diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /filter/source/xslt/import | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'filter/source/xslt/import')
17 files changed, 36487 insertions, 0 deletions
diff --git a/filter/source/xslt/import/common/ms2ooo_docpr.xsl b/filter/source/xslt/import/common/ms2ooo_docpr.xsl new file mode 100644 index 000000000..6a10f93f7 --- /dev/null +++ b/filter/source/xslt/import/common/ms2ooo_docpr.xsl @@ -0,0 +1,92 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v"> + <xsl:template match="o:DocumentProperties"> + <office:meta> + <meta:generator>Microsoft Word 2003</meta:generator> + <dc:title> + <xsl:value-of select="o:Title"/> + </dc:title> + <dc:description> + <xsl:value-of select="o:Description"/> + </dc:description> + <dc:subject> + <xsl:value-of select="o:Subject"/> + </dc:subject> + <meta:initial-creator> + <xsl:value-of select="o:Author"/> + </meta:initial-creator> + <meta:creation-date> + <xsl:value-of select="substring-before( o:Created, 'Z')"/> + </meta:creation-date> + <dc:creator> + <xsl:value-of select="o:LastAuthor"/> + </dc:creator> + <xsl:if test="string-length(substring-before( o:LastSaved, 'Z')) > 0"> + <dc:date> + <xsl:value-of select="substring-before( o:LastSaved, 'Z')"/> + </dc:date> + </xsl:if> + <!-- comment out the below line now because Oasis format doesn't allow the meta:print-by to be empty element --> + <!--meta:printed-by /--> + <xsl:if test="string-length(substring-before( o:LastPrinted, 'Z')) > 0"> + <!-- + <meta:print-date> + <xsl:value-of select="substring-before( o:LastPrinted, 'Z')"/> + </meta:print-date> + --> + </xsl:if> + <meta:keyword> + <xsl:value-of select="o:Keywords"/> + </meta:keyword> + <meta:editing-cycles> + <xsl:value-of select="o:Revision"/> + </meta:editing-cycles> + <meta:editing-duration> + <xsl:if test="o:TotalTime"> + <xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/> + </xsl:if> + </meta:editing-duration> + <meta:user-defined meta:name="Category" meta:value-type="string"> + <xsl:value-of select="o:Category"/> + </meta:user-defined> + <meta:user-defined meta:name="Manager" meta:value-type="string"> + <xsl:value-of select="o:Manager"/> + </meta:user-defined> + <meta:user-defined meta:name="Company" meta:value-type="string"> + <xsl:value-of select="o:Company"/> + </meta:user-defined> + <meta:user-defined meta:name="Version" meta:value-type="string"> + <xsl:value-of select="o:Version"/> + </meta:user-defined> + <meta:user-defined meta:name="HyperlinkBase" meta:value-type="string"> + <xsl:value-of select="o:HyperlinkBase"/> + </meta:user-defined> + <xsl:apply-templates select="../o:CustomDocumentProperties"/> + <meta:document-statistic meta:page-count="{o:Pages}" meta:paragraph-count="{o:Paragraphs}" meta:word-count="{o:Words}" meta:character-count="{o:Characters}"/> + </office:meta> + </xsl:template> + <xsl:template match="o:CustomDocumentProperties"> + <xsl:for-each select="node()[@dt:dt]"> + <meta:user-defined meta:name="{local-name()}" meta:value-type="{@dt:dt}"> + <xsl:value-of select="."/> + </meta:user-defined> + </xsl:for-each> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/spreadsheetml/adorowset2ods.xsl b/filter/source/xslt/import/spreadsheetml/adorowset2ods.xsl new file mode 100644 index 000000000..0d36494d2 --- /dev/null +++ b/filter/source/xslt/import/spreadsheetml/adorowset2ods.xsl @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" + xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" + xmlns:rs="urn:schemas-microsoft-com:rowset" + xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office: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:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" + xmlns:z="#RowsetSchema"> + <xsl:output indent="no" version="1.0" encoding="UTF-8" method="xml"/> + <xsl:template match="/"> + <office:document office:mimetype="application/vnd.oasis.opendocument.spreadsheet" office:version="1.0"> + <xsl:element name="office:body"> + <xsl:element name="office:spreadsheet"> + <!-- Just a single table (sheet) with default name --> + <xsl:element name="table:table"> + <!-- declare columns --> + <xsl:for-each select="./xml/s:Schema/s:ElementType[@name='row']/s:AttributeType"> + <xsl:element name="table:table-column"/> + </xsl:for-each> + <!-- header row from Schema --> + <xsl:element name="table:table-row"> + <xsl:for-each select="./xml/s:Schema/s:ElementType[@name='row']/s:AttributeType"> + <xsl:element name="table:table-cell"> + <xsl:attribute name="office:value-type">string</xsl:attribute> + <xsl:attribute name="calcext:value-type">string</xsl:attribute> + <xsl:element name="text:p"> + <!-- User-readable field name may be defined in optional @rs:name --> + <xsl:choose> + <xsl:when test="./@rs:name"> + <xsl:value-of select="./@rs:name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./@name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:element> + <!-- Now add data itself --> + <xsl:apply-templates select="./xml/rs:data"/> + </xsl:element> + <!-- Add autofilter to the whole range --> + <xsl:element name="table:database-ranges"> + <xsl:element name="table:database-range"> + <xsl:attribute name="table:target-range-address"> + <xsl:call-template name="RangeName"> + <xsl:with-param name="rowStartNum" select="1"/> + <xsl:with-param name="colStartNum" select="1"/> + <xsl:with-param name="rowEndNum" select="count(/xml/rs:data/row)+1"/> + <xsl:with-param name="colEndNum" select="count(/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="table:display-filter-buttons">true</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:element> + </office:document> + </xsl:template> + <xsl:template match="rs:data"> + <xsl:apply-templates select="./row"/> + <xsl:apply-templates select="./z:row"/> + </xsl:template> + <xsl:template match="row|z:row"> + <xsl:element name="table:table-row"> + <!-- Store current row in a variable --> + <xsl:variable name="thisRow" select="."/> + <!-- Get column order from Schema --> + <xsl:for-each select="/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType"> + <xsl:element name="table:table-cell"> + <xsl:variable name="thisColName" select="./@name"/> + <xsl:variable name="thisCellValue"> + <xsl:value-of select="$thisRow/@*[local-name()=$thisColName]"/> + </xsl:variable> + <xsl:if test="string-length($thisCellValue) > 0"> + <xsl:variable name="thisColType"> + <xsl:call-template name="ValTypeFromAttributeType"> + <xsl:with-param name="AttributeTypeNode" select="."/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="office:value-type"><xsl:value-of select="$thisColType"/></xsl:attribute> + <xsl:attribute name="calcext:value-type"><xsl:value-of select="$thisColType"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$thisColType='float'"> + <xsl:attribute name="office:value"><xsl:value-of select="$thisCellValue"/></xsl:attribute> + </xsl:when> + <xsl:when test="$thisColType='date'"> + <!-- We need to convert '2017-04-06 00:40:40' to '2017-04-06T00:40:40', so replace space with 'T' --> + <xsl:attribute name="office:date-value"><xsl:value-of select="translate($thisCellValue,' ','T')"/></xsl:attribute> + </xsl:when> + <xsl:when test="$thisColType='time'"> + <xsl:attribute name="office:time-value"><xsl:value-of select="$thisCellValue"/></xsl:attribute> + </xsl:when> + <xsl:when test="$thisColType='boolean'"> + <xsl:attribute name="office:boolean-value"> + <xsl:choose> + <xsl:when test="$thisCellValue=0">false</xsl:when> + <xsl:otherwise>true</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:element name="text:p"> + <xsl:value-of select="$thisCellValue"/> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <!-- https://msdn.microsoft.com/en-us/library/ms675943 --> + <xsl:template name="ValTypeFromAttributeType"> + <xsl:param name="AttributeTypeNode"/> + <xsl:variable name="thisDataType"> + <xsl:choose> + <xsl:when test="$AttributeTypeNode/@dt:type"><xsl:value-of select="$AttributeTypeNode/@dt:type"/></xsl:when> + <xsl:when test="$AttributeTypeNode/s:datatype"><xsl:value-of select="$AttributeTypeNode/s:datatype/@dt:type"/></xsl:when> + <xsl:otherwise>string</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="XMLDataType2ValType"> + <xsl:with-param name="XMLDataType" select="$thisDataType"/> + </xsl:call-template> + </xsl:template> + <!-- https://www.w3.org/TR/1998/NOTE-XML-data-0105/#API --> + <xsl:template name="XMLDataType2ValType"> + <xsl:param name="XMLDataType"/> + <xsl:choose> + <xsl:when test="$XMLDataType='number'">float</xsl:when> + <xsl:when test="$XMLDataType='int'">float</xsl:when> + <xsl:when test="starts-with($XMLDataType, 'float')">float</xsl:when> + <xsl:when test="starts-with($XMLDataType, 'fixed')">float</xsl:when> + <xsl:when test="$XMLDataType='i1'">float</xsl:when> + <xsl:when test="$XMLDataType='i2'">float</xsl:when> + <xsl:when test="$XMLDataType='i4'">float</xsl:when> + <xsl:when test="$XMLDataType='i8'">float</xsl:when> + <xsl:when test="$XMLDataType='ui1'">float</xsl:when> + <xsl:when test="$XMLDataType='ui2'">float</xsl:when> + <xsl:when test="$XMLDataType='ui4'">float</xsl:when> + <xsl:when test="$XMLDataType='ui8'">float</xsl:when> + <xsl:when test="$XMLDataType='r4'">float</xsl:when> + <xsl:when test="$XMLDataType='r8'">float</xsl:when> + <xsl:when test="$XMLDataType='datetime'">date</xsl:when> + <xsl:when test="starts-with($XMLDataType, 'dateTime')">date</xsl:when> + <xsl:when test="starts-with($XMLDataType, 'date')">date</xsl:when> + <xsl:when test="starts-with($XMLDataType, 'time')">time</xsl:when> + <xsl:when test="$XMLDataType='boolean'">boolean</xsl:when> + <xsl:otherwise>string</xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- A utility to convert a column number (e.g. 27; 1-based) to column name (like AA) --> + <xsl:template name="ColNum2Name"> + <xsl:param name="num"/> + <xsl:if test="$num > 0"> + <xsl:call-template name="ColNum2Name"> + <xsl:with-param name="num" select="floor($num div 26)"/> + </xsl:call-template> + <xsl:choose> + <xsl:when test="$num mod 26 = 1">A</xsl:when> + <xsl:when test="$num mod 26 = 2">B</xsl:when> + <xsl:when test="$num mod 26 = 3">C</xsl:when> + <xsl:when test="$num mod 26 = 4">D</xsl:when> + <xsl:when test="$num mod 26 = 5">E</xsl:when> + <xsl:when test="$num mod 26 = 6">F</xsl:when> + <xsl:when test="$num mod 26 = 7">G</xsl:when> + <xsl:when test="$num mod 26 = 8">H</xsl:when> + <xsl:when test="$num mod 26 = 9">I</xsl:when> + <xsl:when test="$num mod 26 = 10">J</xsl:when> + <xsl:when test="$num mod 26 = 11">K</xsl:when> + <xsl:when test="$num mod 26 = 12">L</xsl:when> + <xsl:when test="$num mod 26 = 13">M</xsl:when> + <xsl:when test="$num mod 26 = 14">N</xsl:when> + <xsl:when test="$num mod 26 = 15">O</xsl:when> + <xsl:when test="$num mod 26 = 16">P</xsl:when> + <xsl:when test="$num mod 26 = 17">Q</xsl:when> + <xsl:when test="$num mod 26 = 18">R</xsl:when> + <xsl:when test="$num mod 26 = 19">S</xsl:when> + <xsl:when test="$num mod 26 = 20">T</xsl:when> + <xsl:when test="$num mod 26 = 21">U</xsl:when> + <xsl:when test="$num mod 26 = 22">V</xsl:when> + <xsl:when test="$num mod 26 = 23">W</xsl:when> + <xsl:when test="$num mod 26 = 24">X</xsl:when> + <xsl:when test="$num mod 26 = 25">Y</xsl:when> + <xsl:otherwise>Z</xsl:otherwise><!-- 0 --> + </xsl:choose> + </xsl:if> + </xsl:template> + <!-- A utility to convert a cell address (e.g. row 2, column 27) to cell name (like AA2) --> + <xsl:template name="CellName"> + <xsl:param name="rowNum"/> + <xsl:param name="colNum"/> + <xsl:call-template name="ColNum2Name"> + <xsl:with-param name="num" select="$colNum"/> + </xsl:call-template> + <xsl:value-of select="$rowNum"/> + </xsl:template> + <!-- A utility to convert a range given in terms of numbers (e.g. row 1, column 1 to row 2, column 27) to range name (like A1:AA2) --> + <xsl:template name="RangeName"> + <xsl:param name="rowStartNum"/> + <xsl:param name="colStartNum"/> + <xsl:param name="rowEndNum"/> + <xsl:param name="colEndNum"/> + <xsl:call-template name="CellName"> + <xsl:with-param name="rowNum" select="$rowStartNum"/> + <xsl:with-param name="colNum" select="$colStartNum"/> + </xsl:call-template> + <xsl:text>:</xsl:text> + <xsl:call-template name="CellName"> + <xsl:with-param name="rowNum" select="$rowEndNum"/> + <xsl:with-param name="colNum" select="$colEndNum"/> + </xsl:call-template> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl new file mode 100644 index 000000000..09b01a360 --- /dev/null +++ b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl @@ -0,0 +1,9152 @@ +<?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.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:SL="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exsl="http://exslt.org/common" xmlns:set="http://exslt.org/sets" extension-element-prefixes="set exsl" exclude-result-prefixes="aml dt html o ss SL v w10 w wx x set exsl"> + <!--+++++ INCLUDED XSL MODULES +++++--> + <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)--> + <xsl:import href="../../common/measure_conversion.xsl"/> + <xsl:output indent="no" version="1.0" encoding="UTF-8" method="xml"/> + <xsl:template match="/"> + <office:document office:mimetype="application/vnd.oasis.opendocument.spreadsheet" office:version="1.0"> + <xsl:apply-templates select="ss:Workbook/o:DocumentProperties"/> + <xsl:apply-templates select="ss:Workbook/x:ExcelWorkbook"/> + <xsl:call-template name="font-declaration"/> + <xsl:apply-templates select="ss:Workbook/ss:Worksheet[1]" mode="styles"/> + <xsl:element name="office:body"> + <xsl:element name="office:spreadsheet"> + <xsl:call-template name="set-calculation"/> + <!-- for DataValidation --> + <xsl:if test="ss:Workbook/ss:Worksheet/x:DataValidation"> + <xsl:element name="table:content-validations"> + <xsl:apply-templates select="ss:Workbook/ss:Worksheet/x:DataValidation"/> + </xsl:element> + </xsl:if> + <xsl:apply-templates select="ss:Workbook/ss:Worksheet"/> + <xsl:call-template name="Names"/> + <xsl:element name="table:database-ranges"> + <!-- these descriptions located in every Worksheet in Excel, but at the same path in Calc --> + <xsl:for-each select="ss:Workbook/ss:Worksheet"> + <xsl:apply-templates select="./x:Sorting"/> + <xsl:apply-templates select="./x:AutoFilter"/> + <!-- for Advanced Filter.the position is same as AutoFilter --> + <xsl:if test="./ss:Names/ss:NamedRange and ./ss:Names/ss:NamedRange/@ss:Name='_FilterDatabase'"> + <xsl:call-template name="transform-advanced-filter"> + <xsl:with-param name="target-value" select="substring-after(./ss:Names/ss:NamedRange[@ss:Name='_FilterDatabase']/@ss:RefersTo, '=')"/> + <xsl:with-param name="condition-pos" select="substring-after(./ss:Names/ss:NamedRange[@ss:Name='Criteria']/@ss:RefersTo, '=')"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:element> + </office:document> + </xsl:template> + <xsl:template match="o:DocumentProperties"> + <office:meta> + <meta:generator>Microsoft Excel 2003</meta:generator> + <xsl:if test="o:Title"> + <dc:title> + <xsl:value-of select="o:Title"/> + </dc:title> + </xsl:if> + <xsl:if test="o:Description"> + <dc:description> + <xsl:value-of select="o:Description"/> + </dc:description> + </xsl:if> + <xsl:if test="o:Subject"> + <dc:subject> + <xsl:value-of select="o:Subject"/> + </dc:subject> + </xsl:if> + <xsl:if test="o:Author"> + <meta:initial-creator> + <xsl:value-of select="o:Author"/> + </meta:initial-creator> + </xsl:if> + <xsl:if test="o:Created"> + <meta:creation-date> + <xsl:value-of select="substring-before( o:Created, 'Z')"/> + </meta:creation-date> + </xsl:if> + <xsl:if test="o:LastAuthor"> + <dc:creator> + <xsl:value-of select="o:LastAuthor"/> + </dc:creator> + </xsl:if> + <xsl:if test="o:LastSaved"> + <dc:date> + <xsl:value-of select="substring-before( o:LastSaved, 'Z')"/> + </dc:date> + </xsl:if> + <!-- + <meta:printed-by/> + <meta:print-date/> + <!~~ removed in OASIS Open Office XML + <meta:keywords> + <meta:keyword> + <xsl:value-of select="o:Keywords" /> + </meta:keyword> + </meta:keywords> + ~~> + <dc:language/> + --> + <xsl:if test="o:Revision"> + <meta:editing-cycles> + <xsl:value-of select="o:Revision"/> + </meta:editing-cycles> + </xsl:if> + <xsl:if test="o:TotalTime"> + <meta:editing-duration> + <xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/> + </meta:editing-duration> + </xsl:if> + <xsl:if test="o:Category"> + <meta:user-defined meta:name="Category"> + <xsl:value-of select="o:Category"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="o:Manager"> + <meta:user-defined meta:name="Manager"> + <xsl:value-of select="o:Manager"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="o:Company"> + <meta:user-defined meta:name="Company"> + <xsl:value-of select="o:Company"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="o:Version"> + <meta:user-defined meta:name="Version"> + <xsl:value-of select="o:Version"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="o:HyperlinkBase"> + <meta:user-defined meta:name="HyperlinkBase"> + <xsl:value-of select="o:HyperlinkBase"/> + </meta:user-defined> + </xsl:if> + <xsl:apply-templates select="../o:CustomDocumentProperties"/> + <!--Note: <meta:document-statistic/>--> + </office:meta> + </xsl:template> + <xsl:template match="o:CustomDocumentProperties"> + <xsl:for-each select="node()[@dt:dt]"> + <meta:user-defined meta:name="{name()}"> + <xsl:value-of select="."/> + </meta:user-defined> + </xsl:for-each> + </xsl:template> + <xsl:template match="x:ExcelWorkbook"> + <!-- Configuration in 'ooo:view-settings' and 'ooo:configuration-settings' + "GridColor" + "HasColumnRowHeaders" + "HasSheetTabs" + "IsOutlineSymbolsSet" + "IsRasterAxisSynchronized" + "IsSnapToRaster" + "RasterIsVisible" + "RasterResolutionX" + "RasterResolutionY" + "RasterSubdivisionX" + "RasterSubdivisionY" + "ShowGrid" + "ShowNotes" + "ShowPageBreaks" + "ShowZeroValues" + --> + <xsl:variable name="sharedConfiguration"> + <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:GridlineColor"> + <config:config-item config:name="GridColor" config:type="long"> + <xsl:variable name="temp-code" select="substring-after(normalize-space(../ss:Worksheet/x:WorksheetOptions/x:GridlineColor), '#')"/> + <xsl:variable name="temp-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$temp-code"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="string-length($temp-code)"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$temp-value"/> + </config:config-item> + </xsl:if> + <xsl:choose> + <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayHeadings"> + <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">false</config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="x:HideWorkbookTabs"> + <config:config-item config:name="HasSheetTabs" config:type="boolean">false</config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayOutline"> + <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">false</config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayGridlines"> + <config:config-item config:name="ShowGrid" config:type="boolean">false</config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayZeros"> + <config:config-item config:name="ShowZeroValues" config:type="boolean">false</config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:type="int" config:name="VisibleAreaTop"> + <xsl:value-of select="x:WindowTopY"/> + </config:config-item> + <config:config-item config:name="VisibleAreaLeft" config:type="int"> + <xsl:value-of select="x:WindowTopX"/> + </config:config-item> + <config:config-item config:name="VisibleAreaWidth" config:type="int"> + <xsl:value-of select="x:WindowWidth"/> + </config:config-item> + <config:config-item config:name="VisibleAreaHeight" config:type="int"> + <xsl:value-of select="x:WindowHeight"/> + </config:config-item> + <xsl:variable name="ratio" select="15"/> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">View1</config:config-item> + <config:config-item-map-named config:name="Tables"> + <!-- The panes of a table is like 3 | 1 or 3 | 1, or 3 , while 3 is the default one. glu + - - - - - - - + 2 | 0 2 --> + <xsl:for-each select="../ss:Worksheet"> + <config:config-item-map-entry config:name="{@ss:Name}"> + <xsl:variable name="active-pane"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:ActivePane"> + <xsl:value-of select="x:WorksheetOptions/x:ActivePane"/> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <xsl:if test="not( $active-pane = '' ) and ( x:WorksheetOptions/x:SplitVertical or x:WorksheetOptions/x:SplitHorizontal )"> + <config:config-item config:name="ActiveSplitRange" config:type="short"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:SplitVertical and not(x:WorksheetOptions/x:SplitHorizontal)"> + <xsl:value-of select="'3'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$active-pane"/> + </xsl:otherwise> + </xsl:choose> + </config:config-item> + </xsl:if> + <xsl:choose> + <xsl:when test="not( $active-pane = '')"> + <config:config-item config:name="CursorPositionX" config:type="int"> + <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane[x:Number = $active-pane ]/x:ActiveCol"/> + </config:config-item> + <config:config-item config:name="CursorPositionY" config:type="int"> + <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane[x:Number = $active-pane ]/x:ActiveRow"/> + </config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="CursorPositionX" config:type="int"> + <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane/x:ActiveCol"/> + </config:config-item> + <config:config-item config:name="CursorPositionY" config:type="int"> + <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane/x:ActiveRow"/> + </config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="position-left"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:LeftColumnVisible"> + <xsl:value-of select="x:WorksheetOptions/x:LeftColumnVisible"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <config:config-item config:name="PositionLeft" config:type="int"> + <xsl:value-of select="$position-left"/> + </config:config-item> + <xsl:variable name="position-top"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:TopRowVisible"> + <xsl:value-of select="x:WorksheetOptions/x:TopRowVisible"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:SplitVertical and not(x:WorksheetOptions/x:SplitHorizontal)"> + <config:config-item config:name="PositionBottom" config:type="int"> + <xsl:value-of select="$position-top"/> + </config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="PositionTop" config:type="int"> + <xsl:value-of select="$position-top"/> + </config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:SplitVertical"> + <config:config-item config:name="HorizontalSplitMode" config:type="short"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:FreezePanes">2</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </config:config-item> + <config:config-item config:name="HorizontalSplitPosition" config:type="int"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:FreezePanes"> + <xsl:value-of select="x:WorksheetOptions/x:SplitVertical + $position-left"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="floor( x:WorksheetOptions/x:SplitVertical div $ratio )"/> + </xsl:otherwise> + </xsl:choose> + </config:config-item> + <config:config-item config:name="PositionRight" config:type="int"> + <xsl:value-of select="x:WorksheetOptions/x:LeftColumnRightPane"/> + </config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:SplitHorizontal"> + <config:config-item config:name="VerticalSplitMode" config:type="short"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:FreezePanes">2</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </config:config-item> + <config:config-item config:name="VerticalSplitPosition" config:type="int"> + <xsl:choose> + <xsl:when test="x:WorksheetOptions/x:FreezePanes"> + <xsl:value-of select="x:WorksheetOptions/x:SplitHorizontal + $position-top"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="floor( x:WorksheetOptions/x:SplitHorizontal div $ratio )"/> + </xsl:otherwise> + </xsl:choose> + </config:config-item> + <config:config-item config:name="PositionBottom" config:type="int"> + <xsl:value-of select="x:WorksheetOptions/x:TopRowBottomPane"/> + </config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item> + </xsl:otherwise> + </xsl:choose> + <xsl:copy-of select="$sharedConfiguration"/> + <xsl:if test="x:WorksheetOptions/x:TabColorIndex"> + <config:config-item config:name="TabColor" config:type="int"> + <xsl:variable name="temp-value"> + <xsl:call-template name="colorindex2decimal"> + <xsl:with-param name="colorindex" select="x:WorksheetOptions/x:TabColorIndex"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$temp-value"/> + </config:config-item> + </xsl:if> + </config:config-item-map-entry> + </xsl:for-each> + </config:config-item-map-named> + <xsl:if test="x:ActiveSheet"> + <config:config-item config:name="ActiveTable" config:type="string"> + <xsl:value-of select="../ss:Worksheet[/ss:Workbook/x:ExcelWorkbook/x:ActiveSheet+1]/@ss:Name"/> + </config:config-item> + </xsl:if> + <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">555</config:config-item> + <!-- following are some table setting from Excel, but transformed to global setting, due to limit of Calc --> + <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:ShowPageBreakZoom"> + <config:config-item config:name="ShowPageBreakPreview" config:type="boolean">true</config:config-item> + </xsl:if> + <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:PageBreakZoom"> + <config:config-item config:name="PageViewZoomValue" config:type="int"> + <xsl:value-of select="../ss:Worksheet/x:WorksheetOptions/x:PageBreakZoom"/> + </config:config-item> + </xsl:if> + <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:Zoom"> + <config:config-item config:name="ZoomValue" config:type="int"> + <xsl:value-of select="../ss:Worksheet/x:WorksheetOptions/x:Zoom"/> + </config:config-item> + </xsl:if> + <!-- several properties are not saved in Calc XML but setting, whereas vice versa. :( So just to be expanded, glu --> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + <config:config-item-set config:name="ooo:configuration-settings"> + <xsl:copy-of select="$sharedConfiguration"/> + </config:config-item-set> + <!-- printer setting, not finished yet. glu + <config:config-item-set config:name="configuration-settings" /> + --> + </office:settings> + </xsl:template> + + <xsl:variable name="allFontDefs"><xsl:for-each select="/ss:Workbook/ss:Styles/ss:Style/ss:Font[@ss:FontName or @x:Family]|/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell/descendant::html:Font[@html:Face or @x:Family]"><f><xsl:copy-of select="@ss:FontName |@html:Face | @x:Family"/><xsl:value-of select="concat(@ss:FontName, @html:Face, '	', @x:Family)"/></f></xsl:for-each></xsl:variable> + + <xsl:template name="font-declaration"> + <xsl:variable name="distinctFontDefs"> + <xsl:choose> + <!-- saxon dropped support for exslt:sets#distinct() in version 8.2, but is capable of executing XPath 2.0 functions --> + <xsl:when test="function-available('set:distinct')"><xsl:copy-of select="set:distinct(exsl:node-set($allFontDefs)/*)"/></xsl:when> + <xsl:otherwise><xsl:call-template name="set:distinct"><xsl:with-param name="nodes" select="$allFontDefs"></xsl:with-param></xsl:call-template></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <office:font-face-decls> + <xsl:if test="count(exsl:node-set($distinctFontDefs))"> + <xsl:for-each select="exsl:node-set($distinctFontDefs)/*"> + <style:font-face> + <xsl:if test="@ss:FontName or @html:Face"> + <xsl:attribute name="style:name"> + <xsl:value-of select="@ss:FontName | @html:Face"/> + </xsl:attribute> + <xsl:attribute name="svg:font-family"> + <xsl:value-of select="@ss:FontName | @html:Face "/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@x:Family"> + <xsl:attribute name="style:font-family-generic"> + <xsl:call-template name="translate-font-family-generic"> + <xsl:with-param name="family" select="@x:Family"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </style:font-face> + </xsl:for-each> + </xsl:if> + </office:font-face-decls> + </xsl:template> + <xsl:template name="translate-font-family-generic"> + <xsl:param name="family"/> + <xsl:choose> + <xsl:when test="$family='Swiss'">swiss</xsl:when> + <xsl:when test="$family='Modern'">modern</xsl:when> + <xsl:when test="$family='Roman'">roman</xsl:when> + <xsl:when test="$family='Script'">script</xsl:when> + <xsl:when test="$family='Decorative'">decorative</xsl:when> + <!-- change 'System' to 'Automatic' for Excel --> + <xsl:when test="$family='Automatic'">system</xsl:when> + <xsl:otherwise>system</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ss:Workbook/ss:Worksheet" mode="styles"> + <office:styles> + <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[@ss:Name]"/> + <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style/ss:NumberFormat[@ss:Format]"/> + <!-- if ConditionalFormatting exists,it should generate some styles for style:style --> + <xsl:if test="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting"> + <xsl:call-template name="CondFormat_office_style"/> + </xsl:if> + </office:styles> + <office:automatic-styles> + <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/ss:Table"/> + <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[not(@ss:Name)]"/> + <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style/ss:Font[@ss:VerticalAlign]"/> + <!-- applying to ss:Data (but *, as also ss:Data nested in ss:Comments --> + <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell/*[descendant-or-self::*]"/> + <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions/x:PageSetup//@x:Data"/> + <!-- if ConditionalFormatting exists,transforing the styles --> + <xsl:if test="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting"> + <xsl:call-template name="CondFormat_automatic_style"/> + </xsl:if> + <xsl:call-template name="create-page-master"> + <xsl:with-param name="worksheetoptions" select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions"/> + </xsl:call-template> + </office:automatic-styles> + <office:master-styles> + <xsl:call-template name="create-master-styles"> + <xsl:with-param name="worksheetoptions" select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions"/> + </xsl:call-template> + </office:master-styles> + </xsl:template> + <xsl:template name="CondFormat_office_style"> + <!-- translate the ConditionalFormatting style,including font,size,color,etc --> + <xsl:for-each select="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting"> + <xsl:variable name="table-pos" select="count(../preceding-sibling::ss:Worksheet)+1"/> + <xsl:variable name="conditions" select="count(preceding-sibling::x:ConditionalFormatting)+1"/> + <!-- Matching multiple styles, but automatic styles are not allowed to inherit from another automatic style + <xsl:for-each select="key('tableStyleIDs', key('tableWithConditional', .)) + [generate-id(.) = + generate-id(key('styleId', .)[1])] "> + <xsl:sort select="." /> + + <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[@ss:ID = current()/.]"/> + </xsl:for-each> + --> + <xsl:for-each select="x:Condition"> + <xsl:variable name="condition-number" select="count(preceding-sibling::x:Condition)+1"/> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:apply-templates select="@ss:Name" /> + <xsl:element name="style:table-cell-properties"> + <xsl:choose> + <xsl:when test="x:Format/@Style"> + <xsl:variable name="stylevalue" select="./x:Format/@Style"/> + <xsl:call-template name="recursion-condformat-style-table-cell"> + <xsl:with-param name="style-value-t"> + <xsl:choose> + <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'"> + <xsl:value-of select="concat($stylevalue,';')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$stylevalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:choose> + <xsl:when test="x:Format/@Style"> + <xsl:variable name="stylevalue" select="./x:Format/@Style"/> + <xsl:call-template name="recursion-condformat-style-text"> + <xsl:with-param name="style-value-t"> + <xsl:choose> + <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'"> + <xsl:value-of select="concat($stylevalue,';')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$stylevalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:font-style"> + <xsl:value-of select="'italic'"/> + </xsl:attribute> + <xsl:attribute name="style:text-underline-type"> + <xsl:value-of select="'single'"/> + </xsl:attribute> + <xsl:attribute name="style:text-underline-color"> + <xsl:value-of select="'font-color'"/> + </xsl:attribute> + <xsl:attribute name="fo:font-weight"> + <xsl:value-of select="'bold'"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + <xsl:template match="@ss:Name"> + <xsl:attribute name="style:display-name"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:template> + <xsl:template name="recursion-condformat-style-table-cell"> + <!-- generates style:style for ConditionalFormatting --> + <xsl:param name="style-value-t"/> + <xsl:variable name="style-value" select="normalize-space($style-value-t)"/> + <xsl:choose> + <xsl:when test="starts-with($style-value,'background')"> + <xsl:choose> + <xsl:when test="contains($style-value,'mso-pattern')"> + <xsl:variable name="color-value"> + <xsl:call-template name="translate-color-style"> + <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="mso-value"> + <xsl:call-template name="translate-color-style"> + <xsl:with-param name="source-str" select="normalize-space(substring-after($style-value,'mso-pattern'))"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="mso-color" select="substring-after($mso-value,'#')"/> + <xsl:variable name="pattern-color-value" select="substring($mso-color,1,6)"/> + <xsl:variable name="pattern" select="concat('0.',normalize-space(substring-before(substring-after($mso-color,'gray-'),';')))"/> + <xsl:variable name="pattern-color"> + <xsl:call-template name="cell-pattern-color"> + <xsl:with-param name="pattern" select="$pattern"/> + <xsl:with-param name="color-value" select="$color-value"/> + <xsl:with-param name="pattern-color-value" select="concat('#',$pattern-color-value)"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:background-color"> + <xsl:value-of select="normalize-space($pattern-color)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:background-color"> + <xsl:call-template name="translate-color-style"> + <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($style-value,'border')"> + <xsl:attribute name="fo:border"> + <xsl:value-of select="'0.002cm solid #000000'"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="contains($style-value,':')"> + <xsl:call-template name="recursion-condformat-style-table-cell"> + <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="recursion-condformat-style-text"> + <!-- generates style:style for ConditionalFormatting --> + <xsl:param name="style-value-t"/> + <xsl:variable name="style-value" select="normalize-space($style-value-t)"/> + <xsl:choose> + <xsl:when test="starts-with($style-value,'color')"> + <xsl:attribute name="fo:color"> + <xsl:call-template name="translate-color-style"> + <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + </xsl:call-template> + </xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-value,'font-style')"> + <xsl:attribute name="fo:font-style"> + <xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-value,'font-weight')"> + <xsl:variable name="font-weight" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + <xsl:attribute name="fo:font-weight"> + <xsl:choose> + <xsl:when test="($font-weight > 300) and ($font-weight < 500)"> + <xsl:value-of select="'normal'"/> + </xsl:when> + <xsl:when test="($font-weight > 500) or ($font-weight = 500)"> + <xsl:value-of select="'bold'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'0'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-value,'text-underline-style')"> + <xsl:attribute name="style:text-underline-type"> + <xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + </xsl:attribute> + <xsl:attribute name="style:text-underline-color"> + <xsl:value-of select="'#000000'"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="contains($style-value,':')"> + <xsl:call-template name="recursion-condformat-style-text"> + <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="translate-color-style"> + <!-- translate the word of color to hex code of color --> + <xsl:param name="source-str"/> + <xsl:choose> + <xsl:when test="starts-with($source-str,'#')"> + <xsl:value-of select="$source-str"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="starts-with($source-str,'black')"> + <xsl:value-of select="'#000000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'maroon')"> + <xsl:value-of select="'#800000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'red')"> + <xsl:value-of select="'#FF0000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'fuchsia')"> + <xsl:value-of select="'#FF00FF'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'olive')"> + <xsl:value-of select="'#808000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'yellow')"> + <xsl:value-of select="'#FFFF00'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'green')"> + <xsl:value-of select="'#008000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'lime')"> + <xsl:value-of select="'#00FF00'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'teal')"> + <xsl:value-of select="'#008080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'aqua')"> + <xsl:value-of select="'#00FFFF'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'navy')"> + <xsl:value-of select="'#000080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'blue')"> + <xsl:value-of select="'#0000FF'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'purple')"> + <xsl:value-of select="'#800080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'gray')"> + <xsl:value-of select="'#808080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'silver')"> + <xsl:value-of select="'#C0C0C0'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'white')"> + <xsl:value-of select="'#FFFFFF'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'#FFFFFF'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:key name="definedStyleIds" match="/ss:Workbook/ss:Styles/ss:Style/@ss:ID" use="string(.)"/> + <xsl:variable name="defaultStyle" select="/ss:Workbook/ss:Styles/ss:Style[@ss:ID='Default']/@ss:ID"></xsl:variable> + <xsl:key name="styleId" match="@ss:StyleID" use="."/> + <xsl:template name="CondFormat_automatic_style"> + <!-- For each conditionalFormatting We inject a new style, which is a child of the current found style --> + <xsl:for-each select="/ss:Workbook/ss:Worksheet[x:ConditionalFormatting]"> + <xsl:variable name="table-pos" select="count(preceding-sibling::ss:Worksheet)+1"/> + <xsl:variable name="styleIdsUsedByTable" select="$defaultStyle | key('definedStyleIds', ss:Table/ss:Row/ss:Cell/@ss:StyleID)"/> + <xsl:for-each select="x:ConditionalFormatting"> + <xsl:variable name="conditions" select="position()"/> + <xsl:variable name="conditionalFormatting" select="."/> + <!-- we want to loop over the distinct styleId attribute values of all cells within the table related to the current conditional formatting. --> + <!-- We'd need to add the anonymous style id "Default" to the mix. --> + <!-- for all 'ssStyle/@ss:ID's, which are in tables connected within this conditional formatting --> + <!-- <xsl:for-each select="key('tableStyleIDs', generate-id(preceding-sibling::ss:Table)) [generate-id(.) = generate-id(key('styleId', .)[1])] "> --> + <xsl:for-each select="$styleIdsUsedByTable"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="concat(.,'-ce',$table-pos,'-',$conditions)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:variable name="style" select="key('Style', .)" /> + <xsl:choose> + <xsl:when test="$style/@ss:Name"> + <xsl:attribute name="style:parent-style-name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="."/> + </xsl:call-template> + </xsl:attribute> + </xsl:when> + <!-- as we create an automatic style, the parent is not allowed to be an automatic style as well + if the parent would be an automatic (unnamed) style, the style information have to be embedded to this style --> + <xsl:otherwise> + <xsl:attribute name="style:parent-style-name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="$style/@ss:Parent"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="$style/ss:NumberFormat/@ss:Format"> + <xsl:attribute name="style:data-style-name"> + <xsl:value-of select="concat($style/@ss:ID, 'F')"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates select="$style" mode="style-style-content"/> + </xsl:otherwise> + </xsl:choose> + <xsl:for-each select="$conditionalFormatting/x:Condition"> + <xsl:variable name="condition-number" select="count(preceding-sibling::x:Condition)+1"/> + <xsl:variable name="base-address"> + <xsl:choose> + <xsl:when test="contains(../x:Range,',')"> + <xsl:choose> + <xsl:when test="contains(substring-before(../x:Range,','),':')"> + <xsl:value-of select="substring-before(substring-after(../x:Range,':'),',')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(../x:Range,',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="../x:Range"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="columnNumber"> + <xsl:choose> + <xsl:when test="contains($base-address, ':')"> + <xsl:value-of select="substring-after(substring-after($base-address, ':'),'C')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($base-address,'C')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rowNumber"> + <xsl:choose> + <xsl:when test="contains($base-address, ':')"> + <xsl:value-of select="substring-before(substring-after(substring-after($base-address, ':'),'R'),'C')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(substring-after($base-address,'R'),'C')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="base-cell-address"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="$columnNumber"/> + <xsl:with-param name="row-number" select="$rowNumber"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="condition-value"> + <xsl:call-template name="translate-condition"> + <xsl:with-param name="cell-column-pos" select="$columnNumber"/> + <xsl:with-param name="cell-row-pos" select="$rowNumber"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="style:map"> + <xsl:attribute name="style:condition"> + <xsl:value-of select="$condition-value"/> + </xsl:attribute> + <xsl:attribute name="style:apply-style-name"> + <xsl:value-of select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/> + </xsl:attribute> + <xsl:attribute name="style:base-cell-address"> + <xsl:value-of select="concat(../../@ss:Name,'.',$base-cell-address)"/> + </xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + <xsl:template name="translate-condition"> + <xsl:param name="cell-row-pos"/> + <xsl:param name="cell-column-pos"/> + <!-- translates the condition to generate formula --> + <xsl:variable name="address-value"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="x:Value1"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="x:Qualifier"> + <xsl:variable name="qualifier" select="x:Qualifier"/> + <xsl:variable name="first-value" select="x:Value1"/> + <xsl:choose> + <xsl:when test="$qualifier = 'Between'"> + <xsl:variable name="second-value"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="x:Value2"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat('cell-content-is-between(',$address-value,',',$second-value,')')"/> + </xsl:when> + <xsl:when test="$qualifier = 'NotBetween'"> + <xsl:variable name="second-value"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="x:Value2"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat('cell-content-is-not-between(',$address-value,',',$second-value,')')"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="translatedQualifier"> + <xsl:choose> + <xsl:when test="$qualifier = 'Equal'">=</xsl:when> + <xsl:when test="$qualifier = 'Less'"><</xsl:when> + <xsl:when test="$qualifier = 'Greater'">></xsl:when> + <xsl:when test="$qualifier = 'LessOrEqual'"><=</xsl:when> + <xsl:when test="$qualifier = 'GreaterOrEqual'">>=</xsl:when> + <xsl:when test="$qualifier = 'NotEqual'">!=</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('cell-content()', $translatedQualifier, $address-value)"/> + </xsl:otherwise> + + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('is-true-formula(',$address-value,')')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- Used in case of 'style:map', conditional formatting, where a style references to another --> + <xsl:key match="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell" name="cells" use="@ss:StyleID"/> + <xsl:template match="ss:NumberFormat"> + <xsl:variable name="unit-count" select="string-length(@ss:Format) - string-length(translate(@ss:Format,';','')) + 1"/> + <xsl:variable name="proto-style-id" select="../@ss:ID"/> + <xsl:call-template name="process-number-format-unit"> + <xsl:with-param name="number-format-unit" select="@ss:Format"/> + <xsl:with-param name="style-id" select="concat($proto-style-id,'F')"/> + <xsl:with-param name="format-type" select="key('cells', $proto-style-id)/ss:Data/@ss:Type"/> + <xsl:with-param name="total-unit" select="$unit-count"/> + <xsl:with-param name="current-unit" select="0"/> + </xsl:call-template> + </xsl:template> + <!-- Note: conditions appearing only once at the beginning are mixed with others --> + <xsl:template name="process-number-format-unit"> + <xsl:param name="number-format-unit"/> + <xsl:param name="style-id"/> + <xsl:param name="format-type"/> + <xsl:param name="total-unit"/> + <xsl:param name="current-unit"/> + <xsl:choose> + <!-- if total-unit > 1 and the last unit is just @, delete it --> + <xsl:when test="$current-unit = 0 and $total-unit > 1 and substring( $number-format-unit, string-length($number-format-unit) - 1) = ';@'"> + <xsl:call-template name="process-number-format-unit"> + <xsl:with-param name="number-format-unit" select="substring( $number-format-unit, 1, string-length($number-format-unit) - 2)"/> + <xsl:with-param name="style-id" select="$style-id"/> + <xsl:with-param name="format-type" select="$format-type"/> + <xsl:with-param name="total-unit" select="$total-unit - 1"/> + <xsl:with-param name="current-unit" select="0"/> + </xsl:call-template> + </xsl:when> + <!-- $number-format-unit enum values: General, General Number, General Date, Long Date, Medium Date, Short Date, Long Time, + Medium Time, Short Time, Currency, Euro Currency, Fixed, Standard, Percent, Scientific, Yes/No, True/False, On/Off --> + <xsl:when test="$number-format-unit = 'Currency'"> + <number:currency-style style:name="{concat( $style-id, 'P1')}" style:volatile="true"> + <number:text>$</number:text> + <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/> + </number:currency-style> + <number:currency-style style:name="{$style-id}"> + <style:text-properties fo:color="#ff0000"/> + <number:text>$-</number:text> + <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/> + <style:map style:condition="value()>=0" style:apply-style-name="{concat( $style-id, 'P1')}"/> + </number:currency-style> + </xsl:when> + <xsl:when test="$number-format-unit = 'Euro Currency'"> + <number:currency-style style:name="{concat( $style-id, 'P1')}" style:volatile="true"> + <number:text>€ </number:text> + <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/> + </number:currency-style> + <number:currency-style style:name="{$style-id}"> + <style:text-properties fo:color="#ff0000"/> + <number:text>(€ </number:text> + <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/> + <number:text>)</number:text> + <style:map style:condition="value()>=0" style:apply-style-name="{concat( $style-id, 'P1')}"/> + </number:currency-style> + </xsl:when> + <xsl:when test="$number-format-unit = 'Yes/No' or $number-format-unit = 'True/False' or $number-format-unit = 'On/Off'"> + <xsl:variable name="left-code" select="substring-before( $number-format-unit, '/')"/> + <xsl:variable name="right-code" select="substring-after( $number-format-unit, '/')"/> + <number:number-style style:name="{concat( $style-id, 'P1')}" style:volatile="true"> + <number:text> + <xsl:value-of select="$left-code"/> + </number:text> + </number:number-style> + <number:number-style style:name="{concat( $style-id, 'P2')}" style:volatile="true"> + <number:text> + <xsl:value-of select="$left-code"/> + </number:text> + </number:number-style> + <number:number-style style:name="{$style-id}"> + <number:text> + <xsl:value-of select="$right-code"/> + </number:text> + <style:map style:condition="value()>0" style:apply-style-name="{concat( $style-id, 'P1')}"/> + <style:map style:condition="value()<0" style:apply-style-name="{concat( $style-id, 'P2')}"/> + </number:number-style> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$total-unit > 1 and $current-unit = 0"> + <!-- still complete number format string of multiple sub-formats, split them out --> + <xsl:call-template name="process-number-format-unit"> + <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/> + <xsl:with-param name="style-id" select="concat($style-id,'P1')"/> + <xsl:with-param name="format-type" select="$format-type"/> + <xsl:with-param name="total-unit" select="$total-unit"/> + <xsl:with-param name="current-unit" select="1"/> + </xsl:call-template> + <xsl:if test="$total-unit > 2"> + <xsl:call-template name="process-number-format-unit"> + <xsl:with-param name="number-format-unit" select="substring-before(substring-after($number-format-unit,';'),';')"/> + <xsl:with-param name="style-id" select="concat($style-id,'P2')"/> + <xsl:with-param name="format-type" select="$format-type"/> + <xsl:with-param name="total-unit" select="$total-unit"/> + <xsl:with-param name="current-unit" select="2"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$total-unit > 3"> + <!-- four sub number format --> + <xsl:call-template name="process-number-format-unit"> + <xsl:with-param name="number-format-unit" select="substring-before(substring-after(substring-after($number-format-unit,';'),';'),';')"/> + <xsl:with-param name="style-id" select="concat($style-id,'P3')"/> + <xsl:with-param name="format-type" select="$format-type"/> + <xsl:with-param name="total-unit" select="$total-unit"/> + <xsl:with-param name="current-unit" select="3"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + <!-- symbol number format converted, below deal with ordinary number formatting --> + <xsl:variable name="current-number-format-unit"> + <xsl:choose> + <xsl:when test="$total-unit = 1 and $current-unit = 0"> + <xsl:value-of select="$number-format-unit"/> + </xsl:when> + <xsl:when test="$total-unit = 2 and $current-unit = 0"> + <xsl:value-of select="substring-after($number-format-unit,';')"/> + </xsl:when> + <xsl:when test="$total-unit = 3 and $current-unit = 0"> + <xsl:value-of select="substring-after(substring-after($number-format-unit,';'),';')"/> + </xsl:when> + <xsl:when test="$current-unit = 0"> + <!-- the forth sub number format --> + <xsl:value-of select="substring-after(substring-after(substring-after($number-format-unit,';'),';'),';')"/> + </xsl:when> + <xsl:otherwise> + <!-- not the default sub number format, glu --> + <xsl:value-of select="$number-format-unit"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style-type-name"> + <xsl:choose> + <xsl:when test="($format-type = 'Number' and contains($current-number-format-unit,'[$') and not(contains($current-number-format-unit,'[$-') ) ) or contains($current-number-format-unit,'Currency') ">number:currency-style</xsl:when> + <xsl:when test="($format-type = 'Number' and (contains($current-number-format-unit,'%') or contains($current-number-format-unit, 'Percent') ) ) or contains($current-number-format-unit,'Percent') ">number:percentage-style</xsl:when> + <xsl:when test="($format-type = 'DateTime' or $format-type = 'String') and (contains($current-number-format-unit,'y') or contains($current-number-format-unit,'g') or contains($current-number-format-unit,'d') or contains($current-number-format-unit, 'Date') )">number:date-style</xsl:when> + <xsl:when test="($format-type = 'DateTime' or $format-type = 'String') and ( contains($current-number-format-unit,'h') or contains($current-number-format-unit,'m') or contains($current-number-format-unit,'s') or contains($current-number-format-unit, 'Time') )">number:time-style</xsl:when> + <xsl:when test="contains($current-number-format-unit, 'Number') or contains($current-number-format-unit, 'General') or contains($current-number-format-unit, 'Fixed') or contains($current-number-format-unit, 'Standard') or contains($current-number-format-unit, 'Scientific') or ( contains($current-number-format-unit,'#') or contains($current-number-format-unit,'0') or contains($current-number-format-unit,'?') )">number:number-style</xsl:when> + <xsl:when test="$format-type = 'Boolean'">number:boolean-style</xsl:when> + <xsl:otherwise>number:text-style</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="{$style-type-name}"> + <xsl:attribute name="style:name"> + <xsl:value-of select="$style-id"/> + </xsl:attribute> + <xsl:apply-templates select="@ss:Name" /> + <!-- removed in OASIS XML + <xsl:attribute name="style:family">data-style</xsl:attribute>--> + <xsl:if test="$current-unit > 0"> + <xsl:attribute name="style:volatile">true</xsl:attribute> + </xsl:if> + <xsl:if test="contains ( $current-number-format-unit, '[h]') or contains ( $current-number-format-unit, '[m]') or contains ( $current-number-format-unit, '[s]')"> + <xsl:attribute name="number:truncate-on-overflow">false</xsl:attribute> + </xsl:if> + <xsl:if test="contains($current-number-format-unit,'[$') or contains($current-number-format-unit, '[DBNum')"> + <xsl:call-template name="create-language-country-attribute"> + <xsl:with-param name="attribute-code" select="substring-before(substring-after(substring-after($current-number-format-unit,'[$'),'-'),']')"/> + <xsl:with-param name="number-code-style" select="substring-before( substring-after($current-number-format-unit,'[DBNum'),']')"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="contains( $current-number-format-unit, '[')"> + <xsl:element name="style:text-properties"> + <xsl:choose> + <xsl:when test="contains( $current-number-format-unit, '[Red')"> + <xsl:attribute name="fo:color">#ff0000</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $current-number-format-unit, '[Black')"> + <xsl:attribute name="fo:color">#000000</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $current-number-format-unit, '[Blue')"> + <xsl:attribute name="fo:color">#0000ff</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $current-number-format-unit, '[Cyan')"> + <xsl:attribute name="fo:color">#00ffff</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $current-number-format-unit, '[Green')"> + <xsl:attribute name="fo:color">#00ff00</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $current-number-format-unit, '[Magenta')"> + <xsl:attribute name="fo:color">#ff00ff</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $current-number-format-unit, '[White')"> + <xsl:attribute name="fo:color">#ffffff</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $current-number-format-unit, '[Yellow')"> + <xsl:attribute name="fo:color">#ffff00</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <!-- the type of condition-pos:1,the former third part of General; 2, the last General. the methods handling different --> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$current-number-format-unit"/> + <xsl:with-param name="unit-pos" select="1"/> + <xsl:with-param name="condition-pos"> + <xsl:choose> + <xsl:when test="$current-unit = 1 or $current-unit = 2 or $current-unit = 3"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:when test="$current-unit = 0 and not(contains($number-format-unit, ';'))"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + <!-- create style:map for other sub number formats --> + <xsl:if test="$current-unit = 0 and $total-unit > 1"> + <xsl:variable name="style-condition1"> + <xsl:call-template name="get-number-format-condition"> + <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($style-condition1) > 0"> + <style:map style:condition="{concat('value()',$style-condition1)}" style:apply-style-name="{concat($style-id,'P1')}"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$total-unit = 2"> + <style:map style:condition="value()>=0" style:apply-style-name="{concat($style-id,'P1')}"/> + </xsl:when> + <xsl:otherwise> + <style:map style:condition="value()>0" style:apply-style-name="{concat($style-id,'P1')}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$total-unit > 2"> + <xsl:variable name="style-condition2"> + <xsl:call-template name="get-number-format-condition"> + <xsl:with-param name="number-format-unit" select="substring-before(substring-after($number-format-unit,';'),';')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($style-condition2) > 0"> + <style:map style:condition="{concat('value()',$style-condition2)}" style:apply-style-name="{concat($style-id,'P2')}"/> + </xsl:when> + <xsl:otherwise> + <style:map style:condition="value()<0" style:apply-style-name="{concat($style-id,'P2')}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$total-unit > 3"> + <!-- four sub number formats, glu --> + <xsl:variable name="style-condition3"> + <xsl:call-template name="get-number-format-condition"> + <xsl:with-param name="number-format-unit" select="substring-before(substring-after(substring-after($number-format-unit,';'),';'),';')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($style-condition3) > 0"> + <style:map style:condition="{concat('value()',$style-condition3)}" style:apply-style-name="{concat($style-id,'P3')}"/> + </xsl:when> + <xsl:otherwise> + <style:map style:condition="value()=0" style:apply-style-name="{concat($style-id,'P3')}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:if> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="create-language-country-attribute"> + <xsl:param name="attribute-code"/> + <xsl:param name="number-code-style"/> + <!-- convert Microsoft List of Locale ID (LCID) to language and country codes according to ISO-639 and ISO-3166. + Reference: + http://www.loc.gov/standards/iso639-2/langcodes.html + http://etext.lib.virginia.edu/tei/iso639.html + http://nl.ijs.si/gnusl/cee/std/ISO_3166.html + http://xml.coverpages.org/ripe3166.txt + http://www.worldlanguage.com/ + http://www.ethnologue.com/ + glu --> + <!-- the variables of language-country-code and number-shape-code transformed to decimal format --> + <xsl:variable name="language-country-code"> + <xsl:variable name="temp-code"> + <xsl:choose> + <xsl:when test="string-length($attribute-code) <= 4"> + <xsl:value-of select="$attribute-code"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring($attribute-code,string-length($attribute-code) - 3)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$temp-code"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="string-length($temp-code)"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length($attribute-code) > 4 or string-length($number-code-style) > 0"> + <xsl:variable name="number-shape-code"> + <xsl:variable name="temp-code"> + <xsl:choose> + <xsl:when test="string-length($attribute-code) > 4"> + <xsl:value-of select="substring($attribute-code, 1, string-length($attribute-code) - 6)"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$temp-code"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="string-length($temp-code)"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="number:transliteration-style">long</xsl:attribute> + <xsl:choose> + <!-- Western, #01 --> + <xsl:when test="$number-shape-code = 1"/> + <!-- Arabic Indic, #02 --> + <xsl:when test="$number-shape-code = 2"/> + <!-- Extended Arabic Indic, #03 --> + <xsl:when test="$number-shape-code = 3"/> + <!-- Devanagari (Sanskrit - India), #04--> + <xsl:when test="$number-shape-code = 4"> + <xsl:attribute name="number:transliteration-language">sa</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Bengali (India), #05 --> + <xsl:when test="$number-shape-code = 5"> + <xsl:attribute name="number:transliteration-language">bn</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Gurmukhi (Punjabi - India), #06 --> + <xsl:when test="$number-shape-code = 6"> + <xsl:attribute name="number:transliteration-language">pa</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Gujarati (India), #07 --> + <xsl:when test="$number-shape-code = 7"> + <xsl:attribute name="number:transliteration-language">gu</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Odia (India), #08 --> + <xsl:when test="$number-shape-code = 8"> + <xsl:attribute name="number:transliteration-language">or</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Tamil (India), #09 --> + <xsl:when test="$number-shape-code = 9"> + <xsl:attribute name="number:transliteration-language">ta</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Telugu (India), #0a --> + <xsl:when test="$number-shape-code = 10"> + <xsl:attribute name="number:transliteration-language">te</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Kannada (India), #0b --> + <xsl:when test="$number-shape-code = 11"> + <xsl:attribute name="number:transliteration-language">kn</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Malayalam (India), #0c --> + <xsl:when test="$number-shape-code = 12"> + <xsl:attribute name="number:transliteration-language">ml</xsl:attribute> + <xsl:attribute name="number:transliteration-country">IN</xsl:attribute> + </xsl:when> + <!-- Thai, #0d --> + <xsl:when test="$number-shape-code = 13"> + <xsl:attribute name="number:transliteration-language">th</xsl:attribute> + <xsl:attribute name="number:transliteration-country">TH</xsl:attribute> + </xsl:when> + <!-- Lao, #0e --> + <xsl:when test="$number-shape-code = 14"> + <xsl:attribute name="number:transliteration-language">lo</xsl:attribute> + <xsl:attribute name="number:transliteration-country">LA</xsl:attribute> + </xsl:when> + <!-- Tibetan (China), #0f --> + <xsl:when test="$number-shape-code = 15"> + <xsl:attribute name="number:transliteration-language">bo</xsl:attribute> + <xsl:attribute name="number:transliteration-country">CN</xsl:attribute> + </xsl:when> + <!-- Myanmar (Burma), #10 --> + <xsl:when test="$number-shape-code = 16"> + <xsl:attribute name="number:transliteration-language">my</xsl:attribute> + <xsl:attribute name="number:transliteration-country">MM</xsl:attribute> + </xsl:when> + <!-- Ethiopic (Geez), #11 --> + <xsl:when test="$number-shape-code = 17"> + <xsl:attribute name="number:transliteration-language">gez</xsl:attribute> + <xsl:attribute name="number:transliteration-country">ET</xsl:attribute> + </xsl:when> + <!-- Khmer (Cambodian), #12--> + <xsl:when test="$number-shape-code = 18"> + <xsl:attribute name="number:transliteration-language">km</xsl:attribute> + <xsl:attribute name="number:transliteration-country">KH</xsl:attribute> + </xsl:when> + <!-- Mongolian, #13 --> + <xsl:when test="$number-shape-code = 19"> + <xsl:attribute name="number:transliteration-language">mn</xsl:attribute> + <xsl:attribute name="number:transliteration-country">CN</xsl:attribute> + </xsl:when> + <!-- Japanese 1 ([DBNum1]) , #1b, #0411 --> + <xsl:when test="$number-shape-code = 27 or ($number-code-style = '1' and $language-country-code = 1041)"> + <xsl:attribute name="number:transliteration-format">一</xsl:attribute> + <xsl:attribute name="number:transliteration-language">ja</xsl:attribute> + <xsl:attribute name="number:transliteration-country">JP</xsl:attribute> + </xsl:when> + <!-- Japanese 2 ([DBNum2]) ,#1c, #0411 --> + <xsl:when test="$number-shape-code = 28 or ($number-code-style = '2' and $language-country-code = 1041 )"> + <xsl:attribute name="number:transliteration-format">壹</xsl:attribute> + <xsl:attribute name="number:transliteration-language">ja</xsl:attribute> + <xsl:attribute name="number:transliteration-country">JP</xsl:attribute> + </xsl:when> + <!-- Japanese 3 ([DBNum3]), #1d, #0411 --> + <xsl:when test="$number-shape-code = 29 or ($number-code-style = '3' and $language-country-code = 1041 )"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-language">ja</xsl:attribute> + <xsl:attribute name="number:transliteration-country">JP</xsl:attribute> + </xsl:when> + <!-- Simplified Chinese 1 ([DBNum1]), #1e, #0804 --> + <xsl:when test="$number-shape-code = 30 or ($number-code-style = '1' and $language-country-code = 2052 )"> + <xsl:attribute name="number:transliteration-format">一</xsl:attribute> + <xsl:attribute name="number:transliteration-language">zh</xsl:attribute> + <xsl:attribute name="number:transliteration-country">CN</xsl:attribute> + </xsl:when> + <!-- Simplified Chinese 2 ([DBNum2]),#1f,#0804 --> + <xsl:when test="$number-shape-code = 31 or ($number-code-style = '2' and $language-country-code = 2052 )"> + <xsl:attribute name="number:transliteration-format">壹</xsl:attribute> + <xsl:attribute name="number:transliteration-language">zh</xsl:attribute> + <xsl:attribute name="number:transliteration-country">CN</xsl:attribute> + </xsl:when> + <!-- Simplified Chinese 3 ([DBNum3]), #20,#0804 --> + <xsl:when test="$number-shape-code = 32 or ($number-code-style = '3' and $language-country-code = 2052 )"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-language">zh</xsl:attribute> + <xsl:attribute name="number:transliteration-country">CN</xsl:attribute> + </xsl:when> + <!-- Traditional Chinese 1 ([DBNum1]), #21, #0404 --> + <xsl:when test="$number-shape-code = 33 or ($number-code-style = '1' and $language-country-code = 1028 )"> + <xsl:attribute name="number:transliteration-format">一</xsl:attribute> + <xsl:attribute name="number:transliteration-language">zh</xsl:attribute> + <xsl:attribute name="number:transliteration-country">TW</xsl:attribute> + </xsl:when> + <!-- Traditional Chinese 2 ([DBNum2]), #22, #0404 --> + <xsl:when test="$number-shape-code = 34 or ($number-code-style = '2' and $language-country-code = 1028 )"> + <xsl:attribute name="number:transliteration-format">壹</xsl:attribute> + <xsl:attribute name="number:transliteration-language">zh</xsl:attribute> + <xsl:attribute name="number:transliteration-country">TW</xsl:attribute> + </xsl:when> + <!-- Traditional Chinese 3 ([DBNum3]),#23, #0404 --> + <xsl:when test="$number-shape-code = 35 or ($number-code-style = '3' and $language-country-code = 1028 )"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-language">zh</xsl:attribute> + <xsl:attribute name="number:transliteration-country">TW</xsl:attribute> + </xsl:when> + <!-- Korean 1 ([DBNum1]), #24, #0412 --> + <xsl:when test="$number-shape-code = 36 or ($number-code-style = '1' and $language-country-code = 1042 )"> + <xsl:attribute name="number:transliteration-format">一</xsl:attribute> + <xsl:attribute name="number:transliteration-language">ko</xsl:attribute> + <xsl:attribute name="number:transliteration-country">KR</xsl:attribute> + </xsl:when> + <!-- Korean 2 ([DBNum2]), #25, #0412 --> + <xsl:when test="$number-shape-code = 37 or ($number-code-style = '2' and $language-country-code = 1042 )"> + <xsl:attribute name="number:transliteration-format">壹</xsl:attribute> + <xsl:attribute name="number:transliteration-language">ko</xsl:attribute> + <xsl:attribute name="number:transliteration-country">KR</xsl:attribute> + </xsl:when> + <!-- Korean 3 ([DBNum3]), #26, #0412 --> + <xsl:when test="$number-shape-code = 38 or ($number-code-style = '3' and $language-country-code = 1042 )"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-language">ko</xsl:attribute> + <xsl:attribute name="number:transliteration-country">KR</xsl:attribute> + </xsl:when> + <!-- Korean 4 ([DBNum4]), #27, #0412 --> + <xsl:when test="$number-shape-code = 39 or ($number-code-style = '4' and $language-country-code = 1042 )"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-language">ko</xsl:attribute> + <xsl:attribute name="number:transliteration-country">KR</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <!-- components of a format code: two digits for number shape codes, two for calendar types, four for LCID --> + <xsl:choose> + <!-- totally 223 language-country LCID codes, manually created, among which MS Office 2003 supports 134, OOo supports 91 --> + <xsl:when test="$language-country-code = 1078"> + <!-- Afrikaans - South Africa, #0436 --> + <xsl:attribute name="number:language">af</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1052"> + <!-- Albanian - Albania, #041c --> + <xsl:attribute name="number:language">sq</xsl:attribute> + <xsl:attribute name="number:country">AL</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1118"> + <!-- Amharic - Ethiopia, #045e --> + <xsl:attribute name="number:language">am</xsl:attribute> + <xsl:attribute name="number:country">ET</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1025"> + <!-- Arabic - Saudi Arabia, #0401 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">SA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 5121"> + <!-- Arabic - Algeria, #1401 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">DZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 15361"> + <!-- Arabic - Bahrain, #3c01 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">BH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3073"> + <!-- Arabic - Egypt, #0c01 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">EG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2049"> + <!-- Arabic - Iraq, #0801 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">IQ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 11265"> + <!-- Arabic - Jordan, #2c01 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">JO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 13313"> + <!-- Arabic - Kuwait, #3401 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">KW</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 12289"> + <!-- Arabic - Lebanon, #3001 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">LB</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 4097"> + <!-- Arabic - Libya, #1001 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">LY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 6145"> + <!-- Arabic - Morocco, #1801 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">MA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 8193"> + <!-- Arabic - Oman, #2001 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">OM</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 16385"> + <!-- Arabic - Qatar, #4001 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">QA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 10241"> + <!-- Arabic - Syria, #2801 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">SY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 7169"> + <!-- Arabic - Tunisia, #1c01 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">TN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 14337"> + <!-- Arabic - U.A.E., #3801 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">AE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 9217"> + <!-- Arabic - Yemen, #2401 --> + <xsl:attribute name="number:language">ar</xsl:attribute> + <xsl:attribute name="number:country">YE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1067"> + <!-- Armenian - Armenia, #042b --> + <xsl:attribute name="number:language">hy</xsl:attribute> + <xsl:attribute name="number:country">AM</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1101"> + <!-- Assamese, #044d --> + <xsl:attribute name="number:language">as</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2092"> + <!-- Azeri - Cyrillic, #082c --> + <xsl:attribute name="number:language">az</xsl:attribute> + <xsl:attribute name="number:country">AZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1068"> + <!-- Azeri - Latin, #042c --> + <xsl:attribute name="number:language">az</xsl:attribute> + <xsl:attribute name="number:country">AZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1069"> + <!-- Basque - France/Spain, #042d --> + <xsl:attribute name="number:language">eu</xsl:attribute> + <xsl:attribute name="number:country">ES</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1059"> + <!-- Belarusian - Belarus, #0423 --> + <xsl:attribute name="number:language">be</xsl:attribute> + <xsl:attribute name="number:country">BY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1093"> + <!-- Bengali (India), #0445 --> + <xsl:attribute name="number:language">bn</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2117"> + <!-- Bengali (Bangladesh), #0845 --> + <xsl:attribute name="number:language">bn</xsl:attribute> + <xsl:attribute name="number:country">BD</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 5146"> + <!-- Bosnian (Bosnia/Herzegovina), #141a --> + <xsl:attribute name="number:language">bs</xsl:attribute> + <xsl:attribute name="number:country">BA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1026"> + <!-- Bulgarian, #0402 --> + <xsl:attribute name="number:language">bg</xsl:attribute> + <xsl:attribute name="number:country">BG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1109"> + <!-- Burmese (Burma/Myanmar), #0455 --> + <xsl:attribute name="number:language">my</xsl:attribute> + <xsl:attribute name="number:country">MM</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1027"> + <!-- Catalan - Spain, #0403 --> + <xsl:attribute name="number:language">ca</xsl:attribute> + <xsl:attribute name="number:country">ES</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1116"> + <!-- Cherokee - United States, #045c --> + <xsl:attribute name="number:language">chr</xsl:attribute> + <xsl:attribute name="number:country">US</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2052"> + <!-- Chinese - People's Republic of China, #0804 --> + <xsl:attribute name="number:language">zh</xsl:attribute> + <xsl:attribute name="number:country">CN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 4100"> + <!-- Chinese - Singapore, #1004 --> + <xsl:attribute name="number:language">zh</xsl:attribute> + <xsl:attribute name="number:country">SG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1028"> + <!-- Chinese - Taiwan, #0404 --> + <xsl:attribute name="number:language">zh</xsl:attribute> + <xsl:attribute name="number:country">TW</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3076"> + <!-- Chinese - Hong Kong SAR, #0c04 --> + <xsl:attribute name="number:language">zh</xsl:attribute> + <xsl:attribute name="number:country">HK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 5124"> + <!-- Chinese - Macao SAR, #1404 --> + <xsl:attribute name="number:language">zh</xsl:attribute> + <xsl:attribute name="number:country">MO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1050"> + <!-- Croatian (Croatia), #041a --> + <xsl:attribute name="number:language">hr</xsl:attribute> + <xsl:attribute name="number:country">HR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 4122"> + <!-- Croatian (Bosnia/Herzegovina), #101a --> + <xsl:attribute name="number:language">hr</xsl:attribute> + <xsl:attribute name="number:country">BA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1029"> + <!-- Czech, #0405 --> + <xsl:attribute name="number:language">cs</xsl:attribute> + <xsl:attribute name="number:country">CZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1030"> + <!-- Danish, #0406 --> + <xsl:attribute name="number:language">da</xsl:attribute> + <xsl:attribute name="number:country">DK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1125"> + <!-- Divehi, #0465 --> + <xsl:attribute name="number:language">dv</xsl:attribute> + <xsl:attribute name="number:country">MV</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1043"> + <!-- Dutch - Netherlands, #0413 --> + <xsl:attribute name="number:language">nl</xsl:attribute> + <xsl:attribute name="number:country">NL</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2067"> + <!-- Dutch - Belgium, #0813 --> + <xsl:attribute name="number:language">nl</xsl:attribute> + <xsl:attribute name="number:country">BE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1126"> + <!-- Edo (Bini - Nigeria), #0466 --> + <xsl:attribute name="number:language">bin</xsl:attribute> + <xsl:attribute name="number:country">NG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1033"> + <!-- English - United States, #0409 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">US</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2057"> + <!-- English - United Kingdom, #0809 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">GB</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3081"> + <!-- English - Australia, #0c09 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">AU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 10249"> + <!-- English - Belize, #2809 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">BZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 4105"> + <!-- English - Canada, #1009 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">CA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 9225"> + <!-- English - Caribbean (Cuba), #2409 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">CU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 15369"> + <!-- English - Hong Kong SAR, #3c09 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">HK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 16393"> + <!-- English - India, #4009 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 14345"> + <!-- English - Indonesia, #3809 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">ID</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 6153"> + <!-- English - Ireland, #1809 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">IE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 8201"> + <!-- English - Jamaica, #2009 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">JM</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 17417"> + <!-- English - Malaysia, #4409 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">MY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 5129"> + <!-- English - New Zealand, #1409 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">NZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 13321"> + <!-- English - Philippines, #3409 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">PH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 18441"> + <!-- English - Singapore, #4809 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">SG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 7177"> + <!-- English - South Africa, #1c09 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 11273"> + <!-- English - Trinidad, #2c09 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">TT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 12297"> + <!-- English - Zimbabwe, #3009 --> + <xsl:attribute name="number:language">en</xsl:attribute> + <xsl:attribute name="number:country">ZW</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1061"> + <!-- Estonian (Estonia), #0425 --> + <xsl:attribute name="number:language">et</xsl:attribute> + <xsl:attribute name="number:country">EE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1080"> + <!-- Faroese (Faroe Islands), #0438 --> + <xsl:attribute name="number:language">fo</xsl:attribute> + <xsl:attribute name="number:country">FO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1065"> + <!-- Farsi (Persian/Iran), #0429 --> + <xsl:attribute name="number:language">fa</xsl:attribute> + <xsl:attribute name="number:country">IR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1124"> + <!-- Filipino (Philippine), #0464 --> + <xsl:attribute name="number:language">phi</xsl:attribute> + <xsl:attribute name="number:country">PH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1035"> + <!-- Finnish, #040b --> + <xsl:attribute name="number:language">fi</xsl:attribute> + <xsl:attribute name="number:country">FI</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1036"> + <!-- French - France, #040c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">FR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2060"> + <!-- French - Belgium, #080c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">BE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 11276"> + <!-- French - Cameroon, #2c0c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">CM</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3084"> + <!-- French - Canada, #0c0c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">CA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 9228"> + <!-- French - Congo, #240c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">CG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 12300"> + <!-- French - Cote d'Ivoire, #300c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">CI</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 15372"> + <!-- French - Haiti, #3c0c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">HT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 5132"> + <!-- French - Luxembourg, #140c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">LU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 13324"> + <!-- French - Mali, #340c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">ML</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 6156"> + <!-- French - Monaco, #180c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">MC</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 14348"> + <!-- French - Morocco, #380c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">MA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 58380"> + <!-- French - North Africa (Algeria), #e40c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">DZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 8204"> + <!-- French - Reunion, #200c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">RE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 10252"> + <!-- French - Senegal, #280c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">SN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 4108"> + <!-- French - Switzerland, #100c --> + <xsl:attribute name="number:language">fr</xsl:attribute> + <xsl:attribute name="number:country">CH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1122"> + <!-- Frisian - Netherlands, #0462 --> + <xsl:attribute name="number:language">fy</xsl:attribute> + <xsl:attribute name="number:country">NL</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1127"> + <!-- Fulfude (Fulah) - Nigeria, #0467 --> + <xsl:attribute name="number:language">ff</xsl:attribute> + <xsl:attribute name="number:country">NG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1071"> + <!-- FYRO Macedonian, #042f --> + <xsl:attribute name="number:language">mk</xsl:attribute> + <xsl:attribute name="number:country">MK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2108"> + <!-- Gaelic (Ireland), #083c --> + <xsl:attribute name="number:language">gd</xsl:attribute> + <xsl:attribute name="number:country">IE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1084"> + <!-- Gaelic (Scotland), #043c --> + <xsl:attribute name="number:language">gd</xsl:attribute> + <xsl:attribute name="number:country">GB</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1110"> + <!-- Galician (Gallegan) - Spain, #0456 --> + <xsl:attribute name="number:language">gl</xsl:attribute> + <xsl:attribute name="number:country">ES</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1079"> + <!-- Georgian - Georgia, #0437 --> + <xsl:attribute name="number:language">ka</xsl:attribute> + <xsl:attribute name="number:country">GE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1031"> + <!-- German - Germany, #0407 --> + <xsl:attribute name="number:language">de</xsl:attribute> + <xsl:attribute name="number:country">DE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3079"> + <!-- German - Austria, #0c07 --> + <xsl:attribute name="number:language">de</xsl:attribute> + <xsl:attribute name="number:country">AT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 5127"> + <!-- German - Liechtenstein, #1407 --> + <xsl:attribute name="number:language">de</xsl:attribute> + <xsl:attribute name="number:country">LI</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 4103"> + <!-- German - Luxembourg, #1007 --> + <xsl:attribute name="number:language">de</xsl:attribute> + <xsl:attribute name="number:country">LU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2055"> + <!-- German - Switzerland, #0807 --> + <xsl:attribute name="number:language">de</xsl:attribute> + <xsl:attribute name="number:country">CH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1032"> + <!-- Greek, #0408 --> + <xsl:attribute name="number:language">el</xsl:attribute> + <xsl:attribute name="number:country">GR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1140"> + <!-- Guarani - Paraguay, #0474 --> + <xsl:attribute name="number:language">gn</xsl:attribute> + <xsl:attribute name="number:country">PY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1095"> + <!-- Gujarati - India, #0447 --> + <xsl:attribute name="number:language">gu</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1128"> + <!-- Hausa - Nigeria, #0468 --> + <xsl:attribute name="number:language">ha</xsl:attribute> + <xsl:attribute name="number:country">NG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1141"> + <!-- Hawaiian - US, #0475 --> + <xsl:attribute name="number:language">haw</xsl:attribute> + <xsl:attribute name="number:country">US</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1037"> + <!-- Hebrew, #040d --> + <xsl:attribute name="number:language">he</xsl:attribute> + <xsl:attribute name="number:country">IL</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1081"> + <!-- Hindi (India), #0439 --> + <xsl:attribute name="number:language">hi</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1038"> + <!-- Hungarian - Hungary, #040e --> + <xsl:attribute name="number:language">hu</xsl:attribute> + <xsl:attribute name="number:country">HU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1129"> + <!-- Ibibio (Niger-Kordofanian) - Nigeria, #0469 --> + <xsl:attribute name="number:language">nic</xsl:attribute> + <xsl:attribute name="number:country">NG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1039"> + <!-- Icelandic, #040f --> + <xsl:attribute name="number:language">is</xsl:attribute> + <xsl:attribute name="number:country">IS</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1136"> + <!-- Igbo - Nigeria, #0470 --> + <xsl:attribute name="number:language">ig</xsl:attribute> + <xsl:attribute name="number:country">NG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1057"> + <!-- Indonesian, #0421 --> + <xsl:attribute name="number:language">id</xsl:attribute> + <xsl:attribute name="number:country">ID</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1117"> + <!-- Inuktitut - US, #045d --> + <xsl:attribute name="number:language">iu</xsl:attribute> + <xsl:attribute name="number:country">US</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1040"> + <!-- Italian - Italy, #0410 --> + <xsl:attribute name="number:language">it</xsl:attribute> + <xsl:attribute name="number:country">IT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2064"> + <!-- Italian - Switzerland, #0810 --> + <xsl:attribute name="number:language">it</xsl:attribute> + <xsl:attribute name="number:country">CH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1041"> + <!-- Japanese, #0411 --> + <xsl:attribute name="number:language">ja</xsl:attribute> + <xsl:attribute name="number:country">JP</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1099"> + <!-- Kannada (India), #044b --> + <xsl:attribute name="number:language">kn</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1137"> + <!-- Kanuri - Nigeria, #0471 --> + <xsl:attribute name="number:language">kr</xsl:attribute> + <xsl:attribute name="number:country">NG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2144"> + <!-- Kashmiri (India), #0860 --> + <xsl:attribute name="number:language">ks</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1120"> + <!-- Kashmiri (Arabic), #0460 --> + <xsl:attribute name="number:language">ks</xsl:attribute> + <xsl:attribute name="number:country">PK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1087"> + <!-- Kazakh, #043f --> + <xsl:attribute name="number:language">kk</xsl:attribute> + <xsl:attribute name="number:country">KZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1107"> + <!-- Khmer (Cambodian), #0453 --> + <xsl:attribute name="number:language">km</xsl:attribute> + <xsl:attribute name="number:country">KH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1111"> + <!-- Konkani (India), #0457 --> + <xsl:attribute name="number:language">kok</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1042"> + <!-- Korean, #0412 --> + <xsl:attribute name="number:language">ko</xsl:attribute> + <xsl:attribute name="number:country">KR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1088"> + <!-- Kyrgyz ( Kirgiz / Cyrillic), #0440 --> + <xsl:attribute name="number:language">ky</xsl:attribute> + <xsl:attribute name="number:country">KG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1108"> + <!-- Lao, #0454 --> + <xsl:attribute name="number:language">lo</xsl:attribute> + <xsl:attribute name="number:country">LA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1142"> + <!-- Latin, #0476 --> + <xsl:attribute name="number:language">la</xsl:attribute> + <xsl:attribute name="number:country">IT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1062"> + <!-- Latvian, #0426 --> + <xsl:attribute name="number:language">lv</xsl:attribute> + <xsl:attribute name="number:country">LV</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1063"> + <!-- Lithuanian, #0427 --> + <xsl:attribute name="number:language">lt</xsl:attribute> + <xsl:attribute name="number:country">LT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1086"> + <!-- Malay - Malaysia, #043e --> + <xsl:attribute name="number:language">ms</xsl:attribute> + <xsl:attribute name="number:country">MY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2110"> + <!-- Malay - Brunei Darussalam, #083e --> + <xsl:attribute name="number:language">ms</xsl:attribute> + <xsl:attribute name="number:country">BN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1071"> + <!-- Macedonian (FYROM), #042f --> + <xsl:attribute name="number:language">mk</xsl:attribute> + <xsl:attribute name="number:country">MK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1100"> + <!-- Malayalam (India), #044c --> + <xsl:attribute name="number:language">ml</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1082"> + <!-- Maltese, #043a --> + <xsl:attribute name="number:language">mt</xsl:attribute> + <xsl:attribute name="number:country">MT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1112"> + <!-- Manipuri (India), #0458 --> + <xsl:attribute name="number:language">mni</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1153"> + <!-- Maori - New Zealand, #0481 --> + <xsl:attribute name="number:language">mi</xsl:attribute> + <xsl:attribute name="number:country">NZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1102"> + <!-- Marathi (India), #044e --> + <xsl:attribute name="number:language">mr</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1104"> + <!-- Mongolian (Cyrillic), #0450 --> + <xsl:attribute name="number:language">mn</xsl:attribute> + <xsl:attribute name="number:country">MN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2128"> + <!-- Mongolian (Mongolian), #0850 --> + <xsl:attribute name="number:language">mn</xsl:attribute> + <xsl:attribute name="number:country">CN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1121"> + <!-- Nepali, #0461 --> + <xsl:attribute name="number:language">ne</xsl:attribute> + <xsl:attribute name="number:country">NP</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2145"> + <!-- Nepali (India), #0861 --> + <xsl:attribute name="number:language">ne</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1044"> + <!-- Norwegian (Bokmal), #0414 --> + <xsl:attribute name="number:language">nb</xsl:attribute> + <xsl:attribute name="number:country">NO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2068"> + <!-- Norwegian (Nynorsk), #0814 --> + <xsl:attribute name="number:language">nn</xsl:attribute> + <xsl:attribute name="number:country">NO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1096"> + <!-- Odia (India), #0448 --> + <xsl:attribute name="number:language">or</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1138"> + <!-- Oromo (Ethiopia), #0472 --> + <xsl:attribute name="number:language">om</xsl:attribute> + <xsl:attribute name="number:country">ET</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1145"> + <!-- Papiamentu (Netherlands Antilles), #0479 --> + <xsl:attribute name="number:language">pap</xsl:attribute> + <xsl:attribute name="number:country">AN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1123"> + <!-- Pashto (Afghanistan), #0463 --> + <xsl:attribute name="number:language">ps</xsl:attribute> + <xsl:attribute name="number:country">AF</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1045"> + <!-- Polish, #0415 --> + <xsl:attribute name="number:language">pl</xsl:attribute> + <xsl:attribute name="number:country">PL</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1046"> + <!-- Portuguese - Brazil, #0416 --> + <xsl:attribute name="number:language">pt</xsl:attribute> + <xsl:attribute name="number:country">BR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2070"> + <!-- Portuguese - Portugal, #0816 --> + <xsl:attribute name="number:language">pt</xsl:attribute> + <xsl:attribute name="number:country">PT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1094"> + <!-- Punjabi, #0446 --> + <xsl:attribute name="number:language">pa</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2118"> + <!-- Punjabi (Pakistan), #0846 --> + <xsl:attribute name="number:language">pa</xsl:attribute> + <xsl:attribute name="number:country">PK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1131"> + <!-- Quecha - Blivia, #046b --> + <xsl:attribute name="number:language">qu</xsl:attribute> + <xsl:attribute name="number:country">BO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2155"> + <!-- Quecha - Ecuador, #086b --> + <xsl:attribute name="number:language">qu</xsl:attribute> + <xsl:attribute name="number:country">EC</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3179"> + <!-- Quecha - peru, #0c6b --> + <xsl:attribute name="number:language">qu</xsl:attribute> + <xsl:attribute name="number:country">PE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1047"> + <!-- Rhaeto-Romanic (Italy), #0417 --> + <xsl:attribute name="number:language">rm</xsl:attribute> + <xsl:attribute name="number:country">IT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1048"> + <!-- Romanian, #0418 --> + <xsl:attribute name="number:language">ro</xsl:attribute> + <xsl:attribute name="number:country">RO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2072"> + <!-- Romanian - Moldova, #0818 --> + <xsl:attribute name="number:language">ro</xsl:attribute> + <xsl:attribute name="number:country">MD</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1049"> + <!-- Russian, #0419 --> + <xsl:attribute name="number:language">ru</xsl:attribute> + <xsl:attribute name="number:country">RU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2073"> + <!-- Russian - Moldova, #0819 --> + <xsl:attribute name="number:language">ru</xsl:attribute> + <xsl:attribute name="number:country">MD</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1083"> + <!-- Sami (Lappish), # (Northern Sami - Sweden), #043b --> + <xsl:attribute name="number:language">se</xsl:attribute> + <xsl:attribute name="number:country">SE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1103"> + <!-- Sanskrit (India), #044f --> + <xsl:attribute name="number:language">sa</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1132"> + <!-- Sepedi (Northern Sotho - South Africa), #046c --> + <xsl:attribute name="number:language">nso</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3098"> + <!-- Serbian (Cyrillic - Serbia Yugoslavia), #0c1a --> + <xsl:attribute name="number:language">sr</xsl:attribute> + <xsl:attribute name="number:country">YU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2074"> + <!-- Serbian (Latin - Croatia), #081a --> + <xsl:attribute name="number:language">sr</xsl:attribute> + <xsl:attribute name="number:country">HR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1113"> + <!-- Sindhi - India,#0459 --> + <xsl:attribute name="number:language">sd</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2137"> + <!-- Sindhi - Pakistan, #0859 --> + <xsl:attribute name="number:language">sd</xsl:attribute> + <xsl:attribute name="number:country">PK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1115"> + <!-- Sinhalese - Sri Lanka, #045b --> + <xsl:attribute name="number:language">si</xsl:attribute> + <xsl:attribute name="number:country">LK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1051"> + <!-- Slovak, #041b --> + <xsl:attribute name="number:language">sk</xsl:attribute> + <xsl:attribute name="number:country">SK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1060"> + <!-- Slovenian, #0424 --> + <xsl:attribute name="number:language">sl</xsl:attribute> + <xsl:attribute name="number:country">SI</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1143"> + <!-- Somali, #0477 --> + <xsl:attribute name="number:language">so</xsl:attribute> + <xsl:attribute name="number:country">SO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1070"> + <!-- Sorbian, #042e --> + <xsl:attribute name="number:language">wen</xsl:attribute> + <xsl:attribute name="number:country">DE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 3082"> + <!-- Spanish - Spain (Modern/International Sort), #0c0a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">ES</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1034"> + <!-- Spanish - Spain (Traditional Sort), #040a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">ES</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 11274"> + <!-- Spanish - Argentina, #2c0a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">AR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 16394"> + <!-- Spanish - Bolivia, #400a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">BO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 13322"> + <!-- Spanish - Chile, #340a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">CL</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 9226"> + <!-- Spanish - Colombia, #240a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">CO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 5130"> + <!-- Spanish - Costa Rica, #140a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">CR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 7178"> + <!-- Spanish - Dominican Republic, #1c0a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">DO</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 12298"> + <!-- Spanish - Ecuador, #300a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">EC</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 17418"> + <!-- Spanish - EL Salvador, #440a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">SV</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 4106"> + <!-- Spanish - Guatemala, #100a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">GT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 18442"> + <!-- Spanish - Honduras, #480a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">HN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 58378"> + <!-- Spanish - Latin America (Argentina), #e40a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">AR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2058"> + <!-- Spanish - Mexico, #080a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">MX</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 19466"> + <!-- Spanish - Nicaragua, #4c0a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">NI</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 6154"> + <!-- Spanish - Panama, #180a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">PA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 15370"> + <!-- Spanish - Paraguay, #3c0a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">PY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 10250"> + <!-- Spanish - Peru, #280a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">PE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 20490"> + <!-- Spanish - Puerto Rico, #500a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">PR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 21514"> + <!-- Spanish - US, #540a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">US</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 14346"> + <!-- Spanish - Uruguay, #380a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">UY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 8202"> + <!-- Spanish - Venezuela, #200a --> + <xsl:attribute name="number:language">es</xsl:attribute> + <xsl:attribute name="number:country">VE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1072"> + <!-- Sutu (Ngoni - Tanzania), #0430 --> + <xsl:attribute name="number:language">bnt</xsl:attribute> + <xsl:attribute name="number:country">TZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1089"> + <!-- Swahili (Tanzania), #0441 --> + <xsl:attribute name="number:language">sw</xsl:attribute> + <xsl:attribute name="number:country">TZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1053"> + <!-- Swedish (Sweden), #041d --> + <xsl:attribute name="number:language">sv</xsl:attribute> + <xsl:attribute name="number:country">SE</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2077"> + <!-- Swedish - Finland, #081d --> + <xsl:attribute name="number:language">sv</xsl:attribute> + <xsl:attribute name="number:country">FI</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1114"> + <!-- Syriac (Syria), #045a --> + <xsl:attribute name="number:language">syr</xsl:attribute> + <xsl:attribute name="number:country">SY</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1064"> + <!-- Tajik, #0428 --> + <xsl:attribute name="number:language">tg</xsl:attribute> + <xsl:attribute name="number:country">TJ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1119"> + <!-- Tamazight (Arabic), #045f --> + <xsl:attribute name="number:language">ber</xsl:attribute> + <xsl:attribute name="number:country">ML</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2143"> + <!-- Tamazight (Latin), #085f --> + <xsl:attribute name="number:language">ber</xsl:attribute> + <xsl:attribute name="number:country">MA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1097"> + <!-- Tamil (India), #0449 --> + <xsl:attribute name="number:language">ta</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1092"> + <!-- Tatar (Russia), #0444 --> + <xsl:attribute name="number:language">tt</xsl:attribute> + <xsl:attribute name="number:country">RU</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1098"> + <!-- Telugu (India), #044a --> + <xsl:attribute name="number:language">te</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1054"> + <!-- Thai, #041e --> + <xsl:attribute name="number:language">th</xsl:attribute> + <xsl:attribute name="number:country">TH</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2129"> + <!-- Tibetan - Bhutan, #0851 --> + <xsl:attribute name="number:language">bo</xsl:attribute> + <xsl:attribute name="number:country">BT</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1105"> + <!-- Tibetan - People's Republic of China, #0451 --> + <xsl:attribute name="number:language">bo</xsl:attribute> + <xsl:attribute name="number:country">CN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2163"> + <!-- Tigrigna (Tigrinya) - Eritrea, #0873 --> + <xsl:attribute name="number:language">ti</xsl:attribute> + <xsl:attribute name="number:country">ER</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1139"> + <!-- Tigrigna (Tigrinya) - Ethiopia, #0473 --> + <xsl:attribute name="number:language">ti</xsl:attribute> + <xsl:attribute name="number:country">ET</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1073"> + <!-- Tsonga (South Africa), #0431 --> + <xsl:attribute name="number:language">ts</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1074"> + <!-- Tswana (South Africa), #0432 --> + <xsl:attribute name="number:language">tn</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1055"> + <!-- Turkish, #041f --> + <xsl:attribute name="number:language">tr</xsl:attribute> + <xsl:attribute name="number:country">TR</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1090"> + <!-- Turkmen, #0442 --> + <xsl:attribute name="number:language">tk</xsl:attribute> + <xsl:attribute name="number:country">TM</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1152"> + <!-- Uighur - China, #0480 --> + <xsl:attribute name="number:language">ug</xsl:attribute> + <xsl:attribute name="number:country">CN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1058"> + <!-- Ukrainian, #0422 --> + <xsl:attribute name="number:language">uk</xsl:attribute> + <xsl:attribute name="number:country">UA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1056"> + <!-- Urdu (Pakistan), #0420 --> + <xsl:attribute name="number:language">ur</xsl:attribute> + <xsl:attribute name="number:country">PK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2080"> + <!-- Urdu - India, #0820 --> + <xsl:attribute name="number:language">ur</xsl:attribute> + <xsl:attribute name="number:country">IN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 2115"> + <!-- Uzbek (Cyrillic), #0843 --> + <xsl:attribute name="number:language">uz</xsl:attribute> + <xsl:attribute name="number:country">UZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1091"> + <!-- Uzbek (Latin), #0443 --> + <xsl:attribute name="number:language">uz</xsl:attribute> + <xsl:attribute name="number:country">UZ</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1075"> + <!-- Venda (South Africa), #0433 --> + <xsl:attribute name="number:language">ve</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1066"> + <!-- Vietnamese, #042a --> + <xsl:attribute name="number:language">vi</xsl:attribute> + <xsl:attribute name="number:country">VN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1106"> + <!-- Welsh (UK), #0452 --> + <xsl:attribute name="number:language">cy</xsl:attribute> + <xsl:attribute name="number:country">UK</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1076"> + <!-- Xhosa (South Africa), #0434 --> + <xsl:attribute name="number:language">xh</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1144"> + <!-- Yi (Sino-Tibetan - China), #0478 --> + <xsl:attribute name="number:language">sit</xsl:attribute> + <xsl:attribute name="number:country">CN</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1085"> + <!-- Yiddish (Jews - Israel), #043d --> + <xsl:attribute name="number:language">yi</xsl:attribute> + <xsl:attribute name="number:country">IL</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1130"> + <!-- Yoruba (Nigeria), #046a --> + <xsl:attribute name="number:language">yo</xsl:attribute> + <xsl:attribute name="number:country">NG</xsl:attribute> + </xsl:when> + <xsl:when test="$language-country-code = 1077"> + <!-- Zulu (South Africa), #0435 --> + <xsl:attribute name="number:language">zu</xsl:attribute> + <xsl:attribute name="number:country">ZA</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-format-condition"> + <xsl:param name="number-format-unit"/> + <xsl:choose> + <xsl:when test="contains($number-format-unit, '[>')"> + <xsl:value-of select="concat('>', substring-before( substring-after($number-format-unit,'[>'), ']'))"/> + </xsl:when> + <xsl:when test="contains($number-format-unit, '[<')"> + <xsl:value-of select="concat('<', substring-before( substring-after($number-format-unit,'[<'), ']'))"/> + </xsl:when> + <xsl:when test="contains($number-format-unit, '[=')"> + <xsl:value-of select="concat('=', substring-before( substring-after($number-format-unit,'[='), ']'))"/> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="add-number-text-value"> + <xsl:param name="style-type-name"/> + <xsl:param name="number-format-unit"/> + <xsl:param name="unit-pos"/> + <xsl:param name="condition-pos"/> + <xsl:param name="isNumberTextElementOpened" select="false()"/> + <xsl:param name="numberTextValue"/> + <xsl:param name="posed-number-format-unit"/> + <xsl:param name="finished" select="false()"/> + <xsl:choose> + <xsl:when test="not($finished)"> + <xsl:choose> +<!-- <xsl:when test="$style-type-name='number:text-style' or $style-type-name='number:date-style'"> --> + <xsl:when test="$style-type-name='number:text-style'"> + <xsl:choose> + <xsl:when test="$isNumberTextElementOpened"> + <number:text-content/> + <number:text> + <xsl:copy-of select="$numberTextValue"/> + </number:text> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="true()"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <number:text> + <xsl:copy-of select="$numberTextValue"/> + </number:text> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="true()"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="finished" select="true()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$style-type-name='number:number-style'"> + <xsl:choose> + <xsl:when test="$isNumberTextElementOpened"> + <xsl:copy-of select="$numberTextValue"/> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="true()"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <number:text> + <xsl:copy-of select="$numberTextValue"/> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="true()"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + </number:text> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="finished" select="true()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <number:text> + <xsl:copy-of select="$numberTextValue"/> + </number:text> + <xsl:choose> + <xsl:when test="starts-with($posed-number-format-unit, '\')"> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="finished" select="false()" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="finished" select="true()" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-text-content"> + <xsl:param name="style-type-name"/> + <xsl:param name="number-format-unit"/> + <xsl:param name="unit-pos"/> + <xsl:param name="condition-pos"/> + <xsl:param name="isNumberTextElementOpened" select="false()"/> + <xsl:param name="finished" select="false()"/> + <xsl:param name="posed-number-format-unit"/> + <!-- process number-format-unit by character string parser --> + <xsl:choose> + <xsl:when test="starts-with( $posed-number-format-unit, '\') or starts-with( $posed-number-format-unit, '*')"> + <xsl:choose> + <xsl:when test="not($finished)"> + <xsl:call-template name="add-number-text-value"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/> + <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/> + <!-- place '*' temporarily here, because now StarCalc doesn't support variable filling character definition --> + <xsl:with-param name="numberTextValue" select="substring($posed-number-format-unit,2,1)"/> + <xsl:with-param name="finished" select="$finished"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos +2)"/> + <xsl:with-param name="finished" select="true()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '_')"> + <xsl:choose> + <xsl:when test="not($finished)"> + <xsl:call-template name="add-number-text-value"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/> + <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/> + <!-- adding an empty string --> + <xsl:with-param name="numberTextValue" select="' '"/> + <xsl:with-param name="finished" select="$finished"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/> + <xsl:with-param name="finished" select="true()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '"')"> + <xsl:choose> + <xsl:when test="not($finished)"> + <!-- creating a pre-character string --> + <xsl:variable name="pre-character-string" select="substring-before(substring($posed-number-format-unit,2), '"')"/> + <xsl:call-template name="add-number-text-value"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + string-length($pre-character-string) + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + string-length($pre-character-string) + 2)"/> + <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/> + <xsl:with-param name="numberTextValue" select="$pre-character-string"/> + <xsl:with-param name="finished" select="$finished"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- creating a pre-character string --> + <xsl:variable name="pre-character-string" select="substring-before(substring($posed-number-format-unit,2), '"')"/> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + string-length($pre-character-string) + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + string-length($pre-character-string) + 2)"/> + <xsl:with-param name="finished" select="true()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$finished"> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="create-number-format-content"> + <xsl:param name="style-type-name"/> + <xsl:param name="number-format-unit"/> + <xsl:param name="unit-pos"/> + <xsl:param name="condition-pos"/> + <xsl:param name="isNumberTextElementOpened" select="false()"/> + <xsl:variable name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos)"/> + <xsl:variable name="calendar-type-name"> + <xsl:if test="contains( $number-format-unit, '[$')"> + <xsl:variable name="format-code" select="substring-before( substring-after( substring-after( $number-format-unit, '[$'), '-'), ']')"/> + <xsl:if test="string-length( $format-code) > 4"> + <xsl:call-template name="get-calendar-type-name"> + <xsl:with-param name="calendar-type" select="substring( $format-code, string-length($format-code) -5, 2)"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:variable> + <!-- process number-format-unit by character string parser --> + <xsl:choose> + <xsl:when test="starts-with( $posed-number-format-unit, '[$') and (not(starts-with($posed-number-format-unit, '[$-') ) )"> + <xsl:element name="number:currency-symbol"> + <xsl:call-template name="create-language-country-attribute"> + <xsl:with-param name="attribute-code" select="substring-before(substring-after(substring-after($posed-number-format-unit,'[$'),'-'),']')"/> + </xsl:call-template> + <xsl:value-of select="substring-before( substring-after( $posed-number-format-unit, '[$'), '-')"/> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + string-length( substring-before( $posed-number-format-unit, ']') ) + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '\') or starts-with( $posed-number-format-unit, '*') or starts-with( $posed-number-format-unit, '_') or starts-with( $posed-number-format-unit, '"')"> + <xsl:call-template name="get-number-text-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="(starts-with( $posed-number-format-unit, '0') or starts-with( $posed-number-format-unit, '#') or starts-with( $posed-number-format-unit, '?') ) and (not ( contains( $posed-number-format-unit, 's.00') ) )"> + <xsl:variable name="valid-number-format-string"> + <xsl:call-template name="get-valid-number-format-string"> + <xsl:with-param name="number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains( $valid-number-format-string, '/')"> + <xsl:element name="number:fraction"> + <xsl:attribute name="number:min-integer-digits"> + <xsl:value-of select="string-length( substring-before($valid-number-format-string, '/') ) - string-length(translate( substring-before($valid-number-format-string, '/'), '0', '') )"/> + </xsl:attribute> + <xsl:if test="contains( $valid-number-format-string, ',')"> + <xsl:attribute name="number:grouping">true</xsl:attribute> + </xsl:if> + <xsl:attribute name="number:min-numerator-digits"> + <xsl:value-of select="string-length( substring-before($valid-number-format-string, '/') ) - string-length(translate( substring-before($valid-number-format-string,'/'), '?', '') )"/> + </xsl:attribute> + <xsl:attribute name="number:min-denominator-digits"> + <xsl:value-of select="string-length(substring-after($valid-number-format-string, '/') )"/> + </xsl:attribute> + <!-- deal with number:embedded-text (removed, as SCHEMA demands element to be empty) + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + --> + </xsl:element> + </xsl:when> + <xsl:when test="contains( $valid-number-format-string, '%')"> + <xsl:element name="number:number"> + <xsl:choose> + <xsl:when test="contains( $valid-number-format-string, '.')"> + <xsl:attribute name="number:decimal-places"> + <xsl:value-of select="string-length( substring-before( substring-after( $valid-number-format-string, '.'), '%') ) - string-length( translate( substring-before( substring-after( $valid-number-format-string, '.'), '%'), '0', '') )"/> + </xsl:attribute> + <xsl:attribute name="number:min-integer-digits"> + <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="number:decimal-places">0</xsl:attribute> + <xsl:attribute name="number:min-integer-digits"> + <xsl:value-of select="string-length( substring-before($valid-number-format-string, '%') ) - string-length(translate( substring-before($valid-number-format-string, '%'), '0', '') )"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="contains( $valid-number-format-string, ',') and (substring( $valid-number-format-string,string-length($valid-number-format-string)) = ',')"> + <xsl:variable name="display-factor"> + <xsl:call-template name="get-display-factor"> + <xsl:with-param name="start-number" select="1"/> + <xsl:with-param name="thousand-count" select="string-length($valid-number-format-string) - string-length( translate($valid-number-format-string, ',', '') )"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="number:display-factor"> + <xsl:value-of select="$display-factor"/> + </xsl:attribute> + <xsl:attribute name="number:grouping">true</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $valid-number-format-string, ',')"> + <xsl:attribute name="number:grouping">true</xsl:attribute> + </xsl:when> + </xsl:choose> + <!-- deal with number:embedded-text --> + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:element> + <number:text>%</number:text> + </xsl:when> + <xsl:when test="contains( $valid-number-format-string, 'E') or contains ($valid-number-format-string, 'e')"> + <xsl:element name="number:scientific-number"> + <xsl:choose> + <xsl:when test="contains( $valid-number-format-string, '.')"> + <xsl:attribute name="number:decimal-places"> + <xsl:value-of select="string-length( substring-before( substring-after( $valid-number-format-string, '.'), 'E') ) - string-length( translate( substring-before( substring-after( $valid-number-format-string, '.'), 'E'), '0', '') )"/> + </xsl:attribute> + <xsl:attribute name="number:min-integer-digits"> + <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="number:decimal-places">0</xsl:attribute> + <xsl:attribute name="number:min-integer-digits"> + <xsl:value-of select="string-length( substring-before($valid-number-format-string, 'E') ) - string-length(translate( substring-before($valid-number-format-string, 'E'), '0', '') )"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="number:min-exponent-digits"> + <xsl:value-of select="string-length( substring-after( $valid-number-format-string, 'E') ) - string-length( translate( substring-after( $valid-number-format-string, 'E'), '0', '') )"/> + </xsl:attribute> + <!-- deal with number:embedded-text --> + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <!-- -normal number format, currency, and accounting, e.g --> + <xsl:element name="number:number"> + <xsl:choose> + <xsl:when test="contains( $valid-number-format-string, '.')"> + <xsl:attribute name="number:decimal-places"> + <xsl:value-of select="string-length( substring-after( $valid-number-format-string, '.') ) - string-length( translate( substring-after( $valid-number-format-string, '.'), '0', '') )"/> + </xsl:attribute> + <xsl:attribute name="number:min-integer-digits"> + <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="number:decimal-places">0</xsl:attribute> + <xsl:attribute name="number:min-integer-digits"> + <xsl:value-of select="string-length( $valid-number-format-string ) - string-length(translate( $valid-number-format-string, '0', '') )"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="contains( $valid-number-format-string, ',') and (substring( $valid-number-format-string,string-length($valid-number-format-string)) = ',')"> + <xsl:variable name="display-factor"> + <xsl:call-template name="get-display-factor"> + <xsl:with-param name="start-number" select="1"/> + <xsl:with-param name="thousand-count"> + <xsl:call-template name="thousand-count-temp"> + <xsl:with-param name="format-unit" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="number:display-factor"> + <xsl:value-of select="$display-factor"/> + </xsl:attribute> + <xsl:attribute name="number:grouping">true</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $valid-number-format-string, ',')"> + <xsl:attribute name="number:grouping">true</xsl:attribute> + </xsl:when> + </xsl:choose> + <!-- deal with number:embedded-text --> + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <!-- deal with post number:text --> + <xsl:variable name="post-number-format-text"> + <xsl:call-template name="get-post-number-format-text"> + <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$post-number-format-text"/> + <xsl:with-param name="unit-pos" select="1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'ggg')"> + <xsl:element name="number:era"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 3"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'gg')"> + <xsl:element name="number:era"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'g')"> + <xsl:element name="number:era"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'ee')"> + <xsl:element name="number:year"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'r')"> + <xsl:element name="number:year"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'yyyy')"> + <xsl:element name="number:year"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 4"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'yy')"> + <xsl:element name="number:year"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'e') or starts-with( $posed-number-format-unit, 'y')"> + <xsl:element name="number:year"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'mmmmm')"> + <xsl:element name="number:month"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:attribute name="number:textual">true</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 5"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'mmmm')"> + <xsl:element name="number:month"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:attribute name="number:textual">true</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 4"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'mmm')"> + <xsl:element name="number:month"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:attribute name="number:textual">true</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 3"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '[mm]')"> + <xsl:element name="number:minutes"> + <xsl:attribute name="number:style">long</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 4"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '[m]')"> + <xsl:element name="number:minutes"> + <xsl:attribute name="number:style">short</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 3"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'mm') and ( contains( $number-format-unit, 'h') or contains( $posed-number-format-unit, 's') )"> + <xsl:element name="number:minutes"> + <xsl:attribute name="number:style">long</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'mm')"> + <xsl:element name="number:month"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'm') and ( contains( $number-format-unit, 'h') or contains( $posed-number-format-unit, 's') )"> + <xsl:element name="number:minutes"> + <xsl:attribute name="number:style">short</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'm')"> + <xsl:element name="number:month"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'dddd') or starts-with( $posed-number-format-unit, 'aaaa')"> + <xsl:element name="number:day-of-week"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 4"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'ddd') or starts-with( $posed-number-format-unit, 'aaa')"> + <xsl:element name="number:day-of-week"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 3"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'dd')"> + <xsl:element name="number:day"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'd')"> + <xsl:element name="number:day"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:if test="string-length($calendar-type-name) > 0"> + <xsl:attribute name="number:calendar"> + <xsl:value-of select="$calendar-type-name"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'hh')"> + <xsl:element name="number:hours"> + <xsl:attribute name="number:style">long</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 2"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '[hh]')"> + <xsl:element name="number:hours"> + <xsl:attribute name="number:style">long</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 4"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'h')"> + <xsl:element name="number:hours"> + <xsl:attribute name="number:style">short</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '[h]')"> + <xsl:element name="number:hours"> + <xsl:attribute name="number:style">short</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 3"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'AM/PM') or starts-with( $posed-number-format-unit, 'am/pm')"> + <number:am-pm/> + <!-- long: am-pm doesn't support long style yet --> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 5"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'a/p'or starts-with( $posed-number-format-unit, 'A/P'))"> + <number:am-pm/> + <!-- short: am-pm doesn't support short style yet --> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 3"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 'ss')"> + <xsl:variable name="decimal-places"> + <xsl:choose> + <xsl:when test="starts-with( $posed-number-format-unit, 'ss.0')"> + <xsl:value-of select="string-length( $posed-number-format-unit) - string-length( translate( $posed-number-format-unit, '0', '') )"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="number:seconds"> + <xsl:attribute name="number:style">long</xsl:attribute> + <xsl:if test="$decimal-places > 0"> + <xsl:attribute name="number:decimal-places"> + <xsl:value-of select="$decimal-places"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:variable name="second-length"> + <xsl:choose> + <xsl:when test="$decimal-places > 0"> + <xsl:value-of select="$decimal-places + 3"/> + </xsl:when> + <xsl:otherwise>2</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + $second-length"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '[ss]')"> + <xsl:element name="number:seconds"> + <xsl:attribute name="number:style">long</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 4"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, 's')"> + <xsl:variable name="decimal-places"> + <xsl:choose> + <xsl:when test="starts-with( $posed-number-format-unit, 's.0')"> + <xsl:value-of select="string-length( $posed-number-format-unit) - string-length( translate( $posed-number-format-unit, '0', '') )"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="number:seconds"> + <xsl:attribute name="number:style">short</xsl:attribute> + <xsl:if test="$decimal-places > 0"> + <xsl:attribute name="number:decimal-places"> + <xsl:value-of select="$decimal-places"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:variable name="second-length"> + <xsl:choose> + <xsl:when test="$decimal-places > 0"> + <xsl:value-of select="$decimal-places + 2"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + $second-length"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '[s]')"> + <xsl:element name="number:seconds"> + <xsl:attribute name="number:style">short</xsl:attribute> + </xsl:element> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 3"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '@')"> + <number:text-content/> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'General Number'"> + <number:number number:decimal-places="0" number:min-integer-digits="1"/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'General Date'"> + <number:year number:style="long"/> + <number:text>-</number:text> + <number:month number:style="short"/> + <number:text>-</number:text> + <number:day number:style="short"/> + <number:text> + <xsl:text> </xsl:text> + </number:text> + <number:hours number:style="short"/> + <number:text>:</number:text> + <number:minutes number:style="long"/> + </xsl:when> + <!-- special for General number:text-content output --> + <xsl:when test="starts-with($posed-number-format-unit , 'General')"> + <xsl:choose> + <xsl:when test="$posed-number-format-unit = 'General' and $condition-pos = 1"> + <number:number number:decimal-places="0" number:min-integer-digits="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="unit-pos" select="8"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Fixed'"> + <number:number number:decimal-places="2" number:min-integer-digits="1"/> + <number:text/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Standard'"> + <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Long Date'"> + <number:year number:style="long"/> + <number:text>-</number:text> + <number:month number:style="long"/> + <number:text>-</number:text> + <number:day number:style="long"/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Medium Date'"> + <number:day number:style="short"/> + <number:text>-</number:text> + <number:month number:textual="true"/> + <number:text>-</number:text> + <number:year number:style="short"/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Short Date'"> + <number:day number:style="short"/> + <number:text>-</number:text> + <number:month number:style="short"/> + <number:text>-</number:text> + <number:year number:style="short"/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Long Time'"> + <number:hours number:style="long"/> + <number:text>:</number:text> + <number:minutes number:style="long"/> + <number:text>:</number:text> + <number:seconds number:style="long"/> + <number:text> + <xsl:text> </xsl:text> + </number:text> + <number:am-pm/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Medium Time'"> + <number:hours number:style="short"/> + <number:text>:</number:text> + <number:minutes number:style="long"/> + <number:text> + <xsl:text> </xsl:text> + </number:text> + <number:am-pm/> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Short Time'"> + <number:hours number:style="short"/> + <number:text>:</number:text> + <number:minutes number:style="long"/> + <number:text> + <xsl:text> </xsl:text> + </number:text> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Percent'"> + <number:number number:decimal-places="2" number:min-integer-digits="1"/> + <number:text>%</number:text> + </xsl:when> + <xsl:when test="$posed-number-format-unit = 'Scientific'"> + <number:scientific-number number:decimal-places="2" number:min-integer-digits="1" number:min-exponent-digits="2"/> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '[')"> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + string-length( substring-before( $posed-number-format-unit, ']') ) + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, '/')"> + <number:text>/</number:text> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( $posed-number-format-unit, ':')"> + <number:text>:</number:text> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length( $posed-number-format-unit ) > 0"> + <xsl:call-template name="create-number-format-content"> + <xsl:with-param name="style-type-name" select="$style-type-name"/> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + <xsl:with-param name="unit-pos" select="$unit-pos + 1"/> + <xsl:with-param name="condition-pos" select="$condition-pos"/> + <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/> + <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/> + <xsl:with-param name="numberTextValue" select="substring( $posed-number-format-unit, 1, 1)"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="thousand-count-temp"> + <!-- thousand count for char ',' at the latter of format-unit by recursion --> + <xsl:param name="format-unit"/> + <xsl:choose> + <xsl:when test="contains($format-unit, ',#')"> + <xsl:call-template name="thousand-count-temp"> + <xsl:with-param name="format-unit" select="substring-after($format-unit, ',#')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($format-unit, ',0')"> + <xsl:call-template name="thousand-count-temp"> + <xsl:with-param name="format-unit" select="substring-after($format-unit, ',0')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($format-unit) - string-length( translate($format-unit, ',', ''))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-calendar-type-name"> + <xsl:param name="calendar-type"/> + <xsl:variable name="temp-type"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$calendar-type"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="string-length($calendar-type)"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <!-- Japanese (Emperor era), #03 --> + <xsl:when test="$temp-type = 3">gengou</xsl:when> + <!-- Taiwanese, #04 --> + <xsl:when test="$temp-type = 4">ROC</xsl:when> + <!-- Korean (Tangun era) hanja_yoil is ok too. #05 --> + <xsl:when test="$temp-type = 5">hanja</xsl:when> + <!-- Hijri (Arabic lunar), #06 --> + <xsl:when test="$temp-type = 6">hijri</xsl:when> + <!-- Thai, #07 --> + <xsl:when test="$temp-type = 7">buddhist</xsl:when> + <!-- 01: Gregorian (Localized), 02: Gregorian (United States), 09: Gregorian (Middle East French), 0A: Gregorian (Arabic), 0B: Gregorian (Transliterated English) --> + <xsl:otherwise>gregorian</xsl:otherwise> + <!-- not found jewish yet --> + </xsl:choose> + </xsl:template> + <xsl:template name="get-valid-number-format-string"> + <xsl:param name="number-format-unit"/> + <xsl:choose> + <xsl:when test="contains( $number-format-unit, '\')"> + <xsl:call-template name="get-valid-number-format-string"> + <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '\'), substring( substring-after( $number-format-unit, '\'), 2) )"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $number-format-unit, '*')"> + <xsl:call-template name="get-valid-number-format-string"> + <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '*'), substring( substring-after( $number-format-unit, '*'), 2) )"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $number-format-unit, '_')"> + <xsl:call-template name="get-valid-number-format-string"> + <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '_'), substring( substring-after( $number-format-unit, '_'), 2) )"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $number-format-unit, '"')"> + <xsl:call-template name="get-valid-number-format-string"> + <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '"'), substring-after( substring-after( $number-format-unit, '"'), '"') )"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$number-format-unit"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-display-factor"> + <xsl:param name="start-number"/> + <xsl:param name="thousand-count"/> + <xsl:choose> + <xsl:when test="$thousand-count = 0"> + <xsl:value-of select="$start-number"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-display-factor"> + <xsl:with-param name="start-number" select="$start-number * 1000"/> + <xsl:with-param name="thousand-count" select="$thousand-count -1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-post-number-format-text"> + <xsl:param name="adapted-number-format-unit"/> + <xsl:param name="valid-number-format-string"/> + <xsl:variable name="first-embedded-character-pos"> + <xsl:choose> + <xsl:when test="contains( $adapted-number-format-unit, '\')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '\') ) + 1"/> + </xsl:when> + <xsl:when test="contains( $adapted-number-format-unit, '_')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '_') ) + 1"/> + </xsl:when> + <xsl:when test="contains( $adapted-number-format-unit, '*')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '*') ) + 1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="first-embedded-string-pos"> + <xsl:choose> + <xsl:when test="contains( $adapted-number-format-unit, '"')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '"') ) + 1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="first-embedded-text-pos"> + <xsl:choose> + <xsl:when test="$first-embedded-character-pos < $first-embedded-string-pos and $first-embedded-character-pos > 0"> + <xsl:value-of select="$first-embedded-character-pos"/> + </xsl:when> + <xsl:when test="$first-embedded-character-pos < $first-embedded-string-pos and $first-embedded-character-pos = 0"> + <xsl:value-of select="$first-embedded-string-pos"/> + </xsl:when> + <xsl:when test="$first-embedded-character-pos > $first-embedded-string-pos and $first-embedded-string-pos > 0"> + <xsl:value-of select="$first-embedded-string-pos"/> + </xsl:when> + <xsl:when test="$first-embedded-character-pos > $first-embedded-string-pos and $first-embedded-string-pos = 0"> + <xsl:value-of select="$first-embedded-character-pos"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-embedded-text-pos > string-length( $valid-number-format-string )"> + <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos)"/> + </xsl:when> + <xsl:when test="$first-embedded-text-pos > 0 and $first-embedded-text-pos < string-length( $valid-number-format-string )"> + <xsl:choose> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '\')"> + <xsl:call-template name="get-post-number-format-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '\'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '_')"> + <xsl:call-template name="get-post-number-format-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '_'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '*')"> + <xsl:call-template name="get-post-number-format-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '*'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '"')"> + <xsl:call-template name="get-post-number-format-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '"'), substring-after( substring-after( $adapted-number-format-unit, '"'), '"') )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="create-number-format-embedded-text"> + <xsl:param name="adapted-number-format-unit"/> + <xsl:param name="valid-number-format-string"/> + <xsl:variable name="first-embedded-character-pos"> + <xsl:choose> + <xsl:when test="contains( $adapted-number-format-unit, '\')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '\') ) + 1"/> + </xsl:when> + <xsl:when test="contains( $adapted-number-format-unit, '_')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '_') ) + 1"/> + </xsl:when> + <xsl:when test="contains( $adapted-number-format-unit, '*')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '*') ) + 1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="first-embedded-string-pos"> + <xsl:choose> + <xsl:when test="contains( $adapted-number-format-unit, '"')"> + <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '"') ) + 1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="first-embedded-text-pos"> + <xsl:choose> + <xsl:when test="$first-embedded-character-pos < $first-embedded-string-pos and $first-embedded-character-pos > 0"> + <xsl:value-of select="$first-embedded-character-pos"/> + </xsl:when> + <xsl:when test="$first-embedded-character-pos < $first-embedded-string-pos and $first-embedded-character-pos = 0"> + <xsl:value-of select="$first-embedded-string-pos"/> + </xsl:when> + <xsl:when test="$first-embedded-character-pos > $first-embedded-string-pos and $first-embedded-string-pos > 0"> + <xsl:value-of select="$first-embedded-string-pos"/> + </xsl:when> + <xsl:when test="$first-embedded-character-pos > $first-embedded-string-pos and $first-embedded-string-pos = 0"> + <xsl:value-of select="$first-embedded-character-pos"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:if test="$first-embedded-text-pos > 0 and $first-embedded-text-pos < string-length( $valid-number-format-string )"> + <xsl:variable name="text-pos"> + <xsl:choose> + <xsl:when test="contains( $valid-number-format-string, '.')"> + <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '.'), $first-embedded-text-pos)"/> + <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/> + </xsl:when> + <xsl:when test="contains( $valid-number-format-string, '/')"> + <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '/'), $first-embedded-text-pos)"/> + <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/> + </xsl:when> + <xsl:when test="contains( $valid-number-format-string, '%')"> + <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '%'), $first-embedded-text-pos)"/> + <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/> + </xsl:when> + <xsl:when test="contains( $valid-number-format-string, 'E')"> + <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, 'E'), $first-embedded-text-pos)"/> + <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="right-text-pos" select="substring( $valid-number-format-string, $first-embedded-text-pos)"/> + <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '\')"> + <number:embedded-text number:position="{$text-pos}"> + <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/> + </number:embedded-text> + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '\'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '_')"> + <number:embedded-text number:position="{$text-pos}"> + <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/> + </number:embedded-text> + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '_'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '*')"> + <number:embedded-text number:position="{$text-pos}"> + <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/> + </number:embedded-text> + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '*'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '"')"> + <number:embedded-text number:position="{$text-pos}"> + <xsl:value-of select="substring-before( substring( $adapted-number-format-unit, $first-embedded-text-pos + 1), '"')"/> + </number:embedded-text> + <xsl:call-template name="create-number-format-embedded-text"> + <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '"'), substring-after( substring-after( $adapted-number-format-unit, '"'), '"') )"/> + <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template name="create-master-styles"> + <xsl:param name="worksheetoptions"/> + <xsl:for-each select="$worksheetoptions"> + <xsl:element name="style:master-page"> + <xsl:attribute name="style:name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="concat( 'TAB_', ../@ss:Name)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="style:display-name"> + <xsl:value-of select="concat( 'PageStyle_', ../@ss:Name)"/> + </xsl:attribute> + <xsl:attribute name="style:page-layout-name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="concat( 'pm_', ../@ss:Name)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:choose> + <xsl:when test="x:PageSetup/x:Header/@x:Data"> + <style:header> + <xsl:call-template name="translate-header-footer"> + <xsl:with-param name="content" select="x:PageSetup/x:Header/@x:Data"/> + <xsl:with-param name="style-name-header" select="concat(../@ss:Name, substring(name(x:PageSetup/x:Header),1,1))"/> + </xsl:call-template> + </style:header> + </xsl:when> + <xsl:otherwise> + <style:header style:display="false"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="x:PageSetup/x:Footer/@x:Data"> + <style:footer> + <xsl:call-template name="translate-header-footer"> + <xsl:with-param name="content" select="x:PageSetup/x:Footer/@x:Data"/> + <xsl:with-param name="style-name-header" select="concat(../@ss:Name, substring(name(x:PageSetup/x:Footer),1,1))"/> + </xsl:call-template> + </style:footer> + </xsl:when> + <xsl:otherwise> + <style:footer style:display="false"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template name="translate-header-footer"> + <xsl:param name="content"/> + <xsl:param name="style-name-header"/> + <style:region-left> + <text:p> + <xsl:variable name="left-content"> + <xsl:call-template name="get-pos-content"> + <xsl:with-param name="content" select="$content"/> + <xsl:with-param name="pos" select="'left'"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$left-content"/> + <xsl:with-param name="style-name-header" select="concat($style-name-header,'L')"/> + <xsl:with-param name="index" select="0"/> + <xsl:with-param name="current-pos" select="1"/> + </xsl:call-template> + </text:p> + </style:region-left> + <style:region-center> + <text:p> + <xsl:variable name="center-content"> + <xsl:call-template name="get-pos-content"> + <xsl:with-param name="content" select="$content"/> + <xsl:with-param name="pos" select="'center'"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$center-content"/> + <xsl:with-param name="style-name-header" select="concat($style-name-header,'C')"/> + <xsl:with-param name="index" select="0"/> + <xsl:with-param name="current-pos" select="1"/> + </xsl:call-template> + </text:p> + </style:region-center> + <style:region-right> + <text:p> + <xsl:variable name="right-content"> + <xsl:call-template name="get-pos-content"> + <xsl:with-param name="content" select="$content"/> + <xsl:with-param name="pos" select="'right'"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$right-content"/> + <xsl:with-param name="style-name-header" select="concat($style-name-header,'R')"/> + <xsl:with-param name="index" select="0"/> + <xsl:with-param name="current-pos" select="1"/> + </xsl:call-template> + </text:p> + </style:region-right> + </xsl:template> + <xsl:template name="locate-header-footer-data"> + <xsl:param name="header-footer-data"/> + <xsl:param name="style-name-header"/> + <xsl:param name="index"/> + <xsl:param name="current-pos"/> + <xsl:variable name="current-style-data"> + <xsl:value-of select="substring($header-footer-data,$current-pos)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($current-style-data,'&X') or starts-with($current-style-data,'&Y') or starts-with($current-style-data,'&S') or starts-with($current-style-data,'&U') or starts-with($current-style-data,'&E') or starts-with($current-style-data,'&B')"> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$header-footer-data"/> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="index" select="$index"/> + <xsl:with-param name="current-pos" select="$current-pos+2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&0') or starts-with($current-style-data,'&1') or starts-with($current-style-data,'&2') or starts-with($current-style-data,'&3') or starts-with($current-style-data,'&4') or starts-with($current-style-data,'&5') or starts-with($current-style-data,'&6') or starts-with($current-style-data,'&7') or starts-with($current-style-data,'&8') or starts-with($current-style-data,'&9')"> + <xsl:variable name="font-size-length"> + <xsl:call-template name="get-digit-length"> + <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&')"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$header-footer-data"/> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="index" select="$index"/> + <xsl:with-param name="current-pos" select="$current-pos+1+$font-size-length"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&"')"> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$header-footer-data"/> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="index" select="$index"/> + <xsl:with-param name="current-pos" select="string-length(substring-before(substring($header-footer-data,$current-pos+2),'"'))+$current-pos+3"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="current-content-last-pos"> + <xsl:call-template name="get-current-content-last-pos"> + <xsl:with-param name="style-data" select="$header-footer-data"/> + <xsl:with-param name="current-pos" select="$current-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$current-pos > 1"> + <text:span text:style-name="{concat($style-name-header,$index)}"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring($header-footer-data,$current-pos,$current-content-last-pos+1-$current-pos)"/> + </xsl:call-template> + </text:span> + <xsl:if test="$current-content-last-pos < string-length($header-footer-data)"> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$header-footer-data"/> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="index" select="$index+1"/> + <xsl:with-param name="current-pos" select="$current-content-last-pos+1"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring($header-footer-data,$current-pos,$current-content-last-pos+1-$current-pos)"/> + </xsl:call-template> + <xsl:if test="$current-content-last-pos < string-length($header-footer-data)"> + <xsl:call-template name="locate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="$header-footer-data"/> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="index" select="$index"/> + <xsl:with-param name="current-pos" select="$current-content-last-pos+1"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-current-content-last-pos"> + <xsl:param name="style-data"/> + <xsl:param name="current-pos"/> + <xsl:variable name="current-style-data"> + <xsl:value-of select="substring($style-data,$current-pos)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($current-style-data,'&"') or starts-with($current-style-data,'&X') or starts-with($current-style-data,'&Y') or starts-with($current-style-data,'&S') or starts-with($current-style-data,'&U') or starts-with($current-style-data,'&E') or starts-with($current-style-data,'&B')or starts-with($current-style-data,'&0') or starts-with($current-style-data,'&1') or starts-with($current-style-data,'&2') or starts-with($current-style-data,'&3') or starts-with($current-style-data,'&4') or starts-with($current-style-data,'&5') or starts-with($current-style-data,'&6') or starts-with($current-style-data,'&7') or starts-with($current-style-data,'&8') or starts-with($current-style-data,'&9')"> + <xsl:value-of select="$current-pos - 1"/> + </xsl:when> + <xsl:when test="contains($current-style-data,'&"') or contains($current-style-data,'&X') or contains($current-style-data,'&Y') or contains($current-style-data,'&S') or contains($current-style-data,'&U') or contains($current-style-data,'&E') or contains($current-style-data,'&B')or contains($current-style-data,'&0') or contains($current-style-data,'&1') or contains($current-style-data,'&2') or contains($current-style-data,'&3') or contains($current-style-data,'&4') or contains($current-style-data,'&5') or contains($current-style-data,'&6') or contains($current-style-data,'&7') or contains($current-style-data,'&8') or contains($current-style-data,'&9')"> + <xsl:variable name="temp" select="substring-before(substring($current-style-data,2),'&')"/> + <xsl:variable name="next-amp-pos"> + <xsl:value-of select="$current-pos+string-length($temp)+1"/> + </xsl:variable> + <xsl:call-template name="get-current-content-last-pos"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$next-amp-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($style-data)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-header-footer-data"> + <xsl:param name="header-footer-data"/> + <xsl:choose> + <xsl:when test="contains( $header-footer-data, '&D')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&D')"/> + </xsl:call-template> + <text:date/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&D')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $header-footer-data, '&T')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&T')"/> + </xsl:call-template> + <text:time/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&T')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $header-footer-data, '&P')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&P')"/> + </xsl:call-template> + <text:page-number/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&P')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $header-footer-data, '&N')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&N')"/> + </xsl:call-template> + <text:page-count/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&N')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $header-footer-data, '&A')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&A')"/> + </xsl:call-template> + <text:sheet-name/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&A')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $header-footer-data, '&Z&F')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&Z&F')"/> + </xsl:call-template> + <text:file-name text:display="full"/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&Z&F')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $header-footer-data, '&Z')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&Z')"/> + </xsl:call-template> + <text:file-name text:display="path"/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&Z')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains( $header-footer-data, '&F')"> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&F')"/> + </xsl:call-template> + <text:file-name text:display="name"/> + <xsl:call-template name="translate-header-footer-data"> + <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&F')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$header-footer-data"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="create-page-master"> + <xsl:param name="worksheetoptions"/> + <xsl:for-each select="$worksheetoptions"> + <xsl:element name="style:page-layout"> + <xsl:attribute name="style:name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="concat( 'pm_', ../@ss:Name)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:element name="style:page-layout-properties"> + <xsl:choose> + <xsl:when test="x:PageSetup/x:Layout/@x:Orientation = 'Landscape'"> + <xsl:attribute name="style:print-orientation">landscape</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:print-orientation">portrait</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="x:PageSetup/x:Layout/@x:StartPageNumber"> + <xsl:attribute name="style:first-page-number"> + <xsl:value-of select="x:PageSetup/x:Layout/@x:StartPageNumber"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:first-page-number">continue</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="x:PageSetup/x:PageMargins"> + <xsl:attribute name="fo:margin-top"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Top,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + <xsl:attribute name="fo:margin-bottom"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Bottom,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + <xsl:attribute name="fo:margin-left"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Left,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + <xsl:attribute name="fo:margin-right"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Right,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test="x:PageSetup/x:Header"> + <style:header-style> + <xsl:element name="style:header-footer-properties"> + <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute> + <xsl:choose> + <xsl:when test="x:PageSetup/x:Header/@x:Margin"> + <xsl:attribute name="fo:margin-bottom"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(x:PageSetup/x:Header/@x:Margin,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-bottom">0.25cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </style:header-style> + </xsl:if> + <xsl:if test="x:PageSetup/x:Footer"> + <style:footer-style> + <xsl:element name="style:header-footer-properties"> + <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute> + <xsl:choose> + <xsl:when test="x:PageSetup/x:Footer/@x:Margin"> + <xsl:attribute name="fo:margin-top"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(x:PageSetup/x:Footer/@x:Margin,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-top">0.25cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </style:footer-style> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template match="ss:Style" name="style-style-content" mode="style-style-content"> + <xsl:element name="style:table-cell-properties"> + <xsl:if test="ss:Alignment"> + <xsl:if test="ss:Alignment/@ss:Vertical"> + <xsl:variable name="vertical-align"> + <xsl:choose> + <xsl:when test="ss:Alignment/@ss:Vertical = 'Top'">top</xsl:when> + <xsl:when test="ss:Alignment/@ss:Vertical = 'Center'">middle</xsl:when> + <xsl:when test="ss:Alignment/@ss:Vertical = 'Bottom'">bottom</xsl:when> + <xsl:when test="ss:Alignment/@ss:Vertical = 'Automatic'">middle</xsl:when> + <!-- actually for vertical written characters, not supported by StarOffice/OpenOffice now yet --> + <xsl:otherwise>middle</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:vertical-align"> + <xsl:value-of select="$vertical-align"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="ss:Alignment/@ss:WrapText = '1'"> + <xsl:attribute name="fo:wrap-option">wrap</xsl:attribute> + </xsl:if> + <xsl:if test="ss:Alignment/@ss:Indent"> + <xsl:attribute name="fo:padding-left"><!-- Indent is ten times of a point --> + <xsl:variable name="indent" select="ss:Alignment/@ss:Indent * 10"/> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat($indent,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:if test="ss:Alignment/@ss:Rotate"> + <xsl:attribute name="style:rotation-angle"> + <xsl:choose> + <xsl:when test="ss:Alignment/@ss:Rotate < 0"> + <xsl:value-of select="360 + ss:Alignment/@ss:Rotate"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="ss:Alignment/@ss:Rotate"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="style:rotation-align">none</xsl:attribute> + </xsl:if> + <xsl:if test="ss:Alignment/@ss:VerticalText = '1'"> + <xsl:attribute name="style:direction">ttb</xsl:attribute> + <!-- The horizontal align default for vertical text in Excel is 'center' --> + <xsl:if test="not(ss:Alignment/@ss:Horizontal)"> + <!-- OASIS XML removal + <xsl:attribute name="fo:text-align">center</xsl:attribute>--> + <xsl:attribute name="style:text-align-source">fix</xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + <xsl:if test="ss:Borders"> + <xsl:if test="ss:Borders/ss:Border"> + <xsl:apply-templates select="ss:Borders/ss:Border"/> + </xsl:if> + </xsl:if> + <xsl:apply-templates select="ss:Interior" mode="style-style-content"/> + <xsl:if test="ss:Protection"> + <xsl:choose> + <xsl:when test="ss:Protection/@ss:Protected = '0'"> + <xsl:choose> + <xsl:when test="ss:Protection/@ss:HideFormula = '1'"> + <xsl:attribute name="style:cell-protect">hidden-and-protected</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:cell-protect">none</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="ss:Protection/@x:HideFormula = '1'"> + <xsl:attribute name="style:cell-protect">protected formula-hidden</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:cell-protect">none</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!-- fix means the horizontal alignment is dependent on ss:Horizontal, + but set on paragraph properties not cell paragraphs --> + <xsl:if test="ss:Alignment/@ss:Horizontal"> + <xsl:attribute name="style:text-align-source">fix</xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:choose> + <xsl:when test="ss:Alignment/@ss:Horizontal"> + <xsl:element name="style:paragraph-properties"> + <xsl:variable name="text-align"> + <xsl:choose> + <xsl:when test="ss:Alignment/@ss:Horizontal = 'Left'">start</xsl:when> + <xsl:when test="ss:Alignment/@ss:Horizontal = 'Center'">center</xsl:when> + <xsl:when test="ss:Alignment/@ss:Horizontal = 'Right'">end</xsl:when> + <xsl:when test="ss:Alignment/@ss:Horizontal = 'Justify'">justify</xsl:when> + <!-- many other text-align not supported yet --> + <xsl:otherwise>start</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:text-align"> + <xsl:value-of select="$text-align"/> + </xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <!-- The horizontal align default for vertical text in Excel is 'center' --> + <xsl:element name="style:paragraph-properties"> + <xsl:if test="ss:Alignment/@ss:VerticalText = '1'"> + <xsl:attribute name="fo:text-align">center</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="ss:Font"> + <xsl:element name="style:text-properties"> + <xsl:choose> + <xsl:when test="ss:Font/@ss:FontName"> + <xsl:attribute name="style:font-name"> + <xsl:value-of select="ss:Font/@ss:FontName"/> + </xsl:attribute> + <xsl:attribute name="style:font-name-asian"> + <xsl:value-of select="ss:Font/@ss:FontName"/> + </xsl:attribute> + <xsl:attribute name="style:font-name-complex"> + <xsl:value-of select="ss:Font/@ss:FontName"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-name">Arial</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!-- "ss:Font/@x:Family" is useless here, so can't map to "svg:font-family" attribute --> + <xsl:if test="ss:Font/@ss:Bold = '1'"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="ss:Font/@ss:Color"> + <xsl:attribute name="fo:color"> + <xsl:value-of select="ss:Font/@ss:Color"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-window-font-color">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="ss:Font/@ss:Italic = '1'"> + <!-- omit font-style oblique --> + <xsl:attribute name="fo:font-style">italic</xsl:attribute> + <xsl:attribute name="style:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-complex">italic</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="ss:Font/@ss:Size"> + <xsl:attribute name="fo:font-size"> + <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/> + </xsl:attribute> + <xsl:attribute name="style:font-size-asian"> + <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/> + </xsl:attribute> + <xsl:attribute name="style:font-size-complex"> + <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:font-size">10pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian">10pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex">10pt</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="ss:Font/@ss:Outline = '1'"> + <xsl:attribute name="style:text-outline">true</xsl:attribute> + </xsl:if> + <xsl:if test="ss:Font/@ss:Shadow = '1'"> + <!-- Not in DTD nor in docu <xsl:attribute name="style:text-shadow">shadow</xsl:attribute> --> + <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute> + </xsl:if> + <xsl:if test="ss:Font/@ss:StrikeThrough = '1'"> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + </xsl:if> + <xsl:if test="ss:Font/@ss:Underline"> + <xsl:choose> + <xsl:when test="ss:Font/@ss:Underline = 'None'"> + <xsl:attribute name="style:text-underline-type">none</xsl:attribute> + </xsl:when> + <xsl:when test="ss:Font/@ss:Underline = 'Single'"> + <xsl:attribute name="style:text-underline-type">single</xsl:attribute> + </xsl:when> + <xsl:when test="ss:Font/@ss:Underline = 'Double'"> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + </xsl:when> + <xsl:when test="ss:Font/@ss:Underline = 'SingleAccounting'"> + <xsl:attribute name="style:text-underline-type">single</xsl:attribute>"</xsl:when> + <xsl:when test="ss:Font/@ss:Underline = 'DoubleAccounting'"> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:text-underline-type">none</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="ss:Font/@x:Charset"> + <!-- quite unclear till now, --> + <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + + <xsl:template match="ss:Interior" mode="style-style-content"> + <xsl:choose> + <xsl:when test="@ss:Pattern = 'Solid'"> + <xsl:if test="@ss:Color"> + <xsl:attribute name="fo:background-color"> + <xsl:value-of select="@ss:Color"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="@ss:PatternColor"> + <xsl:variable name="pattern-value"> + <xsl:call-template name="cell-pattern-color"> + <xsl:with-param name="pattern" select="concat('0.',substring-after(@ss:Pattern,'y'))"/> + <xsl:with-param name="color-value" select="@ss:Color"/> + <xsl:with-param name="pattern-color-value" select="@ss:PatternColor"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:background-color"> + <xsl:value-of select="$pattern-value"/> + </xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="ss:Style"> + <!-- style:default-style is meant for application defaults + <xsl:when test="@ss:ID = 'Default'"> + <xsl:element name="style:default-style"> + <xsl:call-template name="style-style-content" /> + </xsl:element> + </xsl:when> --> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"> + <xsl:value-of select="@ss:ID"/> + </xsl:attribute> + <xsl:apply-templates select="@ss:Name" /> + <xsl:choose> + <xsl:when test="@ss:Parent"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="@ss:Parent"/> + </xsl:attribute> + </xsl:when> + <!-- no parent, but automatic style are automatically inheriting from a style called 'Default' + not necessary named style --> + <xsl:when test="not(key('Style', @ss:ID)/@ss:Name)"> + <xsl:attribute name="style:parent-style-name"> + <xsl:text>Default</xsl:text> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="ss:NumberFormat/@ss:Format"> + <xsl:attribute name="style:data-style-name"> + <xsl:value-of select="concat( @ss:ID, 'F')"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:call-template name="style-style-content"/> + </xsl:element> + </xsl:template> + <xsl:template name="cell-pattern-color"> + <!-- generates a new color from cell-pattern-color --> + <xsl:param name="pattern"/> + <xsl:param name="color-value"/> + <xsl:param name="pattern-color-value"/> + <xsl:variable name="rev-pattern" select="1 - $pattern"/> + <xsl:variable name="color-R-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($color-value,2,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="color-G-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($color-value,4,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="color-B-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($color-value,6,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pattern-R-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($pattern-color-value,2,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pattern-G-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($pattern-color-value,4,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pattern-B-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($pattern-color-value,6,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="R-value"> + <xsl:variable name="combined-R-value"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="floor($color-R-value * $rev-pattern + $pattern-R-value * $pattern)"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($combined-R-value) = 1"> + <xsl:value-of select="concat('0',$combined-R-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$combined-R-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="G-value"> + <xsl:variable name="combined-G-value"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="floor($color-G-value * $rev-pattern + $pattern-G-value * $pattern)"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($combined-G-value) = 1"> + <xsl:value-of select="concat('0',$combined-G-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$combined-G-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="B-value"> + <xsl:variable name="combined-B-value"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="floor($color-B-value * $rev-pattern + $pattern-B-value * $pattern)"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($combined-B-value) = 1"> + <xsl:value-of select="concat('0',$combined-B-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$combined-B-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('#',$R-value,$G-value,$B-value)"/> + </xsl:template> + <xsl:template name="colorindex2decimal"> + <xsl:param name="colorindex"/> + <xsl:variable name="colorIndexLookup"> + <xsl:value-of select="$colorindex - 8"/> + </xsl:variable> + <xsl:variable name="tempColorValue"> + <xsl:choose> + <!-- Grab the color from the custom color index if it exists... --> + <xsl:when test="/ss:Workbook/o:OfficeDocumentSettings/o:Colors/o:Color/o:Index=$colorIndexLookup"> + <xsl:value-of select="substring-after(normalize-space(/ss:Workbook/o:OfficeDocumentSettings/o:Colors/o:Color/o:RGB[/ss:Workbook/o:OfficeDocumentSettings/o:Colors/o:Color/o:Index=$colorIndexLookup]), '#')"/> + </xsl:when > + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$colorindex=8"> + <xsl:value-of select="'000000'"/> + </xsl:when> + <xsl:when test="$colorindex=9"> + <xsl:value-of select="'FFFFFF'"/> + </xsl:when> + <xsl:when test="$colorindex=10"> + <xsl:value-of select="'FF0000'"/> + </xsl:when> + <xsl:when test="$colorindex=11"> + <xsl:value-of select="'00FF00'"/> + </xsl:when> + <xsl:when test="$colorindex=12"> + <xsl:value-of select="'0000FF'"/> + </xsl:when> + <xsl:when test="$colorindex=13"> + <xsl:value-of select="'FFFF00'"/> + </xsl:when> + <xsl:when test="$colorindex=14"> + <xsl:value-of select="'FF00FF'"/> + </xsl:when> + <xsl:when test="$colorindex=15"> + <xsl:value-of select="'00FFFF'"/> + </xsl:when> + <xsl:when test="$colorindex=16"> + <xsl:value-of select="'800000'"/> + </xsl:when> + <xsl:when test="$colorindex=17"> + <xsl:value-of select="'008000'"/> + </xsl:when> + <xsl:when test="$colorindex=18"> + <xsl:value-of select="'000080'"/> + </xsl:when> + <xsl:when test="$colorindex=19"> + <xsl:value-of select="'808000'"/> + </xsl:when> + <xsl:when test="$colorindex=20"> + <xsl:value-of select="'800080'"/> + </xsl:when> + <xsl:when test="$colorindex=21"> + <xsl:value-of select="'008080'"/> + </xsl:when> + <xsl:when test="$colorindex=22"> + <xsl:value-of select="'C0C0C0'"/> + </xsl:when> + <xsl:when test="$colorindex=23"> + <xsl:value-of select="'808080'"/> + </xsl:when> + <xsl:when test="$colorindex=24"> + <xsl:value-of select="'9999FF'"/> + </xsl:when> + <xsl:when test="$colorindex=25"> + <xsl:value-of select="'993366'"/> + </xsl:when> + <xsl:when test="$colorindex=26"> + <xsl:value-of select="'FFFFCC'"/> + </xsl:when> + <xsl:when test="$colorindex=27"> + <xsl:value-of select="'CCFFFF'"/> + </xsl:when> + <xsl:when test="$colorindex=28"> + <xsl:value-of select="'660066'"/> + </xsl:when> + <xsl:when test="$colorindex=29"> + <xsl:value-of select="'FF8080'"/> + </xsl:when> + <xsl:when test="$colorindex=30"> + <xsl:value-of select="'0066CC'"/> + </xsl:when> + <xsl:when test="$colorindex=31"> + <xsl:value-of select="'CCCCFF'"/> + </xsl:when> + <xsl:when test="$colorindex=32"> + <xsl:value-of select="'000080'"/> + </xsl:when> + <xsl:when test="$colorindex=33"> + <xsl:value-of select="'FF00FF'"/> + </xsl:when> + <xsl:when test="$colorindex=34"> + <xsl:value-of select="'FFFF00'"/> + </xsl:when> + <xsl:when test="$colorindex=35"> + <xsl:value-of select="'00FFFF'"/> + </xsl:when> + <xsl:when test="$colorindex=36"> + <xsl:value-of select="'800080'"/> + </xsl:when> + <xsl:when test="$colorindex=37"> + <xsl:value-of select="'800000'"/> + </xsl:when> + <xsl:when test="$colorindex=38"> + <xsl:value-of select="'008080'"/> + </xsl:when> + <xsl:when test="$colorindex=39"> + <xsl:value-of select="'0000FF'"/> + </xsl:when> + <xsl:when test="$colorindex=40"> + <xsl:value-of select="'00CCFF'"/> + </xsl:when> + <xsl:when test="$colorindex=41"> + <xsl:value-of select="'CCFFFF'"/> + </xsl:when> + <xsl:when test="$colorindex=42"> + <xsl:value-of select="'CCFFCC'"/> + </xsl:when> + <xsl:when test="$colorindex=43"> + <xsl:value-of select="'FFFF99'"/> + </xsl:when> + <xsl:when test="$colorindex=44"> + <xsl:value-of select="'99CCFF'"/> + </xsl:when> + <xsl:when test="$colorindex=45"> + <xsl:value-of select="'FF99CC'"/> + </xsl:when> + <xsl:when test="$colorindex=46"> + <xsl:value-of select="'CC99FF'"/> + </xsl:when> + <xsl:when test="$colorindex=47"> + <xsl:value-of select="'FFCC99'"/> + </xsl:when> + <xsl:when test="$colorindex=48"> + <xsl:value-of select="'3366FF'"/> + </xsl:when> + <xsl:when test="$colorindex=49"> + <xsl:value-of select="'33CCCC'"/> + </xsl:when> + <xsl:when test="$colorindex=50"> + <xsl:value-of select="'99CC00'"/> + </xsl:when> + <xsl:when test="$colorindex=51"> + <xsl:value-of select="'FFCC00'"/> + </xsl:when> + <xsl:when test="$colorindex=52"> + <xsl:value-of select="'FF9900'"/> + </xsl:when> + <xsl:when test="$colorindex=53"> + <xsl:value-of select="'FF6600'"/> + </xsl:when> + <xsl:when test="$colorindex=54"> + <xsl:value-of select="'666699'"/> + </xsl:when> + <xsl:when test="$colorindex=55"> + <xsl:value-of select="'969696'"/> + </xsl:when> + <xsl:when test="$colorindex=56"> + <xsl:value-of select="'003366'"/> + </xsl:when> + <xsl:when test="$colorindex=57"> + <xsl:value-of select="'339966'"/> + </xsl:when> + <xsl:when test="$colorindex=58"> + <xsl:value-of select="'003300'"/> + </xsl:when> + <xsl:when test="$colorindex=59"> + <xsl:value-of select="'333300'"/> + </xsl:when> + <xsl:when test="$colorindex=60"> + <xsl:value-of select="'993300'"/> + </xsl:when> + <xsl:when test="$colorindex=61"> + <xsl:value-of select="'993366'"/> + </xsl:when> + <xsl:when test="$colorindex=62"> + <xsl:value-of select="'333399'"/> + </xsl:when> + <xsl:when test="$colorindex=63"> + <xsl:value-of select="'333333'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'NOTFOUND'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="tempColorDecimal"> + <xsl:choose> + <xsl:when test="not($tempColorValue = 'NOTFOUND')"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$tempColorValue"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="6"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4294967295"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$tempColorDecimal"/> + </xsl:template> + <xsl:template name="hex2decimal"> + <!-- transforms a hex number to a decimal number.parses the string from left to right --> + <xsl:param name="hex-number"/> + <xsl:param name="index"/> + <xsl:param name="str-length"/> + <xsl:param name="last-value"/> + <xsl:variable name="dec-char"> + <xsl:call-template name="hexNumber2dec"> + <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/> + <xsl:if test="$index < $str-length"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$hex-number"/> + <xsl:with-param name="index" select="$index + 1"/> + <xsl:with-param name="str-length" select="$str-length"/> + <xsl:with-param name="last-value" select="$current-value"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$index = $str-length"> + <xsl:value-of select="$current-value"/> + </xsl:if> + </xsl:template> + <xsl:template name="hexNumber2dec"> + <!-- return a decimal number for a hex character --> + <xsl:param name="hex-value"/> + <xsl:choose> + <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')"> + <xsl:value-of select="10"/> + </xsl:when> + <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')"> + <xsl:value-of select="11"/> + </xsl:when> + <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')"> + <xsl:value-of select="12"/> + </xsl:when> + <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')"> + <xsl:value-of select="13"/> + </xsl:when> + <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')"> + <xsl:value-of select="14"/> + </xsl:when> + <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')"> + <xsl:value-of select="15"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$hex-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="decimal2hex"> + <!-- transforms a decimal number to a hex number,only for two-bit hex(less than 256 in decimal) currently --> + <xsl:param name="dec-number"/> + <xsl:param name="last-value"/> + <xsl:variable name="current-value"> + <xsl:call-template name="decNumber2hex"> + <xsl:with-param name="dec-value"> + <xsl:if test="$dec-number > 15"> + <xsl:value-of select="floor($dec-number div 16)"/> + </xsl:if> + <xsl:if test="$dec-number < 16"> + <xsl:value-of select="$dec-number"/> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$dec-number > 15"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="$dec-number mod 16"/> + <xsl:with-param name="last-value" select="concat($last-value,$current-value)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$dec-number < 16"> + <xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/> + </xsl:if> + </xsl:template> + <xsl:template name="decNumber2hex"> + <!-- return a hex number for a decimal character --> + <xsl:param name="dec-value"/> + <xsl:choose> + <xsl:when test="$dec-value = 10"> + <xsl:value-of select="'A'"/> + </xsl:when> + <xsl:when test="$dec-value = 11"> + <xsl:value-of select="'B'"/> + </xsl:when> + <xsl:when test="$dec-value = 12"> + <xsl:value-of select="'C'"/> + </xsl:when> + <xsl:when test="$dec-value = 13"> + <xsl:value-of select="'D'"/> + </xsl:when> + <xsl:when test="$dec-value = 14"> + <xsl:value-of select="'E'"/> + </xsl:when> + <xsl:when test="$dec-value = 15"> + <xsl:value-of select="'F'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$dec-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ss:Border"> + <xsl:variable name="position"> + <xsl:choose> + <xsl:when test="@ss:Position = 'Top'">fo:border-top</xsl:when> + <xsl:when test="@ss:Position = 'Bottom'">fo:border-bottom</xsl:when> + <xsl:when test="@ss:Position = 'Left'">fo:border-left</xsl:when> + <xsl:when test="@ss:Position = 'Right'">fo:border-right</xsl:when> + <!-- DiagonalLeft & DiagonalRight are not supported yet, --> + <xsl:otherwise>fo:border-left</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="width"> + <xsl:choose> + <!-- 0: Hairline --> + <xsl:when test="@ss:Weight = '0'">0.002cm</xsl:when> + <!-- 1: Thin --> + <xsl:when test="@ss:Weight = '1'">0.035cm</xsl:when> + <!-- 2: Medium --> + <xsl:when test="@ss:Weight = '2'">0.088cm</xsl:when> + <!-- 3: Thick --> + <xsl:when test="@ss:Weight = '3'"> + <xsl:choose> + <xsl:when test="@ss:LineStyle = 'Double'">0.105cm</xsl:when> + <xsl:otherwise>0.141cm</xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- invalid value, or parameter not exist at all --> + <xsl:otherwise>0.002cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="linestyle"> + <xsl:choose> + <xsl:when test="@ss:LineStyle = 'None'">none</xsl:when> + <xsl:when test="@ss:LineStyle = 'Continuous'">solid</xsl:when> + <xsl:when test="@ss:LineStyle = 'Double'">double</xsl:when> + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="color"> + <xsl:choose> + <xsl:when test="@ss:Color"> + <xsl:value-of select="@ss:Color"/> + </xsl:when> + <!-- default border color is black --> + <xsl:otherwise>#000000</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="{$position}"> + <xsl:value-of select="concat( $width, ' ', $linestyle, ' ', $color)"/> + </xsl:attribute> + <xsl:if test="@ss:LineStyle = 'Double'"> + <xsl:variable name="widthposition"> + <xsl:choose> + <xsl:when test="@ss:Position = 'Top'">style:border-line-width-top</xsl:when> + <xsl:when test="@ss:Position = 'Bottom'">style:border-line-width-bottom</xsl:when> + <xsl:when test="@ss:Position = 'Left'">style:border-line-width-left</xsl:when> + <xsl:when test="@ss:Position = 'Right'">style:border-line-width-right</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="{$widthposition}">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="ss:Font"> + <xsl:choose> + <xsl:when test="@ss:VerticalAlign = 'Superscript'"> + <style:style style:name="{concat(../@ss:ID,'T0')}" style:family="text"> + <style:text-properties style:text-position="33% 58%"/> + </style:style> + </xsl:when> + <xsl:when test="@ss:VerticalAlign = 'Subscript'"> + <style:style style:name="{concat(../@ss:ID,'T0')}" style:family="text"> + <style:text-properties style:text-position="-33% 58%"/> + </style:style> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template match="ss:Table"> + <xsl:variable name="default-column-width"> + <xsl:choose> + <xsl:when test="@ss:DefaultColumnWidth"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(@ss:DefaultColumnWidth,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:when> + <!-- Note: Specify where this value come from... --> + <xsl:otherwise>2.096cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="table-pos"> + <xsl:value-of select="count(../preceding-sibling::ss:Worksheet)+1"/> + </xsl:variable> + <!-- naming convention the default column style is name co<NumberOfSheet> e.g. co1 for the first sheet --> + <style:style style:family="table-column" style:name="{concat('co', $table-pos)}"> + <style:table-column-properties fo:break-before="auto" style:column-width="{$default-column-width}"/> + </style:style> + <xsl:variable name="columnCount" select="count(ss:Column)"/> + <xsl:for-each select="ss:Column"> + <xsl:apply-templates select="." mode="create-column-style"> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentCount" select="position()"/> + <xsl:with-param name="table-pos" select="$table-pos"/> + <xsl:with-param name="default-column-width" select="$default-column-width"/> + </xsl:apply-templates> + </xsl:for-each> + <xsl:if test="../x:PageBreaks/x:ColBreaks"> + <style:style style:name="{concat('cob',$table-pos)}" style:family="table-column"> + <xsl:element name="style:table-column-properties"> + <xsl:attribute name="style:column-width"> + <xsl:value-of select="$default-column-width"/> + </xsl:attribute> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:element> + </style:style> + </xsl:if> + <xsl:variable name="default-row-height"> + <xsl:choose> + <xsl:when test="@ss:DefaultRowHeight"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(@ss:DefaultRowHeight,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:when> + <!-- Note: This is the default row height value in spec it is written 255 point, this seems wrong --> + <!-- <xsl:otherwise>0.503cm</xsl:otherwise> --> + <xsl:otherwise>0.45cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <style:style style:family="table-row" style:name="{concat('ro', $table-pos)}"> + <style:table-row-properties style:row-height="{$default-row-height}" style:use-optimal-row-height="false"/> + </style:style> + <xsl:variable name="rowCount" select="count(ss:Row)"/> + <xsl:for-each select="ss:Row"> + <xsl:apply-templates select="." mode="create-row-style"> + <xsl:with-param name="rowNodeCount" select="$rowCount"/> + <xsl:with-param name="rowNodeIndex" select="position()"/> + <xsl:with-param name="table-pos" select="$table-pos"/> + <xsl:with-param name="default-row-height" select="$default-row-height"/> + </xsl:apply-templates> + </xsl:for-each> + <xsl:if test="../x:PageBreaks/x:RowBreaks"> + <style:style style:name="{concat('rob',$table-pos)}" style:family="table-row"> + <xsl:element name="style:table-row-properties"> + <xsl:attribute name="style:row-height"> + <xsl:value-of select="$default-row-height"/> + </xsl:attribute> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:element> + </style:style> + </xsl:if> + <!-- create table-style --> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"> + <xsl:value-of select="concat( 'ta', $table-pos)"/> + </xsl:attribute> + <xsl:attribute name="style:family">table</xsl:attribute> + <!-- ss:Name have to be from type 'NCNameChar' ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender --> + <xsl:attribute name="style:master-page-name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" select="../@ss:Name"/> + </xsl:call-template> + </xsl:attribute> + <xsl:element name="style:table-properties"> + <xsl:choose> + <xsl:when test="../x:WorksheetOptions/x:Visible = 'SheetHidden'"> + <xsl:attribute name="table:display">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:display">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="ss:Column" mode="create-column-style"> + <!-- generate stylename of colbreak after matching the column number and the colbreak number --> + <xsl:param name="columnCount"/> + <xsl:param name="currentCount"/> + <xsl:param name="table-pos"/> + <xsl:param name="default-column-width"/> + <xsl:variable name="span-value" select="@ss:Span + count(@ss:Span)"/> + <xsl:variable name="finishedColumns"> + <xsl:choose> + <xsl:when test="@ss:Index"> + <xsl:value-of select="@ss:Index -1 + $span-value"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="recent-index" + select="preceding-sibling::ss:Column[@ss:Index][last()]"/> + <xsl:choose> + <xsl:when test="$recent-index"> + <xsl:variable name="nodes-up-to-current" + select="set:intersection(preceding-sibling::ss:Column, $recent-index/following-sibling::ss:Column)"/> + <xsl:variable name="allSpans" select="$nodes-up-to-current/@ss:Span"/> + <xsl:value-of + select="$recent-index/@ss:Index + count($nodes-up-to-current) + sum($allSpans) + count($allSpans)" + /> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="allSpans" select="preceding-sibling::ss:Column/@ss:Span"/> + + <xsl:value-of select="$currentCount + sum($allSpans) + count($allSpans)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current-index"> + <xsl:choose> + <xsl:when test="@ss:Index"> + <xsl:value-of select="@ss:Index - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$finishedColumns"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="column-break"> + <xsl:choose> + <xsl:when test="$span-value = 0"> + <xsl:if test="../x:PageBreaks/x:ColBreaks/x:ColBreak/x:Column = $current-index"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if + test="../x:PageBreaks/x:ColBreaks[(x:ColBreak/x:Column > $finishedColumns) and (x:ColBreak/x:Column < ($finishedColumns + $span-value))]"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$column-break = 1"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"> + <xsl:call-template name="encode-as-nc-name"> + <xsl:with-param name="string" + select="concat('cob', $table-pos, '-',$currentCount)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="style:family">table-column</xsl:attribute> + <xsl:element name="style:table-column-properties"> + <xsl:choose> + <xsl:when test="@ss:Width"> + <xsl:attribute name="style:column-width"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" + select="concat(@ss:Width,'pt')" + /> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:column-width"> + <xsl:value-of select="$default-column-width"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when + test="@ss:AutoFitWidth = '0'"> + <xsl:attribute name="style:use-optimal-column-width" + >false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when + test="@ss:Width > 0"> + <xsl:attribute name="style:use-optimal-column-width" + >false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-optimal-column-width" + >true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:if> + <style:style style:name="{concat('co', $table-pos, '-',$currentCount)}" + style:family="table-column"> + <xsl:element name="style:table-column-properties"> + <xsl:choose> + <xsl:when test="@ss:Width"> + <xsl:attribute name="style:column-width"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" + select="concat(@ss:Width,'pt')" + /> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:column-width"> + <xsl:value-of select="$default-column-width"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">auto</xsl:attribute> + </xsl:element> + </style:style> + </xsl:template> + + <xsl:template match="ss:Row" mode="create-row-style"> + <!-- generate stylename of rowbreak after matching the row number and the rowbreak number --> + <xsl:param name="rowNodeCount"/> + <xsl:param name="rowNodeIndex" select="position()"/> + <xsl:param name="table-pos"/> + <xsl:param name="default-row-height"/> + <xsl:variable name="simple-span-value" select="@ss:Span + count(@ss:Span)"/> + + <xsl:variable name="earlierRowNo"> + <xsl:choose> + <xsl:when test="@ss:Index"><xsl:value-of select="@ss:Index -1 + $simple-span-value"/></xsl:when> + <xsl:otherwise> + <xsl:variable name="recent-index" select="preceding-sibling::ss:Row[@ss:Index][last()]"></xsl:variable> + <xsl:choose> + <xsl:when test="$recent-index"> + <xsl:variable name="nodes-up-to-current" select="set:intersection(preceding-sibling::ss:Row, $recent-index/following-sibling::ss:Row)"></xsl:variable> + <xsl:variable name="allSpans" select="$nodes-up-to-current/@ss:Span"/> + <xsl:value-of select="$recent-index/@ss:Index + count($nodes-up-to-current) + sum($allSpans) + count($allSpans)"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="allSpans" select="preceding-sibling::ss:Row/@ss:Span"/> + <xsl:value-of select="position() + sum($allSpans) + count($allSpans)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="span-value"> + <xsl:choose> + <xsl:when test="@ss:Index"> + <xsl:choose> + <xsl:when test="@ss:Span"> + <xsl:value-of select="@ss:Index - $earlierRowNo + @ss:Span"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@ss:Span"> + <xsl:value-of select="@ss:Span + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="current-index"> + <xsl:choose> + <xsl:when test="@ss:Index"> + <xsl:value-of select="@ss:Index - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$earlierRowNo"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="row-break"> + <xsl:choose> + <xsl:when test="$span-value = 0"> + <xsl:if test="../x:PageBreaks/x:RowBreaks/x:RowBreak/x:Row = $current-index"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="../x:PageBreaks/x:RowBreaks[(x:RowBreak/x:Row > $earlierRowNo) and (x:RowBreak/x:Row < ($earlierRowNo + $span-value))]"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$row-break = 1"> + <xsl:element name="style:style"> + <xsl:choose> + <xsl:when test="@ss:StyleID"> + <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex,'-',@ss:StyleID)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="style:family">table-row</xsl:attribute> + + + <xsl:element name="style:table-row-properties"> + <xsl:choose> + <xsl:when test="@ss:Height"> + <xsl:attribute name="style:row-height"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(@ss:Height,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:row-height"> + <xsl:value-of select="$default-row-height"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@ss:AutoFitHeight = '0'"> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@ss:Height > 0"> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + <xsl:apply-templates select="key('Style', @ss:StyleID)/ss:Interior" mode="style-style-content"/> + </xsl:element> + <!-- + <xsl:apply-templates select="key('Style', @ss:StyleID)" mode="style-style-content" /> + --> + </xsl:element> + </xsl:if> + <!-- + <style:style style:name="{concat('ro', $table-pos, '-',$rowNodeIndex)}" style:family="table-row"> + --> + <xsl:element name="style:style"> + <xsl:choose> + <xsl:when test="@ss:StyleID"> + <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex,'-',@ss:StyleID)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="style:family">table-row</xsl:attribute> + + + <xsl:element name="style:table-row-properties"> + <xsl:choose> + <xsl:when test="@ss:Height"> + <xsl:attribute name="style:row-height"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(@ss:Height,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:row-height"> + <xsl:value-of select="$default-row-height"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@ss:AutoFitHeight"> + <xsl:choose> + <xsl:when test="@ss:AutoFitHeight = '0'"> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@ss:Height > 0"> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">auto</xsl:attribute> + <!-- apply to background --> + <xsl:apply-templates select="key('Style', @ss:StyleID)/ss:Interior" mode="style-style-content"/> + </xsl:element> + <!-- + <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)" mode="style-style-content" /> + --> + </xsl:element> + + + </xsl:template> + + <xsl:template name="count-spanned-columns"> + <xsl:param name="expandedColumnCount" select="0"/> + <xsl:param name="columns"/> + <xsl:param name="columnsCount" select="count($columns)"/> + <xsl:param name="columnIndex" select="1"/> + <xsl:choose> + <xsl:when test="$columnIndex <= $columnsCount"> + <xsl:call-template name="count-spanned-columns"> + <xsl:with-param name="columns" select="$columns"/> + <xsl:with-param name="columnsCount" select="$columnsCount"/> + <xsl:with-param name="columnIndex" select="$columnIndex + 1"/> + <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount + $columns[$columnIndex]/@ss:Span"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$expandedColumnCount"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ss:Worksheet"> + <xsl:element name="table:table"> + <xsl:attribute name="table:name"> + <xsl:value-of select="@ss:Name"/> + </xsl:attribute> + <!-- other attributes aren't suitable to apply yet --> + <xsl:if test="ss:Table"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat( 'ta', count(preceding-sibling::ss:Worksheet)+1)"/> + </xsl:attribute> + <xsl:if test="@ss:Protected = '1'"> + <xsl:attribute name="table:protected">true</xsl:attribute> + </xsl:if> + <xsl:if test="descendant::ss:NamedRange[@ss:Name = 'Print_Area' and contains( @ss:RefersTo, '!R')]"> + <xsl:variable name="referto"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="descendant::ss:NamedRange/@ss:RefersTo"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="table:print-ranges"> + <xsl:value-of select="translate( $referto, '=', '$')"/> + </xsl:attribute> + </xsl:if> + <xsl:variable name="table-pos"> + <xsl:value-of select="count(../preceding-sibling::ss:Worksheet)+1"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="ss:Table/@ss:ExpandedColumnCount"> + <xsl:choose> + <xsl:when test="not(ss:Table/ss:Column)"> + <!-- no columns exist --> + <xsl:call-template name="create-columns-without-input"> + <xsl:with-param name="table-pos" select="$table-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="ss:Table/@ss:ExpandedColumnCount"/> + <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="ss:Table/ss:Column/@ss:Span"> + <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes and spanned columns --> + <xsl:variable name="spannedColumns"> + <xsl:call-template name="count-spanned-columns"> + <xsl:with-param name="columns" select="ss:Table/ss:Column[@ss:Span]"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="count(ss:Table/ss:Column) + number($spannedColumns)"/> + <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes --> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="count(ss:Table/ss:Column)"/> + <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <!-- generates the string of row\column position if ConditionalFormatting exists --> + <xsl:variable name="condition-pos-str1"> + <xsl:if test="./x:ConditionalFormatting"> + <xsl:call-template name="condition-row-column-string"> + <xsl:with-param name="last" select="''"/> + <xsl:with-param name="total" select="count(./x:ConditionalFormatting)"/> + <xsl:with-param name="index" select="1"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="condition-pos-str2"> + <xsl:if test="./x:DataValidation"> + <xsl:call-template name="validation-row-column-string"> + <xsl:with-param name="last" select="''"/> + <xsl:with-param name="total" select="count(./x:DataValidation)"/> + <xsl:with-param name="index" select="1"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="condition-pos-str" select="concat($condition-pos-str1, $condition-pos-str2)"/> + <xsl:choose> + <xsl:when test="./ss:Table/ss:Row"> + <xsl:variable name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/> + <xsl:variable name="rowNodeCount" select="count(ss:Table/ss:Row)"/> + <xsl:variable name="expandedRowCount"> + <xsl:call-template name="get-expanded-row-count"/> + </xsl:variable> + <xsl:variable name="expandedColumnCount"> + <xsl:call-template name="get-expanded-column-count"/> + </xsl:variable> + <xsl:for-each select="ss:Table/ss:Row"> + <xsl:apply-templates select="." mode="create-rows"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + <xsl:with-param name="rowNodeCount" select="$rowNodeCount"/> + <xsl:with-param name="rowNodeIndex" select="position()"/> + <xsl:with-param name="expandedRowCount" select="$expandedRowCount"/> + <xsl:with-param name="expandedRowCountIndex" select="1"/> + <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./x:PageBreaks/x:RowBreaks"> + <xsl:for-each select="./x:PageBreaks/x:RowBreaks/x:RowBreak"> + <xsl:variable name="number-repeated"> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:value-of select="./x:Row"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=". - preceding::x:RowBreak[position()=count(.)]/x:Row - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$number-repeated > 0"> + <xsl:element name="table:table-row"> + <xsl:if test="@ss:Hidden = '1'"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('ro',$table-pos)"/> + </xsl:attribute> + <xsl:attribute name="table:number-rows-repeated"> + <xsl:value-of select="$number-repeated"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="ss:Table/@ss:ExpandedColumnCount"> + <table:table-cell table:number-columns-repeated="{ss:Table/@ss:ExpandedColumnCount}"/> + </xsl:when> + <xsl:otherwise> + <!-- OASIS XML row can not be empty --> + <table:table-cell table:number-columns-repeated="256"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="table:table-row"> + <xsl:if test="@ss:Hidden = '1'"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('rob',$table-pos)"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="ss:Table/@ss:ExpandedColumnCount"> + <table:table-cell table:number-columns-repeated="{ss:Table/@ss:ExpandedColumnCount}"/> + </xsl:when> + <xsl:otherwise> + <!-- OASIS XML row can not be empty --> + <table:table-cell table:number-columns-repeated="256"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <!-- in case no table row exists (empty spreadsheet) --> + <xsl:element name="table:table-row"> + <xsl:choose> + <xsl:when test="ss:Table/@ss:StyleID"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="ss:Table/@ss:StyleID"/> + </xsl:attribute> + <xsl:element name="table:table-cell"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="ss:Table/@ss:StyleID"/> + </xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('ro',$table-pos)"/> + </xsl:attribute> + <xsl:element name="table:table-cell"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="./x:ConditionalFormatting"> + <xsl:variable name="condition-row-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'R'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="condition-col-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'C'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="break-row-max"> + <xsl:call-template name="break-row-beyond-max"> + <xsl:with-param name="pos" select="1"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="count-value" select="count(./x:PageBreaks/x:RowBreaks/x:RowBreak)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="end-value"> + <xsl:choose> + <xsl:when test="$condition-row-max < $break-row-max"> + <xsl:value-of select="$break-row-max"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$condition-row-max"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="get-row-beyond-last"> + <xsl:with-param name="index-value" select="1"/> + <xsl:with-param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="end-pos" select="$end-value"/> + <xsl:with-param name="total-col" select="$condition-col-max"/> + </xsl:call-template> + </xsl:if> + <!-- if exists attribute of StyleID in tag of ss:Table but no Row/Column --> + <xsl:if test="./ss:Table/@ss:StyleID"> + <table:table-row table:style-name="{concat('ro',$table-pos)}" table:number-rows-repeated="65564"> + <table:table-cell table:number-columns-repeated="256"/> + </table:table-row> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:template> + <!-- Note: Need to be refactored --> + <xsl:template name="create-columns-without-input"> + <xsl:param name="table-pos"/> + <xsl:choose> + <xsl:when test="./x:PageBreaks/x:ColBreaks"> + <xsl:for-each select="./x:PageBreaks/x:ColBreaks/x:ColBreak"> + <xsl:variable name="number-repeated"> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:value-of select="./x:Column"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=". - preceding::x:ColBreak[position()=count(.)]/x:Column - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$number-repeated > 0"> + <xsl:element name="table:table-column"> + <xsl:if test="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:value-of select="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@ss:Hidden = '1'"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('co',$table-pos)"/> + </xsl:attribute> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$number-repeated"/> + </xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="table:table-column"> + <!-- column style be made out beforehead --> + <xsl:if test="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:value-of select="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@ss:Hidden = '1'"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('cob',$table-pos)"/> + </xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:element name="table:table-column"> + <xsl:choose> + <xsl:when test="ss:Table/@ss:StyleID"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="ss:Table/@ss:StyleID"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"> + <xsl:text>co1</xsl:text> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="ss:Table/@ss:ExpandedColumnCount and ss:Table/@ss:ExpandedColumnCount > 0"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="ss:Table/@ss:ExpandedColumnCount"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:text>Default</xsl:text> + </xsl:attribute> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- + Example: + <ss:Table> + <ss:Column ss:Index="4" ss:Width="500" ss:Span="3" /> + <ss:Column ss:Width="200" /> + </ss:Table> + + Prior column (ss:Index - 1) is written + The given fourth cell (ss:Index="4") is handled as repeated three times (ss:Span="3"). + The eight column got a width of "200" + + ContextNode: ss:Worksheet + --> + <xsl:key match="/ss:Workbook/ss:Worksheet/x:PageBreaks/x:ColBreaks/x:ColBreak" name="ColBreak" use="Column"/> + <xsl:template name="create-columns"> + <xsl:param name="columnCount"/> + <xsl:param name="currentColumn" select="1"/> + <xsl:param name="finishedColumns" select="0"/> + <xsl:param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/> + <xsl:param name="currentColumnNode"/> + <xsl:choose> + <xsl:when test="$finishedColumns < $columnCount"> + <xsl:choose> + <xsl:when test="$currentColumnNode"> + <xsl:choose> + <xsl:when test="$currentColumnNode/@ss:Index - $finishedColumns > 1"> + <!-- found column with index. + filling up table with empty columns until Index is reached --> + <xsl:call-template name="create-default-column"> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/> + <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:element name="table:table-column"> + <xsl:if test="$currentColumnNode/@ss:Hidden = '1'"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:if test="$currentColumnNode/@ss:Span"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$currentColumnNode/@ss:Span + 1"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="key('ColBreak', $currentColumn)"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('cob', $worksheetNo, '-', $currentColumn)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('co', $worksheetNo, '-', $currentColumn)"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$currentColumnNode/@ss:StyleID"> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:value-of select="$currentColumnNode/@ss:StyleID"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:text>Default</xsl:text> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentColumn" select="$currentColumn + 1"/> + <xsl:with-param name="finishedColumns"> + <xsl:choose> + <xsl:when test="$currentColumnNode/@ss:Span"> + <xsl:value-of select="$finishedColumns + $currentColumnNode/@ss:Span + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$finishedColumns + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[$currentColumn + 1]"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- <xsl:if test="not($finishedColumns + 1 = $columnCount)"> --> + <xsl:call-template name="create-default-column"> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$currentColumn = $columnCount"> + <!-- Note: name test document for this case and refactor the template --> + <xsl:if test="x:PageBreaks/x:ColBreaks/x:ColBreak/x:Column > $finishedColumns"> + <xsl:call-template name="get-column-beyond-last"> + <xsl:with-param name="index-value" select="$finishedColumns"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:if> + <!--Note: Test Scenario for this case: generates some special tags for whole row style + <xsl:if test="(./ss:Table[@ss:StyleID] or ./ss:Table/ss:Row[@ss:StyleID]) and (256 - $finishedColumns > 0)"> + <xsl:element name="table:table-column"> + <xsl:attribute name="table:default-cell-style-name"><xsl:choose><xsl:when test="./ss:Table[@ss:StyleID]"><xsl:value-of select="./ss:Table/@ss:StyleID" /></xsl:when><xsl:otherwise><xsl:value-of select="'Default'" /></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="table:style-name"><xsl:value-of select="'co1'" /></xsl:attribute> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="256 - $finishedColumns" /></xsl:attribute> + </xsl:element> + </xsl:if> + --> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="create-default-column"> + <xsl:param name="currentColumn"/> + <xsl:param name="currentColumnNode"/> + <xsl:param name="worksheetNo"/> + <xsl:param name="nextColumnNo"/> + <xsl:element name="table:table-column"> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:call-template name="get-default-cell-style"> + <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/> + </xsl:call-template> + </xsl:attribute> + <!-- <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="$nextColumnNo - $currentColumn"/></xsl:attribute> --> + <xsl:choose> + <xsl:when test="key('ColBreak', $currentColumn)"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('cob',$worksheetNo)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('co',$worksheetNo)"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:template> + <xsl:template name="create-rows"> + <xsl:param name="condition-pos-str"/> + <xsl:apply-templates select="ss:Table/ss:Row[1]" mode="create-rows"> + <xsl:with-param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/> + <xsl:with-param name="rowNodeCount" select="count(ss:Table/ss:Row)"/> + <xsl:with-param name="rowNodeIndex" select="1"/> + <xsl:with-param name="expandedRowCount"> + <xsl:call-template name="get-expanded-row-count"/> + </xsl:with-param> + <xsl:with-param name="expandedRowCountIndex" select="1"/> + <xsl:with-param name="expandedColumnCount"> + <xsl:call-template name="get-expanded-column-count"/> + </xsl:with-param> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="ss:Row" mode="create-rows"> + <xsl:param name="worksheetNo"/> + <xsl:param name="rowNodeCount"/> + <xsl:param name="rowNodeIndex"/> + <xsl:param name="expandedRowCount"/> + <xsl:param name="expandedColumnCount"/> + <xsl:param name="condition-pos-str"/> + <xsl:variable name="simple-span-value" select="@ss:Span + count(@ss:Span)"/> + <xsl:variable name="expandedRowCountIndex"> + <xsl:choose> + <xsl:when test="@ss:Index"><xsl:value-of select="@ss:Index -1 + $simple-span-value"/></xsl:when> + <xsl:otherwise> + <xsl:variable name="recent-index" select="preceding-sibling::ss:Row[@ss:Index][last()]"></xsl:variable> + <xsl:choose> + <xsl:when test="$recent-index"> + <xsl:variable name="nodes-up-to-current" select="set:intersection(preceding-sibling::ss:Row, $recent-index/following-sibling::ss:Row)"></xsl:variable> + <xsl:variable name="allSpans" select="$nodes-up-to-current/@ss:Span"/> + <xsl:value-of select="$recent-index/@ss:Index + count($nodes-up-to-current) + sum($allSpans) + count($allSpans)"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="allSpans" select="preceding-sibling::ss:Row/@ss:Span"/> + <xsl:value-of select="$rowNodeIndex + sum($allSpans) + count($allSpans)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="currentRowNo"> + <xsl:choose> + <xsl:when test="@ss:Index"> + <xsl:value-of select="@ss:Index"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$expandedRowCountIndex"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="@ss:Index - $expandedRowCountIndex > 0"> + <!-- create the preceding missing rows --> + <xsl:element name="table:table-row"> + <!-- fill the preceding gap with rows without a cell --> + <xsl:attribute name="table:number-rows-repeated"> + <xsl:value-of select="@ss:Index - $expandedRowCountIndex"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="$expandedColumnCount != 0"> + <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/> + </xsl:when> + <xsl:otherwise> + <!-- OASIS XML row can not be empty --> + <table:table-cell table:number-columns-repeated="256"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="table:table-row"> + <xsl:attribute name="table:style-name"> + <xsl:choose> + <xsl:when test="@ss:StyleID"> + <xsl:value-of select="concat('ro',$worksheetNo, '-',$rowNodeIndex,'-', @ss:StyleID)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('ro',$worksheetNo,'-',$rowNodeIndex)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:if test="@ss:Hidden = '1'"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:if test="@ss:Span"> + <xsl:attribute name="table:number-rows-repeated"> + <xsl:value-of select="@ss:Span + 1"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <!-- Excel row without content --> + <xsl:when test="not(*)"> + <!-- OASIS OpenDocument Format does not allow rows without a cell --> + <xsl:choose> + <xsl:when test="$expandedColumnCount != 0"> + <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/> + </xsl:when> + <xsl:otherwise> + <!-- OASIS XML row can not be empty --> + <table:table-cell table:number-columns-repeated="256"/> + </xsl:otherwise> + </xsl:choose> + + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create-cells"> + <xsl:with-param name="row-pos" select="$currentRowNo"/> + <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + + </xsl:template> + + <xsl:template name="get-expanded-column-count"> + <xsl:choose> + <xsl:when test="ss:Table/@ss:ExpandedColumnCount"> + <xsl:value-of select="ss:Table/@ss:ExpandedColumnCount"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="ss:Table/ss:Column/@ss:Span"> + <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes and spanned columns --> + <xsl:variable name="spannedColumns"> + <xsl:call-template name="count-spanned-columns"> + <xsl:with-param name="columns" select="ss:Table/ss:Column[@ss:Span]"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="count(ss:Table/ss:Column) + number($spannedColumns)"/> + </xsl:when> + <xsl:otherwise> + <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes --> + <xsl:value-of select="count(ss:Table/ss:Column)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-expanded-row-count"> + <xsl:choose> + <xsl:when test="ss:Table/@ss:ExpandedRowCount"> + <xsl:value-of select="ss:Table/@ss:ExpandedRowCount"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="ss:Table/ss:Row/@ss:Index and not(ss:Table/ss:Row/@ss:Span)"> + <xsl:variable name="lastIndexedRow" select="ss:Table/ss:Row[@ss:Index][last()]"/> + <xsl:value-of select="number($lastIndexedRow/@ss:Index) + count($lastIndexedRow/following-sibling::ss:Row)"/> + </xsl:when> + <xsl:when test="ss:Table/ss:Row/@ss:Index and ss:Table/ss:Row/@ss:Span"> + <xsl:variable name="lastIndexedRow" select="ss:Table/ss:Row[@ss:Index][last()]"/> + <xsl:variable name="spannedRows"> + <xsl:call-template name="count-spanned-rows"> + <xsl:with-param name="rows" select="$lastIndexedRow/following-sibling::ss:Row[@ss:Span]"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="number($lastIndexedRow/@ss:Index) + count($lastIndexedRow/following-sibling::ss:Row) + number($spannedRows)"/> + </xsl:when> + <xsl:when test="not(ss:Table/ss:Row/@ss:Index) and ss:Table/ss:Row/@ss:Span"> + <xsl:variable name="spannedRows"> + <xsl:call-template name="count-spanned-rows"> + <xsl:with-param name="rows" select="ss:Table/ss:Rows[@ss:Span]"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="count(ss:Table/ss:Row + number($spannedRows))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="count(ss:Table/ss:Row)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="count-spanned-rows"> + <xsl:param name="expandedRowCount" select="0"/> + <xsl:param name="rows"/> + <xsl:param name="rowsCount" select="count($rows)"/> + <xsl:param name="rowIndex" select="1"/> + <xsl:choose> + <xsl:when test="$rowIndex <= $rowsCount"> + <xsl:call-template name="count-spanned-rows"> + <xsl:with-param name="rows" select="$rows"/> + <xsl:with-param name="rowsCount" select="$rowsCount"/> + <xsl:with-param name="rowIndex" select="$rowIndex + 1"/> + <xsl:with-param name="expandedRowCount" select="$expandedRowCount + $rows[$rowIndex]/@ss:Span"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$expandedRowCount"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-default-cell-style"> + <xsl:param name="currentColumnNode"/> + <xsl:choose> + <xsl:when test="$currentColumnNode"> + <xsl:choose> + <xsl:when test="$currentColumnNode/@ss:StyleID"> + <xsl:value-of select="$currentColumnNode/@ss:StyleID"/> + </xsl:when> + <xsl:otherwise>Default</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./ss:Table[@ss:StyleID]"> + <xsl:value-of select="./ss:Table/@ss:StyleID"/> + </xsl:when> + <xsl:otherwise>Default</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-row-beyond-last"> + <!-- dealing the RowBreak after last row by recursion --> + <xsl:param name="index-value"/> + <xsl:param name="worksheetNo"/> + <xsl:param name="condition-pos-str"/> + <xsl:param name="end-pos"/> + <xsl:param name="total-col"/> + <xsl:variable name="current" select="concat('R',$index-value)"/> + <xsl:element name="table:table-row"> + <xsl:choose> + <xsl:when test="./x:PageBreaks/x:RowBreaks/x:RowBreak/x:Row = ($index-value - 1)"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('rob',$worksheetNo)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('ro',$worksheetNo)"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <!-- Note: 2 be refactored + <xsl:when test="./ss:Table/ss:Column[@ss:StyleID] or ./ss:Table[@ss:StyleID]"> + <xsl:if test="256 - count(ss:Table/ss:Column) > 0"> + <table:table-cell table:number-columns-repeated="{256 - count(ss:Table/ss:Column)}" /> + </xsl:if> + </xsl:when>--> + <xsl:when test="contains($condition-pos-str,$current)"> + <xsl:call-template name="create-spanning-cells"> + <xsl:with-param name="row-pos" select="$index-value"/> + <xsl:with-param name="c-start" select="1"/> + <xsl:with-param name="c-end" select="$total-col"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- OASIS XML does not allow rows without a cell --> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="$index-value < ($end-pos + 1)"> + <xsl:call-template name="get-row-beyond-last"> + <xsl:with-param name="index-value" select="$index-value + 1"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="end-pos" select="$end-pos"/> + <xsl:with-param name="total-col" select="$total-col"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="break-row-beyond-max"> + <!-- returns the max position of the row from condition-pos-str --> + <xsl:param name="pos"/> + <xsl:param name="last-value"/> + <xsl:param name="count-value"/> + <xsl:variable name="pre-value" select="./x:PageBreaks/x:RowBreaks/x:RowBreak[position() = $pos]/x:Row"/> + <xsl:variable name="end-value"> + <xsl:choose> + <xsl:when test="$last-value < $pre-value"> + <xsl:value-of select="$pre-value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$last-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$pos < $count-value"> + <xsl:call-template name="break-row-beyond-max"> + <xsl:with-param name="pos" select="$pos + 1"/> + <xsl:with-param name="last-value" select="$end-value"/> + <xsl:with-param name="count-value" select="$count-value"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$end-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-column-beyond-last"> + <!-- dealing the ColBreak after last column by recursion --> + <xsl:param name="index-value"/> + <xsl:param name="worksheetNo"/> + <xsl:for-each select="./x:PageBreaks/x:ColBreaks/x:ColBreak"> + <xsl:variable name="each-column-value" select="./x:Column"/> + <xsl:choose> + <xsl:when test="$each-column-value + 1 > $index-value"> + <xsl:variable name="number-repeated"> + <xsl:choose> + <xsl:when test="preceding-sibling::x:ColBreak[position()=count(.)]/x:Column + 1 = $index-value"> + <xsl:value-of select="$each-column-value - preceding-sibling::x:ColBreak[position()=count(.)]/x:Column - 1"/> + </xsl:when> + <xsl:when test="preceding-sibling::x:ColBreak[position()=count(.)]/x:Column + 1 > $index-value"> + <xsl:value-of select="$each-column-value - preceding-sibling::x:ColBreak[position()=count(.)]/x:Column - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$each-column-value - $index-value + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$number-repeated > 0"> + <xsl:element name="table:table-column"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="'co1'"/> + </xsl:attribute> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$number-repeated"/> + </xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="table:table-column"> + <xsl:if test="./../../../ss:Table[@ss:StyleID]"> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:value-of select="./ss:Table/@ss:StyleID"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('cob',$worksheetNo)"/> + </xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="$each-column-value + 1 = $index-value"> + <xsl:element name="table:table-column"> + <xsl:if test="./../../../ss:Table[@ss:StyleID]"> + <xsl:attribute name="table:default-cell-style-name"> + <xsl:value-of select="./../../../ss:Table/@ss:StyleID"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="concat('cob',$worksheetNo)"/> + </xsl:attribute> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="create-spanning-cells"> + <!-- judge the position of the Cell in the condition-pos-str --> + <xsl:param name="row-pos"/> + <xsl:param name="c-start"/> + <xsl:param name="c-end"/> + <xsl:param name="condition-pos-str"/> + + <xsl:variable name="current" select="concat('R',$row-pos,'C',$c-start,',')"/> + <xsl:variable name="style-name"> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$current)"> + <xsl:variable name="temp-str"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current)"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($temp-str, 'c')"> + <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/> + </xsl:when> + <xsl:when test="starts-with($temp-str, 'v')"> + <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- as for the spanned cells no style is taken... --> + <xsl:choose> + <!-- inherit style from parent row style--> + <xsl:when test="../@ss:StyleID"> + <xsl:value-of select="../@ss:StyleID"/> + </xsl:when> + <!-- if no correspondent column style exists... --> + <!-- inherit style from parent table style --> + <xsl:when test="../../@ss:StyleID"> + <!-- function to give in col-pos and get back column style --> + <xsl:variable name="relatedColumnStyle"> + <xsl:call-template name="get-related-column-style"> + <!-- the given position of the cell in the table, a column style is searched --> + <xsl:with-param name="calculatedCellPosition" select="$c-start" /> + <!-- all columns in XML --> + <xsl:with-param name="columnXMLNodes" select="../../ss:Column"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$relatedColumnStyle = ''"> + <xsl:value-of select="../../@ss:StyleID"/> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="table:table-cell"> + <xsl:if test="not($style-name = '')"> + <xsl:choose> + <xsl:when test="starts-with($style-name, 'val')"> + <xsl:attribute name="table:content-validation-name"> + <xsl:value-of select="$style-name"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-name, 'ce')"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="$style-name"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="$style-name"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$c-start < $c-end"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$c-end - $c-start + 1"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="condition-row-col-pos-max"> + <!-- returns the max position of the column or row from condition-pos-str --> + <xsl:param name="condition-pos-str"/> + <xsl:param name="last-value"/> + <xsl:param name="div-value"/> + <xsl:variable name="pre-value"> + <xsl:choose> + <xsl:when test="$div-value = 'R'"> + <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),'C')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-value"> + <xsl:choose> + <xsl:when test="$last-value < $pre-value"> + <xsl:value-of select="$pre-value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$last-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$div-value)"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="substring-after($condition-pos-str,$div-value)"/> + <xsl:with-param name="last-value" select="$end-value"/> + <xsl:with-param name="div-value" select="$div-value"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$end-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="condition-str"> + <!-- returns the string of style name of condition-pos-str --> + <xsl:param name="param-str"/> + <xsl:choose> + <xsl:when test="contains($param-str,'(')"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($param-str,':')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:key name="Style" match="/ss:Workbook/ss:Styles/ss:Style" use="@ss:ID"/> + <xsl:template name="create-cells"> + <xsl:param name="row-pos"/> + <xsl:param name="expandedColumnCount"/> + <xsl:param name="condition-pos-str"/> + <xsl:choose> + <xsl:when test="ss:Cell"> + <xsl:apply-templates select="ss:Cell[1]" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$expandedColumnCount"/> + <!-- + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str" /> + <xsl:with-param name="last-value" select="0" /> + <xsl:with-param name="div-value" select="'C'" /> + </xsl:call-template> + </xsl:with-param> --> + <xsl:with-param name="col-pos-written" select="0"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="current" select="concat('R',$row-pos,'C')"/> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$current)"> + <xsl:call-template name="create-spanning-cells"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="c-start" select="1"/> + <xsl:with-param name="c-end"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'C'"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos" select="1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- OASIS XML does not allow an empty row --> + <xsl:choose> + <xsl:when test="$expandedColumnCount != 0"> + <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/> + </xsl:when> + <xsl:otherwise> + <!-- OASIS XML row can not be empty --> + <table:table-cell table:number-columns-repeated="256"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ss:Cell" name="ss:Cell" mode="selected"> + <!-- Contains the max position of the column or row from the concatenation from + x:ConditionalFormatting + and + x:DataValidation --> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos-written" select="0"/> + <xsl:param name="col-pos-current" select="0"/> + <xsl:param name="row-pos"/> + <xsl:param name="col-repeated" select="1"/> + + <!-- The column position of the cell (might jumped by ss:Index) --> + <xsl:variable name="col-pos"> + <xsl:choose> + <xsl:when test="@ss:Index"> + <xsl:choose> + <xsl:when test="@ss:MergeAcross"> + <xsl:value-of select="@ss:MergeAcross + @ss:Index"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@ss:Index"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@ss:MergeAcross"> + <xsl:value-of select="1 + @ss:MergeAcross + $col-pos-current"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="1 + $col-pos-current"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="nextCell" select="following-sibling::ss:Cell[1]"/> + <!-- Multiple empty cells with the same or no style will be moved to one cell with a 'table:number-columns-repeated' attribute --> + <xsl:variable name="cell-is-repeatable" select=" + not(current()/*) + and + not(current()/text()) + and + ( + not($nextCell) + and $col-pos > $col-pos-written + 1 + or + ( + $nextCell + and + not($nextCell/*) + and + not($nextCell/text()) + and + ( + (current()/@ss:StyleID = $nextCell/@ss:StyleID) + or + (not(current()/@ss:StyleID) and not($nextCell/@ss:StyleID)) + ) + and + ( + not($nextCell/@ss:Index) + or + ($nextCell/@ss:Index = $col-pos + 1) + ) + ) + ) "/> + <xsl:choose> + <!-- Scenario: The missing cells skipped by using the ss:Index attribute will be added --> + <xsl:when test="@ss:Index and @ss:Index > $col-pos-written + 1"> + <!-- In Open Document nothing comparable to Index exists, + the missing cells might have to be created, if they had content as only style will be repeated--> + <xsl:call-template name="create-spanning-cells"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="c-start" select="$col-pos-current + 1"/> + <xsl:with-param name="c-end" select="@ss:Index - 1"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + <xsl:call-template name="ss:Cell"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-written" select="@ss:Index - 1"/> + <xsl:with-param name="col-pos-current" select="$col-pos"/> + <xsl:with-param name="col-repeated" select="$col-repeated"/> + </xsl:call-template> + </xsl:when> + <!-- Scenario: A sequence of cells can be put together as one cell --> + <xsl:when test="$cell-is-repeatable"> + <xsl:apply-templates select="$nextCell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-written" select="$col-pos-written"/> + <xsl:with-param name="col-pos-current" select="$col-pos"/> + <xsl:with-param name="col-repeated" select="$col-repeated"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <!-- if the cell wasn't repeated yet, created first --> + <xsl:if test="$col-repeated = 1"> + <xsl:element name="table:table-cell"> + <!-- in case the cell has an Index and is repeatable (s.above) and therefore has not been repeated earlier --> + <xsl:choose> + <xsl:when test="@ss:MergeAcross"> + <xsl:if test="$col-pos - @ss:MergeAcross > $col-pos-written + 1"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$col-pos - $col-pos-written"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$col-pos > $col-pos-written + 1"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$col-pos - $col-pos-written"/> + </xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="create-table-cell-attributes"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos" select="$col-pos"/> + <xsl:with-param name="row-pos" select="$row-pos"/> + </xsl:call-template> + <xsl:call-template name="create-table-cell-content"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos" select="$col-pos"/> + <xsl:with-param name="row-pos" select="$row-pos"/> + </xsl:call-template> + </xsl:element> + <!-- ss:MergeAcross (column spanned) indicates a covered table-cell in Open Document XML--> + <xsl:if test="@ss:MergeAcross"> + <xsl:element name="table:covered-table-cell"> + <xsl:if test="@ss:MergeAcross > 1"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="@ss:MergeAcross"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:if> + <xsl:choose> + <!-- the following block is not used, if the cell had been repeated earlier --> + <xsl:when test="$nextCell and not($cell-is-repeatable and $col-repeated = 1)"> + <xsl:choose> + <!-- After cells can no longer be repeated write out the attribute --> + <xsl:when test="not($cell-is-repeatable) and $col-repeated > 1"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$col-repeated"/> + </xsl:attribute> + </xsl:when> + <!-- At the end of the row --> + <xsl:when test="not($nextCell)"> + <xsl:if test="../../../x:ConditionalFormatting"> + <!-- at the last position of the Cell tag,inspecting the following cell before condition-row-col-pos-max --> + <xsl:call-template name="create-spanning-cells"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="c-start" select="$col-pos"/> + <xsl:with-param name="c-end" select="$col-pos-max"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <!-- If the cells can not be repeated (default) --> + <xsl:when test="not($cell-is-repeatable)"> + <!-- Traverse the following Cell --> + <xsl:apply-templates select="$nextCell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-written" select="$col-pos"/> + <xsl:with-param name="col-pos-current" select="$col-pos"/> + </xsl:apply-templates> + </xsl:when> + <!-- Go on with started repetition --> + <xsl:otherwise> + <xsl:apply-templates select="$nextCell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-written" select="$col-pos"/> + <xsl:with-param name="col-pos-current" select="$col-pos"/> + <xsl:with-param name="col-repeated" select="$col-repeated + 1"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="not($nextCell)"> + <xsl:choose> + <xsl:when test="$col-repeated = 1 and ($col-pos < $col-pos-max)"> + <table:table-cell table:number-columns-repeated="{$col-pos-max - $col-pos}"/> + </xsl:when> + <xsl:when test="$col-repeated > 1"> + <xsl:attribute name="table:number-columns-repeated"> + <xsl:value-of select="$col-repeated"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$nextCell" mode="skip"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-written" select="$col-pos"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ss:Cell" mode="skip"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos-written"/> + <xsl:param name="row-pos"/> + + <xsl:variable name="nextCell" select="following-sibling::ss:Cell[1]"/> + <!-- Multiple empty cells with the same style will be moved to one cell with a 'table:number-columns-repeated' attribute --> + <xsl:variable name="cell-is-repeatable" select="not($nextCell/*) and not($nextCell/text()) and ((current()/@ss:StyleID = $nextCell/@ss:StyleID) or (not(current()/@ss:StyleID) and not($nextCell/@ss:StyleID))) and not($nextCell/@ss:Index)"/> + <xsl:choose> + <xsl:when test="$cell-is-repeatable"> + <xsl:apply-templates select="$nextCell" mode="skip"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-written" select="$col-pos-written + 1"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$nextCell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-written" select="$col-pos-written + 1"/> + <xsl:with-param name="col-pos-current" select="$col-pos-written + 1"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="create-table-cell-attributes"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos"/> + <xsl:param name="row-pos"/> + + <xsl:choose> + <xsl:when test="$condition-pos-str"> + <xsl:call-template name="get-condition-dependent-cell-attributes"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="current-pos-str" select="concat('R',$row-pos,'C',$col-pos,',')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@ss:StyleID"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="@ss:StyleID"/> + </xsl:attribute> + </xsl:when> + <!-- inherit style from parent row style--> + <xsl:when test="../@ss:StyleID"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="../@ss:StyleID"/> + </xsl:attribute> + </xsl:when> + <!-- if no correspondent column style exists... --> + <!-- inherit style from parent table style --> + <xsl:when test="../../@ss:StyleID"> + <!-- function to give in col-pos and get back column style --> + <xsl:variable name="relatedColumnStyle"> + <xsl:call-template name="get-related-column-style"> + <!-- the given position of the cell in the table, a column style is searched --> + <xsl:with-param name="calculatedCellPosition" select="$col-pos" /> + <!-- all columns in XML --> + <xsl:with-param name="columnXMLNodes" select="../../ss:Column"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$relatedColumnStyle = ''"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="../../@ss:StyleID"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@ss:MergeAcross or @ss:MergeDown"> + <xsl:choose> + <xsl:when test="@ss:MergeAcross"> + <xsl:attribute name="table:number-columns-spanned"> + <xsl:value-of select="@ss:MergeAcross + 1"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:number-columns-spanned">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@ss:MergeDown"> + <xsl:attribute name="table:number-rows-spanned"> + <xsl:value-of select="@ss:MergeDown+1"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:number-rows-spanned">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@ss:Formula"> + <!-- formula translation from Excel to Calc --> + <xsl:variable name="calc-formula"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$row-pos"/> + <xsl:with-param name="cell-column-pos" select="$col-pos"/> + <xsl:with-param name="expression" select="@ss:Formula"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="table:formula"> + <xsl:value-of select="$calc-formula"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="ss:Data"> + <xsl:variable name="data-format"> + <xsl:value-of select="key('Style', @ss:StyleID)/ss:NumberFormat/@ss:Format"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="ss:Data/@ss:Type = 'Number'"> + <xsl:choose> + <xsl:when test="$data-format = 'Percent' or contains( $data-format, '%')"> + <xsl:attribute name="office:value-type">percentage</xsl:attribute> + </xsl:when> + <xsl:when test="contains(key('Style', @ss:StyleID)/ss:NumberFormat/@ss:Format, 'Currency')"> + <xsl:attribute name="office:value-type">currency</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="office:value-type">float</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="office:value"> + <xsl:value-of select="ss:Data"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="ss:Data/@ss:Type = 'DateTime'"> + <xsl:choose> + <xsl:when test="(contains( $data-format, 'Date') or contains($data-format,'y') or contains($data-format,'g') or contains($data-format,'d') or contains($data-format,'e') or starts-with( substring( ss:Data, 11), 'T00:00:00.000' ) ) and (not (contains( $data-format, 'Time') ) )"> + <xsl:attribute name="office:value-type">date</xsl:attribute> + <xsl:attribute name="office:date-value"> + <xsl:value-of select="substring-before(ss:Data, 'T')"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="office:value-type">time</xsl:attribute> + <xsl:attribute name="office:time-value"> + <xsl:value-of select="concat('P',substring(ss:Data, 11, 3), 'H', substring(ss:Data, 15, 2), 'M', substring(ss:Data, 18,2), 'S')"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="ss:Data/@ss:Type = 'Boolean'"> + <xsl:attribute name="office:value-type">boolean</xsl:attribute> + <xsl:attribute name="office:boolean-value"> + <xsl:choose> + <xsl:when test="ss:Data = '1'">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:when> + <xsl:when test="ss:Data/@ss:Type = 'String'"> + <xsl:attribute name="office:value-type">string</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template name="get-related-column-style"> + <!-- the given position of the cell in the table, a column style is searched --> + <xsl:param name="calculatedCellPosition" /> + <!-- the current position of the column as XML node --> + <xsl:param name="columnXMLPosition" select="1" /> + <!-- all columns in XML --> + <xsl:param name="columnXMLNodes" /> + <!-- the ending column position of the earlier column style in the table --> + <xsl:param name="earlierCalculatedColumnEnd" select="0" /> + + <!-- the current column as XML node --> + <xsl:variable name="columnXMLNode" select="$columnXMLNodes[1]" /> + <xsl:if test="$columnXMLNodes and count($columnXMLNodes) > 0"> + <!-- the starting column position of the style in the table --> + <xsl:variable name="calculatedColumnStart"> + <!-- if ss:Index exists, this is the start of the column --> + <xsl:choose> + <xsl:when test="$columnXMLNode/@ss:Index"> + <xsl:value-of select="$columnXMLNode/@ss:Index" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$earlierCalculatedColumnEnd + 1" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- the ending column position of the style in the table --> + <xsl:variable name="calculatedColumnEnd"> + <xsl:choose> + <xsl:when test="$columnXMLNode/@ss:Span"> + <xsl:value-of select="$calculatedColumnStart + $columnXMLNode/@ss:Span" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$calculatedColumnStart" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$calculatedColumnStart >= $calculatedCellPosition and $calculatedCellPosition <= $calculatedColumnEnd"> + <xsl:value-of select="$columnXMLNode/@ss:StyleID"/> + </xsl:when> + <xsl:when test="$calculatedColumnEnd <= $calculatedCellPosition"> + <xsl:call-template name="get-related-column-style"> + <!-- the given position of the cell in the table, a column style is searched --> + <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" /> + <!-- all columns in XML --> + <xsl:with-param name="columnXMLNodes" select="$columnXMLNodes[position() != 1]"/> + <!-- the ending column position of the style in the table --> + <xsl:with-param name="earlierCalculatedColumnEnd" select="$calculatedColumnEnd" /> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:template> + + <xsl:template name="create-table-cell-content"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos"/> + <xsl:param name="row-pos"/> + <xsl:apply-templates select="ss:Comment" mode="body"/> + <xsl:if test="ss:Data"> + <text:p> + <xsl:call-template name="create-data-content"> + <xsl:with-param name="style-id" select="@ss:StyleID"/> + </xsl:call-template> + </text:p> + </xsl:if> + </xsl:template> + <xsl:template name="create-data-content"> + <xsl:param name="style-id" select="@ss:StyleID"/> + <xsl:choose> + <xsl:when test="ss:Data//text()[string-length(.) != 0] and ss:Data[count(*)>0]"> + <xsl:for-each select="ss:Data//text()[string-length(.) != 0]"> + <xsl:sort select="position( )" order="ascending" data-type="number"/> + <text:span text:style-name="{concat($style-id, 'T', count(preceding::ss:Data[child::html:*]), '_', position())}"> + <xsl:value-of select="."/> + </text:span> + </xsl:for-each> + </xsl:when> + <xsl:when test="contains(key('Style', $style-id)/ss:Font/@ss:VerticalAlign, 'script')"> + <text:span text:style-name="{concat($style-id, 'T0')}"> + <xsl:choose> + <xsl:when test="@ss:HRef"> + <text:a xlink:href="{@ss:HRef}"> + <xsl:value-of select="ss:Data"/> + </text:a> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="ss:Data"/> + </xsl:otherwise> + </xsl:choose> + </text:span> + </xsl:when> + <xsl:when test="@ss:HRef"> + <text:a xlink:href="{@ss:HRef}"> + <xsl:value-of select="ss:Data"/> + </text:a> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="ss:Data"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-condition-dependent-cell-attributes"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="current-pos-str"/> + <xsl:variable name="temp-str"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current-pos-str)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="base-style-name"> + <xsl:choose> + <xsl:when test="@ss:StyleID"> + <xsl:value-of select="@ss:StyleID"/> + </xsl:when> + <xsl:when test="../@ss:StyleID"> + <xsl:value-of select="../@ss:StyleID"/> + </xsl:when> + <xsl:when test="../../@ss:StyleID"> + <xsl:value-of select="../../@ss:StyleID"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style-name"> + <xsl:choose> + <xsl:when test="contains($condition-pos-str, $current-pos-str) and starts-with($temp-str, 'c')"> + <xsl:choose> + <xsl:when test="string-length($base-style-name) > 0"><xsl:value-of select="concat($base-style-name, '-ce', substring-after($temp-str, 'c'))"/></xsl:when> + <xsl:otherwise><xsl:value-of select="concat('Default-ce', substring-after($temp-str, 'c'))"/></xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$base-style-name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($style-name, 'val')"> + <xsl:attribute name="table:content-validation-name"> + <xsl:value-of select="$style-name"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="not($style-name = '')"> + <xsl:attribute name="table:style-name"> + <xsl:value-of select="$style-name"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <!-- maybe multi functions occur at the same time in the same Cell, such as ConditionalFormatting and DataValidation --> + <xsl:if test="contains($condition-pos-str, $current-pos-str)"> + <xsl:choose> + <xsl:when test="starts-with($temp-str, 'v')"> + <xsl:attribute name="table:content-validation-name"> + <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="after-str" select="substring-after($condition-pos-str, $current-pos-str)"/> + <xsl:if test="contains( $after-str, $current-pos-str)"> + <xsl:variable name="temp-str-2"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-before( $after-str,$current-pos-str)"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="starts-with( $temp-str-2, 'v')"> + <xsl:attribute name="table:content-validation-name"> + <xsl:value-of select="concat('val', substring-after($temp-str-2, 'v'))"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template name="validation-row-column-string"> + <!-- returns a string with structure, including row/column position by extraction from x:DataValidation --> + <xsl:param name="last"/> + <xsl:param name="total"/> + <xsl:param name="index"/> + <xsl:variable name="table-pos" select="count(preceding-sibling::ss:Worksheet)+1"/> + <xsl:variable name="current"> + <xsl:call-template name="parse-range"> + <xsl:with-param name="range-value" select="./x:DataValidation[position() = $index]/x:Range"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="current-value" select="concat('(v',$index,':', $current,');')"/> + <xsl:if test="$index < $total"> + <xsl:call-template name="validation-row-column-string"> + <xsl:with-param name="last" select="concat($last, $current-value)"/> + <xsl:with-param name="total" select="$total"/> + <xsl:with-param name="index" select="$index + 1"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$index = $total"> + <xsl:value-of select="concat($last, $current-value)"/> + </xsl:if> + </xsl:template> + <xsl:template name="condition-row-column-string"> + <!-- returns a string with structure, including row/column position by extraction from x:ConditionalFormatting --> + <xsl:param name="last"/> + <xsl:param name="total"/> + <xsl:param name="index"/> + <xsl:variable name="table-pos" select="count(preceding-sibling::ss:Worksheet)+1"/> + <xsl:variable name="current"> + <xsl:call-template name="parse-range"> + <xsl:with-param name="range-value" select="./x:ConditionalFormatting[position() = $index]/x:Range"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="current-value" select="concat('(c',$table-pos,'-',$index,':', $current,');')"/> + <xsl:if test="$index < $total"> + <xsl:call-template name="condition-row-column-string"> + <xsl:with-param name="last" select="concat($last, $current-value)"/> + <xsl:with-param name="total" select="$total"/> + <xsl:with-param name="index" select="$index + 1"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$index = $total"> + <xsl:value-of select="concat($last, $current-value)"/> + </xsl:if> + </xsl:template> + <xsl:template name="parse-range"> + <!-- returns a string,input param:the value of x:Range --> + <xsl:param name="range-value"/> + <xsl:param name="last"/> + <xsl:variable name="first-pit"> + <xsl:choose> + <xsl:when test="contains($range-value,',')"> + <xsl:value-of select="substring-before($range-value,',')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$range-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current"> + <xsl:choose> + <xsl:when test="contains($first-pit,':')"> + <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/> + <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/> + <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/> + <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/> + <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/> + <xsl:variable name="the-str"> + <xsl:call-template name="condition-rc-str"> + <xsl:with-param name="r-start" select="$R-start"/> + <xsl:with-param name="r-end" select="$R-end"/> + <xsl:with-param name="c-start" select="$C-start"/> + <xsl:with-param name="c-end" select="$C-end"/> + <xsl:with-param name="last" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$the-str"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($first-pit,',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($range-value,',')"> + <xsl:call-template name="parse-range"> + <xsl:with-param name="range-value" select="substring-after($range-value,',')"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($last,$current)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="condition-rc-str"> + <!-- dealing the range of row\column --> + <xsl:param name="r-start"/> + <xsl:param name="r-end"/> + <xsl:param name="c-start"/> + <xsl:param name="c-end"/> + <xsl:param name="last"/> + <xsl:variable name="current"> + <xsl:call-template name="condition-c-str"> + <xsl:with-param name="rc-str" select="concat('R',$r-start)"/> + <xsl:with-param name="start" select="$c-start"/> + <xsl:with-param name="end" select="$c-end"/> + <xsl:with-param name="last" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$r-start < $r-end"> + <xsl:call-template name="condition-rc-str"> + <xsl:with-param name="r-start" select="$r-start + 1"/> + <xsl:with-param name="r-end" select="$r-end"/> + <xsl:with-param name="c-start" select="$c-start"/> + <xsl:with-param name="c-end" select="$c-end"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$r-start = $r-end"> + <xsl:value-of select="concat($last,$current)"/> + </xsl:if> + </xsl:template> + <xsl:template name="condition-c-str"> + <!-- return value for the template condition-rc-str --> + <xsl:param name="rc-str"/> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:param name="last"/> + <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/> + <xsl:if test="$start < $end"> + <xsl:call-template name="condition-c-str"> + <xsl:with-param name="rc-str" select="$rc-str"/> + <xsl:with-param name="start" select="$start + 1"/> + <xsl:with-param name="end" select="$end"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$start = $end"> + <xsl:value-of select="concat($last,$current)"/> + </xsl:if> + </xsl:template> + <xsl:template match="ss:Data[count(*)>0]"> + <xsl:for-each select=".//text()[string-length(.) != 0]"> + <style:style style:name="{concat(ancestor::ss:Cell/@ss:StyleID,'T',count(preceding::ss:Data[child::html:*]), '_', position())}" style:family="text"> + <xsl:element name="style:text-properties"> + <xsl:if test="ancestor-or-self::html:Font/@html:Face"> + <xsl:attribute name="style:font-name"> + <xsl:value-of select="ancestor-or-self::html:Font/@html:Face"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:Font/@html:Size"> + <xsl:attribute name="fo:font-size"> + <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/> + </xsl:attribute> + <xsl:attribute name="style:font-size-asian"> + <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/> + </xsl:attribute> + <xsl:attribute name="style:font-size-complex"> + <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:Font/@html:Color"> + <xsl:attribute name="fo:color"> + <xsl:value-of select="ancestor-or-self::html:Font/@html:Color"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:B"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:I"> + <xsl:attribute name="fo:font-style">italic</xsl:attribute> + <xsl:attribute name="style:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-complex">italic</xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:U"> + <xsl:attribute name="style:text-underline-type">single</xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:S"> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:Sup"> + <xsl:attribute name="style:text-position">33% 58%</xsl:attribute> + </xsl:if> + <xsl:if test="ancestor-or-self::html:Sub"> + <xsl:attribute name="style:text-position">-33% 58%</xsl:attribute> + </xsl:if> + </xsl:element> + </style:style> + </xsl:for-each> + </xsl:template> + <xsl:template name="get-pos-content"> + <xsl:param name="content"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="$pos = 'left'"> + <xsl:choose> + <xsl:when test="contains($content,'&C')"> + <xsl:value-of select="substring-before( substring-after( $content, '&L'), '&C')"/> + </xsl:when> + <xsl:when test="contains($content,'&R')"> + <xsl:value-of select="substring-before( substring-after( $content, '&L'), '&R')"/> + </xsl:when> + <xsl:when test="contains($content,'&L')"> + <xsl:value-of select="substring-after( $content, '&L')"/> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:when> + <xsl:when test="$pos = 'center'"> + <xsl:choose> + <xsl:when test="contains($content,'&R')"> + <xsl:value-of select="substring-before( substring-after( $content, '&C'), '&R')"/> + </xsl:when> + <xsl:when test="contains($content,'&C')"> + <xsl:value-of select="substring-after( $content, '&C')"/> + </xsl:when> + <xsl:when test="contains($content,'&L')"/> + <xsl:otherwise> + <xsl:value-of select="$content"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$pos = 'right'"> + <xsl:value-of select="substring-after( $content, '&R')"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="@x:Data"> + <xsl:variable name="style-name-header"> + <xsl:value-of select="concat(ancestor::ss:Worksheet/@ss:Name, substring(name(..),1,1))"/> + </xsl:variable> + <xsl:variable name="left-style-data"> + <xsl:call-template name="get-pos-content"> + <xsl:with-param name="content" select="."/> + <xsl:with-param name="pos" select="'left'"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length($left-style-data)>0 and contains($left-style-data,'&')"> + <xsl:call-template name="create-header-footer-style"> + <xsl:with-param name="style-name-header" select="concat($style-name-header,'L')"/> + <xsl:with-param name="style-data" select="$left-style-data"/> + <xsl:with-param name="index" select="0"/> + <xsl:with-param name="current-pos" select="1"/> + </xsl:call-template> + </xsl:if> + <xsl:variable name="center-style-data"> + <xsl:call-template name="get-pos-content"> + <xsl:with-param name="content" select="."/> + <xsl:with-param name="pos" select="'center'"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length($center-style-data)>0 and contains($center-style-data,'&')"> + <xsl:call-template name="create-header-footer-style"> + <xsl:with-param name="style-name-header" select="concat($style-name-header,'C')"/> + <xsl:with-param name="style-data" select="$center-style-data"/> + <xsl:with-param name="index" select="0"/> + <xsl:with-param name="current-pos" select="1"/> + </xsl:call-template> + </xsl:if> + <xsl:variable name="right-style-data"> + <xsl:call-template name="get-pos-content"> + <xsl:with-param name="content" select="."/> + <xsl:with-param name="pos" select="'right'"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length($right-style-data)>0 and contains($right-style-data,'&')"> + <xsl:call-template name="create-header-footer-style"> + <xsl:with-param name="style-name-header" select="concat($style-name-header,'R')"/> + <xsl:with-param name="style-data" select="$right-style-data"/> + <xsl:with-param name="index" select="0"/> + <xsl:with-param name="current-pos" select="1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="create-header-footer-style"> + <xsl:param name="style-name-header"/> + <xsl:param name="style-data"/> + <xsl:param name="index"/> + <xsl:param name="current-pos"/> + <xsl:variable name="current-style-data"> + <xsl:value-of select="substring($style-data,$current-pos)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($current-style-data,'&D') or starts-with($current-style-data,'&T') or starts-with($current-style-data,'&P') or starts-with($current-style-data,'&N') or starts-with($current-style-data,'&A') or starts-with($current-style-data,'&F') or starts-with($current-style-data,'&Z')"> + <xsl:call-template name="create-header-footer-style"> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="index" select="$index"/> + <xsl:with-param name="current-pos" select="$current-pos +2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&')"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"> + <xsl:value-of select="concat($style-name-header,$index)"/> + </xsl:attribute> + <xsl:attribute name="style:family">text</xsl:attribute> + <xsl:element name="style:text-properties"> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + <xsl:variable name="next-style-header-pos"> + <xsl:call-template name="get-current-content-pos"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="create-header-footer-style"> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="index" select="$index+1"/> + <xsl:with-param name="current-pos" select="$next-style-header-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($current-style-data,'&')"> + <xsl:variable name="temp" select="substring-before($current-style-data,'&')"/> + <xsl:call-template name="create-header-footer-style"> + <xsl:with-param name="style-name-header" select="$style-name-header"/> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="index" select="$index"/> + <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="process-header-footer-style-properties"> + <xsl:param name="style-data"/> + <xsl:param name="current-pos"/> + <xsl:variable name="current-style-data"> + <xsl:value-of select="substring($style-data,$current-pos)"/> + </xsl:variable> + <xsl:choose> + <!-- stack operations necessary --> + <xsl:when test="starts-with($current-style-data,'&"')"> + <xsl:attribute name="style:font-name"> + <xsl:value-of select="substring-before(substring-after($current-style-data,'&"'),',')"/> + </xsl:attribute> + <xsl:if test="contains(substring-before(substring-after($current-style-data,','),'"'),'Bold')"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + <xsl:if test="contains(substring-before(substring-after($current-style-data,','),'"'),'Italic')"> + <xsl:attribute name="fo:font-style">italic</xsl:attribute> + <xsl:attribute name="style:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-complex">italic</xsl:attribute> + </xsl:if> + <xsl:variable name="temp" select="substring-before(substring($style-data,$current-pos+2),'"')"/> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos+3"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&0') or starts-with($current-style-data,'&1') or starts-with($current-style-data,'&2') or starts-with($current-style-data,'&3') or starts-with($current-style-data,'&4') or starts-with($current-style-data,'&5') or starts-with($current-style-data,'&6') or starts-with($current-style-data,'&7') or starts-with($current-style-data,'&8') or starts-with($current-style-data,'&9')"> + <xsl:variable name="font-size-length"> + <xsl:call-template name="get-digit-length"> + <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:font-size"> + <xsl:value-of select="concat(substring($current-style-data,2,$font-size-length),'pt')"/> + </xsl:attribute> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos + 1 + $font-size-length"/> + </xsl:call-template> + </xsl:when> + <!-- don't consider tangled or adjoined '&X' and '&Y', '&U' & '&E', processing-check is necessary, too complex. :( --> + <xsl:when test="starts-with($current-style-data,'&X')"> + <xsl:variable name="superscript-count-before"> + <xsl:call-template name="get-substyle-count-in-data"> + <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/> + <xsl:with-param name="substyle" select="'&X'"/> + <xsl:with-param name="count" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$superscript-count-before mod 2 = 0"> + <xsl:attribute name="style:text-position">33% 58%</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos + 2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&B')"> + <xsl:variable name="subscript-count-before"> + <xsl:call-template name="get-substyle-count-in-data"> + <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/> + <xsl:with-param name="substyle" select="'&B'"/> + <xsl:with-param name="count" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$subscript-count-before mod 2 = 0"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos + 2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&Y')"> + <xsl:variable name="subscript-count-before"> + <xsl:call-template name="get-substyle-count-in-data"> + <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/> + <xsl:with-param name="substyle" select="'&Y'"/> + <xsl:with-param name="count" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$subscript-count-before mod 2 = 0"> + <xsl:attribute name="style:text-position">-33% 58%</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos + 2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&S')"> + <xsl:variable name="strikethrough-count-before"> + <xsl:call-template name="get-substyle-count-in-data"> + <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/> + <xsl:with-param name="substyle" select="'&S'"/> + <xsl:with-param name="count" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$strikethrough-count-before mod 2 = 0"> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos + 2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&U')"> + <xsl:variable name="single-underline-count-before"> + <xsl:call-template name="get-substyle-count-in-data"> + <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/> + <xsl:with-param name="substyle" select="'&U'"/> + <xsl:with-param name="count" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$single-underline-count-before mod 2 = 0"> + <xsl:attribute name="style:text-underline-type">single</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos + 2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&E')"> + <xsl:variable name="double-underline-count-before"> + <xsl:call-template name="get-substyle-count-in-data"> + <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/> + <xsl:with-param name="substyle" select="'&E'"/> + <xsl:with-param name="count" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$double-underline-count-before mod 2 = 0"> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-header-footer-style-properties"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos + 2"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="get-substyle-count-in-data"> + <xsl:param name="style-data"/> + <xsl:param name="substyle"/> + <xsl:param name="count"/> + <xsl:choose> + <xsl:when test="contains($style-data,$substyle)"> + <xsl:call-template name="get-substyle-count-in-data"> + <xsl:with-param name="style-data" select="substring-after($style-data,$substyle)"/> + <xsl:with-param name="substyle" select="$substyle"/> + <xsl:with-param name="count" select="$count+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$count"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-current-content-pos"> + <xsl:param name="style-data"/> + <xsl:param name="current-pos"/> + <xsl:variable name="current-style-data"> + <xsl:value-of select="substring($style-data,$current-pos)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($current-style-data,'&X') or starts-with($current-style-data,'&Y') or starts-with($current-style-data,'&S') or starts-with($current-style-data,'&U') or starts-with($current-style-data,'&E') or starts-with($current-style-data,'&B')"> + <xsl:call-template name="get-current-content-pos"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos+2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&0') or starts-with($current-style-data,'&1') or starts-with($current-style-data,'&2') or starts-with($current-style-data,'&3') or starts-with($current-style-data,'&4') or starts-with($current-style-data,'&5') or starts-with($current-style-data,'&6') or starts-with($current-style-data,'&7') or starts-with($current-style-data,'&8') or starts-with($current-style-data,'&9')"> + <xsl:variable name="font-size-length"> + <xsl:call-template name="get-digit-length"> + <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&')"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="get-current-content-pos"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="$current-pos+1+$font-size-length"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data,'&"')"> + <xsl:variable name="temp" select="substring-before(substring($style-data,$current-pos+2),'"')"/> + <xsl:call-template name="get-current-content-pos"> + <xsl:with-param name="style-data" select="$style-data"/> + <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos+3"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="starts-with($current-style-data, '&')"> + <xsl:value-of select="$current-pos + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$current-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- OASIS OpenDocument Format change: + Excel "=RC4*6" + OOoXML "=$D22*6" + OASIS XML "oooc:=[.$D22]*6" --> + <xsl:template name="translate-expression"> + <!-- return position or range for formula or other --> + <xsl:param name="cell-row-pos"/> + <!-- the position in row (vertical) of cell --> + <xsl:param name="cell-column-pos"/> + <!-- the position in column (horizontal of cell --> + <xsl:param name="expression"/> + <!-- recomposed expression containing cell positions after every conversion --> + <xsl:param name="is-range-mode" select="false()"/> + <!-- as mode changes a '[.' resp. ']' is written out --> + <xsl:param name="return-value"/> + <!-- expression of table:cell-range-address is different than formula (e.g. no prefix) --> + <xsl:param name="isRangeAddress"/> + <!-- determines if the currently processed expression is relative --> + <xsl:param name="isRelative" select="false()" /> + + <!-- value to be given out later --> + <!-- to judge whether this input expression contains any cell position to convert --> + <xsl:variable name="temp-range"> + <xsl:choose> + <xsl:when test="$expression != ''"> + <xsl:call-template name="parse-range-name"> + <xsl:with-param name="expression" select="$expression"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- if $range-type = 1, then range is representing a sheet, function's name or separated symbol, but not cell position, + or if $range-type = 2, range should be handled because it contains certain cell position. + The first character marks the type of that expression. --> + <xsl:variable name="range-type"> + <xsl:choose> + <xsl:when test="substring($temp-range, 1, 1) = '1'"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:when test="substring($temp-range, 1, 1) = '2'"> + <xsl:value-of select="2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- remove that added range type token --> + <xsl:variable name="current-range"> + <xsl:value-of select="substring($temp-range, 2)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$range-type = 1"> + <!-- Nothing to convert, so just join the front and behind strings. --> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression"> + <!-- get current converting position from $temp-token or $current-range, then join the expression. --> + <xsl:choose> + <xsl:when test="contains($current-range, '#$')"> + <!-- because of recomposing of string, the $current-range may not be the pit + of $expression, so the char #$ should not be used for nominal --> + <xsl:variable name="temp-token"> + <xsl:choose> + <xsl:when test="contains($current-range, '\')"> + <xsl:value-of select="concat(']', substring-after($current-range, '#$'), "'")"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($current-range, '#$')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="substring-after($expression, $temp-token)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($expression, $current-range)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="return-value"> + <!-- react on range mode change (when to insert closing ']' or in case of '!' change the mode to RANGE and create open '[' --> + <xsl:choose> + <xsl:when test="$current-range = '=' and $return-value = '' and not($isRangeAddress)"> + <xsl:text>oooc:=</xsl:text> + </xsl:when> + <xsl:when test="contains($current-range, '!') and not($isRangeAddress)"> + <xsl:value-of select="concat($return-value, '[', $current-range)"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$is-range-mode = 'true' and $current-range != ':' and not($isRangeAddress)"> + <xsl:value-of select="concat($return-value, ']', substring-before($expression, $current-range), $current-range)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="is-range-mode"> + <xsl:choose> + <!-- ! is the separator of worksheet and range + : is the separator for a cell range --> + <xsl:when test="contains($current-range, '!') or $current-range = ':'"> + <xsl:value-of select="true()"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="false()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- types of range to handle in $current-range, i.e. the cell position expression to convert + 1: special cell including row and column; e.g. R4C5 + 2: whole row; e.g. R3 + 3: whole column; e.g. C5 + 4: other name not for cell or row/column; e.g. RANDOM() or something unknown + --> + <xsl:variable name="handle-type"> + <xsl:choose> + <xsl:when test="starts-with($current-range, 'R')"> + <!-- It's type 1 or type 2 or 4/unknown cell position. --> + <xsl:choose> + <xsl:when test="contains($current-range, 'C')"> + <!-- It's type 1, specifying the cell position or 4/unknown --> + <xsl:variable name="part-type-r"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-before( substring-after($current-range, 'R'), 'C')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="part-type-c"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="($part-type-r = 1) and ($part-type-c = 1)"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- It's type 2 specifying the cell position, or 4/unknown. --> + <xsl:variable name="part-type"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-after($current-range, 'R')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$part-type = 1"> + <xsl:value-of select="2"/> + </xsl:when> + <xsl:when test="$part-type = 2"> + <xsl:value-of select="4"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($current-range, 'C')"> + <!-- It's type 3 of cell position, or 4/unknown --> + <xsl:variable name="part-type"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$part-type = 1"> + <xsl:value-of select="3"/> + </xsl:when> + <xsl:when test="$part-type = 2"> + <xsl:value-of select="4"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- It's type 4, not cell position --> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- Start to convert that cell position expression, that cell position unit --> + <xsl:choose> + <xsl:when test="$handle-type = 1"> + <!-- It's type 1, e.g. R1C2 --> + <!-- process the row part --> + <xsl:variable name="after-R"> + <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/> + </xsl:variable> + <xsl:choose> + <!-- found one cell unit --> + <xsl:when test="$after-R='C' or $after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'"> + <xsl:variable name="row-pos"> + <xsl:choose> + <xsl:when test="$after-R='['"> + <xsl:value-of select="$cell-row-pos+substring-before( substring-after($current-range,'R['),']')"/> + </xsl:when> + <xsl:when test="$after-R='C'"> + <xsl:value-of select="$cell-row-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(substring-after($current-range,'R'),'C')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="row-pos-style"> + <xsl:choose> + <xsl:when test="$after-R='[' or $after-R='C'">relative</xsl:when> + <xsl:otherwise>absolute</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- process the column part --> + <xsl:variable name="after-C"> + <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,1)"/> + </xsl:variable> + <xsl:variable name="column-digit-length"> + <xsl:choose> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:call-template name="get-digit-length"> + <xsl:with-param name="complexive-string" select="substring-after(substring-after($current-range,'R'),'C')"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="column-pos"> + <xsl:choose> + <xsl:when test="$after-C='['"> + <xsl:value-of select="$cell-column-pos + substring-before(substring-after(substring-after($current-range,'R'),'C['),']')"/> + </xsl:when> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,$column-digit-length)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$cell-column-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="column-pos-style"> + <xsl:choose> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">absolute</xsl:when> + <xsl:otherwise>relative</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="trans-unit"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="$column-pos"/> + <xsl:with-param name="row-number" select="$row-pos"/> + <xsl:with-param name="column-pos-style" select="$column-pos-style"/> + <xsl:with-param name="row-pos-style" select="$row-pos-style"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit)"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="$is-range-mode = 'true'"> + <xsl:value-of select="concat($return-value, $name-unit)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, '[.', $name-unit)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="is-range-mode" select="true()"/> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before(substring-after($expression, '('),'R'),',!', ';.'))"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($current-range,'R')"/> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="$is-range-mode = 'true'"> + <xsl:value-of select="concat($return-value, $name-unit)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, '[.', $name-unit)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="is-range-mode" select="true()"/> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$handle-type = 2"> + <!-- It's type 2, e.g. R3 --> + <!-- process the range only including a whole row --> + <xsl:variable name="after-R"> + <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'"> + <xsl:variable name="row-number"> + <xsl:choose> + <xsl:when test="$after-R = '['"> + <xsl:value-of select="substring-before(substring-after($current-range, 'R['), ']')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($current-range, 'R')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="row-pos"> + <xsl:choose> + <xsl:when test="$after-R='['"> + <xsl:value-of select="$cell-row-pos + $row-number"/> + </xsl:when> + <xsl:when test="$after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'"> + <xsl:value-of select="$row-number"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$cell-row-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="trans-unit1"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="1"/> + <xsl:with-param name="row-number" select="$row-pos"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="trans-unit2"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="256"/> + <xsl:with-param name="row-number" select="$row-pos"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="$is-range-mode = 'true'"> + <xsl:value-of select="concat($return-value, $name-unit)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, '[.', $name-unit)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="is-range-mode" select="true()"/> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'R'),',!', ';.'),'R')"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($current-range,'R')"/> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="$is-range-mode = 'true'"> + <xsl:value-of select="concat($return-value, $name-unit)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, '[.', $name-unit)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="is-range-mode" select="true()"/> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$handle-type = 3"> + <!-- It's type 3, e.g. C4 --> + <!-- process the range only including a whole column --> + <xsl:variable name="after-C"> + <xsl:value-of select="substring(substring-after($current-range,'C'),1,1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$after-C='[' or $after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:variable name="column-number"> + <xsl:choose> + <xsl:when test="$after-C = '['"> + <xsl:value-of select="substring-before(substring-after($current-range, 'C['), ']')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($current-range, 'C')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="column-pos"> + <xsl:choose> + <xsl:when test="$after-C='['"> + <xsl:value-of select="$cell-column-pos + $column-number"/> + </xsl:when> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:value-of select="$column-number"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$cell-column-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="trans-unit1"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="$column-pos"/> + <xsl:with-param name="row-number" select="1"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="trans-unit2"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="$column-pos"/> + <xsl:with-param name="row-number" select="65565"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="$is-range-mode = 'true'"> + <xsl:value-of select="concat($return-value, $name-unit)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, '[.', $name-unit)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="is-range-mode" select="true()"/> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'C'),',!', ';.'),'C')"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($current-range,'C')"/> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="$is-range-mode = 'true'"> + <xsl:value-of select="concat($return-value, $name-unit)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, '[.', $name-unit)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="is-range-mode" select="true()"/> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- It's unknown, so just jump over it --> + <xsl:variable name="next-pit" select="substring-after($expression, $current-range)"/> + <xsl:choose> + <xsl:when test="contains($next-pit, '+') or contains($next-pit, '-') or contains($next-pit, '*') or contains($next-pit, '/') or contains($next-pit, ')') or contains($next-pit, '^') or contains($next-pit, ':') or contains($next-pit, '"') or contains($next-pit, ';') or contains($next-pit, ',') or contains($next-pit, '[')"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, $current-range), $current-range)"/> + <xsl:with-param name="is-range-mode" select="false()"/> + <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- return the final range or formula --> + <xsl:choose> + <!-- in case the closing bracket of the range wasn't set, do it now --> + <xsl:when test="$is-range-mode = 'true' and $current-range = ''"> + <xsl:value-of select="translate( concat($return-value, ']'),',!', ';.')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate( concat($return-value, substring-before($expression, $current-range), $current-range),',!', ';.')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="parse-range-name"> + <!-- return the string or name for next handle. the type 1 is names of function, sheet, special separated symbol, not to parse as range; type 2 is the range including R/C to be parsed --> + <xsl:param name="expression"/> + <xsl:param name="return-value"/> + <xsl:variable name="first-one" select="substring($expression,1,1)"/> + <xsl:choose> + <xsl:when test="$first-one = '='"> + <xsl:choose> + <xsl:when test="string-length(normalize-space($return-value)) > 0"> + <xsl:value-of select="concat('2', $return-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>1=</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-one='(' or $first-one='!' or $first-one='&'"> + <xsl:value-of select="concat('1', $return-value, $first-one)"/> + </xsl:when> + <xsl:when test="$first-one='['"> + <xsl:choose> + <xsl:when test="starts-with(substring-after($expression, ']'), 'C')"> + <xsl:call-template name="parse-range-name"> + <xsl:with-param name="expression" select="substring-after($expression, ']')"/> + <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, ']'), ']')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains(substring-before($expression, ']'), '.') and contains(substring-after($expression, ']'), '!')"> + <xsl:value-of select="concat('1', "'", substring-before(substring-after($expression, '['), ']'), "'", '#$', substring-before(substring-after($expression, ']'), '!'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('2', $return-value, substring-before($expression, ']'), ']')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-one='"'"> + <xsl:value-of select="concat('1', $first-one, substring-before(substring-after($expression, '"'), '"'), '"')"/> + </xsl:when> + <xsl:when test="$first-one="'""> + <!-- here the string "'" represents a char ' --> + <xsl:variable name="str-in" select="substring-before(substring-after($expression, "'"), "'")"/> + <xsl:choose> + <!-- for file path transformation --> + <xsl:when test="contains($str-in, '\') and contains($str-in, '[') and contains($str-in, ']')"> + <xsl:variable name="first-pos" select="substring-before($str-in, '[')"/> + <xsl:variable name="second-pos" select="substring-before(substring-after($str-in, '['), ']')"/> + <xsl:variable name="third-pos" select="substring-after($str-in, ']')"/> + <xsl:value-of select="concat('1', "'", $first-pos, $second-pos, "'", '#$', $third-pos)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('1', "'", $str-in, "'")"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-one='+' or $first-one='-' or $first-one='*' or $first-one='/' or $first-one=')' or $first-one='^' or $first-one=':' or $first-one='"' or $first-one=';' or $first-one=',' or $first-one='>' or $first-one='<'"> + <xsl:choose> + <xsl:when test="$return-value = ''"> + <xsl:value-of select="concat('1', $first-one)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('2', $return-value)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$expression = ''"> + <xsl:value-of select="concat('2', $return-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="parse-range-name"> + <xsl:with-param name="expression" select="substring($expression, 2, string-length($expression)-1)"/> + <xsl:with-param name="return-value" select="concat($return-value, substring($expression, 1, 1))"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="handle-type-number"> + <!-- to handle the part between R and C, or after C in range string in translate-expression. return type: 1: number or cell range; 2: other, not for next step --> + <xsl:param name="t-part"/> + <xsl:choose> + <xsl:when test="starts-with($t-part, '[')"> + <xsl:variable name="tt-str" select="substring-before( substring-after( $t-part, '['), ']')"/> + <xsl:choose> + <xsl:when test="($tt-str < 0) or ($tt-str > 0) or ($tt-str = 0)"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="($t-part < 0) or ($t-part > 0) or ($t-part = 0)"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:when test="$t-part = ''"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-unit"> + <!-- convert cell position expression unit, R1C1, R3, C4 --> + <xsl:param name="column-number"/> + <xsl:param name="row-number"/> + <xsl:param name="column-pos-style"/> + <xsl:param name="row-pos-style"/> + <xsl:variable name="column-number1"> + <xsl:value-of select="floor( $column-number div 26 )"/> + </xsl:variable> + <xsl:variable name="column-number2"> + <xsl:value-of select="$column-number mod 26"/> + </xsl:variable> + <xsl:variable name="column-character1"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-character2"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number2"/> + </xsl:call-template> + </xsl:variable> + <!-- position styles are 'absolute' or 'relative', --> + <xsl:choose> + <xsl:when test="$column-pos-style = 'absolute'"> + <xsl:value-of select="concat( '$', $column-character1, $column-character2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat( $column-character1, $column-character2)"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$row-pos-style ='absolute'"> + <xsl:value-of select="concat( '$', $row-number)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$row-number"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="number-to-character"> + <xsl:param name="number"/> + <xsl:choose> + <xsl:when test="$number = 0"/> + <xsl:when test="$number = 1">A</xsl:when> + <xsl:when test="$number = 2">B</xsl:when> + <xsl:when test="$number = 3">C</xsl:when> + <xsl:when test="$number = 4">D</xsl:when> + <xsl:when test="$number = 5">E</xsl:when> + <xsl:when test="$number = 6">F</xsl:when> + <xsl:when test="$number = 7">G</xsl:when> + <xsl:when test="$number = 8">H</xsl:when> + <xsl:when test="$number = 9">I</xsl:when> + <xsl:when test="$number = 10">J</xsl:when> + <xsl:when test="$number = 11">K</xsl:when> + <xsl:when test="$number = 12">L</xsl:when> + <xsl:when test="$number = 13">M</xsl:when> + <xsl:when test="$number = 14">N</xsl:when> + <xsl:when test="$number = 15">O</xsl:when> + <xsl:when test="$number = 16">P</xsl:when> + <xsl:when test="$number = 17">Q</xsl:when> + <xsl:when test="$number = 18">R</xsl:when> + <xsl:when test="$number = 19">S</xsl:when> + <xsl:when test="$number = 20">T</xsl:when> + <xsl:when test="$number = 21">U</xsl:when> + <xsl:when test="$number = 22">V</xsl:when> + <xsl:when test="$number = 23">W</xsl:when> + <xsl:when test="$number = 24">X</xsl:when> + <xsl:when test="$number = 25">Y</xsl:when> + <xsl:when test="$number = 26">Z</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="get-digit-length"> + <xsl:param name="complexive-string"/> + <xsl:variable name="first-char"> + <xsl:value-of select="substring( $complexive-string, 1, 1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-char = '1' or $first-char = '2' or $first-char = '3' or $first-char = '4' or $first-char = '5' or $first-char = '6' or $first-char = '7' or $first-char = '8' or $first-char = '9' or $first-char = '0' "> + <xsl:variable name="temp"> + <xsl:call-template name="get-digit-length"> + <xsl:with-param name="complexive-string" select="substring( $complexive-string, 2)"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$temp+1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="ss:Comment" mode="body"> + <xsl:element name="office:annotation"> + <xsl:if test="@ss:ShowAlways = '1'"> + <xsl:attribute name="office:display">true</xsl:attribute> + </xsl:if> + <xsl:if test="@ss:Author"> + <xsl:element name="dc:creator"> + <xsl:value-of select="@ss:Author"/> + </xsl:element> + </xsl:if> + <xsl:if test="ss:Data"> + <text:p> + <xsl:call-template name="create-data-content"> + <xsl:with-param name="style-id" select="@ss:StyleID"/> + </xsl:call-template> + </text:p> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="Names"> + <xsl:variable name="namedRanges" select="/ss:Workbook/ss:Worksheet/ss:Names/ss:NamedRange | + /ss:Workbook/ss:Names/ss:NamedRange" /> + <xsl:if test="$namedRanges"> + <table:named-expressions> + <xsl:for-each select="$namedRanges"> + <xsl:choose> + <xsl:when test="contains( @ss:RefersTo, '!R')"> + <xsl:variable name="referto"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="isRangeAddress" select="true()"/> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="@ss:RefersTo"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="table:named-range"> + <xsl:attribute name="table:name"> + <xsl:value-of select="@ss:Name"/> + </xsl:attribute> + <xsl:attribute name="table:base-cell-address"> + <xsl:variable name="worksheetName" select="translate(substring-before(@ss:RefersTo, '!'), '=', '$')" /> + <xsl:call-template name="encode-as-cell-address"> + <xsl:with-param name="string" select="concat($worksheetName,'.$A$1')"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="table:cell-range-address"> + <xsl:call-template name="encode-as-cell-range-address"> + <xsl:with-param name="string" select="translate( $referto, '=', '$')"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@ss:Name = 'Print_Area'"> + <xsl:attribute name="table:range-usable-as">print-range</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="expression-name"> + <xsl:value-of select="@ss:Name"/> + </xsl:variable> + <xsl:element name="table:named-expression"> + <xsl:attribute name="table:name"> + <xsl:value-of select="@ss:Name"/> + </xsl:attribute> + <!-- just set '$Sheet1.$A$1' as named-expressions virtual base-cell-address --> + <xsl:attribute name="table:base-cell-address"> + <xsl:variable name="worksheetName" select="following-sibling::ss:Worksheet/@ss:Name" /> + <xsl:call-template name="encode-as-cell-address"> + <xsl:with-param name="string" select="concat('$', $worksheetName,'.$A$1')"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="table:expression"> + <xsl:value-of select="substring( @ss:RefersTo, 2)"/> + </xsl:attribute> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </table:named-expressions> + </xsl:if> + </xsl:template> + <xsl:template name="transform-advanced-filter"> + <!-- transform the params of Advanced Filter.it's different from AutoFilter --> + <xsl:param name="target-value"/> + <xsl:param name="condition-pos"/> + <xsl:element name="table:database-range"> + <xsl:variable name="target-range"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="$target-value"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="condition-range"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="$condition-pos"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="table:target-range-address"> + <xsl:value-of select="$target-range"/> + </xsl:attribute> + <xsl:attribute name="table:name"> + <xsl:value-of select="concat($target-range, '.filter')"/> + </xsl:attribute> + <xsl:element name="table:filter"> + <xsl:attribute name="table:condition-source-range-address"> + <xsl:value-of select="$condition-range"/> + </xsl:attribute> + <xsl:element name="table:filter-condition"> + <xsl:attribute name="table:field-number">0</xsl:attribute> + <!-- The two attributes are recommended by OASIS --> + <xsl:attribute name="table:value"/> + <xsl:attribute name="table:operator"/> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="x:AutoFilter"> + <!-- for AutoFilter --> + <xsl:element name="table:database-range"> + <xsl:attribute name="table:name"> + <xsl:value-of select="concat(../@ss:Name,'_',@x:Range)"/> + </xsl:attribute> + <xsl:variable name="range"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="@x:Range"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="table:target-range-address"> + <xsl:value-of select="concat('$',../@ss:Name,'.',$range)"/> + </xsl:attribute> + <xsl:attribute name="table:display-filter-buttons">true</xsl:attribute> + <xsl:element name="table:filter"> + <xsl:call-template name="auto-filter-condition"> + <xsl:with-param name="item-pos" select="1"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="total" select="count(./x:AutoFilterColumn)"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="auto-filter-condition"> + <!--?? generate element of filter-condition for AutoCondition to get position of index --> + <xsl:param name="item-pos"/> + <xsl:param name="index"/> + <xsl:param name="total"/> + <xsl:if test="($index - 1 < $total) or ($index - 1 = $total)"> + <xsl:element name="table:filter-condition"> + <xsl:attribute name="table:data-type">number</xsl:attribute> + <xsl:choose> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'TopPercent'"> + <xsl:attribute name="table:operator"> + <xsl:value-of select="'top value'"/> + </xsl:attribute> + <xsl:attribute name="table:value"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Top'"> + <xsl:attribute name="table:operator"> + <xsl:value-of select="'top values'"/> + </xsl:attribute> + <xsl:attribute name="table:value"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'TopPercent'"> + <xsl:attribute name="table:operator"> + <xsl:value-of select="'top percent'"/> + </xsl:attribute> + <xsl:attribute name="table:value"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Bottom'"> + <xsl:attribute name="table:operator"> + <xsl:value-of select="'bottom values'"/> + </xsl:attribute> + <xsl:attribute name="table:value"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'BottomPercent'"> + <xsl:attribute name="table:operator"> + <xsl:value-of select="'bottom percent'"/> + </xsl:attribute> + <xsl:attribute name="table:value"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Custom'"> + <xsl:choose> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/x:AutoFilterOr or ./x:AutoFilterColumn[position() = $item-pos]/x:AutoFilterAnd"> + <xsl:attribute name="table:operator"> + <xsl:choose> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'Equals'"> + <xsl:value-of select="'='"/> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'DoesNotEquals'"> + <xsl:value-of select="'!='"/> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'GreaterThan'"> + <xsl:value-of select="'>'"/> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'GreaterThanOrEqual'"> + <xsl:value-of select="'>='"/> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'LessThan'"> + <xsl:value-of select="'<'"/> + </xsl:when> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'LessThanOrEqual'"> + <xsl:value-of select="'<='"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'='"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="table:value"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]//@x:Value"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:operator"> + <xsl:value-of select="'bottom percent'"/> + </xsl:attribute> + <xsl:attribute name="table:value"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]//@x:Value"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + <xsl:attribute name="table:field-number"> + <xsl:choose> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Index"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Index - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$index - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="auto-filter-condition"> + <xsl:with-param name="item-pos" select="$item-pos + 1"/> + <xsl:with-param name="index"> + <xsl:choose> + <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Index"> + <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Index + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$index + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="total" select="count(./x:AutoFilterColumn)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template match="x:Sorting"> + <!-- for Sorting don't contains header row --> + <xsl:if test="contains(./x:Sort, 'Column')"> + <xsl:element name="table:database-range"> + <xsl:variable name="first-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 1], 'Column'))"/> + <xsl:variable name="second-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 2], 'Column'))"/> + <xsl:variable name="third-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 3], 'Column'))"/> + <xsl:variable name="first-sort-num"> + <xsl:call-template name="letter-to-number"> + <xsl:with-param name="source-letter" select="$first-sort-letter"/> + <xsl:with-param name="return-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="second-sort-num"> + <xsl:call-template name="letter-to-number"> + <xsl:with-param name="source-letter" select="$second-sort-letter"/> + <xsl:with-param name="return-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="third-sort-num"> + <xsl:call-template name="letter-to-number"> + <xsl:with-param name="source-letter" select="$third-sort-letter"/> + <xsl:with-param name="return-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="min-left-num"> + <xsl:call-template name="min-of-three"> + <xsl:with-param name="first-num" select="$first-sort-num"/> + <xsl:with-param name="second-num" select="$second-sort-num"/> + <xsl:with-param name="third-num" select="$third-sort-num"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="max-right-num"> + <xsl:call-template name="max-of-three"> + <xsl:with-param name="first-num" select="$first-sort-num"/> + <xsl:with-param name="second-num" select="$second-sort-num"/> + <xsl:with-param name="third-num" select="$third-sort-num"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="left-column"> + <xsl:call-template name="number-to-letter"> + <xsl:with-param name="source-number" select="$min-left-num"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="right-column"> + <xsl:call-template name="number-to-letter"> + <xsl:with-param name="source-number" select="$max-right-num"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="table:target-range-address"> + <xsl:value-of select="concat(../@ss:Name, '.', $left-column, '1:', ../@ss:Name, '.', $right-column, '32000')"/> + </xsl:attribute> + <xsl:attribute name="table:name"> + <xsl:value-of select="concat(../@ss:Name, '.sort')"/> + </xsl:attribute> + <xsl:attribute name="table:contains-header"> + <xsl:value-of select="'false'"/> + </xsl:attribute> + <xsl:element name="table:sort"> + <xsl:for-each select="./x:Sort"> + <xsl:element name="table:sort-by"> + <xsl:attribute name="table:field-number"> + <xsl:value-of select="0"/> + </xsl:attribute> + <xsl:attribute name="table:data-type"> + <xsl:value-of select="'automatic'"/> + </xsl:attribute> + <xsl:variable name="after-sort" select="following-sibling::*"/> + <xsl:if test="name($after-sort[position() = 1]) = 'Descending'"> + <xsl:attribute name="table:order"> + <xsl:value-of select="'descending'"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:attribute name="table:field-number"> + <xsl:value-of select="$first-sort-num - $min-left-num"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="position() = 2"> + <xsl:attribute name="table:field-number"> + <xsl:value-of select="$second-sort-num - $min-left-num"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="position() = 3"> + <xsl:attribute name="table:field-number"> + <xsl:value-of select="$third-sort-num - $min-left-num"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="letter-to-number"> + <!-- convert letter to number for sorting. the string source-letter should be normalize-space and the first return-value should be zero --> + <xsl:param name="source-letter"/> + <xsl:param name="return-value"/> + <xsl:choose> + <xsl:when test="string-length($source-letter) > 0"> + <xsl:variable name="first-pit" select="substring($source-letter, 1, 1)"/> + <xsl:variable name="pit-number"> + <xsl:choose> + <xsl:when test="($first-pit = 'A') or ($first-pit = 'a')"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:when test="($first-pit = 'B') or ($first-pit = 'b')"> + <xsl:value-of select="2"/> + </xsl:when> + <xsl:when test="($first-pit = 'C') or ($first-pit = 'c')"> + <xsl:value-of select="3"/> + </xsl:when> + <xsl:when test="($first-pit = 'D') or ($first-pit = 'd')"> + <xsl:value-of select="4"/> + </xsl:when> + <xsl:when test="($first-pit = 'E') or ($first-pit = 'e')"> + <xsl:value-of select="5"/> + </xsl:when> + <xsl:when test="($first-pit = 'F') or ($first-pit = 'f')"> + <xsl:value-of select="6"/> + </xsl:when> + <xsl:when test="($first-pit = 'G') or ($first-pit = 'g')"> + <xsl:value-of select="7"/> + </xsl:when> + <xsl:when test="($first-pit = 'H') or ($first-pit = 'h')"> + <xsl:value-of select="8"/> + </xsl:when> + <xsl:when test="($first-pit = 'I') or ($first-pit = 'i')"> + <xsl:value-of select="9"/> + </xsl:when> + <xsl:when test="($first-pit = 'J') or ($first-pit = 'j')"> + <xsl:value-of select="10"/> + </xsl:when> + <xsl:when test="($first-pit = 'K') or ($first-pit = 'k')"> + <xsl:value-of select="11"/> + </xsl:when> + <xsl:when test="($first-pit = 'L') or ($first-pit = 'l')"> + <xsl:value-of select="12"/> + </xsl:when> + <xsl:when test="($first-pit = 'M') or ($first-pit = 'm')"> + <xsl:value-of select="13"/> + </xsl:when> + <xsl:when test="($first-pit = 'N') or ($first-pit = 'n')"> + <xsl:value-of select="14"/> + </xsl:when> + <xsl:when test="($first-pit = 'O') or ($first-pit = 'o')"> + <xsl:value-of select="15"/> + </xsl:when> + <xsl:when test="($first-pit = 'P') or ($first-pit = 'p')"> + <xsl:value-of select="16"/> + </xsl:when> + <xsl:when test="($first-pit = 'Q') or ($first-pit = 'q')"> + <xsl:value-of select="17"/> + </xsl:when> + <xsl:when test="($first-pit = 'R') or ($first-pit = 'r')"> + <xsl:value-of select="18"/> + </xsl:when> + <xsl:when test="($first-pit = 'S') or ($first-pit = 's')"> + <xsl:value-of select="19"/> + </xsl:when> + <xsl:when test="($first-pit = 'T') or ($first-pit = 't')"> + <xsl:value-of select="20"/> + </xsl:when> + <xsl:when test="($first-pit = 'U') or ($first-pit = 'u')"> + <xsl:value-of select="21"/> + </xsl:when> + <xsl:when test="($first-pit = 'V') or ($first-pit = 'v')"> + <xsl:value-of select="22"/> + </xsl:when> + <xsl:when test="($first-pit = 'W') or ($first-pit = 'w')"> + <xsl:value-of select="23"/> + </xsl:when> + <xsl:when test="($first-pit = 'X') or ($first-pit = 'x')"> + <xsl:value-of select="24"/> + </xsl:when> + <xsl:when test="($first-pit = 'Y') or ($first-pit = 'y')"> + <xsl:value-of select="25"/> + </xsl:when> + <xsl:when test="($first-pit = 'Z') or ($first-pit = 'z')"> + <xsl:value-of select="26"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="letter-to-number"> + <xsl:with-param name="source-letter" select="substring($source-letter, 2)"/> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="string-length($source-letter) >= 2"> + <xsl:value-of select="$pit-number * 26 + $return-value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$pit-number + $return-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="number-to-letter"> + <!--?? convert number to letter for sorting --> + <xsl:param name="source-number"/> + <xsl:param name="return-value"/> + <xsl:variable name="current-value"> + <xsl:call-template name="num-conv-letter"> + <xsl:with-param name="first-pit"> + <xsl:choose> + <xsl:when test="$source-number > 26"> + <xsl:value-of select="floor($source-number div 26)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$source-number"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$source-number > 26"> + <xsl:call-template name="number-to-letter"> + <xsl:with-param name="source-number" select="$source-number mod 26"/> + <xsl:with-param name="return-value" select="concat($return-value,$current-value)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$source-number < 27"> + <xsl:value-of select="concat($return-value,$current-value)"/> + </xsl:if> + </xsl:template> + <xsl:template name="num-conv-letter"> + <!-- convert number to number by pit of 26 --> + <xsl:param name="first-pit"/> + <xsl:choose> + <xsl:when test="$first-pit = 1"> + <xsl:value-of select="'A'"/> + </xsl:when> + <xsl:when test="$first-pit = 2"> + <xsl:value-of select="'B'"/> + </xsl:when> + <xsl:when test="$first-pit = 3"> + <xsl:value-of select="'C'"/> + </xsl:when> + <xsl:when test="$first-pit = 4"> + <xsl:value-of select="'D'"/> + </xsl:when> + <xsl:when test="$first-pit = 5"> + <xsl:value-of select="'E'"/> + </xsl:when> + <xsl:when test="$first-pit = 6"> + <xsl:value-of select="'F'"/> + </xsl:when> + <xsl:when test="$first-pit = 7"> + <xsl:value-of select="'G'"/> + </xsl:when> + <xsl:when test="$first-pit = 8"> + <xsl:value-of select="'H'"/> + </xsl:when> + <xsl:when test="$first-pit = 9"> + <xsl:value-of select="'I'"/> + </xsl:when> + <xsl:when test="$first-pit = 10"> + <xsl:value-of select="'J'"/> + </xsl:when> + <xsl:when test="$first-pit = 11"> + <xsl:value-of select="'K'"/> + </xsl:when> + <xsl:when test="$first-pit = 12"> + <xsl:value-of select="'L'"/> + </xsl:when> + <xsl:when test="$first-pit = 13"> + <xsl:value-of select="'M'"/> + </xsl:when> + <xsl:when test="$first-pit = 14"> + <xsl:value-of select="'N'"/> + </xsl:when> + <xsl:when test="$first-pit = 15"> + <xsl:value-of select="'O'"/> + </xsl:when> + <xsl:when test="$first-pit = 16"> + <xsl:value-of select="'P'"/> + </xsl:when> + <xsl:when test="$first-pit = 17"> + <xsl:value-of select="'Q'"/> + </xsl:when> + <xsl:when test="$first-pit = 18"> + <xsl:value-of select="'R'"/> + </xsl:when> + <xsl:when test="$first-pit = 19"> + <xsl:value-of select="'S'"/> + </xsl:when> + <xsl:when test="$first-pit = 20"> + <xsl:value-of select="'T'"/> + </xsl:when> + <xsl:when test="$first-pit = 21"> + <xsl:value-of select="'U'"/> + </xsl:when> + <xsl:when test="$first-pit = 22"> + <xsl:value-of select="'V'"/> + </xsl:when> + <xsl:when test="$first-pit = 23"> + <xsl:value-of select="'W'"/> + </xsl:when> + <xsl:when test="$first-pit = 24"> + <xsl:value-of select="'X'"/> + </xsl:when> + <xsl:when test="$first-pit = 25"> + <xsl:value-of select="'Y'"/> + </xsl:when> + <xsl:when test="$first-pit = 26"> + <xsl:value-of select="'Z'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'A'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="min-of-three"> + <!-- return lowest of three for sorting --> + <xsl:param name="first-num"/> + <xsl:param name="second-num"/> + <xsl:param name="third-num"/> + <xsl:variable name="first-comp"> + <xsl:choose> + <xsl:when test="$first-num = 0"> + <xsl:value-of select="$second-num"/> + </xsl:when> + <xsl:when test="($first-num < $second-num) or ($second-num = 0)"> + <xsl:value-of select="$first-num"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$second-num"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="second-comp"> + <xsl:choose> + <xsl:when test="($first-comp < $third-num) or ($third-num = 0)"> + <xsl:value-of select="$first-comp"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$third-num"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$second-comp"/> + </xsl:template> + <xsl:template name="max-of-three"> + <!-- return greatest of three for sorting --> + <xsl:param name="first-num"/> + <xsl:param name="second-num"/> + <xsl:param name="third-num"/> + <xsl:variable name="first-comp"> + <xsl:choose> + <xsl:when test="$first-num > $second-num"> + <xsl:value-of select="$first-num"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$second-num"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="second-comp"> + <xsl:choose> + <xsl:when test="$first-comp > $third-num"> + <xsl:value-of select="$first-comp"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$third-num"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$second-comp"/> + </xsl:template> + <xsl:template name="set-calculation"> + <xsl:element name="table:calculation-settings"> + <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:PrecisionAsDisplayed"> + <xsl:attribute name="table:precision-as-shown">true</xsl:attribute> + </xsl:if> + <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:Date1904"> + <table:null-date office:date-value="1904-01-01"/> + </xsl:if> + <xsl:element name="table:iteration"> + <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:Iteration"> + <xsl:attribute name="table:status">enable</xsl:attribute> + </xsl:if> + <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:MaxIterations"> + <xsl:attribute name="table:steps"> + <xsl:value-of select="/ss:Workbook/x:ExcelWorkbook/x:MaxIterations"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:MaxChange"> + <xsl:attribute name="table:maximum-difference"> + <xsl:value-of select="/ss:Workbook/x:ExcelWorkbook/x:MaxChange"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="x:DataValidation"> + <!-- for DataValidation. don't support the attribute IMEMode currently. --> + <xsl:element name="table:content-validation"> + <xsl:attribute name="table:name"> + <xsl:value-of select="concat('val', position())"/> + </xsl:attribute> + <xsl:attribute name="table:condition"><!-- don't support two type of qualifier: List, Custom --> + <xsl:variable name="qualifier-content"> + <xsl:choose> + <xsl:when test="./x:Qualifier = 'NotBetween'"> + <xsl:value-of select="concat('cell-content-is-not-between(', ./x:Min, ',', ./x:Max, ')')"/> + </xsl:when> + <xsl:when test="./x:Qualifier = 'NotEqual'"> + <xsl:value-of select="concat('!=', ./x:Value)"/> + </xsl:when> + <xsl:when test="./x:Qualifier = 'Equal'"> + <xsl:value-of select="concat('=', ./x:Value)"/> + </xsl:when> + <xsl:when test="./x:Qualifier = 'Less'"> + <xsl:value-of select="concat('<', ./x:Value)"/> + </xsl:when> + <xsl:when test="./x:Qualifier = 'Greater'"> + <xsl:value-of select="concat('>', ./x:Value)"/> + </xsl:when> + <xsl:when test="./x:Qualifier = 'GreaterOrEqual'"> + <xsl:value-of select="concat('>=', ./x:Value)"/> + </xsl:when> + <xsl:when test="./x:Qualifier = 'LessOrEqual'"> + <xsl:value-of select="concat('<=', ./x:Value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('cell-content-is-between(', ./x:Min, ',', ./x:Max)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="qualifier-value"> + <xsl:choose> + <xsl:when test="./x:Type = 'Whole'"> + <xsl:choose> + <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max"> + <xsl:value-of select="concat('cell-content-is-whole-number() and ', $qualifier-content, ')')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('cell-content-is-whole-number() and ', 'cell-content()', $qualifier-content)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="./x:Type = 'Decimal'"> + <xsl:choose> + <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max"> + <xsl:value-of select="concat('cell-content-is-decimal-number() and ', $qualifier-content, ')')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('cell-content-is-decimal-number() and ', 'cell-content()', $qualifier-content)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="./x:Type = 'Date'"> + <xsl:choose> + <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max"> + <xsl:value-of select="concat('cell-content-is-date() and ', $qualifier-content, ')')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('cell-content-is-date() and ', 'cell-content()', $qualifier-content)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="./x:Type = 'Time'"> + <xsl:choose> + <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max"> + <xsl:value-of select="concat('cell-content-is-time() and ', $qualifier-content, ')')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('cell-content-is-time() and ', 'cell-content()', $qualifier-content)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="./x:Type = 'TextLength'"> + <xsl:choose> + <xsl:when test="./x:Qualifier = 'NotBetween'"> + <xsl:value-of select="concat('cell-content-text-length-is-not-between(', ./x:Min, ',', ./x:Max, ')')"/> + </xsl:when> + <xsl:when test="./x:Max and ./x:Min"> + <xsl:value-of select="concat('cell-content-text-length-is-between(', ./x:Min, ',', ./x:Max, ')')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('cell-content-text-length()', $qualifier-content)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./x:Type"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$qualifier-value"/> + </xsl:attribute> + <xsl:attribute name="table:base-cell-address"> + <xsl:variable name="first-range"> + <xsl:choose> + <xsl:when test="contains(./x:Range, ',')"> + <xsl:value-of select="substring-before(./x:Range, ',')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./x:Range"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="range"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="$first-range"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="encode-as-cell-address"> + <xsl:with-param name="string" select="concat(../../ss:Worksheet/@ss:Name, '.', $range)"/> + </xsl:call-template> + </xsl:attribute> + <xsl:element name="table:help-message"> + <xsl:attribute name="table:title"> + <xsl:value-of select="./x:InputTitle"/> + </xsl:attribute> + <xsl:attribute name="table:display"> + <xsl:choose> + <xsl:when test="./x:InputHide"> + <xsl:value-of select="'false'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'true'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:element name="text:p"> + <xsl:value-of select="./x:InputMessage"/> + </xsl:element> + </xsl:element> + <xsl:element name="table:error-message"> + <xsl:attribute name="table:message-type"> + <xsl:choose> + <xsl:when test="./x:ErrorStyle= 'Info'"> + <xsl:value-of select="'information'"/> + </xsl:when> + <xsl:when test="./x:ErrorStyle= 'Warn'"> + <xsl:value-of select="'warning'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'stop'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="table:title"> + <xsl:value-of select="./x:ErrorTitle"/> + </xsl:attribute> + <xsl:attribute name="table:display"> + <xsl:choose> + <xsl:when test="./x:ErrorHide"> + <xsl:value-of select="'false'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'true'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:element name="text:p"> + <xsl:value-of select="./x:ErrorMessage"/> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:template> + <!-- Note: Move template to common section --> + <xsl:template name="encode-as-cell-range-address"> + <xsl:param name="string"/> + <xsl:value-of select="$string"/> + </xsl:template> + <xsl:template name="encode-as-cell-address"> + <xsl:param name="string"/> + <xsl:value-of select="$string"/> + </xsl:template> + <xsl:template name="encode-as-nc-name"> + <xsl:param name="string"/> + <xsl:value-of select="translate($string, '.%()/\+[]', '')"/> + </xsl:template> + + <xsl:template name="set:distinct"> + <xsl:param name="nodes" select="/.."/> + <xsl:param name="distinct" select="/.."/> + <xsl:choose> + <xsl:when test="$nodes"> + <xsl:call-template name="set:distinct"> + <xsl:with-param name="distinct" select="$distinct | $nodes[1][not(. = $distinct)]"/> + <xsl:with-param name="nodes" select="$nodes[position() > 1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$distinct" mode="set:distinct"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="node()|@*" mode="set:distinct"> + <xsl:copy-of select="." /> + </xsl:template> + +</xsl:stylesheet> diff --git a/filter/source/xslt/import/uof/uof2odf_presentation.xsl b/filter/source/xslt/import/uof/uof2odf_presentation.xsl new file mode 100644 index 000000000..1debe1dde --- /dev/null +++ b/filter/source/xslt/import/uof/uof2odf_presentation.xsl @@ -0,0 +1,3494 @@ +<?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:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/> + <xsl:template match="uof:UOF"> + <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0"> + <xsl:apply-templates select="uof:元数据"/> + <office:settings> + <xsl:variable name="PageNumberFormat" select="/uof:UOF/uof:演示文稿/演:公用处理规则/演:页面设置集/演:页面设置/演:页码格式[1]"/> + <xsl:variable name="proportion"> + <xsl:value-of select="substring-before(/uof:UOF/uof:演示文稿/演:公用处理规则/演:显示比例,'%')"/> + </xsl:variable> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item> + <config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item> + <config:config-item config:name="VisibleAreaWidth" config:type="int">14098</config:config-item> + <config:config-item config:name="VisibleAreaHeight" config:type="int">9998</config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">view1</config:config-item> + <config:config-item config:name="GridIsVisible" config:type="boolean">false</config:config-item> + <config:config-item config:name="GridIsFront" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsSnapToGrid" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsSnapToPageMargins" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsSnapToSnapLines" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsSnapToObjectFrame" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsSnapToObjectPoints" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsPlusHandlesAlwaysVisible" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsFrameDragSingles" config:type="boolean">true</config:config-item> + <config:config-item config:name="EliminatePolyPointLimitAngle" config:type="int">1500</config:config-item> + <config:config-item config:name="IsEliminatePolyPoints" config:type="boolean">false</config:config-item> + <config:config-item config:name="VisibleLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item> + <config:config-item config:name="PrintableLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item> + <config:config-item config:name="LockedLayers" config:type="base64Binary"/> + <config:config-item config:name="NoAttribs" config:type="boolean">false</config:config-item> + <config:config-item config:name="NoColors" config:type="boolean">true</config:config-item> + <config:config-item config:name="RulerIsVisible" config:type="boolean">false</config:config-item> + <config:config-item config:name="PageKind" config:type="short">0</config:config-item> + <config:config-item config:name="SelectedPage" config:type="short">0</config:config-item> + <config:config-item config:name="IsLayerMode" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsDoubleClickTextEdit" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsClickChangeRotation" config:type="boolean">false</config:config-item> + <config:config-item config:name="SlidesPerRow" config:type="short">4</config:config-item> + <config:config-item config:name="EditModeStandard" config:type="int">0</config:config-item> + <config:config-item config:name="EditModeNotes" config:type="int">0</config:config-item> + <config:config-item config:name="EditModeHandout" config:type="int">1</config:config-item> + <config:config-item config:name="VisibleAreaTop" config:type="int">-5402</config:config-item> + <config:config-item config:name="VisibleAreaLeft" config:type="int">-441</config:config-item> + <config:config-item config:name="VisibleAreaWidth" config:type="int"> + <xsl:value-of select="(100*13997) div $proportion"/> + </config:config-item> + <config:config-item config:name="VisibleAreaHeight" config:type="int"> + <xsl:value-of select="(100*15426) div $proportion"/> + </config:config-item> + <config:config-item config:name="GridCoarseWidth" config:type="int">1000</config:config-item> + <config:config-item config:name="GridCoarseHeight" config:type="int">1000</config:config-item> + <config:config-item config:name="GridFineWidth" config:type="int">500</config:config-item> + <config:config-item config:name="GridFineHeight" config:type="int">500</config:config-item> + <config:config-item config:name="GridSnapWidth" config:type="int">1000</config:config-item> + <config:config-item config:name="GridSnapHeight" config:type="int">1000</config:config-item> + <config:config-item config:name="GridSnapWidthXNumerator" config:type="int">500</config:config-item> + <config:config-item config:name="GridSnapWidthXDenominator" config:type="int">1</config:config-item> + <config:config-item config:name="GridSnapWidthYNumerator" config:type="int">500</config:config-item> + <config:config-item config:name="GridSnapWidthYDenominator" config:type="int">1</config:config-item> + <config:config-item config:name="IsAngleSnapEnabled" config:type="boolean">false</config:config-item> + <config:config-item config:name="SnapAngle" config:type="int">1500</config:config-item> + <config:config-item config:name="ZoomOnPage" config:type="boolean">true</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="PageNumberFormat" config:type="int"> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:演示文稿/演:公用处理规则/演:页面设置集/演:页面设置/演:页码格式"> + <xsl:choose> + <xsl:when test="$PageNumberFormat='upper-letter'">0</xsl:when> + <xsl:when test="$PageNumberFormat='lower-letter'">1</xsl:when> + <xsl:when test="$PageNumberFormat='upper-roman'">2</xsl:when> + <xsl:when test="$PageNumberFormat='lower-letter'">3</xsl:when> + <xsl:when test="$PageNumberFormat='decimal'">4</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise>5</xsl:otherwise> + </xsl:choose> + </config:config-item> + </config:config-item-set> + </office:settings> + <office:scripts/> + <xsl:element name="office:font-face-decls"> + <style:font-face style:name="宋体" svg:font-family="宋体" style:font-family-generic="swiss" style:font-pitch="variable"/> + <xsl:apply-templates select="uof:式样集/uof:字体集"/> + </xsl:element> + <office:styles> + <xsl:apply-templates select="uof:演示文稿/演:公用处理规则/演:页面版式集/演:页面版式"/> + <xsl:call-template name="编号字体"/> + <xsl:for-each select="uof:式样集/uof:段落式样"> + <xsl:variable name="outline" select="@字:标识符"/> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]"> + <xsl:call-template name="段落式样"/> + </xsl:when> + <xsl:when test="contains($outline,'outline')"> + <xsl:call-template name="段落式样"/> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </office:styles> + <office:automatic-styles> + <xsl:apply-templates select="uof:演示文稿/演:公用处理规则/演:配色方案集/演:配色方案"/> + <xsl:apply-templates select="uof:式样集/uof:句式样"/> + <xsl:for-each select="uof:式样集/uof:段落式样"> + <xsl:variable name="outline" select="@字:标识符"/> + <xsl:if test="not(/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]) and not(contains($outline,'outline'))"> + <xsl:call-template name="段落式样"/> + </xsl:if> + </xsl:for-each> + <xsl:apply-templates select="uof:对象集"/> + <xsl:call-template name="create-page-master"> + <xsl:with-param name="impressoptions" select="uof:演示文稿/演:公用处理规则/演:页面设置集/演:页面设置"/> + </xsl:call-template> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形/图:文本内容/字:段落/字:段落属性/字:自动编号信息"> + <xsl:variable name="currlistid" select="@字:编号引用"/> + <xsl:variable name="currlist" select="."/> + <xsl:variable name="rootlist" select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符 =$currlistid]"/> + <xsl:if test="not(ancestor::字:段落/preceding-sibling::字:段落[1]/字:段落属性/字:自动编号信息/@字:编号引用= $currlistid)"> + <xsl:element name="text:list-style"> + <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::字:自动编号信息)"/></xsl:attribute> + <xsl:for-each select="$rootlist"> + <xsl:call-template name="自动编号"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + </xsl:for-each> + </office:automatic-styles> + <office:master-styles> + <xsl:apply-templates select="uof:演示文稿/演:主体/演:母版集"/> + </office:master-styles> + <office:body> + <office:presentation> + <xsl:apply-templates select="uof:演示文稿/演:主体/演:幻灯片集"/> + <xsl:apply-templates select="uof:演示文稿/演:公用处理规则/演:放映设置"/> + </office:presentation> + </office:body> + </office:document> + </xsl:template> + <xsl:template match="演:放映设置"> + <presentation:settings> + <xsl:variable name="start-page"> + <xsl:choose> + <xsl:when test="contains(演:幻灯片序列,' ')"> + <xsl:value-of select="substring-before(演:幻灯片序列,' ')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="演:幻灯片序列"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="first-page"> + <xsl:value-of select="/uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片[1]/@演:名称"/> + </xsl:variable> + <xsl:if test="not($start-page = $first-page)"> + <xsl:attribute name="presentation:start-page"><xsl:value-of select="$start-page"/></xsl:attribute> + </xsl:if> + <xsl:if test="演:全屏放映='false'"> + <xsl:attribute name="presentation:full-screen">false</xsl:attribute> + </xsl:if> + <xsl:if test="演:循环放映='true'"> + <xsl:attribute name="presentation:endless">true</xsl:attribute> + </xsl:if> + <xsl:if test="演:放映间隔"> + <xsl:attribute name="presentation:pause"><xsl:variable name="OOtime"><xsl:value-of select="substring-after(演:放映间隔,'P0Y0M0DT')"/></xsl:variable><xsl:value-of select="concat('PT',$OOtime)"/></xsl:attribute> + </xsl:if> + <xsl:if test="演:手动方式='true'"> + <xsl:attribute name="presentation:force-manual">true</xsl:attribute> + </xsl:if> + <xsl:if test="演:导航帮助='true'"> + <xsl:attribute name="presentation:start-with-navigator">true</xsl:attribute> + </xsl:if> + <xsl:if test="演:放映动画='false'"> + <xsl:attribute name="presentation:animations">disabled</xsl:attribute> + </xsl:if> + <xsl:if test="演:前端显示='true'"> + <xsl:attribute name="presentation:stay-on-top">true</xsl:attribute> + </xsl:if> + </presentation:settings> + </xsl:template> + <xsl:template name="自动编号"> + <xsl:for-each select="字:级别"> + <xsl:choose> + <xsl:when test="字:项目符号"> + <xsl:call-template name="xiangmufuhao"> + <xsl:with-param name="biaoshifu" select="../@字:标识符"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="字:图片符号引用"> + <xsl:call-template name="imagefuhao"> + <xsl:with-param name="biaoshifu" select="../@字:标识符"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="jibianhao"> + <xsl:with-param name="biaoshifu" select="../@字:标识符"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="编号字体"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号"> + <xsl:if test="字:级别/字:符号字体"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="concat( @字:标识符,字:级别/@字:级别值)"/></xsl:attribute> + <xsl:attribute name="style:family">text</xsl:attribute> + <xsl:element name="style:text-properties"> + <xsl:attribute name="fo:color"><xsl:value-of select="字:级别/字:符号字体/字:字体/@字:颜色"/></xsl:attribute> + <xsl:if test="字:级别/字:符号字体/字:粗体 and 字:级别/字:符号字体/字:粗体/@字:值='true'"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-style-asian">bold</xsl:attribute> + </xsl:if> + <xsl:variable name="ziti"> + <xsl:value-of select="字:级别/字:符号字体/字:字体/@字:中文字体引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:字体集/uof:字体声明"> + <xsl:if test="@uof:标识符=$ziti"> + <xsl:attribute name="style:font-name"><xsl:value-of select="@uof:名称"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:attribute name="fo:font-style">normal</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">normal</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template match="uof:对象集"> + <xsl:apply-templates select="图:图形"/> + <xsl:apply-templates select="图:图形/图:文本内容/字:段落/字:句/字:句属性" mode="style"/> + </xsl:template> + <xsl:variable name="uofUnit"> + <xsl:variable name="uu"> + <xsl:value-of select="/uof:UOF/uof:演示文稿/演:公用处理规则/演:度量单位"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$uu='cm'">cm</xsl:when> + <xsl:when test="$uu='mm'">mm</xsl:when> + <xsl:when test="$uu='pt'">pt</xsl:when> + <xsl:when test="$uu='inch'">inch</xsl:when> + <xsl:otherwise>pt</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="other-to-cm-conversion-factor"> + <xsl:choose> + <xsl:when test="$uofUnit='cm'">1</xsl:when> + <xsl:when test="$uofUnit='mm'">0.1</xsl:when> + <xsl:when test="$uofUnit='pt'">0.03527</xsl:when> + <xsl:when test="$uofUnit='inch'">2.54</xsl:when> + <xsl:when test="$uofUnit='pica'">0.4233</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:key match="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版/uof:锚点 | /uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片/uof:锚点 | /uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片/演:幻灯片备注/uof:锚点" name="rel_graphic_name" use="@uof:图形引用"/> + <xsl:template match="图:图形"> + <xsl:variable name="random-name"> + <xsl:value-of select="generate-id()"/> + </xsl:variable> + <xsl:variable name="draw-name"> + <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/> + </xsl:variable> + <xsl:call-template name="graphic-fill"> + <xsl:with-param name="draw-name" select="$draw-name"/> + <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:填充/图:渐变"/> + </xsl:call-template> + <xsl:variable name="biaozhifu" select="@图:标识符"/> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="style:family"><xsl:choose><xsl:when test="图:预定义图形/图:类别='3' or 图:预定义图形/图:类别='67'">presentation</xsl:when><xsl:otherwise>graphic</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版/uof:锚点[@uof:图形引用=$biaozhifu]"> + <xsl:variable name="duan" select="图:文本内容/字:段落/字:段落属性/@字:式样引用"/> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="/uof:UOF/uof:式样集/uof:段落式样[@字:标识符=$duan]/@字:基式样引用"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:graphic-properties"> + <xsl:call-template name="process-graphics"> + <xsl:with-param name="draw-name" select="$draw-name"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="style:family"><xsl:choose><xsl:when test="图:预定义图形/图:类别='3' or 图:预定义图形/图:类别='67'">presentation</xsl:when><xsl:otherwise>graphic</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版/uof:锚点[@uof:图形引用=$biaozhifu]"> + <xsl:variable name="duan" select="图:文本内容/字:段落/字:段落属性/@字:式样引用"/> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="/uof:UOF/uof:式样集/uof:段落式样[@字:标识符=$duan]/@字:基式样引用"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:graphic-properties"> + <xsl:if test="@图:其他对象"> + <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute> + <xsl:attribute name="draw:color-mode">standard</xsl:attribute> + <xsl:attribute name="draw:luminance">0%</xsl:attribute> + <xsl:attribute name="draw:contrast">0%</xsl:attribute> + <xsl:attribute name="draw:gamma">100%</xsl:attribute> + <xsl:attribute name="draw:red">0%</xsl:attribute> + <xsl:attribute name="draw:green">0%</xsl:attribute> + <xsl:attribute name="draw:blue">0%</xsl:attribute> + <xsl:attribute name="draw:image-opacity">100%</xsl:attribute> + <xsl:attribute name="style:mirror">none</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-graphics"/> + </xsl:element> + <xsl:if test="图:文本内容/@图:文字排列方向='vert-r2l' or 图:文本内容/@图:文字排列方向='vert-l2r'"> + <xsl:element name="style:paragraph-properties"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="process-graphics"> + <xsl:param name="draw-name"/> + <xsl:if test="not(key('rel_graphic_name',@图:标识符)/@uof:随动方式='movesize')"> + <xsl:attribute name="style:protect"><xsl:choose><xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:随动方式='move'">size</xsl:when><xsl:otherwise>position size</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="not(图:预定义图形/图:属性/图:填充)"> + <xsl:attribute name="draw:fill">none</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:attribute> + <xsl:if test="not(图:预定义图形/图:属性/图:填充/图:图片/@图:位置='title')"> + <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:前景色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色"> + <xsl:attribute name="draw:fill">solid</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:attribute name="draw:fill">gradient</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:渐变/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="图:预定义图形/图:属性/图:线颜色"> + <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')"> + <xsl:variable name="linetype" select="图:预定义图形/图:属性/图:线型"/> + <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$linetype='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$linetype='dot-dot-dash' or $linetype='dash-dot-dot-heavy'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$linetype='dash' or $linetype='dashed-heavy'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$linetype='dotted' or $linetype='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$linetype='double'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$linetype='dot-dash' or $linetype='dash-dot-heavy'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$linetype='wave' or $linetype='wavy-heavy'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$linetype='wavy-double'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:otherwise>Fine Dashed</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:线粗细"> + <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头"> + <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头/图:大小"> + <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头"> + <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头/图:大小"> + <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:透明度"> + <xsl:attribute name="draw:opacity"><xsl:variable name="opacity"><xsl:value-of select="./图:预定义图形/图:属性/图:透明度"/></xsl:variable><xsl:value-of select="concat((1 - $opacity)*100,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:for-each select="图:文本内容"> + <xsl:if test="@图:上边距"> + <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(@图:上边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(@图:下边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(@图:左边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(@图:右边距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(@图:文字排列方向='middle')"> + <xsl:variable name="hori-or-vert" select="@图:文字排列方向"/> + <xsl:choose> + <xsl:when test="$hori-or-vert='vert-l2r'"> + <xsl:attribute name="draw:textarea-vertical-align">bottom</xsl:attribute> + </xsl:when> + <xsl:when test="$hori-or-vert='hori-l2r'"> + <xsl:attribute name="draw:textarea-horizontal-align">left</xsl:attribute> + </xsl:when> + <xsl:when test="$hori-or-vert='hori-r2l'"> + <xsl:attribute name="draw:textarea-horizontal-align">right</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$hori-or-vert"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@图:自动换行"> + <xsl:attribute name="fo:wrap-option">no-wrap</xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:auto-grow-width"><xsl:choose><xsl:when test="@图:大小适应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:for-each> + </xsl:if> + </xsl:template> + <xsl:template name="bina_graphic"> + <xsl:param name="refGraphic"/> + <xsl:element name="office:binary-data"> + <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]"> + <xsl:value-of select="uof:数据"/> + </xsl:for-each> + </xsl:element> + <text:p/> + </xsl:template> + <xsl:template name="graphic-fill"> + <xsl:param name="draw-name"/> + <xsl:param name="gradient-name"/> + <xsl:if test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:element name="draw:gradient"> + <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute> + <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:渐变方向 * 10"/></xsl:attribute> + <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute> + <xsl:if test="$gradient-name/@图:种子X位置"> + <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:种子X位置,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="$gradient-name/@图:种子Y位置"> + <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:种子Y位置,'%')"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头"> + <xsl:element name="draw:marker"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'"> + <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute> + <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'"> + <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute> + <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute> + <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头"> + <xsl:element name="draw:marker"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'"> + <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute> + <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'"> + <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute> + <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute> + <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"> + <xsl:element name="draw:fill-image"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:call-template name="bina_graphic"> + <xsl:with-param name="refGraphic"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/> + </xsl:when> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型"> + <xsl:variable name="line" select="图:预定义图形/图:属性/图:线型"/> + <xsl:element name="draw:stroke-dash"> + <xsl:choose> + <xsl:when test="$line='dash-long' or $line='dash-long-heavy'"> + <xsl:attribute name="draw:name">Fine_20_Dashed</xsl:attribute> + <xsl:attribute name="draw:display-name">Fine dashed</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.508cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dot-dot-dash' or $line='dash-dot-dot-heavy'"> + <xsl:attribute name="draw:name">_32__20_Dots_20_1_20_Dash</xsl:attribute> + <xsl:attribute name="draw:display-name">2 Dots 1 Dash</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">2</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.203cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.203cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dash' or $line='dashed-heavy'"> + <xsl:attribute name="draw:name">Ultrafine_20_Dashed</xsl:attribute> + <xsl:attribute name="draw:display-name">Ultrafine Dashed</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.051cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.051cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dotted' or $line='dotted-heavy'"> + <xsl:attribute name="draw:name">Ultrafine_20_Dotted_20__28_var_29_</xsl:attribute> + <xsl:attribute name="draw:display-name">Ultrafine Dotted (var)</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:distance">50%</xsl:attribute> + </xsl:when> + <xsl:when test="$line='wave' or $line='wavy-heavy'"> + <xsl:attribute name="draw:name">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:attribute> + <xsl:attribute name="draw:display-name">Ultrafine 2 Dots 3 Dashes</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">2</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute> + <xsl:attribute name="draw:dots2">3</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.254cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.127cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dot-dash' or $line='dash-dot-heavy'"> + <xsl:attribute name="draw:name">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:attribute> + <xsl:attribute name="draw:display-name">3 Dashes 3 Dots (var)</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">3</xsl:attribute> + <xsl:attribute name="draw:dots1-length">197%</xsl:attribute> + <xsl:attribute name="draw:dots2">3</xsl:attribute> + <xsl:attribute name="draw:distance">100%</xsl:attribute> + </xsl:when> + <xsl:when test="$line='double'"> + <xsl:attribute name="draw:name">Line_20_with_20_Fine_20_Dots</xsl:attribute> + <xsl:attribute name="draw:display-name">Line with Fine Dots</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">2.007cm</xsl:attribute> + <xsl:attribute name="draw:dots2">10</xsl:attribute> + <xsl:attribute name="draw:distance">0.152cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='wavy-double'"> + <xsl:attribute name="draw:name">Fine_20_Dashed_20__28_var_29_</xsl:attribute> + <xsl:attribute name="draw:display-name">Fine Dashed (var)</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">197%</xsl:attribute> + <xsl:attribute name="draw:distance">197%</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="draw:name">Fine Dashed</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.508cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="create-page-master"> + <xsl:param name="impressoptions"/> + <xsl:for-each select="$impressoptions"> + <xsl:element name="style:page-layout"> + <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="@演:标识符"/></xsl:call-template></xsl:attribute> + <xsl:element name="style:page-layout-properties"> + <xsl:if test="演:纸张/@uof:宽度"> + <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(演:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="演:纸张/@uof:高度"> + <xsl:attribute name="fo:page-height"><xsl:value-of select="concat((演:纸张/@uof:高度),$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="演:页边距"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(演:页边距/@uof:上,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(演:页边距/@uof:下,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(演:页边距/@uof:左,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(演:页边距/@uof:右,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="演:纸张方向 = 'landscape'"> + <xsl:attribute name="style:print-orientation">landscape</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:print-orientation">portrait</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template name="encode-as-nc-name"> + <xsl:param name="string"/> + <xsl:value-of select="translate($string, '. %()/\+', '')"/> + </xsl:template> + <xsl:key name="tianchongmu" match="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版" use="@演:配色方案引用"/> + <xsl:key name="tianchonghuan" match="/uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片" use="@演:标识符"/> + <xsl:template match="演:配色方案"> + <xsl:if test="key('tianchongmu',@演:标识符)/演:背景"> + <xsl:for-each select="key('tianchongmu',@演:标识符)/演:背景"> + <xsl:call-template name="officestyle"/> + </xsl:for-each> + </xsl:if> + <xsl:if test="key('tianchonghuan',@演:标识符)/演:背景"> + <xsl:for-each select="key('tianchonghuan',@演:标识符)/演:背景"> + <xsl:call-template name="officestyle"/> + </xsl:for-each> + </xsl:if> + <xsl:element name="style:style"> + <xsl:attribute name="style:family">drawing-page</xsl:attribute> + <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute> + <xsl:element name="style:drawing-page-properties"> + <xsl:if test="演:填充"> + <xsl:attribute name="draw:fill">solid</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="演:背景色"/></xsl:attribute> + </xsl:if> + <xsl:if test="演:背景色"> + <xsl:attribute name="draw:background-size">border</xsl:attribute> + </xsl:if> + <xsl:if test="演:阴影"> + <xsl:attribute name="draw:shadow">visible</xsl:attribute> + <xsl:attribute name="draw:shadow-color"><xsl:value-of select="演:阴影"/></xsl:attribute> + </xsl:if> + <xsl:if test="演:文本和线条"> + <xsl:attribute name="svg:stroke-color"><xsl:value-of select="演:文本和线条"/></xsl:attribute> + </xsl:if> + <xsl:if test="key('tianchongmu',@演:标识符)/演:背景"> + <xsl:for-each select="key('tianchongmu',@演:标识符)/演:背景"> + <xsl:call-template name="background"/> + </xsl:for-each> + </xsl:if> + <xsl:if test="key('tianchonghuan',@演:标识符)/演:背景"> + <xsl:for-each select="key('tianchonghuan',@演:标识符)/演:背景"> + <xsl:call-template name="background"/> + </xsl:for-each> + </xsl:if> + </xsl:element> + <xsl:variable name="style-name"> + <xsl:value-of select="@演:标识符"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片[@演:标识符=$style-name]/演:切换"> + <style:drawing-page-properties> + <xsl:if test="@演:速度='slow'"> + <xsl:attribute name="presentation:transition-speed">slow</xsl:attribute> + </xsl:if> + <xsl:if test="not(@演:效果 = 'none')"> + <xsl:variable name="effect"> + <xsl:value-of select="@演:效果"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$effect='box in'"> + <xsl:attribute name="smil:type">irisWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">rectangle</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='box out'"> + <xsl:attribute name="smil:type">irisWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">rectangle</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='checkerboard across'"> + <xsl:attribute name="smil:type">checkerBoardWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">across</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='checkerboard down'"> + <xsl:attribute name="smil:type">checkerBoardWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">down</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='comb horizontal'"> + <xsl:attribute name="smil:type">pushWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">combHorizontal</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='comb vertical'"> + <xsl:attribute name="smil:type">pushWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">combVertical</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover down'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromTop</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover left'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromRight</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover right'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover up'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover left-down'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromTopRight</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover left-up'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromBottomRight</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover right-down'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromTopLeft</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='uncover right-up'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromBottomLeft</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover down'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromTop</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover left'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromRight</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover right'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover up'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover left-down'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromTopRight</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover left-up'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromBottomRight</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover right-down'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromTopLeft</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='cover right-up'"> + <xsl:attribute name="smil:type">slideWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromBottomLeft</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='fade through black'"> + <xsl:attribute name="smil:type">fade</xsl:attribute> + <xsl:attribute name="smil:subtype">fadeOverColor</xsl:attribute> + <xsl:attribute name="smil:fadeColor">#000000</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='push down'"> + <xsl:attribute name="smil:type">pushWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromTop</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='push left'"> + <xsl:attribute name="smil:type">pushWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromRight</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='push right'"> + <xsl:attribute name="smil:type">pushWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='push up'"> + <xsl:attribute name="smil:type">pushWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='random bars horizontal'"> + <xsl:attribute name="smil:type">randomBarWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">horizontal</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='random bars vertical'"> + <xsl:attribute name="smil:type">randomBarWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">vertical</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='shape circle'"> + <xsl:attribute name="smil:type">ellipseWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">circle</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='shape diamond'"> + <xsl:attribute name="smil:type">irisWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">diamond</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='shape plus'"> + <xsl:attribute name="smil:type">fourBoxWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">cornersOut</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='split horizontal in'"> + <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">horizontal</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='split horizontal out'"> + <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">horizontal</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='split vertical in'"> + <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">vertical</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='split vertical out'"> + <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">vertical</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wedge'"> + <xsl:attribute name="smil:type">fanWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">centerTop</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wheel clockwise – 1 spoke'"> + <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">oneBlade</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wheel clockwise – 2 spoke'"> + <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">twoBladeVertical</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wheel clockwise – 3 spoke'"> + <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">threeBlade</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wheel clockwise – 4 spoke'"> + <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">fourBlade</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wheel clockwise – 8 spoke'"> + <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">eightBlade</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wipe left'"> + <xsl:attribute name="smil:type">barWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">leftToRight</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wipe right'"> + <xsl:attribute name="smil:type">barWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">leftToRight</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wipe up'"> + <xsl:attribute name="smil:type">barWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">topToBottom</xsl:attribute> + <xsl:attribute name="smil:direction">reverse</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='wipe down'"> + <xsl:attribute name="smil:type">barWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">topToBottom</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='blinds vertical'"> + <xsl:attribute name="smil:type">blindsWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">vertical</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='blinds horizontal'"> + <xsl:attribute name="smil:type">blindsWipe</xsl:attribute> + <xsl:attribute name="smil:subtype">horizontal</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='dissolve'"> + <xsl:attribute name="smil:type">dissolve</xsl:attribute> + </xsl:when> + <xsl:when test="$effect='random transition'"> + <xsl:attribute name="smil:type">random</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="演:方式/演:单击鼠标='false'"> + <xsl:attribute name="presentation:transition-type">automatic</xsl:attribute> + </xsl:if> + <xsl:if test="演:方式/演:时间间隔"> + <xsl:attribute name="presentation:duration"><xsl:value-of select="concat('PT00H00M',演:方式/演:时间间隔,'S')"/></xsl:attribute> + </xsl:if> + <xsl:if test="(演:声音/@演:预定义声音 and not(演:声音/@演:预定义声音='none')) or 演:声音/@演:自定义声音"> + <xsl:choose> + <xsl:when test="演:声音/@演:预定义声音"> + <xsl:variable name="voice"> + <xsl:value-of select="演:声音/@演:预定义声音"/> + </xsl:variable> + <presentation:sound xlink:type="simple" xlink:show="new" xlink:actuate="onRequest"> + <xsl:attribute name="xlink:href"><xsl:choose><xsl:when test="$voice='applause'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/applause.wav</xsl:when><xsl:when test="$voice='explosion'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/explos.wav</xsl:when><xsl:when test="$voice='laser'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/laser.wav</xsl:when><xsl:otherwise><xsl:value-of select="演:声音/@演:预定义声音"/></xsl:otherwise></xsl:choose></xsl:attribute> + </presentation:sound> + </xsl:when> + <xsl:otherwise> + <presentation:sound xlink:type="simple" xlink:show="new" xlink:actuate="onRequest"> + <xsl:attribute name="xlink:href"><xsl:value-of select="演:声音/@演:自定义声音"/></xsl:attribute> + </presentation:sound> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </style:drawing-page-properties> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="officestyle"> + <xsl:variable name="random-name"> + <xsl:value-of select="generate-id()"/> + </xsl:variable> + <xsl:variable name="draw-name"> + <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="图:渐变"> + <xsl:element name="draw:gradient"> + <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="图:渐变/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:start-color"><xsl:value-of select="图:渐变/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:end-color"><xsl:value-of select="图:渐变/@图:终止色"/></xsl:attribute> + <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat(图:渐变/@图:起始浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat(图:渐变/@图:终止浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:angle"><xsl:value-of select="图:渐变/@图:渐变方向 * 10"/></xsl:attribute> + <xsl:attribute name="draw:border"><xsl:value-of select="concat(图:渐变/@图:边界,'%')"/></xsl:attribute> + <xsl:if test="图:渐变/@图:种子X位置"> + <xsl:attribute name="draw:cx"><xsl:value-of select="concat(图:渐变/@图:种子X位置,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:渐变/@图:种子Y位置"> + <xsl:attribute name="draw:cy"><xsl:value-of select="concat(图:渐变/@图:种子Y位置,'%')"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:when> + <xsl:when test="图:图片/@图:图形引用 or 图:图案/@图:图形引用"> + <xsl:element name="draw:fill-image"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:图案/@图:图形引用"><xsl:value-of select="图:图案/@图:类型"/></xsl:when><xsl:when test="图:图片/@图:图形引用"><xsl:value-of select="图:图片/@图:名称"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:call-template name="bina_graphic"> + <xsl:with-param name="refGraphic"> + <xsl:choose> + <xsl:when test="图:图案/@图:图形引用"> + <xsl:value-of select="图:图案/@图:图形引用"/> + </xsl:when> + <xsl:when test="图:图片/@图:图形引用"> + <xsl:value-of select="图:图片/@图:图形引用"/> + </xsl:when> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="background"> + <xsl:variable name="random-name"> + <xsl:value-of select="generate-id()"/> + </xsl:variable> + <xsl:variable name="draw-name"> + <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="图:图片"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:图片/@图:名称"/></xsl:attribute> + <xsl:if test="not(图:图片/@图:位置='title')"> + <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:when test="图:图案"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:图案/@图:前景色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:颜色"> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:颜色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:渐变"> + <xsl:attribute name="draw:fill">gradient</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:渐变/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="演:母版集"> + <draw:layer-set> + <draw:layer draw:name="layout"/> + <draw:layer draw:name="background"/> + <draw:layer draw:name="backgroundobjects"/> + <draw:layer draw:name="controls"/> + <draw:layer draw:name="measurelines"/> + </draw:layer-set> + <xsl:apply-templates select="演:母版"/> + </xsl:template> + <xsl:template match="演:母版"> + <xsl:choose> + <xsl:when test="@演:类型 = 'handout' "> + <xsl:element name="style:handout-master"> + <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute> + <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@演:页面设置引用"/></xsl:attribute> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:配色方案引用"/></xsl:attribute> + <xsl:for-each select="uof:锚点[@uof:缩略图='true']"> + <draw:page-thumbnail draw:layer="backgroundobjects"> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + </draw:page-thumbnail> + </xsl:for-each> + <xsl:apply-templates select="uof:锚点[not(@uof:缩略图='true')]"/> + </xsl:element> + </xsl:when> + <xsl:when test="@演:类型 = 'slide'"> + <xsl:element name="style:master-page"> + <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute> + <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@演:页面设置引用"/></xsl:attribute> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:配色方案引用"/></xsl:attribute> + <xsl:apply-templates select="uof:锚点 "/> + <xsl:for-each select="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版"> + <xsl:if test="@演:类型 = 'notes'"> + <xsl:element name="presentation:notes"> + <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@演:页面设置引用"/></xsl:attribute> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:配色方案引用"/></xsl:attribute> + <xsl:apply-templates select="uof:锚点 "/> + </xsl:element> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="uof:句式样"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + <xsl:if test="@字:基式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="ancestor::字:段落式样"> + <xsl:attribute name="style:family">paragraph</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:family">text</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="*"/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="段落式样"> + <xsl:element name="style:style"> + <xsl:variable name="outline" select="@字:标识符"/> + <xsl:attribute name="style:family"><xsl:choose><xsl:when test="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]">presentation</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + <xsl:if test="@字:基式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]"> + <style:graphic-properties draw:stroke="none" draw:fill="none"> + <xsl:element name="text:list-style"> + <xsl:call-template name="自动编号"/> + </xsl:element> + </style:graphic-properties> + </xsl:for-each> + </xsl:if> + <xsl:element name="style:paragraph-properties"> + <xsl:if test="字:自动编号信息"> + <xsl:attribute name="text:enable-numbering">true</xsl:attribute> + </xsl:if> + <xsl:if test="contains($outline,'title')"> + <xsl:attribute name="fo:text-align">center</xsl:attribute> + </xsl:if> + <xsl:call-template name="paragraph-properties"/> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="*"/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="paragraph-properties"> + <xsl:choose> + <xsl:when test="descendant::字:页边距[@uof:左]"> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="number(((descendant::字:页边距/@uof:左)div 10) *1)"/>cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-left">0cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="descendant::字:页边距[@uof:右]"> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="number(((descendant::字:页边距/@uof:右)div 10) *1)"/>cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-right">0cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:text-indent">0cm</xsl:attribute> + <xsl:call-template name="bidi"/> + </xsl:template> + <xsl:template name="bidi"> + </xsl:template> + <xsl:template name="jibianhao"> + <xsl:param name="biaoshifu"/> + <xsl:element name="text:list-level-style-number"> + <xsl:variable name="currlevel" select="number(@字:级别值)"/> + <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute> + <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute> + <xsl:if test="字:起始编号"> + <xsl:attribute name="text:start-value"><xsl:value-of select="字:起始编号"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:正规格式"> + <xsl:attribute name="text:num-regular-exp"><xsl:value-of select="字:正规格式/@值"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(字:编号格式表示) - string-length(translate(字:编号格式表示,'%','') )"/></xsl:attribute> + <xsl:if test="字:编号格式"> + <xsl:call-template name="编号格式"/> + </xsl:if> + <xsl:if test="字:编号格式表示"> + <xsl:attribute name="style:num-prefix"><xsl:choose><xsl:when test="number($currlevel) =1"><xsl:value-of select="substring-before(字:编号格式表示,concat('%',$currlevel))"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-after(substring-after( substring-before(字:编号格式表示,concat('%',$currlevel)),concat('%',string(number($currlevel) -1))),'.')"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,concat('%',$currlevel))"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:list-level-properties"> + <xsl:if test="@字:编号对齐方式"> + <xsl:attribute name="fo:text-align"><xsl:value-of select="@字:编号对齐方式"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="suojinleixing"/> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:if test="字:符号字体"> + <xsl:variable name="Font-ID"> + <xsl:value-of select="字:符号字体/@字:式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样"> + <xsl:if test="@字:标识符=$Font-ID"> + <xsl:if test="字:字体/@字:中文字体引用"> + <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="字:符号字体"> + <xsl:apply-templates select="*"/> + </xsl:for-each> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="xiangmufuhao"> + <xsl:param name="biaoshifu"/> + <xsl:variable name="currlevel" select="number(@字:级别值)"/> + <xsl:element name="text:list-level-style-bullet"> + <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute> + <xsl:attribute name="text:bullet-char"><xsl:value-of select="字:项目符号"/></xsl:attribute> + <xsl:element name="style:list-level-properties"> + <xsl:if test="@字:编号对齐方式"> + <xsl:attribute name="fo:text-align"><xsl:value-of select="@字:编号对齐方式"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="suojinleixing"/> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:if test="字:符号字体"> + <xsl:variable name="Font-ID"> + <xsl:value-of select="字:符号字体/@字:式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样[@字:标识符=$Font-ID]"> + <xsl:if test="字:字体/@字:中文字体引用"> + <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="字:符号字体"> + <xsl:apply-templates select="*"/> + </xsl:for-each> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="suojinleixing"> + <xsl:if test="字:缩进/字:左/字:绝对/@字:值"> + <xsl:attribute name="text:space-before"><xsl:value-of select="concat(number(字:缩进/字:左/字:绝对/@字:值),$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:缩进/字:右/字:绝对/@字:值"> + <xsl:attribute name="text:min-label-width"><xsl:value-of select="concat(number(字:缩进/字:右/字:绝对/@字:值),$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:缩进/字:首行/字:绝对/@字:值"> + <xsl:attribute name="text:min-label-distance"><xsl:value-of select="concat(number(字:缩进/字:首行/字:绝对/@字:值),$uofUnit)"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="imagefuhao"> + <xsl:param name="biaoshifu"/> + <xsl:variable name="currlevel" select="number(@字:级别值)"/> + <xsl:element name="text:list-level-style-image" style:vertical-pos="middle" style:vertical-rel="line" fo:width="0.265cm" fo:height="0.265cm"> + <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute> + <xsl:if test="字:图片符号引用"> + <xsl:variable name="gid"> + <xsl:value-of select="字:图片符号引用"/> + </xsl:variable> + <xsl:element name="office:binary-data"> + <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据"/> + </xsl:element> + </xsl:if> + <xsl:element name="style:list-level-properties"> + <xsl:attribute name="style:vertical-pos">middle</xsl:attribute> + <xsl:attribute name="style:vertical-rel">line</xsl:attribute> + <xsl:attribute name="fo:width"><xsl:value-of select="concat(字:图片符号引用/@字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:height"><xsl:value-of select="concat(字:图片符号引用/@字:高度,$uofUnit)"/></xsl:attribute> + <xsl:if test="字:符号字体"> + <xsl:variable name="Font-ID"> + <xsl:value-of select="字:符号字体/@字:式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样"> + <xsl:if test="@字:标识符=$Font-ID"> + <xsl:if test="字:字体/@字:中文字体引用"> + <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:if> + <xsl:call-template name="suojinleixing"/> + <xsl:if test="@字:编号对齐方式"> + <xsl:attribute name="fo:text-align"><xsl:value-of select="@字:编号对齐方式"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:for-each select="字:符号字体"> + <xsl:apply-templates select="*"/> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="编号格式"> + <xsl:attribute name="style:num-format"><xsl:choose><xsl:when test="string(字:编号格式)='lower-letter'">a</xsl:when><xsl:when test="string(字:编号格式)='upper-letter'">A</xsl:when><xsl:when test="string(字:编号格式)='lower-roman'">i</xsl:when><xsl:when test="string(字:编号格式)='upper-roman'">I</xsl:when><xsl:when test="string(字:编号格式)='decimal-enclosed-circle'">①, ②, ③, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-traditional'">甲, 乙, 丙, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-zodiac'">子, 丑, 寅, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-counting'">一, 二, 三, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-legal-simplified'">壹, 贰, 叁, ...</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template match="演:幻灯片集"> + <xsl:for-each select="演:幻灯片"> + <xsl:element name="draw:page"> + <xsl:attribute name="draw:name"><xsl:value-of select="@演:名称"/></xsl:attribute> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:标识符"/></xsl:attribute> + <xsl:attribute name="draw:master-page-name"><xsl:value-of select="@演:母版引用"/></xsl:attribute> + <xsl:if test="@演:页面版式引用"> + <xsl:attribute name="presentation:presentation-page-layout-name"><xsl:value-of select="@演:页面版式引用"/></xsl:attribute> + </xsl:if> + <office:forms form:automatic-focus="false" form:apply-design-mode="false"/> + <xsl:apply-templates select="uof:锚点"/> + <xsl:apply-templates select="演:动画"/> + <xsl:element name="presentation:notes"> + <xsl:attribute name="draw:style-name">dp2</xsl:attribute> + <xsl:apply-templates select="./演:幻灯片备注/uof:锚点"/> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template match="演:动画"> + <xsl:element name="anim:par"> + <xsl:attribute name="presentation:node-type">timing-root</xsl:attribute> + <anim:seq presentation:node-type="main-sequence"> + <xsl:for-each select="演:序列"> + <anim:par begin="next"> + <anim:par smil:begin="0s"> + <xsl:variable name="animnodename">anim:par</xsl:variable> + <xsl:choose> + <xsl:when test="演:效果//演:其他"> + <xsl:copy-of select="演:效果//演:其他/*"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="{$animnodename}"> + <xsl:attribute name="smil:fill"><xsl:choose><xsl:when test="演:定时/@演:回卷='true'">remove</xsl:when><xsl:otherwise>hold</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:choose> + <xsl:when test="演:增强/演:动画播放后/@演:播放后隐藏='true'"> + <xsl:attribute name="presentation:preset-property">Direction;Accelerate;Decelerate</xsl:attribute> + </xsl:when> + <xsl:when test=".//演:轮子"> + <xsl:attribute name="presentation:preset-property">Spokes</xsl:attribute> + </xsl:when> + <xsl:when test="演:效果/演:强调/演:更改填充颜色"> + <xsl:attribute name="presentation:preset-property">FillColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute> + </xsl:when> + <xsl:when test="演:效果/演:强调/演:更改字体颜色"> + <xsl:attribute name="presentation:preset-property">CharColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute> + </xsl:when> + <xsl:when test="演:效果/演:强调/演:更改字号"> + <xsl:attribute name="presentation:preset-property">CharHeight</xsl:attribute> + </xsl:when> + <xsl:when test="演:效果/演:强调/演:更改字形"> + <xsl:attribute name="presentation:preset-property">CharDecoration</xsl:attribute> + </xsl:when> + <xsl:when test="演:效果/演:强调/演:陀螺旋"> + <xsl:attribute name="presentation:preset-property">Rotate;Accelerate;Decelerate;AutoReverse</xsl:attribute> + </xsl:when> + <xsl:when test="演:效果/演:强调/演:透明"> + <xsl:attribute name="presentation:preset-property">Transparency</xsl:attribute> + </xsl:when> + <xsl:when test="演:效果/演:强调/演:更改线条颜色"> + <xsl:attribute name="presentation:preset-property">LineColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:attribute name="presentation:node-type"><xsl:choose><xsl:when test="演:定时/@演:事件='on click'">on-click</xsl:when><xsl:otherwise><xsl:value-of select="演:定时/@演:事件"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="smil:begin"><xsl:value-of select="演:定时/@演:延时"/></xsl:attribute> + <xsl:choose> + <xsl:when test="演:定时/@演:重复='until next click' "> + <xsl:attribute name="smil:repeatCount">indefinite</xsl:attribute> + <xsl:attribute name="smil:end">next</xsl:attribute> + </xsl:when> + <xsl:when test="演:定时/@演:重复='until next slide' "> + <xsl:attribute name="smil:repeatCount">indefinite</xsl:attribute> + </xsl:when> + <xsl:when test="演:定时/@演:重复 !='none'"> + <xsl:attribute name="smil:repeatCount"><xsl:value-of select="演:定时/@演:重复"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="演:增强/演:动画文本/@演:发送"> + <xsl:attribute name="anim:iterate-type"><xsl:choose><xsl:when test="演:增强/演:动画文本/@演:发送='by word'">by-word</xsl:when><xsl:when test="演:增强/演:动画文本/@演:发送='by letter'">by-letter</xsl:when><xsl:otherwise>all at once</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="演:增强/演:动画文本/@演:间隔"> + <xsl:attribute name="anim:iterate-interval"><xsl:value-of select="演:增强/演:动画文本/@演:间隔"/></xsl:attribute> + </xsl:if> + <xsl:if test="$animnodename='anim:iterate' "> + <xsl:attribute name="anim:id"><xsl:value-of select="@演:动画对象"/></xsl:attribute> + </xsl:if> + <xsl:apply-templates select="演:效果"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </anim:par> + </anim:par> + </xsl:for-each> + </anim:seq> + </xsl:element> + </xsl:template> + <xsl:template match="演:效果"> + <xsl:apply-templates select="演:进入 "/> + <xsl:apply-templates select="演:强调"/> + <xsl:apply-templates select="演:退出"/> + </xsl:template> + <xsl:template match="演:进入"> + <xsl:attribute name="presentation:preset-class">entrance</xsl:attribute> + <xsl:apply-templates select="." mode="entrance"/> + </xsl:template> + <xsl:template match="演:强调"> + <xsl:attribute name="presentation:preset-class">emphasis</xsl:attribute> + <xsl:apply-templates select="." mode="emphasis"/> + </xsl:template> + <xsl:template match="演:退出"> + <xsl:attribute name="presentation:preset-class">exit</xsl:attribute> + <xsl:apply-templates select="." mode="exit"/> + </xsl:template> + <xsl:template name="演速度"> + <xsl:choose> + <xsl:when test="./@演:速度='very fast' ">0.5s</xsl:when> + <xsl:when test="./@演:速度='fast'">1s</xsl:when> + <xsl:when test="./@演:速度='medium'">2s</xsl:when> + <xsl:when test="./@演:速度='slow'">3s</xsl:when> + <xsl:when test="./@演:速度='very slow'">5s</xsl:when> + <xsl:otherwise>1s</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="演:出现" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-appear</xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" anim:sub-item="text" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:盒状" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-box</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:棋盘" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-checkerboard</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='down'">downward</xsl:when><xsl:when test="@演:方向='across'">across</xsl:when></xsl:choose></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:dur="2s" anim:sub-item="text" smil:type="checkerBoardWipe" smil:subtype="down"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:圆形扩展" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-circle</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:阶梯状" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-diagonal-squares</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='left down'">left-to-bottom</xsl:when><xsl:when test="@演:方向='left up'">left-to-top</xsl:when><xsl:when test="@演:方向='right down'">right-to-bottom</xsl:when><xsl:when test="@演:方向='right up'">right-to-top</xsl:when></xsl:choose></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="waterfallWipe" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向='left down'">horizontalLeft</xsl:when><xsl:when test="@演:方向='left up'">horizontalLeft</xsl:when><xsl:when test="@演:方向='right down'">horizontalRight</xsl:when><xsl:when test="@演:方向='right up'">horizontalRight</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:菱形" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-diamond</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:内向溶解" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-dissolve-in</xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="dissolve" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:闪烁一次" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-flash-once</xsl:attribute> + <anim:set smil:begin="0s" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:飞入" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-fly-in</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from top-right'">from-top-right</xsl:when><xsl:when test="@演:方向 = 'from top-left'">from-top-left</xsl:when><xsl:when test="@演:方向 = 'from bottom-left'">from-bottom-left</xsl:when><xsl:when test="@演:方向 = 'from bottom-right'">from-bottom-right</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <xsl:variable name="smilvalueX"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'right')">1+width/2;x</xsl:when> + <xsl:when test="contains(@演:方向,'left')">0-width/2;x</xsl:when> + <xsl:otherwise>x;x</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="smilvalueY"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'bottom')">1+height/2;y</xsl:when> + <xsl:when test="contains(@演:方向,'top')">0-height/2;y</xsl:when> + <xsl:otherwise>y;y</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute> + </anim:animate> + <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute> + </anim:animate> + </xsl:template> + <xsl:template match="演:缓慢飞入" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-fly-in-slow</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <xsl:variable name="smilvalueX"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'right')">1+width/2;x</xsl:when> + <xsl:when test="contains(@演:方向,'left')">0-width/2;x</xsl:when> + <xsl:otherwise>x;x</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="smilvalueY"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'bottom')">1+height/2;y</xsl:when> + <xsl:when test="contains(@演:方向,'top')">0-height/2;y</xsl:when> + <xsl:otherwise>y;y</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute> + </anim:animate> + <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute> + </anim:animate> + </xsl:template> + <xsl:template match="演:切入" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-peek-in</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="slideWipe" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">fromBottom</xsl:when><xsl:when test="@演:方向 = 'from right'">fromRight</xsl:when><xsl:when test="@演:方向 = 'from left'">fromLeft</xsl:when><xsl:when test="@演:方向 = 'from top'">fromTop</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:十字形扩展" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-plus</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="fourBoxWipe" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'in'">cornersIn</xsl:when><xsl:when test="@演:方向 = 'out'">cornersOut</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:随机线条" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-bars</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="randomBarWipe" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:劈裂" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-split</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal-out</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal-in</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical-in</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical-out</xsl:when></xsl:choose></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:dur="0.5s" smil:type="barnDoorWipe"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:百叶窗" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-venetian-blinds</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="blindsWipe" smil:direction="reverse"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:扇形展开" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-wedge</xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.0015s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:轮子" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-wheel</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:辐射状"/></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:dur="0.5s" smil:type="pinWheelWipe"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:辐射状='1'">oneBlade</xsl:when><xsl:when test="@演:辐射状='2'">twoBlade</xsl:when><xsl:when test="@演:辐射状='3'">threeBlade</xsl:when><xsl:when test="@演:辐射状='4'">fourBlade</xsl:when><xsl:when test="@演:辐射状='8'">eightBlade</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:擦除" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-wipe</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:速度 = 'from right'">from-right</xsl:when><xsl:when test="@演:速度 = 'from left'">from-left</xsl:when><xsl:when test="@演:速度 = 'from top'">from-top</xsl:when><xsl:when test="@演:速度 = 'from bottom'">from-bottom</xsl:when><xsl:otherwise>from-left</xsl:otherwise></xsl:choose></xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.006s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="(@演:速度 = 'from right') or (@演:速度 = 'from left')">leftToRight</xsl:when><xsl:when test="(@演:速度 = 'from top') or (@演:速度 = 'from bottom')">topToBottom</xsl:when><xsl:otherwise>leftToRight</xsl:otherwise></xsl:choose></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="演:随机效果" mode="entrance"> + <xsl:attribute name="presentation:preset-id">ooo-entrance-random</xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + <anim:animate smil:dur="1s" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + </anim:animate> + <anim:animate smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + </anim:animate> + <anim:animate smil:fill="hold" smil:attributeName="rotate" smil:values="90;0" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + </anim:animate> + <anim:transitionFilter smil:type="fade" smil:subtype="crossfade"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + </anim:transitionFilter> + </xsl:template> + <xsl:template match="更改填充颜色" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-fill-color</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute> + <anim:animateColor smil:fill="hold" smil:attributeName="fill-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute> + </anim:animateColor> + <anim:set smil:dur="0.5s" smil:fill="hold" smil:attributeName="fill" smil:to="solid"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="更改字体颜色" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-color</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute> + <anim:animateColor smil:fill="hold" smil:attributeName="fill-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute> + </anim:animateColor> + </xsl:template> + <xsl:template match="演:更改字号" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-size</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute> + <anim:animate smil:fill="hold" smil:attributeName="font-size" presentation:additive="base"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义尺寸='tiny' ">0.25,1</xsl:when><xsl:when test="@演:预定义尺寸='smaller' ">0.5,1</xsl:when><xsl:when test="@演:预定义尺寸='larger' ">1.5,1</xsl:when><xsl:when test="@演:预定义尺寸='huge' ">4,1</xsl:when><xsl:when test="@演:自定义尺寸"><xsl:value-of select="@演:自定义尺寸"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute> + </anim:animate> + </xsl:template> + <xsl:template name="emp_font_style"> + <xsl:param name="fontstyle"/> + <xsl:choose> + <xsl:when test="contains($fontstyle,' ')"> + <anim:set smil:dur="indefinite" smil:attributeName="font-style"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:to"><xsl:value-of select="substring-before($fontstyle,' ')"/></xsl:attribute> + </anim:set> + <xsl:variable name="fontstyle1"> + <xsl:choose> + <xsl:when test="contains($fontstyle,' ')"> + <xsl:value-of select="substring-after($fontstyle,' ')"/> + </xsl:when> + <xsl:when test="not($fontstyle=' ')"> + <xsl:value-of select="$fontstyle"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="emp_font_style"> + <xsl:with-param name="fontstyle"> + <xsl:value-of select="$fontstyle1"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="演:更改字形" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-style</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type">1</xsl:attribute> + <xsl:call-template name="emp_font_style"> + <xsl:with-param name="fontstyle"> + <xsl:value-of select="@演:字形"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template match="演:更改线条颜色" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-line-color</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute> + <anim:animateColor smil:dur="0s" smil:fill="hold" smil:attributeName="stroke-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute> + </anim:animateColor> + <anim:set smil:dur="0s" smil:fill="hold" anim:sub-item="text" smil:attributeName="stroke" smil:to="solid"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:陀螺旋" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-spin</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute> + <anim:animateTransform smil:fill="hold" smil:by="180" presentation:additive="base" svg:type="rotate"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:by"><xsl:choose><xsl:when test="@演:预定义角度='quarter spin'">90</xsl:when><xsl:when test="@演:预定义角度='half spin'">180</xsl:when><xsl:when test="@演:预定义角度='full spin'">360</xsl:when><xsl:when test="@演:预定义角度='two spins'">720 </xsl:when><xsl:when test="@演:自定义角度"><xsl:value-of select="@演:自定义角度"/></xsl:when></xsl:choose></xsl:attribute> + </anim:animateTransform> + </xsl:template> + <xsl:template match="演:透明" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-transparency</xsl:attribute> + <xsl:attribute name="smil:repeatCount"><xsl:choose><xsl:when test="(@演:期间 = 'until next click') or (@演:期间 ='until next slide') ">indefinite</xsl:when><xsl:when test="@演:期间='2' or @演:期间 ='3' or @演:期间 ='4' or @演:期间 ='5' or @演:期间 ='10'"><xsl:value-of select="@演:期间"/></xsl:when><xsl:otherwise>2</xsl:otherwise></xsl:choose></xsl:attribute> + <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="opacity"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义透明度='25' ">0.25</xsl:when><xsl:when test="@演:预定义透明度='50' ">0.5</xsl:when><xsl:when test="@演:预定义透明度='75' ">0.75</xsl:when><xsl:when test="@演:预定义透明度='100' ">1</xsl:when><xsl:when test="@演:自定义透明度"><xsl:value-of select="@演:自定义透明度"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:缩放" mode="emphasis"> + <xsl:attribute name="presentation:preset-id">ooo-emphasis-grow-and-shrink</xsl:attribute> + <anim:animateTransform smil:fill="hold" anim:sub-item="text" presentation:additive="base" svg:type="scale"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义尺寸='tiny' ">0.25,1</xsl:when><xsl:when test="@演:预定义尺寸='smaller' ">0.5,1</xsl:when><xsl:when test="@演:预定义尺寸='larger' ">1.5,1</xsl:when><xsl:when test="@演:预定义尺寸='huge' ">4,1</xsl:when><xsl:when test="@演:自定义尺寸"><xsl:value-of select="@演:自定义尺寸"/></xsl:when><xsl:otherwise>0.5,1</xsl:otherwise></xsl:choose></xsl:attribute> + </anim:animateTransform> + </xsl:template> + <xsl:template match="演:盒状" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-box</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:棋盘" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-checkerboard</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='down'">downward</xsl:when><xsl:when test="@演:方向='across'">across</xsl:when></xsl:choose></xsl:attribute> + <anim:transitionFilter smil:dur="2s" anim:sub-item="text" smil:type="checkerBoardWipe" smil:subtype="down" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:圆形扩展" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-circle</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:阶梯状" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-diagonal-squares</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='left down'">left-to-bottom</xsl:when><xsl:when test="@演:方向='left up'">left-to-top</xsl:when><xsl:when test="@演:方向='right down'">right-to-bottom</xsl:when><xsl:when test="@演:方向='right up'">right-to-top</xsl:when></xsl:choose></xsl:attribute> + <anim:transitionFilter smil:type="waterfallWipe" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向='left down'">horizontalLeft</xsl:when><xsl:when test="@演:方向='left up'">horizontalLeft</xsl:when><xsl:when test="@演:方向='right down'">horizontalRight</xsl:when><xsl:when test="@演:方向='right up'">horizontalRight</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:菱形" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-diamond</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:消失" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-disappear</xsl:attribute> + <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" anim:sub-item="text" smil:attributeName="visibility" smil:to="visible"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:向外溶解" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-dissolve</xsl:attribute> + <anim:transitionFilter smil:type="dissolve" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:闪烁一次" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-flash-once</xsl:attribute> + <anim:animate smil:attributeName="visibility" smil:values="hidden;visible" smil:keyTimes="0;0.5" smil:calcMode="discrete" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:animate> + <anim:set smil:dur="0s" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:飞出" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-fly-out</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'to bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'to top-right'">from-top-right</xsl:when><xsl:when test="@演:方向 = 'to top-left'">from-top-left</xsl:when><xsl:when test="@演:方向 = 'to bottom-left'">from-bottom-left</xsl:when><xsl:when test="@演:方向 = 'to bottom-right'">from-bottom-right</xsl:when><xsl:when test="@演:方向 = 'to right'">from-right</xsl:when><xsl:when test="@演:方向 = 'to left'">from-left</xsl:when><xsl:when test="@演:方向 = 'to top'">from-top</xsl:when></xsl:choose></xsl:attribute> + <xsl:variable name="smilvalueX"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'right')">x;1+width/2</xsl:when> + <xsl:when test="contains(@演:方向,'left')">x;0-width/2</xsl:when> + <xsl:otherwise>x;x</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="smilvalueY"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'bottom')">y;1+height/2</xsl:when> + <xsl:when test="contains(@演:方向,'top')">y;0-height/2</xsl:when> + <xsl:otherwise>y;y</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute> + </anim:animate> + <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute> + </anim:animate> + <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:缓慢移出" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-crawl-out</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'to bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'to right'">from-right</xsl:when><xsl:when test="@演:方向 = 'to left'">from-left</xsl:when><xsl:when test="@演:方向 = 'to top'">from-top</xsl:when></xsl:choose></xsl:attribute> + <xsl:variable name="smilvalueX"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'right')">x;1+width/2</xsl:when> + <xsl:when test="contains(@演:方向,'left')">x;0-width/2</xsl:when> + <xsl:otherwise>x;x</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="smilvalueY"> + <xsl:choose> + <xsl:when test="contains(@演:方向,'bottom')">y;1+height/2</xsl:when> + <xsl:when test="contains(@演:方向,'top')">y;0-height/2</xsl:when> + <xsl:otherwise>y;y</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute> + </anim:animate> + <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute> + </anim:animate> + <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:切出" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-peek-out</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute> + <anim:transitionFilter smil:type="slideWipe" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">fromBottom</xsl:when><xsl:when test="@演:方向 = 'from right'">fromRight</xsl:when><xsl:when test="@演:方向 = 'from left'">fromLeft</xsl:when><xsl:when test="@演:方向 = 'from top'">fromTop</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:十字形扩展" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-plus</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:transitionFilter smil:type="fourBoxWipe" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'in'">cornersIn</xsl:when><xsl:when test="@演:方向 = 'out'">cornersOut</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:随机线条" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-random-bars</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:transitionFilter smil:type="randomBarWipe" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:劈裂" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-split</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal-out</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal-in</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical-in</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical-out</xsl:when></xsl:choose></xsl:attribute> + <anim:transitionFilter smil:dur="0.5s" smil:type="barnDoorWipe" smil:mode="out"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:百叶窗" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-venetian-blinds</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute> + <anim:transitionFilter smil:type="blindsWipe" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:扇形展开" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-wedge</xsl:attribute> + <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop" smil:mode="out"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.0015s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:轮子" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-wheel</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:辐射状"/></xsl:attribute> + <anim:transitionFilter smil:dur="0.5s" smil:type="pinWheelWipe" smil:mode="out"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:辐射状='1'">oneBlade</xsl:when><xsl:when test="@演:辐射状='2'">twoBlade</xsl:when><xsl:when test="@演:辐射状='3'">threeBlade</xsl:when><xsl:when test="@演:辐射状='4'">fourBlade</xsl:when><xsl:when test="@演:辐射状='8'">eightBlade</xsl:when></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:擦除" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-wipe</xsl:attribute> + <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:速度 = 'from right'">from-right</xsl:when><xsl:when test="@演:速度 = 'from left'">from-left</xsl:when><xsl:when test="@演:速度 = 'from top'">from-top</xsl:when><xsl:when test="@演:速度 = 'from bottom'">from-bottom</xsl:when><xsl:otherwise>from-left</xsl:otherwise></xsl:choose></xsl:attribute> + <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse" smil:mode="out"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="(@演:速度 = 'from right') or (@演:速度 = 'from left')">leftToRight</xsl:when><xsl:when test="(@演:速度 = 'from top') or (@演:速度 = 'from bottom')">topToBottom</xsl:when><xsl:otherwise>leftToRight</xsl:otherwise></xsl:choose></xsl:attribute> + </anim:transitionFilter> + <anim:set smil:dur="0.006s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="演:随机效果" mode="exit"> + <xsl:attribute name="presentation:preset-id">ooo-exit-random</xsl:attribute> + <anim:transitionFilter smil:type="fade" smil:subtype="crossfade" smil:mode="out"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:transitionFilter> + <anim:animate smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:animate> + <anim:animate smil:dur="0.1s" smil:decelerate="1" smil:attributeName="y" smil:values="y;y-.03" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:animate> + <anim:animate smil:begin="0.1s" smil:dur="0.9s" smil:accelerate="1" smil:attributeName="y" smil:values="y;y+1" smil:keyTimes="0;1" presentation:additive="base"> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:animate> + <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"> + <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute> + <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute> + </anim:set> + </xsl:template> + <xsl:template match="uof:锚点" name="图形解析"> + <xsl:variable name="tuxing1" select="@uof:图形引用"/> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]"> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif'"> + <xsl:element name="draw:frame"> + <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::uof:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute> + <xsl:attribute name="presentation:class">graphic</xsl:attribute> + <xsl:attribute name="presentation:user-transformed">true</xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="draw:layer">layout</xsl:attribute> + <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing1"> + <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute> + </xsl:if> + <draw:image> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"> + <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute> + </xsl:if> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"> + <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute> + </xsl:if> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"> + <office:binary-data> + <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"/> + </office:binary-data> + </xsl:if> + </draw:image> + </xsl:element> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"/> + <xsl:with-param name="groupx" select="0"/> + <xsl:with-param name="groupy" select="0"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="graph"> + <xsl:param name="id"/> + <xsl:param name="groupx"/> + <xsl:param name="groupy"/> + <xsl:for-each select="$id"> + <xsl:variable name="tuxing1"> + <xsl:value-of select="图:预定义图形/图:类别"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$tuxing1='11'"> + <xsl:call-template name="Rectangle"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='19'"> + <xsl:call-template name="Oval"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='61'"> + <xsl:call-template name="Line"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='64'"> + <xsl:call-template name="Curve"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='65'"> + <xsl:call-template name="Freeform"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='66'"> + <xsl:call-template name="Scribble"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='3'"> + <xsl:call-template name="演文本框"/> + </xsl:when> + <xsl:when test="$tuxing1='67'"> + <xsl:call-template name="演缩略图"/> + </xsl:when> + <xsl:when test="$tuxing1='4'"> + <xsl:element name="draw:g"> + <xsl:variable name="tu"> + <xsl:value-of select="@图:标识符"/> + </xsl:variable> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$tu"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:variable name="this-group-x"> + <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:x坐标"/> + </xsl:variable> + <xsl:variable name="this-group-y"> + <xsl:value-of select="key('rel_graphic_name',@图:标识符)/uof:y坐标"/> + </xsl:variable> + <xsl:variable name="group-x"> + <xsl:value-of select="number($groupx + $this-group-x)"/> + </xsl:variable> + <xsl:variable name="group-y"> + <xsl:value-of select="number($groupy + $this-group-y)"/> + </xsl:variable> + <xsl:call-template name="组合图形"> + <xsl:with-param name="zuheliebiao" select="@图:组合列表"/> + <xsl:with-param name="groupx1" select="$group-x"/> + <xsl:with-param name="groupy1" select="$group-y"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="common"> + <xsl:param name="groupx"/> + <xsl:param name="groupy"/> + <xsl:variable name="tuxing"> + <xsl:value-of select="@图:标识符"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="key('rel_graphic_name',@图:标识符)"> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="draw:layer"><xsl:choose><xsl:when test="parent::演:母版">backgroundobjects</xsl:when><xsl:otherwise>layout</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing"> + <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="zuheweizhi-x"> + <xsl:value-of select="图:组合位置/@图:x坐标"/> + </xsl:variable> + <xsl:variable name="zuheweizhi-y"> + <xsl:value-of select="图:组合位置/@图:y坐标"/> + </xsl:variable> + <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(($groupx + $zuheweizhi-x),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(($groupy + $zuheweizhi-y),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(图:预定义图形 /图:属性/图:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(图:预定义图形/图:属性 /图:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="draw:layer">layout</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:template> + <xsl:template name="组合图形"> + <xsl:param name="zuheliebiao"/> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:variable name="x"> + <xsl:value-of select="$groupx1"/> + </xsl:variable> + <xsl:variable name="y"> + <xsl:value-of select="$groupy1"/> + </xsl:variable> + <xsl:variable name="first-pictures"> + <xsl:value-of select="substring-before($zuheliebiao,',')"/> + </xsl:variable> + <xsl:variable name="other-pictures"> + <xsl:value-of select="substring-after($zuheliebiao,',')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($other-pictures,',')"> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + <xsl:call-template name="组合图形"> + <xsl:with-param name="zuheliebiao" select="$other-pictures"/> + <xsl:with-param name="groupx1" select="$x"/> + <xsl:with-param name="groupy1" select="$y"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $other-pictures]"/> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="Curve"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:path"> + <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点坐标/@图:路径"/></xsl:attribute> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Freeform"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:polygon"> + <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Scribble"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:polyline"> + <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="drawpoints"> + <xsl:param name="points"/> + <xsl:param name="value"/> + <xsl:variable name="frist-piont"> + <xsl:value-of select="substring-before($points,'lineto')"/> + </xsl:variable> + <xsl:variable name="other-points"> + <xsl:value-of select="substring-after($points,'lineto')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($other-points,'lineto')"> + <xsl:variable name="x-coor"> + <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="y-coor"> + <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="all-points"> + <xsl:value-of select="concat($value,$x-coor,',',$y-coor,' ')"/> + </xsl:variable> + <xsl:call-template name="drawpoints"> + <xsl:with-param name="points" select="$other-points"/> + <xsl:with-param name="value" select="$all-points"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="q-x-coor"> + <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="q-y-coor"> + <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="e-x-coor"> + <xsl:value-of select="substring-before($other-points,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="e-y-coor"> + <xsl:value-of select="substring-after($other-points,' ') * 1000"/> + </xsl:variable> + <xsl:value-of select="concat($value,$q-x-coor,',',$q-y-coor,' ',$e-x-coor,',',$e-y-coor)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="Oval"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:ellipse"> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Rectangle"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:rect"> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Line"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:line"> + <xsl:variable name="tuxing1" select="@图:标识符"/> + <xsl:choose> + <xsl:when test="key('rel_graphic_name',@图:标识符)"> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)"> + <xsl:attribute name="svg:x1"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y1"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:x2"><xsl:value-of select="concat((@uof:x坐标 + @uof:宽度),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y2"><xsl:value-of select="concat((@uof:y坐标 + @uof:高度),$uofUnit)"/></xsl:attribute> + <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing1"> + <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="zuheweizhi-x"> + <xsl:value-of select="图:组合位置/@图:x坐标"/> + </xsl:variable> + <xsl:variable name="zuheweizhi-y"> + <xsl:value-of select="图:组合位置/@图:y坐标"/> + </xsl:variable> + <xsl:variable name="hex"> + <xsl:value-of select="concat(number($groupx1 + $zuheweizhi-x),$uofUnit)"/> + </xsl:variable> + <xsl:variable name="hey"> + <xsl:value-of select="concat(number($groupy1 + $zuheweizhi-y),$uofUnit)"/> + </xsl:variable> + <xsl:attribute name="svg:x1"><xsl:value-of select="$hex"/></xsl:attribute> + <xsl:attribute name="svg:y1"><xsl:value-of select="$hey"/></xsl:attribute> + <xsl:attribute name="svg:x2"><xsl:value-of select="concat(($hex + 图:预定义图形/图:属性/图:宽度),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y2"><xsl:value-of select="concat(($hey + 图:预定义图形/图:属性/图:高度),$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="演文本框"> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)"> + <xsl:variable name="tuxing1" select="@uof:图形引用"/> + <xsl:element name="draw:frame"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="draw:layer"><xsl:choose><xsl:when test="parent::演:母版">backgroundobjects</xsl:when><xsl:otherwise>layout</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:类别 = '3' and (parent::演:幻灯片/@演:配色方案引用) and not(@uof:占位符 = 'graphic')"> + <xsl:attribute name="presentation:style-name"><xsl:value-of select="parent::演:幻灯片/@演:配色方案引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing1"> + <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(@uof:占位符 = 'graphic')"> + <xsl:attribute name="presentation:style-name"><xsl:value-of select="@uof:图形引用"/></xsl:attribute> + </xsl:if> + <xsl:variable name="placeholdType"> + <xsl:value-of select="@uof:占位符"/> + </xsl:variable> + <xsl:if test="@uof:占位符"> + <xsl:attribute name="presentation:class"><xsl:choose><xsl:when test="@uof:占位符 = 'clipart'">graphic</xsl:when><xsl:when test="@uof:占位符 = 'media_clip'">graphic</xsl:when><xsl:when test="@uof:占位符 = 'graphics'">graphic</xsl:when><xsl:when test="@uof:占位符 = 'number'">page_number</xsl:when><xsl:when test="@uof:占位符 = 'centertitle'">title</xsl:when><xsl:when test="@uof:占位符 = 'date'">date-time</xsl:when><xsl:when test="@uof:占位符 = 'vertical_text'">vertical_outline</xsl:when><xsl:when test="@uof:占位符 = 'vertical_subtitle'">vertical_outline</xsl:when><xsl:otherwise><xsl:value-of select="@uof:占位符"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"> + <xsl:variable name="leibie"> + <xsl:value-of select="图:预定义图形/图:类别"/> + </xsl:variable> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="图:文本内容 or @图:其他对象"> + <xsl:attribute name="presentation:user-transformed">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="presentation:placeholder">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$placeholdType = 'graphic' or $placeholdType = 'clipart' or $placeholdType ='media_clip'"> + <draw:image/> + </xsl:when> + <xsl:when test="$placeholdType = 'table' or $placeholdType = 'chart' or $placeholdType ='object'"> + <draw:object/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="draw:text-box"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template name="演缩略图"> + <draw:page-thumbnail> + <xsl:call-template name="common"/> + <xsl:attribute name="draw:layer">layout</xsl:attribute> + <xsl:attribute name="draw:page-number"><xsl:for-each select="../.."><xsl:value-of select="count(preceding-sibling::演:幻灯片) + 1"/></xsl:for-each></xsl:attribute> + <xsl:attribute name="presentation:class">page</xsl:attribute> + </draw:page-thumbnail> + </xsl:template> + <xsl:template match="演:页面版式"> + <xsl:element name="style:presentation-page-layout"> + <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute> + <xsl:apply-templates select="演:占位符" mode="layout"/> + </xsl:element> + </xsl:template> + <xsl:template match="演:占位符" mode="layout"> + <presentation:placeholder> + <xsl:attribute name="presentation:object"><xsl:choose><xsl:when test="@演:类型='vertical_text'">vertical_outline</xsl:when><xsl:when test="@演:类型='date'">date-time</xsl:when><xsl:when test="@演:类型='number'">page_number</xsl:when><xsl:otherwise><xsl:value-of select="@演:类型"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(uof:锚点/@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(uof:锚点/@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(uof:锚点/@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(uof:锚点/@uof:高度,$uofUnit)"/></xsl:attribute> + </presentation:placeholder> + </xsl:template> + <xsl:template match="字:段落"> + <xsl:choose> + <xsl:when test="字:段落属性/字:自动编号信息"> + <xsl:call-template name="编号解析"/> + </xsl:when> + <xsl:when test="字:句/字:分页符"> + <xsl:call-template name="processPageBreaks"/> + </xsl:when> + <xsl:when test="string(parent::node()/@uof:locID)='t0107'"> + <xsl:call-template name="jiaozhu"/> + </xsl:when> + <xsl:when test="string(parent::node()/@uof:locID)='t0108'"> + <xsl:call-template name="weizhu"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="commonParagraph"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="jiaozhu"> + <xsl:element name="text:footnote"> + <xsl:element name="text:footnote-body"> + <xsl:call-template name="commonParagraph"/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="weizhu"> + <xsl:element name="text:endnote"> + <xsl:element name="text:endnote-body"> + <xsl:call-template name="commonParagraph"/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="processPageBreaks"> + <xsl:variable name="pageBreak" select="字:句/字:分页符"/> + <xsl:call-template name="createSubParagraph"> + <xsl:with-param name="list" select="$pageBreak[1]/preceding-sibling::字:句"/> + <xsl:with-param name="pageBreak"/> + <xsl:with-param name="needsPageBreak">false</xsl:with-param> + </xsl:call-template> + <xsl:for-each select="$pageBreak"> + <xsl:call-template name="createSubParagraph"> + <xsl:with-param name="list" select="./following-sibling::字:句[preceding::字:句/字:分页符 = '.']"/> + <xsl:with-param name="pageBreak" select="."/> + <xsl:with-param name="needsPageBreak">true</xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="createSubParagraph"> + <xsl:param name="list"/> + <xsl:param name="pageBreak"/> + <xsl:param name="needsPageBreak"/> + <xsl:if test="(count($list) > 0) or ($needsPageBreak ='true') "> + <xsl:element name="text:p"> + <xsl:choose> + <xsl:when test="$needsPageBreak = 'true'"> + <xsl:choose> + <xsl:when test="ancestor::字:段落/字:段落属性"> + <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:演示文稿/演:主体" level="any" count="字:段落属性"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:style-name">PageBreak</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + <xsl:if test="$pageBreak"> + <xsl:apply-templates select="$pageBreak"/> + </xsl:if> + <xsl:apply-templates select="$list"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="字:区域开始[@字:类型='bookmark']"> + <text:bookmark-start text:name="{@字:标识符}"/> + </xsl:template> + <xsl:template match="字:区域结束[preceding::字:区域开始[1]/@字:类型='bookmark']"> + <text:bookmark-end text:name="{@字:标识符引用}"/> + </xsl:template> + <xsl:template match="字:段落/字:域开始"> + <xsl:choose> + <xsl:when test="@字:类型='CREATEDATE'"> + <xsl:variable name="datestr" select="../字:句/字:文本串"/> + <xsl:element name="text:date"> + <xsl:attribute name="style:data-style-name">Time<xsl:number from="/uof:UOF/uof:演示文稿/演:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'CREATEDATE']"/></xsl:attribute> + <xsl:attribute name="text:date-value"><xsl:value-of select="concat(substring-before($datestr,' '),'T',substring-after($datestr,' '))"/></xsl:attribute> + <xsl:value-of select="$datestr"/> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="commonParagraph"> + <xsl:element name="text:p"> + <xsl:if test="@字:动画标识"> + <xsl:attribute name="text:id"><xsl:value-of select="@字:动画标识"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="commonParagraphAttributes"/> + <xsl:apply-templates/> + </xsl:element> + </xsl:template> + <xsl:template name="commonParagraphAttributes"> + <xsl:choose> + <xsl:when test="字:段落属性"> + <xsl:attribute name="text:style-name"><xsl:value-of select="字:段落属性/@字:式样引用"/></xsl:attribute> + </xsl:when> + <xsl:when test="generate-id(ancestor::字:主体/descendant::字:段落[1]) = generate-id(.)"> + <xsl:variable name="paragraph-number"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/> + </xsl:variable> + <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute> + </xsl:when> + <xsl:when test="not(字:段落属性) and (descendant::字:分栏符 or ancestor::字:分节/descendant::字:节属性[字:分栏/@字:栏数 > 1])"> + <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute> + </xsl:when> + <xsl:when test="字:句"> + <xsl:apply-templates select="字:文本串"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="字:段落属性"/> + <xsl:template match="字:句/字:句属性"/> + <xsl:template match="字:句属性" mode="style"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:对象集" level="any" count="字:句属性" format="1"/></xsl:attribute> + <xsl:attribute name="style:family">text</xsl:attribute> + <xsl:if test="@字:式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="./*"/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="字:句/字:文本串"> + <xsl:choose> + <xsl:when test="string(.) = ' ' "> + <xsl:element name="text:s"/> + </xsl:when> + <xsl:when test="contains(.,' ')"> + <xsl:call-template name="replace-spaces"> + <xsl:with-param name="curr-string" select="."/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="replace-spaces"> + <xsl:param name="curr-string"/> + <xsl:if test="contains($curr-string,' ')"> + <xsl:value-of select="substring-before($curr-string,' ')"/> + <text:s text:c="2"/> + <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/> + <xsl:choose> + <xsl:when test="contains($next-string, ' ')"> + <xsl:call-template name="replace-spaces"> + <xsl:with-param name="curr-string" select="$next-string"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$next-string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="字:句"> + <xsl:if test="name(following-sibling::*[1])!='字:域结束'"> + <xsl:if test="字:换行符"> + <xsl:element name="text:line-break"/> + </xsl:if> + <xsl:variable name="currently-node" select="./字:锚点"/> + <xsl:choose> + <xsl:when test="字:句属性//字:隐藏文字/@字:值='true'"> + <text:hidden-text text:is-hidden="true" text:string-value="{.}"/> + </xsl:when> + <xsl:when test="字:区域开始[@字:类型='hyperlink']"> + <xsl:element name="text:a"> + <xsl:attribute name="xlink:type">simple</xsl:attribute> + <xsl:variable name="hyperDest" select="字:区域开始/@字:标识符"/> + <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链源=$hyperDest"><xsl:if test="@uof:目标"><xsl:value-of select="@uof:目标"/></xsl:if><xsl:if test="@uof:书签"><xsl:variable name="bookmarkDest" select="@uof:书签"/><xsl:for-each select="/uof:UOF/uof:书签集/uof:书签"><xsl:if test="@uof:名称=$bookmarkDest"><xsl:value-of select="concat('#',uof:文本位置/@字:区域引用)"/></xsl:if></xsl:for-each></xsl:if></xsl:if></xsl:for-each></xsl:attribute> + <xsl:apply-templates select="字:文本串"/> + </xsl:element> + </xsl:when> + <xsl:when test="(preceding-sibling::字:句) or (字:句属性)or(字:区域开始)"> + <xsl:element name="text:span"> + <xsl:choose> + <xsl:when test="字:区域开始[@字:类型='annotation']"> + <xsl:variable name="ref_comment"> + <xsl:value-of select="字:区域开始/@字:标识符"/> + </xsl:variable> + <xsl:apply-templates/> + <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:公用处理规则/字:批注集/字:批注[@字:区域引用 = $ref_comment]"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="stylenum"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/> + </xsl:variable> + <xsl:attribute name="text:style-name"><xsl:value-of select="字:句属性/@字:式样引用"/></xsl:attribute> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="node()[name() = '字:位置']"> + <xsl:variable name="height">100% </xsl:variable> + <xsl:variable name="position"> + <xsl:choose> + <xsl:when test="parent::字:句属性//字:位置"> + <xsl:value-of select="concat( parent::字:句属性//字:位置, '%')"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:text-position"><xsl:value-of select="concat(concat( $position, ' '), $height)"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:字体"> + <xsl:if test="@字:字号"> + <xsl:attribute name="fo:font-size"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="@字:相对字号 and self::node( )[not(parent::字:句属性)]"> + <xsl:variable name="stylename" select="parent::node()/@字:基式样引用"/> + <xsl:variable name="zihao"> + <xsl:for-each select="/uof:UOF/uof:式样集//uof:段落式样[@字:标识符=$stylename]"> + <xsl:value-of select="字:字体/@字:字号"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="font-size" select="@字:相对字号"/> + <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="@字:颜色"> + <xsl:attribute name="fo:color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:中文字体引用"> + <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:西文字体引用"> + <xsl:attribute name="style:font-name"><xsl:value-of select="@字:西文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:斜体"> + <xsl:if test="@字:值='true'"> + <xsl:attribute name="fo:font-style">italic</xsl:attribute> + <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-complex">italic</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:粗体"> + <xsl:if test="@字:值='true'"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="fo:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:下划线"> + <xsl:choose> + <xsl:when test="@字:字下划线 = 'true'"> + <xsl:attribute name="style:text-underline">single</xsl:attribute> + <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute> + <xsl:attribute name="fo:score-spaces">false</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'thick'"> + <xsl:attribute name="style:text-underline">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dotted-heavy'"> + <xsl:attribute name="style:text-underline">bold-dotted</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dashed-heavy'"> + <xsl:attribute name="style:text-underline">bold-dash</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-long'"> + <xsl:attribute name="style:text-underline">long-dash</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-long-heavy'"> + <xsl:attribute name="style:text-underline">bold-long-dash</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-dot-heavy'"> + <xsl:attribute name="style:text-underline">bold-dot-dash</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'"> + <xsl:attribute name="style:text-underline">bold-dot-dot-dash</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wavy-heavy'"> + <xsl:attribute name="style:text-underline">bold-wave</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wavy-double'"> + <xsl:attribute name="style:text-underline">double-wave</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:text-underline"><xsl:value-of select="@字:类型"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@字:颜色 and not(@字:颜色 = 'auto')"> + <xsl:attribute name="style:text-underline-color"><xsl:value-of select="concat( '#', @字:颜色)"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:阴影"> + <xsl:attribute name="style:text-shadow">1pt 1pt</xsl:attribute> + <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute> + </xsl:template> + <xsl:template match="字:删除线"> + <xsl:choose> + <xsl:when test="@字:类型 = 'single' "> + <xsl:attribute name="style:text-crossing-out">single-line</xsl:attribute> + </xsl:when> + <xsl:when test="@字类型 = 'double'"> + <xsl:attribute name="style:text-crossing-out">double-line</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="字:突出显示"> + <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute> + <xsl:attribute name="fo:text-background-color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute> + </xsl:template> + <xsl:template match="@字:颜色[not(.='auto')]"> + <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:浮雕"> + <xsl:attribute name="style:font-relief">embossed</xsl:attribute> + </xsl:template> + <xsl:template match="字:外框"> + <xsl:attribute name="style:text-outline">true</xsl:attribute> + </xsl:template> + <xsl:template match="字:缩放"> + <xsl:attribute name="style:text-scale"><xsl:value-of select="@字:字号"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:字符间距[parent::字:句属性]"> + <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( floor(number(字:字符间距 div 1440) * 2540) div 1000, 'cm')"/></xsl:attribute> + </xsl:template> + <xsl:template match="uof:字体集"> + <xsl:if test="not(uof:字体声明[@uof:名称='StarSymbol'])"> + <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/> + </xsl:if> + <xsl:for-each select="uof:字体声明"> + <xsl:element name="style:font-face"> + <xsl:attribute name="style:name"><xsl:value-of select="@uof:名称"/></xsl:attribute> + <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:字体族"/></xsl:attribute> + <xsl:if test="@uof:字符集 = '02'"> + <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute> + </xsl:if> + <xsl:if test="@uof:字体族"> + <xsl:choose> + <xsl:when test="@uof:字体族 = 'Swiss'"> + <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Modern'"> + <xsl:attribute name="style:font-family-generic">modern</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族='Roman'"> + <xsl:attribute name="style:font-family-generic">roman</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Script'"> + <xsl:attribute name="style:font-family-generic">script</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Decorative'"> + <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='System'"> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:attribute name="style:font-pitch">12</xsl:attribute> + </xsl:element> + </xsl:for-each> + <xsl:apply-templates select="uof:字体声明"/> + </xsl:template> + <xsl:template match="uof:元数据"> + <office:meta> + <meta:generator>UOFText 2004</meta:generator> + <dc:title> + <xsl:value-of select="uof:标题"/> + </dc:title> + <dc:description> + <xsl:value-of select="uof:摘要"/> + </dc:description> + <dc:subject> + <xsl:value-of select="uof:主题"/> + </dc:subject> + <meta:initial-creator> + <xsl:value-of select="uof:作者"/> + </meta:initial-creator> + <meta:creation-date> + <xsl:value-of select="substring-before( uof:创建日期, 'Z')"/> + </meta:creation-date> + <dc:creator> + <xsl:value-of select="uof:最后作者"/> + </dc:creator> + <dc:date> + <xsl:value-of select="substring-before( uof:编辑时间, 'Z')"/> + </dc:date> + <meta:printed-by/> + <meta:print-date/> + <meta:keywords> + <meta:keyword> + <xsl:value-of select="uof:关键字集/uof:关键字"/> + </meta:keyword> + </meta:keywords> + <dc:language/> + <meta:editing-cycles> + <xsl:value-of select="uof:编辑次数"/> + </meta:editing-cycles> + <meta:editing-duration> + <xsl:if test="uof:编辑时间"> + <xsl:value-of select="concat('PT', floor(uof:编辑时间 div 60), 'H', uof:编辑时间 mod 60, 'M0S')"/> + </xsl:if> + </meta:editing-duration> + <meta:user-defined meta:name="Category"> + <xsl:value-of select="uof:分类"/> + </meta:user-defined> + <meta:user-defined meta:name="Manager"> + <xsl:value-of select="uof:经理名称"/> + </meta:user-defined> + <meta:user-defined meta:name="Company"> + <xsl:value-of select="uof:公司名称"/> + </meta:user-defined> + <meta:user-defined meta:name="Version"> + <xsl:value-of select="uof:创建应用程序"/> + </meta:user-defined> + <xsl:if test="uof:文档模板|child::*[@uof:locID='u0013']"> + <meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:href="{child::*[@uof:locID='u0013']}"/> + </xsl:if> + <xsl:if test="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']"> + <xsl:for-each select="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']"> + <xsl:element name="meta:user-defined"> + <xsl:attribute name="meta:name"><xsl:value-of select="@uof:名称"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:if> + <meta:document-statistic meta:page-count="{child::*[@uof:locID='u0020']}" meta:paragraph-count="{child::*[@uof:locID='u0025']}" meta:word-count="{child::*[@uof:locID='u0023']}" meta:object-count="{child::*[@uof:locID='u0026']}" meta:character-count="{child::*[@uof:locID='u0021']}"/> + <meta:document-statistic/> + </office:meta> + </xsl:template> + <xsl:template match="uof:用户自定义元数据集"> + <xsl:for-each select="node()[@名称]"> + <meta:user-defined meta:name="{name()}"> + <xsl:value-of select="."/> + </meta:user-defined> + </xsl:for-each> + </xsl:template> + <xsl:template name="parse-range"> + <xsl:param name="range-value"/> + <xsl:param name="last"/> + <xsl:variable name="first-pit"> + <xsl:choose> + <xsl:when test="contains($range-value,',')"> + <xsl:value-of select="substring-before($range-value,',')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$range-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current"> + <xsl:choose> + <xsl:when test="contains($first-pit,':')"> + <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/> + <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/> + <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/> + <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/> + <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/> + <xsl:variable name="the-str"> + <xsl:call-template name="condition-rc-str"> + <xsl:with-param name="r-start" select="$R-start"/> + <xsl:with-param name="r-end" select="$R-end"/> + <xsl:with-param name="c-start" select="$C-start"/> + <xsl:with-param name="c-end" select="$C-end"/> + <xsl:with-param name="last" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$the-str"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($first-pit,',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($range-value,',')"> + <xsl:call-template name="parse-range"> + <xsl:with-param name="range-value" select="substring-after($range-value,',')"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($last,$current)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="condition-rc-str"> + <xsl:param name="r-start"/> + <xsl:param name="r-end"/> + <xsl:param name="c-start"/> + <xsl:param name="c-end"/> + <xsl:param name="last"/> + <xsl:variable name="current"> + <xsl:call-template name="condition-c-str"> + <xsl:with-param name="rc-str" select="concat('R',$r-start)"/> + <xsl:with-param name="start" select="$c-start"/> + <xsl:with-param name="end" select="$c-end"/> + <xsl:with-param name="last" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$r-start < $r-end"> + <xsl:call-template name="condition-rc-str"> + <xsl:with-param name="r-start" select="$r-start + 1"/> + <xsl:with-param name="r-end" select="$r-end"/> + <xsl:with-param name="c-start" select="$c-start"/> + <xsl:with-param name="c-end" select="$c-end"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$r-start = $r-end"> + <xsl:value-of select="concat($last,$current)"/> + </xsl:if> + </xsl:template> + <xsl:template name="condition-c-str"> + <xsl:param name="rc-str"/> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:param name="last"/> + <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/> + <xsl:if test="$start < $end"> + <xsl:call-template name="condition-c-str"> + <xsl:with-param name="rc-str" select="$rc-str"/> + <xsl:with-param name="start" select="$start + 1"/> + <xsl:with-param name="end" select="$end"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$start = $end"> + <xsl:value-of select="concat($last,$current)"/> + </xsl:if> + </xsl:template> + <xsl:template name="condition-str"> + <xsl:param name="param-str"/> + <xsl:choose> + <xsl:when test="contains($param-str,'(')"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($param-str,':')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="encode-as-cell-range-address"> + <xsl:param name="string"/> + <xsl:value-of select="$string"/> + </xsl:template> + <xsl:template name="encode-as-cell-address"> + <xsl:param name="string"/> + <xsl:value-of select="$string"/> + </xsl:template> + <xsl:param name="dpi" select="111"/> + <xsl:param name="centimeter-in-mm" select="10"/> + <xsl:param name="inch-in-mm" select="25.4"/> + <xsl:param name="didot-point-in-mm" select="0.376065"/> + <xsl:param name="pica-in-mm" select="4.2333333"/> + <xsl:param name="point-in-mm" select="0.3527778"/> + <xsl:param name="twip-in-mm" select="0.017636684"/> + <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/> + <!-- ***** MEASUREMENT CONVERSIONS ***** + PARAM 'value' + The measure to be converted. + The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...) + directly added to the number. + + PARAM 'rounding-factor' + Is used for the rounding of decimal places. + The parameter number is the product of 1 and some '10', where + every zero represents a decimal place. + + For example, providing as parameter: + <xsl:param name="rounding-factor" select="10000" /> + Gives by default four decimal places. + + To round two decimal places, basically the following is done: + <xsl:value-of select="round(100 * value) div 100"/> + + RETURN The converted number, by default rounded to four decimal places. + In case the input measure could not be matched the same value is + returned and a warning message is written out. + + + + MEASURE LIST: + * 1 millimeter (mm), the basic measure + + * 1 centimeter (cm) = 10 mm + + * 1 inch (in) = 25.4 mm + While the English have already seen the light (read: the metric system), the US + remains loyal to this medieval system. + + * 1 point (pt) = 0.35277777.. mm + Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points. + There are exactly 72 PostScript points in 1 inch. + + * 1 twip = twentieth of a (PostScript) point + A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing. + + * 1 didot point (dpt) = 0.376065 mm + Didot point after the French typographer Firmin Didot (1764-1836). + + More details under + http://www.unc.edu/~rowlett/units/dictP.html: + "A unit of length used by typographers and printers. When printing was done + from hand-set metal type, one point represented the smallest element of type + that could be handled, roughly 1/64 inch. Eventually, the point was standardized + in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is + about 0.35 mm (351.46 micrometers). In continental Europe, typographers + traditionally used a slightly larger point of 0.014 83 inch (about + 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point + after the French typographer Firmin Didot (1764-1836). In the U.S., + Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch + or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point + of 0.351 459 8035 mm. The German standards agency DIN has proposed that + all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch). + + * 1 pica = 4.233333 mm + 1/6 inch or 12 points + + * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi) + Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter + + + --> + <!-- changing measure to mm --> + <xsl:template name="convert2mm"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="substring-before($value, 'mm')"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to cm --> + <xsl:template name="convert2cm"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="substring-before($value, 'cm')"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to inch (cp. section comment) --> + <xsl:template name="convert2in"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="substring-before($value, 'in')"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to dpt (cp. section comment) --> + <xsl:template name="convert2dpt"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="substring-before($value, 'dpt')"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pica (cp. section comment) --> + <xsl:template name="convert2pica"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="substring-before($value, 'pica')"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pt (cp. section comment) --> + <xsl:template name="convert2pt"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="substring-before($value, 'pt')"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="编号解析"> + <xsl:variable name="bianhao"> + <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号引用"/> + </xsl:variable> + <xsl:variable name="bianhaojibie"> + <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号级别"/> + </xsl:variable> + <xsl:variable name="isxiangmuorisimage"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号"> + <xsl:choose> + <xsl:when test="$bianhao=@字:标识符"> + <xsl:choose> + <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:项目符号">true</xsl:when> + <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:图片符号引用">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="$isxiangmuorisimage='true'"> + <xsl:call-template name="无序"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="有序"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="有序"> + <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/> + <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别"/> + <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/> + <xsl:element name="text:list"> + <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute> + <xsl:if test="字:段落属性/字:自动编号信息/@字:重新编号"> + <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="字:段落属性/字:自动编号信息/@字:重新编号='true'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:element name="text:list-item"> + <xsl:call-template name="ordered-levels"> + <xsl:with-param name="level" select="$currlistlvl -1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="ordered-levels"> + <xsl:param name="level"/> + <xsl:choose> + <xsl:when test="$level = '0'"> + <xsl:call-template name="commonParagraph"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="text:list"> + <xsl:element name="text:list-item"> + <xsl:call-template name="ordered-levels"> + <xsl:with-param name="level" select="$level -1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="无序"> + <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/> + <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别"/> + <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/> + <xsl:element name="text:list"> + <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute> + <xsl:element name="text:list-item"> + <xsl:call-template name="unordered-levels"> + <xsl:with-param name="level" select="$currlistlvl -1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="unordered-levels"> + <xsl:param name="level"/> + <xsl:choose> + <xsl:when test="$level = '0'"> + <xsl:call-template name="commonParagraph"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="text:list"> + <xsl:element name="text:list-item"> + <xsl:call-template name="unordered-levels"> + <xsl:with-param name="level" select="$level -1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pt (cp. section comment) --> + <xsl:template name="convert2twip"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="substring-before($value, 'twip')"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) --> + <xsl:template name="convert2px"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl new file mode 100644 index 000000000..95d0d6b9d --- /dev/null +++ b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl @@ -0,0 +1,9071 @@ +<?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:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/> + <xsl:template match="uof:UOF"> + <!--chengxz0804 OK--> + <!--office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0" office:class="spreadsheet"--> + <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0"> + <xsl:apply-templates select="uof:元数据"/> + <office:settings> + <xsl:call-template name="工作表属性"/> + </office:settings> + <xsl:apply-templates select="uof:式样集"/> + <!--xsl:apply-templates select="表:公用处理规则"/--> + <xsl:apply-templates select="uof:电子表格"/> + </office:document> + </xsl:template> + <!--Redoffice comment lil from chenjh SC0013 06.02.15--> + <!--增加内容--> + <xsl:variable name="uofUnit"> + <xsl:variable name="uu"> + <xsl:value-of select="/uof:UOF/uof:电子表格/表:公用处理规则/表:度量单位"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$uu='cm'">cm</xsl:when> + <xsl:when test="$uu='mm'">mm</xsl:when> + <xsl:when test="$uu='pt'">pt</xsl:when> + <xsl:when test="$uu='inch'">inch</xsl:when> + <xsl:otherwise>cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="other-to-cm-conversion-factor"> + <xsl:choose> + <xsl:when test="$uofUnit='cm'">1</xsl:when> + <xsl:when test="$uofUnit='mm'">0.1</xsl:when> + <xsl:when test="$uofUnit='pt'">0.03527</xsl:when> + <xsl:when test="$uofUnit='inch'">2.54</xsl:when> + <xsl:when test="$uofUnit='pica'">0.4233</xsl:when> + <xsl:otherwise>0.03527</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!--Redoffice comment liliang end 06.02.15--> + <xsl:template name="set-calculation"> + <xsl:element name="table:calculation-settings"> + <xsl:if test="表:公用处理规则/表:度量单位"> + <xsl:variable name="uofUnit"> + <xsl:variable name="uu"> + <xsl:value-of select="表:公用处理规则/表:度量单位"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$uu='cm'">cm</xsl:when> + <xsl:when test="$uu='mm'">mm</xsl:when> + <xsl:when test="$uu='pt'">pt</xsl:when> + <xsl:when test="$uu='inch'">inch</xsl:when> + <xsl:otherwise>cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="other-to-cm-conversion-factor"> + <xsl:choose> + <xsl:when test="$uofUnit='cm'">1</xsl:when> + <xsl:when test="$uofUnit='mm'">0.1</xsl:when> + <xsl:when test="$uofUnit='pt'">0.03527</xsl:when> + <xsl:when test="$uofUnit='inch'">2.54</xsl:when> + <xsl:when test="$uofUnit='pica'">0.4233</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + </xsl:if> + <xsl:if test="表:公用处理规则/表:精确度以显示值为准"> + <xsl:attribute name="table:precision-as-shown">true</xsl:attribute> + </xsl:if> + <xsl:if test="表:公用处理规则/表:日期系统-1904/@表:值='true'"> + <table:null-date table:date-value="1904-01-01"/> + </xsl:if> + <xsl:if test="表:公用处理规则/表:计算设置"> + <xsl:element name="table:iteration"> + <xsl:attribute name="table:status">enable</xsl:attribute> + <xsl:attribute name="table:steps"><xsl:value-of select="表:公用处理规则/表:计算设置/@表:迭代次数"/></xsl:attribute> + <xsl:attribute name="table:maximum-difference"><xsl:value-of select="表:公用处理规则/表:计算设置/@表:偏差值"/></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template match="uof:字体集"> + <xsl:if test="not(uof:字体声明[@uof:名称='StarSymbol'])"> + <style:font-face style:name="StarSymbol" fo:font-family="StarSymbol" style:font-charset="x-symbol"/> + </xsl:if> + <xsl:for-each select="uof:字体声明"> + <xsl:element name="style:font-face"> + <xsl:attribute name="style:name"><xsl:value-of select="@uof:名称"/></xsl:attribute> + <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:字体族"/></xsl:attribute> + <xsl:if test="@uof:字符集 = '02'"> + <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute> + </xsl:if> + <xsl:if test="@uof:字体族"> + <xsl:choose> + <xsl:when test="@uof:字体族 = 'Swiss'"> + <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Modern'"> + <xsl:attribute name="style:font-family-generic">modern</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族='Roman'"> + <xsl:attribute name="style:font-family-generic">roman</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Script'"> + <xsl:attribute name="style:font-family-generic">script</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Decorative'"> + <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='System'"> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:attribute name="style:font-pitch">12</xsl:attribute> + </xsl:element> + </xsl:for-each> + <xsl:apply-templates select="uof:字体声明"/> + </xsl:template> + <xsl:template match="uof:电子表格"> + <office:body> + <office:spreadsheet> + <xsl:call-template name="trackchange"/> + <xsl:call-template name="set-calculation"/> + <xsl:if test="表:公用处理规则/表:数据有效性集"> + <xsl:element name="table:content-validations"> + <xsl:call-template name="create-content-validations"> + <xsl:with-param name="validation-set" select="表:公用处理规则/表:数据有效性集/表:数据有效性"/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:apply-templates select="表:主体/表:工作表"/> + <!--MSexcel 中的names暂时没有对应的--> + <xsl:element name="table:database-ranges"> + <xsl:for-each select="表:主体/表:工作表"> + <xsl:if test="./表:筛选"> + <xsl:variable name="filter" select="./表:筛选"/> + <xsl:variable name="column-and-row" select="substring-before(substring-after($filter/表:范围/text(),'.'),':')"/> + <xsl:variable name="dd" select="number(substring($column-and-row,2,1))"/> + <xsl:variable name="zone-left-column-string"> + <xsl:choose> + <xsl:when test="contains($dd,'NaN') "> + <xsl:value-of select="substring($column-and-row,1,2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring($column-and-row,1,1)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="zone-left-column-num"> + <xsl:call-template name="translate-column-char-to-number"> + <xsl:with-param name="string" select="$zone-left-column-string"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="table:database-range"> + <xsl:attribute name="table:name"><xsl:value-of select="uof:电子表格/表:主体/表:工作表/@表:名称"/></xsl:attribute> + <xsl:attribute name="table:target-range-address"><xsl:call-template name="translate-expression2"><xsl:with-param name="expression2" select="translate($filter/表:范围/text(),'$','')"/></xsl:call-template></xsl:attribute> + <xsl:if test="$filter/@表:类型='auto'"> + <xsl:attribute name="table:display-filter-buttons">true</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="$filter/表:条件区域"> + <xsl:element name="table:filter"> + <xsl:attribute name="table:condition-source-range-address"><xsl:call-template name="translate-expression2"><xsl:with-param name="expression2" select="translate($filter/表:条件区域/text(),'$','')"/></xsl:call-template></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="table:filter"> + <xsl:element name="table:filter-and"> + <xsl:call-template name="auto-filter-condition"> + <xsl:with-param name="condition-set" select="$filter/表:条件"/> + <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + </xsl:for-each> + </xsl:element> + </office:spreadsheet> + </office:body> + </xsl:template> + <xsl:template name="trackchange"> + <xsl:for-each select="表:主体/表:工作表/表:工作表内容//字:修订开始"> + <xsl:variable name="num"> + <xsl:number level="any" from="表:主体/表:工作表/表:工作表内容//*" count="字:修订开始"/> + </xsl:variable> + <table:tracked-changes> + <table:cell-content-change> + <xsl:attribute name="table:id"><xsl:value-of select="concat('ct',$num)"/></xsl:attribute> + <table:cell-address> + <xsl:attribute name="table:column"><xsl:value-of select="substring-after(@字:标识符,'-')"/></xsl:attribute> + <xsl:attribute name="table:row"><xsl:value-of select="substring-before(@字:标识符,'-')"/></xsl:attribute> + <xsl:attribute name="table:table">0</xsl:attribute> + </table:cell-address> + <office:change-info> + <dc:creator> + <xsl:choose> + <xsl:when test="starts-with(@字:修订信息引用,'+')"/> + <xsl:otherwise> + <xsl:value-of select="substring-before(@字:修订信息引用,'+')"/> + </xsl:otherwise> + </xsl:choose> + </dc:creator> + <!--xsl:value-of select="/uof:UOF/uof:元数据/uof:作者"/--> + <!--xsl:value-of select="/uof:UOF/uof:元数据/uof:创建日期"/--> + <dc:date> + <xsl:value-of select="substring-before(substring-after(@字:修订信息引用,'+'),'%')"/> + </dc:date> + </office:change-info> + <table:previous> + <table:change-track-table-cell> + <text:p> + <xsl:value-of select="substring-after(@字:修订信息引用,'%')"/> + </text:p> + </table:change-track-table-cell> + </table:previous> + </table:cell-content-change> + </table:tracked-changes> + </xsl:for-each> + </xsl:template> + <xsl:template match="uof:式样集"> + <xsl:element name="office:font-face-decls"> + <style:font-face style:name="宋体" svg:font-family="宋体" style:font-family-generic="swiss"/> + <xsl:apply-templates select="uof:字体集"/> + </xsl:element> + <xsl:call-template name="单元格式样"/> + </xsl:template> + <xsl:key match="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/uof:锚点 | /uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/表:单元格/uof:锚点" name="rel_graphic_name" use="@uof:图形引用"/> + <xsl:template match="图:图形"> + <xsl:variable name="random-name"> + <xsl:value-of select="generate-id()"/> + </xsl:variable> + <xsl:variable name="draw-name"> + <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/> + </xsl:variable> + <xsl:call-template name="graphic-fill"> + <xsl:with-param name="draw-name" select="$draw-name"/> + <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:填充/图:渐变"/> + </xsl:call-template> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <xsl:element name="style:graphic-properties"> + <xsl:call-template name="process-graphics"> + <xsl:with-param name="draw-name" select="$draw-name"/> + </xsl:call-template> + </xsl:element> + <xsl:element name="style:paragraph-properties"> + <xsl:if test="图:文本内容/@图:文字排列方向"> + <xsl:choose> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'"> + <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <xsl:element name="style:graphic-properties"> + <xsl:if test="@图:其他对象"> + <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute> + <xsl:attribute name="draw:color-mode">standard</xsl:attribute> + <xsl:attribute name="draw:luminance">0%</xsl:attribute> + <xsl:attribute name="draw:contrast">0%</xsl:attribute> + <xsl:attribute name="draw:gamma">100%</xsl:attribute> + <xsl:attribute name="draw:red">0%</xsl:attribute> + <xsl:attribute name="draw:green">0%</xsl:attribute> + <xsl:attribute name="draw:blue">0%</xsl:attribute> + <xsl:attribute name="draw:image-opacity">100%</xsl:attribute> + <xsl:attribute name="style:mirror">none</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-graphics"/> + </xsl:element> + <xsl:element name="style:paragraph-properties"> + <xsl:if test="图:文本内容/@图:文字排列方向"> + <xsl:choose> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'"> + <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="process-graphics"> + <xsl:param name="draw-name"/> + <xsl:if test="not(key('rel_graphic_name',@图:标识符)/@uof:随动方式='movesize')"> + <xsl:attribute name="style:protect"><xsl:choose><xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:随动方式='move'">size</xsl:when><xsl:otherwise>position size</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="not(图:预定义图形/图:属性/图:填充)"> + <xsl:attribute name="draw:fill">none</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:attribute> + <xsl:if test="not(图:预定义图形/图:属性/图:填充/图:图片/@图:位置='tile')"> + <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:前景色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色"> + <xsl:attribute name="draw:fill">solid</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:attribute name="draw:fill">gradient</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:渐变/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="图:预定义图形/图:属性/图:线颜色"> + <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')"> + <xsl:variable name="type" select="图:预定义图形/图:属性/图:线型"/> + <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$type='none'">none</xsl:when><xsl:when test="$type='single'">solid</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$type='dash'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$type='dot-dash'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$type='dashed-heavy'">Fine_20_Dashed</xsl:when><xsl:when test="$type='dotted' ">Fine_20_Dotted</xsl:when><xsl:when test="$type='dash-long-heavy'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$type='dash-long'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-dot'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$type='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$type='thick'">Line_20_Style_20_9</xsl:when><xsl:when test="$type='dot-dot-dash'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$type='dash-dot-dot-heavy'">Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-heavy'">Dash_20_10</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:线粗细"> + <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头"> + <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头/图:大小"> + <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头"> + <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头/图:大小"> + <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:透明度"> + <xsl:attribute name="draw:opacity"><xsl:value-of select="concat(图:预定义图形/图:属性/图:透明度,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:if test="图:文本内容/@图:上边距"> + <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(图:文本内容/@图:上边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(图:文本内容/@图:下边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(图:文本内容/@图:左边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(图:文本内容/@图:右边距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容/@图:文字排列方向"> + <xsl:choose> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'"> + <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='hori-r2l'"> + <xsl:attribute name="draw:textarea-horizontal-align">right</xsl:attribute> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='hori-12r'"> + <xsl:attribute name="draw:textarea-horizontal-align">left</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="图:文本内容/@图:水平对齐"> + <xsl:attribute name="draw:textarea-horizontal-align"><xsl:value-of select="图:文本内容/@图:水平对齐"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容/@图:垂直对齐"> + <xsl:attribute name="draw:textarea-vertical-align"><xsl:value-of select="图:文本内容/@图:垂直对齐"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容/@图:自动换行"> + <xsl:attribute name="fo:wrap-option">no-wrap</xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:auto-grow-width"><xsl:choose><xsl:when test="图:文本内容/@图:大小适应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:auto-grow-height"><xsl:choose><xsl:when test="图:文本内容/@图:大小适应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="bina_graphic"> + <xsl:param name="refGraphic"/> + <xsl:element name="office:binary-data"> + <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]"> + <xsl:value-of select="uof:数据"/> + </xsl:for-each> + </xsl:element> + <text:p/> + </xsl:template> + <xsl:template name="graphic-fill"> + <xsl:param name="draw-name"/> + <xsl:param name="gradient-name"/> + <xsl:if test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:element name="draw:gradient"> + <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute> + <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:渐变方向 * 10"/></xsl:attribute> + <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute> + <xsl:if test="$gradient-name/@图:种子X位置"> + <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:种子X位置,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="$gradient-name/@图:种子Y位置"> + <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:种子Y位置,'%')"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头"> + <xsl:element name="draw:marker"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'"> + <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute> + <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'"> + <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute> + <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute> + <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头"> + <xsl:element name="draw:marker"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'"> + <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute> + <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'"> + <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute> + <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute> + <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"> + <xsl:element name="draw:fill-image"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:call-template name="bina_graphic"> + <xsl:with-param name="refGraphic"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/> + </xsl:when> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型"> + <draw:stroke-dash draw:name="Ultrafine_20_Dashed" draw:display-name="Ultrafine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.051cm" draw:dots2="1" draw:dots2-length="0.051cm" draw:distance="0.051cm"/> + <draw:stroke-dash draw:name="Fine_20_Dashed" draw:display-name="Fine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.508cm" draw:dots2="1" draw:dots2-length="0.508cm" draw:distance="0.508cm"/> + <draw:stroke-dash draw:name="Ultrafine_20_2_20_Dots_20_3_20_Dashes" draw:display-name="Ultrafine 2 Dots 3 Dashes" draw:style="rect" draw:dots1="2" draw:dots1-length="0.051cm" draw:dots2="3" draw:dots2-length="0.254cm" draw:distance="0.127cm"/> + <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/> + <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/> + <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/> + <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/> + <draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/> + <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/> + <draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/> + <draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/> + <draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/> + <draw:stroke-dash draw:name="Dash_20_10" draw:display-name="Dash 10" draw:style="rect" draw:dots1="1" draw:dots1-length="0.02cm" draw:dots2="1" draw:dots2-length="0.02cm" draw:distance="0.02cm"/> + </xsl:if> + </xsl:template> + <xsl:template name="单元格式样"> + <xsl:variable name="uofSheet" select="/uof:UOF/uof:电子表格"/> + <xsl:variable name="uofSheet1" select="/uof:UOF/uof:电子表格/表:主体/表:工作表"/> + <xsl:variable name="uofSheetCom" select="$uofSheet/表:公用处理规则"/> + <xsl:variable name="first-style" select="/uof:UOF/uof:式样集/uof:单元格式样"/> + <xsl:variable name="quyu" select="/uof:UOF/uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化/表:区域"/> + <xsl:variable name="condition-format-set" select="/uof:UOF/uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化"/> + <xsl:variable name="aa"> + <xsl:for-each select="$first-style"> + <xsl:if test="@表:标识符!=@表:名称 and @表:名称!='Normal'"> + <xsl:value-of select="@表:名称"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="bb"> + <xsl:for-each select="$first-style"> + <xsl:if test="@表:标识符!=@表:名称 and @表:名称!='Normal'"> + <xsl:value-of select="@表:标识符"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <office:styles> + <!-- if ConditionalFormatting exists,it should generate some styles for style:style --> + <!--xsl:if test="$uofSheetCom/表:条件格式化集"> + <xsl:call-template name="CondFormat_office_style"/> + </xsl:if--> + <!--ro000179 chenjh--> + <xsl:for-each select="$first-style[@表:类型='custom' or @表:类型='default']"> + <xsl:call-template name="单元格具体式样"/> + <xsl:apply-templates select="表:数字格式[@表:格式码]"/> + <xsl:apply-templates select="表:字体格式[字:上下标]"/> + </xsl:for-each> + </office:styles> + <office:automatic-styles> + <xsl:for-each select="$first-style[@表:类型='auto']"> + <xsl:variable name="apply-style-name" select="@表:名称"/> + <xsl:variable name="style-name" select="@表:标识符"/> + <xsl:choose> + <xsl:when test="$style-name!=$apply-style-name and $apply-style-name!='Normal'"> + <xsl:for-each select="$condition-format-set/表:条件"> + <style:style> + <xsl:attribute name="style:name"><xsl:value-of select="//uof:单元格式样[@表:名称=current()/表:格式/@表:式样引用 and @表:类型='auto']/@表:标识符"/></xsl:attribute> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:attribute name="style:parent-style-name">Default</xsl:attribute> + <xsl:for-each select="parent::表:条件格式化/表:条件"> + <xsl:variable name="condition-text"> + <xsl:choose> + <xsl:when test="@表:类型='cell value'"> + <xsl:choose> + <xsl:when test="表:操作码/text()='between' "> + <xsl:value-of select="concat('cell-content-is-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test=" 表:操作码/text()='not between'"> + <xsl:value-of select="concat('cell-content-is-not-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="表:操作码/text()='equal to'"> + <xsl:value-of select="concat('cell-content()=',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='not equal to'"> + <xsl:value-of select="concat('cell-content()!=',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='greater than'"> + <xsl:value-of select="concat('cell-content()>',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='less than'"> + <xsl:value-of select="concat('cell-content()<',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='greater than or equal to'"> + <xsl:value-of select="concat('cell-content()>=',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='less than or equal to'"> + <xsl:value-of select="concat('cell-content()<=',表:第一操作数/text())"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="@表:类型='formula'"> + <xsl:value-of select="concat('is-true-formula','(',表:第一操作数/text(),')')"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:element name="style:map"> + <xsl:variable name="address"> + <xsl:value-of select="preceding-sibling::表:区域"/> + </xsl:variable> + <xsl:attribute name="style:condition"><xsl:value-of select="$condition-text"/></xsl:attribute> + <xsl:attribute name="style:apply-style-name"><xsl:value-of select="表:格式/@表:式样引用"/></xsl:attribute> + <xsl:attribute name="style:base-cell-address"><xsl:value-of select="substring-after($address,':')"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </style:style> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="uof:单元格式样 "> + <xsl:if test="@表:类型='auto' and (@表:标识符=@表:名称 or @表:名称='Normal')"> + <xsl:call-template name="单元格具体式样"/> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <!--Redoffie comment liliang SC0008 06.02.14--> + <!--1新增内容--> + <xsl:if test="uof:单元格式样"> + <xsl:for-each select="uof:单元格式样"> + <xsl:if test="@表:类型='auto' and (@表:标识符=@表:名称 or @表:名称='Normal')"> + <xsl:call-template name="单元格具体式样"/> + </xsl:if> + </xsl:for-each> + </xsl:if> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='png' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='ipg' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='gif'"> + <style:style style:name="Graphics" style:family="graphics"> + <style:properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/> + </style:style> + </xsl:if> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形"/> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形/图:文本内容/字:段落/字:句/字:句属性" mode="style"/> + <!--Redoffice comment end 06.02.14--> + <xsl:apply-templates select="$uofSheet1/表:工作表内容"/> + <xsl:if test="uof:单元格式样"> + <xsl:for-each select="uof:单元格式样[@表:类型='auto' and (@表:标识符=@表:名称 or @表:名称='Normal')]"> + <xsl:call-template name="单元格具体式样"/> + <xsl:apply-templates select="表:数字格式[@表:格式码]"/> + <xsl:apply-templates select="表:字体格式[字:上下标]"/> + </xsl:for-each> + </xsl:if> + <!-- if ConditionalFormatting exists,transforing the styles --> + <!--xsl:if test="$uofSheetCom/表:条件格式化集"> + <xsl:call-template name="CondFormat_automatic_style"/> + </xsl:if--> + <xsl:if test="$uofSheetCom/表:条件格式化集/表:条件格式化"> + <xsl:variable name="style-name" select="$first-style/@表:标识符"/> + <xsl:variable name="left-top"> + <xsl:call-template name="search-left-top-in-tables"> + <xsl:with-param name="cellstylename" select="$style-name"/> + <xsl:with-param name="tableslist" select="$uofSheet1/表:工作表内容"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="after-translated-left-top"> + <xsl:call-template name="translate-left-top"> + <xsl:with-param name="left-top" select="$left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$after-translated-left-top!=''"> + <xsl:call-template name="create-the-condition-format-map"> + <xsl:with-param name="condition-format-set" select="$uofSheetCom/表:条件格式化集//表:条件格式化"/> + <xsl:with-param name="current-left-top" select="$after-translated-left-top"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + <xsl:apply-templates select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列/表:单元格/*[descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40']]"/> + <!--xsl:apply-templates select="$uofSheet1/表:工作表属性/表:页面设置/表:页眉页脚/字:段落" /--> + <xsl:call-template name="create-page-master"> + <xsl:with-param name="worksheetoptions" select="$uofSheet1/表:工作表属性"/> + </xsl:call-template> + <xsl:for-each select="uof:句式样"> + <style:style> + <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + <xsl:attribute name="style:family">text</xsl:attribute> + <style:text-properties> + <xsl:apply-templates select="./*"/> + </style:text-properties> + </style:style> + </xsl:for-each> + </office:automatic-styles> + <office:master-styles> + <xsl:call-template name="create-master-styles"> + <xsl:with-param name="worksheetoptions" select="$uofSheet1/表:工作表属性"/> + </xsl:call-template> + </office:master-styles> + </xsl:template> + <xsl:template match="表:数据有效性"> + <xsl:variable name="range-name-temp"> + <xsl:value-of select="substring-before(表:区域,'!')"/> + </xsl:variable> + <xsl:variable name="range-name"> + <xsl:value-of select="substring($range-name-temp,2,string-length($range-name-temp)-2)"/> + </xsl:variable> + <xsl:variable name="first-range"> + <xsl:choose> + <xsl:when test="contains(表:区域, ',')"> + <xsl:value-of select="translate(substring-after(substring-before(表:区域, ','),'!'),'$','')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate(substring-after(表:区域,'!'),'$','')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="value-first"> + <xsl:value-of select="translate(表:第一操作数,'=','')"/> + </xsl:variable> + <xsl:variable name="value-second"> + <xsl:value-of select="translate(表:第二操作数,'=','')"/> + </xsl:variable> + <xsl:element name="table:content-validation"> + <xsl:attribute name="table:name"><xsl:value-of select="concat('val', position())"/></xsl:attribute> + <!--数据有效性:第一操作数、第二操作数--> + <!-- don't support two type of qualifier: List, Custom --> + <xsl:attribute name="table:condition"><xsl:variable name="qualifier-content"><xsl:choose><xsl:when test="表:操作码 = 'between'"><xsl:choose><xsl:when test="(number($value-second))"><xsl:value-of select="concat('cell-content-is-between([',$range-name,'.',$value-first,'],',$value-second)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('cell-content-is-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,']')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:操作码 = 'not between'"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('cell-content-is-not-between([',$range-name,'.',$value-first,'],',$value-second)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('cell-content-is-not-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,']')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:操作码 = 'not equal to'"><xsl:value-of select="concat('!=', $value-first)"/></xsl:when><xsl:when test="表:操作码 = 'equal to'"><xsl:variable name="range1"><xsl:value-of select="substring-after(substring-before($value-first,':'),'(')"/></xsl:variable><xsl:variable name="range2"><xsl:value-of select="substring-before(substring-after($value-first,':'),')')"/></xsl:variable><xsl:value-of select="concat('=SUM([',$range-name,'.',$range1,':',$range-name,'.',$range2,']')"/></xsl:when><xsl:when test="表:操作码 = 'less than'"><xsl:value-of select="concat('<', $value-first)"/></xsl:when><xsl:when test="表:操作码 = 'greater than'"><xsl:value-of select="concat('>', $value-first)"/></xsl:when><xsl:when test="表:操作码 = 'greater than or equal to'"><xsl:value-of select="concat('>=[',$range-name, '.',$value-first,']')"/></xsl:when><xsl:when test="表:操作码 = 'less than or equal to'"><xsl:value-of select="concat('<=[',$range-name,'.', $value-first,']')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('([',$range-name,'.',substring-before($value-first,':'),':',$range-name,'.',substring-after($value-first,':'),'])')"/></xsl:otherwise></xsl:choose></xsl:variable><!--操作码、校验类型--><xsl:variable name="qualifier-value"><xsl:choose><xsl:when test="表:校验类型 = 'whole number'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-whole-number() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-whole-number() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'decimal'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'list'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-in-list() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-in-list',$qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'date'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-date() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-date() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'time'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-time() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-time() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'text length'"><xsl:choose><xsl:when test="表:操作码 = 'not between'"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between([', $range-name,'.',$value-first, '],', $value-second, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between([',$range-name,'.', $value-first, '],[',$range-name,'.', $value-second, '])')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="$value-second and $value-first"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('oooc:cell-content-text-length-is-between([',$range-name,'.',$value-first,'],',$value-second,')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length-is-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,'])')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'custom'"><xsl:choose><xsl:when test="表:操作码 = 'between'"><xsl:value-of select="concat('and cell-content-is-between(',substring-before($value-first,'('),'([',$range-name,'.',substring-after(substring-before($value-first,':'),'('),':',$range-name,'.',substring-before(substring-after($value-first,':'),')'),']),0')"/></xsl:when><xsl:when test="表:操作码 = 'not between'"><xsl:value-of select="concat('oooc:and cell-content-is-not-between(',substring-before($value-first,'('),'([',$range-name,'.',substring-after(substring-before($value-first,':'),'('),':',$range-name,'.',substring-before(substring-after($value-first,':'),')'),']),0')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-custom() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="表:校验类型"/></xsl:otherwise></xsl:choose></xsl:variable><xsl:value-of select="$qualifier-value"/></xsl:attribute> + <!--忽略空格--> + <xsl:attribute name="table:allow-empty-cell"><xsl:choose><xsl:when test="表:忽略空格"><xsl:value-of select="'false'"/></xsl:when><xsl:otherwise><xsl:value-of select="'true'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="table:base-cell-address"><xsl:variable name="range"><xsl:value-of select="$first-range"/><!--xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0" /> + <xsl:with-param name="cell-column-pos" select="0" /> + <xsl:with-param name="expression" select="$first-range" /> + <xsl:with-param name="return-value" select="''" /> + </xsl:call-template--></xsl:variable><xsl:call-template name="encode-as-cell-address"><xsl:with-param name="string" select="concat($range-name, '.', $range)"/></xsl:call-template></xsl:attribute> + <!--输入提示--> + <xsl:element name="table:help-message"> + <xsl:attribute name="table:title"><xsl:value-of select="表:输入提示/@表:标题"/></xsl:attribute> + <xsl:attribute name="table:display"><xsl:choose><xsl:when test="表:输入提示/@表:显示"><xsl:value-of select="表:输入提示/@表:显示"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:element name="text:p"> + <xsl:value-of select="表:输入提示/@表:内容"/> + </xsl:element> + </xsl:element> + <!--错误提示--> + <xsl:element name="table:error-message"> + <xsl:attribute name="table:message-type"><xsl:choose><xsl:when test="表:错误提示/@表:类型= 'information'"><xsl:value-of select="'information'"/></xsl:when><xsl:when test="表:错误提示/@表:类型= 'warning'"><xsl:value-of select="'warning'"/></xsl:when><xsl:otherwise><xsl:value-of select="'stop'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="table:title"><xsl:value-of select="表:错误提示/@表:标题"/></xsl:attribute> + <xsl:attribute name="table:display"><xsl:choose><xsl:when test="表:错误提示/@表:显示"><xsl:value-of select="表:错误提示/@表:显示"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:element name="text:p"> + <xsl:value-of select="表:错误提示/@表:内容"/> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="CondFormat_office_style"> + <xsl:for-each select="../../uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化"> + <xsl:variable name="table-pos" select="count(../../../preceding-sibling::表:公用处理规则)+1"/> + <xsl:variable name="conditions" select="count(../preceding-sibling::表:条件格式化集)+1"/> + <xsl:for-each select="表:条件"> + <xsl:variable name="condition-number" select="count(preceding-sibling::表:条件)+1"/> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:element name="style:properties"> + <xsl:choose> + <xsl:when test="表:格式/@表:式样引用"> + <xsl:variable name="stylevalue" select="表:格式/@表:式样引用"/> + <xsl:call-template name="recursion-condformat-style-table-cell"> + <xsl:with-param name="style-value-t"> + <xsl:choose> + <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'"> + <xsl:value-of select="concat($stylevalue,';')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$stylevalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:element> + <!--xsl:element name="style:text-properties"--> + <!--chengxz0618--> + <xsl:element name="style:properties"> + <xsl:choose> + <xsl:when test="表:格式/@表:式样引用"> + <xsl:variable name="stylevalue" select="表:格式/@表:式样引用"/> + <xsl:call-template name="recursion-condformat-style-text"> + <xsl:with-param name="style-value-t"> + <xsl:choose> + <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'"> + <xsl:value-of select="concat($stylevalue,';')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$stylevalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:font-style"><xsl:value-of select="'italic'"/></xsl:attribute> + <xsl:attribute name="style:text-underline-type"><xsl:value-of select="'single'"/></xsl:attribute> + <xsl:attribute name="style:text-underline-color"><xsl:value-of select="'font-color'"/></xsl:attribute> + <xsl:attribute name="fo:font-weight"><xsl:value-of select="'bold'"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + <xsl:template name="cell-pattern-color"> + <xsl:param name="pattern"/> + <xsl:param name="color-value"/> + <xsl:param name="pattern-color-value"/> + <xsl:variable name="rev-pattern" select="1 - $pattern"/> + <xsl:variable name="color-R-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($color-value,2,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="color-G-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($color-value,4,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="color-B-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($color-value,6,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pattern-R-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($pattern-color-value,2,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pattern-G-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($pattern-color-value,4,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pattern-B-value"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="substring($pattern-color-value,6,2)"/> + <xsl:with-param name="index" select="1"/> + <xsl:with-param name="str-length" select="2"/> + <xsl:with-param name="last-value" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="R-value"> + <xsl:variable name="combined-R-value"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="floor($color-R-value * $rev-pattern + $pattern-R-value * $pattern)"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($combined-R-value) = 1"> + <xsl:value-of select="concat('0',$combined-R-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$combined-R-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="G-value"> + <xsl:variable name="combined-G-value"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="floor($color-G-value * $rev-pattern + $pattern-G-value * $pattern)"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($combined-G-value) = 1"> + <xsl:value-of select="concat('0',$combined-G-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$combined-G-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="B-value"> + <xsl:variable name="combined-B-value"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="floor($color-B-value * $rev-pattern + $pattern-B-value * $pattern)"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($combined-B-value) = 1"> + <xsl:value-of select="concat('0',$combined-B-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$combined-B-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('#',$R-value,$G-value,$B-value)"/> + </xsl:template> + <xsl:template name="hex2decimal"> + <xsl:param name="hex-number"/> + <xsl:param name="index"/> + <xsl:param name="str-length"/> + <xsl:param name="last-value"/> + <xsl:variable name="dec-char"> + <xsl:call-template name="hexNumber2dec"> + <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/> + <xsl:if test="$index < $str-length"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$hex-number"/> + <xsl:with-param name="index" select="$index + 1"/> + <xsl:with-param name="str-length" select="$str-length"/> + <xsl:with-param name="last-value" select="$current-value"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$index = $str-length"> + <xsl:value-of select="$current-value"/> + </xsl:if> + </xsl:template> + <xsl:template name="hexNumber2dec"> + <xsl:param name="hex-value"/> + <xsl:choose> + <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')"> + <xsl:value-of select="10"/> + </xsl:when> + <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')"> + <xsl:value-of select="11"/> + </xsl:when> + <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')"> + <xsl:value-of select="12"/> + </xsl:when> + <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')"> + <xsl:value-of select="13"/> + </xsl:when> + <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')"> + <xsl:value-of select="14"/> + </xsl:when> + <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')"> + <xsl:value-of select="15"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$hex-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="decimal2hex"> + <xsl:param name="dec-number"/> + <xsl:param name="last-value"/> + <xsl:variable name="current-value"> + <xsl:call-template name="decNumber2hex"> + <xsl:with-param name="dec-value"> + <xsl:if test="$dec-number > 15"> + <xsl:value-of select="floor($dec-number div 16)"/> + </xsl:if> + <xsl:if test="$dec-number < 16"> + <xsl:value-of select="$dec-number"/> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$dec-number > 15"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="$dec-number mod 16"/> + <xsl:with-param name="last-value" select="concat($last-value,$current-value)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$dec-number < 16"> + <xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/> + </xsl:if> + </xsl:template> + <xsl:template name="decNumber2hex"> + <xsl:param name="dec-value"/> + <xsl:choose> + <xsl:when test="$dec-value = 10"> + <xsl:value-of select="'A'"/> + </xsl:when> + <xsl:when test="$dec-value = 11"> + <xsl:value-of select="'B'"/> + </xsl:when> + <xsl:when test="$dec-value = 12"> + <xsl:value-of select="'C'"/> + </xsl:when> + <xsl:when test="$dec-value = 13"> + <xsl:value-of select="'D'"/> + </xsl:when> + <xsl:when test="$dec-value = 14"> + <xsl:value-of select="'E'"/> + </xsl:when> + <xsl:when test="$dec-value = 15"> + <xsl:value-of select="'F'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$dec-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="recursion-condformat-style-table-cell"> + <xsl:param name="style-value-t"/> + <xsl:variable name="style-value" select="$style-value-t"/> + <xsl:choose> + <xsl:when test="starts-with($style-value,'background')"> + <xsl:choose> + <xsl:when test="contains($style-value,'mso-pattern')"> + <xsl:variable name="color-value"> + <xsl:call-template name="translate-color-style"> + <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="mso-value"> + <xsl:call-template name="translate-color-style"> + <xsl:with-param name="source-str" select="normalize-space(substring-after($style-value,'mso-pattern'))"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="mso-color" select="substring-after($mso-value,'#')"/> + <xsl:variable name="pattern-color-value" select="substring($mso-color,1,6)"/> + <xsl:variable name="pattern" select="concat('0.',normalize-space(substring-before(substring-after($mso-color,'gray-'),';')))"/> + <xsl:variable name="pattern-color"> + <xsl:call-template name="cell-pattern-color"> + <xsl:with-param name="pattern" select="$pattern"/> + <xsl:with-param name="color-value" select="$color-value"/> + <xsl:with-param name="pattern-color-value" select="concat('#',$pattern-color-value)"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:background-color"><xsl:value-of select="normalize-space($pattern-color)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:background-color"><xsl:call-template name="translate-color-style"><xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:call-template></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($style-value,'border')"> + <xsl:attribute name="fo:border"><xsl:value-of select="'0.002cm solid #000000'"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="contains($style-value,':')"> + <xsl:call-template name="recursion-condformat-style-table-cell"> + <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="recursion-condformat-style-text"> + <xsl:param name="style-value-t"/> + <xsl:variable name="style-value" select="normalize-space($style-value-t)"/> + <xsl:choose> + <xsl:when test="starts-with($style-value,'color')"> + <xsl:attribute name="fo:color"><xsl:call-template name="translate-color-style"><xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:call-template></xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-value,'font-style')"> + <xsl:attribute name="fo:font-style"><xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-value,'font-weight')"> + <xsl:variable name="font-weight" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/> + <xsl:attribute name="fo:font-weight"><xsl:choose><xsl:when test="($font-weight > 300) and ($font-weight < 500)"><xsl:value-of select="'normal'"/></xsl:when><xsl:when test="($font-weight > 500) or ($font-weight = 500)"><xsl:value-of select="'bold'"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-value,'text-underline-style')"> + <xsl:attribute name="style:text-underline-type"><xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:attribute> + <xsl:attribute name="style:text-underline-color"><xsl:value-of select="'#000000'"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="contains($style-value,':')"> + <xsl:call-template name="recursion-condformat-style-text"> + <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="translate-color-style"> + <xsl:param name="source-str"/> + <xsl:choose> + <xsl:when test="starts-with($source-str,'#')"> + <xsl:value-of select="$source-str"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="starts-with($source-str,'black')"> + <xsl:value-of select="'#000000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'maroon')"> + <xsl:value-of select="'#800000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'red')"> + <xsl:value-of select="'#FF0000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'fuchsia')"> + <xsl:value-of select="'#FF00FF'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'olive')"> + <xsl:value-of select="'#808000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'yellow')"> + <xsl:value-of select="'#FFFF00'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'green')"> + <xsl:value-of select="'#008000'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'lime')"> + <xsl:value-of select="'#00FF00'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'teal')"> + <xsl:value-of select="'#008080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'aqua')"> + <xsl:value-of select="'#00FFFF'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'navy')"> + <xsl:value-of select="'#000080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'blue')"> + <xsl:value-of select="'#0000FF'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'purple')"> + <xsl:value-of select="'#800080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'gray')"> + <xsl:value-of select="'#808080'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'silver')"> + <xsl:value-of select="'#C0C0C0'"/> + </xsl:when> + <xsl:when test="starts-with($source-str,'white')"> + <xsl:value-of select="'#FFFFFF'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'#FFFFFF'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="CondFormat_automatic_style"> + <xsl:for-each select="../uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化"> + <xsl:variable name="table-pos" select="count(../../../preceding-sibling::表:公用处理规则)+1"/> + <xsl:variable name="conditions" select="count(../preceding-sibling::表:条件格式化集)+1"/> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('ce',$table-pos,'-',$conditions)"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:for-each select="uof:单元格式样/表:条件"> + <xsl:variable name="condition-number" select="count(preceding-sibling::表:条件)+1"/> + <xsl:variable name="base-address"> + <xsl:choose> + <xsl:when test="contains(../表:区域,',')"> + <xsl:choose> + <xsl:when test="contains(substring-before(../表:区域,','),':')"> + <xsl:value-of select="substring-before(substring-after(../表:区域,':'),',')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(../表:区域,',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="../表:区域"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="base-cell-address"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="substring-before(substring-after($base-address,'R'),'C')"/> + <xsl:with-param name="row-number" select="substring-after($base-address,'C')"/> + <xsl:with-param name="column-pos-style" select="absolute"/> + <xsl:with-param name="row-pos-style" select="absolute"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="condition-value"> + <xsl:call-template name="translate-condition"> + </xsl:call-template> + </xsl:variable> + <xsl:element name="style:map"> + <xsl:attribute name="style:condition"><xsl:value-of select="$condition-value"/></xsl:attribute> + <xsl:attribute name="style:apply-style-name"><xsl:value-of select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/></xsl:attribute> + <xsl:attribute name="style:base-cell-address"><xsl:value-of select="concat(../../@Name,'.',$base-cell-address)"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template name="translate-condition"> + <xsl:variable name="address-value"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="表:第一操作数"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="表:操作码"> + <xsl:variable name="qualifier" select="表:操作码"/> + <xsl:variable name="first-value" select="表:第一操作数"/> + <xsl:choose> + <xsl:when test="$qualifier = 'Equal'"> + <xsl:choose> + <xsl:when test="starts-with($first-value,'"')"> + <xsl:value-of select="concat('cell-content()=',$address-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('cell-content()=[',$address-value,']')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$qualifier = 'Less'"> + <xsl:value-of select="concat('cell-content()<[',$address-value,']')"/> + </xsl:when> + <xsl:when test="$qualifier = 'Greater'"> + <xsl:value-of select="concat('cell-content()>[',$address-value,']')"/> + </xsl:when> + <xsl:when test="$qualifier = 'LessOrEqual'"> + <xsl:value-of select="concat('cell-content()<=[',$address-value,']')"/> + </xsl:when> + <xsl:when test="$qualifier = 'GreaterOrEqual'"> + <xsl:value-of select="concat('cell-content()>=[',$address-value,']')"/> + </xsl:when> + <xsl:when test="$qualifier = 'NotEqual'"> + <xsl:value-of select="concat('cell-content()!=[',$address-value,']')"/> + </xsl:when> + <xsl:when test="$qualifier = 'Between'"> + <xsl:variable name="second-value"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="表:第二操作数"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat('cell-content-is-between([',$address-value,'],[',$second-value,'])')"/> + </xsl:when> + <xsl:when test="$qualifier = 'NotBetween'"> + <xsl:variable name="second-value"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="0"/> + <xsl:with-param name="cell-column-pos" select="0"/> + <xsl:with-param name="expression" select="表:第二操作数"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat('cell-content-is-not-between([',$address-value,'],[',$second-value,'])')"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('is-true-formula(',$address-value,')')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-expression"> + <xsl:param name="cell-row-pos"/> + <xsl:param name="cell-column-pos"/> + <xsl:param name="expression"/> + <xsl:param name="return-value"/> + <xsl:variable name="temp-range"> + <xsl:choose> + <xsl:when test="$expression != ''"> + <xsl:call-template name="parse-range-name"> + <xsl:with-param name="expression" select="$expression"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="range-type"> + <xsl:choose> + <xsl:when test="substring($temp-range, 1, 1) = '1'"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:when test="substring($temp-range, 1, 1) = '2'"> + <xsl:value-of select="2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current-range"> + <xsl:value-of select="substring($temp-range, 2)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$range-type = 1"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression"> + <xsl:choose> + <xsl:when test="contains($current-range, '#$')"> + <xsl:variable name="temp-token"> + <xsl:choose> + <xsl:when test="contains($current-range, '\')"> + <xsl:value-of select="concat(']', substring-after($current-range, '#$'), "'")"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($current-range, '#$')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="substring-after($expression, $temp-token)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($expression, $current-range)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="return-value"> + <xsl:choose> + <xsl:when test="$current-range = '='"> + <xsl:text>oooc:=</xsl:text> + </xsl:when> + <xsl:when test="substring($current-range, string-length($current-range)) = '('"> + <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range, '[.')"/> + </xsl:when> + <xsl:when test="$current-range = ','"> + <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), '];[.')"/> + </xsl:when> + <xsl:when test="$current-range = ')'"> + <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), '])')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="handle-type"> + <xsl:choose> + <xsl:when test="starts-with($current-range, 'R')"> + <xsl:choose> + <xsl:when test="contains($current-range, 'C')"> + <xsl:variable name="part-type-r"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-before( substring-after($current-range, 'R'), 'C')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="part-type-c"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="($part-type-r = 1) and ($part-type-c = 1)"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="part-type"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-after($current-range, 'R')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$part-type = 1"> + <xsl:value-of select="2"/> + </xsl:when> + <xsl:when test="$part-type = 2"> + <xsl:value-of select="4"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($current-range, 'C')"> + <xsl:variable name="part-type"> + <xsl:call-template name="handle-type-number"> + <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$part-type = 1"> + <xsl:value-of select="3"/> + </xsl:when> + <xsl:when test="$part-type = 2"> + <xsl:value-of select="4"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="4"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$handle-type = 1"> + <xsl:variable name="after-R"> + <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$after-R='C' or $after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'"> + <xsl:variable name="row-pos"> + <xsl:choose> + <xsl:when test="$after-R='['"> + <xsl:value-of select="$cell-row-pos+substring-before( substring-after($current-range,'R['),']')"/> + </xsl:when> + <xsl:when test="$after-R='C'"> + <xsl:value-of select="$cell-row-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(substring-after($current-range,'R'),'C')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="row-pos-style"> + <xsl:choose> + <xsl:when test="$after-R='[' or $after-R='C'">relative</xsl:when> + <xsl:otherwise>absolute</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="after-C"> + <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,1)"/> + </xsl:variable> + <xsl:variable name="column-digit-length"> + <xsl:choose> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:call-template name="get-digit-length"> + <xsl:with-param name="complexive-string" select="substring-after(substring-after($current-range,'R'),'C')"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="column-pos"> + <xsl:choose> + <xsl:when test="$after-C='['"> + <xsl:value-of select="$cell-column-pos + substring-before(substring-after(substring-after($current-range,'R'),'C['),']')"/> + </xsl:when> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,$column-digit-length)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$cell-column-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="column-pos-style"> + <xsl:choose> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">absolute</xsl:when> + <xsl:otherwise>relative</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="trans-unit"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="$column-pos"/> + <xsl:with-param name="row-number" select="$row-pos"/> + <xsl:with-param name="column-pos-style" select="$column-pos-style"/> + <xsl:with-param name="row-pos-style" select="$row-pos-style"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit)"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before(substring-after($expression, '('),'R'),',!', ';.'))"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($current-range,'R')"/> + <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$handle-type = 2"> + <xsl:variable name="after-R"> + <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'"> + <xsl:variable name="row-number"> + <xsl:choose> + <xsl:when test="$after-R = '['"> + <xsl:value-of select="substring-before(substring-after($current-range, 'R['), ']')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($current-range, 'R')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="row-pos"> + <xsl:choose> + <xsl:when test="$after-R='['"> + <xsl:value-of select="$cell-row-pos + $row-number"/> + </xsl:when> + <xsl:when test="$after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'"> + <xsl:value-of select="$row-number"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$cell-row-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="trans-unit1"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="1"/> + <xsl:with-param name="row-number" select="$row-pos"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="trans-unit2"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="256"/> + <xsl:with-param name="row-number" select="$row-pos"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'R'),',!', ';.'),'R')"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($current-range,'R')"/> + <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$handle-type = 3"> + <xsl:variable name="after-C"> + <xsl:value-of select="substring(substring-after($current-range,'C'),1,1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$after-C='[' or $after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:variable name="column-number"> + <xsl:choose> + <xsl:when test="$after-C = '['"> + <xsl:value-of select="substring-before(substring-after($current-range, 'C['), ']')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($current-range, 'C')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="column-pos"> + <xsl:choose> + <xsl:when test="$after-C='['"> + <xsl:value-of select="$cell-column-pos + $column-number"/> + </xsl:when> + <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'"> + <xsl:value-of select="$column-number"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$cell-column-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="trans-unit1"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="$column-pos"/> + <xsl:with-param name="row-number" select="1"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="trans-unit2"> + <xsl:call-template name="translate-unit"> + <xsl:with-param name="column-number" select="$column-pos"/> + <xsl:with-param name="row-number" select="32000"/> + <xsl:with-param name="column-pos-style" select="'relative'"/> + <xsl:with-param name="row-pos-style" select="'relative'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'C'),',!', ';.'),'C')"/> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($current-range,'C')"/> + <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="next-pit" select="substring-after($expression, $current-range)"/> + <xsl:choose> + <xsl:when test="contains($next-pit, '+') or contains($next-pit, '-') or contains($next-pit, '*') or contains($next-pit, '/') or contains($next-pit, ')') or contains($next-pit, '^') or contains($next-pit, ':') or contains($next-pit, '"') or contains($next-pit, ';') or contains($next-pit, ',') or contains($next-pit, '[')"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/> + <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/> + <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/> + <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, $current-range), $current-range)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate( concat($return-value, substring-before($expression, $current-range), $current-range),',!', ';.')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="parse-range-name"> + <xsl:param name="expression"/> + <xsl:param name="return-value"/> + <xsl:variable name="first-one" select="substring($expression,1,1)"/> + <xsl:choose> + <xsl:when test="$first-one = '='"> + <xsl:choose> + <xsl:when test="string-length(normalize-space($return-value)) > 0"> + <xsl:value-of select="concat('2', $return-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>1=</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-one='(' or $first-one='!' or $first-one='&'"> + <xsl:value-of select="concat('1', $return-value, $first-one)"/> + </xsl:when> + <xsl:when test="$first-one='['"> + <xsl:choose> + <xsl:when test="starts-with(substring-after($expression, ']'), 'C')"> + <xsl:call-template name="parse-range-name"> + <xsl:with-param name="expression" select="substring-after($expression, ']')"/> + <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, ']'), ']')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains(substring-before($expression, ']'), '.') and contains(substring-after($expression, ']'), '!')"> + <xsl:value-of select="concat('1', "'", substring-before(substring-after($expression, '['), ']'), "'", '#$', substring-before(substring-after($expression, ']'), '!'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('2', $return-value, substring-before($expression, ']'), ']')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-one='"'"> + <xsl:value-of select="concat('1', $first-one, substring-before(substring-after($expression, '"'), '"'), '"')"/> + </xsl:when> + <xsl:when test="$first-one="'""> + <xsl:variable name="str-in" select="substring-before(substring-after($expression, "'"), "'")"/> + <xsl:choose> + <xsl:when test="contains($str-in, '\') and contains($str-in, '[') and contains($str-in, ']')"> + <xsl:variable name="first-pos" select="substring-before($str-in, '[')"/> + <xsl:variable name="second-pos" select="substring-before(substring-after($str-in, '['), ']')"/> + <xsl:variable name="third-pos" select="substring-after($str-in, ']')"/> + <xsl:value-of select="concat('1', "'", $first-pos, $second-pos, "'", '#$', $third-pos)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('1', "'", $str-in, "'")"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-one='+' or $first-one='-' or $first-one='*' or $first-one='/' or $first-one=')' or $first-one='^' or $first-one=':' or $first-one='"' or $first-one=';' or $first-one=',' or $first-one='>' or $first-one='<'"> + <xsl:choose> + <xsl:when test="$return-value = ''"> + <xsl:value-of select="concat('1', $first-one)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('2', $return-value)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$expression = ''"> + <xsl:value-of select="concat('2', $return-value)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="parse-range-name"> + <xsl:with-param name="expression" select="substring($expression, 2, string-length($expression)-1)"/> + <xsl:with-param name="return-value" select="concat($return-value, substring($expression, 1, 1))"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="handle-type-number"> + <xsl:param name="t-part"/> + <xsl:choose> + <xsl:when test="starts-with($t-part, '[')"> + <xsl:variable name="tt-str" select="substring-before( substring-after( $t-part, '['), ']')"/> + <xsl:choose> + <xsl:when test="($tt-str < 0) or ($tt-str > 0) or ($tt-str = 0)"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="($t-part < 0) or ($t-part > 0) or ($t-part = 0)"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:when test="$t-part = ''"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-unit"> + <xsl:param name="column-number"/> + <xsl:param name="row-number"/> + <xsl:param name="column-pos-style"/> + <xsl:param name="row-pos-style"/> + <xsl:variable name="column-number1"> + <xsl:value-of select="floor( $column-number div 26 )"/> + </xsl:variable> + <xsl:variable name="column-number2"> + <xsl:value-of select="$column-number mod 26"/> + </xsl:variable> + <xsl:variable name="column-character1"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-character2"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number2"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$column-pos-style = 'absolute'"> + <xsl:value-of select="concat( '$', $column-character1, $column-character2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat( $column-character1, $column-character2)"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$row-pos-style ='absolute'"> + <xsl:value-of select="concat( '$', $row-number)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$row-number"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="number-to-character"> + <xsl:param name="number"/> + <xsl:choose> + <xsl:when test="$number = 0"/> + <xsl:when test="$number = 1">A</xsl:when> + <xsl:when test="$number = 2">B</xsl:when> + <xsl:when test="$number = 3">C</xsl:when> + <xsl:when test="$number = 4">D</xsl:when> + <xsl:when test="$number = 5">E</xsl:when> + <xsl:when test="$number = 6">F</xsl:when> + <xsl:when test="$number = 7">G</xsl:when> + <xsl:when test="$number = 8">H</xsl:when> + <xsl:when test="$number = 9">I</xsl:when> + <xsl:when test="$number = 10">J</xsl:when> + <xsl:when test="$number = 11">K</xsl:when> + <xsl:when test="$number = 12">L</xsl:when> + <xsl:when test="$number = 13">M</xsl:when> + <xsl:when test="$number = 14">N</xsl:when> + <xsl:when test="$number = 15">O</xsl:when> + <xsl:when test="$number = 16">P</xsl:when> + <xsl:when test="$number = 17">Q</xsl:when> + <xsl:when test="$number = 18">R</xsl:when> + <xsl:when test="$number = 19">S</xsl:when> + <xsl:when test="$number = 20">T</xsl:when> + <xsl:when test="$number = 21">U</xsl:when> + <xsl:when test="$number = 22">V</xsl:when> + <xsl:when test="$number = 23">W</xsl:when> + <xsl:when test="$number = 24">X</xsl:when> + <xsl:when test="$number = 25">Y</xsl:when> + <xsl:when test="$number = 26">Z</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="get-digit-length"> + <xsl:param name="complexive-string"/> + <xsl:variable name="first-char"> + <xsl:value-of select="substring( $complexive-string, 1, 1)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-char = '1' or $first-char = '2' or $first-char = '3' or $first-char = '4' or $first-char = '5' or $first-char = '6' or $first-char = '7' or $first-char = '8' or $first-char = '9' or $first-char = '0' "> + <xsl:variable name="temp"> + <xsl:call-template name="get-digit-length"> + <xsl:with-param name="complexive-string" select="substring( $complexive-string, 2)"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$temp+1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:句属性" mode="style"> + <!--chengxz 0725--> + <xsl:if test="not(@字:式样引用)"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句属性" format="1"/></xsl:attribute> + <xsl:attribute name="style:family">text</xsl:attribute> + <xsl:if test="@字:式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="./*"/> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="style-style-content"> + <xsl:variable name="style-name" select="@表:标识符"/> + <xsl:variable name="apply-style-name" select="@表:名称"/> + <xsl:attribute name="style:family"><xsl:choose><xsl:when test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]">table-column</xsl:when><xsl:otherwise>table-cell</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]/@表:列宽"> + <xsl:element name="style:table-column-properties"> + <xsl:attribute name="style:column-width"><xsl:value-of select="concat(/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]/@表:列宽,$uofUnit)"/></xsl:attribute> + <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]/@表:跨度"> + <xsl:attribute name="fo:break-before">auto</xsl:attribute> + </xsl:if> + <xsl:for-each select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]"> + <xsl:if test="preceding-sibling::表:列[1]/@表:跨度 and ancestor::表:工作表/表:分页符集/表:分页符/@表:列号"> + <xsl:variable name="kuadu"> + <xsl:value-of select="preceding-sibling::表:列[1]/@表:跨度"/> + </xsl:variable> + <xsl:if test="not($kuadu='1')"> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:if> + <xsl:if test="$kuadu='1' and not(preceding::表:列[2])"> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:element name="style:table-cell-properties"> + <xsl:if test="表:对齐格式"> + <xsl:if test="表:对齐格式/表:垂直对齐方式"> + <xsl:variable name="vertical-align"> + <xsl:choose> + <xsl:when test="表:对齐格式/表:垂直对齐方式 = 'top'">top</xsl:when> + <xsl:when test="表:对齐格式/表:垂直对齐方式 = 'center'">center</xsl:when> + <xsl:when test="表:对齐格式/表:垂直对齐方式 = 'bottom'">bottom</xsl:when> + <xsl:otherwise>middle</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:vertical-align"><xsl:value-of select="$vertical-align"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:对齐格式/表:自动换行/@表:值 = 'true'"> + <xsl:attribute name="fo:wrap-option">wrap</xsl:attribute> + </xsl:if> + <xsl:if test="表:对齐格式/表:缩进"> + <xsl:attribute name="fo:padding-left"><xsl:variable name="indent" select="表:对齐格式/表:缩进 * 10"/><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat($indent,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + </xsl:if> + <xsl:if test="表:对齐格式/表:文字旋转角度"> + <xsl:attribute name="style:rotation-angle"><xsl:choose><xsl:when test="表:对齐格式/表:文字旋转角度 < 0"><xsl:value-of select="360 - 表:对齐格式/表:文字旋转角度"/></xsl:when><xsl:otherwise><xsl:value-of select="表:对齐格式/表:文字旋转角度"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="style:rotation-align">none</xsl:attribute> + </xsl:if> + <xsl:if test="表:对齐格式/表:文字方向 = 'vertical'"> + <xsl:attribute name="style:direction">ttb</xsl:attribute> + <xsl:if test="not(表:对齐格式/字:水平对齐方式)"> + <xsl:attribute name="style:text-align-source">fix</xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + <!--xsl:if test="表:边框"> + <xsl:apply-templates select="表:边框" /> + </xsl:if--> + <!--chenjh add 边框 again--> + <xsl:if test="表:边框/uof:上/@uof:宽度 !=''"> + <xsl:variable name="top-line-width" select="concat(表:边框/uof:上/@uof:宽度,$uofUnit)"/> + <xsl:variable name="top-line-tyle"> + <xsl:choose> + <xsl:when test="表:边框/uof:上/@uof:类型='single'">solid</xsl:when> + <xsl:when test="表:边框/uof:上/@uof:类型='double'">double</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="top-line-color" select="表:边框/uof:上/@uof:颜色"/> + <xsl:variable name="border-top" select="concat($top-line-width,' ',$top-line-tyle,' ',$top-line-color)"/> + <xsl:attribute name="fo:border-top"><xsl:value-of select="$border-top"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:边框/uof:下/@uof:宽度 !=''"> + <xsl:variable name="bottom-line-width" select="concat(表:边框/uof:下/@uof:宽度,$uofUnit)"/> + <xsl:variable name="bottom-line-tyle"> + <xsl:choose> + <xsl:when test="表:边框/uof:下/@uof:类型='single'">solid</xsl:when> + <xsl:when test="表:边框/uof:下/@uof:类型='double'">double</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="bottom-line-color" select="表:边框/uof:下/@uof:颜色"/> + <xsl:variable name="border-bottom" select="concat($bottom-line-width,' ',$bottom-line-tyle,' ',$bottom-line-color)"/> + <xsl:attribute name="fo:border-bottom"><xsl:value-of select="$border-bottom"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:边框/uof:左/@uof:宽度 !=''"> + <xsl:variable name="left-line-width" select="concat(表:边框/uof:左/@uof:宽度,$uofUnit)"/> + <xsl:variable name="left-line-tyle"> + <xsl:choose> + <xsl:when test="表:边框/uof:左/@uof:类型='single'">solid</xsl:when> + <xsl:when test="表:边框/uof:左/@uof:类型='double'">double</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="left-line-color" select="表:边框/uof:左/@uof:颜色"/> + <xsl:variable name="border-left" select="concat($left-line-width,' ',$left-line-tyle,' ',$left-line-color)"/> + <xsl:attribute name="fo:border-left"><xsl:value-of select="$border-left"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:边框/uof:右/@uof:宽度 !=''"> + <xsl:variable name="right-line-width" select="concat(表:边框/uof:右/@uof:宽度,$uofUnit)"/> + <xsl:variable name="right-line-tyle"> + <xsl:choose> + <xsl:when test="@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="@uof:类型 = 'double'">double</xsl:when> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="right-line-color" select="表:边框/uof:右/@uof:颜色"/> + <xsl:variable name="border-right" select="concat($right-line-width,' ',$right-line-tyle,' ',$right-line-color)"/> + <xsl:attribute name="fo:border-right"><xsl:value-of select="$border-right"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:边框/uof:对角线1/@uof:宽度 !=''"> + <xsl:variable name="diagonal-lr-width" select="concat(表:边框/uof:对角线1/@uof:宽度,$uofUnit)"/> + <xsl:variable name="diagonal-lr-tyle"> + <xsl:choose> + <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'double'">double</xsl:when> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="diagonal-lr-color" select="表:边框/uof:对角线1/@uof:颜色"/> + <xsl:variable name="border-diagonal" select="concat($diagonal-lr-width,' ',$diagonal-lr-tyle,' ',$diagonal-lr-color)"/> + <xsl:attribute name="style:diagonal-bl-tr"><xsl:value-of select="$border-diagonal"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:边框/uof:对角线2/@uof:宽度 !=''"> + <xsl:variable name="diagonal-rl-width" select="concat(表:边框/uof:对角线2/@uof:宽度,$uofUnit)"/> + <xsl:variable name="diagonal-rl-tyle"> + <xsl:choose> + <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'double'">double</xsl:when> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="diagonal-rl-color" select="表:边框/uof:对角线2/@uof:颜色"/> + <xsl:variable name="border-diagonal" select="concat($diagonal-rl-width,' ',$diagonal-rl-tyle,' ',$diagonal-rl-color)"/> + <xsl:attribute name="style:diagonal-tl-br"><xsl:value-of select="$border-diagonal"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:边框/*/@uof:阴影"> + <xsl:choose> + <xsl:when test="表:边框/uof:下/@uof:阴影 and 表:边框/uof:右/@uof:阴影"> + <xsl:attribute name="style:shadow">#808080 0.18cm 0.18cm</xsl:attribute> + </xsl:when> + <xsl:when test="表:边框/uof:下/@uof:阴影 and 表:边框/uof:左/@uof:阴影"> + <xsl:attribute name="style:shadow">#808080 -0.18cm 0.18cm</xsl:attribute> + </xsl:when> + <xsl:when test="表:边框/uof:上/@uof:阴影 and 表:边框/uof:右/@uof:阴影"> + <xsl:attribute name="style:shadow">#808080 0.18cm -0.18cm</xsl:attribute> + </xsl:when> + <xsl:when test="表:边框/uof:上/@uof:阴影 and 表:边框/uof:左/@uof:阴影"> + <xsl:attribute name="style:shadow">#808080 -0.18cm -0.18cm</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <!--边框 end --> + <xsl:if test="表:填充"> + <xsl:choose> + <xsl:when test="表:填充/图:颜色"> + <xsl:attribute name="fo:background-color"><xsl:value-of select="表:填充/图:颜色"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:if test="表:填充/图:图案/@图:前景色"> + <xsl:variable name="pattern-value"> + <xsl:call-template name="cell-pattern-color"> + <xsl:with-param name="pattern" select="concat('0.',substring-after(表:填充/图:图案/图:背景色,'y'))"/> + <xsl:with-param name="color-value" select="表:填充/图:颜色"/> + <xsl:with-param name="pattern-color-value" select="表:填充/图:图案/图:背景色"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:background-color"><xsl:value-of select="$pattern-value"/></xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="表:字体格式/字:隐藏文字"> + <xsl:choose> + <xsl:when test="表:字体格式/字:隐藏文字 = 'true'"> + <xsl:attribute name="style:cell-protect">protected formula-hidden</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:cell-protect">none</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:attribute name="style:cell-protect">none</xsl:attribute> + <xsl:attribute name="style:text-align-source">fix</xsl:attribute> + </xsl:element> + <xsl:element name="style:paragraph-properties"> + <xsl:if test="表:对齐格式/表:水平对齐方式"> + <xsl:variable name="text-align"> + <xsl:choose> + <xsl:when test="表:对齐格式/表:水平对齐方式 = 'left'">start</xsl:when> + <xsl:when test="表:对齐格式/表:水平对齐方式 = 'center'">center</xsl:when> + <xsl:when test="表:对齐格式/表:水平对齐方式 = 'right'">end</xsl:when> + <xsl:when test="表:对齐格式/表:水平对齐方式 = 'justify'">justify</xsl:when> + <xsl:otherwise>start</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:text-align"><xsl:value-of select="$text-align"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:if test="表:字体格式/字:字体"> + <xsl:choose> + <xsl:when test="(表:字体格式/字:字体/@字:中文字体引用)or (表:字体格式/字:字体/@字:西文字体引用)"> + <xsl:variable name="fontnameZ" select="表:字体格式/字:字体/@字:中文字体引用"/> + <xsl:variable name="fontnameX" select="表:字体格式/字:字体/@字:西文字体引用"/> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:字体集/uof:字体声明"> + <xsl:if test="(./@uof:标识符 = $fontnameZ)or(./@uof:标识符 = $fontnameX)"> + <xsl:attribute name="style:font-name"><xsl:value-of select="./@uof:名称"/></xsl:attribute> + <xsl:attribute name="style:font-name-asian"><xsl:value-of select="./@uof:名称"/></xsl:attribute> + <xsl:attribute name="style:font-name-complex"><xsl:value-of select="./@uof:名称"/></xsl:attribute> + <xsl:attribute name="style:font-charset"><xsl:value-of select="./@uof:字体族"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-name">Arial</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="表:字体格式/字:粗体/@字:值"> + <xsl:attribute name="fo:font-weight"><xsl:choose><xsl:when test="表:字体格式/字:粗体/@字:值=1 or 表:字体格式/字:粗体/@字:值='true'">bold</xsl:when><xsl:when test="表:字体格式/字:粗体/@字:值=0 or 表:字体格式/字:粗体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="style:font-weight-asian"><xsl:choose><xsl:when test="表:字体格式/字:粗体/@字:值=1 or 表:字体格式/字:粗体/@字:值='true'">bold</xsl:when><xsl:when test="表:字体格式/字:粗体/@字:值=0 or 表:字体格式/字:粗体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="style:font-weight-complex"><xsl:choose><xsl:when test="表:字体格式/字:粗体/@字:值=1 or 表:字体格式/字:粗体/@字:值='true'">bold</xsl:when><xsl:when test="表:字体格式/字:粗体/@字:值=0 or 表:字体格式/字:粗体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="表:字体格式/字:斜体/@字:值"> + <xsl:attribute name="fo:font-style"><xsl:choose><xsl:when test="表:字体格式/字:斜体/@字:值=1 or 表:字体格式/字:斜体/@字:值='true'">italic</xsl:when><xsl:when test="表:字体格式/字:斜体/@字:值=0 or 表:字体格式/字:斜体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="style:font-style-asian"><xsl:choose><xsl:when test="表:字体格式/字:斜体/@字:值=1 or 表:字体格式/字:斜体/@字:值='true'">italic</xsl:when><xsl:when test="表:字体格式/字:斜体/@字:值=0 or 表:字体格式/字:斜体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="style:font-style-complex"><xsl:choose><xsl:when test="表:字体格式/字:斜体/@字:值=1 or 表:字体格式/字:斜体/@字:值='true'">italic</xsl:when><xsl:when test="表:字体格式/字:斜体/@字:值=0 or 表:字体格式/字:斜体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="表:字体格式/字:字体/@字:颜色"> + <xsl:attribute name="fo:color"><xsl:value-of select="表:字体格式/字:字体/@字:颜色"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-window-font-color">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="表:字体格式/字:字体/@字:字号"> + <xsl:attribute name="fo:font-size"><xsl:value-of select="concat( 表:字体格式/字:字体/@字:字号, 'pt')"/></xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="concat( 表:字体格式/字:字体/@字:字号, 'pt')"/></xsl:attribute> + <xsl:attribute name="style:font-size-complex"><xsl:value-of select="concat( 表:字体格式/字:字体/@字:字号, 'pt')"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:font-size">12pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian">12pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex">12pt</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="表:字体格式/字:浮雕"> + <xsl:variable name="aa"> + <xsl:value-of select="表:字体格式/字:浮雕/@字:类型"/> + </xsl:variable> + <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="$aa='emboss'">embossed</xsl:when><xsl:when test="$aa='engrave'">engraved</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="表:字体格式/字:阴影/@字:值 = '1' or 表:字体格式/字:阴影/@字:值 = 'true'"> + <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute> + </xsl:if> + <xsl:if test="表:字体格式/字:删除线"> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + <xsl:choose> + <xsl:when test="表:字体格式/字:删除线/@字:类型='double'"> + <xsl:attribute name="style:text-line-through-type">double</xsl:attribute> + </xsl:when> + <xsl:when test="表:字体格式/字:删除线/@字:类型='single'"> + <xsl:attribute name="style:text-underline-mode">continuous</xsl:attribute> + <xsl:attribute name="style:text-line-through-mode">continuous</xsl:attribute> + </xsl:when> + <xsl:when test="表:字体格式/字:删除线/@字:类型='bold'"> + <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="表:字体格式/字:删除线/@字:类型='带/'"> + <xsl:attribute name="style:text-line-through-text">/</xsl:attribute> + </xsl:when> + <xsl:when test="表:字体格式/字:删除线/@字:类型='带X'"> + <xsl:attribute name="style:text-line-through-text">X</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:if> + <xsl:if test="表:字体格式/字:下划线"> + <xsl:apply-templates select="表:字体格式/字:下划线"/> + </xsl:if> + </xsl:if> + <xsl:if test="表:字体格式/字:着重号"> + <xsl:apply-templates select="表:字体格式/字:着重号"/> + </xsl:if> + <xsl:if test="表:字体格式/字:空心/@字:值='true'"> + <xsl:attribute name="style:text-outline">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="单元格具体式样"> + <xsl:choose> + <xsl:when test="@表:类型 = 'Default'"> + <xsl:element name="style:default-style"> + <xsl:call-template name="style-style-content"/> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@表:标识符"/></xsl:attribute> + <xsl:if test="表:数字格式/@表:格式码 = 'general'"> + <xsl:attribute name="style:parent-style-name">Default</xsl:attribute> + </xsl:if> + <xsl:attribute name="style:parent-style-name">Default</xsl:attribute> + <xsl:attribute name="style:data-style-name"><xsl:value-of select="concat( @表:标识符, 'F')"/></xsl:attribute> + <!--chengxz这里要改 --> + <!--xsl:attribute name="style:data-style-name"><xsl:value-of select="'N2'"/></xsl:attribute--> + <xsl:call-template name="style-style-content"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="表:边框"> + <!--chengxz 0622--> + <xsl:if test="not(uof:下)"> + <xsl:attribute name="fo:border-bottom">none</xsl:attribute> + </xsl:if> + <xsl:if test="not(uof:上)"> + <xsl:attribute name="fo:border-top">none</xsl:attribute> + </xsl:if> + <xsl:if test="not(uof:左)"> + <xsl:attribute name="fo:border-left">none</xsl:attribute> + </xsl:if> + <xsl:if test="not(uof:右)"> + <xsl:attribute name="fo:border-right">none</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="uof:对角线1"/> + <xsl:apply-templates select="uof:对角线2"/> + <xsl:apply-templates select="uof:上"/> + <xsl:apply-templates select="uof:下"/> + <xsl:apply-templates select="uof:左"/> + <xsl:apply-templates select="uof:右"/> + </xsl:template> + <xsl:template match="uof:上"> + <xsl:variable name="bordtype"> + <xsl:choose> + <xsl:when test="@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="@uof:类型 = 'double'">double</xsl:when> + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(@uof:宽度 div 30,$uofUnit, ' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute> + <xsl:if test="@uof:类型 = 'double'"> + <xsl:attribute name="style:border-line-width-top">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="uof:下"> + <xsl:variable name="bordtype"> + <xsl:choose> + <xsl:when test="@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="@uof:类型 = 'double'">double</xsl:when> + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(@uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ',@uof:颜色)"/></xsl:attribute> + <xsl:if test="@uof:类型 = 'double'"> + <xsl:attribute name="style:border-line-width-bottom">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="uof:左"> + <xsl:variable name="bordtype"> + <xsl:choose> + <xsl:when test="@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="@uof:类型 = 'double'">double</xsl:when> + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(@uof:宽度 div 30,$uofUnit, ' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute> + <xsl:if test="@uof:类型 = 'double'"> + <xsl:attribute name="style:border-line-width-left">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="uof:右"> + <xsl:variable name="bordtype"> + <xsl:choose> + <xsl:when test="@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="@uof:类型 = 'double'">double</xsl:when> + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:border-right"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute> + <xsl:if test="@uof:类型 = 'double'"> + <xsl:attribute name="style:border-line-width-right">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="uof:对角线1"> + <xsl:variable name="bordtype"> + <xsl:choose> + <xsl:when test="@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="@uof:类型 = 'double'">double</xsl:when> + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:diagonal-bl-tr"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute> + <xsl:if test="@uof:类型 = 'double'"> + <xsl:attribute name="style:diagonal-bl-tr-width">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="uof:对角线2"> + <xsl:variable name="bordtype"> + <xsl:choose> + <xsl:when test="@uof:类型 = 'none'">none</xsl:when> + <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when> + <xsl:when test="@uof:类型 = 'double'">double</xsl:when> + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:otherwise>solid</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:diagonal-tl-br"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute> + <xsl:if test="@uof:类型 = 'double'"> + <xsl:attribute name="style:diagonal-tl-br-width">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="表:字体格式"> + <xsl:choose> + <xsl:when test="字:上下标/@字:上下标 = 'sup'"> + <style:style style:name="{concat(../@表:标识符,'T0')}" style:family="text"> + <style:text-properties style:text-position="33% 58%"/> + </style:style> + </xsl:when> + <xsl:when test="字:上下标/@字:上下标 = 'sub'"> + <style:style style:name="{concat(../@表:标识符,'T0')}" style:family="text"> + <style:text-properties style:text-position="-33% 58%"/> + </style:style> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="tablecolumngroup"> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:param name="prestart"/> + <xsl:param name="preend"/> + <xsl:param name="nextstart"/> + <xsl:param name="nextend"/> + <table:table-column-group> + <table:table-column> + <xsl:attribute name="table:style-name">co1</xsl:attribute> + <xsl:attribute name="table:table-column-repeated"><xsl:value-of select="@表:终止 - @表:起始 + 1"/></xsl:attribute> + </table:table-column> + <xsl:if test="$nextstart >= $start and $nextend <= $end"> + <xsl:for-each select="following-sibling::表:列[1]"> + <xsl:call-template name="tablecolumngroup"/> + </xsl:for-each> + </xsl:if> + </table:table-column-group> + </xsl:template> + <xsl:template match="表:工作表"> + <xsl:variable name="rowpath" select="表:工作表内容/表:行"/> + <xsl:variable name="colpath" select="表:工作表内容/表:列"/> + <xsl:element name="table:table"> + <xsl:attribute name="table:name"><xsl:value-of select="@表:名称"/></xsl:attribute> + <xsl:if test="表:工作表内容"> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat( 'ta', count(preceding-sibling::表:工作表)+1)"/></xsl:attribute> + <xsl:if test="(@表:隐藏 = '1')or(@表:隐藏 = 'true')"> + <xsl:attribute name="table:protected">true</xsl:attribute> + </xsl:if> + <xsl:if test="表:工作表内容/uof:锚点 or 表:工作表内容/表:图表"> + <table:shapes> + <xsl:apply-templates select="表:工作表内容/uof:锚点"/> + <xsl:apply-templates select="表:工作表内容/表:图表"> + <xsl:with-param name="table-name" select="@表:名称"/> + </xsl:apply-templates> + </table:shapes> + </xsl:if> + <xsl:variable name="table-pos"> + <xsl:value-of select="count(../preceding-sibling::表:工作表)+1"/> + </xsl:variable> + <xsl:if test="表:工作表内容/表:分组集/表:列"> + <xsl:for-each select="表:工作表内容/表:分组集/表:列"> + <xsl:variable name="start" select="@表:起始"/> + <xsl:variable name="end" select="@表:终止"/> + <xsl:variable name="prestart" select="preceding-sibling::表:列/@表:起始"/> + <xsl:variable name="preend" select="preceding-sibling::表:列/@表:终止"/> + <xsl:variable name="nextstart" select="following-sibling::表:列/@表:起始"/> + <xsl:variable name="nextend" select="following-sibling::表:列/@表:终止"/> + <xsl:call-template name="tablecolumngroup"> + <xsl:with-param name="start" select="$start"/> + <xsl:with-param name="end" select="$end"/> + <xsl:with-param name="prestart" select="$prestart"/> + <xsl:with-param name="preend" select="$preend"/> + <xsl:with-param name="nextstart" select="$nextstart"/> + <xsl:with-param name="nextend" select="$nextend"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:for-each select="表:工作表内容/表:列"> + <table:table-column> + <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute> + <xsl:if test="@表:跨度 and not(@表:跨度='1')"> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="@表:跨度"/></xsl:attribute> + </xsl:if> + <xsl:if test="@表:隐藏"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + </table:table-column> + </xsl:for-each> + <xsl:variable name="condition-pos-str1"> + <xsl:if test="../../表:公用处理规则/表:条件格式化集/表:条件格式化"> + <xsl:call-template name="condition-row-column-string"> + <xsl:with-param name="last" select="''"/> + <xsl:with-param name="total" select="count(../../表:公用处理规则/表:条件格式化集/表:条件格式化)"/> + <xsl:with-param name="index" select="1"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="condition-pos-str2"> + <xsl:if test="../../表:公用处理规则/表:数据有效性集/表:数据有效性"> + <xsl:call-template name="validation-row-column-string"> + <xsl:with-param name="last" select="''"/> + <xsl:with-param name="total" select="count(../../表:公用处理规则/表:数据有效性集/表:数据有效性)"/> + <xsl:with-param name="index" select="1"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="condition-pos-str" select="concat($condition-pos-str1, $condition-pos-str2)"/> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行"> + <xsl:call-template name="create-rows"> + <xsl:with-param name="lastrowpos" select="0"/> + <xsl:with-param name="row-count" select="count(表:工作表内容/表:行)"/> + <xsl:with-param name="currentRow" select="1"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="tableHasStyle"> + <xsl:choose> + <xsl:when test="./表:工作表内容[@表:式样引用]"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="./表:分页符集/表:分页符[@表:行号]"> + <xsl:for-each select="./表:分页符集/表:分页符[@表:行号]"> + <xsl:variable name="number-repeated"> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:value-of select="./@表:行号"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./@表:行号 - preceding::表:分页符[@表:行号 and (position()=count(.))]/@表:行号 - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$number-repeated > 0"> + <xsl:element name="table:table-row"> + <xsl:if test="($rowpath/@表:隐藏 = '1') or ($rowpath/@表:隐藏 = 'true')"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$table-pos)"/></xsl:attribute> + <xsl:attribute name="table:number-rows-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$tableHasStyle = 1"> + <table:table-cell table:number-columns-repeated="256"/> + </xsl:when> + <xsl:otherwise> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="table:table-row"> + <xsl:if test="($colpath/@表:隐藏 = '1') or ($colpath/@表:隐藏 = 'true')"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$table-pos)"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$tableHasStyle = 1"> + <table:table-cell table:number-columns-repeated="256"/> + </xsl:when> + <xsl:otherwise> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:element name="table:table-row"> + <xsl:choose> + <xsl:when test="表:工作表内容/@表:式样引用"> + <xsl:attribute name="table:style-name"><xsl:value-of select="表:工作表内容/@表:式样引用"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:text>ro1</xsl:text></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:element name="table:table-cell"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="../../表:公用处理规则/表:条件格式化集/表:条件格式化"> + <xsl:variable name="condition-row-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'R'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="condition-col-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'C'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="break-row-max"> + <xsl:call-template name="break-row-beyond-max"> + <xsl:with-param name="pos" select="1"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="count-value" select="count(./表:分页符集/表:分页符[@表:行号])"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="end-value"> + <xsl:choose> + <xsl:when test="$condition-row-max < $break-row-max"> + <xsl:value-of select="$break-row-max"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$condition-row-max"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="get-row-beyond-last"> + <xsl:with-param name="index-value" select="1"/> + <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="end-pos" select="$end-value"/> + <xsl:with-param name="total-col" select="$condition-col-max"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="./表:工作表内容/@表:式样引用"> + <table:table-row table:style-name="ro1" table:number-rows-repeated="32000"> + <table:table-cell table:number-columns-repeated="256"/> + </table:table-row> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:element> + <xsl:if test="表:图表"> + <table:shapes> + <xsl:apply-templates select="表:图表"> + <xsl:with-param name="table-name" select="@表:名称"/> + </xsl:apply-templates> + </table:shapes> + </xsl:if> + </xsl:template> + <!--xsl:template name="create-columns-without-input"></xsl:template> + <xsl:template name="create-columns"></xsl:template> + <xsl:template name="condition-row-column-string"></xsl:template> +<xsl:template name="validation-row-column-string"></xsl:template> +<xsl:template name="create-rows"></xsl:template> +<xsl:template name="condition-row-col-pos-max"></xsl:template> +<xsl:template name="get-row-beyond-last"></xsl:template--> + <!--xsl:template name="break-row-beyond-max"></xsl:template--> + <!-- chengxz有问题--> + <xsl:template name="create-columns-without-input"> + <xsl:param name="table-pos"/> + <xsl:variable name="rowpath" select="表:工作表内容/表:行"/> + <xsl:variable name="colpath" select="表:工作表内容/表:列"/> + <xsl:choose> + <xsl:when test="./表:分页符集/表:分页符[@表:列号]"> + <xsl:for-each select="./表:分页符集/表:分页符[@表:列号]"> + <xsl:variable name="number-repeated"> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:value-of select="./@表:列号"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./@表:列号 - preceding::表:分页符[@表:列号 and (position()=count(.))]/@表:列号 - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$number-repeated > 0"> + <xsl:element name="table:table-column"> + <xsl:if test="ancestor::表:工作表/表:工作表内容/@表:式样引用"> + <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="ancestor::表:工作表/表:工作表内容/@表:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="($colpath/@表:隐藏 = '1') or ($colpath/@表:隐藏 = 'true')"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co',$table-pos)"/></xsl:attribute> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="table:table-column"> + <xsl:if test="ancestor::表:工作表/表:工作表内容/@表:式样引用"> + <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="ancestor::表:工作表/表:工作表内容/@表:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="($colpath/@表:隐藏 = '1') or ($colpath/@表:隐藏 = 'true')"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$table-pos)"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:element name="table:table-column"> + <xsl:choose> + <xsl:when test="表:工作表内容/@表:式样引用"> + <xsl:attribute name="table:style-name"><xsl:value-of select="表:工作表内容/@表:式样引用"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:text>co1</xsl:text></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="表:工作表内容/@表:最大列 and 表:工作表内容/@表:最大列 > 0"> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="表:工作表内容/@表:最大列"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="table:default-cell-style-name"><xsl:text>Default</xsl:text></xsl:attribute> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="create-columns"> + <xsl:param name="columnCount"/> + <xsl:param name="currentColumn" select="1"/> + <xsl:param name="finishedColumns" select="0"/> + <xsl:param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:param name="currentColumnNode"/> + <xsl:choose> + <xsl:when test="$finishedColumns < $columnCount"> + <xsl:choose> + <xsl:when test="$currentColumnNode"> + <xsl:choose> + <xsl:when test="$currentColumnNode/@表:列号 - $finishedColumns > 1"> + <xsl:call-template name="create-default-column"> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/> + <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:element name="table:table-column"> + <xsl:if test="($currentColumnNode/@表:隐藏 = '1') or ($currentColumnNode/@表:隐藏 = 'true')"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + <xsl:if test="$currentColumnNode/@表:跨度"> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$currentColumnNode/@表:跨度 + 1"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="key('ColBreak', $currentColumn)"> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob', $worksheetNo, '-', $currentColumn)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co', $worksheetNo, '-', $currentColumn)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentColumn" select="$currentColumn + 1"/> + <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/> + <xsl:with-param name="currentColumnNode" select="表:工作表属性/表:列[$currentColumn + 1]"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create-default-column"> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + <xsl:call-template name="create-columns"> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentColumn" select="$currentColumn"/> + <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$currentColumn = $columnCount"> + <xsl:if test="表:分页符集/表:分页符/@表:列号 > $finishedColumns"> + <xsl:call-template name="get-column-beyond-last"> + <xsl:with-param name="index-value" select="$finishedColumns"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-column-beyond-last"> + <xsl:param name="index-value"/> + <xsl:param name="worksheetNo"/> + <xsl:for-each select="表:分页符集/表:分页符[@表:列号]"> + <xsl:variable name="each-column-value" select="@表:列号"/> + <xsl:choose> + <xsl:when test="$each-column-value + 1 > $index-value"> + <xsl:variable name="number-repeated"> + <xsl:choose> + <xsl:when test="preceding-sibling::表:分页符[@表:列号][position()=count(.)]/@表:列号 + 1 = $index-value"> + <xsl:value-of select="$each-column-value - preceding-sibling::表:分页符[@表:列号 and (position()=count(.))]/@表:列号 - 1"/> + </xsl:when> + <xsl:when test="preceding-sibling::表:分页符[@表:列号 and (position()=count(.))]/@表:列号 + 1 > $index-value"> + <xsl:value-of select="$each-column-value - preceding-sibling::表:分页符[@表:列号][position()=count(.)]/@表:列号 - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$each-column-value - $index-value + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$number-repeated > 0"> + <xsl:element name="table:table-column"> + <xsl:attribute name="table:style-name"><xsl:value-of select="'co1'"/></xsl:attribute> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="table:table-column"> + <xsl:if test="../../表:工作表内容[@表:式样引用]"> + <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="./表:工作表内容/@表:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="$each-column-value + 1 = $index-value"> + <xsl:element name="table:table-column"> + <xsl:if test="/../../表:工作表内容[@表:式样引用]"> + <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="./../../表:工作表内容/@表:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="condition-row-column-string"> + <xsl:param name="last"/> + <xsl:param name="total"/> + <xsl:param name="index"/> + <xsl:variable name="table-pos" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:variable name="current"> + <xsl:call-template name="parse-range"> + <xsl:with-param name="range-value" select="../../表:公用处理规则/表:条件格式化集/表:条件格式化[position() = $index]/表:范围"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="current-value" select="concat('(c',$table-pos,'-',$index,':', $current,');')"/> + <xsl:if test="$index < $total"> + <xsl:call-template name="condition-row-column-string"> + <xsl:with-param name="last" select="concat($last, $current-value)"/> + <xsl:with-param name="total" select="$total"/> + <xsl:with-param name="index" select="$index + 1"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$index = $total"> + <xsl:value-of select="concat($last, $current-value)"/> + </xsl:if> + </xsl:template> + <xsl:template name="validation-row-column-string"> + <xsl:param name="last"/> + <xsl:param name="total"/> + <xsl:param name="index"/> + <xsl:variable name="table-pos" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:variable name="current"> + <xsl:call-template name="parse-range"> + <xsl:with-param name="range-value" select="../../表:公用处理规则/表:数据有效性集/表:数据有效性[position() = $index]/表:范围"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="current-value" select="concat('(v',$index,':', $current,');')"/> + <xsl:if test="$index < $total"> + <xsl:call-template name="validation-row-column-string"> + <xsl:with-param name="last" select="concat($last, $current-value)"/> + <xsl:with-param name="total" select="$total"/> + <xsl:with-param name="index" select="$index + 1"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$index = $total"> + <xsl:value-of select="concat($last, $current-value)"/> + </xsl:if> + </xsl:template> + <xsl:template name="create-rows"> + <xsl:param name="lastrowpos"/> + <xsl:param name="row-count"/> + <xsl:param name="currentRow"/> + <xsl:param name="condition-pos-str"/> + <xsl:choose> + <xsl:when test="$currentRow < ($row-count + 1)"> + <xsl:variable name="span-value"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 - $lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 - $lastrowpos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current-index"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$lastrowpos + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:分组集/表:行"> + <xsl:for-each select="./表:工作表内容/表:分组集/表:行[1]"> + <xsl:call-template name="table:table-row-group"/> + </xsl:for-each> + <xsl:for-each select="./表:工作表内容/表:行[not(@表:行号)]"> + <xsl:call-template name="create-row"> + <xsl:with-param name="index-value" select="$lastrowpos"/> + <xsl:with-param name="span-value" select="$span-value"/> + <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:with-param name="row-value" select="$currentRow"/> + <xsl:with-param name="times" select="1"/> + <xsl:with-param name="current-index" select="$current-index"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:when test="./表:工作表内容/表:分组集 and ( ./表:工作表内容/表:分组集/表:行/@表:起始 >= ($currentRow - 1) and ($currentRow - 1) <= ./表:工作表内容/表:分组集/表:行/@表:终止 )"> + <xsl:element name="table:table-row-group"> + <xsl:variable name="TempStart"> + <xsl:value-of select="./表:工作表内容/表:分组集/表:行/@表:起始"/> + </xsl:variable> + <xsl:variable name="TempEnd"> + <xsl:value-of select="./表:工作表内容/表:分组集/表:行/@表:终止"/> + </xsl:variable> + <xsl:for-each select="./表:工作表内容/表:行"> + <xsl:if test="$TempStart >= ($currentRow - 1) and ($currentRow - 1) <= $TempEnd"> + <xsl:call-template name="create-row"> + <xsl:with-param name="index-value" select="$lastrowpos"/> + <xsl:with-param name="span-value" select="$span-value"/> + <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:with-param name="row-value" select="$currentRow"/> + <xsl:with-param name="times" select="1"/> + <xsl:with-param name="current-index" select="$current-index"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create-row"> + <xsl:with-param name="index-value" select="$lastrowpos"/> + <xsl:with-param name="span-value" select="$span-value"/> + <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:with-param name="row-value" select="$currentRow"/> + <xsl:with-param name="times" select="1"/> + <xsl:with-param name="current-index" select="$current-index"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + <xsl:if test="$currentRow < $row-count"> + <xsl:call-template name="create-rows"> + <xsl:with-param name="lastrowpos"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="$lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$lastrowpos + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="row-count" select="$row-count"/> + <xsl:with-param name="currentRow" select="$currentRow + 1"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$currentRow = $row-count"> + <xsl:variable name="last-pos"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="$lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$lastrowpos + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="./表:分页符集/表:分页符/@表:行号 > ($last-pos - 1) or ../../表:公用处理规则/表:条件格式化集/表:条件格式化"> + <xsl:variable name="condition-row-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'R'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="condition-col-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'C'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="break-row-max"> + <xsl:call-template name="break-row-beyond-max"> + <xsl:with-param name="pos" select="1"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="count-value" select="count(./表:分页符集/表:分页符[@表:行号])"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="end-value"> + <xsl:choose> + <xsl:when test="$condition-row-max < $break-row-max"> + <xsl:value-of select="$break-row-max"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$condition-row-max"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="get-row-beyond-last"> + <xsl:with-param name="index-value" select="$last-pos + 1"/> + <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="end-pos" select="$end-value"/> + <xsl:with-param name="total-col" select="$condition-col-max"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="./表:工作表内容/表:列[@表:式样引用] or ./表:工作表内容[@表:式样引用]"> + <table:table-row table:style-name="ro1" table:number-rows-repeated="31990"> + <table:table-cell table:number-columns-repeated="256"/> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:number-columns-repeated="256"/> + </table:table-row> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:template> + <!-- add row-group 2.6--> + <xsl:template name="table:table-row-group"> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:variable name="start1" select="@表:起始"/> + <xsl:variable name="end1" select="@表:终止"/> + <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/> + <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/> + <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/> + <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/> + <xsl:variable name="numrow" select="$end1 - $start1"/> + <xsl:variable name="position" select="position()"/> + <xsl:choose> + <xsl:when test="$nextstart >= $start1 and $nextend <= $end1"> + <table:table-row-group> + <xsl:call-template name="creategroup"/> + </table:table-row-group> + </xsl:when> + <xsl:when test="$nextstart >= $end1"> + <xsl:choose> + <xsl:when test="$nextend <=$preend"> + <xsl:call-template name="row"> + <xsl:with-param name="start1" select="$start1"/> + <xsl:with-param name="end1" select="$end1"/> + <xsl:with-param name="nextstart" select="$nextstart"/> + <xsl:with-param name="nextend" select="$nextend"/> + <xsl:with-param name="prestart" select="$prestart"/> + <xsl:with-param name="preend" select="$preend"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="levelgroup"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="row"> + <xsl:with-param name="start1" select="$start1"/> + <xsl:with-param name="end1" select="$end1"/> + <xsl:with-param name="nextstart" select="$nextstart"/> + <xsl:with-param name="nextend" select="$nextend"/> + <xsl:with-param name="prestart" select="$prestart"/> + <xsl:with-param name="preend" select="$preend"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="levelrowgroup"> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:variable name="start1" select="@表:起始"/> + <xsl:variable name="end1" select="@表:终止"/> + <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/> + <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/> + <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/> + <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/> + <xsl:variable name="numrow" select="$end1 - $start1"/> + <xsl:variable name="position" select="position()"/> + <xsl:call-template name="row"> + <xsl:with-param name="start1" select="$start1"/> + <xsl:with-param name="end1" select="$end1"/> + <xsl:with-param name="nextstart" select="$nextstart"/> + <xsl:with-param name="nextend" select="$nextend"/> + <xsl:with-param name="prestart" select="$prestart"/> + <xsl:with-param name="preend" select="$preend"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="creategroup"> + <xsl:for-each select="following-sibling::表:行"> + <xsl:variable name="start1" select="@表:起始"/> + <xsl:variable name="end1" select="@表:终止"/> + <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/> + <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/> + <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/> + <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/> + <xsl:if test="$start1 >= $prestart and $end1 <= $preend"> + <xsl:call-template name="table:table-row-group"/> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="levelgroup"> + <xsl:for-each select="parent::表:分组集/表:行"> + <xsl:call-template name="levelrowgroup"/> + </xsl:for-each> + </xsl:template> + <xsl:template name="row"> + <xsl:param name="start1"/> + <xsl:param name="end1"/> + <xsl:param name="nextstart"/> + <xsl:param name="nextend"/> + <xsl:param name="prestart"/> + <xsl:param name="preend"/> + <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]"> + <xsl:variable name="rownum" select="@表:行号"/> + <xsl:variable name="aa" select="$start1 - $prestart"/> + <xsl:if test="$rownum >= $prestart and $rownum <= ($prestart + $aa - 1) and $start1 <= $preend"> + <table:table-row> + <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute> + <xsl:call-template name="celldata"/> + </table:table-row> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]"> + <xsl:variable name="rownum" select="@表:行号"/> + <xsl:variable name="ss" select="$start1 - $preend"/> + <xsl:if test="$rownum >= ($preend +1) and $rownum <= ($preend + $ss - 1) and $start1 >= $preend"> + <table:table-row> + <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute> + <xsl:call-template name="celldata"/> + </table:table-row> + </xsl:if> + </xsl:for-each> + <table:table-row-group> + <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]"> + <xsl:variable name="rownum" select="@表:行号"/> + <xsl:if test="$rownum <= $end1"> + <xsl:if test="$rownum >= $start1"> + <table:table-row> + <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute> + <xsl:call-template name="celldata"/> + </table:table-row> + </xsl:if> + </xsl:if> + </xsl:for-each> + </table:table-row-group> + <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]"> + <xsl:variable name="rownum" select="@表:行号"/> + <xsl:variable name="bb" select="$preend - $end1"/> + <xsl:if test="$rownum >= ($end1 + 1) and $rownum <= ($end1 + $bb) and $start1 < $preend"> + <table:table-row> + <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute> + <xsl:call-template name="celldata"/> + </table:table-row> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="celldata"> + <xsl:for-each select="./表:单元格"> + <table:table-cell> + <xsl:choose> + <xsl:when test="表:数据/@表:数据类型 = 'number'"> + <xsl:attribute name="office:value-type">float</xsl:attribute> + <xsl:attribute name="office:value"><xsl:choose><xsl:when test="表:数据/@表:数据数值"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:when><xsl:otherwise><xsl:value-of select="表:数据/字:句/字:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'date'"> + <xsl:attribute name="office:value-type">date</xsl:attribute> + <xsl:attribute name="table:date-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'time'"> + <xsl:attribute name="office:value-type">time</xsl:attribute> + <xsl:attribute name="table:time-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'boolean'"> + <xsl:attribute name="office:value-type">boolean</xsl:attribute> + <xsl:attribute name="table:boolean-value"><xsl:choose><xsl:when test="表:数据/字:句/字:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'text'"> + <xsl:attribute name="office:value-type">string</xsl:attribute> + <xsl:attribute name="table:string-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="表:数据/字:句/字:文本串"> + <text:p> + <xsl:value-of select="表:数据/字:句/字:文本串"/> + </text:p> + </xsl:if> + </table:table-cell> + </xsl:for-each> + </xsl:template> + <!-- add row-group 2.8 --> + <xsl:template name="create-row"> + <xsl:param name="index-value"/> + <xsl:param name="span-value"/> + <xsl:param name="worksheetNo"/> + <xsl:param name="row-value"/> + <xsl:param name="times"/> + <xsl:param name="current-index"/> + <xsl:param name="condition-pos-str"/> + <xsl:element name="table:table-row"> + <xsl:choose> + <xsl:when test="./表:分页符集/表:分页符/@表:行号 = ($index-value + $times - 1)"> + <xsl:choose> + <xsl:when test="($index-value + $times < $current-index) and ($current-index != 0)"> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$worksheetNo)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob', $worksheetNo, '-', $row-value)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="($index-value + $times < $current-index) and ($current-index != 0)"> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$worksheetNo)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro', $worksheetNo, '-', $row-value)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <!--chengxiuzhi0617--> + <xsl:if test="./表:工作表内容/表:行[position() = $row-value]/@表:隐藏 = 'true'"> + <xsl:choose> + <xsl:when test="./表:工作表内容/表:行[position() = $row-value]/@表:跨度"> + <xsl:if test="$index-value + $times > ($current-index - 1)"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$index-value + $times = $current-index"> + <xsl:attribute name="table:visibility">collapse</xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:choose> + <xsl:when test="not(./表:工作表内容/表:行[position() = $row-value]/*)"> + <table:table-cell> + <xsl:for-each select="./表:单元格/表:数据"> + <xsl:choose> + <xsl:when test="@表:数据类型 = 'number'"> + <xsl:attribute name="office:value-type">float</xsl:attribute> + <xsl:attribute name="office:value"><xsl:choose><xsl:when test="@表:数据数值"><xsl:value-of select="@表:数据数值"/></xsl:when><xsl:otherwise><xsl:value-of select="字:句/字:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="@表:数据类型 = 'date'"> + <xsl:attribute name="office:value-type">date</xsl:attribute> + <xsl:attribute name="table:date-value"><xsl:value-of select="@表:数据数值"/></xsl:attribute> + </xsl:when> + <xsl:when test="@表:数据类型 = 'time'"> + <xsl:attribute name="office:value-type">time</xsl:attribute> + <xsl:attribute name="table:time-value"><xsl:value-of select="@表:数据数值"/></xsl:attribute> + </xsl:when> + <xsl:when test="@表:数据类型 = 'boolean'"> + <xsl:attribute name="office:value-type">boolean</xsl:attribute> + <xsl:attribute name="table:boolean-value"><xsl:choose><xsl:when test="字:句/字:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="@表:数据类型 = 'text'"> + <xsl:attribute name="office:value-type">string</xsl:attribute> + <xsl:attribute name="table:string-value"><xsl:value-of select="@表:数据数值"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="字:句/字:文本串"> + <text:p> + <xsl:value-of select="字:句/字:文本串"/> + </text:p> + </xsl:if> + </xsl:for-each> + </table:table-cell> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$index-value + $times < $current-index"> + <xsl:variable name="current" select="concat('R',($index-value + $times),'C')"/> + <xsl:variable name="col-pos-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'C'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$current)"> + <xsl:call-template name="get-cell-span-in"> + <xsl:with-param name="row-pos" select="$index-value + $times"/> + <xsl:with-param name="c-start" select="1"/> + <xsl:with-param name="c-end" select="$col-pos-max"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$index-value + $times = $current-index"> + <xsl:apply-templates select="表:工作表内容/表:行[position() = $row-value]" mode="selected"> + <xsl:with-param name="row-pos" select="$index-value + $times"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="$times < $span-value"> + <xsl:call-template name="create-row"> + <xsl:with-param name="index-value" select="$index-value"/> + <xsl:with-param name="span-value" select="$span-value"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + <xsl:with-param name="row-value" select="$row-value"/> + <xsl:with-param name="times" select="$times + 1"/> + <xsl:with-param name="current-index" select="$current-index"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="condition-row-col-pos-max"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="last-value"/> + <xsl:param name="div-value"/> + <xsl:variable name="pre-value"> + <xsl:choose> + <xsl:when test="$div-value = 'R'"> + <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),'C')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-value"> + <xsl:choose> + <xsl:when test="$last-value < $pre-value"> + <xsl:value-of select="$pre-value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$last-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$div-value)"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="substring-after($condition-pos-str,$div-value)"/> + <xsl:with-param name="last-value" select="$end-value"/> + <xsl:with-param name="div-value" select="$div-value"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$end-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="break-row-beyond-max"> + <xsl:param name="pos"/> + <xsl:param name="last-value"/> + <xsl:param name="count-value"/> + <xsl:variable name="pre-value" select="./表:分页符集/表:分页符[@表:列号 and (position() = $pos)]/@表:列号"/> + <xsl:variable name="end-value"> + <xsl:choose> + <xsl:when test="$last-value < $pre-value"> + <xsl:value-of select="$pre-value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$last-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$pos < $count-value"> + <xsl:call-template name="break-row-beyond-max"> + <xsl:with-param name="pos" select="$pos + 1"/> + <xsl:with-param name="last-value" select="$end-value"/> + <xsl:with-param name="count-value" select="$count-value"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$end-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-row-beyond-last"> + <xsl:param name="index-value"/> + <xsl:param name="worksheetNo"/> + <xsl:param name="condition-pos-str"/> + <xsl:param name="end-pos"/> + <xsl:param name="total-col"/> + <xsl:variable name="current" select="concat('R',$index-value)"/> + <xsl:element name="table:table-row"> + <xsl:choose> + <xsl:when test="./表:分页符集/表:分页符/@行号 = ($index-value - 1)"> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$worksheetNo)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$worksheetNo)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$current)"> + <xsl:call-template name="get-cell-span-in"> + <xsl:with-param name="row-pos" select="$index-value"/> + <xsl:with-param name="c-start" select="1"/> + <xsl:with-param name="c-end" select="$total-col"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="$index-value < ($end-pos + 1)"> + <xsl:call-template name="get-row-beyond-last"> + <xsl:with-param name="index-value" select="$index-value + 1"/> + <xsl:with-param name="worksheetNo" select="$worksheetNo"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="end-pos" select="$end-pos"/> + <xsl:with-param name="total-col" select="$total-col"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="get-cell-span-in"> + <xsl:param name="row-pos"/> + <xsl:param name="c-start"/> + <xsl:param name="c-end"/> + <xsl:param name="condition-pos-str"/> + <xsl:variable name="current" select="concat('R',$row-pos,'C',$c-start,',')"/> + <xsl:variable name="style-name"> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$current)"> + <xsl:variable name="temp-str"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current)"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($temp-str, 'c')"> + <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/> + </xsl:when> + <xsl:when test="starts-with($temp-str, 'v')"> + <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="../表:单元格[position() = position() - 1]/@表:式样引用"> + <xsl:value-of select="../表:单元格[position() = position() - 1]/@表:式样引用 "/> + </xsl:when> + <xsl:when test="../@表:式样引用"> + <xsl:value-of select="../@表:式样引用"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'Default'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$c-start < $c-end"> + <xsl:call-template name="get-cell-condition-in"> + <xsl:with-param name="style-name" select="$style-name"/> + </xsl:call-template> + <xsl:call-template name="get-cell-span-in"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="c-start" select="$c-start + 1"/> + <xsl:with-param name="c-end" select="$c-end"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$c-start = $c-end"> + <xsl:call-template name="get-cell-condition-in"> + <xsl:with-param name="style-name" select="$style-name"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-cell-condition-in"> + <xsl:param name="style-name"/> + <xsl:element name="table:table-cell"> + <xsl:if test="not( contains($style-name, 'Default'))"> + <xsl:choose> + <xsl:when test="starts-with($style-name, 'val')"> + <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$style-name"/></xsl:attribute> + </xsl:when> + <xsl:when test="starts-with($style-name, 'ce')"> + <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!--chengxiuzhi0617 单元格--> + </xsl:element> + </xsl:template> + <xsl:key match="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:分页符集/表:分页符[@表:列号]" name="ColBreak" use="Column"/> + <xsl:template name="create-default-column"> + <xsl:param name="currentColumn"/> + <xsl:param name="currentColumnNode"/> + <xsl:param name="worksheetNo"/> + <xsl:element name="table:table-column"> + <xsl:attribute name="table:default-cell-style-name"><xsl:call-template name="get-default-cell-style"><xsl:with-param name="currentColumnNode" select="$currentColumnNode"/></xsl:call-template></xsl:attribute> + <xsl:choose> + <xsl:when test="key('ColBreak', $currentColumn)"> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co',$worksheetNo)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!--chengxiuzhi0617用key就错--> + </xsl:element> + </xsl:template> + <xsl:template name="get-default-cell-style"> + <xsl:param name="currentColumnNode"/> + <xsl:choose> + <xsl:when test="$currentColumnNode"> + <xsl:choose> + <xsl:when test="$currentColumnNode/@表:式样引用"> + <xsl:value-of select="$currentColumnNode/@表:式样引用"/> + </xsl:when> + <xsl:otherwise>Default</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./表:工作表内容[@表:式样引用]"> + <xsl:value-of select="./表:工作表内容/@表:式样引用"/> + </xsl:when> + <xsl:otherwise>Default</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="表:行" mode="selected"> + <xsl:param name="row-pos"/> + <xsl:param name="condition-pos-str"/> + <xsl:choose> + <xsl:when test="表:单元格"> + <xsl:apply-templates select="表:单元格[1]" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'C'"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="col-pos-before" select="0"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="current" select="concat('R',$row-pos,'C')"/> + <xsl:choose> + <xsl:when test="contains($condition-pos-str,$current)"> + <xsl:call-template name="get-cell-span-in"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="c-start" select="1"/> + <xsl:with-param name="c-end"> + <xsl:call-template name="condition-row-col-pos-max"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="last-value" select="0"/> + <xsl:with-param name="div-value" select="'C'"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos" select="1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <table:table-cell/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="表:单元格" mode="selected"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos-before"/> + <xsl:param name="row-pos"/> + <xsl:param name="col-repeated" select="1"/> + <xsl:variable name="col-pos"> + <xsl:choose> + <xsl:when test="@表:列号"> + <xsl:choose> + <xsl:when test="@表:合并列数"> + <xsl:value-of select="@表:合并列数 + @表:列号"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@表:列号"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@表:合并列数"> + <xsl:value-of select="1 + @表:合并列数 + $col-pos-before"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="1 + $col-pos-before"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="next-cell" select="following-sibling::表:单元格[1]"/> + <xsl:variable name="maodian" select="boolean($next-cell/uof:锚点)"/> + <xsl:variable name="cell-is-repeatable" select="not(current()/*) and not($next-cell/*) and not($next-cell/text()) and (@表:式样引用 = $next-cell/@表:式样引用) and not($next-cell/@表:列号)"/> + <xsl:if test="$col-repeated = 1"> + <xsl:if test="@表:列号 != ($col-pos-before + 1)"> + <xsl:call-template name="get-cell-span-in"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="c-start" select="$col-pos-before + 1"/> + <xsl:with-param name="c-end" select="@表:列号 - 1"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:if> + <xsl:element name="table:table-cell"> + <xsl:call-template name="create-table-cell-attributes"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos" select="$col-pos"/> + <xsl:with-param name="row-pos" select="$row-pos"/> + </xsl:call-template> + <xsl:if test="$cell-is-repeatable"> + <xsl:apply-templates select="$next-cell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-before" select="$col-pos + 1"/> + <xsl:with-param name="col-repeated" select="$col-repeated + 1"/> + </xsl:apply-templates> + </xsl:if> + <xsl:call-template name="create-table-cell-content"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos" select="$col-pos"/> + <xsl:with-param name="row-pos" select="$row-pos"/> + </xsl:call-template> + </xsl:element> + <xsl:if test="@表:合并列数"> + <xsl:element name="table:covered-table-cell"> + <xsl:if test="@表:合并列数 > 1"> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="@表:合并列数"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:if> + <xsl:choose> + <xsl:when test="not($cell-is-repeatable and $col-repeated = 1)"> + <xsl:choose> + <xsl:when test="not($cell-is-repeatable) and $col-repeated > 1"> + <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$col-repeated"/></xsl:attribute> + </xsl:when> + <xsl:when test="not($next-cell)"> + <xsl:if test="../../../../../表:公用处理规则/表:条件格式化集/表:条件格式化"> + <xsl:call-template name="get-cell-span-in"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="c-start" select="$col-pos"/> + <xsl:with-param name="c-end" select="$col-pos-max"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:when test="not($cell-is-repeatable)"> + <xsl:apply-templates select="$next-cell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-before" select="$col-pos"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$next-cell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-before" select="$col-pos"/> + <xsl:with-param name="col-repeated" select="$col-repeated + 1"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$next-cell"> + <xsl:apply-templates select="$next-cell" mode="skip"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-before" select="$col-pos"/> + </xsl:apply-templates> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--Redoffice comment liliang sc0012 06.02.15--> + <!--新增内容--> + <xsl:template match="uof:锚点"> + <xsl:variable name="tuxing1" select="@uof:图形引用"/> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]"> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='ipg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif'"> + <xsl:element name="draw:frame"> + <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::uof:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:for-each> + <xsl:element name="draw:image"> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"> + <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符= $tuxing1]/uof:路径"/></xsl:attribute> + </xsl:if> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"> + <office:binary-data> + <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"/> + </office:binary-data> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:when> + <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:文本内容[@图:文本框='true']"> + <draw:text-box text:anchor-type="paragraph"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:if test="@uof:x坐标"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@uof:y坐标"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:z-index"><xsl:value-of select="/uof:UOF/uof:对象集/图:图形/@图:层次"/></xsl:attribute> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:段落"/> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:文字表"/> + </draw:text-box> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"/> + <xsl:with-param name="groupx" select="0"/> + <xsl:with-param name="groupy" select="0"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="graph"> + <xsl:param name="id"/> + <xsl:param name="groupx"/> + <xsl:param name="groupy"/> + <xsl:for-each select="$id"> + <xsl:variable name="tuxing1"> + <xsl:value-of select="图:预定义图形/图:类别"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$tuxing1='11'"> + <xsl:call-template name="Rectangle"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='19'"> + <xsl:call-template name="Oval"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='61'"> + <xsl:call-template name="Line"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='64'"> + <xsl:call-template name="Curve"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='65'"> + <xsl:call-template name="Freeform"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='66'"> + <xsl:call-template name="Scribble"> + <xsl:with-param name="groupx1" select="$groupx"/> + <xsl:with-param name="groupy1" select="$groupy"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$tuxing1='4'"> + <xsl:element name="draw:g"> + <xsl:variable name="tu"> + <xsl:value-of select="@图:标识符"/> + </xsl:variable> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$tu"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:variable name="this-group-x"> + <xsl:choose> + <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:x坐标"> + <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:x坐标"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="number(0)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="this-group-y"> + <xsl:choose> + <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:y坐标"> + <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:y坐标"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="number(0)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="group-x"> + <xsl:value-of select="number($groupx + $this-group-x)"/> + </xsl:variable> + <xsl:variable name="group-y"> + <xsl:value-of select="number($groupy + $this-group-y)"/> + </xsl:variable> + <xsl:call-template name="组合图形"> + <xsl:with-param name="zuheliebiao" select="@图:组合列表"/> + <xsl:with-param name="groupx1" select="$group-x"/> + <xsl:with-param name="groupy1" select="$group-y"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="common"> + <xsl:param name="groupx"/> + <xsl:param name="groupy"/> + <xsl:variable name="tuxing"> + <xsl:value-of select="@图:标识符"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:x坐标"> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)"> + <xsl:if test="@uof:x坐标"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@uof:y坐标"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:variable name="tuxing1" select="@uof:图形引用"/> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="zuheweizhi-x"> + <xsl:value-of select="图:组合位置/@图:x坐标"/> + </xsl:variable> + <xsl:variable name="zuheweizhi-y"> + <xsl:value-of select="图:组合位置/@图:y坐标"/> + </xsl:variable> + <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(($groupx + $zuheweizhi-x),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(($groupy + $zuheweizhi-y),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(图:预定义图形/图:属性 /图:高度,$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:template> + <xsl:template name="组合图形"> + <xsl:param name="zuheliebiao"/> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:variable name="x"> + <xsl:value-of select="$groupx1"/> + </xsl:variable> + <xsl:variable name="y"> + <xsl:value-of select="$groupy1"/> + </xsl:variable> + <xsl:variable name="first-pictures"> + <xsl:value-of select="substring-before($zuheliebiao,',')"/> + </xsl:variable> + <xsl:variable name="other-pictures"> + <xsl:value-of select="substring-after($zuheliebiao,',')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($other-pictures,',')"> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + <xsl:call-template name="组合图形"> + <xsl:with-param name="zuheliebiao" select="$other-pictures"/> + <xsl:with-param name="groupx1" select="$x"/> + <xsl:with-param name="groupy1" select="$y"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + <xsl:call-template name="graph"> + <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $other-pictures]"/> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="Curve"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:path"> + <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点坐标/@图:路径"/></xsl:attribute> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Freeform"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:polygon"> + <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Scribble"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:polyline"> + <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="drawpoints"> + <xsl:param name="points"/> + <xsl:param name="value"/> + <xsl:variable name="frist-piont"> + <xsl:value-of select="substring-before($points,'lineto')"/> + </xsl:variable> + <xsl:variable name="other-points"> + <xsl:value-of select="substring-after($points,'lineto')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($other-points,'lineto')"> + <xsl:variable name="x-coor"> + <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="y-coor"> + <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="all-points"> + <xsl:value-of select="concat($value,$x-coor,',',$y-coor,' ')"/> + </xsl:variable> + <xsl:call-template name="drawpoints"> + <xsl:with-param name="points" select="$other-points"/> + <xsl:with-param name="value" select="$all-points"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="q-x-coor"> + <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="q-y-coor"> + <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="e-x-coor"> + <xsl:value-of select="substring-before($other-points,' ') * 1000"/> + </xsl:variable> + <xsl:variable name="e-y-coor"> + <xsl:value-of select="substring-after($other-points,' ') * 1000"/> + </xsl:variable> + <xsl:value-of select="concat($value,$q-x-coor,',',$q-y-coor,' ',$e-x-coor,',',$e-y-coor)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="Oval"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:ellipse"> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Rectangle"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:rect"> + <xsl:call-template name="common"> + <xsl:with-param name="groupx" select="$groupx1"/> + <xsl:with-param name="groupy" select="$groupy1"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="Line"> + <xsl:param name="groupx1"/> + <xsl:param name="groupy1"/> + <xsl:element name="draw:line"> + <xsl:variable name="tuxing1" select="@图:标识符"/> + <xsl:choose> + <xsl:when test="key('rel_graphic_name',@图:标识符)"> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)"> + <xsl:attribute name="svg:x1"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y1"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:x2"><xsl:value-of select="concat((number(@uof:x坐标) + number(@uof:宽度)),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y2"><xsl:value-of select="concat((number(@uof:y坐标) + number(@uof:高度)),$uofUnit)"/></xsl:attribute> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="zuheweizhi-x"> + <xsl:value-of select="图:组合位置/@图:x坐标"/> + </xsl:variable> + <xsl:variable name="zuheweizhi-y"> + <xsl:value-of select="图:组合位置/@图:y坐标"/> + </xsl:variable> + <xsl:variable name="hex"> + <xsl:value-of select="concat(number($groupx1 + $zuheweizhi-x),$uofUnit)"/> + </xsl:variable> + <xsl:variable name="hey"> + <xsl:value-of select="concat(number($groupy1 + $zuheweizhi-y),$uofUnit)"/> + </xsl:variable> + <xsl:attribute name="svg:x1"><xsl:value-of select="$hex"/></xsl:attribute> + <xsl:attribute name="svg:y1"><xsl:value-of select="$hey"/></xsl:attribute> + <xsl:attribute name="svg:x2"><xsl:value-of select="concat(($hex + 图:预定义图形/图:属性/图:宽度),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y2"><xsl:value-of select="concat(($hey + 图:预定义图形/图:属性/图:高度),$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:element> + </xsl:template> + <!--Redoffice comment liliang end 06.02.15--> + <xsl:template match="表:单元格" mode="skip"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos-before"/> + <xsl:param name="row-pos"/> + <xsl:variable name="next-cell" select="following-sibling::表:单元格[1]"/> + <xsl:variable name="cell-is-repeatable" select="not($next-cell/*) and not($next-cell/text()) and (@表:式样引用 = $next-cell/@表:式样引用) and not($next-cell/@表:列号)"/> + <xsl:choose> + <xsl:when test="$cell-is-repeatable"> + <xsl:apply-templates select="$next-cell" mode="skip"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-before" select="$col-pos-before + 1"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$next-cell"> + <xsl:apply-templates select="$next-cell" mode="selected"> + <xsl:with-param name="row-pos" select="$row-pos"/> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="col-pos-max" select="$col-pos-max"/> + <xsl:with-param name="col-pos-before" select="$col-pos-before +1"/> + </xsl:apply-templates> + <!--chengxz0925 no otherwise ,some content cells missed --> + </xsl:if> + <!--chengxz 060418 add if sentence--> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--xsl:template name="create-table-cell-attributes"></xsl:template> +<xsl:template name="create-table-cell-content"></xsl:template> +<xsl:template name="create-data-content"></xsl:template> +<xsl:template name="get-condition-dependent-cell-attributes"></xsl:template--> + <xsl:template name="create-table-cell-attributes"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos"/> + <xsl:param name="row-pos"/> + <xsl:choose> + <xsl:when test="$condition-pos-str"> + <xsl:call-template name="get-condition-dependent-cell-attributes"> + <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/> + <xsl:with-param name="current-pos-str" select="concat('R',$row-pos,'C',$col-pos,',')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:choose><xsl:when test="@表:式样引用"><xsl:value-of select="@表:式样引用"/></xsl:when><xsl:when test="../@表:式样引用 and ../@表:式样引用 != ''"><xsl:value-of select="../@表:式样引用"/></xsl:when><xsl:otherwise><xsl:value-of select="'Default'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <!--chengxiuzhi--> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@表:合并列数 or @表:合并行数"> + <xsl:choose> + <xsl:when test="@表:合并列数"> + <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="@表:合并列数 + 1"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:number-columns-spanned">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@表:合并行数"> + <xsl:attribute name="table:number-rows-spanned"><xsl:value-of select="@表:合并行数+1"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:number-rows-spanned">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="表:数据"> + <xsl:if test="表:数据/表:公式"> + <xsl:variable name="calc-formula"> + <xsl:call-template name="translate-expression"> + <xsl:with-param name="cell-row-pos" select="$row-pos"/> + <xsl:with-param name="cell-column-pos" select="$col-pos"/> + <xsl:with-param name="expression" select="表:数据/表:公式"/> + <xsl:with-param name="return-value" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="table:formula"><xsl:value-of select="$calc-formula"/></xsl:attribute> + </xsl:if> + <!--RedOffice Comment from Zengjh:UOF0020 2006-04-17 Based on Original--> + <xsl:variable name="table-stylename" select="@表:式样引用"/> + <xsl:variable name="data-format"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:单元格式样"> + <xsl:if test="$table-stylename = ./@ 表:标识符"> + <xsl:value-of select="表:数字格式/@表:分类名称"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="data-formatcode"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:单元格式样"> + <xsl:if test="$table-stylename= ./@表:标识符"> + <xsl:value-of select="表:数字格式/@表:格式码"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="表:数据/@表:数据类型 = 'number'"> + <xsl:choose> + <xsl:when test="$data-format = 'percentage' or contains( $data-formatcode, '%')"> + <xsl:attribute name="office:value-type">percentage</xsl:attribute> + </xsl:when> + <xsl:when test="contains($data-format, 'currency')"> + <xsl:attribute name="office:value-type">currency</xsl:attribute> + <xsl:attribute name="office:currency">CNY</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="office:value-type">float</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="office:value"><xsl:choose><xsl:when test="表:数据/@表:数据数值"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:when><xsl:otherwise><xsl:value-of select="表:数据/字:句/字:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'date'"> + <xsl:attribute name="office:value-type">date</xsl:attribute> + <xsl:attribute name="office:date-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'time'"> + <xsl:attribute name="office:value-type">time</xsl:attribute> + <xsl:attribute name="office:time-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'boolean'"> + <xsl:attribute name="office:value-type">boolean</xsl:attribute> + <xsl:attribute name="office:boolean-value"><xsl:choose><xsl:when test="表:数据/字:句/字:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="表:数据/@表:数据类型 = 'text'"> + <xsl:attribute name="office:value-type">string</xsl:attribute> + <xsl:attribute name="office:string-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <!-- zhangying ok and /uof:UOF/uof:电子表格/表:公共处理规则/表:数据有效性集--> + <xsl:if test="表:数据"> + <xsl:variable name="validation-name"> + <xsl:call-template name="zyvalidationtest"> + <xsl:with-param name="column-num" select="$col-pos"/> + <xsl:with-param name="row-num" select="$row-pos"/> + <xsl:with-param name="table-name" select="ancestor::表:工作表/@表:名称"/> + <xsl:with-param name="validation-set" select="/uof:UOF/uof:电子表格/表:公用处理规则/表:数据有效性集/表:数据有效性"/> + <xsl:with-param name="validation-num" select="'1'"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$validation-name!=''"> + <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$validation-name"/></xsl:attribute> + </xsl:if> + </xsl:if> + <!-- zhangying mod end --> + </xsl:template> + <!-- zhangying o --> + <xsl:template name="zyvalidationtest"> + <xsl:param name="row-num"/> + <xsl:param name="column-num"/> + <xsl:param name="table-name"/> + <xsl:param name="validation-set"/> + <xsl:param name="validation-num"/> + <xsl:if test="$validation-set"> + <xsl:variable name="zone" select="$validation-set/表:区域/text()"/> + <xsl:variable name="success"> + <xsl:choose> + <xsl:when test="$table-name=substring-after(substring-before($zone,'.'),'$')"> + <xsl:variable name="validation-row-left-top" select="substring-before(substring-after(substring-after(substring-after($zone,'$'),'$'),'$'),':')"/> + <xsl:variable name="validation-row-right-bottom" select="substring-after(substring-after(substring-after($zone,':$'),'$'),'$')"/> + <xsl:choose> + <xsl:when test="($row-num >= $validation-row-left-top and $row-num <= $validation-row-right-bottom) or $validation-row-left-top=$validation-row-right-bottom"> + <xsl:variable name="validation-column-left-top"> + <xsl:call-template name="translate-column-char-to-number"> + <xsl:with-param name="string" select="substring-before(substring-after(substring-after($zone,'$'),'$'),'$')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="validation-column-right-bottom"> + <xsl:call-template name="translate-column-char-to-number"> + <xsl:with-param name="string" select="substring-before(substring-after(substring-after($zone,':$'),'$'),'$')"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="($column-num >= $validation-column-left-top) and ($column-num <= $validation-column-right-bottom)">yes</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$success='yes'"> + <xsl:value-of select="concat('val',$validation-num)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="zyvalidationtest"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="column-num" select="$column-num"/> + <xsl:with-param name="validation-set" select="$validation-set[position()!=1]"/> + <xsl:with-param name="validation-num" select="$validation-num + 1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <!--zhangying mod end --> + <xsl:template name="create-table-cell-content"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="col-pos-max"/> + <xsl:param name="col-pos"/> + <xsl:param name="row-pos"/> + <!--Redoffice comment liliang SC0011 06.02.15 --> + <!--新增内容--> + <xsl:apply-templates select="uof:锚点"/> + <!--Redoffice comment liliang end 06.02.15 --> + <xsl:apply-templates select="表:批注" mode="body"/> + <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26 charts--> + <xsl:apply-templates select="表:图表"/> + <xsl:if test="表:数据/字:句"> + <text:p> + <xsl:call-template name="create-data-content"> + <xsl:with-param name="style-id" select="../../@表:式样引用"/> + </xsl:call-template> + </text:p> + </xsl:if> + <!--chengxz0701多个句不能读入--> + </xsl:template> + <xsl:template name="create-data-content"> + <xsl:param name="style-id" select="@表:式样引用"/> + <xsl:variable name="html-children" select="表:式样引用/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/> + <xsl:choose> + <xsl:when test="$html-children and $html-children != ''"> + <xsl:for-each select="$html-children"> + <text:span text:style-name="{concat($style-id, 'T', count(preceding::表:数据/字:句/字:文本串[child::html:*]), '_', position())}"> + <xsl:copy-of select="text()"/> + </text:span> + </xsl:for-each> + </xsl:when> + <xsl:when test="@表:超链接引用"> + <text:a xlink:href="{@表:超链接引用}"> + <xsl:value-of select="表:数据/字:句/字:文本串"/> + </text:a> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="表:数据/字:句"> + <xsl:choose> + <xsl:when test="name(descendant::*[1])='字:句属性'"> + <text:span> + <xsl:attribute name="text:style-name"><xsl:value-of select="descendant::*[1]/@字:式样引用"/></xsl:attribute> + <xsl:value-of select="./字:文本串"/> + </text:span> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./字:文本串"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="create-comment-data-content"> + <xsl:param name="style-id" select="@表:式样引用"/> + <xsl:variable name="html-children" select="表:式样引用/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/> + <xsl:choose> + <xsl:when test="$html-children and $html-children != ''"> + <xsl:for-each select="$html-children"> + <text:span text:style-name="{concat($style-id, 'T', count(preceding::图:文本内容/字:段落/字:句/字:文本串[child::html:*]), '_', position())}"> + <xsl:copy-of select="text()"/> + </text:span> + </xsl:for-each> + </xsl:when> + <xsl:when test="@表:超链接引用"> + <text:a xlink:href="{@表:超链接引用}"> + <xsl:value-of select="图:文本内容/字:段落/字:句/字:文本串"/> + </text:a> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="图:文本内容/字:段落/字:句/字:文本串"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-condition-dependent-cell-attributes"> + <xsl:param name="condition-pos-str"/> + <xsl:param name="current-pos-str"/> + <xsl:variable name="temp-str"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current-pos-str)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="style-name"> + <xsl:choose> + <xsl:when test="contains($condition-pos-str, $current-pos-str) and starts-with($temp-str, 'c')"> + <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="@表:式样引用"> + <xsl:value-of select="@表:式样引用"/> + </xsl:when> + <xsl:when test="../@表:式样引用"> + <xsl:value-of select="../@表:式样引用"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'Default'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="not( contains($style-name, 'Default'))"> + <xsl:choose> + <xsl:when test="starts-with($style-name, 'val')"> + <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$style-name"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="contains($style-name, 'Default')"> + <xsl:variable name="style-nametemp"> + <xsl:choose> + <xsl:when test="@表:式样引用"> + <xsl:value-of select="@表:式样引用"/> + </xsl:when> + <xsl:when test="../@表:式样引用"> + <xsl:value-of select="../@表:式样引用"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'Default'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="table:style-name"><xsl:value-of select="$style-nametemp"/></xsl:attribute> + <!--xsl:attribute name="style:data-style-name"><xsl:value-of select="N104" /></xsl:attribute--> + </xsl:if> + <!--chengxz--> + <xsl:if test="contains($condition-pos-str, $current-pos-str)"> + <xsl:choose> + <xsl:when test="starts-with($temp-str, 'v')"> + <xsl:attribute name="table:content-validation-name"><xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="after-str" select="substring-after($condition-pos-str, $current-pos-str)"/> + <xsl:if test="contains( $after-str, $current-pos-str)"> + <xsl:variable name="temp-str-2"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-before( $after-str,$current-pos-str)"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="starts-with( $temp-str-2, 'v')"> + <xsl:attribute name="table:content-validation-name"><xsl:value-of select="concat('val', substring-after($temp-str-2, 'v'))"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="表:工作表内容"> + <xsl:variable name="default-column-width"> + <xsl:choose> + <xsl:when test="@表:缺省列宽"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(@表:缺省列宽,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:when> + <xsl:otherwise>2.096cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="table-pos"> + <xsl:value-of select="count(../preceding-sibling::表:工作表)+1"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="表:列"> + <xsl:call-template name="get-column-style-name"> + <xsl:with-param name="finishedColumns" select="0"/> + <xsl:with-param name="columnCount" select="count(./表:列)"/> + <xsl:with-param name="currentCount" select="1"/> + <xsl:with-param name="table-pos" select="$table-pos"/> + <xsl:with-param name="default-column-width" select="$default-column-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + <xsl:if test="../表:分页符集/表:分页符[@表:列号]"> + <style:style style:name="{concat('cob',$table-pos)}" style:family="table-column"> + <xsl:element name="style:table-column-properties"> + <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:element> + </style:style> + </xsl:if> + <xsl:variable name="default-row-height"> + <xsl:choose> + <xsl:when test="@表:缺省行高"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="concat(@表:缺省行高,'pt')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:when> + <xsl:otherwise>0.503cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <style:style style:family="table-row" style:name="{concat('ro', $table-pos)}"> + <style:table-row-properties style:row-height="{$default-row-height}" style:use-optimal-row-height="false"/> + </style:style> + <xsl:if test="表:行"> + <xsl:call-template name="get-row-style-name"> + <xsl:with-param name="lastrowpos" select="0"/> + <xsl:with-param name="row-count" select="count(./表:行)"/> + <xsl:with-param name="currentRow" select="1"/> + <xsl:with-param name="table-pos" select="$table-pos"/> + <xsl:with-param name="default-row-height" select="$default-row-height"/> + </xsl:call-template> + </xsl:if> + <!--RedOffice Comment from Zengjh:UOF0020 2006-06-11 charts--> + <xsl:for-each select="//表:图表"> + <xsl:variable name="chart-current"> + <xsl:number level="any" count="表:图表" format="1"/> + </xsl:variable> + <style:style style:family="graphics" style:name="{concat('chart', $chart-current)}"> + <style:graphic-properties> + <xsl:choose> + <xsl:when test="@表:随动方式='none'"> + <xsl:attribute name="draw:move-protect">true</xsl:attribute> + <xsl:attribute name="draw:size-protect">true</xsl:attribute> + </xsl:when> + <xsl:when test="@表:随动方式='move'"> + <xsl:attribute name="draw:size-protect">true</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </style:graphic-properties> + </style:style> + </xsl:for-each> + <!--RedOffice comment (Zengjh) end charts--> + <xsl:if test="../表:分页符集/表:分页符[@行号]"> + <style:style style:name="{concat('rob',$table-pos)}" style:family="table-row"> + <xsl:element name="style:table-row-properties"> + <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:element> + </style:style> + </xsl:if> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="concat( 'ta', $table-pos)"/></xsl:attribute> + <xsl:attribute name="style:family">table</xsl:attribute> + <xsl:attribute name="style:master-page-name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'TAB_',../@表:名称)"/></xsl:call-template></xsl:attribute> + <xsl:element name="style:properties"> + <xsl:choose> + <xsl:when test="../@表:隐藏 = 'true'"> + <xsl:attribute name="table:display">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:display">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="get-column-style-name"> + <xsl:param name="finishedColumns"/> + <xsl:param name="columnCount"/> + <xsl:param name="currentCount"/> + <xsl:param name="table-pos"/> + <xsl:param name="default-column-width"/> + <xsl:if test="$currentCount < ($columnCount + 1)"> + <xsl:variable name="span-value"> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:跨度"> + <xsl:value-of select="./表:跨度[position() = $currentCount]/@表:跨度 + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current-index"> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:列号"> + <xsl:value-of select="./表:列[position() = $currentCount]/@表:列号 - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$finishedColumns"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="column-break"> + <xsl:choose> + <xsl:when test="$span-value = 0"> + <xsl:if test="../表:分页符集/表:分页符/表:列 = $current-index"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="../表:分页符集/表:分页符[(@表:列号 > $finishedColumns) and (@表:列号 < ($finishedColumns + $span-value))]"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$column-break = 1"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('cob', $table-pos, '-',$currentCount)"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="style:family">table-column</xsl:attribute> + <xsl:element name="style:table-column-properties"> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:列宽"> + <xsl:attribute name="style:column-width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:列[position() = $currentCount]/@表:列宽,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:列宽 > 0"> + <xsl:attribute name="style:use-optimal-column-width">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-optimal-column-width">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:if> + <style:style style:name="{concat('co', $table-pos, '-',$currentCount)}" style:family="table-column"> + <xsl:element name="style:table-column-properties"> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:列宽"> + <xsl:attribute name="style:column-width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:列[position() = $currentCount]/@表:列宽,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">auto</xsl:attribute> + </xsl:element> + </style:style> + <xsl:if test="$currentCount < $columnCount"> + <xsl:call-template name="get-column-style-name"> + <xsl:with-param name="finishedColumns"> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:列号"> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:跨度"> + <xsl:value-of select="./表:列[position() = $currentCount]/@表:列宽 + ./表:列[position() = $currentCount]/@表:跨度"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./表:列[position() = $currentCount]/@表:列号"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./表:列[position() = $currentCount]/@表:跨度"> + <xsl:value-of select="$finishedColumns + ./表:列[position() = $currentCount]/@表:跨度 + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$finishedColumns + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="currentCount" select="$currentCount + 1"/> + <xsl:with-param name="table-pos" select="$table-pos"/> + <xsl:with-param name="default-column-width" select="$default-column-width"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:template> + <xsl:template name="get-row-style-name"> + <xsl:param name="lastrowpos"/> + <xsl:param name="row-count"/> + <xsl:param name="currentRow"/> + <xsl:param name="table-pos"/> + <xsl:param name="default-row-height"/> + <xsl:if test="$currentRow < ($row-count + 1)"> + <xsl:variable name="span-value"> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:行号"> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号 - $lastrowpos+ ./表:行[position() = $currentRow]/@表:跨度"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="./表:行[position() = $currentRow]/@表:跨度 + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current-index"> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:行号"> + <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号 - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$lastrowpos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="row-break"> + <xsl:choose> + <xsl:when test="$span-value = 0"> + <xsl:if test="../表:分页符集/表:分页符/@表:行号 = $current-index"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="../表:分页符集/表:分页符[(@表:行号 > $lastrowpos) and (@表:行号 < ($lastrowpos + $span-value))]"> + <xsl:value-of select="1"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$row-break = 1"> + <style:style style:name="{concat('rob', $table-pos, '-',$currentRow)}" style:family="table-row"> + <xsl:element name="style:table-row-properties"> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:行高"> + <xsl:attribute name="style:row-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:行[position() = $currentRow]/@表:行高,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:行高 > 0"> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:element> + </style:style> + </xsl:if> + <style:style style:name="{concat('ro', $table-pos, '-',$currentRow)}" style:family="table-row"> + <xsl:element name="style:table-row-properties"> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:行高"> + <xsl:attribute name="style:row-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:行[position() = $currentRow]/@表:行高,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:行高 > 0"> + <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:break-before">auto</xsl:attribute> + </xsl:element> + </style:style> + <xsl:if test="$currentRow < $row-count"> + <xsl:call-template name="get-row-style-name"> + <xsl:with-param name="lastrowpos"> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:行号"> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号 + ./表:行[position() = $currentRow]/@表:跨度"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="./表:行[position() = $currentRow]/@表:跨度"> + <xsl:value-of select="$lastrowpos + ./表:行[position() = $currentRow]/@表:跨度 + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$lastrowpos + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="row-count" select="$row-count"/> + <xsl:with-param name="currentRow" select="$currentRow + 1"/> + <xsl:with-param name="table-pos" select="$table-pos"/> + <xsl:with-param name="default-row-height" select="$default-row-height"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:template> + <xsl:template name="encode-as-nc-name"> + <xsl:param name="string"/> + <xsl:value-of select="translate($string, '. %()/\+', '')"/> + </xsl:template> + <xsl:key match="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/表:单元格" name="cells" use="@表:式样引用"/> + <xsl:template match="表:数字格式"> + <xsl:variable name="unit-count" select="string-length(@表:格式码) - string-length(translate(@表:格式码,';','')) + 1"/> + <xsl:variable name="style-id" select="../@表:标识符"/> + <xsl:variable name="number-format-name"> + <xsl:choose> + <xsl:when test="@表:分类名称='fraction' or @表:分类名称='scientific'">number</xsl:when> + <xsl:otherwise> + <xsl:value-of select="@表:分类名称"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="process-number-format"> + <xsl:with-param name="number-format-name" select="$number-format-name"/> + <xsl:with-param name="number-format-unit" select="@表:格式码"/> + <xsl:with-param name="style-id" select="concat($style-id,'F')"/> + <xsl:with-param name="format-type" select="key('cells', $style-id)/表:数据/@表:数据类型"/> + <xsl:with-param name="total-unit" select="$unit-count"/> + <xsl:with-param name="current-unit" select="0"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="process-number-format"> + <xsl:param name="number-format-name"/> + <xsl:param name="number-format-unit"/> + <xsl:param name="style-id"/> + <xsl:param name="format-type"/> + <xsl:param name="total-unit"/> + <xsl:param name="current-unit"/> + <xsl:choose> + <xsl:when test="$current-unit < ($total-unit -1)"> + <xsl:variable name="style-name"> + <xsl:choose> + <xsl:when test="contains(substring-before($number-format-unit,';'),'[$')">currency</xsl:when> + <xsl:when test="contains(substring-before($number-format-unit,';'),'%')">percentage</xsl:when> + <xsl:otherwise>number</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="{concat('number:',$style-name,'-style')}"> + <xsl:attribute name="style:name"><xsl:value-of select="concat( $style-id, 'P',$current-unit)"/></xsl:attribute> + <xsl:attribute name="style:volatile">true</xsl:attribute> + <xsl:call-template name="general-number"> + <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/> + </xsl:call-template> + </xsl:element> + <xsl:call-template name="process-number-format"> + <xsl:with-param name="number-format-name" select="$number-format-name"/> + <xsl:with-param name="number-format-unit" select="substring-after($number-format-unit,';')"/> + <xsl:with-param name="style-id" select="$style-id"/> + <xsl:with-param name="format-type" select="$format-type"/> + <xsl:with-param name="total-unit" select="$total-unit"/> + <xsl:with-param name="current-unit" select="$current-unit +1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:element name="{concat('number:',$number-format-name,'-style')}"> + <xsl:attribute name="style:name"><xsl:value-of select="$style-id"/></xsl:attribute> + <xsl:call-template name="element-attribute"> + <xsl:with-param name="number-format-unit" select="string($number-format-unit)"/> + </xsl:call-template> + <xsl:call-template name="general-number"> + <xsl:with-param name="number-format-unit" select="string($number-format-unit)"/> + </xsl:call-template> + <xsl:call-template name="style-map"> + <xsl:with-param name="number-format-name" select="@表:分类名称"/> + <xsl:with-param name="number-format-unit" select="@表:格式码"/> + <xsl:with-param name="style-id" select="$style-id"/> + <xsl:with-param name="format-type" select="$format-type"/> + <xsl:with-param name="total-unit" select="$total-unit"/> + <xsl:with-param name="current-unit" select="0"/> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="style-map"> + <xsl:param name="number-format-name"/> + <xsl:param name="number-format-unit"/> + <xsl:param name="style-id"/> + <xsl:param name="format-type"/> + <xsl:param name="total-unit"/> + <xsl:param name="current-unit"/> + <xsl:if test="$current-unit < ($total-unit -1)"> + <xsl:variable name="stylecondition" select="substring-after(substring-before($number-format-unit,']'),'[')"/> + <style:map style:condition="{$stylecondition}" style:apply-style-name="{concat( $style-id, 'P',$current-unit)}"/> + <xsl:call-template name="style-map"> + <xsl:with-param name="number-format-name" select="$number-format-name"/> + <xsl:with-param name="number-format-unit" select="substring-after($number-format-unit,';')"/> + <xsl:with-param name="style-id" select="$style-id"/> + <xsl:with-param name="format-type" select="$format-type"/> + <xsl:with-param name="total-unit" select="$total-unit"/> + <xsl:with-param name="current-unit" select="$current-unit +1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="general-number"> + <xsl:param name="number-format-unit"/> + <xsl:call-template name="number-format-color"> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + </xsl:call-template> + <xsl:call-template name="number-format-currency"> + <xsl:with-param name="number-format-unit" select="$number-format-unit"/> + </xsl:call-template> + <xsl:choose> + <xsl:when test="starts-with($number-format-unit,'"')"> + <number:text> + <xsl:value-of select="substring-before(substring-after($number-format-unit,'"'),'"')"/> + </number:text> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'@')"> + <number:text-content/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'-') or starts-with($number-format-unit,'$') or starts-with($number-format-unit,'¥')"> + <number:text> + <xsl:value-of select="substring($number-format-unit,1,1)"/> + </number:text> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'YYYY')"> + <number:year number:style="long"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'YY')"> + <number:year number:style="rolong"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'MMMM')"> + <number:month number:style="long" number:textual="true"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'MMM')"> + <number:month number:style="rolong" number:textual="true"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'DD')"> + <number:day number:style="long"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'D')"> + <number:day number:style="rolong"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[HH]')"> + <number:hours number:style="long"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'HH')"> + <number:hours number:style="long"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'H')"> + <number:hours/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'SS.00')"> + <number:seconds number:style="long" number:decimal-places="2"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'SS')"> + <number:seconds number:style="long"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'S')"> + <number:seconds/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'AM/PM')"> + <number:am-pm/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'NNNN')"> + <number:day-of-week number:style="long"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'NNN')"> + <number:day-of-week/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'QQ')"> + <number:quarter number:style="long"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'Q')"> + <number:quarter/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'WW')"> + <number:week-of-year/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'MM')"> + <xsl:choose> + <xsl:when test="starts-with(substring($number-format-unit,3),'S') or (starts-with(substring($number-format-unit,3),'"') and starts-with(substring-after(substring-after($number-format-unit,'"'),'"'),'S'))"> + <number:minutes number:style="long"/> + </xsl:when> + <xsl:otherwise> + <number:month number:style="long"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'M')"> + <xsl:choose> + <xsl:when test="starts-with(substring($number-format-unit,2),'S') or (starts-with(substring($number-format-unit,2),'"') and starts-with(substring-after(substring-after($number-format-unit,'"'),'"'),'S'))"> + <number:minutes/> + </xsl:when> + <xsl:otherwise> + <number:month/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'#') or starts-with($number-format-unit,'0')"> + <xsl:variable name="digits-part"> + <xsl:choose> + <xsl:when test="contains($number-format-unit,'"')"> + <xsl:value-of select="substring-before($number-format-unit,'"')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$number-format-unit"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="decimal-integer-exponent-fraction"> + <xsl:with-param name="digits-part" select="$digits-part"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + <xsl:variable name="unit-length"> + <xsl:choose> + <xsl:when test="starts-with($number-format-unit,'[value()')"> + <xsl:value-of select="string-length(substring-before($number-format-unit,']')) +2"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[NatNum')"> + <xsl:value-of select="string-length(substring-before($number-format-unit,']')) +2"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$-804]')">8</xsl:when> + <xsl:when test="starts-with($number-format-unit,'"')"> + <xsl:value-of select="string-length(substring-before(substring-after($number-format-unit,'"'),'"')) +3"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'@')">2</xsl:when> + <xsl:when test="starts-with($number-format-unit,'-') or starts-with($number-format-unit,'$') or starts-with($number-format-unit,'¥')">2</xsl:when> + <xsl:when test="starts-with($number-format-unit,'YYYY')">5</xsl:when> + <xsl:when test="starts-with($number-format-unit,'YY')">3</xsl:when> + <xsl:when test="starts-with($number-format-unit,'MMMM')">5</xsl:when> + <xsl:when test="starts-with($number-format-unit,'MMM')">4</xsl:when> + <xsl:when test="starts-with($number-format-unit,'MM')">3</xsl:when> + <xsl:when test="starts-with($number-format-unit,'M')">2</xsl:when> + <xsl:when test="starts-with($number-format-unit,'DD')">3</xsl:when> + <xsl:when test="starts-with($number-format-unit,'D')">2</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[HH]')">5</xsl:when> + <xsl:when test="starts-with($number-format-unit,'HH')">3</xsl:when> + <xsl:when test="starts-with($number-format-unit,'H')">2</xsl:when> + <xsl:when test="starts-with($number-format-unit,'SS.00')">6</xsl:when> + <xsl:when test="starts-with($number-format-unit,'SS')">3</xsl:when> + <xsl:when test="starts-with($number-format-unit,'S')">2</xsl:when> + <xsl:when test="starts-with($number-format-unit,'AM/PM')">6</xsl:when> + <xsl:when test="starts-with($number-format-unit,'NNNN')">5</xsl:when> + <xsl:when test="starts-with($number-format-unit,'NNN')">4</xsl:when> + <xsl:when test="starts-with($number-format-unit,'QQ')">3</xsl:when> + <xsl:when test="starts-with($number-format-unit,'Q')">2</xsl:when> + <xsl:when test="starts-with($number-format-unit,'WW')">3</xsl:when> + <xsl:when test="starts-with($number-format-unit,'#') or starts-with($number-format-unit,'0')"> + <xsl:choose> + <xsl:when test="contains($number-format-unit,'"')"> + <xsl:value-of select="string-length(substring-before($number-format-unit,'"')) +1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($number-format-unit) +1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$unit-length >1 and $unit-length <=string-length($number-format-unit)"> + <xsl:call-template name="general-number"> + <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="decimal-integer-exponent-fraction"> + <xsl:param name="digits-part"/> + <xsl:variable name="decimal-digits"> + <xsl:choose> + <xsl:when test="contains($digits-part,'.')"> + <xsl:choose> + <xsl:when test="contains($digits-part,' ')"> + <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),' '))"/> + </xsl:when> + <xsl:when test="contains(substring-after($digits-part,'.'),',')"> + <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),','))"/> + </xsl:when> + <xsl:when test="contains($digits-part,'E')"> + <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),'E'))"/> + </xsl:when> + <xsl:when test="contains($digits-part,'e')"> + <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),'e'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length(substring-after($digits-part,'.'))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="decimal-replacement"> + <xsl:choose> + <xsl:when test="contains($digits-part,'.')"> + <xsl:choose> + <xsl:when test="contains($digits-part,' ') and contains(substring-before(substring-after($digits-part,'.'),' '),'#')">true</xsl:when> + <xsl:when test="contains($digits-part,'E') and contains(substring-before(substring-after($digits-part,'.'),'E'),'#')">true</xsl:when> + <xsl:when test="contains($digits-part,'e') and contains(substring-before(substring-after($digits-part,'.'),'e'),'#')">true</xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="contains(substring-after($digits-part,'.'),'#')">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="integer-digits"> + <xsl:choose> + <xsl:when test="contains($digits-part,'.')"> + <xsl:value-of select="string-length(substring-before($digits-part,'.')) - string-length(translate(substring-before($digits-part,'.'),'0',''))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($digits-part) - string-length(translate($digits-part,'0',''))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="factor-digits"> + <xsl:call-template name="display-factor-digits"> + <xsl:with-param name="digits-part" select="$digits-part"/> + <xsl:with-param name="count" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="grouping"> + <xsl:choose> + <xsl:when test="(string-length($digits-part) - string-length(translate($digits-part,',',''))) >$factor-digits">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="exponent-digits"> + <xsl:choose> + <xsl:when test="contains($digits-part,'E')"> + <xsl:value-of select="string-length(substring-after($digits-part,'E')) -1"/> + </xsl:when> + <xsl:when test="contains($digits-part,'e')"> + <xsl:value-of select="string-length(substring-after($digits-part,'e')) -1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="numerator-digits"> + <xsl:choose> + <xsl:when test="contains($digits-part,' ')"> + <xsl:value-of select="string-length(substring-before(substring-after($digits-part,' '),'/'))"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="denominator-digits"> + <xsl:choose> + <xsl:when test="contains($digits-part,' ')"> + <xsl:value-of select="string-length(substring-after(substring-after($digits-part,' '),'/'))"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="number-type"> + <xsl:choose> + <xsl:when test="$exponent-digits >0">number:scientific-number</xsl:when> + <xsl:when test="($numerator-digits >0) or ($denominator-digits >0)">number:fraction</xsl:when> + <xsl:otherwise>number:number</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="{$number-type}"> + <xsl:if test="$decimal-digits >=0"> + <xsl:attribute name="number:decimal-places"><xsl:value-of select="$decimal-digits"/></xsl:attribute> + </xsl:if> + <xsl:if test="$decimal-replacement='true'"> + <xsl:attribute name="number:decimal-replacement"/> + </xsl:if> + <xsl:if test="$integer-digits >=0"> + <xsl:attribute name="number:min-integer-digits"><xsl:value-of select="$integer-digits"/></xsl:attribute> + </xsl:if> + <xsl:if test="$grouping='true'"> + <xsl:attribute name="number:grouping"><xsl:value-of select="$grouping"/></xsl:attribute> + </xsl:if> + <xsl:if test="$factor-digits >0"> + <xsl:attribute name="number:display-factor"><xsl:choose><xsl:when test="$factor-digits=1">1000</xsl:when><xsl:when test="$factor-digits=2">1000000</xsl:when><xsl:when test="$factor-digits=3">1000000000</xsl:when><xsl:when test="$factor-digits=4">1000000000000</xsl:when><xsl:when test="$factor-digits=5">1000000000000000</xsl:when><xsl:when test="$factor-digits=6">1000000000000000000</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="$exponent-digits >0"> + <xsl:attribute name="number:min-exponent-digits"><xsl:value-of select="$exponent-digits"/></xsl:attribute> + </xsl:if> + <xsl:if test="$numerator-digits >0"> + <xsl:attribute name="number:min-numerator-digits"><xsl:value-of select="$numerator-digits"/></xsl:attribute> + </xsl:if> + <xsl:if test="$denominator-digits >0"> + <xsl:attribute name="number:min-denominator-digits"><xsl:value-of select="$denominator-digits"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="number-format-color"> + <xsl:param name="number-format-unit"/> + <xsl:choose> + <xsl:when test="starts-with($number-format-unit,'[Black]')"> + <style:text-properties fo:color="#000000"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Blue]')"> + <style:text-properties fo:color="#0000ff"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Cyan]')"> + <style:text-properties fo:color="#00ffff"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Green]')"> + <style:text-properties fo:color="#00ff00"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Magenta]')"> + <style:text-properties fo:color="#ff00ff"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Red]')"> + <style:text-properties fo:color="#ff0000"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[White]')"> + <style:text-properties fo:color="#ffffff"/> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Yellow]')"> + <style:text-properties fo:color="#ffff00"/> + </xsl:when> + </xsl:choose> + <xsl:variable name="unit-length"> + <xsl:choose> + <xsl:when test="starts-with($number-format-unit,'[Black]')">8</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Blue]')">7</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Cyan]')">7</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Green]')">8</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Magenta]')">10</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Red]')">6</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[White]')">8</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[Yellow]')">9</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$unit-length >1 and $unit-length <=string-length($number-format-unit)"> + <xsl:call-template name="general-number"> + <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="number-format-currency"> + <xsl:param name="number-format-unit"/> + <xsl:choose> + <xsl:when test="starts-with($number-format-unit,'[$¥-804]')"> + <number:currency-symbol number:language="zh" number:country="CN">¥</number:currency-symbol> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$$-409]')"> + <number:currency-symbol number:language="en" number:country="US">$</number:currency-symbol> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$$-2C0A]')"> + <number:currency-symbol number:language="es" number:country="AR">$</number:currency-symbol> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$$-C0C]')"> + <number:currency-symbol number:language="fr" number:country="CA">$</number:currency-symbol> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$CNY]')"> + <number:currency-symbol>CNY</number:currency-symbol> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$AFA]')"> + <number:currency-symbol>AFA</number:currency-symbol> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'CNY')"> + <number:currency-symbol>CNY</number:currency-symbol> + </xsl:when> + <xsl:when test="starts-with($number-format-unit,'CCC')"> + <number:currency-symbol>CCC</number:currency-symbol> + </xsl:when> + </xsl:choose> + <xsl:variable name="unit-length"> + <xsl:choose> + <xsl:when test="starts-with($number-format-unit,'[$¥-804]')">9</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$$-409]')">9</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$$-2C0A]')">10</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$$-C0C]')">9</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$CNY]')">7</xsl:when> + <xsl:when test="starts-with($number-format-unit,'[$AFA]')">7</xsl:when> + <xsl:when test="starts-with($number-format-unit,'CNY')">4</xsl:when> + <xsl:when test="starts-with($number-format-unit,'CCC')">4</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$unit-length >1 and $unit-length <=string-length($number-format-unit)"> + <xsl:call-template name="general-number"> + <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="display-factor-digits"> + <xsl:param name="digits-part"/> + <xsl:param name="count"/> + <xsl:choose> + <xsl:when test="not(substring($digits-part,string-length($digits-part),1) =',')"> + <xsl:value-of select="$count"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="display-factor-digits"> + <xsl:with-param name="digits-part" select="substring($digits-part,1,string-length($digits-part) -1)"/> + <xsl:with-param name="count" select="$count +1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="element-attribute"> + <xsl:param name="number-format-unit"/> + <xsl:if test="contains($number-format-unit,'[HH]')"> + <xsl:attribute name="number:truncate-on-overflow">false</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum1]')"> + <xsl:attribute name="number:transliteration-format">一</xsl:attribute> + <xsl:attribute name="number:transliteration-style">short</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum2]')"> + <xsl:attribute name="number:transliteration-format">壹</xsl:attribute> + <xsl:attribute name="number:transliteration-style">short</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum3]')"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-style">short</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum4]')"> + <xsl:attribute name="number:transliteration-format">一</xsl:attribute> + <xsl:attribute name="number:transliteration-style">long</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum5]')"> + <xsl:attribute name="number:transliteration-format">壹</xsl:attribute> + <xsl:attribute name="number:transliteration-style">long</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum6]')"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-style">long</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum7]')"> + <xsl:attribute name="number:transliteration-format">一</xsl:attribute> + <xsl:attribute name="number:transliteration-style">medium</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum8]')"> + <xsl:attribute name="number:transliteration-format">壹</xsl:attribute> + <xsl:attribute name="number:transliteration-style">medium</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with($number-format-unit,'[NatNum0]')"> + <xsl:attribute name="number:transliteration-format">1</xsl:attribute> + <xsl:attribute name="number:transliteration-style">short</xsl:attribute> + </xsl:if> + <xsl:if test="contains($number-format-unit,'[$-804]')"> + <xsl:attribute name="number:transliteration-language">zh</xsl:attribute> + <xsl:attribute name="number:transliteration-country">CN</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:key name="pz" match="/uof:UOF/uof:对象集/图:图形" use="@图:标识符"/> + <xsl:template match="表:批注" mode="body"> + <xsl:element name="office:annotation"> + <xsl:if test="@表:是否显示 = 'true'"> + <xsl:attribute name="office:display">true</xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:style-name"><xsl:value-of select="uof:锚点/@uof:图形引用"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(uof:锚点/@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(uof:锚点/@uof:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(uof:锚点/@uof:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(uof:锚点/@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:variable name="w"> + <xsl:value-of select="./uof:锚点/@uof:图形引用"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="key('pz',$w)/图:文本内容/字:句/字:文本串"> + <text:p> + <xsl:for-each select="key('pz',$w)/图:文本内容/字:句"> + <text:span> + <xsl:if test="字:句属性/@字:式样引用"> + <xsl:attribute name="text:style-name"><xsl:value-of select="字:句属性/@字:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:value-of select="字:文本串"/> + </text:span> + </xsl:for-each> + </text:p> + </xsl:when> + </xsl:choose> + <!--xsl:if test="图:文本内容/字:段落/字:句/字:文本串"> + <text:p> + <xsl:call-template name="create-comment-data-content"> + <xsl:with-param name="style-id" select="../@表:式样引用"/> + </xsl:call-template> + </text:p> + </xsl:if--> + </xsl:element> + </xsl:template> + <xsl:template name="auto-filter-condition"> + <xsl:param name="condition-set"/> + <xsl:param name="zone-left-column-num"/> + <xsl:if test="$condition-set"> + <xsl:variable name="first-condition" select="$condition-set[1]"/> + <xsl:element name="table:filter-condition"> + <xsl:attribute name="table:field-number"><xsl:value-of select="$first-condition/@表:列号 - $zone-left-column-num"/></xsl:attribute> + <xsl:attribute name="office:value"><xsl:choose><xsl:when test="$first-condition/表:普通"><xsl:value-of select="$first-condition/表:普通/@表:值"/></xsl:when><xsl:when test="$first-condition/表:自定义"><xsl:value-of select="$first-condition/表:自定义/表:操作条件/表:值"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:variable name="operator"> + <xsl:choose> + <xsl:when test="$first-condition/表:普通"> + <xsl:variable name="general" select="$first-condition/表:普通/@表:类型"/> + <xsl:choose> + <xsl:when test="$general ='topitem'">top values</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-condition/表:自定义"> + <xsl:variable name="operator-text" select="$first-condition/表:自定义/表:操作条件/表:操作码/text()"/> + <xsl:choose> + <xsl:when test="$operator-text ='less than'"><</xsl:when> + <xsl:when test="$operator-text ='greater than'">></xsl:when> + <xsl:when test="$operator-text ='equal to'"> + <xsl:value-of select="'='"/> + </xsl:when> + <xsl:when test="$operator-text ='greater than or equal to'"> + <xsl:value-of select="'>='"/> + </xsl:when> + <xsl:when test="$operator-text ='less than or equal to'"> + <xsl:value-of select="'<='"/> + </xsl:when> + <xsl:when test="$operator-text ='not equal to'"> + <xsl:value-of select="'!='"/> + </xsl:when> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="table:operator"><xsl:value-of select="$operator"/></xsl:attribute> + </xsl:element> + <xsl:call-template name="auto-filter-condition"> + <xsl:with-param name="condition-set" select="$condition-set[position()!=1]"/> + <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="translate-column-char-to-number"> + <xsl:param name="string"/> + <xsl:choose> + <xsl:when test="string-length($string)=1"> + <xsl:call-template name="char-to-number"> + <xsl:with-param name="char" select="$string"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="tens-place"> + <xsl:call-template name="char-to-number"> + <xsl:with-param name="char" select="substring($string,1,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="units-place"> + <xsl:call-template name="char-to-number"> + <xsl:with-param name="char" select="substring($string,2,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$tens-place * 26 + $units-place"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="char-to-number"> + <xsl:param name="char"/> + <xsl:choose> + <xsl:when test="$char='A'">1</xsl:when> + <xsl:when test="$char='B'">2</xsl:when> + <xsl:when test="$char='C'">3</xsl:when> + <xsl:when test="$char='D'">4</xsl:when> + <xsl:when test="$char='E'">5</xsl:when> + <xsl:when test="$char='F'">6</xsl:when> + <xsl:when test="$char='G'">7</xsl:when> + <xsl:when test="$char='H'">8</xsl:when> + <xsl:when test="$char='I'">9</xsl:when> + <xsl:when test="$char='J'">10</xsl:when> + <xsl:when test="$char='K'">11</xsl:when> + <xsl:when test="$char='L'">12</xsl:when> + <xsl:when test="$char='M'">13</xsl:when> + <xsl:when test="$char='N'">14</xsl:when> + <xsl:when test="$char='O'">15</xsl:when> + <xsl:when test="$char='P'">16</xsl:when> + <xsl:when test="$char='Q'">17</xsl:when> + <xsl:when test="$char='R'">18</xsl:when> + <xsl:when test="$char='S'">19</xsl:when> + <xsl:when test="$char='T'">20</xsl:when> + <xsl:when test="$char='U'">21</xsl:when> + <xsl:when test="$char='V'">22</xsl:when> + <xsl:when test="$char='W'">23</xsl:when> + <xsl:when test="$char='X'">24</xsl:when> + <xsl:when test="$char='Y'">25</xsl:when> + <xsl:when test="$char='Z'">26</xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-expression2"> + <xsl:param name="expression2"/> + <xsl:choose> + <xsl:when test="contains($expression2,':')"> + <xsl:variable name="column-one"> + <xsl:value-of select="substring(substring-before($expression2,':'),1,1)"/> + </xsl:variable> + <xsl:variable name="row-one"> + <xsl:value-of select="substring(substring-before($expression2,':'),2)"/> + </xsl:variable> + <xsl:variable name="column-two"> + <xsl:value-of select="substring(substring-after($expression2,':'),1,1)"/> + </xsl:variable> + <xsl:variable name="row-two"> + <xsl:value-of select="substring(substring-after($expression2,':'),2)"/> + </xsl:variable> + <xsl:variable name="column-value1"> + <xsl:call-template name="character-to-column"> + <xsl:with-param name="column-value" select="$column-one"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-value2"> + <xsl:call-template name="character-to-column"> + <xsl:with-param name="column-value" select="$column-two"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat('R',$row-one,'C',$column-value1,':','R',$row-two,'C',$column-value2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="column-one"> + <xsl:value-of select="substring($expression2,1,1)"/> + </xsl:variable> + <xsl:variable name="row-one"> + <xsl:value-of select="substring($expression2,2)"/> + </xsl:variable> + <xsl:variable name="column-value1"> + <xsl:call-template name="character-to-column"> + <xsl:with-param name="column-value" select="$column-one"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat('R',$row-one,'C',$column-value1)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="character-to-column"> + <xsl:param name="column-value"/> + <xsl:choose> + <xsl:when test="$column-value= 'A'">1</xsl:when> + <xsl:when test="$column-value= 'B'">2</xsl:when> + <xsl:when test="$column-value= 'C'">3</xsl:when> + <xsl:when test="$column-value= 'D'">4</xsl:when> + <xsl:when test="$column-value= 'E'">5</xsl:when> + <xsl:when test="$column-value= 'F'">6</xsl:when> + <xsl:when test="$column-value= 'G'">7</xsl:when> + <xsl:when test="$column-value= 'H'">8</xsl:when> + <xsl:when test="$column-value= 'I'">9</xsl:when> + <xsl:when test="$column-value= 'J'">10</xsl:when> + <xsl:when test="$column-value= 'K'">11</xsl:when> + <xsl:when test="$column-value= 'L'">12</xsl:when> + <xsl:when test="$column-value= 'M'">13</xsl:when> + <xsl:when test="$column-value= 'N'">14</xsl:when> + <xsl:when test="$column-value= 'O'">15</xsl:when> + <xsl:when test="$column-value= 'P'">16</xsl:when> + <xsl:when test="$column-value= 'Q'">17</xsl:when> + <xsl:when test="$column-value= 'R'">18</xsl:when> + <xsl:when test="$column-value= 'S'">19</xsl:when> + <xsl:when test="$column-value= 'T'">20</xsl:when> + <xsl:when test="$column-value= 'U'">21</xsl:when> + <xsl:when test="$column-value= 'V'">22</xsl:when> + <xsl:when test="$column-value= 'W'">23</xsl:when> + <xsl:when test="$column-value= 'X'">24</xsl:when> + <xsl:when test="$column-value= 'Y'">25</xsl:when> + <xsl:when test="$column-value= 'Z'">26</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <!--chenjh end 20050611--> + <xsl:template name="工作表属性"> + <!--office:settings--> + <xsl:variable name="sheetprop" select="/uof:UOF/uof:电子表格/表:主体/表:工作表"/> + <config:config-item-set config:name="ooo:view-settings"> + <xsl:variable name="ratio" select="15"/> + <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/表:单元格/表:数据/字:句/字:修订开始"> + <config:config-item-set config:name="TrackedChangesViewSettings"> + <config:config-item config:name="ShowChanges" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowAcceptedChanges" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowRejectedChanges" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowChangesByDatetime" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowChangesByDatetimeMode" config:type="short">0</config:config-item> + <config:config-item config:name="ShowChangesByDatetimeFirstDatetime" config:type="datetime">2007-01-17T10:56:46.21</config:config-item> + <config:config-item config:name="ShowChangesByDatetimeSecondDatetime" config:type="datetime">2007-01-17T10:56:46.21</config:config-item> + <config:config-item config:name="ShowChangesByAuthor" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowChangesByAuthorName" config:type="string"/> + <config:config-item config:name="ShowChangesByComment" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowChangesByCommentText" config:type="string"/> + <config:config-item config:name="ShowChangesByRanges" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowChangesByRangesList" config:type="string"/> + </config:config-item-set> + </xsl:if> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">View1</config:config-item> + <config:config-item-map-named config:name="Tables"> + <xsl:for-each select="$sheetprop/表:工作表属性/表:视图"> + <xsl:element name="config:config-item-map-entry"> + <xsl:attribute name="config:name"><xsl:value-of select="ancestor::表:工作表/@表:名称"/></xsl:attribute> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">HorizontalSplitMode</xsl:attribute> + <xsl:attribute name="config:type">short</xsl:attribute> + <xsl:choose> + <xsl:when test="表:冻结 and 表:冻结/@表:列号!=0">2</xsl:when> + <xsl:when test="表:冻结 and 表:冻结/@表:列号=0">0</xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:宽度!=0">1</xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:宽度=0">0</xsl:when> + </xsl:choose> + </xsl:element> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">VerticalSplitMode</xsl:attribute> + <xsl:attribute name="config:type">short</xsl:attribute> + <xsl:choose> + <xsl:when test="表:冻结 and 表:冻结/@表:行号!=0">2</xsl:when> + <xsl:when test="表:冻结 and 表:冻结/@表:行号=0">0</xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:高度!=0">1</xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:高度=0">0</xsl:when> + </xsl:choose> + </xsl:element> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">HorizontalSplitPosition</xsl:attribute> + <xsl:attribute name="config:type">int</xsl:attribute> + <xsl:choose> + <xsl:when test="表:冻结 and 表:冻结/@表:列号=0">0</xsl:when> + <xsl:when test="表:冻结 and 表:冻结/@表:列号!=0"> + <xsl:value-of select="表:冻结/@表:列号"/> + </xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:宽度=0">0</xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:宽度!=0"> + <xsl:value-of select="表:拆分/@表:宽度"/> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">VerticalSplitPosition</xsl:attribute> + <xsl:attribute name="config:type">int</xsl:attribute> + <xsl:choose> + <xsl:when test="表:冻结 and 表:冻结/@表:行号=0">0</xsl:when> + <xsl:when test="表:冻结 and 表:冻结/@表:行号!=0"> + <xsl:value-of select="表:冻结/@表:行号"/> + </xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:高度=0">0</xsl:when> + <xsl:when test="表:拆分 and 表:拆分/@表:高度!=0"> + <xsl:value-of select="表:拆分/@表:高度"/> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:variable name="position-top"> + <xsl:choose> + <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:最上行"> + <xsl:value-of select="//表:工作表属性/表:视图/表:最上行"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="position-left"> + <xsl:choose> + <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:最左列"> + <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:最左列"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <config:config-item config:name="PositionRight" config:type="int"> + <xsl:value-of select="$position-left"/> + </config:config-item> + <config:config-item config:name="PositionBottom" config:type="int"> + <xsl:value-of select="$position-top"/> + </config:config-item> + </xsl:element> + </xsl:for-each> + </config:config-item-map-named> + <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:当前视图"> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">ShowPageBreakPreview</xsl:attribute> + <xsl:attribute name="config:type">boolean</xsl:attribute> + <xsl:choose> + <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:当前视图/@表:类型='normal'">false</xsl:when> + <xsl:otherwise>true</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:网格"> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">ShowGrid</xsl:attribute> + <xsl:attribute name="config:type">boolean</xsl:attribute> + <xsl:choose> + <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:网格/@表:值=1 or $sheetprop/表:工作表属性/表:视图/表:网格/@表:值='true'">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:网格颜色"> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">GridColor</xsl:attribute> + <xsl:attribute name="config:type">long</xsl:attribute> + <xsl:call-template name="transform-hex-to-decimal"> + <xsl:with-param name="number" select="//表:视图/表:网格颜色/text()"/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:选中"> + <xsl:element name="config:config-item"> + <xsl:attribute name="config:name">ActiveTable</xsl:attribute> + <xsl:attribute name="config:type">string</xsl:attribute> + <xsl:value-of select="$sheetprop/表:工作表属性/表:视图[表:选中]/ancestor::表:工作表/@表:名称"/> + </xsl:element> + </xsl:if> + <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:缩放"> + <config:config-item config:name="ZoomValue" config:type="int"> + <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:缩放/text()"/> + </config:config-item> + </xsl:if> + <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:分页缩放"> + <config:config-item config:name="PageViewZoomValue" config:type="int"> + <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:分页缩放/text()"/> + </config:config-item> + </xsl:if> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + </xsl:template> + <xsl:template name="create-page-master"> + <xsl:param name="worksheetoptions"/> + <xsl:for-each select="$worksheetoptions"> + <xsl:element name="style:page-layout"> + <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'pm_', ../@表:名称)"/></xsl:call-template></xsl:attribute> + <xsl:element name="style:page-layout-properties"> + <xsl:if test="表:页面设置/表:纸张/@uof:宽度"> + <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(表:页面设置/表:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:页面设置/表:纸张/@uof:高度"> + <xsl:attribute name="fo:page-height"><xsl:value-of select="concat(表:页面设置/表:纸张/@uof:高度,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:页面设置/表:纸张方向"> + <xsl:attribute name="style:print-orientation"><xsl:value-of select="表:页面设置/表:纸张方向"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:页面设置/表:缩放"> + <xsl:attribute name="style:scale-to"><xsl:value-of select="concat(表:页面设置/表:缩放,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/@表:背景"> + <xsl:attribute name="fo:background-color"><xsl:value-of select="/uof:UOF/uof:电子表格/表:主体/表:工作表/@表:背景"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="style:first-page-number">continue</xsl:attribute> + <xsl:if test="表:页面设置/表:页边距"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:上,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:下,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:左,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:右,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:页面设置/表:打印/@表:先列后行='true'"> + <xsl:attribute name="style:print-page-order">ltr</xsl:attribute> + </xsl:if> + <xsl:if test="表:页面设置/表:垂直对齐/@表:对齐方式"> + <xsl:attribute name="style:table-centering">vertical</xsl:attribute> + </xsl:if> + <xsl:if test="表:页面设置/表:水平对齐/@表:对齐方式"> + <xsl:attribute name="style:table-centering">horizontal</xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="style:header-style"> + <xsl:element name="style:header-footer-properties"> + <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute> + <xsl:choose> + <xsl:when test="表:页面设置/表:页眉页脚/@uof:边距"> + <xsl:attribute name="fo:margin-bottom"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(表:页面设置/表:页眉页脚/@uof:边距,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-bottom">0.25cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + <xsl:element name="style:footer-style"> + <xsl:element name="style:header-footer-properties"> + <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute> + <xsl:choose> + <xsl:when test="表:页面设置/表:页眉页脚/@uof:边距"> + <xsl:attribute name="fo:margin-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(表:页面设置/表:页眉页脚/@uof:边距,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-top">0.25cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template match="字:文本串"> + <xsl:value-of select="text()"/> + </xsl:template> + <xsl:template match="字:换行符"> + <xsl:element name="text:line-break"/> + </xsl:template> + <xsl:template match="字:制表符"> + <xsl:element name="text:tab-stop"/> + </xsl:template> + <xsl:template match="字:区域开始"> + <xsl:if test="@字:类型='hyperlink'"> + <xsl:variable name="superlink" select="//uof:超级链接[@uof:标识符=current()/@字:标识符]"/> + <xsl:element name="text:a"> + <xsl:attribute name="xlink:href"><xsl:value-of select="$superlink/@uof:目标"/></xsl:attribute> + <xsl:value-of select="$superlink/@uof:提示"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="字:空格符"> + <xsl:element name="text:s"> + <xsl:if test="@字:个数"> + <xsl:attribute name="text:c"><xsl:value-of select="@字:个数"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="create-page-header-footer-text-p"> + <xsl:param name="paragragh-set"/> + <xsl:choose> + <xsl:when test="$paragragh-set"> + <xsl:element name="text:p"> + <xsl:for-each select="$paragragh-set[1]/字:句"> + <xsl:choose> + <xsl:when test="not(字:句属性)"> + <xsl:apply-templates select="字:文本串 | 字:空格符 | 字:换行符"/> + </xsl:when> + <xsl:when test="字:句属性"> + <xsl:element name="text:span"> + <xsl:attribute name="text:style-name"><xsl:value-of select="//uof:句式样[@字:标识符=current()/字:句属性/@字:式样引用]/@字:名称"/></xsl:attribute> + <xsl:apply-templates select="字:空格符 | 字:文本串 | 字:换行符 | 字:制表符"/> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:element> + <xsl:call-template name="create-page-header-footer-text-p"> + <xsl:with-param name="paragragh-set" select="$paragragh-set[position()!=1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <!--Redoffice comment lilliang SC0016 06.02.16 --> + <!--新增内容--> + <xsl:template match="字:段落"> + <xsl:element name="text:p"> + <xsl:choose> + <xsl:when test="字:段落属性"> + <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/></xsl:attribute> + </xsl:when> + <xsl:when test="generate-id(ancestor::字:主体/descendant::字:段落[1]) = generate-id(.)"> + <!-- create the leading paragraph style name in one section for master page style application, glu --> + <xsl:variable name="paragraph-number"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/> + </xsl:variable> + <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute> + </xsl:when> + <xsl:when test="not(字:段落属性) and (descendant::字:分栏符 or ancestor::字:分节/descendant::字:节属性[字:分栏/@字:栏数 > 1])"> + <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute> + </xsl:when> + <xsl:when test="字:句"> + <xsl:apply-templates select="字:句/字:文本串"/> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:template> + <!--Redoffice comment liliang end 06.02.16--> + <xsl:template name="create-master-styles"> + <xsl:param name="worksheetoptions"/> + <xsl:for-each select="$worksheetoptions"> + <xsl:element name="style:master-page"> + <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'TAB_', ../@表:名称)"/></xsl:call-template></xsl:attribute> + <!--xsl:attribute name="style:page-layout-name"--> + <xsl:attribute name="style:page-layout-name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'pm_', ../@表:名称)"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="style:display-name"><xsl:value-of select="concat( 'PageStyle_', ../@表:名称)"/></xsl:attribute> + <style:header> + <xsl:for-each select="表:页面设置/表:页眉页脚"> + <xsl:variable name="temp" select="@表:位置"/> + <xsl:choose> + <xsl:when test="contains($temp,'header')"> + <xsl:if test="字:段落"> + <xsl:choose> + <xsl:when test="@表:位置='headerleft'"> + <xsl:element name="style:region-left"> + <xsl:call-template name="create-page-header-footer-text-p"> + <xsl:with-param name="paragragh-set" select="字:段落"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="@表:位置='headercenter'"> + <xsl:element name="style:region-center"> + <xsl:call-template name="create-page-header-footer-text-p"> + <xsl:with-param name="paragragh-set" select="字:段落"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="@表:位置='headerright'"> + <xsl:element name="style:region-right"> + <xsl:call-template name="create-page-header-footer-text-p"> + <xsl:with-param name="paragragh-set" select="字:段落"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </style:header> + <style:footer> + <xsl:for-each select="表:页面设置/表:页眉页脚"> + <xsl:variable name="temp" select="@表:位置"/> + <xsl:choose> + <xsl:when test="contains($temp,'footer')"> + <xsl:if test="字:段落"> + <xsl:choose> + <xsl:when test="@表:位置='footerleft'"> + <xsl:element name="style:region-left"> + <xsl:call-template name="create-page-header-footer-text-p"> + <xsl:with-param name="paragragh-set" select="字:段落"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="@表:位置='footercenter'"> + <xsl:element name="style:region-center"> + <xsl:call-template name="create-page-header-footer-text-p"> + <xsl:with-param name="paragragh-set" select="字:段落"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="@表:位置='footerright'"> + <xsl:element name="style:region-right"> + <xsl:call-template name="create-page-header-footer-text-p"> + <xsl:with-param name="paragragh-set" select="字:段落"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </style:footer> + </xsl:element> + </xsl:for-each> + </xsl:template> + <!--xsl:template name="create-page-master"> + </xsl:template> + <xsl:template match="表:页面设置"> + </xsl:template> + + <xsl:template name="create-master-styles"> + </xsl:template> + <xsl:template name="表:工作表属性"> + </xsl:template--> + <!--00000000000--> + <xsl:template match="uof:元数据"> + <office:meta> + <xsl:if test="uof:创建应用程序"> + <meta:generator> + <xsl:value-of select="uof:创建应用程序"/> + </meta:generator> + </xsl:if> + <xsl:if test="uof:标题"> + <dc:title> + <xsl:value-of select="uof:标题"/> + </dc:title> + </xsl:if> + <xsl:if test="uof:摘要"> + <dc:description> + <xsl:value-of select="uof:摘要"/> + </dc:description> + </xsl:if> + <xsl:if test="uof:主题"> + <dc:subject> + <xsl:value-of select="uof:主题"/> + </dc:subject> + </xsl:if> + <xsl:if test="uof:作者"> + <meta:initial-creator> + <xsl:value-of select="uof:作者"/> + </meta:initial-creator> + </xsl:if> + <xsl:if test="uof:创建日期"> + <meta:creation-date> + <xsl:value-of select="uof:创建日期"/> + </meta:creation-date> + </xsl:if> + <xsl:if test="uof:最后作者"> + <dc:creator> + <xsl:value-of select="uof:最后作者"/> + </dc:creator> + </xsl:if> + <xsl:if test="uof:编辑时间"> + <meta:editing-duration> + <xsl:value-of select="uof:编辑时间"/> + </meta:editing-duration> + </xsl:if> + <dc:language/> + <meta:keyword> + <xsl:value-of select="uof:关键字集/uof:关键字"/> + </meta:keyword> + <xsl:if test="uof:编辑次数"> + <meta:editing-cycles> + <xsl:value-of select="uof:编辑次数"/> + </meta:editing-cycles> + </xsl:if> + <xsl:if test="uof:分类"> + <meta:user-defined meta:name="Category"> + <xsl:value-of select="uof:分类"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="uof:经理名称"> + <meta:user-defined meta:name="Manager"> + <xsl:value-of select="uof:经理名称"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="uof:公司名称"> + <meta:user-defined meta:name="Company"> + <xsl:value-of select="uof:公司名称"/> + </meta:user-defined> + </xsl:if> + <xsl:apply-templates select="uof:用户自定义元数据集"/> + </office:meta> + </xsl:template> + <xsl:template match="uof:用户自定义元数据集"> + <xsl:for-each select="uof:用户自定义元数据"> + <meta:user-defined meta:name="{@uof:名称}"> + <xsl:value-of select="."/> + </meta:user-defined> + </xsl:for-each> + </xsl:template> + <xsl:template name="parse-range"> + <xsl:param name="range-value"/> + <xsl:param name="last"/> + <xsl:variable name="first-pit"> + <xsl:choose> + <xsl:when test="contains($range-value,',')"> + <xsl:value-of select="substring-before($range-value,',')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$range-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="current"> + <xsl:choose> + <xsl:when test="contains($first-pit,':')"> + <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/> + <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/> + <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/> + <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/> + <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/> + <xsl:variable name="the-str"> + <xsl:call-template name="condition-rc-str"> + <xsl:with-param name="r-start" select="$R-start"/> + <xsl:with-param name="r-end" select="$R-end"/> + <xsl:with-param name="c-start" select="$C-start"/> + <xsl:with-param name="c-end" select="$C-end"/> + <xsl:with-param name="last" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$the-str"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($first-pit,',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($range-value,',')"> + <xsl:call-template name="parse-range"> + <xsl:with-param name="range-value" select="substring-after($range-value,',')"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($last,$current)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="condition-rc-str"> + <!-- dealing the range of row\column --> + <xsl:param name="r-start"/> + <xsl:param name="r-end"/> + <xsl:param name="c-start"/> + <xsl:param name="c-end"/> + <xsl:param name="last"/> + <xsl:variable name="current"> + <xsl:call-template name="condition-c-str"> + <xsl:with-param name="rc-str" select="concat('R',$r-start)"/> + <xsl:with-param name="start" select="$c-start"/> + <xsl:with-param name="end" select="$c-end"/> + <xsl:with-param name="last" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$r-start < $r-end"> + <xsl:call-template name="condition-rc-str"> + <xsl:with-param name="r-start" select="$r-start + 1"/> + <xsl:with-param name="r-end" select="$r-end"/> + <xsl:with-param name="c-start" select="$c-start"/> + <xsl:with-param name="c-end" select="$c-end"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$r-start = $r-end"> + <xsl:value-of select="concat($last,$current)"/> + </xsl:if> + </xsl:template> + <xsl:template name="condition-c-str"> + <!-- return value for the template condition-rc-str --> + <xsl:param name="rc-str"/> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:param name="last"/> + <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/> + <xsl:if test="$start < $end"> + <xsl:call-template name="condition-c-str"> + <xsl:with-param name="rc-str" select="$rc-str"/> + <xsl:with-param name="start" select="$start + 1"/> + <xsl:with-param name="end" select="$end"/> + <xsl:with-param name="last" select="concat($last,$current)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$start = $end"> + <xsl:value-of select="concat($last,$current)"/> + </xsl:if> + </xsl:template> + <xsl:template name="condition-str"> + <xsl:param name="param-str"/> + <xsl:choose> + <xsl:when test="contains($param-str,'(')"> + <xsl:call-template name="condition-str"> + <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($param-str,':')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="encode-as-cell-range-address"> + <xsl:param name="string"/> + <xsl:value-of select="$string"/> + </xsl:template> + <xsl:template name="encode-as-cell-address"> + <xsl:param name="string"/> + <xsl:value-of select="$string"/> + </xsl:template> + <!--chengxiuzhi 111111111111111111111111111111111111111111111111111111111111111--> + <!-- measure_conversion.xsl Begin--> + <xsl:param name="dpi" select="111"/> + <xsl:param name="centimeter-in-mm" select="10"/> + <xsl:param name="inch-in-mm" select="25.4"/> + <xsl:param name="didot-point-in-mm" select="0.376065"/> + <xsl:param name="pica-in-mm" select="4.2333333"/> + <xsl:param name="point-in-mm" select="0.3527778"/> + <xsl:param name="twip-in-mm" select="0.017636684"/> + <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/> + <!-- ***** MEASUREMENT CONVERSIONS ***** + PARAM 'value' + The measure to be converted. + The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...) + directly added to the number. + + PARAM 'rounding-factor' + Is used for the rounding of decimal places. + The parameter number is the product of 1 and some '10', where + every zero represents a decimal place. + + For example, providing as parameter: + <xsl:param name="rounding-factor" select="10000" /> + Gives by default four decimal places. + + To round two decimal places, basically the following is done: + <xsl:value-of select="round(100 * value) div 100"/> + + RETURN The converted number, by default rounded to four decimal places. + In case the input measure could not be matched the same value is + returned and a warning message is written out. + + + + MEASURE LIST: + * 1 millimeter (mm), the basic measure + + * 1 centimeter (cm) = 10 mm + + * 1 inch (in) = 25.4 mm + While the English have already seen the light (read: the metric system), the US + remains loyal to this medieval system. + + * 1 point (pt) = 0.35277777.. mm + Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points. + There are exactly 72 PostScript points in 1 inch. + + * 1 twip = twentieth of a (PostScript) point + A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing. + + * 1 didot point (dpt) = 0.376065 mm + Didot point after the French typographer Firmin Didot (1764-1836). + + More details under + http://www.unc.edu/~rowlett/units/dictP.html: + "A unit of length used by typographers and printers. When printing was done + from hand-set metal type, one point represented the smallest element of type + that could be handled, roughly 1/64 inch. Eventually, the point was standardized + in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is + about 0.35 mm (351.46 micrometers). In continental Europe, typographers + traditionally used a slightly larger point of 0.014 83 inch (about + 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point + after the French typographer Firmin Didot (1764-1836). In the U.S., + Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch + or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point + of 0.351 459 8035 mm. The German standards agency DIN has proposed that + all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch). + + * 1 pica = 4.233333 mm + 1/6 inch or 12 points + + * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi) + Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter + + + --> + <!-- changing measure to mm --> + <xsl:template name="convert2mm"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="substring-before($value, 'mm')"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to cm --> + <xsl:template name="convert2cm"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="substring-before($value, 'cm')"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to inch (cp. section comment) --> + <xsl:template name="convert2in"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="substring-before($value, 'in')"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to dpt (cp. section comment) --> + <xsl:template name="convert2dpt"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="substring-before($value, 'dpt')"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pica (cp. section comment) --> + <xsl:template name="convert2pica"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="substring-before($value, 'pica')"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pt (cp. section comment) --> + <xsl:template name="convert2pt"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="substring-before($value, 'pt')"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pt (cp. section comment) --> + <xsl:template name="convert2twip"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="substring-before($value, 'twip')"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) --> + <xsl:template name="convert2px"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- chenjh zhangying--> + <xsl:template name="create-content-validations"> + <xsl:param name="validation-set"/> + <xsl:if test="$validation-set"> + <xsl:variable name="first-validation" select="$validation-set[1]"/> + <xsl:variable name="condition-text"> + <xsl:choose> + <xsl:when test="$first-validation/表:校验类型/text()='whole number'"> + <xsl:choose> + <xsl:when test="$first-validation/表:操作码/text()='between' "> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not between'"> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()!=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than'"> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()>',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than'"> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()<',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()>=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()<=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-validation/表:校验类型/text()='decimal'"> + <xsl:choose> + <xsl:when test="$first-validation/表:操作码/text()='between' "> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not between'"> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()!=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than'"> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()>',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than'"> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()<',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()>=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()<=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-validation/表:校验类型/text()='date'"> + <xsl:choose> + <xsl:when test="$first-validation/表:操作码/text()='between' "> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not between'"> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()!=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than'"> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()>',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than'"> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()<',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()>=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()<=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="$first-validation/表:校验类型/text()='time'"> + <xsl:choose> + <xsl:when test="$first-validation/表:操作码/text()='between' "> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not between'"> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()!=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than'"> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()>',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than'"> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()<',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()>=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()<=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <!-- add 20060317 --> + <xsl:when test="$first-validation/表:校验类型/text()='cell range'"> + <xsl:value-of select="concat('oooc:cell-content-is-in-list',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:校验类型/text()='list'"> + <xsl:value-of select="concat('oooc:cell-content-is-in-list',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <!-- add 20060317 end --> + <xsl:when test="$first-validation/表:校验类型/text()='text length'"> + <xsl:choose> + <xsl:when test="$first-validation/表:操作码/text()='between' "> + <xsl:value-of select="concat('oooc:cell-content-text-length-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not between'"> + <xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='equal to'"> + <xsl:value-of select="concat('oooc:cell-content-text-length()=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='not equal to'"> + <xsl:value-of select="concat('oooc:cell-content-text-length()!=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than'"> + <xsl:value-of select="concat('oooc:cell-content-text-length()>',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than'"> + <xsl:value-of select="concat('oooc:cell-content-text-length()<',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-text-length()>=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'"> + <xsl:value-of select="concat('oooc:cell-content-text-length()<=',$first-validation/表:第一操作数/text())"/> + </xsl:when> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:element name="table:content-validation"> + <xsl:attribute name="table:name"><xsl:value-of select="concat('val',count($first-validation/preceding-sibling::表:数据有效性)+1)"/></xsl:attribute> + <xsl:attribute name="table:condition"><xsl:value-of select="$condition-text"/></xsl:attribute> + <xsl:attribute name="table:allow-empty-cell"><xsl:value-of select="$first-validation/表:忽略空格/@表:值"/></xsl:attribute> + <xsl:attribute name="table:base-cell-address"><xsl:value-of select="translate(substring-after($first-validation/表:区域/text(),':'),'$','')"/></xsl:attribute> + <xsl:if test="$first-validation/表:输入提示"> + <xsl:element name="table:help-message"> + <xsl:attribute name="table:title"><xsl:value-of select="$first-validation/表:输入提示/@表:标题"/></xsl:attribute> + <xsl:attribute name="table:display"><xsl:value-of select="$first-validation/表:输入提示/@表:显示"/></xsl:attribute> + <xsl:element name="text:p"> + <xsl:value-of select="$first-validation/表:输入提示/@表:内容"/> + </xsl:element> + </xsl:element> + </xsl:if> + <xsl:if test="$first-validation/表:错误提示"> + <xsl:element name="table:error-message"> + <xsl:attribute name="table:title"><xsl:value-of select="$first-validation/表:错误提示/@表:标题"/></xsl:attribute> + <xsl:attribute name="table:display"><xsl:value-of select="$first-validation/表:错误提示/@表:显示"/></xsl:attribute> + <xsl:attribute name="table:message-type"><xsl:value-of select="$first-validation/表:错误提示/@表:类型"/></xsl:attribute> + <xsl:element name="text:p"> + <xsl:value-of select="$first-validation/表:错误提示/@表:内容"/> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:element> + <xsl:call-template name="create-content-validations"> + <xsl:with-param name="validation-set" select="$validation-set[position()!=1]"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26 charts--> + <xsl:template match="表:图表"> + <xsl:param name="table-name"/> + <xsl:element name="draw:frame"> + <xsl:attribute name="draw:z-index"><xsl:value-of select="'0'"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@表:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@表:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(@表:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(@表:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:variable name="chart-current"> + <xsl:number level="any" count="表:图表" format="1"/> + </xsl:variable> + <xsl:attribute name="draw:style-name"><xsl:value-of select="concat('chart', $chart-current)"/></xsl:attribute> + <xsl:variable name="series-value-start"> + <xsl:for-each select="表:数据源/表:系列[position()='1']"> + <xsl:value-of select="@表:系列值"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="series-value-end"> + <xsl:for-each select="表:数据源/表:系列[position()=last()]"> + <xsl:value-of select="@表:系列值"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="series-generate-type"> + <xsl:choose> + <xsl:when test="表:数据源/@表序号产生"> + <xsl:value-of select="表:数据源/@表序号产生"/> + </xsl:when> + <xsl:when test="substring(substring-after($series-value-start,'!'),2,1)=substring(substring-after($series-value-start,':'),2,1)">row</xsl:when> + <xsl:otherwise>col</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="draw:object"> + <xsl:attribute name="draw:notify-on-update-of-ranges"><xsl:value-of select="表:数据源/@表:数据区域"/></xsl:attribute> + <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0" office:mimetype="application/vnd.oasis.opendocument.chart"> + <xsl:call-template name="表:元数据"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="@表:类型"/> + <xsl:with-param name="table-subtype" select="@表:子类型"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + <xsl:call-template name="表:式样集"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="@表:类型"/> + <xsl:with-param name="table-subtype" select="@表:子类型"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + <xsl:call-template name="表:主体"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="@表:类型"/> + <xsl:with-param name="table-subtype" select="@表:子类型"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </office:document> + </xsl:element> + <xsl:element name="draw:image"> + <office:binary-data> + <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象/uof:数据"/> + </office:binary-data> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="表:元数据"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:for-each select="/uof:UOF/uof:元数据"> + <office:meta> + <meta:generator>OpenOffice.org 1.1.3 (Win32)</meta:generator> + <xsl:if test="uof:标题"> + <dc:title> + <xsl:value-of select="uof:标题"/> + </dc:title> + </xsl:if> + <xsl:if test="uof:摘要"> + <dc:description> + <xsl:value-of select="uof:摘要"/> + </dc:description> + </xsl:if> + <xsl:if test="uof:主题"> + <dc:subject> + <xsl:value-of select="uof:主题"/> + </dc:subject> + </xsl:if> + <xsl:if test="uof:作者"> + <meta:initial-creator> + <xsl:value-of select="uof:作者"/> + </meta:initial-creator> + </xsl:if> + <xsl:if test="uof:创建日期"> + <meta:creation-date> + <xsl:value-of select="uof:创建日期"/> + </meta:creation-date> + </xsl:if> + <xsl:if test="uof:最后作者"> + <dc:creator> + <xsl:value-of select="uof:最后作者"/> + </dc:creator> + </xsl:if> + <xsl:if test="uof:编辑时间"> + <meta:editing-duration> + <xsl:value-of select="uof:编辑时间"/> + </meta:editing-duration> + </xsl:if> + <dc:language/> + <meta:keywords> + <meta:keyword> + <xsl:value-of select="uof:关键字集/uof:关键字"/> + </meta:keyword> + </meta:keywords> + <xsl:if test="uof:编辑次数"> + <meta:editing-cycles> + <xsl:value-of select="uof:编辑次数"/> + </meta:editing-cycles> + </xsl:if> + <xsl:if test="uof:分类"> + <meta:user-defined meta:name="Category"> + <xsl:value-of select="uof:分类"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="uof:经理名称"> + <meta:user-defined meta:name="Manager"> + <xsl:value-of select="uof:经理名称"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="uof:公司名称"> + <meta:user-defined meta:name="Company"> + <xsl:value-of select="uof:公司名称"/> + </meta:user-defined> + </xsl:if> + <xsl:if test="uof:创建应用程序"> + <meta:user-defined meta:name="Version"> + <xsl:value-of select="uof:创建应用程序"/> + </meta:user-defined> + </xsl:if> + </office:meta> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:式样集"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <office:styles> + <draw:stroke-dash draw:name="Ultrafine_20_Dashed" draw:display-name="Ultrafine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.051cm" draw:dots2="1" draw:dots2-length="0.051cm" draw:distance="0.051cm"/> + <draw:stroke-dash draw:name="Fine_20_Dashed" draw:display-name="Fine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.508cm" draw:dots2="1" draw:dots2-length="0.508cm" draw:distance="0.508cm"/> + <draw:stroke-dash draw:name="Ultrafine_20_2_20_Dots_20_3_20_Dashes" draw:display-name="Ultrafine 2 Dots 3 Dashes" draw:style="rect" draw:dots1="2" draw:dots1-length="0.051cm" draw:dots2="3" draw:dots2-length="0.254cm" draw:distance="0.127cm"/> + <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/> + <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/> + <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/> + <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/> + <draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/> + <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/> + <draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/> + <draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/> + <draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/> + <draw:stroke-dash draw:name="Dash_20_10" draw:display-name="Dash 10" draw:style="rect" draw:dots1="1" draw:dots1-length="0.02cm" draw:dots2="1" draw:dots2-length="0.02cm" draw:distance="0.02cm"/> + <xsl:for-each select="//图:图片"> + <xsl:variable name="chart-image-name" select="@图:名称"/> + <draw:fill-image> + <xsl:attribute name="draw:name"><xsl:value-of select="@图:名称"/></xsl:attribute> + <office:binary-data> + <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$chart-image-name]"> + <xsl:value-of select="uof:数据"/> + </xsl:for-each> + </office:binary-data> + </draw:fill-image> + </xsl:for-each> + <xsl:for-each select="//图:图案"> + <xsl:variable name="chart-hatch-name" select="@图:图形引用"/> + <draw:hatch> + <xsl:if test="@图:图形引用"> + <xsl:attribute name="draw:name"><xsl:value-of select="$chart-hatch-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:类型"> + <xsl:attribute name="draw:style"><xsl:value-of select="@图:类型"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:前景色"> + <xsl:attribute name="draw:color"><xsl:value-of select="@图:前景色"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:距离"> + <xsl:attribute name="draw:distance"><xsl:value-of select="@图:距离"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:旋转度"> + <xsl:attribute name="draw:rotation"><xsl:value-of select="@图:旋转度"/></xsl:attribute> + </xsl:if> + </draw:hatch> + </xsl:for-each> + <xsl:for-each select="//图:渐变"> + <draw:gradient> + <xsl:if test="@图:图形引用"> + <xsl:attribute name="draw:name"><xsl:value-of select="@图:图形引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:起始色"> + <xsl:attribute name="draw:start-color"><xsl:value-of select="@图:起始色"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:终止色"> + <xsl:attribute name="draw:end-color"><xsl:value-of select="@图:终止色"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:种子类型"> + <xsl:attribute name="draw:style"><xsl:value-of select="@图:种子类型"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:起始浓度"> + <xsl:attribute name="draw:start-intensity"><xsl:value-of select="@图:起始浓度"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:终止浓度"> + <xsl:attribute name="draw:end-intensity"><xsl:value-of select="@图:终止浓度"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:渐变方向"> + <xsl:attribute name="draw:angle"><xsl:value-of select="@图:渐变方向"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:边界"> + <xsl:attribute name="draw:border"><xsl:value-of select="@图:边界"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:种子X位置"> + <xsl:attribute name="draw:cx"><xsl:value-of select="@图:种子X位置"/></xsl:attribute> + </xsl:if> + <xsl:if test="@图:种子Y位置"> + <xsl:attribute name="draw:cy"><xsl:value-of select="@图:种子Y位置"/></xsl:attribute> + </xsl:if> + </draw:gradient> + </xsl:for-each> + </office:styles> + <office:automatic-styles> + <xsl:for-each select="node( )"> + <xsl:choose> + <xsl:when test="name(.)='表:图表区'"> + <xsl:call-template name="表:图表区式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:绘图区'"> + <xsl:call-template name="表:绘图区式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + <xsl:call-template name="表:图表背景墙式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:分类轴'"> + <xsl:call-template name="表:分类轴式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:数值轴'"> + <xsl:call-template name="表:数值轴式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:图例'"> + <xsl:call-template name="表:图例式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:数据表'"> + <xsl:call-template name="表:数据表式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:数据系列集'"> + <xsl:call-template name="表:数据系列集式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:数据点集'"> + <xsl:call-template name="表:数据点集式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:网格线集'"> + <xsl:call-template name="表:网格线集式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:数据源'"> + <xsl:call-template name="表:数据源式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name(.)='表:标题集'"> + <xsl:call-template name="表:标题集式样"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </office:automatic-styles> + </xsl:template> + <xsl:template name="表:主体"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <office:body> + <office:chart> + <chart:chart> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(@表:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(@表:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="chart:class"><xsl:choose><xsl:when test="$table-type='column'">chart:bar</xsl:when><xsl:when test="$table-type='line'">chart:line</xsl:when><xsl:when test="$table-type='pie'"><xsl:choose><xsl:when test="$table-subtype='pie_ring'">chart:ring</xsl:when><xsl:otherwise>chart:circle</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="$table-type"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="chart:style-name">chart-area</xsl:attribute> + <xsl:for-each select="表:标题集/表:标题[@表:位置='chart']"> + <chart:title chart:style-name="chart-title"> + <text:p> + <xsl:value-of select="@表:名称"/> + </text:p> + </chart:title> + </xsl:for-each> + <xsl:call-template name="表:图例区域"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + <xsl:call-template name="表:绘图区域"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + <xsl:call-template name="表:本地表"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </chart:chart> + </office:chart> + </office:body> + </xsl:template> + <xsl:template name="表:图例区域"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <chart:legend> + <xsl:attribute name="chart:legend-position"><xsl:choose><xsl:when test="表:图例/@表:位置"><xsl:value-of select="表:图例/@表:位置"/></xsl:when><xsl:otherwise>right</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(表:图例/@表:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(表:图例/@表:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="chart:style-name">legend</xsl:attribute> + </chart:legend> + </xsl:template> + <xsl:template name="表:绘图区域"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <chart:plot-area> + <xsl:variable name="start-range"> + <xsl:value-of select="concat('.$',substring(substring-after($series-value-start,'!'),1,1),'$',substring-before(substring(substring-after($series-value-start,'!'),2),':'))"/> + </xsl:variable> + <xsl:variable name="end-range"> + <xsl:value-of select="concat(':.$',substring(substring-after($series-value-end,':'),1,1),'$',substring(substring-after($series-value-end,':'),2))"/> + </xsl:variable> + <xsl:attribute name="chart:style-name">plot-area</xsl:attribute> + <xsl:attribute name="table:cell-range-address"><xsl:value-of select="concat($table-name,$start-range,$end-range)"/></xsl:attribute> + <!--xsl:value-of select="表:数据源/@表:数据区域"/--> + <xsl:attribute name="chart:table-number-list">0</xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(表:绘图区/@表:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(表:绘图区/@表:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(表:绘图区/@表:x坐标,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(表:绘图区/@表:y坐标,$uofUnit)"/></xsl:attribute> + <xsl:if test="表:分类轴"> + <chart:axis chart:dimension="x" chart:name="primary-x" chart:style-name="category-axis"> + <xsl:for-each select="表:标题集/表:标题[@表:位置='category axis']"> + <chart:title chart:style-name="category-axis-title"> + <text:p> + <xsl:value-of select="@表:名称"/> + </text:p> + </chart:title> + </xsl:for-each> + <chart:categories/> + <xsl:if test="表:网格线集/表:网格线[@表:位置='category axis']"> + <chart:grid chart:style-name="category-axis-grid" chart:class="major"/> + </xsl:if> + </chart:axis> + </xsl:if> + <xsl:if test="表:数值轴"> + <chart:axis chart:dimension="y" chart:name="primary-y" chart:style-name="value-axis"> + <xsl:for-each select="表:标题集/表:标题[@表:位置='value axis']"> + <chart:title chart:style-name="value-axis-title"> + <text:p> + <xsl:value-of select="@表:名称"/> + </text:p> + </chart:title> + </xsl:for-each> + <chart:grid chart:style-name="value-axis-grid" chart:class="major"/> + </chart:axis> + </xsl:if> + <xsl:call-template name="表:数据组"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + <chart:wall> + <xsl:attribute name="chart:style-name">chart-wall</xsl:attribute> + </chart:wall> + <chart:floor> + <xsl:attribute name="chart:style-name">chart-floor</xsl:attribute> + </chart:floor> + </chart:plot-area> + </xsl:template> + <xsl:template name="表:本地表"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <table:table table:name="local-table"> + <table:table-header-columns> + <xsl:call-template name="表:本地表_表头列"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="sum" select="1"/> + </xsl:call-template> + </table:table-header-columns> + <table:table-columns> + <xsl:variable name="column-sum"> + <xsl:value-of select="count(表:数据源/表:系列)"/> + </xsl:variable> + <xsl:call-template name="表:本地表_列"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="column-sum" select="$column-sum"/> + </xsl:call-template> + </table:table-columns> + <table:table-header-rows> + <xsl:call-template name="表:本地表_表头行"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="row-current" select="1"/> + <xsl:with-param name="fixed-row-sum" select="'1'"/> + </xsl:call-template> + </table:table-header-rows> + <table:table-rows> + <xsl:variable name="row-start"> + <xsl:value-of select="substring-before(substring(substring-after($series-value-start,'!'),2),':')"/> + </xsl:variable> + <xsl:variable name="row-end"> + <xsl:value-of select="substring(substring-after($series-value-end,':'),2)"/> + </xsl:variable> + <xsl:variable name="fixed-row-sum"> + <xsl:value-of select="$row-end -$row-start +1"/> + </xsl:variable> + <xsl:call-template name="表:本地表_行"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="row-current" select="'1'"/> + <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/> + </xsl:call-template> + </table:table-rows> + </table:table> + </xsl:template> + <xsl:template name="表:本地表_表头列"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="sum"/> + <xsl:choose> + <xsl:when test="$sum=0"/> + <xsl:otherwise> + <table:table-column/> + <xsl:call-template name="表:本地表_表头列"> + <xsl:with-param name="sum" select="$sum -1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:本地表_列"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="column-sum"/> + <xsl:choose> + <xsl:when test="$column-sum=0"/> + <xsl:otherwise> + <table:table-column/> + <xsl:call-template name="表:本地表_列"> + <xsl:with-param name="column-sum" select="$column-sum -1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:本地表_表头行"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="row-current"/> + <xsl:param name="fixed-row-sum"/> + <xsl:choose> + <xsl:when test="$row-current >$fixed-row-sum"/> + <xsl:otherwise> + <table:table-row> + <xsl:variable name="series-value-current"> + <xsl:for-each select="表:数据源/表:系列[position()=$row-current]"> + <xsl:value-of select="@表:系列值"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="cell-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cell-end"> + <xsl:choose> + <xsl:when test="$series-generate-type='row'"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,':'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-end,'!'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="cell-sum"> + <xsl:value-of select="$cell-end -$cell-start +2"/> + </xsl:variable> + <xsl:variable name="fixed-cell-sum" select="$cell-sum"/> + <xsl:call-template name="表:本地表_表头行_单元格"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="series-value-current" select="$series-value-current"/> + <xsl:with-param name="row-current" select="$row-current"/> + <xsl:with-param name="cell-sum" select="$cell-sum"/> + <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/> + </xsl:call-template> + </table:table-row> + <xsl:call-template name="表:本地表_表头行"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="row-current" select="$row-current +1"/> + <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:本地表_表头行_单元格"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="series-value-current"/> + <xsl:param name="row-current"/> + <xsl:param name="cell-sum"/> + <xsl:param name="fixed-cell-sum"/> + <xsl:choose> + <xsl:when test="$cell-sum=0"/> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$fixed-cell-sum=$cell-sum"> + <table:table-cell> + <text:p/> + </table:table-cell> + </xsl:when> + <xsl:otherwise> + <table:table-cell office:value-type="string"> + <xsl:variable name="cell-no"> + <xsl:value-of select="$fixed-cell-sum -$cell-sum +1"/> + </xsl:variable> + <xsl:variable name="cell-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="char"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="$cell-start +$cell-no -2"/> + <xsl:with-param name="output-type" select="'CHARS_UPPER_LETTER'"/> + </xsl:call-template> + </xsl:variable> + <text:p> + <xsl:value-of select="concat('列 ',$char)"/> + </text:p> + </table:table-cell> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="表:本地表_表头行_单元格"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="series-value-current" select="$series-value-current"/> + <xsl:with-param name="row-current" select="$row-current"/> + <xsl:with-param name="cell-sum" select="$cell-sum -1"/> + <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:本地表_行"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="row-current"/> + <xsl:param name="fixed-row-sum"/> + <xsl:choose> + <xsl:when test="$row-current >$fixed-row-sum"/> + <xsl:otherwise> + <xsl:variable name="series-value-current"> + <xsl:for-each select="表:数据源/表:系列[position()=$row-current]"> + <xsl:value-of select="@表:系列值"/> + </xsl:for-each> + </xsl:variable> + <table:table-row> + <xsl:variable name="cell-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cell-end"> + <xsl:choose> + <xsl:when test="$series-generate-type='row'"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,':'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-end,'!'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="cell-sum"> + <xsl:value-of select="$cell-end -$cell-start +2"/> + </xsl:variable> + <xsl:variable name="fixed-cell-sum" select="$cell-sum"/> + <xsl:call-template name="表:本地表_行_单元格"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="series-value-current" select="$series-value-current"/> + <xsl:with-param name="row-current" select="$row-current"/> + <xsl:with-param name="cell-sum" select="$cell-sum"/> + <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/> + </xsl:call-template> + </table:table-row> + <xsl:call-template name="表:本地表_行"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="row-current" select="$row-current +1"/> + <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:本地表_行_单元格"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="series-value-current"/> + <xsl:param name="row-current"/> + <xsl:param name="cell-sum"/> + <xsl:param name="fixed-cell-sum"/> + <xsl:choose> + <xsl:when test="$cell-sum=0"/> + <xsl:otherwise> + <xsl:variable name="cell-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cell-no"> + <xsl:value-of select="$cell-start +$fixed-cell-sum -$cell-sum -1"/> + </xsl:variable> + <xsl:variable name="row-start"> + <xsl:value-of select="substring(substring-after($series-value-start,'!'),2,1)"/> + </xsl:variable> + <xsl:variable name="row-no"> + <xsl:value-of select="$row-start +$row-current -1"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$fixed-cell-sum=$cell-sum"> + <table:table-cell office:value-type="string"> + <text:p> + <xsl:value-of select="concat('行 ',$row-no)"/> + </text:p> + </table:table-cell> + </xsl:when> + <xsl:otherwise> + <table:table-cell office:value-type="float"> + <xsl:variable name="cell-content"> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/@表:行号"> + <xsl:for-each select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行[@表:行号=$row-no]"> + <xsl:for-each select="表:单元格[@表:列号=$cell-no]"> + <xsl:value-of select="表:数据/字:句/字:文本串"/> + </xsl:for-each> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行[position()=$row-no]"> + <xsl:for-each select="表:单元格[position()=$cell-no]"> + <xsl:value-of select="表:数据/字:句/字:文本串"/> + </xsl:for-each> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:value"><xsl:value-of select="$cell-content"/></xsl:attribute> + <text:p> + <xsl:value-of select="$cell-content"/> + </text:p> + </table:table-cell> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="表:本地表_行_单元格"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="series-value-current" select="$series-value-current"/> + <xsl:with-param name="row-current" select="$row-current"/> + <xsl:with-param name="cell-sum" select="$cell-sum -1"/> + <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:数据组"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:variable name="input-char-start"> + <xsl:choose> + <xsl:when test="$series-generate-type='row'"> + <xsl:value-of select="substring(substring-after($series-value-start,'!'),1,1)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(substring(substring-after($series-value-start,'!'),2),':')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="input-char-end"> + <xsl:choose> + <xsl:when test="$series-generate-type='row'"> + <xsl:value-of select="substring(substring-after($series-value-start,':'),1,1)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring(substring-after($series-value-start,':'),2)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="cell-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="$input-char-start"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="cell-end"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="$input-char-end"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="fixed-cell-sum"> + <xsl:value-of select="$cell-end -$cell-start +1"/> + </xsl:variable> + <xsl:for-each select="表:数据系列集/表:数据系列"> + <chart:series> + <xsl:attribute name="chart:style-name"><xsl:value-of select="concat('data-series',position())"/></xsl:attribute> + <xsl:call-template name="表:数据点"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="data-series-current" select="position()"/> + <xsl:with-param name="cell-current" select="'1'"/> + <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/> + </xsl:call-template> + </chart:series> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:数据点"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="data-series-current"/> + <xsl:param name="cell-current"/> + <xsl:param name="fixed-cell-sum"/> + <xsl:choose> + <xsl:when test="$cell-current>$fixed-cell-sum"/> + <xsl:otherwise> + <chart:data-point> + <xsl:attribute name="chart:style-name"><xsl:value-of select="concat('data-point',$data-series-current,$cell-current)"/></xsl:attribute> + </chart:data-point> + <xsl:call-template name="表:数据点"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="data-series-current" select="$data-series-current"/> + <xsl:with-param name="cell-current" select="$cell-current +1"/> + <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:图表区式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <style:style style:name="chart-area" style:family="chart"> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name(.)='表:边框'"> + <style:graphic-properties> + <xsl:call-template name="uof:边框"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:填充'"> + <style:graphic-properties> + <xsl:call-template name="图:填充类型"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:字体'"> + <style:text-properties> + <xsl:call-template name="字:句属性类型"/> + </style:text-properties> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </style:style> + </xsl:template> + <xsl:template name="表:绘图区式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <style:style style:name="plot-area" style:family="chart"> + <style:chart-properties> + <xsl:choose> + <xsl:when test="$table-subtype='bar_stacked' or $table-subtype='column_stacked' or $table-subtype='line_stacked'"> + <xsl:attribute name="chart:stacked">true</xsl:attribute> + </xsl:when> + <xsl:when test="$table-subtype='bar_percent' or $table-subtype='column_percent' or $table-subtype='line_percent'"> + <xsl:attribute name="chart:percentage">true</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:attribute name="chart:vertical"><xsl:choose><xsl:when test="$table-type='bar'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="chart:series-source"><xsl:choose><xsl:when test="$series-generate-type='row'">rows</xsl:when><xsl:otherwise>columns</xsl:otherwise></xsl:choose></xsl:attribute> + </style:chart-properties> + </style:style> + </xsl:template> + <xsl:template name="表:图表背景墙式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <style:style style:name="chart-wall" style:family="chart"> + <style:graphic-properties> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name(.)='表:边框'"> + <xsl:call-template name="uof:边框"/> + </xsl:when> + <xsl:when test="name(.)='表:填充'"> + <xsl:call-template name="图:填充类型"/> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </style:graphic-properties> + </style:style> + </xsl:template> + <xsl:template name="表:分类轴式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <style:style style:name="category-axis" style:family="chart"> + <xsl:call-template name="表:坐标轴类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="axis-type" select="'category axis'"/> + </xsl:call-template> + </style:style> + </xsl:template> + <xsl:template name="表:数值轴式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <style:style style:name="value-axis" style:family="chart"> + <xsl:call-template name="表:坐标轴类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="axis-type" select="'value axis'"/> + </xsl:call-template> + </style:style> + </xsl:template> + <xsl:template name="表:图例式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <style:style style:name="legend" style:family="chart"> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name(.)='表:边框'"> + <style:graphic-properties> + <xsl:call-template name="uof:边框"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:填充'"> + <style:graphic-properties> + <xsl:call-template name="图:填充类型"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:字体'"> + <style:text-properties> + <xsl:call-template name="字:句属性类型"/> + </style:text-properties> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </style:style> + </xsl:template> + <xsl:template name="表:数据表式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <style:style style:name="data-table" style:family="chart"> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name(.)='表:边框'"> + <style:graphic-properties> + <xsl:call-template name="uof:边框"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:填充'"> + <style:graphic-properties> + <xsl:call-template name="图:填充类型"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:字体'"> + <style:text-properties> + <xsl:call-template name="字:句属性类型"/> + </style:text-properties> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </style:style> + </xsl:template> + <xsl:template name="表:数据系列集式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:for-each select="表:数据系列"> + <style:style style:family="chart"> + <xsl:variable name="current-position" select="position()"/> + <xsl:attribute name="style:name"><xsl:value-of select="concat('data-series',$current-position)"/></xsl:attribute> + <xsl:call-template name="表:数据点类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="recall-type" select="'data-series'"/> + </xsl:call-template> + </style:style> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:数据点集式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:for-each select="表:数据点"> + <style:style style:family="chart"> + <xsl:attribute name="style:name"><xsl:value-of select="concat('data-point',@表:系列,@表:点)"/></xsl:attribute> + <xsl:call-template name="表:数据点类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + <xsl:with-param name="recall-type" select="'data-point'"/> + </xsl:call-template> + </style:style> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:网格线集式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:for-each select="表:网格线"> + <xsl:choose> + <xsl:when test="@表:位置='category axis'"> + <style:style style:name="category-axis-grid" style:family="chart"> + <style:graphic-properties> + <xsl:call-template name="uof:边框"/> + </style:graphic-properties> + </style:style> + </xsl:when> + <xsl:when test="@表:位置='value axis'"> + <style:style style:name="value-axis-grid" style:family="chart"> + <style:graphic-properties> + <xsl:call-template name="uof:边框"/> + </style:graphic-properties> + </style:style> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:数据源式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:for-each select="表:系列"> + <style:style style:family="chart"> + <xsl:variable name="current-position" select="position()"/> + <xsl:attribute name="style:name"><xsl:value-of select="concat('data-source',$current-position)"/></xsl:attribute> + </style:style> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:标题集式样"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:for-each select="表:标题"> + <xsl:choose> + <xsl:when test="@表:位置='chart'"> + <style:style style:name="chart-title" style:family="chart"> + <xsl:call-template name="表:标题类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </style:style> + </xsl:when> + <xsl:when test="@表:位置='category axis'"> + <style:style style:name="category-axis-title" style:family="chart"> + <xsl:call-template name="表:标题类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </style:style> + </xsl:when> + <xsl:when test="@表:位置='value axis'"> + <style:style style:name="value-axis-title" style:family="chart"> + <xsl:call-template name="表:标题类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="table-type" select="$table-type"/> + <xsl:with-param name="table-subtype" select="$table-subtype"/> + <xsl:with-param name="series-value-start" select="$series-value-start"/> + <xsl:with-param name="series-value-end" select="$series-value-end"/> + <xsl:with-param name="series-generate-type" select="$series-generate-type"/> + </xsl:call-template> + </style:style> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:坐标轴类型"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="axis-type"/> + <style:chart-properties> + <xsl:choose> + <xsl:when test="@表:主刻度类型='cross'"> + <xsl:attribute name="chart:tick-marks-major-inner">true</xsl:attribute> + <xsl:attribute name="chart:tick-marks-major-outer">true</xsl:attribute> + </xsl:when> + <xsl:when test="@表:主刻度类型='inside'"> + <xsl:attribute name="chart:tick-marks-major-inner">true</xsl:attribute> + <xsl:attribute name="chart:tick-marks-major-outer">false</xsl:attribute> + </xsl:when> + <xsl:when test="@表:主刻度类型='outside'"> + <xsl:attribute name="chart:tick-marks-major-inner">false</xsl:attribute> + <xsl:attribute name="chart:tick-marks-major-outer">true</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:choose> + <xsl:when test="@表:次刻度类型='cross'"> + <xsl:attribute name="chart:tick-marks-minor-inner">true</xsl:attribute> + <xsl:attribute name="chart:tick-marks-minor-outer">true</xsl:attribute> + </xsl:when> + <xsl:when test="@表:次刻度类型='inside'"> + <xsl:attribute name="chart:tick-marks-minor-inner">true</xsl:attribute> + <xsl:attribute name="chart:tick-marks-minor-outer">false</xsl:attribute> + </xsl:when> + <xsl:when test="@表:次刻度类型='outside'"> + <xsl:attribute name="chart:tick-marks-minor-inner">false</xsl:attribute> + <xsl:attribute name="chart:tick-marks-minor-outer">true</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:if test="@表:刻度线标志='next to axis'"> + <xsl:attribute name="chart:display-label">true</xsl:attribute> + </xsl:if> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name(.)='表:线型'"> + <xsl:call-template name="uof:线型"/> + </xsl:when> + <xsl:when test="name(.)='表:数值'"> + <xsl:attribute name="chart:link-data-style-to-source"><xsl:value-of select="@表:链接到源"/></xsl:attribute> + </xsl:when> + <xsl:when test="name(.)='表:刻度'"> + <xsl:call-template name="表:刻度类型"/> + </xsl:when> + <xsl:when test="name(.)='表:对齐'"> + <xsl:if test="表:文字方向"> + <xsl:attribute name="fo:direction"><xsl:value-of select="表:文字方向"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:旋转角度"> + <xsl:attribute name="text:rotation-angle"><xsl:value-of select="表:旋转角度"/></xsl:attribute> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </style:chart-properties> + <xsl:if test="表:字体"> + <xsl:for-each select="表:字体"> + <xsl:element name="style:text-properties"> + <xsl:call-template name="字:句属性类型"/> + </xsl:element> + </xsl:for-each> + </xsl:if> + </xsl:template> + <xsl:template name="表:数据点类型"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:param name="recall-type"/> + <xsl:if test="name(.)='表:数据点'"> + <style:chart-properties> + <xsl:if test="$table-type='pie' and $table-subtype='pie_offset1' and @表:点='1'"> + <xsl:attribute name="chart:pie-offset">10</xsl:attribute> + </xsl:if> + <xsl:if test="$table-type='pie' and $table-subtype='pie_offset2'"> + <xsl:attribute name="chart:pie-offset">10</xsl:attribute> + </xsl:if> + </style:chart-properties> + </xsl:if> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name(.)='表:边框'"> + <style:graphic-properties> + <xsl:call-template name="uof:边框"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:填充'"> + <style:graphic-properties> + <xsl:call-template name="图:填充类型"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:字体'"> + <style:text-properties> + <xsl:call-template name="字:句属性类型"/> + </style:text-properties> + </xsl:when> + <xsl:when test="name(.)='表:显示标志'"> + <style:chart-properties> + <xsl:if test="@表:类别名"> + <xsl:attribute name="chart:data-label-text"><xsl:value-of select="@表:类别名"/></xsl:attribute> + </xsl:if> + <xsl:if test="@表:数值"> + <xsl:attribute name="chart:data-label-number">value</xsl:attribute> + </xsl:if> + <xsl:if test="@表:百分数"> + <xsl:attribute name="chart:data-label-number">percentage</xsl:attribute> + </xsl:if> + <xsl:if test="@表:图例标志"> + <xsl:attribute name="chart:data-label-symbol"><xsl:value-of select="@表:图例标志"/></xsl:attribute> + </xsl:if> + </style:chart-properties> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:标题类型"> + <xsl:param name="table-name"/> + <xsl:param name="table-type"/> + <xsl:param name="table-subtype"/> + <xsl:param name="series-value-start"/> + <xsl:param name="series-value-end"/> + <xsl:param name="series-generate-type"/> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name(.)='表:边框'"> + <style:graphic-properties> + <xsl:call-template name="uof:边框"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:填充'"> + <style:graphic-properties> + <xsl:call-template name="图:填充类型"/> + </style:graphic-properties> + </xsl:when> + <xsl:when test="name(.)='表:对齐'"> + <style:chart-properties> + <xsl:call-template name="表:对齐格式类型"/> + </style:chart-properties> + </xsl:when> + <xsl:when test="name(.)='表:字体'"> + <style:text-properties> + <xsl:call-template name="字:句属性类型"/> + </style:text-properties> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="uof:边框"> + <xsl:if test="@uof:类型"> + <xsl:variable name="type" select="@uof:类型"/> + <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="@uof:类型='single'">solid</xsl:when><xsl:when test="@uof:类型='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$type='dash'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$type='dot-dash'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$type='dashed-heavy'">Fine_20_Dashed</xsl:when><xsl:when test="$type='dotted' ">Fine_20_Dotted</xsl:when><xsl:when test="$type='dash-long-heavy'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$type='dash-long'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-dot'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$type='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$type='thick'">Line_20_Style_20_9</xsl:when><xsl:when test="$type='dot-dot-dash'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$type='dash-dot-dot-heavy'">Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-heavy'">Dash_20_10</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="@uof:宽度"> + <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@uof:颜色"> + <xsl:attribute name="svg:stroke-color"><xsl:value-of select="@uof:颜色"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="图:填充类型"> + <xsl:if test="图:颜色"> + <xsl:attribute name="draw:fill">solid</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:颜色"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:图片"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:图片/@图:名称"/></xsl:attribute> + <xsl:if test="not(图:图片/@图:位置='tile')"> + <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="图:图案"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-hatch-name"><xsl:value-of select="图:图案/@图:图形引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:渐变"> + <xsl:attribute name="draw:fill">gradient</xsl:attribute> + <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="图:渐变/@图:图形引用"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="uof:线型"> + <xsl:call-template name="uof:边框"/> + </xsl:template> + <xsl:template name="字:句属性类型"> + <xsl:apply-templates select="./*"/> + </xsl:template> + <xsl:template name="表:刻度类型"> + <xsl:if test="表:最小值"> + <xsl:attribute name="chart:minimum"><xsl:value-of select="表:最小值"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:最大值"> + <xsl:attribute name="chart:maximum"><xsl:value-of select="表:最大值"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:主单位"> + <xsl:attribute name="chart:interval-major"><xsl:value-of select="表:主单位"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:次单位"> + <xsl:attribute name="chart:interval-minor"><xsl:value-of select="表:次单位"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:分类交叉点"> + <xsl:attribute name="chart:origin"><xsl:value-of select="表:分类交叉点"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="表:对齐格式类型"> + <xsl:if test="表:文字方向"> + <xsl:attribute name="style:direction"><xsl:value-of select="表:文字方向"/></xsl:attribute> + </xsl:if> + <xsl:if test="表:文字旋转角度"> + <xsl:attribute name="style:rotation-angle"><xsl:value-of select="表:文字旋转角度"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:字体"> + <xsl:if test="@字:字号"> + <xsl:attribute name="fo:font-size"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="@字:相对字号 and self::node( )[not(parent::字:句属性)]"> + <xsl:variable name="stylename" select="parent::node()/@字:基式样引用"/> + <xsl:variable name="zihao"> + <xsl:for-each select="/uof:UOF/uof:式样集//uof:段落式样[@字:标识符=$stylename]"> + <xsl:value-of select="字:字体/@字:字号"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="font-size" select="@字:相对字号"/> + <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="@字:颜色"> + <xsl:attribute name="fo:color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:中文字体引用"> + <xsl:attribute name="style:font-family-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:西文字体引用"> + <xsl:attribute name="fo:font-family"><xsl:value-of select="@字:西文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:斜体"> + <xsl:if test="@字:值='true'"> + <xsl:attribute name="fo:font-style">italic</xsl:attribute> + <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-complex">italic</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:粗体"> + <xsl:if test="@字:值='true'"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:下划线"> + <xsl:choose> + <xsl:when test="@字:类型 = 'single'"> + <xsl:attribute name="style:text-underline-style">solid</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'double'"> + <xsl:attribute name="style:text-underline-style">solid</xsl:attribute> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'thick'"> + <xsl:attribute name="style:text-underline-style">solid</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dotted'"> + <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dotted-heavy'"> + <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash'"> + <xsl:attribute name="style:text-underline-style">dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dashed-heavy'"> + <xsl:attribute name="style:text-underline-style">dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-long'"> + <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-long-heavy'"> + <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dot-dash'"> + <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-dot-heavy'"> + <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dot-dot-dash'"> + <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'"> + <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wave'"> + <xsl:attribute name="style:text-underline-style">wave</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wavy-heavy'"> + <xsl:attribute name="style:text-underline-style">wave</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wavy-double'"> + <xsl:attribute name="style:text-underline-style">wave</xsl:attribute> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:choose> + <xsl:when test="@字:颜色"> + <xsl:attribute name="style:text-underline-color"><xsl:choose><xsl:when test="@字:颜色='auto'">font-color</xsl:when><xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:着重号"> + <xsl:if test="not(@字:类型='none')"> + <xsl:choose> + <xsl:when test="@字:类型='accent above' "> + <xsl:attribute name="style:text-emphasize">accent above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='dot above' "> + <xsl:attribute name="style:text-emphasize">dot above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='disc above' "> + <xsl:attribute name="style:text-emphasize">disc above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='circle above' "> + <xsl:attribute name="style:text-emphasize">circle above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='accent below' "> + <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='dot below' "> + <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='disc below' "> + <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='circle below' "> + <xsl:attribute name="style:text-emphasize">circle below</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="字:颜色"> + <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:隐藏文字"> + <xsl:attribute name="text:display"><xsl:value-of select="@字:值"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:空心"> + <xsl:attribute name="style:text-outline"><xsl:value-of select="@字:值"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:阴影"> + <xsl:if test="not(@字:值='false')"> + <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:删除线"> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + <xsl:choose> + <xsl:when test="@字:类型='double'"> + <xsl:attribute name="style:text-line-through-type">double</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='single'"> + <xsl:attribute name="style:text-underline-mode">continuous</xsl:attribute> + <xsl:attribute name="style:text-line-through-mode">continuous</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='bold'"> + <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='带/'"> + <xsl:attribute name="style:text-line-through-text">/</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='带X'"> + <xsl:attribute name="style:text-line-through-text">X</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template match="@字:颜色[not(.='auto')]"> + <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:浮雕"> + <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="@字:类型='engrave'">engraved</xsl:when><xsl:when test="@字:类型='emboss'">embossed</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template match="字:醒目字体"> + <xsl:choose> + <xsl:when test="@字:类型='small-caps'"> + <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='none'"> + <xsl:attribute name="fo:font-variant">normal</xsl:attribute> + <xsl:attribute name="fo:text-transform">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:text-transform"><xsl:choose><xsl:when test="@字:类型='uppercase'">uppercase</xsl:when><xsl:when test="@字:类型='lowercase'">lowercase</xsl:when><xsl:when test="@字:类型='capital'">capitalize</xsl:when></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:位置"> + <xsl:attribute name="style:text-position"><xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:缩放"> + <xsl:attribute name="style:text-scale"><xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:字符间距"> + <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:调整字间距"> + <xsl:attribute name="style:letter-kerning"><xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:外框"> + <xsl:attribute name="style:text-outline">true</xsl:attribute> + </xsl:template> + <xsl:template match="字:缩放"> + <xsl:attribute name="style:text-scale"><xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:字符间距[parent::字:句属性]"> + <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( number(.)* $other-to-cm-conversion-factor, $uofUnit)"/></xsl:attribute> + </xsl:template> + <xsl:template name="General-Char-Transition"> + <xsl:param name="input-char"/> + <xsl:param name="output-type"/> + <xsl:choose> + <xsl:when test="$input-char='A' or $input-char='a' or $input-char='1' or $input-char='Roman_I' or $input-char='Roman_i' or $input-char='一' or $input-char='壹' or $input-char='甲' or $input-char='子'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">1</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">甲</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">子</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='B' or $input-char='b' or $input-char='2' or $input-char='Roman_II' or $input-char='Roman_ii' or $input-char='二' or $input-char='贰' or $input-char='乙' or $input-char='丑'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">2</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">b</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">B</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">II</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">ii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">2</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">2</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">2</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">乙</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">丑</xsl:when> + <xsl:otherwise>2</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='C' or $input-char='c' or $input-char='3' or $input-char='Roman_III' or $input-char='Roman_iii' or $input-char='三' or $input-char='叁' or $input-char='丙' or $input-char='寅'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">3</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">c</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">C</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">III</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">iii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">3</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">三</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">3</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">叁</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">3</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">丙</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">寅</xsl:when> + <xsl:otherwise>3</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='D' or $input-char='d' or $input-char='4' or $input-char='Roman_IV' or $input-char='Roman_iv' or $input-char='四' or $input-char='肆' or $input-char='丁' or $input-char='卯'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">4</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">d</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">D</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">IV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">iv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">4</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">四</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">4</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">肆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">4</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">丁</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">卯</xsl:when> + <xsl:otherwise>4</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='E' or $input-char='e' or $input-char='5' or $input-char='Roman_V' or $input-char='Roman_v' or $input-char='五' or $input-char='伍' or $input-char='戊' or $input-char='辰'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">5</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">e</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">E</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">V</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">v</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">5</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">五</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">5</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">伍</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">5</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">戊</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">辰</xsl:when> + <xsl:otherwise>5</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='F' or $input-char='f' or $input-char='6' or $input-char='Roman_VI' or $input-char='Roman_vi' or $input-char='六' or $input-char='陆' or $input-char='己' or $input-char='巳'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">6</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">f</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">F</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">VI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">vi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">6</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">六</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">6</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">陆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">6</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">己</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">巳</xsl:when> + <xsl:otherwise>6</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='G' or $input-char='g' or $input-char='7' or $input-char='7' or $input-char='Roman_VII' or $input-char='Roman_vii' or $input-char='七' or $input-char='柒' or $input-char='庚' or $input-char='午'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">7</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">g</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">G</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">VII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">vii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">7</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">七</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">7</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">柒</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">7</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">庚</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">午</xsl:when> + <xsl:otherwise>7</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='H' or $input-char='h' or $input-char='8' or $input-char='Roman_VIII' or $input-char='Roman_viii' or $input-char='八' or $input-char='捌' or $input-char='辛' or $input-char='未'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">8</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">h</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">H</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">VIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">viii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">8</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">八</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">8</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">捌</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">8</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">辛</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">未</xsl:when> + <xsl:otherwise>8</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='I' or $input-char='i' or $input-char='9' or $input-char='Roman_IX' or $input-char='Roman_ix' or $input-char='九' or $input-char='玖' or $input-char='壬' or $input-char='申'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">9</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">i</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">I</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">IX</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">ix</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">9</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">九</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">9</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">玖</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">9</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">壬</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">申</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='J' or $input-char='j' or $input-char='10' or $input-char='Roman_X' or $input-char='Roman_x' or $input-char='十' or $input-char='拾' or $input-char='癸' or $input-char='酉'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">10</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">j</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">J</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">X</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">x</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">10</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">10</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">10</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">癸</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">酉</xsl:when> + <xsl:otherwise>10</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='K' or $input-char='k' or $input-char='11' or $input-char='Roman_XI' or $input-char='Roman_xi' or $input-char='十一' or $input-char='拾壹' or $input-char='戌'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">11</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">k</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">K</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">11</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">11</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">11</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">戌</xsl:when> + <xsl:otherwise>11</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='L' or $input-char='l' or $input-char='12' or $input-char='Roman_XII' or $input-char='Roman_xii' or $input-char='十二' or $input-char='拾贰' or $input-char='亥'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">12</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">l</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">L</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">12</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十二</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">12</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾贰</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">12</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">亥</xsl:when> + <xsl:otherwise>12</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='M' or $input-char='m' or $input-char='13' or $input-char='Roman_XIII' or $input-char='Roman_xiii' or $input-char='十三' or $input-char='拾叁'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">13</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">m</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">M</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xiii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">13</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十三</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">13</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾叁</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">13</xsl:when> + <xsl:otherwise>13</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='N' or $input-char='n' or $input-char='14' or $input-char='Roman_XIV' or $input-char='Roman_xiv' or $input-char='十四' or $input-char='拾肆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">14</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">n</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">N</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XIV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xiv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">14</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十四</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">14</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾肆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">14</xsl:when> + <xsl:otherwise>14</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='O' or $input-char='o' or $input-char='15' or $input-char='Roman_XV' or $input-char='Roman_xv' or $input-char='十五' or $input-char='拾伍'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">15</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">o</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">O</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">15</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十五</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">15</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾伍</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">15</xsl:when> + <xsl:otherwise>15</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='P' or $input-char='p' or $input-char='16' or $input-char='Roman_XVI' or $input-char='Roman_xvi' or $input-char='十六' or $input-char='拾陆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">16</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">p</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">P</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XVI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xvi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">16</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十六</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">16</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾陆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">16</xsl:when> + <xsl:otherwise>16</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='Q' or $input-char='q' or $input-char='17' or $input-char='Roman_XVII' or $input-char='Roman_xvii' or $input-char='十七' or $input-char='拾柒'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">17</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">q</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Q</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XVII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xvii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">17</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十七</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">17</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾柒</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">17</xsl:when> + <xsl:otherwise>17</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='R' or $input-char='r' or $input-char='18' or $input-char='Roman_XVIII' or $input-char='Roman_xviii' or $input-char='十八' or $input-char='拾捌'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">18</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">r</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">R</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XVIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xviii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">18</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十八</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">18</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾捌</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">18</xsl:when> + <xsl:otherwise>18</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='S' or $input-char='s' or $input-char='19' or $input-char='Roman_XIX' or $input-char='Roman_xix' or $input-char='十九' or $input-char='拾玖'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">19</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">s</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">S</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XIX</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xix</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">19</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十九</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">19</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾玖</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">19</xsl:when> + <xsl:otherwise>19</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='T' or $input-char='t' or $input-char='20' or $input-char='Roman_XX' or $input-char='Roman_xx' or $input-char='二十' or $input-char='贰拾'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">20</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">t</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">T</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XX</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xx</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">20</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">20</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">20</xsl:when> + <xsl:otherwise>20</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='U' or $input-char='u' or $input-char='21' or $input-char='Roman_XXI' or $input-char='Roman_xxi' or $input-char='二十一' or $input-char='贰拾壹'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">21</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">u</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">U</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">21</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">21</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">21</xsl:when> + <xsl:otherwise>21</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='V' or $input-char='v' or $input-char='22' or $input-char='Roman_XXII' or $input-char='Roman_xxii' or $input-char='二十二' or $input-char='贰拾贰'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">22</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">v</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">V</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">22</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十二</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">22</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾贰</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">22</xsl:when> + <xsl:otherwise>22</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='W' or $input-char='w' or $input-char='23' or $input-char='Roman_XXIII' or $input-char='Roman_xxiii' or $input-char='二十三' or $input-char='贰拾叁'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">23</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">w</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">W</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxiii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">23</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十三</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">23</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾叁</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">23</xsl:when> + <xsl:otherwise>23</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='X' or $input-char='x' or $input-char='24' or $input-char='Roman_XXIV' or $input-char='Roman_xxiv' or $input-char='二十四' or $input-char='贰拾肆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">24</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">x</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">X</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXIV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxiv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">24</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十四</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">24</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾肆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">24</xsl:when> + <xsl:otherwise>24</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='Y' or $input-char='y' or $input-char='25' or $input-char='Roman_XXV' or $input-char='Roman_xxv' or $input-char='二十五' or $input-char='贰拾伍'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">25</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">y</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Y</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">25</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十五</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">25</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾伍</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">25</xsl:when> + <xsl:otherwise>25</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='Z' or $input-char='z' or $input-char='26' or $input-char='Roman_XXVI' or $input-char='Roman_xxvi' or $input-char='二十六' or $input-char='贰拾陆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">26</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">z</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Z</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXVI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxvi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">26</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十六</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">26</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾陆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">26</xsl:when> + <xsl:otherwise>26</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">1</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--RedOffice comment (Zengjh) end charts--> + <!-- 以下模板的作用是将网格线颜色由16进制转换为十进制 --> + <xsl:template name="transform-hex-to-decimal"> + <xsl:param name="number"/> + <xsl:variable name="R-color-number"> + <xsl:call-template name="color-hex-to-decimal"> + <xsl:with-param name="chars" select="substring($number,2,2)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="G-color-number"> + <xsl:call-template name="color-hex-to-decimal"> + <xsl:with-param name="chars" select="substring($number,4,2)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="B-color-number"> + <xsl:call-template name="color-hex-to-decimal"> + <xsl:with-param name="chars" select="substring($number,6,2)"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$R-color-number * 65536 + $G-color-number * 256 + $B-color-number"/> + </xsl:template> + <!-- 以下模板的作用是为R或G或B颜色转换为十进制形式--> + <xsl:template name="color-hex-to-decimal"> + <xsl:param name="chars"/> + <xsl:variable name="first-num"> + <xsl:call-template name="hex-to-decimal"> + <xsl:with-param name="char" select="substring($chars,1,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="second-num"> + <xsl:call-template name="hex-to-decimal"> + <xsl:with-param name="char" select="substring($chars,2,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$first-num *16 + $second-num"/> + </xsl:template> + <xsl:template name="hex-to-decimal"> + <xsl:param name="char"/> + <xsl:choose> + <xsl:when test="$char='0'">0</xsl:when> + <xsl:when test="$char='1'">1</xsl:when> + <xsl:when test="$char='2'">2</xsl:when> + <xsl:when test="$char='3'">3</xsl:when> + <xsl:when test="$char='4'">4</xsl:when> + <xsl:when test="$char='5'">5</xsl:when> + <xsl:when test="$char='6'">6</xsl:when> + <xsl:when test="$char='7'">7</xsl:when> + <xsl:when test="$char='8'">8</xsl:when> + <xsl:when test="$char='9'">9</xsl:when> + <xsl:when test="$char='a'">10</xsl:when> + <xsl:when test="$char='b'">11</xsl:when> + <xsl:when test="$char='c'">12</xsl:when> + <xsl:when test="$char='d'">13</xsl:when> + <xsl:when test="$char='e'">14</xsl:when> + <xsl:when test="$char='f'">15</xsl:when> + </xsl:choose> + </xsl:template> + <!-- end --> + <!--ro000179 chenjh--> + <xsl:template name="search-left-top-in-tables"> + <xsl:param name="cellstylename"/> + <xsl:param name="tableslist"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$tableslist and $return=''"> + <xsl:variable name="firsttablerows" select="$tableslist[1]//表:行"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-inatable"> + <xsl:with-param name="row-num" select="'1'"/> + <xsl:with-param name="firsttablerows" select="$firsttablerows"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-in-tables"> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top!=''"> + <xsl:value-of select="$rest-left-top"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- 以下模板的作用为在一个table中寻找左上角--> + <xsl:template name="search-left-top-inatable"> + <xsl:param name="row-num"/> + <xsl:param name="firsttablerows"/> + <xsl:param name="cellstylename"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$firsttablerows and $return=''"> + <xsl:variable name="firstcells" select="$firsttablerows[1]/表:单元格"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-inarow"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="firstcells" select="$firstcells"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="row-num-p"> + <xsl:choose> + <xsl:when test="$firsttablerows[1]/@表:跨度"> + <xsl:value-of select="$row-num+ $firsttablerows[1]/@表:跨度"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$row-num+1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-inatable"> + <xsl:with-param name="row-num" select="$row-num-p"/> + <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top !=''"> + <xsl:value-of select="$rest-left-top "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- 以下模板的作用为在某一行中寻找左上角--> + <xsl:template name="search-left-top-inarow"> + <xsl:param name="row-num"/> + <xsl:param name="firstcells"/> + <xsl:param name="cellstylename"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$firstcells and $return=''"> + <xsl:variable name="firstcell" select="$firstcells[1]"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-inacell"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="cell" select="$firstcell"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-inarow"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top !=''"> + <xsl:value-of select="$rest-left-top "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- 以下的模板的作用为判断某个cell是否为左上角 --> + <xsl:template name="search-left-top-inacell"> + <xsl:param name="row-num"/> + <xsl:param name="cell"/> + <xsl:param name="cellstylename"/> + <xsl:choose> + <xsl:when test="$cell/@表:式样引用=$cellstylename"> + <xsl:value-of select="concat($cell/ancestor::表:工作表/@表:名称,'.',$cell/@表:列号,' ',$row-num)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + <!-- <xsl:variable name="style-is-default"> + <xsl:call-template name="is-default-or-not-condition-format"> + <xsl:with-param name="column-num" select="$cell/@表:列号"/> + <xsl:with-param name="cell" select="$cell"/> + <xsl:with-param name="preceding-cellstylename" select="''"/> + <xsl:with-param name="temp-num" select="'0'"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="table-columns" select="$cell/ancestor::表:工作表内容//表:列"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$style-is-default='yes' "> + <xsl:value-of select="concat($cell/ancestor::表:工作表/@表:名称,'.',$cell/@表:列号,' ',$row-num)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> --> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-left-top"> + <xsl:param name="left-top"/> + <xsl:if test="$left-top!=''"> + <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/> + <xsl:variable name="column-number1"> + <xsl:value-of select="floor( $column-number div 26 )"/> + </xsl:variable> + <xsl:variable name="column-number2"> + <xsl:value-of select="$column-number mod 26"/> + </xsl:variable> + <xsl:variable name="column-character1"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-character2"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat(substring-before($left-top,'.'),'.',$column-character1,$column-character2,substring-after($left-top,' '))"/> + </xsl:if> + </xsl:template> + <xsl:template name="create-the-condition-format-map"> + <xsl:param name="condition-format-set"/> + <xsl:param name="current-left-top"/> + <xsl:if test="$condition-format-set"> + <xsl:choose> + <xsl:when test="contains($condition-format-set[1]/表:区域/text(),$current-left-top)"> + <xsl:for-each select="$condition-format-set[1]/表:条件"> + <xsl:variable name="condition-text"> + <xsl:choose> + <xsl:when test="@表:类型='cell value'"> + <xsl:choose> + <xsl:when test="表:操作码/text()='between' "> + <xsl:value-of select="concat('cell-content-is-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test=" 表:操作码/text()='not between'"> + <xsl:value-of select="concat('cell-content-is-not-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/> + </xsl:when> + <xsl:when test="表:操作码/text()='equal to'"> + <xsl:value-of select="concat('cell-content()=',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='not equal to'"> + <xsl:value-of select="concat('cell-content()!=',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='greater than'"> + <xsl:value-of select="concat('cell-content()>',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='less than'"> + <xsl:value-of select="concat('cell-content()<',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='greater than or equal to'"> + <xsl:value-of select="concat('cell-content()>=',表:第一操作数/text())"/> + </xsl:when> + <xsl:when test="表:操作码/text()='less than or equal to'"> + <xsl:value-of select="concat('cell-content()<=',表:第一操作数/text())"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="@表:类型='formula'"> + <xsl:value-of select="concat('is-true-formula','(',表:第一操作数/text(),')')"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:element name="style:map"> + <xsl:attribute name="style:condition"><xsl:value-of select="$condition-text"/></xsl:attribute> + <xsl:attribute name="style:apply-style-name"><xsl:value-of select="//uof:单元格式样[@表:标识符=current()/表:格式/@表:式样引用]/@表:名称"/></xsl:attribute> + <xsl:attribute name="style:base-cell-address"><xsl:value-of select="substring-after($condition-format-set[1]/表:区域/text(),':')"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create-the-condition-format-map"> + <xsl:with-param name="condition-format-set" select="$condition-format-set[position()!=1]"/> + <xsl:with-param name="current-left-top" select="$current-left-top"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <!--ro000179 end--> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/uof/uof2odf_text.xsl b/filter/source/xslt/import/uof/uof2odf_text.xsl new file mode 100644 index 000000000..162fa4c7f --- /dev/null +++ b/filter/source/xslt/import/uof/uof2odf_text.xsl @@ -0,0 +1,4667 @@ +<?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:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0"> + <xsl:template match="uof:UOF"> + <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0"> + <xsl:apply-templates select="uof:元数据"/> + <xsl:apply-templates select="uof:文字处理/字:公用处理规则/字:文档设置"/> + <xsl:apply-templates select="uof:字体集"/> + <xsl:apply-templates select="uof:式样集"/> + <xsl:apply-templates select="uof:文字处理"/> + </office:document> + </xsl:template> + <xsl:template match="uof:元数据"> + <xsl:element name="office:meta"> + <meta:generator>UOFText 2004</meta:generator> + <dc:title> + <xsl:value-of select="uof:标题"/> + </dc:title> + <dc:description> + <xsl:value-of select="uof:摘要"/> + </dc:description> + <dc:subject> + <xsl:value-of select="uof:主题"/> + </dc:subject> + <meta:initial-creator> + <xsl:value-of select="uof:创建者"/> + </meta:initial-creator> + <meta:creation-date> + <xsl:value-of select="substring-before( uof:创建日期, 'Z')"/> + </meta:creation-date> + <dc:creator> + <xsl:value-of select="uof:最后作者"/> + </dc:creator> + <dc:date> + <xsl:value-of select="substring-before( uof:编辑时间, 'Z')"/> + </dc:date> + <meta:printed-by/> + <meta:print-date/> + <meta:keywords> + <meta:keyword> + <xsl:value-of select="uof:关键字集/uof:关键字"/> + </meta:keyword> + </meta:keywords> + <dc:language/> + <meta:editing-cycles> + <xsl:value-of select="uof:编辑次数"/> + </meta:editing-cycles> + <meta:editing-duration> + <xsl:if test="uof:编辑时间"> + <xsl:value-of select="concat('PT', floor(uof:编辑时间 div 60), 'H', uof:编辑时间 mod 60, 'M0S')"/> + </xsl:if> + </meta:editing-duration> + <meta:user-defined meta:name="Category"> + <xsl:value-of select="uof:分类"/> + </meta:user-defined> + <meta:user-defined meta:name="Manager"> + <xsl:value-of select="uof:经理名称"/> + </meta:user-defined> + <meta:user-defined meta:name="Company"> + <xsl:value-of select="uof:公司名称"/> + </meta:user-defined> + <meta:user-defined meta:name="Version"> + <xsl:value-of select="uof:创建应用程序"/> + </meta:user-defined> + <xsl:if test="uof:文档模板|child::*[@uof:locID='u0013']"> + <meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:href="{child::*[@uof:locID='u0013']}"/> + </xsl:if> + <xsl:if test="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']"> + <xsl:for-each select="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']"> + <xsl:element name="meta:user-defined"> + <xsl:attribute name="meta:name"><xsl:value-of select="@uof:名称"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:if> + <meta:document-statistic> + <xsl:attribute name="meta:page-count"> + <xsl:choose> + <xsl:when test="child::*[@uof:locID='u0020']"><xsl:value-of select="uof:页数"/></xsl:when> + <xsl:otherwise> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:段落/字:域开始[@字:类型='numpages']"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="fmt"> + <xsl:value-of select="substring-before($date0,' \*')"/> + </xsl:variable> + <xsl:if test="$fmt='Arabic'"><xsl:value-of select="following-sibling::字:句/字:文本串"/></xsl:if> + <xsl:if test="not($fmt='Arabic')"> + <xsl:variable name="content"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$content='I' or $content='i' or $content='A' or $content='a'">1</xsl:when> + <xsl:when test="$content='II' or $content='ii' or $content='B' or $content='b'">2</xsl:when> + </xsl:choose> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="meta:paragraph-count"><xsl:if test="child::*[@uof:locID='u0025']"><xsl:value-of select="uof:段落数"/></xsl:if></xsl:attribute> + <xsl:attribute name="meta:word-count"><xsl:if test="child::*[@uof:locID='u0023']"><xsl:value-of select="uof:中文字符数"/></xsl:if></xsl:attribute> + <xsl:attribute name="meta:object-count"><xsl:if test="child::*[@uof:locID='u0026']"><xsl:value-of select="uof:对象数"/></xsl:if></xsl:attribute> + <xsl:attribute name="meta:character-count"> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:段落/字:域开始[@字:类型='numchars']"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:for-each> + <xsl:if test="child::*[@uof:locID='u0021']"><xsl:value-of select="uof:字数"/></xsl:if> + </xsl:attribute> + </meta:document-statistic> + <meta:document-statistic/> + </xsl:element> + </xsl:template> + <xsl:variable name="uofUnit"> + <xsl:variable name="uu"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:度量单位"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$uu='cm'">cm</xsl:when> + <xsl:when test="$uu='mm'">mm</xsl:when> + <xsl:when test="$uu='pt'">pt</xsl:when> + <xsl:when test="$uu='inch'">in</xsl:when> + <xsl:otherwise>cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="other-to-cm-conversion-factor"> + <xsl:choose> + <xsl:when test="$uofUnit='cm'">1</xsl:when> + <xsl:when test="$uofUnit='mm'">0.1</xsl:when> + <xsl:when test="$uofUnit='pt'">0.03527</xsl:when> + <xsl:when test="$uofUnit='inch'">2.54</xsl:when> + <xsl:when test="$uofUnit='pica'">0.4233</xsl:when> + <xsl:otherwise>0.03527</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:template match="uof:式样集"> + <xsl:apply-templates select="uof:字体集"/> + <xsl:variable name="default_paragraph_style" select="uof:段落式样"/> + <xsl:variable name="default_character_style" select="uof:句式样"/> + <xsl:variable name="default_table_style" select="uof:文字表式样"/> + <office:styles> + <xsl:if test="uof:段落式样[@字:类型 = 'default']"> + <style:default-style style:family="paragraph"> + <xsl:element name="style:paragraph-properties"> + <xsl:attribute name="style:tab-stop-distance"><xsl:value-of select="concat( number(/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:默认制表位位置),$uofUnit)"/></xsl:attribute> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:式样集/uof:字体集/uof:默认字体"> + <xsl:attribute name="style:font-name"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:ascii"/></xsl:attribute> + <xsl:attribute name="style:font-name-asian"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:fareast"/></xsl:attribute> + <xsl:attribute name="style:font-name-complex"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:cs"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="uof:UOF/uof:式样集/uof:句式样/字:字体"/> + <xsl:if test="not(uof:UOF/uof:式样集/uof:句式样/字:字体/@字:字号 or uof:UOF/uof:式样集/uof:句属性/字:字体/@字:字号)"> + <xsl:attribute name="fo:font-size">10pt</xsl:attribute> + <xsl:attribute name="fo:font-size-asian">10pt</xsl:attribute> + <xsl:attribute name="fo:font-size-complex">10pt</xsl:attribute> + </xsl:if> + </xsl:element> + </style:default-style> + </xsl:if> + <xsl:for-each select="uof:段落式样[@字:类型='auto']"> + <xsl:element name="style:style"> + <xsl:attribute name="style:family">paragraph</xsl:attribute> + <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + <xsl:if test="@字:基式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:别名"> + <xsl:attribute name="style:display-name"><xsl:value-of select="@字:别名"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:paragraph-properties"> + <xsl:call-template name="XDParagraphAttr"/> + <xsl:apply-templates select="*[not(name()='字:大纲级别')]"/> + <xsl:if test="字:制表位设置"> + <xsl:call-template name="ootab"/> + </xsl:if> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="字:句属性/*"/> + </xsl:element> + <xsl:variable name="biaoshi" select="@字:标识符"/> + <xsl:for-each select="../uof:句式样"> + <xsl:if test="@字:标识符=$biaoshi"> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="*"/> + </xsl:element> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="uof:句式样[@字:类型='auto']"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + <xsl:choose> + <xsl:when test="ancestor::字:段落式样"> + <xsl:attribute name="style:family">paragraph</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:family">text</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="*"/> + </xsl:element> + </xsl:element> + </xsl:for-each> + <style:style style:name="ColumnBreakPara" style:family="paragraph"> + <style:text-properties fo:break-after="column"/> + </style:style> + <xsl:if test="uof:句式样"> + <style:default-style style:family="text"/> + </xsl:if> + <style:style style:name="Numbering Symbols" style:family="text"/> + <style:style style:name="Bullet Symbols" style:family="text"> + <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/> + </style:style> + <xsl:apply-templates select="uof:文字表式样" mode="table"/> + <xsl:apply-templates select="uof:式样"/> + <xsl:call-template name="脚注设置"/> + <xsl:call-template name="尾注设置"/> + <xsl:call-template name="行编号"/> + </office:styles> + <xsl:element name="office:automatic-styles"> + <style:style style:name="PageBreak" style:family="paragraph"> + <style:text-properties fo:break-before="page"/> + </style:style> + <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体/字:段落/字:句/字:句属性" mode="style"/> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:句"> + <xsl:variable name="stylename1" select="字:句属性/@字:式样引用"/> + <xsl:element name="style:style"> + <xsl:variable name="stylenum"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/> + </xsl:variable> + <xsl:attribute name="style:name"><xsl:value-of select="concat('T',$stylenum)"/></xsl:attribute> + <xsl:choose> + <xsl:when test="ancestor::字:段落式样"> + <xsl:attribute name="style:family">paragraph</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:family">text</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样"> + <xsl:if test="$stylename1=@字:标识符"> + <xsl:choose> + <xsl:when test="@字:标识符=/uof:UOF/uof:文字处理/字:主体/字:段落/字:句/字:句属性/字:格式修订/@字:修订信息引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:for-each> + <xsl:element name="style:text-properties"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样"> + <xsl:if test="$stylename1=@字:标识符"> + <xsl:apply-templates select="./字:位置" mode="oo"/> + <xsl:apply-templates select="*[not(name()='字:位置')]"/> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'date']"> + <xsl:element name="number:date-style"> + <xsl:attribute name="style:name">Date<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'date']"/></xsl:attribute> + <xsl:call-template name="日期域"/> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'createdate']"> + <xsl:element name="number:date-style"> + <xsl:attribute name="style:name">CreateDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createdate']"/></xsl:attribute> + <xsl:call-template name="日期域"/> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'savedate']"> + <xsl:element name="number:date-style"> + <xsl:attribute name="style:name">SaveDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'savedate']"/></xsl:attribute> + <xsl:call-template name="日期域"/> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'time']"> + <xsl:element name="number:date-style"> + <xsl:attribute name="style:name">Time<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'time']"/></xsl:attribute> + <xsl:call-template name="时间域"/> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'edittime']"> + <xsl:element name="number:time-style"> + <xsl:attribute name="style:name">EditTime<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'edittime']"/></xsl:attribute> + <xsl:call-template name="编辑时间"/> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'createtime']"> + <xsl:element name="number:time-style"> + <xsl:attribute name="style:name">CREATETIME<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createtime']"/></xsl:attribute> + <xsl:call-template name="创建时间"/> + </xsl:element> + </xsl:for-each> + <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:文字表[not(@字:类型='sub-table')]" mode="style"/> + <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:单元格" mode="style"/> + <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:行[not(../../@字:类型='sub-table')]" mode="style"/> + <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:列宽集[not(../../@字:类型='sub-table')]" mode="style"/> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:自动编号信息"> + <xsl:variable name="currlistid" select="@字:编号引用"/> + <xsl:variable name="currlist" select="."/> + <xsl:variable name="rootlist" select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符 =$currlistid]"/> + <xsl:if test="not(ancestor::字:段落/preceding-sibling::字:段落[1]/字:段落属性/字:自动编号信息/@字:编号引用= $currlistid)"> + <xsl:element name="text:list-style"> + <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::字:自动编号信息)"/></xsl:attribute> + <xsl:for-each select="$rootlist"> + <xsl:for-each select="字:级别"> + <xsl:choose> + <xsl:when test="字:项目符号"> + <xsl:call-template name="xiangmufuhao"> + <xsl:with-param name="biaoshifu" select="../@字:标识符"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="字:图片符号引用"> + <xsl:call-template name="imagefuhao"> + <xsl:with-param name="biaoshifu" select="../@字:标识符"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="jibianhao"> + <xsl:with-param name="biaoshifu" select="../@字:标识符"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:for-each> + </xsl:element> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:节属性"> + <xsl:element name="style:page-layout"> + <xsl:attribute name="style:name">pm<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any"/></xsl:attribute> + <xsl:if test="字:对称页边距/@字:值='true'"> + <xsl:attribute name="style:page-usage">mirrored</xsl:attribute> + </xsl:if> + <xsl:element name="style:page-layout-properties"> + <xsl:if test="字:纸张方向"> + <xsl:attribute name="style:print-orientation"><xsl:choose><xsl:when test="字:纸张方向='portrait'">portrait</xsl:when><xsl:when test="字:纸张方向='landscape'">landscape</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(字:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:page-height"><xsl:value-of select="concat(字:纸张/@uof:高度,$uofUnit)"/></xsl:attribute> + <xsl:choose> + <xsl:when test="字:页边距"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上 ,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:页边距/@uof:左,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:页边距/@uof:下,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="字:装订线/@字:位置='top'"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上 ,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:页边距/@uof:左,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="字:装订线/@字:位置='left' "> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat((字:页边距/@uof:左+ 字:装订线/@字:距边界),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:页边距/@uof:左,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:页边距/@uof:下,$uofUnit)"/></xsl:attribute> + <xsl:if test="字:拼页/@字:值='1' or 字:拼页/@字:值='true'"> + <xsl:attribute name="style:page-usage">mirrored</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="string(字:文字排列方向)='vert-r2l'"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:when> + <xsl:when test="string(字:文字排列方向)='vert-l2r'"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:when> + <xsl:when test="string(字:文字排列方向)='hori-l2r'"> + <xsl:attribute name="style:writing-mode">lr-tb</xsl:attribute> + </xsl:when> + <xsl:when test="string(字:文字排列方向)='hori-r2l'"> + <xsl:attribute name="style:writing-mode">lr-tb</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:writing-mode">page</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="字:网格设置/@字:网格类型"> + <xsl:attribute name="style:layout-grid-mode"><xsl:choose><xsl:when test="字:网格设置/@字:网格类型='line-char'">both-nosnap</xsl:when><xsl:when test="字:网格设置/@字:网格类型='char'">both</xsl:when><xsl:when test="字:网格设置/@字:网格类型='line'">line</xsl:when><xsl:when test="字:网格设置/@字:网格类型='none'">none</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:网格设置/@字:宽度"> + <xsl:attribute name="style:layout-grid-base-width"><xsl:value-of select="concat(字:网格设置/@字:宽度,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:网格设置/@字:高度"> + <xsl:attribute name="style:layout-grid-base-height"><xsl:value-of select="concat(字:网格设置/@字:高度,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:网格设置/@字:显示网格"> + <xsl:attribute name="style:layout-grid-display"><xsl:value-of select="字:网格设置/@字:显示网格"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:网格设置/@字:打印网格"> + <xsl:attribute name="style:layout-grid-print"><xsl:value-of select="字:网格设置/@字:打印网格"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:稿纸设置/@字:类型"> + <xsl:attribute name="style:layout-grid-mode"><xsl:choose><xsl:when test="字:稿纸设置/@字:类型='draft-paper' ">both</xsl:when><xsl:when test="字:稿纸设置/@字:类型='letter-paper' ">line</xsl:when><xsl:otherwise>both</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:稿纸设置/@字:格式"> + <xsl:choose> + <xsl:when test="字:稿纸设置/@字:格式='fourth-gear'"> + <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-ruby-height">0.496cm</xsl:attribute> + </xsl:when> + <xsl:when test="字:稿纸设置/@字:格式='third-gear'"> + <xsl:attribute name="style:layout-grid-base-width">0.584cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-base-height">0.584cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-ruby-height">0.64cm</xsl:attribute> + </xsl:when> + <xsl:when test="字:稿纸设置/@字:格式='second-gear'"> + <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-ruby-height">0.905cm</xsl:attribute> + </xsl:when> + <xsl:when test="字:稿纸设置/@字:格式='first-gear'"> + <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute> + <xsl:attribute name="style:layout-grid-ruby-height">1.633cm</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:attribute name="style:layout-grid-display">true</xsl:attribute> + <xsl:attribute name="style:layout-grid-print">true</xsl:attribute> + </xsl:if> + <xsl:if test="字:稿纸设置/@字:颜色"> + <xsl:attribute name="style:layout-grid-color"><xsl:value-of select="字:稿纸设置/@字:颜色"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:边框"> + <xsl:for-each select="字:边框"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + </xsl:if> + <xsl:if test="字:填充"> + <xsl:for-each select="字:填充"> + <xsl:call-template name="uof:填充"/> + </xsl:for-each> + </xsl:if> + <xsl:apply-templates select="字:填充"/> + <xsl:attribute name="style:num-format"><xsl:variable name="format"><xsl:value-of select="字:页码设置/@字:格式"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute> + <xsl:if test="字:纸张来源/@字:其他页"> + <xsl:attribute name="style:paper-tray-name"><xsl:value-of select="字:纸张来源/@字:其他页"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:分栏/@字:栏数"> + <xsl:apply-templates select="字:分栏"/> + </xsl:if> + </xsl:element> + <xsl:if test="字:页眉位置"> + <style:header-style> + <xsl:element name="style:header-footer-properties"> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:页眉位置/@字:距边界,$uofUnit)"/></xsl:attribute> + <xsl:variable name="long1" select="字:页眉位置/@字:距边界"/> + <xsl:variable name="long2" select="字:页眉位置/@字:距版芯"/> + <xsl:variable name="long" select="$long1 + $long2"/> + <xsl:attribute name="svg:height"><xsl:value-of select="concat($long,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="style:dynamic-spacing">false</xsl:attribute> + </xsl:element> + </style:header-style> + </xsl:if> + <xsl:if test="字:页脚位置"> + <style:footer-style> + <xsl:element name="style:header-footer-properties"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页脚位置/@字:距边界,$uofUnit)"/></xsl:attribute> + <xsl:variable name="long1" select="字:页脚位置/@字:距边界"/> + <xsl:variable name="long2" select="字:页脚位置/@字:距版芯"/> + <xsl:variable name="long" select="$long1 + $long2"/> + <xsl:attribute name="svg:height"><xsl:value-of select="concat($long,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="style:dynamic-spacing">false</xsl:attribute> + </xsl:element> + </style:footer-style> + </xsl:if> + </xsl:element> + <xsl:if test="字:分栏/@字:栏数"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">sect<xsl:value-of select="count(preceding::字:节属性[字:分栏/@字:栏数])"/></xsl:attribute> + <xsl:attribute name="style:family">section</xsl:attribute> + <xsl:element name="style:page-layout-properties"> + <xsl:element name="style:columns"> + <xsl:attribute name="fo:column-count"><xsl:value-of select="number(字:分栏/@字:栏数)"/></xsl:attribute> + <xsl:attribute name="fo:column-gap"><xsl:value-of select="concat(number(字:分栏/@字:分割线宽度),$uofUnit)"/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:for-each> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='png' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='gif' or /uof:UOF/uof:对象集/uof:其他对象/@uof:私有类型='图片'"> + <style:style style:name="Graphics" style:family="graphic"> + <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/> + </style:style> + </xsl:if> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形"/> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形/图:文本内容/字:段落/字:句/字:句属性" mode="style"/> + <xsl:call-template name="duanluoshuxing"/> + </xsl:element> + <office:master-styles> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:节属性"> + <xsl:element name="style:master-page"> + <xsl:variable name="master-page-name"> + <xsl:number count="字:节属性" from="/uof:UOF/uof:文字处理/字:主体" level="any"/> + </xsl:variable> + <xsl:attribute name="style:name"><xsl:choose> + <xsl:when test="../@字:名称"><xsl:value-of select="../@字:名称"/></xsl:when> + <xsl:otherwise>Standard</xsl:otherwise> + </xsl:choose></xsl:attribute> + <xsl:attribute name="style:page-layout-name"><xsl:value-of select="concat('pm', $master-page-name)"/></xsl:attribute> + <xsl:if test="following::字:节属性"> + <xsl:attribute name="style:next-style-name">Standard<xsl:value-of select="$master-page-name +1"/></xsl:attribute> + </xsl:if> + <xsl:for-each select="字:页眉"> + <xsl:if test="字:首页页眉 or 字:奇数页页眉"> + <xsl:element name="style:header"> + <xsl:apply-templates select="字:奇数页页眉/字:段落 | 字:首页页眉/字:段落 | 字:奇数页页眉/字:文字表 | 字:首页页眉/字:文字表"/> + </xsl:element> + </xsl:if> + <xsl:if test="字:偶数页页眉"> + <xsl:element name="style:header-left"> + <xsl:apply-templates select="字:偶数页页眉/字:段落 | 字:偶数页页眉/字:文字表"/> + </xsl:element> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="字:页脚"> + <xsl:if test="字:奇数页页脚 or 字:首页页脚"> + <xsl:element name="style:footer"> + <xsl:apply-templates select="字:奇数页页脚/字:段落 | 字:首页页脚/字:段落 | 字:奇数页页脚/字:文字表 | 字:首页页脚/字:文字表"/> + </xsl:element> + </xsl:if> + <xsl:if test="字:偶数页页脚"> + <xsl:element name="style:footer-left"> + <xsl:apply-templates select="字:偶数页页脚/字:段落 | 字:偶数页页脚/字:文字表"/> + </xsl:element> + </xsl:if> + </xsl:for-each> + <xsl:if test="字:奇偶页页眉页脚不同"> + <xsl:element name="style:header-left"> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:for-each> + </office:master-styles> + </xsl:template> + <xsl:template match="字:填充"> + <xsl:choose> + <xsl:when test="图:颜色"> + <xsl:attribute name="fo:background-color"><xsl:value-of select="图:颜色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:图案/@图:背景色"> + <xsl:attribute name="style:text-background-color"><xsl:choose><xsl:when test="contains(图:图案/@图:背景色,'#')"><xsl:value-of select="图:图案/@图:背景色"/></xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="图:图案/@图:前景色"> + <xsl:attribute name="fo:text-background-color"><xsl:choose><xsl:when test="contains(图:图案/@图:前景色,'#')"><xsl:value-of select="图:图案/@图:前景色"/></xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="字:分栏"> + <xsl:element name="style:columns"> + <xsl:attribute name="fo:column-count"><xsl:value-of select="//字:分栏/@字:栏数"/></xsl:attribute> + <xsl:variable name="aa"> + <xsl:value-of select="//字:分栏/字:栏[position()=1]/@字:间距"/> + </xsl:variable> + <xsl:if test="//字:分栏/@字:等宽='true' "> + <xsl:attribute name="fo:column-gap"><xsl:value-of select="concat($aa * 2,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="//字:分栏/@字:分隔线宽度"> + <xsl:element name="style:column-sep"> + <xsl:attribute name="style:width"><xsl:value-of select="concat(@字:分隔线宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="style:color"><xsl:value-of select="@字:分隔线颜色"/></xsl:attribute> + <xsl:attribute name="style:height">100%</xsl:attribute> + <xsl:attribute name="style:vertical-align">top</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:for-each select="//字:分栏/字:栏"> + <xsl:element name="style:column"> + <xsl:attribute name="style:rel-width"><xsl:value-of select="@字:宽度"/>*</xsl:attribute> + <xsl:if test="parent::字:分栏/@字:宽度='true'"> + <xsl:choose> + <xsl:when test="self::node()[not(preceding-sibling::字:栏)]"> + <xsl:attribute name="fo:start-indent">0cm</xsl:attribute> + <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="self::node()[not(following-sibling::字:栏)]"> + <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:end-indent">0cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="parent::字:分栏/@字:等宽='false'"> + <xsl:variable name="last" select="preceding-sibling::字:栏[1]/@字:间距"/> + <xsl:choose> + <xsl:when test="self::node()[not(preceding-sibling::字:栏)]"> + <xsl:attribute name="fo:start-indent">0cm</xsl:attribute> + <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="self::node()[not(following-sibling::字:栏)]"> + <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat($last,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:end-indent">0cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat($last,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template match="uof:文字表式样" mode="table"> + <style:style style:family="table"> + <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + <xsl:if test="@字:基式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute> + </xsl:if> + <style:table-properties> + <xsl:choose> + <xsl:when test="字:对齐"> + <xsl:attribute name="table:align"><xsl:value-of select="字:对齐"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:align">margins</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="字:宽度/@字:相对宽度"> + <xsl:variable name="reltblw"> + <xsl:value-of select="concat(number(字:宽度/@字:相对宽度),'%')"/> + </xsl:variable> + <xsl:variable name="pagew"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/> + </xsl:variable> + <xsl:variable name="leftm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/> + </xsl:variable> + <xsl:variable name="rightm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/> + </xsl:variable> + <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(number(字:宽度/@字:相对宽度) * 100,'%')"/></xsl:attribute> + <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)) * number($reltblw),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="字:宽度/@字:绝对宽度"> + <xsl:attribute name="style:width"><xsl:value-of select="concat(number(字:宽度/@字:绝对宽度),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </style:table-properties> + </style:style> + </xsl:template> + <xsl:template match="字:文字表" mode="style"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/></xsl:attribute> + <xsl:attribute name="style:family">table</xsl:attribute> + <xsl:if test="@字:式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="name(preceding-sibling::*[1])='字:分节'"> + <xsl:attribute name="style:master-page-name"><xsl:value-of select="preceding-sibling::*[1]/@字:名称"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:table-properties"> + <xsl:for-each select="字:文字表属性"> + <xsl:variable name="biaoshi" select="@字:式样引用"/> + <xsl:choose> + <xsl:when test="字:对齐 = 'left' or 字:对齐 = 'center' or 字:对齐 = 'right'"> + <xsl:attribute name="table:align"><xsl:value-of select="字:对齐"/></xsl:attribute> + </xsl:when> + <xsl:when test="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:对齐"> + <xsl:attribute name="table:align"><xsl:value-of select="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:对齐"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:align">margins</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="字:左缩进"> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(number(字:左缩进),$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:绕排/@字:值='around'"> + <xsl:if test="字:绕排边距/@字:上"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:绕排边距/@字:上,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:绕排边距/@字:左"> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:绕排边距/@字:左,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:绕排边距/@字:右"> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:绕排边距/@字:右,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:绕排边距/@字:下"> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:绕排边距/@字:下,$uofUnit)"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="@字:式样引用"> + <xsl:variable name="rootStyle" select="@字:式样引用"/> + <xsl:variable name="rootStyleNode" select="/uof:UOF/uof:式样集/字:文字表式样[@字:基式样引用 = $rootStyle]"/> + <xsl:variable name="paddingleft"> + <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:左"/> + </xsl:variable> + <xsl:variable name="paddingright"> + <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:右"/> + </xsl:variable> + <xsl:variable name="paddingtop"> + <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:上"/> + </xsl:variable> + <xsl:variable name="paddingbottom"> + <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:下"/> + </xsl:variable> + <xsl:if test="$rootStyleNode/字:文字表属性/字:边距/@uof:左"> + <xsl:attribute name="fo:margin-left">-<xsl:value-of select="(number($paddingleft))* $other-to-cm-conversion-factor"/>cm</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:choose> + <xsl:when test="字:宽度/@字:相对宽度"> + <xsl:variable name="reltblw"> + <xsl:value-of select="字:宽度/@字:相对宽度"/> + </xsl:variable> + <xsl:variable name="pagew"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/> + </xsl:variable> + <xsl:variable name="leftm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/> + </xsl:variable> + <xsl:variable name="rightm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/> + </xsl:variable> + <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(number(字:宽度/@字:相对宽度) * 100,'%')"/></xsl:attribute> + <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)) * number($reltblw),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="字:宽度/@字:绝对宽度"> + <xsl:attribute name="style:width"><xsl:value-of select="concat(number(字:宽度/@字:绝对宽度),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:相对宽度 or /uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:绝对宽度"> + <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:相对宽度 * 100,'%')"/></xsl:attribute> + <xsl:attribute name="style:width"><xsl:value-of select="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:绝对宽度"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="pagew"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/> + </xsl:variable> + <xsl:variable name="leftm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/> + </xsl:variable> + <xsl:variable name="rightm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/> + </xsl:variable> + <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)),$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="tblsize" select="sum(字:列宽集/字:列宽)"/> + <xsl:if test="(not($tblsize='0')) and not(字:宽度) "> + <xsl:choose> + <xsl:when test="字:左缩进"> + <xsl:attribute name="style:width"><xsl:value-of select="concat( number($tblsize - 字:左缩进), $uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:width"><xsl:value-of select="concat( number(sum(字:列宽集/字:列宽) ), $uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="字:边框"> + <xsl:for-each select="字:边框"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + </xsl:if> + <xsl:for-each select="字:填充"> + <xsl:call-template name="uof:填充"/> + </xsl:for-each> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="字:列宽集" mode="style"> + <xsl:choose> + <xsl:when test="not(./字:列宽)"> + <xsl:for-each select="../.."> + <xsl:for-each select="字:行[1]/字:单元格"> + <xsl:element name="style:style"> + <xsl:attribute name="style:family">table-column</xsl:attribute> + <xsl:attribute name="style:name">Table<xsl:number count="字:文字表" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number value="count(preceding::字:单元格)+1"/></xsl:attribute> + <xsl:element name="style:table-column-properties"> + <xsl:choose> + <xsl:when test="字:单元格属性/字:宽度/@字:相对值"> + <xsl:variable name="tblw1"> + <xsl:choose> + <xsl:when test="../../字:文字表属性/字:宽度/@字:绝对宽度"> + <xsl:value-of select="../../字:文字表属性/字:宽度/@字:绝对宽度"/> + </xsl:when> + <xsl:when test="../../字:文字表属性/字:宽度/@字:相对宽度"> + <xsl:variable name="pagew"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/> + </xsl:variable> + <xsl:variable name="leftm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/> + </xsl:variable> + <xsl:variable name="rightm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/> + </xsl:variable> + <xsl:variable name="relw"> + <xsl:value-of select="../../字:文字表属性/字:宽度/@字:相对宽度"/> + </xsl:variable> + <xsl:value-of select=" ( number($pagew)-number($leftm)-number($rightm))* number($relw) div 100"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="pagew"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/> + </xsl:variable> + <xsl:variable name="leftm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/> + </xsl:variable> + <xsl:variable name="rightm"> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/> + </xsl:variable> + <xsl:value-of select="(number($pagew)-number($leftm)-number($rightm))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:column-width"><xsl:value-of select="concat(number(number($tblw1)*number(字:单元格属性/字:宽度/@字:相对值) div 100),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="字:单元格属性/字:宽度/@字:绝对值"> + <xsl:attribute name="style:column-width"><xsl:value-of select="concat(number(字:单元格属性/字:宽度/@字:绝对值),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:column-width"><xsl:value-of select="'1cm'"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="字:列宽"> + <xsl:element name="style:style"> + <xsl:attribute name="style:family">table-column</xsl:attribute> + <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number count="字:列宽" from="/uof:UOF/uof:文字处理/字:主体" level="single" format="1"/></xsl:attribute> + <xsl:variable name="tableRoot" select="ancestor::字:文字表"/> + <xsl:element name="style:table-column-properties"> + <xsl:choose> + <xsl:when test="string(.)"> + <xsl:attribute name="style:column-width"><xsl:value-of select="concat(.,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:column-width"><xsl:value-of select="'1cm'"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:行" mode="style"> + <xsl:element name="style:style"> + <xsl:attribute name="style:family">table-row</xsl:attribute> + <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/></xsl:attribute> + <xsl:element name="style:table-row-properties"> + <xsl:for-each select="字:表行属性"> + <xsl:choose> + <xsl:when test="字:高度/@字:固定值"> + <xsl:attribute name="style:row-height"><xsl:value-of select="concat(number(字:高度/@字:固定值),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="字:高度/@字:最小值"> + <xsl:attribute name="style:min-row-height"><xsl:value-of select="concat(number(字:高度/@字:最小值), $uofUnit )"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:attribute name="fo:keep-together"><xsl:value-of select="字:跨页/@字:值"/></xsl:attribute> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="字:单元格" mode="style"> + <style:style> + <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/>C<xsl:number count="字:单元格" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]/字:行" level="any" format="1"/></xsl:attribute> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:element name="style:table-cell-properties"> + <xsl:for-each select="字:单元格属性"> + <xsl:choose> + <xsl:when test="字:单元格边距/@字:左"> + <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(number(字:单元格边距/@字:左),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:padding-left"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:左"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="字:单元格边距/@字:右"> + <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(number(字:单元格边距/@字:右),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:padding-right"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:右"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="字:单元格边距/@字:上"> + <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(number(字:单元格边距/@字:上),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:padding-top"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:上"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="字:单元格边距/@字:下"> + <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(number(字:单元格边距/@字:下),$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:下"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="cellbefore"> + <xsl:value-of select="count(ancestor::字:单元格/preceding-sibling::字:单元格)"/> + </xsl:variable> + <xsl:variable name="cellafter"> + <xsl:value-of select="count(ancestor::字:单元格/following-sibling::字:单元格)"/> + </xsl:variable> + <xsl:variable name="rowbefore"> + <xsl:value-of select="count(ancestor::字:行/preceding-sibling::字:行)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="字:边框"> + <xsl:for-each select="字:边框"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="number($cellafter) > 0"> + <xsl:attribute name="fo:border-right">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:border-right">0.002cm solid #000000</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:border-left">0.002cm solid #000000</xsl:attribute> + <xsl:choose> + <xsl:when test="number($rowbefore) > 0"> + <xsl:attribute name="fo:border-top">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:border-top">0.002cm solid #000000</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:border-bottom">0.002cm solid #000000</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:垂直对齐方式='center' ">middle</xsl:when><xsl:when test="字:垂直对齐方式='bottom' ">bottom</xsl:when><xsl:otherwise>top</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:for-each select="字:填充"> + <xsl:call-template name="uof:填充"/> + </xsl:for-each> + </xsl:for-each> + </xsl:element> + </style:style> + </xsl:template> + <xsl:template match="uof:字体集"> + <xsl:element name="office:font-face-decls"> + <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/> + <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/> + <xsl:if test="not(uof:字体声明[@uof:名称='StarSymbol'])"> + <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/> + </xsl:if> + <xsl:for-each select="uof:字体声明"> + <xsl:element name="style:font-face"> + <xsl:attribute name="style:name"><xsl:value-of select="@uof:标识符"/></xsl:attribute> + <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:名称"/></xsl:attribute> + <xsl:if test="@uof:字符集 = '02'"> + <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute> + </xsl:if> + <xsl:if test="@uof:字体族"> + <xsl:choose> + <xsl:when test="@uof:字体族 = 'Swiss'"> + <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Modern'"> + <xsl:attribute name="style:font-family-generic">modern</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族='Roman'"> + <xsl:attribute name="style:font-family-generic">roman</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Script'"> + <xsl:attribute name="style:font-family-generic">script</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='Decorative'"> + <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:字体族 ='System'"> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:attribute name="style:font-pitch">12</xsl:attribute> + </xsl:element> + </xsl:for-each> + <xsl:apply-templates select="uof:字体声明"/> + </xsl:element> + </xsl:template> + <xsl:template match="uof:式样"> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="uof:句式样/*"/> + <xsl:apply-templates select="uof:段落式样/*"/> + <xsl:call-template name="paragraph-properties"/> + </xsl:element> + </xsl:template> + <xsl:template match="uof:段落式样"/> + <xsl:template match="uof:句式样"/> + <xsl:template match="字:公用处理规则"> + <xsl:apply-templates select="uof:文字处理/字:公用处理规则/字:文档设置"/> + </xsl:template> + <xsl:template match="uof:文字处理/字:公用处理规则/字:文档设置"> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="InBrowseMode" config:type="boolean"> + <xsl:choose> + <xsl:when test="字:当前视图='web'">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <xsl:if test="字:缩放"> + <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item> + <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item> + <xsl:choose> + <xsl:when test="字:缩放 = 'best-fit'"> + <config:config-item config:name="ZoomType" config:type="short">3</config:config-item> + </xsl:when> + <xsl:when test="字:缩放 = 'full-page'"> + <config:config-item config:name="ZoomType" config:type="short">2</config:config-item> + </xsl:when> + <xsl:when test="字:缩放 = 'text-fit'"> + <config:config-item config:name="ZoomType" config:type="short">1</config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + </xsl:otherwise> + </xsl:choose> + <config:config-item config:name="ZoomFactor" config:type="short"> + <xsl:value-of select="字:缩放"/> + </config:config-item> + </xsl:if> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + <config:config-item-set config:name="configuration-settings"> + <config:config-item-map-indexed config:name="ForbiddenCharacters"> + <config:config-item-map-entry> + <config:config-item config:name="Language" config:type="string">zh</config:config-item> + <config:config-item config:name="Country" config:type="string">CN</config:config-item> + <config:config-item config:name="Variant" config:type="string"/> + <config:config-item config:name="BeginLine" config:type="string"> + <xsl:choose> + <xsl:when test="字:标点禁则/字:行首字符 or *[@uof:locID='t0007']/*[@uof:locID='t0008']"> + <xsl:value-of select="*[@uof:locID='t0007']/*[@uof:locID='t0008']"/> + </xsl:when> + <xsl:otherwise>:!),.:;?]}_'"、。〉》」』】〕〗〞︰︱︳﹐_﹒﹔﹕﹖﹗﹚﹜﹞!),.:;?|}︴︶︸︺︼︾﹀﹂﹄﹏_~¢々‖_·ˇˉ―--′</xsl:otherwise> + </xsl:choose> + </config:config-item> + <config:config-item config:name="EndLine" config:type="string"> + <xsl:choose> + <xsl:when test="字:标点禁则/字:行尾字符 or *[@uof:locID='t0007']/*[@uof:locID='t0009']"> + <xsl:value-of select="*[@uof:locID='t0007']/*[@uof:locID='t0009']"/> + </xsl:when> + <xsl:otherwise>([{__'"‵〈《「『【〔〖([{£¥〝︵︷︹︻︽︿﹁﹃﹙﹛﹝({</xsl:otherwise> + </xsl:choose> + </config:config-item> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + </office:settings> + </xsl:template> + <xsl:template match="uof:文字处理"> + <xsl:element name="office:body"> + <xsl:element name="office:text"> + <xsl:call-template name="GenerateTrackChanges"/> + <text:sequence-decls> + <xsl:call-template name="default_sequence_declaration"/> + </text:sequence-decls> + <xsl:apply-templates/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="default_sequence_declaration"> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="Table"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="Text"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="AutoNr"> + </text:sequence-decl> + </xsl:template> + <xsl:template name="段落" match="字:段落[not((preceding-sibling::字:段落/字:域开始) and (not(preceding-sibling::字:段落/字:域结束)))][not(字:段落属性[字:自动编号信息])]"> + <xsl:if test="字:域开始/@字:类型='caption'"> + <xsl:apply-templates select="字:域代码"/> + </xsl:if> + <xsl:if test="字:域开始/@字:类型='REF'"> + <xsl:call-template name="目录域"/> + </xsl:if> + <xsl:if test="字:域开始/@字:类型='INDEX'"> + <xsl:call-template name="索引域"/> + </xsl:if> + <xsl:choose> + <xsl:when test="string(parent::node()/@uof:locID)='t0107'"> + <xsl:apply-templates select="字:脚注"/> + </xsl:when> + <xsl:when test="string(parent::node()/@uof:locID)='t0108'"> + <xsl:apply-templates select="字:尾注"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="commonParagraph"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:脚注"> + <xsl:element name="text:note"> + <xsl:attribute name="text:note-class">footnote</xsl:attribute> + <xsl:element name="text:note-citation"> + <xsl:attribute name="text:label"><xsl:value-of select="@字:引文体"/></xsl:attribute> + <xsl:value-of select="@字:引文体"/> + </xsl:element> + <xsl:element name="text:note-body"> + <xsl:for-each select="字:段落"> + <xsl:call-template name="commonParagraph"/> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="字:尾注"> + <xsl:element name="text:note"> + <xsl:attribute name="text:note-class">endnote</xsl:attribute> + <xsl:element name="text:note-citation"> + <xsl:attribute name="text:label"><xsl:value-of select="@字:引文体"/></xsl:attribute> + <xsl:value-of select="@字:引文体"/> + </xsl:element> + <xsl:element name="text:note-body"> + <xsl:for-each select="字:段落"> + <xsl:call-template name="commonParagraph"/> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="字:锚点"> + <xsl:call-template name="图形解析"/> + </xsl:template> + <xsl:key match="/uof:UOF/uof:文字处理/字:主体/字:段落/字:句/字:锚点 | /uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页眉//字:锚点 | /uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页脚//字:锚点" name="rel_graphic_name" use="字:图形/@字:图形引用"/> + <xsl:template match="图:图形"> + <xsl:variable name="random-name"> + <xsl:value-of select="generate-id()"/> + </xsl:variable> + <xsl:variable name="draw-name"> + <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/> + </xsl:variable> + <xsl:call-template name="graphic-fill"> + <xsl:with-param name="draw-name" select="$draw-name"/> + <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:填充/图:渐变"/> + </xsl:call-template> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变 | 图:预定义图形/图:属性/图:填充/图:颜色 | 图:预定义图形/图:属性/图:填充/图:图片 | 图:预定义图形/图:属性/图:填充/图:位图"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <xsl:if test="图:文本内容/@图:自动换行='true' or 图:文本内容/@图:自动换行='1'"> + <xsl:attribute name="draw:fit-to-contour">true</xsl:attribute> + </xsl:if> + <xsl:element name="style:graphic-properties"> + <xsl:call-template name="process-graphics"> + <xsl:with-param name="draw-name" select="$draw-name"/> + </xsl:call-template> + </xsl:element> + <xsl:if test="图:文本内容/@图:文字排列方向"> + <xsl:choose> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'"> + <style:paragraph-properties style:writing-mode="tb-rl"/> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'"> + <style:paragraph-properties style:writing-mode="tb-rl"/> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <xsl:element name="style:graphic-properties"> + <xsl:if test="@图:其他对象 or key('rel_graphic_name',@图:标识符)/字:锚点属性/字:锚点属性/字:位置/字:垂直/字:相对/@字:相对于"> + <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute> + <xsl:attribute name="draw:color-mode">standard</xsl:attribute> + <xsl:attribute name="draw:luminance">0%</xsl:attribute> + <xsl:attribute name="draw:contrast">0%</xsl:attribute> + <xsl:attribute name="draw:gamma">100%</xsl:attribute> + <xsl:attribute name="draw:red">0%</xsl:attribute> + <xsl:attribute name="draw:green">0%</xsl:attribute> + <xsl:attribute name="draw:blue">0%</xsl:attribute> + <xsl:attribute name="draw:image-opacity">100%</xsl:attribute> + <xsl:attribute name="style:mirror">none</xsl:attribute> + </xsl:if> + <xsl:call-template name="process-graphics"/> + </xsl:element> + <xsl:if test="图:文本内容/@图:文字排列方向"> + <xsl:choose> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'"> + <style:paragraph-properties style:writing-mode="tb-rl"/> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'"> + <style:paragraph-properties style:writing-mode="tb-rl"/> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="bina_graphic"> + <xsl:param name="refGraphic"/> + <xsl:element name="office:binary-data"> + <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]"> + <xsl:value-of select="uof:数据"/> + </xsl:for-each> + </xsl:element> + <text:p/> + </xsl:template> + <xsl:template name="graphic-fill"> + <xsl:param name="draw-name"/> + <xsl:param name="gradient-name"/> + <xsl:if test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:element name="draw:gradient"> + <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute> + <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute> + <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:渐变方向 * 10"/></xsl:attribute> + <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute> + <xsl:if test="$gradient-name/@图:种子X位置"> + <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:种子X位置,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="$gradient-name/@图:种子Y位置"> + <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:种子Y位置,'%')"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头"> + <xsl:element name="draw:marker"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'"> + <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute> + <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'"> + <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute> + <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute> + <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头"> + <xsl:element name="draw:marker"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'"> + <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute> + <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'"> + <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute> + <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute> + <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'"> + <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute> + <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"> + <xsl:element name="draw:fill-image"> + <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/></xsl:when></xsl:choose></xsl:when></xsl:choose></xsl:attribute> + <xsl:call-template name="bina_graphic"> + <xsl:with-param name="refGraphic"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/> + </xsl:when> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型"> + <xsl:variable name="line" select="图:预定义图形/图:属性/图:线型"/> + <xsl:element name="draw:stroke-dash"> + <xsl:choose> + <xsl:when test="$line='dash-long' or $line='dash-long-heavy'"> + <xsl:attribute name="draw:name">Fine_20_Dashed</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.508cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dot-dot-dash' or $line='dash-dot-dot-heavy'"> + <xsl:attribute name="draw:name">2 Dots 1 Dash</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">2</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.203cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.203cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dash' or $line='dashed-heavy'"> + <xsl:attribute name="draw:name">Ultrafine Dashed</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.051cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.051cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dotted' or $line='dotted-heavy'"> + <xsl:attribute name="draw:name">Ultrafine Dotted (var)</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:distance">50%</xsl:attribute> + </xsl:when> + <xsl:when test="$line='wave' or $line='wavy-heavy'"> + <xsl:attribute name="draw:name">Ultrafine 2 Dots 3 Dashes</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">2</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute> + <xsl:attribute name="draw:dots2">3</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.254cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.127cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='dot-dash' or $line='dash-dot-heavy'"> + <xsl:attribute name="draw:name">3 Dashes 3 Dots (var)</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">3</xsl:attribute> + <xsl:attribute name="draw:dots1-length">197%</xsl:attribute> + <xsl:attribute name="draw:dots2">3</xsl:attribute> + <xsl:attribute name="draw:distance">100%</xsl:attribute> + </xsl:when> + <xsl:when test="$line='double'"> + <xsl:attribute name="draw:name">Line with Fine Dots</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">2.007cm</xsl:attribute> + <xsl:attribute name="draw:dots2">10</xsl:attribute> + <xsl:attribute name="draw:distance">0.152cm</xsl:attribute> + </xsl:when> + <xsl:when test="$line='wavy-double'"> + <xsl:attribute name="draw:name">Fine Dashed (var)</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">197%</xsl:attribute> + <xsl:attribute name="draw:distance">197%</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="draw:name">Fine Dashed</xsl:attribute> + <xsl:attribute name="draw:style">rect</xsl:attribute> + <xsl:attribute name="draw:dots1">1</xsl:attribute> + <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:dots2">1</xsl:attribute> + <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute> + <xsl:attribute name="draw:distance">0.508cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="process-graphics"> + <xsl:param name="draw-name"/> + <xsl:if test="图:预定义图形/图:类别"> + </xsl:if> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:位置/字:垂直"> + <xsl:attribute name="style:vertical-pos"><xsl:choose><xsl:when test="字:绝对">from-top</xsl:when><xsl:when test="字:相对/@字:值='bottom'">bottom</xsl:when><xsl:when test="字:相对/@字:值='center'">middle</xsl:when><xsl:when test="字:相对/@字:值='inside'">below</xsl:when><xsl:otherwise>top</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="style:vertical-rel"><xsl:choose><xsl:when test="@字:相对于='margin'">paragraph-content</xsl:when><xsl:otherwise><xsl:value-of select="@字:相对于"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:for-each> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:位置/字:水平"> + <xsl:attribute name="style:horizontal-pos"><xsl:choose><xsl:when test="字:绝对">from-left</xsl:when><xsl:otherwise><xsl:value-of select="字:相对/@字:值"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="style:horizontal-rel"><xsl:choose><xsl:when test="@字:相对于='margin'">paragraph</xsl:when><xsl:when test="@字:相对于='page'">page</xsl:when><xsl:when test="@字:相对于='column'">paragraph</xsl:when><xsl:when test="@字:相对于='char'">char</xsl:when></xsl:choose></xsl:attribute> + </xsl:for-each> + <xsl:variable name="wrap_type"> + <xsl:value-of select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:绕排/@字:绕排方式"/> + </xsl:variable> + <xsl:variable name="aa"> + <xsl:value-of select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:绕排/@字:绕排顶点"/> + </xsl:variable> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:绕排/@字:绕排方式"> + <xsl:attribute name="style:wrap"><xsl:choose><xsl:when test="$wrap_type = 'through'">run-through</xsl:when><xsl:when test="$wrap_type = 'tight'">right</xsl:when><xsl:when test="$wrap_type = 'square'">parallel</xsl:when><xsl:when test="$wrap_type = 'top-bottom'">dynamic</xsl:when><xsl:when test="$wrap_type = 'infrontoftext'">run-through</xsl:when><xsl:when test="$wrap_type = 'behindtext'">run-through</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="style:run-through"><xsl:choose><xsl:when test="$wrap_type = 'behindtext'">background</xsl:when><xsl:otherwise>foreground</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:for-each> + <xsl:if test="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:边距"> + <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:边距"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(@字:上,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(@字:下,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(@字:右,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(@字:左,$uofUnit)"/></xsl:attribute> + </xsl:for-each> + </xsl:if> + <xsl:if test="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:保护/@字:值='true'"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:名称"> + <xsl:attribute name="style:protect">position size</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:protect">content size position</xsl:attribute> + <xsl:attribute name="draw:size-protect">true</xsl:attribute> + <xsl:attribute name="draw:move-protect">true</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="图:预定义图形/图:名称"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:名称='椭圆'"> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:choose> + <xsl:when test="not(图:预定义图形/图:属性/图:填充)"> + <xsl:attribute name="draw:fill">none</xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称='background-image'"> + <xsl:element name="style:background-image"> + <xsl:element name="office:binary-data"> + <xsl:variable name="biaoshi"> + <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/> + </xsl:variable> + <xsl:value-of select="ancestor::uof:对象集/uof:其他对象[@uof:标识符=$biaoshi]/uof:数据"/> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-image-name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="not(图:预定义图形/图:属性/图:填充/图:图片/@图:位置='tile')"> + <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:前景色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色"> + <xsl:attribute name="draw:fill">solid</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute> + <xsl:attribute name="fo:background-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变"> + <xsl:attribute name="draw:fill">gradient</xsl:attribute> + <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:渐变/@图:起始色"/></xsl:attribute> + <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="图:预定义图形/图:属性/图:线颜色"> + <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')"> + <xsl:variable name="linetype" select="图:预定义图形/图:属性/图:线型"/> + <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$linetype='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$linetype='none'"> + <xsl:attribute name="fo:border">none</xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$linetype='dot-dot-dash' or $linetype='dash-dot-dot-heavy'">2 Dots 1 Dash</xsl:when><xsl:when test="$linetype='dash' or $linetype='dashed-heavy'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$linetype='dotted' or $linetype='dotted-heavy'">Ultrafine Dotted (var)</xsl:when><xsl:when test="$linetype='double'">Line with Fine Dots</xsl:when><xsl:when test="$linetype='dot-dash' or $linetype='dash-dot-heavy'">3 Dashes 3 Dots (var)</xsl:when><xsl:when test="$linetype='wave' or $linetype='wavy-heavy'">Ultrafine 2 Dots 3 Dashes</xsl:when><xsl:when test="$linetype='wavy-double'">Fine Dashed (var)</xsl:when><xsl:otherwise>Fine Dashed</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:线粗细"> + <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头"> + <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:前端箭头/图:大小"> + <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头"> + <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:后端箭头/图:大小"> + <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:宽度"> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:高度"> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度"> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:锁定纵横比"> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:打印对象"> + </xsl:if> + <xsl:if test="图:预定义图形/图:属性/图:透明度"> + <xsl:attribute name="draw:opacity"><xsl:value-of select="concat((100 - 图:预定义图形/图:属性/图:透明度),'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:if test="图:文本内容/@图:上边距"> + <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(图:文本内容/@图:上边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(图:文本内容/@图:下边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(图:文本内容/@图:左边距,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(图:文本内容/@图:右边距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容/@图:文字排列方向"> + <xsl:choose> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:when> + <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'"> + <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="图:文本内容/@图:水平对齐"> + <xsl:attribute name="draw:textarea-horizontal-align"><xsl:value-of select="图:文本内容/@图:水平对齐"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容/@图:垂直对齐"> + <xsl:attribute name="draw:textarea-vertical-align"><xsl:value-of select="图:文本内容/@图:垂直对齐"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容/@图:自动换行"> + <xsl:attribute name="fo:wrap-option"><xsl:choose><xsl:when test="图:文本内容/@图:自动换行='1' or 图:文本内容/@图:自动换行='true'">wrap</xsl:when><xsl:otherwise>no-wrap</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="图:文本内容/@图:大小适应文字='true'"> + <xsl:attribute name="draw:auto-grow-width">true</xsl:attribute> + <xsl:attribute name="draw:auto-grow-height">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="draw:auto-grow-width">false</xsl:attribute> + <xsl:attribute name="draw:auto-grow-height">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="图:控制点"> + </xsl:if> + </xsl:template> + <xsl:template name="图形解析"> + <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/> + <xsl:variable name="paiban"> + <xsl:value-of select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:名称"/> + </xsl:variable> + <xsl:variable name="otherobject"> + <xsl:value-of select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/@图:其他对象"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]"> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:私有类型='图片'"> + <xsl:element name="draw:frame"> + <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::字:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute> + <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="jiaodu"> + <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/> + </xsl:variable> + <xsl:variable name="shibie"> + <xsl:value-of select="图:预定义图形/图:生成软件"/> + </xsl:variable> + <xsl:variable name="rotate-angle"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')"> + <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:for-each> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"> + <draw:image> + <office:binary-data> + <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"/> + </office:binary-data> + </draw:image> + </xsl:if> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"> + <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:when> + <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/@图:其他对象 and /uof:UOF/uof:对象集/uof:其他对象/@uof:公共类型='jpg'"> + <xsl:variable name="bshi"> + <xsl:value-of select="/uof:UOF/uof:对象集/图:图形/@图:其他对象"/> + </xsl:variable> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$bshi]/@uof:公共类型='jpg'"> + <xsl:element name="draw:frame"> + <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::字:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute> + <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="jiaodu"> + <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/> + </xsl:variable> + <xsl:variable name="shibie"> + <xsl:value-of select="图:预定义图形/图:生成软件"/> + </xsl:variable> + <xsl:variable name="rotate-angle"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')"> + <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + <xsl:variable name="qita"> + <xsl:value-of select="self::node()/@图:其他对象"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$qita]/uof:数据"> + <draw:image> + <office:binary-data> + <xsl:value-of select="."/> + </office:binary-data> + </draw:image> + </xsl:for-each> + </xsl:for-each> + <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"> + <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:when> + <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:文本内容[@图:文本框='true'] and not($paiban='排版框')"> + <draw:frame text:anchor-type="paragraph"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute> + <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:z-index"> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"><xsl:value-of select="@图:层次"/></xsl:for-each> + </xsl:attribute> + <draw:text-box> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:段落"/> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:文字表"/> + </draw:text-box> + </draw:frame> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="leibie"> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"> + <xsl:value-of select="图:预定义图形/图:类别"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="leibie2"> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"> + <xsl:value-of select="图:预定义图形/图:名称"/> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="$leibie='22'"> + <xsl:call-template name="排版框"> + <xsl:with-param name="biaoshi" select="$tuxing1"/> + <xsl:with-param name="name" select="$leibie2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$leibie='23'"> + <xsl:call-template name="文本框"> + <xsl:with-param name="biaoshi" select="$tuxing1"/> + <xsl:with-param name="name" select="$leibie2"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$leibie='11'"> + <xsl:call-template name="Rectangle"/> + </xsl:when> + <xsl:when test="$leibie='19'"> + <xsl:call-template name="Oval"/> + </xsl:when> + <xsl:when test="$leibie='61'"> + <xsl:call-template name="Line"/> + </xsl:when> + <xsl:when test="$leibie='62'"> + <xsl:call-template name="Line"/> + </xsl:when> + <xsl:when test="$leibie='63'"> + <xsl:call-template name="Line"/> + </xsl:when> + <xsl:when test="$leibie='64'"> + <xsl:call-template name="Curve"/> + </xsl:when> + <xsl:when test="$leibie='65'"> + <xsl:call-template name="Freeform"/> + </xsl:when> + <xsl:when test="$leibie='66'"> + <xsl:call-template name="Scribble"/> + </xsl:when> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="文本框"> + <xsl:param name="biaoshi"/> + <xsl:param name="name"/> + <draw:frame text:anchor-type="paragraph"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$biaoshi"/></xsl:attribute> + <xsl:attribute name="draw:name"><xsl:value-of select="$name"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:z-index"> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $biaoshi]"> + <xsl:value-of select="@图:层次"/> + </xsl:for-each> + </xsl:attribute> + <draw:text-box> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:段落"/> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:文字表"/> + </draw:text-box> + </draw:frame> + </xsl:template> + <xsl:template name="Curve"> + <xsl:element name="draw:path"> + <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"> + <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点坐标/@图:路径"/></xsl:attribute> + </xsl:for-each> + <xsl:call-template name="common"/> + </xsl:element> + </xsl:template> + <xsl:template name="common"> + <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="jiaodu"> + <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/> + </xsl:variable> + <xsl:variable name="shibie"> + <xsl:value-of select="图:预定义图形/图:生成软件"/> + </xsl:variable> + <xsl:variable name="rotate-angle"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')"> + <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="common1"> + <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:预定义图形/图:属性/图:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:height"><xsl:value-of select="concat(/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:预定义图形/图:属性/图:高度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="jiaodu"> + <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/> + </xsl:variable> + <xsl:variable name="shibie"> + <xsl:value-of select="图:预定义图形/图:生成软件"/> + </xsl:variable> + <xsl:variable name="rotate-angle"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')"> + <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="Freeform"> + <xsl:element name="draw:polygon"> + <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/> + <xsl:variable name="width" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="draw:points"><xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:关键点坐标"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="concat(number(图:坐标[1]/@x坐标)*1000,',',number(图:坐标[1]/@y坐标)*1000)"/><xsl:with-param name="point-pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute> + <xsl:call-template name="common"/> + </xsl:element> + </xsl:template> + <xsl:template name="drawpoints"> + <xsl:param name="points"/> + <xsl:param name="point-pos"/> + <xsl:choose> + <xsl:when test="图:坐标[$point-pos]"> + <xsl:variable name="points1" select="concat($points,' ',number(图:坐标[$point-pos]/@x坐标)*1000,',',number(图:坐标[$point-pos]/@y坐标)*1000)"/> + <xsl:call-template name="drawpoints"> + <xsl:with-param name="points" select="$points1"/> + <xsl:with-param name="point-pos" select="$point-pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$points"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="Scribble"> + <xsl:element name="draw:polyline"> + <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/> + <xsl:variable name="width" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:宽度)*1000"/> + <xsl:variable name="height" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:高度)*1000"/> + <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute> + <xsl:attribute name="draw:points"><xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:关键点坐标"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="concat(number(图:坐标[1]/@x坐标)*1000,',',number(图:坐标[1]/@y坐标)*1000)"/><xsl:with-param name="point-pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute> + <xsl:call-template name="common"/> + </xsl:element> + </xsl:template> + <xsl:template name="Oval"> + <xsl:element name="draw:ellipse"> + <xsl:call-template name="common1"/> + </xsl:element> + </xsl:template> + <xsl:template name="排版框"> + <xsl:param name="biaoshi"/> + <xsl:param name="name"/> + <draw:frame text:anchor-type="paragraph"> + <xsl:attribute name="draw:style-name"><xsl:value-of select="$biaoshi"/></xsl:attribute> + <xsl:attribute name="draw:name"><xsl:value-of select="$name"/></xsl:attribute> + <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对"> + <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对"> + <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:z-index"> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $biaoshi]"> + <xsl:value-of select="@图:层次"/> + </xsl:for-each> + </xsl:attribute> + <draw:text-box> + <xsl:attribute name="fo:min-height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:段落"/> + <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:文字表"/> + </draw:text-box> + </draw:frame> + </xsl:template> + <xsl:template name="Rectangle"> + <xsl:element name="draw:rect"> + <xsl:call-template name="common1"/> + </xsl:element> + </xsl:template> + <xsl:template name="Line"> + <xsl:element name="draw:line"> + <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/> + <xsl:attribute name="svg:x1"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y1"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:x2"><xsl:value-of select="concat((字:锚点属性/字:位置/字:水平/字:绝对/@字:值 + 字:锚点属性/字:宽度),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="svg:y2"><xsl:value-of select="concat((字:锚点属性/字:位置/字:垂直/字:绝对/@字:值 + 字:锚点属性/字:高度),$uofUnit)"/></xsl:attribute> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"> + <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute> + <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute> + <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')"> + <xsl:variable name="jiaodu"> + <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/> + </xsl:variable> + <xsl:variable name="shibie"> + <xsl:value-of select="图:预定义图形/图:生成软件"/> + </xsl:variable> + <xsl:variable name="rotate-angle"> + <xsl:choose> + <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')"> + <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute> + </xsl:if> + <xsl:if test="图:文本内容"> + <xsl:apply-templates select="图:文本内容/字:段落"/> + <xsl:apply-templates select="图:文本内容/字:文字表"/> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="processPageBreaks"> + <xsl:variable name="pageBreak" select="字:句/字:分页符"/> + <xsl:call-template name="createSubParagraph"> + <xsl:with-param name="list" select="$pageBreak[1]/preceding-sibling::字:句"/> + <xsl:with-param name="pageBreak"/> + <xsl:with-param name="needsPageBreak">false</xsl:with-param> + </xsl:call-template> + <xsl:for-each select="$pageBreak"> + <xsl:call-template name="createSubParagraph"> + <xsl:with-param name="list" select="./following-sibling::字:句[preceding::字:句/字:分页符 = '.']"/> + <xsl:with-param name="pageBreak" select="."/> + <xsl:with-param name="needsPageBreak">true</xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="createSubParagraph"> + <xsl:param name="list"/> + <xsl:param name="pageBreak"/> + <xsl:param name="needsPageBreak"/> + <xsl:if test="(count($list) > 0) or ($needsPageBreak ='true') "> + <xsl:element name="text:p"> + <xsl:choose> + <xsl:when test="$needsPageBreak = 'true'"> + <xsl:choose> + <xsl:when test="ancestor::字:段落/字:段落属性"> + <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落属性"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:style-name">PageBreak</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + <xsl:if test="$pageBreak"> + <xsl:apply-templates select="$pageBreak"/> + </xsl:if> + <xsl:apply-templates select="$list"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="字:句/字:区域开始[@字:类型='bookmark']"> + <xsl:variable name="biaoshi"> + <xsl:value-of select="@字:标识符"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="not(@字:名称)"> + <text:bookmark-start text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本位置/@字:区域引用=$biaoshi]/@uof:名称}"/> + </xsl:when> + <xsl:otherwise> + <text:bookmark-start text:name="{@字:名称}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:句/字:区域结束[preceding::字:区域开始[1]/@字:类型='bookmark']"> + <xsl:variable name="biaoshi"> + <xsl:value-of select="@字:标识符引用"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="not(@字:名称)"> + <text:bookmark-end text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本位置/@字:区域引用=$biaoshi]/@uof:名称}"/> + </xsl:when> + <xsl:otherwise> + <text:bookmark-end text:name="{@字:名称}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:区域开始[@字:类型='annotation']"> + <text:bookmark-start text:name="{@字:标识符}"/> + </xsl:template> + <xsl:template match="字:区域结束[preceding::字:区域开始[1]/@字:类型='annotation']"> + <text:bookmark-end text:name="{@字:标识符引用}"/> + </xsl:template> + <xsl:template match="字:区域开始[@字:类型='user-data']"> + <text:alphabetical-index-mark-start text:id="{@字:标识符}" text:string-value-phonetic="{@字:名称}"/> + </xsl:template> + <xsl:template match="字:区域结束[preceding::字:区域开始[1]/@字:类型='user-data']"> + <text:alphabetical-index-mark-end text:id="{@字:标识符引用}"/> + </xsl:template> + <xsl:template match="字:段落/字:域开始"> + <xsl:choose> + <xsl:when test="@字:类型='createdate'"> + <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/> + <xsl:element name="text:creation-date"> + <xsl:attribute name="style:data-style-name">CreateDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createdate']"/></xsl:attribute> + <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute> + <xsl:value-of select="$datestr"/> + </xsl:element> + </xsl:when> + <xsl:when test="@字:类型='savedate'"> + <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/> + <xsl:element name="text:date"> + <xsl:attribute name="style:data-style-name">SaveDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'savedate']"/></xsl:attribute> + <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute> + <xsl:attribute name="text:fixed">true</xsl:attribute> + <xsl:value-of select="$datestr"/> + </xsl:element> + </xsl:when> + <xsl:when test="@字:类型='date'"> + <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/> + <xsl:element name="text:date"> + <xsl:attribute name="style:data-style-name">Date<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'date']"/></xsl:attribute> + <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute> + <xsl:value-of select="$datestr"/> + </xsl:element> + </xsl:when> + <xsl:when test="@字:类型='time'"> + <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/> + <xsl:element name="text:time"> + <xsl:attribute name="style:data-style-name">Time<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'time']"/></xsl:attribute> + <xsl:attribute name="text:time-value"><xsl:value-of select="$datestr"/></xsl:attribute> + <xsl:value-of select="$datestr"/> + </xsl:element> + </xsl:when> + <xsl:when test="@字:类型='edittime'"> + <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/> + <xsl:element name="text:editing-duration"> + <xsl:attribute name="style:data-style-name">EditTime<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'edittime']"/></xsl:attribute> + <xsl:value-of select="$datestr"/> + </xsl:element> + </xsl:when> + <xsl:when test="@字:类型='createtime'"> + <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/> + <xsl:element name="text:creation-time"> + <xsl:attribute name="style:data-style-name">CREATETIME<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createtime']"/></xsl:attribute> + <xsl:value-of select="$datestr"/> + </xsl:element> + </xsl:when> + <xsl:when test="@字:类型='page'"> + <xsl:call-template name="页码域"/> + </xsl:when> + <xsl:when test="@字:类型='numpages'"> + <xsl:call-template name="页数域"/> + </xsl:when> + <xsl:when test="@字:类型='author'"> + <xsl:call-template name="作者域"/> + </xsl:when> + <xsl:when test="@字:类型='username'"> + <xsl:call-template name="用户域"/> + </xsl:when> + <xsl:when test="@字:类型='userinitials'"> + <xsl:call-template name="缩写域"/> + </xsl:when> + <xsl:when test="@字:类型='title'"> + <xsl:call-template name="标题域"/> + </xsl:when> + <xsl:when test="@字:类型='subject'"> + <xsl:call-template name="主题域"/> + </xsl:when> + <xsl:when test="@字:类型='numchars'"> + <xsl:call-template name="字符数"/> + </xsl:when> + <xsl:when test="@字:类型='filename'"> + <xsl:call-template name="文件名"/> + </xsl:when> + <xsl:when test="@字:类型='edittime'"> + <xsl:call-template name="编辑时间"/> + </xsl:when> + <xsl:when test="@字:类型='creation-time'"> + <xsl:call-template name="创建时间"/> + </xsl:when> + <xsl:when test="@字:类型='seq'"> + <xsl:call-template name="题注"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="commonParagraph"> + <xsl:choose> + <xsl:when test="字:段落属性/字:大纲级别"> + <xsl:element name="text:h"> + <xsl:call-template name="commonParagraphAttributes"/> + <xsl:apply-templates/> + </xsl:element> + </xsl:when> + <xsl:when test="not (字:域开始/@字:类型='ref') and not(字:域开始/@字:类型='index')"> + <xsl:element name="text:p"> + <xsl:call-template name="commonParagraphAttributes"/> + <xsl:apply-templates/> + </xsl:element> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="commonParagraphAttributes"> + <xsl:choose> + <xsl:when test="字:段落属性"> + <xsl:variable name="pp"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/> + </xsl:variable> + <xsl:variable name="aa"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:域结束]"/> + </xsl:variable> + <xsl:variable name="stylename" select="字:段落属性/@字:式样引用"/> + <xsl:choose> + <xsl:when test="preceding-sibling::字:段落/字:域结束"> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$pp+$aa)"/></xsl:attribute> + </xsl:when> + <xsl:when test="contains($stylename,'Heading')"> + <xsl:attribute name="text:style-name"><xsl:value-of select="$stylename"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$pp)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="字:段落属性/字:大纲级别"> + <xsl:attribute name="text:outline-level"><xsl:value-of select="字:段落属性/字:大纲级别"/></xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:when test="generate-id(ancestor::字:主体/descendant::字:段落[1]) = generate-id(.)"> + <xsl:variable name="paragraph-number"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/> + </xsl:variable> + <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute> + </xsl:when> + <xsl:when test="not(字:段落属性) and (descendant::字:分栏符 or ancestor::字:分节/descendant::字:节属性[字:分栏/@字:栏数 > 1])"> + <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute> + </xsl:when> + <xsl:when test="字:句"> + <xsl:apply-templates select="字:文本串"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="字:段落属性"/> + <xsl:template match="字:句/字:句属性"/> + <xsl:template match="字:句属性" mode="style"> + <xsl:if test="not(@字:式样引用)"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句属性" format="1"/></xsl:attribute> + <xsl:attribute name="style:family">text</xsl:attribute> + <xsl:if test="@字:式样引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute> + </xsl:if> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="./*"/> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="字:句/字:文本串"> + <xsl:choose> + <xsl:when test="string(.) = ' ' "> + <xsl:element name="text:s"/> + </xsl:when> + <xsl:when test="contains(.,' ')"> + <xsl:call-template name="replace-spaces"> + <xsl:with-param name="curr-string" select="."/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="replace-spaces"> + <xsl:param name="curr-string"/> + <xsl:if test="contains($curr-string,' ')"> + <xsl:value-of select="substring-before($curr-string,' ')"/> + <text:s text:c="2"/> + <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/> + <xsl:choose> + <xsl:when test="contains($next-string, ' ')"> + <xsl:call-template name="replace-spaces"> + <xsl:with-param name="curr-string" select="$next-string"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$next-string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="字:空格符[parent::字:句]"> + <xsl:element name="text:s"> + <xsl:attribute name="text:c"><xsl:value-of select="@字:个数"/></xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="字:制表符[parent::字:句]"> + <xsl:element name="text:tab"/> + </xsl:template> + <xsl:template match="字:句"> + <xsl:if test="name(following-sibling::*[1])!='字:域结束'"> + <xsl:if test="字:换行符"> + <xsl:element name="text:line-break"/> + </xsl:if> + <xsl:variable name="currently-node" select="./字:锚点"/> + <xsl:choose> + <xsl:when test="字:句属性//字:隐藏文字/@字:值='true'"> + <text:hidden-text text:is-hidden="true" text:string-value="{.}"/> + </xsl:when> + <xsl:when test="字:区域开始[@字:类型='hyperlink']"> + <xsl:element name="text:a"> + <xsl:attribute name="xlink:type">simple</xsl:attribute> + <xsl:variable name="hyperDest" select="字:区域开始/@字:标识符"/> + <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链源=$hyperDest"><xsl:if test="@uof:提示"><xsl:attribute name="office:name"><xsl:value-of select="@uof:提示"/></xsl:attribute></xsl:if><xsl:if test="@uof:目标"><xsl:variable name="bsh" select="@uof:目标"/><xsl:choose><xsl:when test="contains($bsh,'\')"><xsl:value-of select="concat('/',translate($bsh,'\','/'))"/></xsl:when><xsl:otherwise><xsl:value-of select="$bsh"/></xsl:otherwise></xsl:choose></xsl:if><xsl:if test="@uof:书签"><xsl:variable name="bookmarkDest" select="@uof:书签"/><xsl:choose><xsl:when test="/uof:UOF/uof:书签集/uof:书签"><xsl:for-each select="/uof:UOF/uof:书签集/uof:书签"><xsl:if test="@uof:名称=$bookmarkDest"><xsl:value-of select="concat('#',@uof:名称)"/></xsl:if></xsl:for-each></xsl:when><xsl:otherwise><xsl:value-of select="concat('#',$bookmarkDest)"/></xsl:otherwise></xsl:choose></xsl:if></xsl:if></xsl:for-each></xsl:attribute> + <xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"> + <xsl:if test="@uof:链源=$hyperDest"> + <xsl:if test="@uof:提示"> + <xsl:attribute name="office:name"><xsl:value-of select="@uof:提示"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:for-each> + <xsl:choose> + <xsl:when test="./字:文本串"> + <xsl:apply-templates select="字:文本串"/> + </xsl:when> + <xsl:when test="following-sibling::字:句/字:文本串"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:when> + <xsl:when test="字:区域结束 and preceding::字:区域开始[1]/@字:类型='bookmark' and not(self::node()/字:区域开始)"> + <xsl:variable name="aa"> + <xsl:value-of select="字:区域结束/@字:标识符引用"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="preceding::字:区域开始[1]/@字:类型='bookmark' and not(preceding::字:区域开始[1]/@字:名称)"> + <text:bookmark-end text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本位置/@字:区域引用=$aa]/@uof:名称}"/> + </xsl:when> + <xsl:when test="preceding::字:区域开始[1]/@字:类型='bookmark'"> + <text:bookmark-end text:name="{preceding::字:区域开始[1]/@字:名称}"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="preceding-sibling::字:句[position()=1]/字:区域开始[@字:类型='hyperlink'] and not(preceding-sibling::字:句[position()=1]/字:区域结束)"/> + <xsl:when test="(preceding-sibling::字:句) or (字:句属性)or(字:区域开始)"> + <xsl:element name="text:span"> + <xsl:choose> + <xsl:when test="字:区域开始[@字:类型='annotation']"> + <xsl:variable name="ref_comment"> + <xsl:value-of select="字:区域开始/@字:标识符"/> + </xsl:variable> + <xsl:apply-templates/> + <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:公用处理规则/字:批注集/字:批注[@字:区域引用 = $ref_comment]"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="stylenum"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/> + </xsl:variable> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('T',$stylenum)"/></xsl:attribute> + <xsl:apply-templates select="*[not(name()='字:引文符号')]"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="字:文本串|字:锚点|字:空格符|字:换行符|字:制表符|字:区域开始|字:区域结束|字:脚注|字:尾注"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="node()[name() = '字:位置']"> + <xsl:attribute name="style:text-position"><xsl:variable name="val"><xsl:value-of select="."/></xsl:variable><xsl:choose><xsl:when test="$val='sub' or $val='super'"><xsl:value-of select="concat($val,' 58%')"/></xsl:when><xsl:when test="contains($val,'sub ') or contains($val,'super ')"><xsl:value-of select="concat($val,'%')"/></xsl:when><xsl:when test="not(contains($val,' '))"><xsl:value-of select="concat($val,'% 100%')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(substring-before($val,' '),'% ',substring-after($val,' '),'%' )"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template match="字:批注"> + <office:annotation office:display="true"> + <xsl:variable name="name" select="@字:作者"/> + <dc:creator> + <xsl:value-of select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$name]/@字:姓名"/> + </dc:creator> + <dc:date> + <xsl:value-of select="@字:日期"/> + </dc:date> + <xsl:apply-templates select="字:段落"/> + </office:annotation> + </xsl:template> + <xsl:template match="字:字体"> + <xsl:if test="@字:字号"> + <xsl:attribute name="fo:font-size"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@字:字号"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="@字:相对字号 and self::node( )[not(parent::字:句属性)]"> + <xsl:variable name="stylename" select="parent::node()/@字:基式样引用"/> + <xsl:variable name="zihao"> + <xsl:for-each select="/uof:UOF/uof:式样集//uof:段落式样[@字:标识符=$stylename]"> + <xsl:value-of select="字:字体/@字:字号"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="font-size" select="@字:相对字号"/> + <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="@字:颜色"> + <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:中文字体引用"> + <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:西文字体引用"> + <xsl:variable name="xiwen" select="@字:西文字体引用"/> + <xsl:attribute name="style:font-name"><xsl:value-of select="translate($xiwen,'_',' ')"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:斜体"> + <xsl:if test="@字:值='true'"> + <xsl:attribute name="fo:font-style">italic</xsl:attribute> + <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-asian">italic</xsl:attribute> + <xsl:attribute name="style:font-style-complex">italic</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:粗体"> + <xsl:if test="@字:值='true'or @字:值='1'"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:下划线"> + <xsl:choose> + <xsl:when test="@字:类型 = 'single'"> + <xsl:attribute name="style:text-underline-style">solid</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'double'"> + <xsl:attribute name="style:text-underline-style">solid</xsl:attribute> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'thick'"> + <xsl:attribute name="style:text-underline-style">solid</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dotted'"> + <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dotted-heavy'"> + <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash'"> + <xsl:attribute name="style:text-underline-style">dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dashed-heavy'"> + <xsl:attribute name="style:text-underline-style">dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-long'"> + <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-long-heavy'"> + <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dot-dash'"> + <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-dot-heavy'"> + <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dot-dot-dash'"> + <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'"> + <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wave'"> + <xsl:attribute name="style:text-underline-style">wave</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wavy-heavy'"> + <xsl:attribute name="style:text-underline-style">wave</xsl:attribute> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'wavy-double'"> + <xsl:attribute name="style:text-underline-style">wave</xsl:attribute> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + <xsl:attribute name="style:text-underline-width">auto</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:choose> + <xsl:when test="@字:颜色"> + <xsl:attribute name="style:text-underline-color"><xsl:choose><xsl:when test="@字:颜色='auto'">font-color</xsl:when><xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:着重号"> + <xsl:if test="not(@字:类型='none')"> + <xsl:choose> + <xsl:when test="@字:类型='dot'"> + <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='accent above' "> + <xsl:attribute name="style:text-emphasize">accent above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='dot above' "> + <xsl:attribute name="style:text-emphasize">dot above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='disc above' "> + <xsl:attribute name="style:text-emphasize">disc above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='circle above' "> + <xsl:attribute name="style:text-emphasize">circle above</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='accent below' "> + <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='dot below' "> + <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='disc below' "> + <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='circle below' "> + <xsl:attribute name="style:text-emphasize">circle below</xsl:attribute> + </xsl:when> + <xsl:otherwise>none</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="字:颜色"> + <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:隐藏文字"> + <xsl:attribute name="text:display"><xsl:value-of select="@字:值"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:空心"> + <xsl:attribute name="style:text-outline"><xsl:value-of select="@字:值"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:阴影"> + <xsl:if test="not(@字:值='false')"> + <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:闪动的"> + <xsl:attribute name="style:text-blinking"><xsl:value-of select="@字:闪动的"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:删除线"> + <xsl:choose> + <xsl:when test="@字:类型 = 'single' "> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'double' "> + <xsl:attribute name="style:text-line-through-type">double</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'bold' "> + <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = 'xl' "> + <xsl:attribute name="style:text-line-through-text">X</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型 = '/l' "> + <xsl:attribute name="style:text-line-through-text">/</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:text-crossing-out">none</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:突出显示"> + <xsl:attribute name="fo:background-color"> + <xsl:choose> + <xsl:when test="@字:颜色='auto'">transparent</xsl:when> + <xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:template> + <xsl:template match="@字:颜色[not(.='auto')]"> + <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute> + </xsl:template> + <xsl:template match="字:浮雕"> + <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="@字:类型='engrave'">engraved</xsl:when><xsl:when test="@字:类型='emboss'">embossed</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template match="字:醒目字体"> + <xsl:choose> + <xsl:when test="@字:类型='small-caps'"> + <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute> + </xsl:when> + <xsl:when test="@字:类型='none'"> + <xsl:attribute name="fo:font-variant">normal</xsl:attribute> + <xsl:attribute name="fo:text-transform">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:text-transform"><xsl:choose><xsl:when test="@字:类型='uppercase'">uppercase</xsl:when><xsl:when test="@字:类型='lowercase'">lowercase</xsl:when><xsl:when test="@字:类型='capital'">capitalize</xsl:when></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:位置" mode="oo"> + <xsl:attribute name="style:text-position"><xsl:variable name="val"><xsl:value-of select="."/></xsl:variable><xsl:choose><xsl:when test="$val='sub' or $val='super'"><xsl:value-of select="concat($val,' 58%')"/></xsl:when><xsl:when test="contains($val,'sub ') or contains($val,'super ')"><xsl:value-of select="concat($val,'%')"/></xsl:when><xsl:when test="not(contains($val,' '))"><xsl:value-of select="concat($val,'% 100%')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(substring-before($val,' '),'% ',substring-after($val,' '),'%' )"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template match="字:缩放"> + <xsl:attribute name="style:text-scale"><xsl:value-of select="."/>%</xsl:attribute> + </xsl:template> + <xsl:template match="字:字符间距"> + <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="."/>cm</xsl:attribute> + </xsl:template> + <xsl:template match="字:调整字间距"> + <xsl:variable name="tt" select="字:调整字间距"/> + <xsl:attribute name="style:letter-kerning"><xsl:choose><xsl:when test="$tt='1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template match="字:外框"> + <xsl:attribute name="style:text-outline">true</xsl:attribute> + </xsl:template> + <xsl:template match="字:字符间距[parent::字:句属性]"> + <xsl:variable name="aa"> + <xsl:value-of select="."/> + </xsl:variable> + <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( $aa, $uofUnit)"/></xsl:attribute> + </xsl:template> + <xsl:template match="字:分节"> + <xsl:if test="字:节属性/字:脚注设置"> + <xsl:call-template name="脚注设置"/> + </xsl:if> + <xsl:if test="字:节属性/字:尾注设置"> + <xsl:call-template name="尾注设置"/> + </xsl:if> + <xsl:if test="字:节属性/字:行号设置"> + <xsl:call-template name="行编号"/> + </xsl:if> + </xsl:template> + <xsl:template name="行编号"> + <xsl:element name="text:linenumbering-configuration"> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:行号设置"> + <xsl:choose> + <xsl:when test="@字:使用行号='false'"> + <xsl:attribute name="text:number-lines">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:style-name">Line numbering</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@字:编号方式"> + <xsl:choose> + <xsl:when test="@字:编号方式='section'"> + <xsl:attribute name="text:count-in-floating-frames">true</xsl:attribute> + </xsl:when> + <xsl:when test="@字:编号方式='page'"> + <xsl:attribute name="text:restart-on-page">true</xsl:attribute> + </xsl:when> + <xsl:when test="字:编号方式='continuous'"> + <xsl:attribute name="text:count-empty-lines">true</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="@字:起始编号"> + <xsl:attribute name="style:num-format"><xsl:value-of select="@字:起始编号"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:距边界"> + <xsl:attribute name="text:offset"><xsl:value-of select="concat(@字:距边界,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@字:行号间隔"> + <xsl:attribute name="text:increment"><xsl:value-of select="@字:行号间隔"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="脚注设置"> + <xsl:element name="text:notes-configuration"> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:脚注设置"> + <xsl:attribute name="text:note-class">footnote</xsl:attribute> + <xsl:attribute name="text:master-page-name">Footnote</xsl:attribute> + <xsl:attribute name="text:footnotes-position"><xsl:choose><xsl:when test="@字:位置='page-bottom'">page</xsl:when><xsl:when test="@字:位置='below-text'">document</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="text:start-numbering-at"><xsl:choose><xsl:when test="@字:编号方式='continuous'">document</xsl:when><xsl:when test="@字:编号方式='section'">chapter</xsl:when><xsl:when test="@字:编号方式='page'">page</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="text:start-value"><xsl:value-of select="@字:起始编号 - 1"/></xsl:attribute> + <xsl:attribute name="style:num-format"><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="@字:格式"/></xsl:call-template></xsl:attribute> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="尾注设置"> + <xsl:element name="text:notes-configuration"> + <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:尾注设置"> + <xsl:attribute name="text:note-class">endnote</xsl:attribute> + <xsl:attribute name="text:master-page-name">Endnote</xsl:attribute> + <xsl:attribute name="style:num-format"><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="@字:格式"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="text:start-value"><xsl:value-of select="@字:起始编号 - 1"/></xsl:attribute> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="paragraph-properties"> + <xsl:choose> + <xsl:when test="descendant::字:页边距[@uof:左]"> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="number((descendant::字:页边距/@uof:左)) * $other-to-cm-conversion-factor"/>cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-left">0cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="descendant::字:页边距[@uof:右]"> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="number((descendant::字:页边距/@uof:右)) * $other-to-cm-conversion-factor"/>cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-right">0cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:text-indent">0cm</xsl:attribute> + <xsl:call-template name="bidi"/> + </xsl:template> + <xsl:template name="bidi"> + </xsl:template> + <xsl:template match="字:文字表"> + <xsl:choose> + <xsl:when test="@字:类型 = 'sub-table'"> + <xsl:element name="table:table"> + <xsl:attribute name="table:is-sub-table">true</xsl:attribute> + <xsl:apply-templates select="字:文字表属性"> + <xsl:with-param name="sub-table" select="@字:类型"/> + </xsl:apply-templates> + <xsl:if test="字:行[position()=1]/字:表行属性/字:表头行/@字:值='true'"> + <xsl:element name="table:table-header-rows"> + <xsl:for-each select="字:行"> + <xsl:if test="字:表行属性/字:表头行/@字:值='true'"> + <xsl:apply-templates select="."/> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:for-each select="字:行[not(字:表行属性/字:表头行) or (字:表行属性/字:表头行/@字:值='false')]"> + <xsl:apply-templates select="."/> + </xsl:for-each> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="table:table"> + <xsl:if test="字:文字表属性"> + <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(字:文字表属性/字:列宽集/字:列宽)"> + <xsl:for-each select="字:行[1]/字:单元格"> + <xsl:element name="table:table-column"> + <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number value="count(preceding::字:单元格)+1"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:if> + <xsl:apply-templates select="字:文字表属性"/> + <xsl:if test="字:行[position()=1]/字:表行属性/字:表头行/@字:值='true'"> + <xsl:element name="table:table-header-rows"> + <xsl:for-each select="字:行"> + <xsl:if test="字:表行属性/字:表头行/@字:值='true'"> + <xsl:apply-templates select="."/> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:for-each select="字:行[not(字:表行属性/字:表头行) or (字:表行属性/字:表头行/@字:值='false')]"> + <xsl:apply-templates select="."/> + </xsl:for-each> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:文字表属性"> + <xsl:param name="sub-table"/> + <xsl:apply-templates select="字:列宽集"> + <xsl:with-param name="sub-table" select="$sub-table"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="字:列宽集"> + <xsl:param name="sub-table"/> + <xsl:apply-templates select="字:列宽"> + <xsl:with-param name="sub-table" select="$sub-table"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="字:列宽"> + <xsl:param name="sub-table"/> + <xsl:element name="table:table-column"> + <xsl:choose> + <xsl:when test="$sub-table='sub-table'"> + <xsl:variable name="subtable-leikuan" select="."/> + <xsl:variable name="weizi"> + <xsl:for-each select="ancestor::*[name()='字:文字表' and not(@字:类型='sub-table')]/字:文字表属性/字:列宽集/字:列宽"> + <xsl:variable name="yyyyy" select="."/> + <xsl:if test="substring(string($yyyyy),1,string-length(string($yyyyy))-1)=substring(string($subtable-leikuan),1,string-length(string($subtable-leikuan))-1)"> + <xsl:value-of select="concat(position(),';')"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="xxxxx"> + <xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/> + </xsl:variable> + <xsl:attribute name="table:style-name"><xsl:value-of select="concat('Table',$xxxxx,'.C',substring-before($weizi,';'))"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number count="字:列宽" from="/uof:UOF/uof:文字处理/字:主体" level="single" format="1"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:template> + <xsl:template match="字:行"> + <xsl:element name="table:table-row"> + <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/></xsl:attribute> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name()='字:单元格'"> + <xsl:call-template name="字:单元格"/> + </xsl:when> + <xsl:when test="name()='字:单元格覆盖'"> + + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="字:单元格"> + <xsl:element name="table:table-cell"> + <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/>C<xsl:number count="字:单元格" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]/字:行" level="any" format="1"/></xsl:attribute> + <xsl:if test="字:单元格属性"> + <xsl:apply-templates select="字:单元格属性"/> + </xsl:if> + <xsl:for-each select="node( )"> + <xsl:choose> + <xsl:when test="name( )='字:段落'"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="name( )='字:文字表'"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:otherwise> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template match="字:单元格属性/字:边框"> + <xsl:apply-templates/> + </xsl:template> + <xsl:template match="字:对齐[parent::字:文字表属性]"> + + </xsl:template> + <xsl:template match="uof:上"> + <xsl:choose> + <xsl:when test="@uof:宽度='nil' "> + <xsl:attribute name="fo:border-top">none</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度 and @uof:颜色"> + <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度"> + <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="uof:下"> + <xsl:choose> + <xsl:when test="@uof:宽度='nil' "> + <xsl:attribute name="fo:border-bottom">none</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度 and @uof:颜色"> + <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度"> + <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="uof:左"> + <xsl:choose> + <xsl:when test="@uof:宽度='nil'"> + <xsl:attribute name="fo:border-left">none</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度 and @uof:颜色"> + <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度"> + <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="uof:右"> + <xsl:choose> + <xsl:when test="@uof:宽度='nil' "> + <xsl:attribute name="fo:border-right">none</xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度 and @uof:颜色"> + <xsl:attribute name="fo:border-right"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="@uof:宽度"> + <xsl:attribute name="fo:border-right"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="字:文字表属性/字:边框"> + <xsl:apply-templates/> + </xsl:template> + <xsl:template match="字:单元格属性/字:边框"> + <xsl:call-template name="uof:边框"/> + </xsl:template> + <xsl:template match="字:左缩进"> + </xsl:template> + <xsl:template match="字:单元格属性"> + <xsl:if test="字:跨列/@字:值"> + <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="字:跨列/@字:值"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="编号风格"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="concat('P',@字:标识符)"/></xsl:attribute> + <xsl:attribute name="style:family">paragraph</xsl:attribute> + <xsl:attribute name="style:parent-style-name">Standard</xsl:attribute> + <xsl:attribute name="style:list-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + <xsl:element name="style:text-properties"> + <xsl:attribute name="fo:margin-left">0cm</xsl:attribute> + <xsl:attribute name="fo:margin-right">0cm</xsl:attribute> + <xsl:attribute name="fo:color"><xsl:value-of select="字:级别/字:符号字体/字:字体/字:颜色"/></xsl:attribute> + <xsl:attribute name="fo:text-indent"/> + <xsl:attribute name="style:auto-text-indent">false</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template name="编号格式"> + <xsl:attribute name="style:num-format"><xsl:choose><xsl:when test="string(字:编号格式)='lower-letter'">a</xsl:when><xsl:when test="string(字:编号格式)='upper-letter'">A</xsl:when><xsl:when test="string(字:编号格式)='lower-roman'">i</xsl:when><xsl:when test="string(字:编号格式)='upper-roman'">I</xsl:when><xsl:when test="string(字:编号格式)='decimal-enclosed-circle'">①, ②, ③, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-traditional'">甲, 乙, 丙, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-zodiac'">子, 丑, 寅, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-counting'">一, 二, 三, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-legal-simplified'">壹, 贰, 叁, ...</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template name="图形style"> + <xsl:for-each select="/uof:UOF/uof:对象集/图:图形"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <xsl:attribute name="style:parent-style-name">Graphics</xsl:attribute> + <xsl:element name="style:text-properties"> + <xsl:attribute name="svg:stroke-width"><xsl:value-of select="图:预定义图形/图:属性/图:线粗细"/></xsl:attribute> + <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute> + <xsl:attribute name="draw:stroke-dash"><xsl:value-of select="图:预定义图形/图:属性/图:线型"/></xsl:attribute> + <xsl:attribute name="draw:marker-start"><xsl:value-of select="图:预定义图形/图:属性/图:前端箭头/图:式样"/></xsl:attribute> + <xsl:attribute name="draw:marker-end"><xsl:value-of select="图:预定义图形/图:属性/图:后端箭头/图:式样"/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template name="duanluoshuxing"> + <xsl:for-each select="/uof:UOF/uof:文字处理//字:段落"> + <xsl:choose> + <xsl:when test="count(字:句)<=1"> + <xsl:call-template name="单个或者没有句"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="多个句"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="单个或者没有句"> + <xsl:variable name="stylename" select="字:段落属性/@字:式样引用"/> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">P<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落"/></xsl:attribute> + <xsl:attribute name="style:family">paragraph</xsl:attribute> + <xsl:if test="name(preceding-sibling::*[1])='字:分节'"> + <xsl:attribute name="style:master-page-name"><xsl:value-of select="preceding-sibling::字:分节[1]/@字:名称"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/@字:式样引用"> + <xsl:variable name="duanluoyinyong"> + <xsl:value-of select="字:段落属性/@字:式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF//uof:段落式样"> + <xsl:if test="$duanluoyinyong=@字:标识符"> + <xsl:if test="@字:基式样引用"> + <xsl:choose> + <xsl:when test="@字:标识符=/uof:UOF/uof:文字处理/字:主体/字:段落/字:段落属性/字:格式修订/@字:修订信息引用"> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute> + <xsl:variable name="aa"> + <xsl:value-of select="@字:基式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF//uof:段落式样"> + <xsl:if test="$aa=@字:标识符"> + <xsl:attribute name="style:display-name"><xsl:choose><xsl:when test="@字:别名"><xsl:value-of select="@字:别名"/></xsl:when><xsl:otherwise><xsl:value-of select="@字:名称"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:element name="style:paragraph-properties"> + <xsl:if test="字:对齐"> + <xsl:if test="字:对齐/@字:文字对齐"> + <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:对齐/@字:文字对齐='base'">baseline</xsl:when><xsl:when test="字:对齐/@字:文字对齐='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="字:对齐/@字:文字对齐"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:对齐/@字:水平对齐"> + <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="字:对齐/@字:水平对齐='left'">start</xsl:when><xsl:when test="字:对齐/@字:水平对齐='right'">end</xsl:when><xsl:when test="字:对齐/@字:水平对齐='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="字:对齐/@字:水平对齐='distributed'"> + <xsl:attribute name="fo:text-align-last">justify</xsl:attribute> + </xsl:if> + <xsl:attribute name="style:justify-single-word">false</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:call-template name="ParagraphAttr"/> + <xsl:if test="字:段落属性/字:制表位设置"> + <xsl:call-template name="ootab"/> + </xsl:if> + </xsl:element> + <xsl:if test="字:句属性"> + <xsl:variable name="bsh"> + <xsl:value-of select="字:句属性/@字:式样引用"/> + </xsl:variable> + <xsl:element name="style:text-properties"> + <xsl:for-each select="/uof:UOF//uof:句式样"> + <xsl:if test="$bsh=@字:标识符"> + <xsl:apply-templates select="./*"/> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="字:边框"> + <xsl:call-template name="uof:边框"/> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:if> + <xsl:element name="style:text-properties"> + <xsl:if test="字:句/字:句属性/字:字体"> + <xsl:variable name="ziti"> + <xsl:value-of select="字:句/字:句属性/字:字体/@字:中文字体引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:字体集/uof:字体声明"> + <xsl:if test="@uof:标识符=$ziti"> + <xsl:attribute name="style:font-name"><xsl:value-of select="@uof:名称"/></xsl:attribute> + <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@uof:名称"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:if test="字:句/字:句属性/字:字体/@字:字号"> + <xsl:attribute name="fo:font-size"><xsl:value-of select="字:句/字:句属性/字:字体/@字:字号"/></xsl:attribute> + <xsl:attribute name="style:font-size-asian"><xsl:value-of select="字:句/字:句属性/字:字体/@字:字号"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="字:段落属性/字:句属性"> + <xsl:for-each select="字:段落属性/字:句属性"> + <xsl:apply-templates select="./*"/> + </xsl:for-each> + </xsl:if> + <xsl:apply-templates select="字:句/字:句属性/字:浮雕 | 字:句/字:句属性/字:边框 | 字:句/字:句属性/字:缩放 | 字:句/字:句属性/字:阴影 | 字:句/字:句属性/字:删除线 | 字:句/字:句属性/字:下划线 | 字:句/字:填充"/> + <xsl:call-template name="ParagraphAttr"/> + <xsl:if test="字:段落属性/字:制表位设置"> + <xsl:call-template name="ootab"/> + </xsl:if> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样[@字:标识符=$stylename]"> + <xsl:apply-templates select="./*"/> + </xsl:for-each> + </xsl:element> + <style:paragraph-properties> + <xsl:if test="字:句/字:分栏符"> + <xsl:attribute name="fo:break-before">column</xsl:attribute> + </xsl:if> + <xsl:if test="字:句/字:分页符"> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:if> + <xsl:call-template name="ParagraphAttr"/> + <xsl:if test="字:段落属性/字:制表位设置"> + <xsl:call-template name="ootab"/> + </xsl:if> + </style:paragraph-properties> + </xsl:element> + </xsl:template> + <xsl:template name="ParagraphAttr"> + <xsl:apply-templates select="字:段落属性/字:填充"/> + <xsl:if test="字:段落属性/字:对齐"> + <xsl:if test="字:段落属性/字:对齐/@字:文字对齐"> + <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:段落属性/字:对齐/@字:文字对齐='base'">baseline</xsl:when><xsl:when test="字:段落属性/字:对齐/@字:文字对齐='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="字:段落属性/字:对齐/@字:文字对齐"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:对齐/@字:水平对齐"> + <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="字:段落属性/字:对齐/@字:水平对齐='left'">start</xsl:when><xsl:when test="字:段落属性/字:对齐/@字:水平对齐='right'">end</xsl:when><xsl:when test="字:段落属性/字:对齐/@字:水平对齐='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="字:段落属性/字:对齐/@字:水平对齐='distributed'"> + <xsl:attribute name="fo:text-align-last">justify</xsl:attribute> + </xsl:if> + <xsl:attribute name="style:justify-single-word">false</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:choose> + <xsl:when test="字:段落属性/字:缩进"> + <xsl:variable name="a1"> + <xsl:value-of select="字:段落属性/字:缩进/字:左/字:相对/@字:值"/> + </xsl:variable> + <xsl:variable name="a2"> + <xsl:value-of select="字:段落属性/字:缩进/字:右/字:相对/@字:值"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="字:段落属性/字:缩进/字:左/字:相对 or 字:段落属性/字:缩进/字:右/字:相对"> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat($a1 * 0.37,'cm')"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat($a2 * 0.37,'cm')"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:段落属性/字:缩进/字:左/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:段落属性/字:缩进/字:右/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(字:段落属性/字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进"> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进/字:左/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进/字:右/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="字:段落属性/字:行距"> + <xsl:variable name="type"> + <xsl:value-of select="字:段落属性/字:行距/@字:类型"/> + </xsl:variable> + <xsl:variable name="val"> + <xsl:value-of select="字:段落属性/字:行距/@字:值"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$type='fixed'"> + <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="$type='multi-lines'"> + <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val * 100,'%')"/></xsl:attribute> + </xsl:when> + <xsl:when test="$type='at-least'"> + <xsl:attribute name="style:line-height-at-least"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="$type='line-space'"> + <xsl:attribute name="style:line-spacing"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="字:段落属性/字:段间距"> + <xsl:if test="字:段落属性/字:段间距/字:段前距/字:绝对值/@字:值"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:段落属性/字:段间距/字:段前距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:段间距/字:段后距/字:绝对值/@字:值"> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:段落属性/字:段间距/字:段后距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:variable name="aa"> + <xsl:value-of select="字:段落属性/字:段间距/字:段前距/字:相对值/@字:值"/> + </xsl:variable> + <xsl:variable name="bb"> + <xsl:value-of select="字:段落属性/字:段间距/字:段后距/字:相对值/@字:值"/> + </xsl:variable> + <xsl:if test="字:段落属性/字:段间距/字:段前距/字:相对值/@字:值"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat($aa * 15.6,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:段间距/字:段后距/字:相对值/@字:值"> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat($bb * 15.6,$uofUnit)"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="字:段落属性/字:孤行控制"> + <xsl:attribute name="fo:widows"><xsl:value-of select="字:段落属性/字:孤行控制"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:寡行控制"> + <xsl:attribute name="fo:orphans"><xsl:value-of select="字:段落属性/字:寡行控制"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:段中不分页"> + <xsl:attribute name="fo:keep-together"><xsl:choose><xsl:when test="字:段落属性/字:段中不分页/@字:值='1' or 字:段落属性/字:段中不分页/@字:值='true'">always</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:与下段同页"> + <xsl:attribute name="fo:keep-with-next"><xsl:choose><xsl:when test="字:段落属性/字:与下段同页/@字:值='1' or 字:段落属性/字:与下段同页/@字:值='true'">always</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:for-each select="字:段落属性/字:边框"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + <xsl:for-each select="字:段落属性/字:填充"> + <xsl:call-template name="uof:填充"/> + </xsl:for-each> + <xsl:if test="字:段落属性/字:对齐网格"> + <xsl:attribute name="style:snap-to-layout-grid"><xsl:choose><xsl:when test="字:段落属性/字:对齐网格/@字:值='1' or 字:段落属性/字:对齐网格/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:取消断字"> + <xsl:attribute name="fo:hyphenation-ladder-count">no-limit</xsl:attribute> + <xsl:attribute name="fo:hyphenation-remain-char-count">2</xsl:attribute> + <xsl:attribute name="fo:hyphenation-push-char-count">2</xsl:attribute> + <xsl:attribute name="fo:hyphenate"><xsl:choose><xsl:when test="字:段落属性/字:取消断字/@字:值='1' or 字:段落属性/字:取消断字/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:取消行号"> + <xsl:attribute name="text:number-lines"><xsl:choose><xsl:when test="字:段落属性/字:取消行号/@字:值='1' or 字:段落属性/字:取消行号/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:行首尾标点控制"> + <xsl:attribute name="style:punctuation-wrap"><xsl:choose><xsl:when test="字:段落属性/字:行首尾标点控制/@字:值='1' or 字:段落属性/字:行首尾标点控制/@字:值='true'">hanging</xsl:when><xsl:otherwise>simple</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:是否行首标点压缩/@字:值='true'"> + <xsl:attribute name="style:punctuation-compress">false</xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:中文习惯首尾字符"> + <xsl:attribute name="style:line-break"><xsl:choose><xsl:when test="字:段落属性/字:中文习惯首尾字符/@字:值='1' or 字:段落属性/字:中文习惯首尾字符/@字:值='true'">strict</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:自动调整中英文字符间距 or 字:段落属性/字:自动调整中文与数字间距"> + <xsl:attribute name="style:text-autospace"><xsl:choose><xsl:when test="字:段落属性/字:自动调整中英文字符间距/@字:值='1' or 字:段落属性/字:自动调整中文与数字间距/@字:值='1'or 字:段落属性/字:自动调整中英文字符间距/@字:值='true' or 字:段落属性/字:自动调整中文与数字间距/@字:值='true'">ideograph-alpha</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:首字下沉"> + <xsl:element name="style:drop-cap"> + <xsl:if test="字:段落属性/字:首字下沉/@字:行数"> + <xsl:attribute name="style:lines"><xsl:value-of select="字:段落属性/字:首字下沉/@字:行数"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:首字下沉/@字:间距"> + <xsl:attribute name="style:distance"><xsl:value-of select="concat(字:段落属性/字:首字下沉/@字:间距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:首字下沉/@字:字体引用"> + <xsl:attribute name="style:style-name"><xsl:value-of select="translate(字:段落属性/字:首字下沉/@字:字体引用,'_',' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段落属性/字:首字下沉/@字:字符数"> + <xsl:attribute name="style:length"><xsl:choose><xsl:when test="字:段落属性/字:首字下沉/@字:字符数='1'">word</xsl:when><xsl:otherwise><xsl:value-of select="字:段落属性/字:首字下沉/@字:字符数"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="XDParagraphAttr"> + <xsl:apply-templates select="字:填充"/> + <xsl:if test="字:对齐"> + <xsl:if test="字:对齐/@字:文字对齐"> + <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:对齐/@字:文字对齐='base'">baseline</xsl:when><xsl:when test="字:对齐/@字:文字对齐='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="字:对齐/@字:文字对齐"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:对齐/@字:水平对齐"> + <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="字:对齐/@字:水平对齐='left'">start</xsl:when><xsl:when test="字:对齐/@字:水平对齐='right'">end</xsl:when><xsl:when test="字:对齐/@字:水平对齐='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="字:对齐/@字:水平对齐='distributed'"> + <xsl:attribute name="fo:text-align-last">justify</xsl:attribute> + </xsl:if> + <xsl:attribute name="style:justify-single-word">false</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="字:缩进"> + <xsl:if test="字:缩进/字:左/字:绝对/@字:值"> + <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:缩进/字:左/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:缩进/字:右/字:绝对/@字:值"> + <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:缩进/字:右/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:缩进/字:首行/字:绝对/@字:值"> + <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="字:行距"> + <xsl:variable name="type"> + <xsl:value-of select="字:行距/@字:类型"/> + </xsl:variable> + <xsl:variable name="val"> + <xsl:value-of select="字:行距/@字:值"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$type='fixed'"> + <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="$type='multi-lines'"> + <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val * 100,'%')"/></xsl:attribute> + </xsl:when> + <xsl:when test="$type='at-least'"> + <xsl:attribute name="style:line-height-at-least"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="$type='line-space'"> + <xsl:attribute name="style:line-spacing"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="字:段间距"> + <xsl:if test="字:段间距/字:段前距/字:绝对值/@字:值"> + <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:段间距/字:段前距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段间距/字:段后距/字:绝对值/@字:值"> + <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:段间距/字:段后距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="字:孤行控制"> + <xsl:attribute name="fo:orphans"><xsl:value-of select="字:孤行控制"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:寡行控制"> + <xsl:attribute name="fo:widows"><xsl:value-of select="字:寡行控制"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:段中不分页"> + <xsl:attribute name="fo:keep-together"><xsl:choose><xsl:when test="字:段中不分页/@字:值='1' or 字:段中不分页/@字:值='true'">always</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:与下段同页"> + <xsl:attribute name="fo:keep-with-next"><xsl:choose><xsl:when test="字:与下段同页/@字:值='1' or 字:与下段同页/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:for-each select="字:边框"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + <xsl:for-each select="字:填充"> + <xsl:call-template name="uof:填充"/> + </xsl:for-each> + <xsl:if test="字:对齐网格"> + <xsl:attribute name="style:snap-to-layout-grid"><xsl:choose><xsl:when test="字:对齐网格/@字:值='1' or 字:对齐网格/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:取消断字"> + <xsl:attribute name="fo:hyphenation-ladder-count">no-limit</xsl:attribute> + <xsl:attribute name="fo:hyphenation-remain-char-count">2</xsl:attribute> + <xsl:attribute name="fo:hyphenation-push-char-count">2</xsl:attribute> + <xsl:attribute name="fo:hyphenate"><xsl:choose><xsl:when test="字:取消断字/@字:值='1' or 字:取消断字/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:取消行号"> + <xsl:attribute name="text:number-lines"><xsl:choose><xsl:when test="字:取消行号/@字:值='1' or 字:取消行号/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:行首尾标点控制"> + <xsl:attribute name="style:punctuation-wrap"><xsl:choose><xsl:when test="字:行首尾标点控制/@字:值='1' or 字:行首尾标点控制/@字:值='true'">hanging</xsl:when><xsl:otherwise>simple</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:是否行首标点压缩/@字:值='true'"> + <xsl:attribute name="style:punctuation-compress">false</xsl:attribute> + </xsl:if> + <xsl:if test="字:中文习惯首尾字符"> + <xsl:attribute name="style:line-break"><xsl:choose><xsl:when test="字:中文习惯首尾字符/@字:值='1' or 字:中文习惯首尾字符/@字:值='true'">strict</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:自动调整中英文字符间距 or 字:自动调整中文与数字间距"> + <xsl:attribute name="style:text-autospace"><xsl:choose><xsl:when test="字:自动调整中英文字符间距/@字:值='1' or 字:自动调整中文与数字间距/@字:值='1'or 字:自动调整中英文字符间距/@字:值='true' or 字:自动调整中文与数字间距/@字:值='true'">ideograph-alpha</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:首字下沉"> + <xsl:element name="style:drop-cap"> + <xsl:if test="字:首字下沉/@字:行数"> + <xsl:attribute name="style:lines"><xsl:value-of select="字:首字下沉/@字:行数"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:首字下沉/@字:间距"> + <xsl:attribute name="style:distance"><xsl:value-of select="concat(字:首字下沉/@字:间距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:首字下沉/@字:字体引用"> + <xsl:attribute name="style:style-name"><xsl:value-of select="字:首字下沉/@字:字体引用"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:首字下沉/@字:字符数"> + <xsl:attribute name="style:length"><xsl:choose><xsl:when test="字:首字下沉/@字:字符数='1'">word</xsl:when><xsl:otherwise><xsl:value-of select="字:首字下沉/@字:字符数"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="多个句"> + <xsl:call-template name="单个或者没有句"/> + </xsl:template> + <xsl:template name="jibianhao"> + <xsl:param name="biaoshifu"/> + <xsl:element name="text:list-level-style-number"> + <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/> + <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute> + <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute> + <xsl:if test="@字:尾随字符"> + <xsl:attribute name="style:num-suffix"><xsl:choose><xsl:when test="@字:尾随字符='space'"><xsl:value-of select="' ' "/></xsl:when><xsl:when test="@字:尾随字符='tab'"><xsl:value-of select="' '"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:符号字体"> + <xsl:variable name="Font-ID"> + <xsl:value-of select="字:符号字体/@字:式样引用"/> + </xsl:variable> + <xsl:attribute name="text:style-name"><xsl:value-of select="$Font-ID"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:起始编号"> + <xsl:attribute name="text:start-value"><xsl:value-of select="字:起始编号"/></xsl:attribute> + </xsl:if> + <xsl:if test="字:正规格式"> + <xsl:attribute name="text:num-regular-exp"><xsl:value-of select="字:正规格式/@值"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(字:编号格式表示) - string-length(translate(字:编号格式表示,'%','') )"/></xsl:attribute> + <xsl:if test="字:编号格式"> + <xsl:call-template name="编号格式"/> + </xsl:if> + <xsl:if test="字:编号格式表示"> + <xsl:variable name="last" select="substring-after(字:编号格式表示,concat('%',$currlevel))"/> + <xsl:variable name="first"> + <xsl:variable name="aa" select="substring-before(字:编号格式表示,concat('%',$currlevel))"/> + <xsl:choose> + <xsl:when test="not(substring-after($aa,'%'))"> + <xsl:value-of select="$aa"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:if test="$first!=''"> + <xsl:attribute name="style:num-prefix"><xsl:value-of select="$first"/></xsl:attribute> + </xsl:if> + <xsl:if test="$last!=''"> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="$last"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="bianhaogeshi"> + <xsl:with-param name="biaoshi"> + <xsl:value-of select="字:编号格式表示"/> + </xsl:with-param> + <xsl:with-param name="jibie"> + <xsl:value-of select="1"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:element name="style:text-properties"> + <xsl:call-template name="suojinleixing"/> + <xsl:if test="@字:编号对齐方式"> + <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@字:编号对齐方式"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="字:符号字体"> + <xsl:if test="字:符号字体/@字:式样引用"> + <xsl:variable name="Font-ID"> + <xsl:value-of select="字:符号字体/@字:式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样"> + <xsl:if test="@字:标识符=$Font-ID"> + <xsl:if test="字:字体/@字:中文字体引用"> + <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:if> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="bianhaogeshi"> + <xsl:param name="biaoshi"/> + <xsl:param name="jibie"/> + <xsl:variable name="bb"> + <xsl:value-of select="substring-after($biaoshi,'%')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="substring-after($bb,'%')"> + <xsl:call-template name="bianhaogeshi"> + <xsl:with-param name="biaoshi" select="$bb"/> + <xsl:with-param name="jibie" select="$jibie +1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:if test="not($jibie=1)"> + <xsl:attribute name="text:display-levels"><xsl:value-of select="$jibie"/></xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="xiangmufuhao"> + <xsl:param name="biaoshifu"/> + <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/> + <xsl:element name="text:list-level-style-bullet"> + <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute> + <xsl:attribute name="text:style-name"><xsl:value-of select="../@字:名称"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute> + <xsl:attribute name="text:bullet-char"><xsl:value-of select="字:项目符号"/></xsl:attribute> + <xsl:element name="style:text-properties"> + <xsl:if test="字:符号字体"> + <xsl:variable name="Font-ID"> + <xsl:value-of select="字:符号字体/@字:式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样"> + <xsl:if test="@字:标识符=$Font-ID"> + <xsl:if test="字:字体/@字:中文字体引用"> + <xsl:attribute name="svg:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:if> + <xsl:if test="字:项目符号"> + <xsl:attribute name="fo:font-family"><xsl:value-of select="'WingDings'"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="suojinleixing"/> + <xsl:if test="@字:编号对齐方式"> + <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@字:编号对齐方式"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="imagefuhao"> + <xsl:param name="biaoshifu"/> + <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/> + <xsl:element name="text:list-level-style-image" style:vertical-pos="middle" style:vertical-rel="line" fo:width="0.265cm" fo:height="0.265cm"> + <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute> + <xsl:if test="字:图片符号引用"> + <xsl:variable name="gid"> + <xsl:value-of select="字:图片符号引用"/> + </xsl:variable> + <xsl:element name="office:binary-data"> + <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据"/> + </xsl:element> + </xsl:if> + <xsl:element name="style:list-level-properties"> + <xsl:attribute name="style:vertical-pos">middle</xsl:attribute> + <xsl:attribute name="style:vertical-rel">line</xsl:attribute> + <xsl:attribute name="fo:width"><xsl:value-of select="concat(字:图片符号引用/@字:宽度,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="fo:height"><xsl:value-of select="concat(字:图片符号引用/@字:高度,$uofUnit)"/></xsl:attribute> + <xsl:if test="字:符号字体"> + <xsl:variable name="Font-ID"> + <xsl:value-of select="字:符号字体/@字:式样引用"/> + </xsl:variable> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样"> + <xsl:if test="@字:标识符=$Font-ID"> + <xsl:if test="字:字体/@字:中文字体引用"> + <xsl:attribute name="svg:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:if> + <xsl:call-template name="suojinleixing"/> + <xsl:if test="@字:编号对齐方式"> + <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@字:编号对齐方式"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="ootab"> + <xsl:element name="style:tab-stops"> + <xsl:for-each select="字:段落属性/字:制表位设置/字:制表位 | 字:制表位设置/字:制表位"> + <xsl:element name="style:tab-stop"> + <xsl:attribute name="style:position"><xsl:value-of select="concat(@字:位置,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="style:type"><xsl:choose><xsl:when test="@字:类型='decimal'">char</xsl:when><xsl:when test="@字:类型='left' or @字:类型='right' or @字:类型='center'"><xsl:value-of select="@字:类型"/></xsl:when><xsl:otherwise/></xsl:choose></xsl:attribute> + <xsl:if test="@字:制表位字符"> + <xsl:attribute name="style:leader-text"><xsl:value-of select="@字:制表位字符"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="style:leader-style"><xsl:value-of select="@字:前导符"/></xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template match="字:段落[字:段落属性[字:自动编号信息]]"> + <xsl:call-template name="编号解析"> + </xsl:call-template> + </xsl:template> + <xsl:template name="编号解析"> + <xsl:variable name="bianhao"> + <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号引用"/> + </xsl:variable> + <xsl:variable name="bianhaojibie"> + <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号级别"/> + </xsl:variable> + <xsl:variable name="isxiangmuorisimage"> + <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号"> + <xsl:choose> + <xsl:when test="$bianhao=@字:标识符"> + <xsl:choose> + <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:项目符号">true</xsl:when> + <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:图片符号引用">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="$isxiangmuorisimage='true'"> + <xsl:call-template name="无序"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="有序"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="有序"> + <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/> + <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别 + 1"/> + <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/> + <xsl:element name="text:list"> + <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute> + <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="字:段落属性/字:自动编号信息/@字:重新编号='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="字:段落属性/字:自动编号信息/@字:重新编号"> + <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="字:段落属性/字:自动编号信息/@字:重新编号='1'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:element name="text:list-item"> + <xsl:call-template name="ordered-levels"> + <xsl:with-param name="level" select="$currlistlvl - 1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="ordered-levels"> + <xsl:param name="level"/> + <xsl:choose> + <xsl:when test="$level = '0'"> + <xsl:call-template name="commonParagraph"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="text:list"> + <xsl:element name="text:list-item"> + <xsl:call-template name="ordered-levels"> + <xsl:with-param name="level" select="$level - 1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="无序"> + <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/> + <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别 + 1"/> + <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/> + <xsl:element name="text:list"> + <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute> + <xsl:element name="text:list-item"> + <xsl:call-template name="unordered-levels"> + <xsl:with-param name="level" select="$currlistlvl - 1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="unordered-levels"> + <xsl:param name="level"/> + <xsl:choose> + <xsl:when test="$level = '0'"> + <xsl:call-template name="commonParagraph"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="text:list"> + <xsl:element name="text:list-item"> + <xsl:call-template name="unordered-levels"> + <xsl:with-param name="level" select="$level - 1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- measure_conversion.xsl Begin--> + <xsl:param name="dpi" select="111"/> + <xsl:param name="centimeter-in-mm" select="10"/> + <xsl:param name="inch-in-mm" select="25.4"/> + <xsl:param name="didot-point-in-mm" select="0.376065"/> + <xsl:param name="pica-in-mm" select="4.2333333"/> + <xsl:param name="point-in-mm" select="0.3527778"/> + <xsl:param name="twip-in-mm" select="0.017636684"/> + <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/> + <!-- ***** MEASUREMENT CONVERSIONS ***** + PARAM 'value' + The measure to be converted. + The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...) + directly added to the number. + + PARAM 'rounding-factor' + Is used for the rounding of decimal places. + The parameter number is the product of 1 and some '10', where + every zero represents a decimal place. + + For example, providing as parameter: + <xsl:param name="rounding-factor" select="10000" /> + Gives by default four decimal places. + + To round two decimal places, basically the following is done: + <xsl:value-of select="round(100 * value) div 100"/> + + RETURN The converted number, by default rounded to four decimal places. + In case the input measure could not be matched the same value is + returned and a warning message is written out. + + + + MEASURE LIST: + * 1 millimeter (mm), the basic measure + + * 1 centimeter (cm) = 10 mm + + * 1 inch (in) = 25.4 mm + While the English have already seen the light (read: the metric system), the US + remains loyal to this medieval system. + + * 1 point (pt) = 0.35277777.. mm + Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points. + There are exactly 72 PostScript points in 1 inch. + + * 1 twip = twentieth of a (PostScript) point + A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing. + + * 1 didot point (dpt) = 0.376065 mm + Didot point after the French typographer Firmin Didot (1764-1836). + + More details under + http://www.unc.edu/~rowlett/units/dictP.html: + "A unit of length used by typographers and printers. When printing was done + from hand-set metal type, one point represented the smallest element of type + that could be handled, roughly 1/64 inch. Eventually, the point was standardized + in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is + about 0.35 mm (351.46 micrometers). In continental Europe, typographers + traditionally used a slightly larger point of 0.014 83 inch (about + 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point + after the French typographer Firmin Didot (1764-1836). In the U.S., + Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch + or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point + of 0.351 459 8035 mm. The German standards agency DIN has proposed that + all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch). + + * 1 pica = 4.233333 mm + 1/6 inch or 12 points + + * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi) + Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter + + + --> + <!-- changing measure to mm --> + <xsl:template name="convert2cm"> + <xsl:param name="value"/> + <xsl:param name="rounding-factor" select="10000"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, $uofUnit)"> + <xsl:value-of select="substring-before($value, $uofUnit)"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:通用边框"> + <xsl:param name="lineType"/> + <xsl:param name="width"/> + <xsl:param name="color"/> + <xsl:choose> + <xsl:when test="$lineType='none'">none</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$width"/> + <xsl:choose> + <xsl:when test="$lineType='single'">solid </xsl:when> + <xsl:when test="$lineType='double'">double </xsl:when> + <xsl:otherwise>solid </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$color='auto' or $color='none' or $color=''">#808080</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$color"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:边框"> + <xsl:if test="uof:上"> + <xsl:variable name="type" select="uof:上/@uof:类型"/> + <xsl:variable name="size" select="concat(uof:上/@uof:宽度,$uofUnit,' ')"/> + <xsl:variable name="clr" select="uof:上/@uof:颜色"/> + <xsl:attribute name="fo:border-top"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute> + <xsl:if test="uof:上/@uof:线宽度"> + <xsl:attribute name="style:border-line-width-top"><xsl:value-of select="uof:上/@uof:线宽度"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:下"> + <xsl:variable name="type" select="uof:下/@uof:类型"/> + <xsl:variable name="size" select="concat(uof:下/@uof:宽度,$uofUnit,' ')"/> + <xsl:variable name="clr" select="uof:下/@uof:颜色"/> + <xsl:attribute name="fo:border-bottom"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute> + <xsl:if test="uof:下/@uof:线宽度"> + <xsl:attribute name="style:border-line-width-bottom"><xsl:value-of select="uof:下/@uof:线宽度"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:左"> + <xsl:variable name="type" select="uof:左/@uof:类型"/> + <xsl:variable name="size" select="concat(uof:左/@uof:宽度,$uofUnit,' ')"/> + <xsl:variable name="clr" select="uof:左/@uof:颜色"/> + <xsl:attribute name="fo:border-left"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute> + <xsl:if test="uof:左/@uof:线宽度"> + <xsl:attribute name="style:border-line-width-left"><xsl:value-of select="uof:左/@uof:线宽度"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:右"> + <xsl:variable name="type" select="uof:右/@uof:类型"/> + <xsl:variable name="size" select="concat(uof:右/@uof:宽度,$uofUnit,' ')"/> + <xsl:variable name="clr" select="uof:右/@uof:颜色"/> + <xsl:attribute name="fo:border-right"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute> + <xsl:if test="uof:右/@uof:线宽度"> + <xsl:attribute name="style:border-line-width-right"><xsl:value-of select="uof:右/@uof:线宽度"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:上/@uof:阴影='true'or uof:上/@uof:阴影='1'"> + <xsl:if test="uof:左/@uof:阴影='true'or uof:左/@uof:阴影='1'"> + <xsl:attribute name="style:shadow">#808080 -0.18cm -0.18cm</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:上/@uof:阴影='true'or uof:上/@uof:阴影='1'"> + <xsl:if test="uof:右/@uof:阴影='true'or uof:右/@uof:阴影='1'"> + <xsl:attribute name="style:shadow">#808080 0.18cm -0.18cm</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:下/@uof:阴影='true'or uof:下/@uof:阴影='1'"> + <xsl:if test="uof:左/@uof:阴影='true'or uof:左/@uof:阴影='1'"> + <xsl:attribute name="style:shadow">#808080 -0.18cm 0.18cm</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:下/@uof:阴影='true'or uof:下/@uof:阴影='1'"> + <xsl:if test="uof:右/@uof:阴影='true'or uof:右/@uof:阴影='1'"> + <xsl:attribute name="style:shadow">#808080 0.18cm 0.18cm</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="uof:上/@uof:边距"> + <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(uof:上/@uof:边距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="uof:下/@uof:边距"> + <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(uof:下/@uof:边距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="uof:左/@uof:边距"> + <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(uof:左/@uof:边距,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="uof:右/@uof:边距"> + <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(uof:右/@uof:边距,$uofUnit)"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="uof:填充"> + <xsl:choose> + <xsl:when test="图:颜色"> + <xsl:attribute name="fo:background-color"><xsl:choose><xsl:when test="图:颜色"><xsl:value-of select="图:颜色"/></xsl:when><xsl:otherwise>transparent</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="contains(图:图案/@图:前景色,'#')"> + <xsl:attribute name="fo:text-background-color"><xsl:value-of select="图:图案/@图:前景色"/></xsl:attribute> + </xsl:when> + <xsl:when test="图:图案/@图:背景色"> + <xsl:attribute name="fo:background-color"><xsl:value-of select="图:图案/@图:背景色"/></xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:if test="图:图片"> + <xsl:element name="style:background-image"> + <xsl:variable name="gid"> + <xsl:value-of select="图:图片/@图:图形引用"/> + </xsl:variable> + <xsl:if test="图:图片/@图:位置 and not(图:图片/@图:位置='tile')"> + <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:位置='stretch'">stretch</xsl:when><xsl:when test="图:图片/@图:位置='center'">no-repeat</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据"> + <xsl:element name="office:binary-data"> + <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据"/> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:路径"/></xsl:attribute> + <xsl:attribute name="xlink:type">simple</xsl:attribute> + <xsl:attribute name="xlink:actuate">onLoad</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="日期域"> + <xsl:if test="following-sibling::字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/> + <xsl:variable name="datestr"> + <xsl:choose> + <xsl:when test="contains($date0,'\*')"> + <xsl:value-of select="string(substring-before($date0,'\*'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$date0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="zydate"> + <xsl:param name="str1"/> + <xsl:choose> + <xsl:when test="substring($str1,1,5)='am/pm'"> + <xsl:variable name="str1-before" select="substring($str1,1,5)"/> + <xsl:variable name="str1-after" select="substring($str1,6)"/> + <number:am-pm/> + <xsl:if test="not($str1-after)=''"> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zytime"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + + <xsl:choose> + <xsl:when test="substring($str1,1,4)='yyyy'"> + <xsl:variable name="str1-before" select="substring($str1,1,4)"/> + <xsl:variable name="str1-after" select="substring($str1,5)"/> + <number:year number:style="long"/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="substring($str1,1,1)=substring($str1,2,1) and substring($str1,2,1) !=substring($str1,3,1) "> + <xsl:variable name="str1-before" select="substring($str1,1,2)"/> + <xsl:variable name="str1-after" select="substring($str1,3)"/> + <xsl:if test="substring($str1,1,1)='y'"> + <number:year/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='M'"> + <number:month number:style="long"/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='d'"> + <number:day number:style="long"/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='h'"> + <number:hours number:style="long"/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='m'"> + <number:minutes number:style="long"/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='s'"> + <number:seconds number:style="long"/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='W'"> + <number:week-of-year number:style="long"/> + </xsl:if> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="substring($str1,1,1)='M'or substring($str1,1,1)='d'or substring($str1,1,1)='h'or substring($str1,1,1)='m'or substring($str1,1,1)='s'"> + <xsl:variable name="str1-after" select="substring($str1,2)"/> + <xsl:variable name="str1-before" select="substring($str1,1,1)"/> + <xsl:if test="substring($str1,1,1)='M'"> + <number:month/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="substring($str1,1,1)='d'"> + <number:day/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="substring($str1,1,1)='h'"> + <number:hours/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="substring($str1,1,1)='m'"> + <number:minutes/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="substring($str1,1,1)='s'"> + <number:seconds/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + <xsl:if test="contains(substring($str1,1,3),'Q' )"> + <xsl:choose> + <xsl:when test="substring($str1,1,1)='Q'"> + <xsl:variable name="str1-before" select="substring($str1,1,2)"/> + <xsl:variable name="str1-after" select="substring($str1,3)"/> + <number:quarter/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="str1-before" select="substring($str1,1,5)"/> + <xsl:variable name="str1-after" select="substring($str1,6)"/> + <number:quarter number:style="long"/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="contains(substring(normalize-space($str1),1,3),'W' )"> + <xsl:variable name="str1-before" select="substring(normalize-space($str1),1,3)"/> + <xsl:variable name="str1-after" select="substring(normalize-space($str1),4)"/> + <number:day-of-week number:style="long"/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + <xsl:if test="contains(substring($str1,1,3),'NN' ) and substring($str1,1,1)!='NN' "> + <xsl:variable name="str1-before" select="substring($str1,1,3)"/> + <xsl:variable name="str1-after" select="substring($str1,4)"/> + <number:text>第</number:text> + <number:week-of-year/> + <number:text>周</number:text> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zydate"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="时间域"> + <xsl:if test="following-sibling::字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/> + <xsl:variable name="datestr" select="$date0"/> + <xsl:call-template name="zytime"> + <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="zytime"> + <xsl:param name="str1"/> + <xsl:choose> + <xsl:when test="substring($str1,1,5)='am/pm'"> + <xsl:variable name="str1-before" select="substring($str1,1,5)"/> + <xsl:variable name="str1-after" select="substring($str1,6)"/> + <number:am-pm/> + <xsl:if test="not($str1-after)=''"> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zytime"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="substring($str1,1,1)=substring($str1,2,1) and substring($str1,2,1) !=substring($str1,3,1) "> + <xsl:variable name="str1-before" select="substring($str1,1,2)"/> + <xsl:variable name="str1-after" select="substring($str1,3)"/> + <xsl:if test="substring($str1,1,1)='H' or substring($str1,1,1)='h'"> + <number:hours number:style="long"/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='M' or substring($str1,1,1)='m'"> + <number:minutes number:style="long"/> + </xsl:if> + <xsl:if test="substring($str1,1,1)='S' or substring($str1,1,1)='s'"> + <number:seconds number:style="long"/> + </xsl:if> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zytime"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="substring($str1,1,1)='H'or substring($str1,1,1)='M'or substring($str1,1,1)='S'or substring($str1,1,1)='h' or substring($str1,1,1)='m' or substring($str1,1,1)='s'"> + <xsl:variable name="str1-after" select="substring($str1,2)"/> + <xsl:variable name="str1-before" select="substring($str1,1,1)"/> + <xsl:if test="substring($str1,1,1)='H' or substring($str1,1,1)='h'"> + <number:hours/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="substring($str1,1,1)='M' or substring($str1,1,1)='m'"> + <number:minutes/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="substring($str1,1,1)='S' or substring($str1,1,1)='s'"> + <number:seconds/> + <number:text> + <xsl:value-of select="substring($str1-after,1,1)"/> + </number:text> + </xsl:if> + <xsl:if test="string-length($str1-after)>1"> + <xsl:call-template name="zytime"> + <xsl:with-param name="str1" select="substring($str1-after,2)"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="oo数字格式域开关"> + <xsl:param name="oo_format"/> + <xsl:choose> + <xsl:when test="$oo_format='Arabic'">1</xsl:when> + <xsl:when test="$oo_format='ROMAN'">I</xsl:when> + <xsl:when test="$oo_format='roman'">i</xsl:when> + <xsl:when test="$oo_format='ALPHABETIC'">A</xsl:when> + <xsl:when test="$oo_format='alphabetic'">a</xsl:when> + <xsl:when test="$oo_format='GB1'">1, 2, 3, ...</xsl:when> + <xsl:when test="$oo_format='GB3'">①, ②, ③, ...</xsl:when> + <xsl:when test="$oo_format='CHINESENUM3'">一, 二, 三, ...</xsl:when> + <xsl:when test="$oo_format='CHINESENUM2'">壹, 贰, 叁, ...</xsl:when> + <xsl:when test="$oo_format='ZODIAC1'">甲, 乙, 丙, ...</xsl:when> + <xsl:when test="$oo_format='ZODIAC2'">子, 丑, 寅, ...</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="题注"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串 or 字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="aa" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,'\f ')"/> + <xsl:variable name="ooow" select="substring-after($aa,'ooow:') "/> + <xsl:variable name="as" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="ad"> + <xsl:value-of select="substring-after($as,'SEQ ') "/> + </xsl:variable> + <xsl:variable name="num"> + <xsl:value-of select="substring-after(substring-before(../字:域代码/字:段落/字:句/字:文本串,' \f'),'\* ')"/> + </xsl:variable> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="$num"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="text:sequence"> + <xsl:attribute name="text:name"><xsl:choose><xsl:when test="$ad='表格'">Table</xsl:when><xsl:when test="$ad='图表'">Drawing</xsl:when><xsl:otherwise><xsl:value-of select="$ad"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="text:formula"><xsl:choose><xsl:when test="contains($aa,'ooow:')"><xsl:value-of select="$ooow"/></xsl:when><xsl:when test="contains($as,'表格')"><xsl:value-of select="concat('Table','+',$fmt)"/></xsl:when><xsl:when test="contains($as,'图表')"><xsl:value-of select="concat('Drawing','+',$fmt)"/></xsl:when><xsl:otherwise><xsl:value-of select="$aa"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="页码域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串 or 字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="$date0"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="text:page-number"> + <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute> + <xsl:attribute name="text:select-page">current</xsl:attribute> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="页数域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="substring-before($date0,' \*')"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="text:page-count"> + <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="作者域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:element name="text:initial-creator"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="用户域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:element name="text:author-name"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="缩写域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:element name="text:author-initials"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="标题域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:element name="text:title"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="主题域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:element name="text:subject"> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="文件名"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:element name="text:file-name"> + <xsl:variable name="string"> + <xsl:value-of select="../字:域代码/字:段落/字:句/字:文本串"/> + </xsl:variable> + <xsl:attribute name="text:display"><xsl:choose><xsl:when test="contains($string,' \p')">full</xsl:when><xsl:otherwise>name-and-extension</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="编辑时间"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/> + <xsl:variable name="datestr" select="$date0"/> + <xsl:call-template name="zytime"> + <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="创建时间"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/> + <xsl:variable name="datestr" select="$date0"/> + <xsl:call-template name="zytime"> + <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="字符数"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="substring-before($date0,' \#')"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="text:character-count"> + <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:key name="mulu" match="/uof:UOF/uof:式样集/uof:段落式样" use="@字:标识符"/> + <xsl:template name="索引域"> + <xsl:element name="text:alphabetical-index"> + <xsl:variable name="stylenum"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/> + </xsl:variable> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute> + <xsl:variable name="aanum"> + <xsl:number value="0" format="1"/> + </xsl:variable> + <xsl:attribute name="text:name"><xsl:value-of select="concat('索引目录',$aanum + 1)"/></xsl:attribute> + <text:alphabetical-index-source text:main-entry-style-name="Main_index_entry" text:sort-algorithm="pinyin" fo:language="zh" fo:country="CN"> + <text:index-title-template text:style-name="Index_20_Heading">索引目录</text:index-title-template> + <text:alphabetical-index-entry-template text:outline-level="separator" text:style-name="Index_Separator"> + <text:index-entry-text/> + </text:alphabetical-index-entry-template> + <text:alphabetical-index-entry-template text:outline-level="1" text:style-name="Index_20_1"> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + </text:alphabetical-index-entry-template> + <text:alphabetical-index-entry-template text:outline-level="2" text:style-name="Index_20_2"> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + </text:alphabetical-index-entry-template> + <text:alphabetical-index-entry-template text:outline-level="3" text:style-name="Index_20_3"> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + </text:alphabetical-index-entry-template> + </text:alphabetical-index-source> + <text:index-body> + <text:index-title> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute> + <xsl:attribute name="text:name"><xsl:value-of select="concat('索引目录',$aanum + 1,'_Head')"/></xsl:attribute> + <xsl:for-each select="字:域代码/字:段落[position()=2]"> + <text:p text:style-name="Index_20_Heading"> + <xsl:apply-templates select=".//字:文本串"/> + </text:p> + </xsl:for-each> + </text:index-title> + <xsl:if test="字:域开始/@字:类型='INDEX'"> + <xsl:for-each select="字:域代码/字:段落[position()>2]"> + <xsl:element name="text:p"> + <xsl:variable name="aa"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/> + </xsl:variable> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$aa + 1)"/></xsl:attribute> + <xsl:for-each select="字:句"> + <xsl:apply-templates select="self::node()/*"/> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + </xsl:if> + </text:index-body> + </xsl:element> + </xsl:template> + <xsl:template name="目录域"> + <xsl:element name="text:table-of-content"> + <xsl:variable name="stylenum"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/> + </xsl:variable> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute> + <xsl:variable name="aanum"> + <xsl:number value="0" format="1"/> + </xsl:variable> + <xsl:attribute name="text:name"><xsl:value-of select="concat('内容目录',$aanum + 1)"/></xsl:attribute> + <text:table-of-content-source text:outline-level="10"> + <text:index-title-template text:style-name="Contents_20_Heading">内容目录</text:index-title-template> + <text:table-of-content-entry-template text:outline-level="1" text:style-name="Contents 1"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="2" text:style-name="Contents 2"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="3" text:style-name="Contents 3"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="4" text:style-name="Contents 4"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="5" text:style-name="Contents 5"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="6" text:style-name="Contents 6"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="7" text:style-name="Contents 7"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="8" text:style-name="Contents 8"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="9" text:style-name="Contents 9"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + <text:table-of-content-entry-template text:outline-level="10" text:style-name="Contents 10"> + <text:index-entry-link-start text:style-name="Index_20_Link"/> + <text:index-entry-chapter/> + <text:index-entry-text/> + <text:index-entry-tab-stop style:type="right" style:leader-char="."/> + <text:index-entry-page-number/> + <text:index-entry-link-end/> + </text:table-of-content-entry-template> + </text:table-of-content-source> + <text:index-body> + <text:index-title> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute> + <xsl:attribute name="text:name"><xsl:value-of select="concat('内容目录',$aanum + 1,'_Head')"/></xsl:attribute> + <xsl:for-each select="字:域代码/字:段落[position()=2]"> + <text:p text:style-name="Contents_20_Heading"> + <xsl:apply-templates select=".//字:文本串"/> + </text:p> + </xsl:for-each> + </text:index-title> + <xsl:if test="字:域开始/@字:类型='REF'"> + <xsl:for-each select="字:域代码/字:段落[position()>2]"> + <xsl:element name="text:p"> + <xsl:variable name="aa"> + <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/> + </xsl:variable> + <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$aa + 1)"/></xsl:attribute> + <xsl:element name="text:a"> + <xsl:attribute name="xlink:type">simple</xsl:attribute> + <xsl:attribute name="text:style-name">Index Link</xsl:attribute> + <xsl:attribute name="text:visited-style-name">Index Link</xsl:attribute> + <xsl:variable name="hyperDest" select="./字:句/字:区域开始/@字:标识符"/> + <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链源=$hyperDest"><xsl:value-of select="concat('#',@uof:书签)"/></xsl:if></xsl:for-each></xsl:attribute> + <xsl:apply-templates select="字:句/*"/> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:if> + </text:index-body> + </xsl:element> + </xsl:template> + <xsl:template name="suojinleixing"> + <xsl:if test="字:缩进/字:首行/字:绝对/@字:值 and 字:缩进/字:左/字:绝对/@字:值"> + <xsl:attribute name="text:min-label-width"><xsl:value-of select="concat(0 - 字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="text:space-before"><xsl:value-of select="concat(字:缩进/字:左/字:绝对/@字:值 + 字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="字:修订开始[@字:类型='insert']"> + <xsl:choose> + <xsl:when test="./@字:标识符"> + <text:change-start text:change-id="{@字:标识符}"/> + </xsl:when> + <xsl:otherwise> + <text:change-start text:change-id="{@字:修订信息引用}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:修订结束[preceding::字:修订开始[1]/@字:类型='insert']"> + <text:change-end> + <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute> + </text:change-end> + </xsl:template> + <xsl:template match="字:修订开始[@字:类型='delete']"> + <xsl:choose> + <xsl:when test="./@字:标识符"> + <text:change-start text:change-id="{@字:标识符}"/> + </xsl:when> + <xsl:otherwise> + <text:change-start text:change-id="{@字:修订信息引用}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:修订结束[preceding::字:修订开始[1]/@字:类型='delete']"> + <text:change-end> + <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute> + </text:change-end> + </xsl:template> + <xsl:template match="字:修订开始[@字:类型='format']"> + <xsl:choose> + <xsl:when test="./@字:标识符"> + <text:change-start text:change-id="{@字:标识符}"/> + </xsl:when> + <xsl:otherwise> + <text:change-start text:change-id="{@字:修订信息引用}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="字:修订结束[preceding::字:修订开始[1]/@字:类型='format']"> + <text:change-end> + <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute> + </text:change-end> + </xsl:template> + <xsl:template name="GenerateTrackChanges"> + <text:tracked-changes> + <xsl:if test="/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:修订"> + <xsl:attribute name="text:track-changes"><xsl:value-of select="/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:修订/@字:值"/></xsl:attribute> + </xsl:if> + <xsl:if test="//字:段落/字:修订开始[@字:类型='insert']"> + <xsl:for-each select="//字:段落/字:修订开始[@字:类型='insert']"> + <xsl:variable name="id" select="@字:标识符"/> + <xsl:variable name="aid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:作者"/> + <xsl:variable name="sid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$aid]/@字:姓名"/> + <xsl:variable name="bid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:日期"/> + <text:changed-region text:id="{$id}"> + <xsl:choose> + <xsl:when test="name()='字:修订开始'"> + <xsl:choose> + <xsl:when test="not(name(following-sibling::node()[1])='字:修订结束')"> + <text:insertion> + <office:change-info> + <dc:creator> + <xsl:value-of select="$sid"/> + </dc:creator> + <dc:date> + <xsl:value-of select="$bid"/> + </dc:date> + </office:change-info> + </text:insertion> + </xsl:when> + <xsl:otherwise> + <text:format-change> + <office:change-info> + <dc:creator> + <xsl:value-of select="$sid"/> + </dc:creator> + <dc:date> + <xsl:value-of select="$bid"/> + </dc:date> + </office:change-info> + </text:format-change> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </text:changed-region> + </xsl:for-each> + </xsl:if> + <xsl:if test="//字:段落/字:修订开始[@字:类型='insert']"> + <xsl:for-each select="//字:段落/字:修订开始[@字:类型='delete']"> + <xsl:variable name="id" select="@字:标识符"/> + <xsl:variable name="aid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:作者"/> + <xsl:variable name="sid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$aid]/@字:姓名"/> + <xsl:variable name="bid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:日期"/> + <text:changed-region text:id="{$id}"> + <xsl:choose> + <xsl:when test="name()='字:修订开始'"> + <xsl:choose> + <xsl:when test="not(name(following-sibling::node()[1])='字:修订结束')"> + <text:deletion> + <office:change-info> + <dc:creator> + <xsl:value-of select="$sid"/> + </dc:creator> + <dc:date> + <xsl:value-of select="$bid"/> + </dc:date> + </office:change-info> + </text:deletion> + </xsl:when> + <xsl:otherwise> + <text:format-change> + <office:change-info> + <dc:creator> + <xsl:value-of select="$sid"/> + </dc:creator> + <dc:date> + <xsl:value-of select="$bid"/> + </dc:date> + </office:change-info> + </text:format-change> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </text:changed-region> + </xsl:for-each> + </xsl:if> + <xsl:if test="//字:段落/字:修订开始[@字:类型='format']"> + <xsl:for-each select="//字:段落/字:修订开始[@字:类型='format']"> + <xsl:variable name="id" select="@字:标识符"/> + <xsl:variable name="aid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:作者"/> + <xsl:variable name="sid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$aid]/@字:姓名"/> + <xsl:variable name="bid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:日期"/> + <text:changed-region text:id="{$id}"> + <xsl:choose> + <xsl:when test="name()='字:修订开始'"> + <xsl:choose> + <xsl:when test="not(name(following-sibling::node()[1])='字:修订结束')"> + <text:format-change> + <office:change-info> + <dc:creator> + <xsl:value-of select="$sid"/> + </dc:creator> + <dc:date> + <xsl:value-of select="$bid"/> + </dc:date> + </office:change-info> + </text:format-change> + </xsl:when> + <xsl:otherwise> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </text:changed-region> + </xsl:for-each> + </xsl:if> + + </text:tracked-changes> + + </xsl:template> + <xsl:template name="oo数字格式"> + <xsl:param name="oo_format"/> + <xsl:choose> + <xsl:when test="$oo_format='decimal'">1</xsl:when> + <xsl:when test="$oo_format='upper-roman'">I</xsl:when> + <xsl:when test="$oo_format='lower-roman'">i</xsl:when> + <xsl:when test="$oo_format='upper-letter'">A</xsl:when> + <xsl:when test="$oo_format='lower-letter'">a</xsl:when> + <xsl:when test="$oo_format='decimal-full-width'">1, 2, 3, ...</xsl:when> + <xsl:when test="$oo_format='decimal-enclosed-circle'">①, ②, ③, ...</xsl:when> + <xsl:when test="$oo_format='chinese-counting'">一, 二, 三, ...</xsl:when> + <xsl:when test="$oo_format='chinese-legal-simplified'">壹, 贰, 叁, ...</xsl:when> + <xsl:when test="$oo_format='ideograph-traditional'">甲, 乙, 丙, ...</xsl:when> + <xsl:when test="$oo_format='ideograph-zodiac'">子, 丑, 寅, ...</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="章节域"> + <xsl:if test="../字:域代码/字:段落/字:句/字:文本串"> + <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/> + <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/> + <xsl:variable name="fmt"> + <xsl:choose> + <xsl:when test="substring-before($date0,' \*')='Arabic'"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="substring-before($date0,' \*')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:element name="text:chapter"> + <xsl:attribute name="text:display">name</xsl:attribute> + <xsl:attribute name="text:outline-level"><xsl:value-of select="$fmt"/></xsl:attribute> + <xsl:value-of select="following-sibling::字:句/字:文本串"/> + </xsl:element> + </xsl:if> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo.xsl b/filter/source/xslt/import/wordml/wordml2ooo.xsl new file mode 100644 index 000000000..972a54ecc --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo.xsl @@ -0,0 +1,256 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:fla="urn:experimental:fla"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/> + <xsl:include href="../../common/measure_conversion.xsl"/> + <xsl:include href="../common/ms2ooo_docpr.xsl"/> + <xsl:include href="wordml2ooo_text.xsl"/> + <xsl:include href="wordml2ooo_settings.xsl"/> + <xsl:include href="wordml2ooo_table.xsl"/> + <xsl:include href="wordml2ooo_page.xsl"/> + <xsl:include href="wordml2ooo_list.xsl"/> + <xsl:include href="wordml2ooo_draw.xsl"/> + <xsl:include href="wordml2ooo_field.xsl"/> + <xsl:include href="wordml2ooo_props.xsl"/> + <xsl:key name="paragraph-style" match="w:style[@w:type = 'paragraph']" use="@w:styleId"/> + <xsl:key name="heading-style" match="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl]" use="@w:styleId"/> + <xsl:variable name="preserve-alien-markup">no</xsl:variable> + <xsl:variable name="native-namespace-prefixes">,w,o,v,wx,aml,w10,dt,</xsl:variable> + <xsl:variable name="to-dispatch-elements">,wx:sect,wx:sub-section,w:p,w:tbl,w:sectPr,w:r,w:fldSimple,w:hlink,w:t,w:pict,w:br,w:instrText,w:fldChar,w:tab,w:footnote,w:endnote,aml:annotation,w:hlink,w:footnote,w:endnote,w:tblGrid,w:tr,w:tc,wx:pBdrGroup,</xsl:variable> + <xsl:template match="/"> + <xsl:apply-templates select="w:wordDocument"/> + </xsl:template> + <xsl:template match="*" mode="dispatch"> + <xsl:choose> + <xsl:when test="not(contains($native-namespace-prefixes, concat(',', substring-before(name(), ':'), ',')))"> + <!-- if alien namespace dispatch --> + <xsl:choose> + <xsl:when test="$preserve-alien-markup = 'yes'"> + <xsl:copy> + <xsl:copy-of select="@*"/> + <xsl:apply-templates mode="dispatch"/> + </xsl:copy> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="dispatch"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="contains($to-dispatch-elements, concat(',',name(),','))"> + <xsl:apply-templates select="current()"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="w:wordDocument"> + <office:document office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.0"> + <fla:fla.activate/> + <xsl:apply-templates select="o:DocumentProperties"/> + <xsl:apply-templates select="w:docOleData" mode="init"/> + <xsl:apply-templates select="w:docPr"/> + <xsl:apply-templates select="w:fonts"/> + <xsl:apply-templates select="w:styles"/> + <xsl:apply-templates select="w:body"/> + <xsl:apply-templates select="w:docOleData" mode="exit"/> + </office:document> + </xsl:template> + <xsl:template match="w:fonts"> + <xsl:element name="office:font-face-decls"> + <!-- MS Word's default font declaration, added for Writer automatically. glu --> + <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/> + <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/> + <xsl:if test="not(w:font[@w:name='StarSymbol'])"> + <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/> + </xsl:if> + <xsl:for-each select="w:font"> + <xsl:element name="style:font-face"> + <xsl:attribute name="style:name"> + <xsl:value-of select="@w:name"/> + </xsl:attribute> + <xsl:attribute name="svg:font-family"> + <xsl:value-of select="@w:name"/> + </xsl:attribute> + <!-- added by glu, for process special fonts e.g. Marlett, --> + <xsl:if test="w:charset/@w:val = '02'"> + <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute> + </xsl:if> + <xsl:if test="w:family"> + <xsl:choose> + <xsl:when test="w:family/@w:val = 'Swiss'"> + <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute> + </xsl:when> + <xsl:when test="w:family/@w:val='Modern'"> + <xsl:attribute name="style:font-family-generic">modern</xsl:attribute> + </xsl:when> + <xsl:when test="w:family/@w:val='Roman'"> + <xsl:attribute name="style:font-family-generic">roman</xsl:attribute> + </xsl:when> + <xsl:when test="w:family/@w:val='Script'"> + <xsl:attribute name="style:font-family-generic">script</xsl:attribute> + </xsl:when> + <xsl:when test="w:family/@w:val='Decorative'"> + <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute> + </xsl:when> + <xsl:when test="w:family/@w:val='System'"> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-family-generic">system</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="w:pitch and string-length(w:pitch/@w:val) > 0"> + <xsl:attribute name="style:font-pitch"> + <xsl:choose> + <xsl:when test="w:pitch/@w:val = 'default'">variable</xsl:when> + <xsl:otherwise> + <xsl:value-of select="w:pitch/@w:val"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template match="w:styles"> + <office:styles> + <!--The next statement Added by wguo,collect the pict's dash and mark-style.The template is implemented in file wordml2ooo_draw.xsl--> + <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style4dash_mark"/> + <xsl:apply-templates select="//v:fill" mode="office-style"/> + <xsl:call-template name="create-default-paragraph-styles"/> + <xsl:call-template name="create-default-text-styles"/> + <xsl:call-template name="create-default-frame-style"/> + <!-- StarWriter has no default style family 'list'. glu --> + <xsl:if test="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl and w:pPr/w:listPr]"> + <xsl:call-template name="create-outline-style"/> + </xsl:if> + <xsl:apply-templates select="w:style[@w:type='table']" mode="table"/> + <xsl:apply-templates select="w:style[@w:type='list']" mode="list"/> + <xsl:apply-templates select="w:style[@w:type!='list']"/> + <xsl:apply-templates select="/w:wordDocument/w:docPr/w:footnotePr" mode="config"/> + <xsl:apply-templates select="/w:wordDocument/w:docPr/w:endnotePr" mode="config"/> + </office:styles> + <office:automatic-styles> + <xsl:apply-templates select="/w:wordDocument/w:body//w:p" mode="style"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:rPr[not(parent::w:pPr)]" mode="style"/> + <!--The next statement Added by wguo for the pict's draw-style.The template is implemented in file wordml2ooo_draw.xsl--> + <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:tblPr" mode="style"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:gridCol" mode="style"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:trPr" mode="style"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:tcPr" mode="style"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:listPr" mode="style"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="page-layout"/> + <xsl:call-template name="default_date_style"/> + <!--add for generate the date , time style for date , time field G.Y.--> + <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText | /w:wordDocument/w:body//w:fldSimple " mode="style"/> + </office:automatic-styles> + <office:master-styles> + <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="master-page"/> + </office:master-styles> + </xsl:template> + <xsl:template match="w:style"> + <style:style> + <xsl:attribute name="style:name"> + <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + <xsl:if test="w:basedOn"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:next"> + <xsl:attribute name="style:next-style-name"> + <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="@w:type = 'character'"> + <xsl:attribute name="style:family">text</xsl:attribute> + </xsl:when> + <!-- table, paragraph are the same as in Writer . glu --> + <xsl:when test="@w:type"> + <xsl:attribute name="style:family"> + <xsl:value-of select="@w:type"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:family">text</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@w:type = 'table'"> + <xsl:element name="style:table-properties"> + <!-- xsl:apply-templates select="w:tblPr" mode="style"/ --> + </xsl:element> + </xsl:when> + <xsl:when test="@w:type = 'character' "> + <xsl:element name="style:text-properties"> +<!-- + <xsl:apply-templates select="w:pPr/w:rPr"/> + <xsl:apply-templates select="w:rPr"/> +--> + <xsl:for-each select="w:rPr"> + <xsl:call-template name="text-properties"/> + </xsl:for-each> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="style:paragraph-properties"> + <xsl:apply-templates select="w:pPr"/> + </xsl:element> + <xsl:element name="style:text-properties"> + <xsl:apply-templates select="w:rPr"/> + <xsl:apply-templates select="w:pPr/w:rPr"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </style:style> + </xsl:template> + <xsl:template match="w:body"> + <xsl:element name="office:body"> + <xsl:element name="office:text"> + <!-- to add the sequence variable declaration at the beginning of the office:body G.Y.--> + <text:sequence-decls> + <xsl:call-template name="default_sequence_declaration"/> + <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,3) = 'SEQ' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,3) = 'SEQ' ] " mode="sequence_declare"/> + </text:sequence-decls> + <!-- add the user field variables declare for Docproperty fields importing G.Y.--> + <text:user-field-decls> + <xsl:call-template name="user_fields_declare_docproperty"/> + </text:user-field-decls> + <xsl:apply-templates mode="dispatch"/> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="wx:sect"> + <xsl:apply-templates mode="dispatch"/> + </xsl:template> + <xsl:template match="wx:sub-section"> + <xsl:apply-templates mode="dispatch"/> + </xsl:template> + <xsl:template name="create-default-frame-style"> + <!--add for default frame style --> + <style:style style:name="Frame" style:family="graphic"> + <style:graphic-properties text:anchor-type="paragraph" svg:x="0in" svg:y="0in" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/> + </style:style> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl new file mode 100644 index 000000000..c286f3a96 --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v"> + <xsl:template name="ms_word_draw_map2ooo_custom_draw"> + <xsl:param name="ms_word_draw_type"/> + <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl--> + <xsl:choose> + <xsl:when test="$ms_word_draw_type = '#_x0000_t5' "> + <xsl:value-of select=" 'isosceles-triangle'"/> + </xsl:when> + <xsl:when test="$ms_word_draw_type ='#_x0000_t6' "> + <xsl:value-of select=" 'right-triangle' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t8' "> + <xsl:value-of select=" 'trapezoid' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t4' "> + <xsl:value-of select=" 'diamond' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t9' "> + <xsl:value-of select=" 'hexagon' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t7' "> + <xsl:value-of select="'parallelogram' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t56' "> + <xsl:value-of select=" 'pentagon' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t10' "> + <xsl:value-of select=" 'octagon' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t11' "> + <xsl:value-of select=" 'cross' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t23' "> + <xsl:value-of select=" 'ring' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t95' "> + <xsl:value-of select=" 'block-arc' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t22' "> + <xsl:value-of select=" 'can' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t16' "> + <xsl:value-of select=" 'cube' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t65' "> + <xsl:value-of select=" 'paper' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t96' "> + <xsl:value-of select=" 'smiley' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t183' "> + <xsl:value-of select=" 'sun' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t184' "> + <xsl:value-of select=" 'moon' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t74' "> + <xsl:value-of select=" 'heart' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t57' "> + <xsl:value-of select=" 'forbidden' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type ='#_x0000_t85' "> + <xsl:value-of select=" 'left-bracket' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t86' "> + <xsl:value-of select=" 'right-bracket' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t87' "> + <xsl:value-of select=" 'left-brace' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t88' "> + <xsl:value-of select=" 'right-brace' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t185' "> + <xsl:value-of select=" 'bracket-pair' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t186' "> + <xsl:value-of select=" 'brace-pair' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t189' "> + <xsl:value-of select=" 'quad-bevel' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t66' "> + <xsl:value-of select=" 'left-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t67' "> + <xsl:value-of select=" 'down-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t68' "> + <xsl:value-of select=" 'up-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t13' "> + <xsl:value-of select=" 'right-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t69' "> + <xsl:value-of select=" 'left-right-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t70' "> + <xsl:value-of select=" 'up-down-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t89' "> + <xsl:value-of select=" 'mso-spt89' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t76' "> + <xsl:value-of select=" 'quad-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t94' "> + <xsl:value-of select=" 'notched-right-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t177' "> + <xsl:value-of select=" 'pentagon-right' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t55' "> + <xsl:value-of select=" 'chevron' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t79' "> + <xsl:value-of select=" 'up-arrow-callout' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t80' "> + <xsl:value-of select=" 'down-arrow-callout' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t82' "> + <xsl:value-of select=" 'up-down-arrow-callout' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t103' "> + <xsl:value-of select=" 'circular-arrow' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t109' "> + <xsl:value-of select=" 'flowchart-process' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t116' "> + <xsl:value-of select=" 'flowchart-alternate-process' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t110' "> + <xsl:value-of select=" 'flowchart-decision' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t111' "> + <xsl:value-of select=" 'flowchart-data' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t112' "> + <xsl:value-of select=" 'flowchart-predefined-process' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t113' "> + <xsl:value-of select=" 'flowchart-internal-storage' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t114' "> + <xsl:value-of select=" 'flowchart-document' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t115' "> + <xsl:value-of select=" 'flowchart-multidocument' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t116' "> + <xsl:value-of select=" 'flowchart-terminator' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t117' "> + <xsl:value-of select=" 'flowchart-preparation' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t118' "> + <xsl:value-of select=" 'flowchart-manual-input' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t119' "> + <xsl:value-of select=" 'flowchart-manual-operation' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t120' "> + <xsl:value-of select=" 'flowchart-connector' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t177' "> + <xsl:value-of select=" 'flowchart-off-page-connector' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t121' "> + <xsl:value-of select=" 'flowchart-card' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t122' "> + <xsl:value-of select=" 'flowchart-punched-tape' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t123' "> + <xsl:value-of select=" 'flowchart-summing-junction' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t124' "> + <xsl:value-of select=" 'flowchart-or' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t125' "> + <xsl:value-of select=" 'flowchart-collate' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t126' "> + <xsl:value-of select=" 'flowchart-sort' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t127' "> + <xsl:value-of select=" 'flowchart-extract' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t128' "> + <xsl:value-of select=" 'flowchart-merge' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t130' "> + <xsl:value-of select=" 'flowchart-stored-data' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t135' "> + <xsl:value-of select=" 'flowchart-delay' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t131' "> + <xsl:value-of select=" 'flowchart-sequential-access' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t132' "> + <xsl:value-of select=" 'flowchart-magnetic-disk' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t133' "> + <xsl:value-of select=" 'flowchart-direct-access-storage' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t134' "> + <xsl:value-of select=" 'flowchart-display' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t61' "> + <xsl:value-of select=" 'rectangular-callout' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t62' "> + <xsl:value-of select=" 'round-rectangular-callout' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t63' "> + <xsl:value-of select=" 'round-callout' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t106' "> + <xsl:value-of select=" 'cloud-callout' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t50' "> + <xsl:value-of select=" 'line-callout-1' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t51' "> + <xsl:value-of select=" 'line-callout-2' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t47' "> + <xsl:value-of select=" 'line-callout-3' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t72' "> + <xsl:value-of select=" 'bang' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t187' "> + <xsl:value-of select=" 'star4' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t12' "> + <xsl:value-of select=" 'star5' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t58' "> + <xsl:value-of select=" 'star8' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t92' "> + <xsl:value-of select=" 'star24' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t97' "> + <xsl:value-of select=" 'vertical-scroll' "/> + </xsl:when> + <xsl:when test="$ms_word_draw_type = '#_x0000_t98' "> + <xsl:value-of select=" 'horizontal-scroll' "/> + </xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl new file mode 100644 index 000000000..3226f0d1c --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl @@ -0,0 +1,2170 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:ole="http://libreoffice.org/2011/xslt/ole" exclude-result-prefixes="w wx aml o dt v"> + <xsl:include href="wordml2ooo_custom_draw.xsl"/> + <xsl:include href="wordml2ooo_path.xsl"/> + + <xsl:key name="imagedata" match="w:binData" use="@w:name"/> + <xsl:key name="shapetype" match="v:shapetype" use="concat('#', @id)"/> + <xsl:template match="v:fill" mode="get-xsl-number"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/> + </xsl:template> + <xsl:template match="v:textpath" mode="get-xsl-number"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/> + </xsl:template> + <xsl:template match="v:fill" mode="office-style"> + <xsl:choose> + <xsl:when test="@type='pattern' or @type='tile' or @type='frame'"> + <xsl:variable name="fill-src" select="key('imagedata',@src)"/> + <xsl:if test="$fill-src"> + <draw:fill-image> + <xsl:if test="string-length(@o:title) > 0"> + <xsl:attribute name="draw:name"> + <xsl:value-of select="@o:title"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="draw:name"> + <xsl:value-of select="translate(@src,'	  :/.','' ) "/> + </xsl:attribute> + <xsl:element name="office:binary-data"> + <xsl:value-of select="translate($fill-src/text(),'	  ','' ) "/> + </xsl:element> + </draw:fill-image> + </xsl:if> + </xsl:when> + <xsl:when test="contains(@type,'gradient')"> + <draw:gradient> + <xsl:attribute name="draw:name"> + <xsl:value-of select=" 'gradient' "/> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/> + </xsl:attribute> + <xsl:attribute name="draw:style">linear</xsl:attribute> + <xsl:if test="string-length(parent::v:*/@fillcolor) > 0"> + <xsl:attribute name="draw:start-color"> + <xsl:call-template name="MapConstColor"> + <xsl:with-param name="color" select="parent::v:*/@fillcolor"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length(@color2) > 0"> + <xsl:attribute name="draw:end-color"> + <xsl:call-template name="MapConstColor"> + <xsl:with-param name="color" select="@color2"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </draw:gradient> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="w:pict" mode="style4dash_mark"> + <xsl:if test="descendant::v:line or descendant::v:rect or descendant::v:oval or descendant::v:arc or descendant::v:shape"> + <!--Changed--> + <xsl:variable name="vchild" select="./v:*"/> + <xsl:variable name="def" select="$vchild/v:stroke"/> + <xsl:if test="$def"> + <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> --> + <xsl:variable name="wdashstyle" select="$vchild/v:stroke/@dashstyle"/> + <xsl:variable name="stroke-num"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/> + </xsl:variable> + <xsl:variable name="ptweight"> + <xsl:choose> + <xsl:when test="$vchild/@strokeweight"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + <xsl:with-param name="value" select="$vchild/@strokeweight"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + <xsl:with-param name="value" select="'1pt'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$wdashstyle and not ($wdashstyle = 'solid')"> + <xsl:variable name="strdashdot"> + <xsl:call-template name="getstrdashdot"> + <xsl:with-param name="dashstyle" select="$wdashstyle"/> + <!--<xsl:with-param name="weight" select="$vchild/@strokeweight"/>--> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="draw-style"> + <xsl:variable name="end-cap" select="$vchild/v:stroke/@endcap"/> + <xsl:choose> + <xsl:when test="$end-cap = 'round'">round</xsl:when> + <xsl:otherwise>rect</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dot1-length"> + <xsl:call-template name="get-middle-substring"> + <xsl:with-param name="string" select="$strdashdot"/> + <xsl:with-param name="prefix" select="'dol:'"/> + <xsl:with-param name="suffix" select="';don'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="dot1n"> + <xsl:call-template name="get-middle-substring"> + <xsl:with-param name="string" select="$strdashdot"/> + <xsl:with-param name="prefix" select="'don:'"/> + <xsl:with-param name="suffix" select="';dist'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="dist-length"> + <xsl:call-template name="get-middle-substring"> + <xsl:with-param name="string" select="$strdashdot"/> + <xsl:with-param name="prefix" select="'dist:'"/> + <xsl:with-param name="suffix" select="';dtl'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="dot2-length"> + <xsl:call-template name="get-middle-substring"> + <xsl:with-param name="string" select="$strdashdot"/> + <xsl:with-param name="prefix" select="'dtl:'"/> + <xsl:with-param name="suffix" select="';dtn'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="dot2n"> + <xsl:call-template name="get-middle-substring"> + <xsl:with-param name="string" select="$strdashdot"/> + <xsl:with-param name="prefix" select="'dtn:'"/> + <xsl:with-param name="suffix" select="';eddtn'"/> + </xsl:call-template> + </xsl:variable> + <xsl:element name="draw:stroke-dash"> + <!--dol:8;don:1;dist:2;dtl:1;dtn:2;eddtn" />--> + <xsl:attribute name="draw:name"> + <xsl:value-of select="concat('Tdash',$stroke-num)"/> + </xsl:attribute> + <xsl:attribute name="draw:style"> + <xsl:value-of select="$draw-style"/> + </xsl:attribute> + <xsl:if test="(string-length($dot1n) > 0 ) and not ($dot1n ='-1')"> + <xsl:attribute name="draw:dots1"> + <xsl:value-of select="$dot1n"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="(string-length($dot2n) > 0 ) and not ($dot2n ='-1')"> + <xsl:attribute name="draw:dots2"> + <xsl:value-of select="$dot2n"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="(string-length($dot1-length) > 0 ) and not ($dot1-length ='-1')"> + <xsl:attribute name="draw:dots1-length"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat($dot1-length,'pt')"/> + </xsl:call-template>in</xsl:attribute> + </xsl:if> + <xsl:if test="(string-length($dot2-length) > 0 ) and not ($dot2-length ='-1')"> + <xsl:attribute name="draw:dots2-length"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat($dot2-length,'pt')"/> + </xsl:call-template>in</xsl:attribute> + </xsl:if> + <xsl:if test="(string-length($dist-length) > 0 ) and not ($dist-length ='-1')"> + <xsl:variable name="valdistance-length"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat($dist-length,'pt')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="draw:distance"> + <xsl:value-of select="$valdistance-length*$ptweight"/>in</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$vchild/v:stroke/@startarrow"> + <xsl:call-template name="CreateArrowStyle"> + <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@startarrow"/> + <xsl:with-param name="namenumber" select="concat('markerstart',$stroke-num)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$vchild/v:stroke/@endarrow"> + <xsl:call-template name="CreateArrowStyle"> + <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@endarrow"/> + <xsl:with-param name="namenumber" select="concat('markerend',$stroke-num)"/> + </xsl:call-template> + </xsl:if> + <!--<v:stroke dashstyle="1 1" startarrow="diamond" startarrowwidth="wide" startarrowlength="long" endarrow="block" + endarrowwidth="wide" endarrowlength="long" endcap="round"/> + <draw:stroke-dash draw:name="2 2dots 1 dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.0795in" + draw:distance="0.102in"/> + Hehe, it needs to be revised--> + </xsl:if> + </xsl:if> + </xsl:template> + <xsl:template name="CreateArrowStyle"> + <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> --> + <xsl:param name="arrow-name"/> + <xsl:param name="namenumber"/> + <xsl:param name="arrow-weight"/> + <xsl:variable name="svg-box"> + <xsl:choose> + <xsl:when test="$arrow-name = 'block' ">0 0 1131 902</xsl:when> + <xsl:when test="$arrow-name = 'diamond' ">0 0 10 10</xsl:when> + <xsl:when test="$arrow-name = 'open' ">0 0 1122 2243</xsl:when> + <xsl:when test="$arrow-name = 'oval' ">0 0 1131 1131</xsl:when> + <xsl:when test="$arrow-name = 'diamond' ">0 0 1131 1131</xsl:when> + <xsl:when test="$arrow-name = 'classic' ">0 0 1131 1580</xsl:when> + <xsl:otherwise>0 0 1122 2243</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="svg-d"> + <xsl:choose> + <xsl:when test="$arrow-name = 'block' ">m564 0-564 902h1131z</xsl:when> + <!--Symmetric Arrow--> + <xsl:when test="$arrow-name = 'diamond' ">m0 0h10v10h-10z</xsl:when> + <xsl:when test="$arrow-name = 'open' ">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:when> + <xsl:when test="$arrow-name = 'oval' ">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:when> + <xsl:when test="$arrow-name = 'diamond' ">m0 564 564 567 567-567-567-564z</xsl:when> + <xsl:when test="$arrow-name = 'classic' ">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:when> + <xsl:otherwise>m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="draw:marker"> + <xsl:attribute name="draw:name"> + <xsl:value-of select="$namenumber"/> + </xsl:attribute> + <xsl:attribute name="draw:display-name"> + <xsl:value-of select="$namenumber"/> + </xsl:attribute> + <xsl:attribute name="svg:viewBox"> + <xsl:value-of select="$svg-box"/> + </xsl:attribute> + <xsl:attribute name="svg:d"> + <xsl:value-of select="$svg-d"/> + </xsl:attribute> + </xsl:element> + </xsl:template> + <!-- The template MapDashConst Map the const dashstyle to a number manner + It calls the template kickblanks to delete the extra blanks in the dash style here is the map +• Solid (default) • ShortDash "2 2" +• ShortDot "0 2" • ShortDashDot "2 2 0 2" +• ShortDashDotDot "2 2 0 2 0 2" • Dot "1 2" +• Dash "4 2" • LongDash "8 2" +• DashDot "4 2 1 2"• LongDashDot "8 2 1 2" +• LongDashDotDot "8 2 1 2 1 2" +--> + <xsl:template name="MapDashConst"> + <xsl:param name="dashstyle"/> + <xsl:choose> + <xsl:when test="$dashstyle='shortDash'"> 2 2 </xsl:when> + <xsl:when test="$dashstyle='shortDot'"> 0 2 </xsl:when> + <xsl:when test="$dashstyle='shortDashDot'"> 2 2 0 2 </xsl:when> + <xsl:when test="$dashstyle='shortDashDotDot'"> 2 2 0 2 0 2 </xsl:when> + <xsl:when test="$dashstyle='dot'"> 1 2 </xsl:when> + <xsl:when test="$dashstyle='dash'"> 4 2 </xsl:when> + <xsl:when test="$dashstyle='longDash'"> 8 2 </xsl:when> + <xsl:when test="$dashstyle='dashDot'"> 4 2 1 2 </xsl:when> + <xsl:when test="$dashstyle='longDashDot'"> 8 2 1 2 </xsl:when> + <xsl:when test="$dashstyle='longDashDotDot'"> 8 2 1 2 1 2 </xsl:when> + <xsl:otherwise> + <xsl:variable name="str-style" select="concat(' ',$dashstyle ,' ')"/> + <xsl:variable name="cleanstyle"> + <xsl:call-template name="kickblanks"> + <xsl:with-param name="str" select="translate($str-style,' ','-')"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="translate($cleanstyle,'-',' ')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--The template is used to delete the extra blanks from a string.--> + <xsl:template name="kickblanks"> + <xsl:param name="str"/> + <xsl:variable name="tmpstr"> + <xsl:choose> + <xsl:when test="contains($str,'--')"> + <xsl:variable name="str-before"> + <xsl:value-of select="substring-before($str,'--')"/> + </xsl:variable> + <xsl:variable name="str-after"> + <xsl:value-of select="substring-after($str,'--')"/> + </xsl:variable> + <xsl:value-of select="concat($str-before,'-',$str-after)"/> + </xsl:when> + <xsl:when test="contains($str,' ')"> + <xsl:variable name="str-before"> + <xsl:value-of select="substring-before($str,' ')"/> + </xsl:variable> + <xsl:variable name="str-after"> + <xsl:value-of select="substring-after($str,' ')"/> + </xsl:variable> + <xsl:value-of select="concat($str-before,' ',$str-after)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$str"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="not ( string-length($str) = string-length($tmpstr) )"> + <xsl:variable name="restr"> + <xsl:call-template name="kickblanks"> + <xsl:with-param name="str" select="$tmpstr"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$restr"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$str"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="substrcount"> + <xsl:param name="str"/> + <xsl:param name="substr"/> + <xsl:choose> + <xsl:when test="$substr and string-length($str) and contains($str,$substr) and string-length(substring-before($str,$substr)) = 0"> + <xsl:variable name="restr" select="substring-after($str,$substr)"/> + <xsl:variable name="num"> + <xsl:call-template name="substrcount"> + <xsl:with-param name="str" select="$restr"/> + <xsl:with-param name="substr" select="$substr"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$num+1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="latest-substr-after"> + <xsl:param name="str"/> + <xsl:param name="substr"/> + <xsl:choose> + <xsl:when test="contains($str,$substr) and string-length(substring-before($str,$substr)) = 0"> + <xsl:variable name="restr" select="substring-after($str,$substr)"/> + <xsl:call-template name="latest-substr-after"> + <xsl:with-param name="str" select="$restr"/> + <xsl:with-param name="substr" select="$substr"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$str"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--Template get_revised_adj is used to get real adj when adj show two time in the file. --> + <xsl:template name="get_remained_adj"> + <xsl:param name="adj_typeid"/> + <xsl:param name="num"/> + <xsl:param name="mark"/> + <xsl:choose> + <xsl:when test="$num > 0 "> + <xsl:variable name="new_remained_adj"> + <xsl:choose> + <xsl:when test="string-length($adj_typeid) > 0"> + <xsl:call-template name="get_remained_adj"> + <xsl:with-param name="adj_typeid" select="substring-after($adj_typeid,$mark)"/> + <xsl:with-param name="num" select="$num -1"/> + <xsl:with-param name="mark" select="$mark"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$new_remained_adj"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$adj_typeid"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--Template get_non_omit_adj is used to get the non-omit adj.(e.g. Adj="10,,11" means modifiers="10 0 11").--> + <xsl:template name="get_non_omit_adj"> + <xsl:param name="adj_typeid"/> + <xsl:param name="num"/> + <xsl:param name="mark"/> + <xsl:choose> + <xsl:when test="$num > 0 "> + <xsl:variable name="before" select="substring-before($adj_typeid,',')"/> + <xsl:variable name="after" select="substring-after($adj_typeid,',')"/> + <xsl:variable name="zero_or_itself"> + <xsl:choose> + <xsl:when test="string-length(translate($before, ' ','' ) ) > 0"> + <xsl:value-of select="$before"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'0'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="new_non_omit_adj"> + <xsl:call-template name="get_non_omit_adj"> + <xsl:with-param name="adj_typeid" select="$after"/> + <xsl:with-param name="num" select="$num -1"/> + <xsl:with-param name="mark" select="$mark"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat($zero_or_itself, ' ',$new_non_omit_adj)"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="zero_or_itself"> + <xsl:choose> + <xsl:when test="string-length(translate($adj_typeid, ' ','' ) ) > 0"> + <xsl:value-of select="$adj_typeid"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'0'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$zero_or_itself"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="getstrdashdot"> + <!--Remember the robust!if dashstyle is '2'?What to do!--> + <xsl:param name="dashstyle"/> + <xsl:variable name="dstyle"> + <xsl:variable name="tmpstyle"> + <xsl:call-template name="MapDashConst"> + <xsl:with-param name="dashstyle" select="$dashstyle"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring-after($tmpstyle,' ')"/> + </xsl:variable> + <xsl:variable name="dot1" select="substring-before($dstyle,' ')"/> + <xsl:variable name="dot1after" select="substring-after($dstyle,' ')"/> + <xsl:variable name="dot1distance" select="substring-before($dot1after,' ')"/> + <xsl:variable name="modesubstr1" select="concat($dot1,' ',$dot1distance,' ')"/> + <xsl:variable name="dot1n"> + <xsl:call-template name="substrcount"> + <xsl:with-param name="str" select="$dstyle"/> + <xsl:with-param name="substr" select="$modesubstr1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="dot2substr"> + <xsl:call-template name="latest-substr-after"> + <xsl:with-param name="str" select="$dstyle"/> + <xsl:with-param name="substr" select="$modesubstr1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="dot2"> + <xsl:choose> + <xsl:when test="string-length($dot2substr) > 3"> + <xsl:value-of select="substring-before($dot2substr,' ')"/> + </xsl:when> + <xsl:otherwise>-1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dot2distance"> + <xsl:choose> + <xsl:when test="string-length($dot2substr) > 3"> + <xsl:variable name="tmpstr" select="substring-after($dot2substr,' ')"/> + <xsl:value-of select="substring-before($tmpstr,' ')"/> + </xsl:when> + <xsl:otherwise>-1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="modesubstr2" select="concat($dot2,' ',$dot2distance,' ') "/> + <xsl:variable name="dot2n"> + <xsl:choose> + <xsl:when test="string-length($dot2substr) > 3"> + <xsl:call-template name="substrcount"> + <xsl:with-param name="str" select="$dot2substr"/> + <xsl:with-param name="substr" select="$modesubstr2"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>-1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="valDistance"> + <!--Over all distance is the larger one!--> + <xsl:choose> + <xsl:when test="$dot2distance > $dot1distance"> + <xsl:value-of select="$dot2distance"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$dot1distance"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('dol:',$dot1,';don:',$dot1n,';dist:',$valDistance,';dtl:',$dot2,';dtn:',$dot2n,';eddtn')"/> + <!--<xsl:choose> + <xsl:when test="$dashstyle='1 1' or $dashstyle='Dots'"> + <xsl:variable name="do"><xsl:value-of select="'1'"/></xsl:variable> + <xsl:variable name="dol"><xsl:value-of select="$do * $cmweight"/></xsl:variable> + <xsl:variable name="ds"><xsl:value-of select="'1'"/></xsl:variable> + <xsl:variable name="dsl"><xsl:value-of select="$ds * $cmweight"/></xsl:variable> + <xsl:variable name="dt"><xsl:value-of select="'-1'"/></xsl:variable> + <xsl:variable name="dtl"><xsl:value-of select="'-1'"/></xsl:variable> + <xsl:value-of select="concat('dsl:',$dsl,'edsl','do:',$do, 'edo;','do')"/> + </xsl:when> + </xsl:choose>--> + </xsl:template> + <xsl:template match="w:pict" mode="style"> + <xsl:apply-templates mode="style" select="v:*"/> + </xsl:template> + <xsl:template match="v:*" mode="style"> + <xsl:variable name="vchild" select="."/> + <xsl:variable name="style" select="concat($vchild/@style, ';')"/> + <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/> + <xsl:variable name="right-name" select="not(name($vchild) = 'v:formulas') and not(name($vchild) = 'v:f') and not(name($vchild) = 'v:shapetype')"/> + <xsl:variable name="def" select="string-length($style) > 0 or $vchild/@stroke or $vchild/@stroked or $vchild/@strokecolor or $vchild/v:stroke or $vchild/@strokeweight or $vchild/@wrapcoords or $vchild/@fillcolor"/> + <xsl:choose> + <xsl:when test="$right-name and ($def or (number($z-index) < 0))"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/> + </xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <xsl:variable name="stroke-num"> + <xsl:if test="$vchild/v:stroke"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="draw-stroke"> + <xsl:variable name="dashstyle" select="$vchild/v:stroke/@dashstyle"/> + <xsl:choose> + <xsl:when test="$vchild/@stroked and $vchild/@stroked='f'">none</xsl:when> + <xsl:when test="$dashstyle and not ($dashstyle = 'solid')"> + <xsl:value-of select="concat('Tdash',$stroke-num)"/> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <xsl:element name="style:graphic-properties"> + <xsl:variable name="style-str" select="concat(@style,';')"/> + <xsl:choose> + <xsl:when test="number($z-index) < 0 or (name($vchild) = 'v:group' and $vchild/@editas ='canvas' )"> + <xsl:attribute name="style:wrap">run-through</xsl:attribute> + <xsl:attribute name="style:run-through">background</xsl:attribute> + <xsl:attribute name="style:flow-with-text">false</xsl:attribute> + <xsl:attribute name="fo:border">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:wrap">run-through</xsl:attribute> + <xsl:attribute name="style:run-through">foreground</xsl:attribute> + <xsl:attribute name="style:flow-with-text">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="contains($style-str,'mso-position-horizontal:')"> + <xsl:attribute name="style:horizontal-pos"> + <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-horizontal:') , ';')"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="v:imagedata or v:textbox"> + <xsl:attribute name="style:horizontal-pos">from-left</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="parent::w:pict/o:OLEObject"> + <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/> + <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/> + <xsl:attribute name="draw:visible-area-left">0cm</xsl:attribute> + <xsl:attribute name="draw:visible-area-top">0cm</xsl:attribute> + <xsl:attribute name="draw:visible-area-width"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$width"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="draw:visible-area-height"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$height"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="draw:ole-draw-aspect"> + <!-- DVASPECT_CONTENT = 1, + DVASPECT_THUMBNAIL = 2, + DVASPECT_ICON = 4, + DVASPECT_DOCPRINT = 8 --> + <xsl:variable name="ms-aspect" select="parent::w:pict/o:OLEObject/@DrawAspect"/> + <xsl:choose> + <xsl:when test="$ms-aspect = 'Content'">1</xsl:when> + <xsl:when test="$ms-aspect = 'Thumbnail'">2</xsl:when> + <xsl:when test="$ms-aspect = 'Icon'">4</xsl:when> + <xsl:when test="$ms-aspect = 'Docprint'">8</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="parent::w:pict/o:OLEObject"> + <xsl:attribute name="style:vertical-pos">middle</xsl:attribute> + <xsl:attribute name="style:vertical-rel">baseline</xsl:attribute> + </xsl:when> + <xsl:when test="contains($style-str,'mso-position-vertical:')"> + <xsl:attribute name="style:vertical-pos"> + <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-vertical:') , ';')"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="v:imagedata or v:textbox"> + <xsl:attribute name="style:vertical-pos">from-top</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="string-length($draw-stroke) > 0"> + <!--draw:stroke="dash" draw:stroke-dash="Ohon!Ultrafine dashed" --> + <xsl:choose> + <xsl:when test="not ($draw-stroke = 'none')"> + <xsl:attribute name="draw:stroke"> + <xsl:value-of select="'dash'"/> + </xsl:attribute> + <xsl:attribute name="draw:stroke-dash"> + <xsl:value-of select="$draw-stroke"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="draw:stroke"> + <xsl:value-of select="'none'"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$vchild/v:stroke/@startarrow"> + <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/--> + <xsl:attribute name="draw:marker-start"> + <xsl:value-of select="concat('markerstart',$stroke-num)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$vchild/v:stroke/@endarrow"> + <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/--> + <xsl:attribute name="draw:marker-end"> + <xsl:value-of select="concat('markerend',$stroke-num)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$vchild/@strokeweight"> + <xsl:attribute name="svg:stroke-width"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$vchild/@strokeweight"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="$vchild/@strokecolor"> + <xsl:attribute name="svg:stroke-color"> + <xsl:call-template name="MapConstColor"> + <xsl:with-param name="color" select="$vchild/@strokecolor"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="$vchild/@fillcolor"> + <xsl:attribute name="draw:fill-color"> + <xsl:call-template name="MapConstColor"> + <xsl:with-param name="color" select="$vchild/@fillcolor"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="not($vchild/@fillcolor)"> + <xsl:choose> + <xsl:when test="ancestor::v:group | v:shadow"> + <xsl:attribute name="draw:fill-color">#ffffff</xsl:attribute> + </xsl:when> + <xsl:when test="not($vchild/v:fill) and not(v:shadow)"> + <xsl:attribute name="draw:fill">none</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="$vchild/v:fill/@opacity"> + <xsl:attribute name="draw:opacity"> + <xsl:call-template name="convert2percent"> + <xsl:with-param name="value" select="$vchild/v:fill/@opacity"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="$vchild/v:fill/@type = 'pattern' or $vchild/v:fill/@type = 'tile' or $vchild/v:fill/@type = 'frame'"> + <xsl:attribute name="draw:fill">bitmap</xsl:attribute> + <xsl:attribute name="draw:fill-image-name"> + <xsl:value-of select="translate($vchild/v:fill/@src,'	  :/.','' ) "/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$vchild/v:fill/@type = 'gradient'"> + <xsl:attribute name="draw:fill">gradient</xsl:attribute> + <xsl:attribute name="draw:fill-gradient-name"> + <xsl:value-of select=" 'gradient' "/> + <xsl:apply-templates mode="get-xsl-number" select="$vchild/v:fill"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="style" select="v:shadow"/> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <!--Default style which will surely be removed during imported from a .flat file to SO--> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/> + </xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" style:wrap="none" draw:fill="none"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="name() = 'v:group'"> + <xsl:apply-templates mode="style" select="v:*"/> + </xsl:if> + <xsl:apply-templates mode="style" select="v:textpath"/> + </xsl:template> + <xsl:template match="v:shadow" mode="style"> + <!-- v:shadow on="t" color="aqua" opacity=".5" offset="13pt,11pt" offset2="14pt,10pt" --> + <xsl:attribute name="draw:shadow"> + <xsl:choose> + <xsl:when test="contains(@on,'f')">hidden</xsl:when> + <xsl:otherwise>visible</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="draw:shadow-color"> + <xsl:call-template name="MapConstColor"> + <xsl:with-param name="color" select="@color"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="string-length(@opacity) >0"> + <xsl:attribute name="draw:shadow-opacity"> + <xsl:call-template name="convert2percent"> + <xsl:with-param name="value" select="@opacity"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="contains(@offset,',')"> + <xsl:attribute name="draw:shadow-offset-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before(@offset,',')"/> + <xsl:with-param name="TargetMeasure" select=" 'cm' "/> + </xsl:call-template> + <xsl:value-of select="'cm'"/> + </xsl:attribute> + <xsl:attribute name="draw:shadow-offset-y"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-after(@offset,',')"/> + <xsl:with-param name="TargetMeasure" select=" 'cm' "/> + </xsl:call-template> + <xsl:value-of select="'cm'"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="draw:shadow-offset-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="@offset"/> + <xsl:with-param name="TargetMeasure" select=" 'cm' "/> + </xsl:call-template> + <xsl:value-of select="'cm'"/> + </xsl:attribute> + <xsl:attribute name="draw:shadow-offset-y">0.062cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@type='perspective' and @offset='0,0'"> + <xsl:message>This kind of shadow does not support yet.</xsl:message> + </xsl:if> + </xsl:template> + <xsl:template name="convert2percent"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="contains($value,'%')"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:when test="contains($value,'f')"> + <xsl:variable name="num-value" select="round(substring-before($value,'f') div 6.5536) div 100"/> + <xsl:value-of select="concat(100 - $num-value ,'%')"/> + </xsl:when> + <xsl:when test="string-length($value) = 0"> + <xsl:value-of select="'1%'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($value * 100 ,'%')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="w:pict"> + <xsl:param name="x-scale" select="1"/> + <xsl:param name="y-scale" select="1"/> + <xsl:param name="group-left" select="0"/> + <xsl:param name="group-top" select="0"/> + <xsl:param name="coord-left" select="0"/> + <xsl:param name="coord-top" select="0"/> + <xsl:param name="MeasureMark"/> + <xsl:apply-templates> + <xsl:with-param name="x-scale" select="$x-scale"/> + <xsl:with-param name="y-scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-left" select="$group-left"/> + <xsl:with-param name="group-top" select="$group-top"/> + <xsl:with-param name="coord-left" select="$coord-left"/> + <xsl:with-param name="coord-top" select="$coord-top"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template name="get-middle-substring"> + <xsl:param name="string"/> + <xsl:param name="prefix"/> + <xsl:param name="suffix"/> + <xsl:if test="contains($string, $prefix)"> + <xsl:choose> + <xsl:when test="contains(substring-after( $string, $prefix), $suffix)"> + <xsl:value-of select="substring-before(substring-after( $string, $prefix), $suffix)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after( $string, $prefix)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="w:binData"> + </xsl:template> + <xsl:template match="v:group"> + <xsl:param name="x-scale" select="1"/> + <xsl:param name="y-scale" select="1"/> + <xsl:param name="MeasureMark"/> + <xsl:param name="group-left" select="0"/> + <xsl:param name="group-top" select="0"/> + <xsl:param name="coord-left" select="0"/> + <xsl:param name="coord-top" select="0"/> + <xsl:variable name="style" select="concat(@style, ';')"/> + <xsl:variable name="left"> + <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/> + <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/> + <xsl:call-template name="Add-with-Measure"> + <xsl:with-param name="value1" select="$margin-left"/> + <xsl:with-param name="value2" select="$direct-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="top"> + <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/> + <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/> + <xsl:call-template name="Add-with-Measure"> + <xsl:with-param name="value1" select="$margin-top"/> + <xsl:with-param name="value2" select="$direct-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/> + <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/> + <xsl:variable name="Current-coord-left"> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="substring-before(@coordorigin, ',' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="Current-coord-top"> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="substring-after(@coordorigin, ',' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="Current-coord-width"> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="substring-before(@coordsize, ',' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="Current-coord-height"> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="substring-after(@coordsize, ',' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="Current-MeasureMark"> + <xsl:choose> + <xsl:when test="string-length($MeasureMark) > 0"> + <xsl:value-of select="$MeasureMark"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" 'cm' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="left-value"> + <xsl:variable name="adjusted-left"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$left"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/> + <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="$adjusted-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="top-value"> + <xsl:variable name="adjusted-top"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$top"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/> + <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="$adjusted-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="width-value"> + <xsl:variable name="adjusted-width"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$width"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/> + <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="$adjusted-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height-value"> + <xsl:variable name="adjusted-height"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$height"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/> + <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="$adjusted-height"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="Current-x-scale" select="( $Current-coord-width div $width-value ) * $x-scale"/> + <xsl:variable name="Current-y-scale" select="( $Current-coord-height div $height-value ) * $y-scale"/> + <xsl:choose> + <xsl:when test="@editas='canvas' "> + <!-- frame --> + <xsl:variable name="style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/> + </xsl:variable> + <xsl:variable name="frame-name">frame<xsl:number from="/w:wordDocument/w:body" level="any" count="v:group" format="1"/> + </xsl:variable> + <draw:frame draw:style-name="{$style-name}" draw:name="{$frame-name}" text:anchor-type="as-char" svg:x="{$left-value}{$Current-MeasureMark}" svg:y="{$top-value}{$Current-MeasureMark}" svg:width="{$width-value}{$Current-MeasureMark}" svg:height="{$height-value}{$Current-MeasureMark}" draw:z-index="0"> + <draw:text-box> + <text:p text:style-name="Drawing"> + <xsl:apply-templates select="w:r/w:pict | v:*"> + <xsl:with-param name="x-scale" select="$Current-x-scale"/> + <xsl:with-param name="y-scale" select="$Current-y-scale"/> + <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/> + <xsl:with-param name="group-left" select="$left-value"/> + <xsl:with-param name="group-top" select="$top-value"/> + <xsl:with-param name="coord-left" select="$Current-coord-left"/> + <xsl:with-param name="coord-top" select="$Current-coord-top"/> + </xsl:apply-templates> + </text:p> + </draw:text-box> + </draw:frame> + </xsl:when> + <xsl:otherwise> + <xsl:element name="draw:g"> + <xsl:apply-templates select="w:r/w:pict | v:*"> + <xsl:with-param name="x-scale" select="$Current-x-scale"/> + <xsl:with-param name="y-scale" select="$Current-y-scale"/> + <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/> + <xsl:with-param name="group-left" select="$left-value"/> + <xsl:with-param name="group-top" select="$top-value"/> + <xsl:with-param name="coord-left" select="$Current-coord-left"/> + <xsl:with-param name="coord-top" select="$Current-coord-top"/> + </xsl:apply-templates> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="v:*"> + <xsl:param name="x-scale" select="1"/> + <xsl:param name="y-scale" select="1"/> + <xsl:param name="MeasureMark"/> + <xsl:param name="group-left" select="0"/> + <xsl:param name="group-top" select="0"/> + <xsl:param name="coord-left" select="0"/> + <xsl:param name="coord-top" select="0"/> + <xsl:if test="not (name() = 'v:shapetype' )"> + <xsl:call-template name="DrawElements"> + <xsl:with-param name="x-scale" select="$x-scale"/> + <xsl:with-param name="y-scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-left" select="$group-left"/> + <xsl:with-param name="group-top" select="$group-top"/> + <xsl:with-param name="coord-left" select="$coord-left"/> + <xsl:with-param name="coord-top" select="$coord-top"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="DrawElements"> + <xsl:param name="x-scale" select="1"/> + <xsl:param name="y-scale" select="1"/> + <xsl:param name="MeasureMark"/> + <xsl:param name="group-left" select="0"/> + <xsl:param name="group-top" select="0"/> + <xsl:param name="coord-left" select="0"/> + <xsl:param name="coord-top" select="0"/> + <xsl:param name="force-draw" select="'false'"/> + <xsl:param name="shape-type"/> + <xsl:variable name="wordshapename" select="substring-after(name(),':')"/> + <xsl:variable name="custom_shapename"> + <xsl:if test="$wordshapename='roundrect' ">round-rectangle</xsl:if> + <xsl:if test="$wordshapename='shape' and not (v:imagedata) and not (v:textbox) and @type"> + <xsl:call-template name="ms_word_draw_map2ooo_custom_draw"> + <xsl:with-param name="ms_word_draw_type" select="@type"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="is-image" select="$wordshapename='shape' and v:imagedata"/> + <xsl:variable name="element-name"> + <xsl:choose> + <xsl:when test="$wordshapename='line'">draw:line</xsl:when> + <xsl:when test="$wordshapename='rect'">draw:rect</xsl:when> + <xsl:when test="$wordshapename='oval'">draw:ellipse</xsl:when> + <xsl:when test="$wordshapename='arc'">draw:ellipse</xsl:when> + <xsl:when test="$wordshapename='polyline'">draw:polyline</xsl:when> + <xsl:when test="$wordshapename='roundrect' ">draw:custom-shape</xsl:when> + <xsl:when test="$wordshapename='shape' and v:imagedata">draw:frame</xsl:when> + <xsl:when test="$wordshapename='shape' and not (v:imagedata) and @type"> + <xsl:choose> + <xsl:when test="string-length($custom_shapename) > 0">draw:custom-shape</xsl:when> + <xsl:when test=" string-length(@type) > 0 and key('shapetype',@type)">draw:custom-shape</xsl:when> + <xsl:otherwise>draw:rect</xsl:otherwise> + <!--if nothing match it, we prefer rect--> + </xsl:choose> + </xsl:when> + <xsl:when test="$wordshapename='shape' and v:textbox">draw:frame</xsl:when> + <!--changed here!--> + <xsl:otherwise>draw:path</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="wfill" select="@fill"/> + <xsl:variable name="draw-kind"> + <xsl:if test="$wordshapename='arc' and string-length($wfill) > 0">arc</xsl:if> + <!--Means this is a Segment of Circle--> + </xsl:variable> + <!--Get the position,left,top,width,height,z-index,flip from Style--> + <xsl:variable name="style" select="concat(@style, ';')"/> + <xsl:variable name="position" select="substring-before(substring-after($style,'position:'),';')"/> + <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/> + <xsl:variable name="left"> + <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/> + <xsl:call-template name="Add-with-Measure"> + <xsl:with-param name="value1" select="$margin-left"/> + <xsl:with-param name="value2" select="$direct-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/> + <xsl:variable name="top"> + <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/> + <xsl:call-template name="Add-with-Measure"> + <xsl:with-param name="value1" select="$margin-top"/> + <xsl:with-param name="value2" select="$direct-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/> + <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/> + <xsl:variable name="flip" select="substring-before(substring-after($style,'flip:'),';')"/> + <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/> + <!--these are used for wrap margins get from style--> + <xsl:variable name="mso-wrap-distance-lefttmp" select="substring-after($style,'mso-wrap-distance-left:')"/> + <xsl:variable name="mso-wrap-distance-left" select="substring-before($mso-wrap-distance-lefttmp,';')"/> + <xsl:variable name="mso-wrap-distance-toptmp" select="substring-after($style,'mso-wrap-distance-top:')"/> + <xsl:variable name="mso-wrap-distance-top" select="substring-before($mso-wrap-distance-toptmp,';')"/> + <xsl:variable name="mso-wrap-distance-righttmp" select="substring-after($style,'mso-wrap-distance-right:')"/> + <xsl:variable name="mso-wrap-distance-right" select="substring-before($mso-wrap-distance-righttmp,';')"/> + <xsl:variable name="mso-wrap-distance-bottomtmp" select="substring-after($style,'mso-wrap-distance-bottom:')"/> + <xsl:variable name="mso-wrap-distance-bottom" select="substring-before($mso-wrap-distance-bottomtmp,';')"/> + <xsl:variable name="mso-position-horizontal-relativetmp" select="substring-after($style,'mso-position-horizontal-relative:')"/> + <xsl:variable name="mso-position-horizontal-relative" select="substring-before($mso-position-horizontal-relativetmp,';')"/> + <xsl:variable name="mso-position-vertical-relativetmp" select="substring-after($style,'mso-position-vertical-relative:')"/> + <xsl:variable name="mso-position-vertical-relative" select="substring-before($mso-position-vertical-relativetmp,';')"/> + <xsl:variable name="anchor-type"> + <xsl:choose> + <xsl:when test="$mso-position-vertical-relative='page' or $mso-position-horizontal-relative = 'page'">page</xsl:when> + <xsl:when test="$position='absolute'">paragraph</xsl:when> + <xsl:otherwise>as-char</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="text-style-name"> + <xsl:choose> + <xsl:when test="descendant::v:textbox">P1</xsl:when> + <xsl:when test="v:textpath">textpath<xsl:apply-templates mode="get-xsl-number" select="v:textpath"/> + </xsl:when> + <!--Should get the real style late--> + <xsl:otherwise>P1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="{$element-name}"> + <xsl:if test="$element-name = 'draw:frame'"> + <xsl:attribute name="draw:name"> + <xsl:value-of select="'frame'"/> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$element-name ='draw:path'"> + <xsl:choose> + <xsl:when test="string-length(@path) = 0"> + <xsl:attribute name="svg:d">M 0,0 L 0,0</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="svg:d"> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="@path"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$element-name ='draw:path' or $wordshapename='polyline'"> + <xsl:attribute name="svg:viewBox"> + <xsl:value-of select="'0 0'"/> + <xsl:value-of select="' '"/> + <xsl:if test="string-length(@coordsize) = 0"> + <xsl:value-of select="'1000 1000'"/> + </xsl:if> + <xsl:if test="not(string-length(@coordsize) = 0)"> + <xsl:value-of select="translate(@coordsize,',',' ')"/> + </xsl:if> + </xsl:attribute> + </xsl:if> + <xsl:if test="contains($style,'rotation:')"> + <xsl:attribute name="draw:transform"> + <xsl:variable name="rotate"> + <xsl:call-template name="convert2redian"> + <xsl:with-param name="x" select="substring-before(substring-after($style,'rotation:') , ';')"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat( 'rotate(' , $rotate * -1 , ')' )"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="text:anchor-type"> + <xsl:value-of select="$anchor-type"/> + <!--This need to be checkout and built!--> + </xsl:attribute> + <xsl:if test="string-length($z-index) > 0"> + <xsl:if test="number($z-index) < 0"> + <xsl:attribute name="draw:z-index"> + <xsl:value-of select="'0'"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="not(number($z-index) < 0)"> + <xsl:attribute name="draw:z-index"> + <xsl:value-of select="$z-index"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:attribute name="draw:style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/> + </xsl:attribute> + <xsl:attribute name="draw:text-style-name"> + <xsl:value-of select="$text-style-name"/> + <!--This is difficult!!--> + </xsl:attribute> + <xsl:if test="$wordshapename='line'"> + <xsl:variable name="fromx" select="substring-before(@from,',')"/> + <xsl:variable name="fromy" select="substring-after(@from,',')"/> + <xsl:variable name="tox" select="substring-before(@to,',')"/> + <xsl:variable name="toy" select="substring-after(@to,',')"/> + <xsl:variable name="valfromx"> </xsl:variable> + <xsl:if test="$anchor-type='as-char'"> + <xsl:attribute name="svg:x1"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$fromx"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:y1"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$fromy"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-top"/> + <xsl:with-param name="coord-value" select="$coord-top"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:x2"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$tox"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:y2"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$toy"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-top"/> + <xsl:with-param name="coord-value" select="$coord-top"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="not ($anchor-type='as-char')"> + <xsl:attribute name="svg:x1"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$fromx"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:y1"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$toy"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-top"/> + <xsl:with-param name="coord-value" select="$coord-top"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:x2"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$tox"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:y2"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$fromy"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-top"/> + <xsl:with-param name="coord-value" select="$coord-top"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="$wordshapename='rect' or $wordshapename='oval' or $wordshapename='arc' or $wordshapename='shape' or $wordshapename='polyline' or ($wordshapename='shape' and v:textbox) or ($wordshapename='roundrect' and v:textbox) "> + <xsl:if test="$anchor-type='as-char'"> + <xsl:attribute name="svg:width"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$width"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:height"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$height"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:x"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$left"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:y"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$top"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-top"/> + <xsl:with-param name="coord-value" select="$coord-top"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="not ($anchor-type='as-char')"> + <!--Something has to be down because We have Margin-top options--> + <xsl:attribute name="svg:width"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$width"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:height"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$height"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:x"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$left"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="svg:y"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$top"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$MeasureMark"/> + <xsl:with-param name="group-value" select="$group-top"/> + <xsl:with-param name="coord-value" select="$coord-top"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="$element-name='draw:ellipse' and string-length($draw-kind) > 0"> + <xsl:attribute name="draw:kind"> + <xsl:value-of select="$draw-kind"/> + </xsl:attribute> + </xsl:if> + <!--<draw:area-polygon … svg:x="0" svg:y="0" svg:width="2.0cm" svg:height="2.0cm" svg:viewBox="0 0 2000 2000" svg:points="400,1500 1600,1500 1000,400"/> + The element shown in the following example defines a triangle that is located in the middle of a 2cm by 2cm image. The bounding box covers an area of 2cm by 1.5cm. One view box unit corresponds to 0.01mm.--> + <xsl:if test="$wordshapename='polyline'"> + <xsl:variable name="MeasureMark_Here" select="'cm'"/> + <!--MeasureMarkHere is cm because One view box unit corresponds to 0.01mm--> + <xsl:variable name="width_cm"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$width"/> + <xsl:with-param name="scale" select="$x-scale"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height_cm"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$height"/> + <xsl:with-param name="scale" select="$x-scale"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="widthval"> + <xsl:if test="contains($width_cm,'cm')"> + <xsl:value-of select="round(substring-before($width_cm,'cm')*1000)"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="heightval"> + <xsl:if test="contains($height_cm,'cm')"> + <xsl:value-of select="round(substring-before($height_cm,'cm')*1000)"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="viewBoxstr" select="concat('0 0 ',$widthval,' ',$heightval)"/> + <xsl:attribute name="svg:viewBox"> + <xsl:value-of select="$viewBoxstr"/> + </xsl:attribute> + <xsl:variable name="inputx_cm"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$left"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="group-value" select="$group-left"/> + <xsl:with-param name="coord-value" select="$coord-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="inputy_cm"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$top"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="group-value" select="$group-top"/> + <xsl:with-param name="coord-value" select="$coord-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="inputx_val"> + <xsl:choose> + <xsl:when test="contains($inputx_cm,'cm')"> + <xsl:value-of select="substring-before($inputx_cm,'cm')"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="inputy_val"> + <xsl:choose> + <xsl:when test="contains($inputy_cm,'cm')"> + <xsl:value-of select="substring-before($inputy_cm,'cm')"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="inputboxwidth" select="$widthval"/> + <xsl:variable name="oopoints"> + <xsl:call-template name="wordpoints2oopoints"> + <xsl:with-param name="input_x" select="$inputx_val"/> + <xsl:with-param name="input_y" select="$inputy_val"/> + <xsl:with-param name="input_width" select="$width"/> + <xsl:with-param name="input_height" select="$height"/> + <xsl:with-param name="input_boxwidth" select="$widthval"/> + <xsl:with-param name="input_boxheight" select="$heightval"/> + <xsl:with-param name="input_points" select="concat(@points,',')"/> + <!-- add a space to the end of input_points --> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length($oopoints) > 0"> + <xsl:attribute name="draw:points"> + <xsl:value-of select="$oopoints"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="$is-image"> + <xsl:variable name="the-image" select="key('imagedata',v:imagedata/@src)"/> + <xsl:choose> + <xsl:when test="string-length(v:imagedata/@o:title) > 0"> + <xsl:attribute name="draw:name"> + <xsl:value-of select="v:imagedata/@o:title"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="string-length(parent::w:pict/o:OLEObject/@ObjectID) > 0"> + <xsl:attribute name="draw:name"> + <xsl:value-of select="parent::w:pict/o:OLEObject/@ObjectID"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="parent::w:pict/o:OLEObject" mode="output"/> + <draw:image> + <xsl:element name="office:binary-data"> + <xsl:value-of select="translate($the-image/text(),'	  ','' ) "/> + </xsl:element> + </draw:image> + </xsl:if> + <xsl:if test="$element-name = 'draw:custom-shape'"> + <xsl:apply-templates select="v:textpath" mode="text-p"> + <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/> + </xsl:apply-templates> + <xsl:element name="draw:enhanced-geometry"> + <xsl:variable name="enhanced_path"> + <!--enhanced_path call a template to get the enhanced-path--> + <xsl:choose> + <xsl:when test="string-length($custom_shapename) = 0"> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="@path"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <!--####notice that:there is some drawing elements that don't have the shapetype so that can not have a viewbox + It is a ****problem**** now-so be sure to check it out.--> + <xsl:if test="$wordshapename='roundrect' "> + <xsl:variable name="tmp_MeasueMark"> + <xsl:value-of select="'cm'"/> + </xsl:variable> + <xsl:variable name="svg_viewwidth"> + <xsl:if test="$anchor-type='as-char'"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$width"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not ($anchor-type='as-char')"> + <!--Something has to be down because We have Margin-top options--> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$width"/> + <xsl:with-param name="scale" select="$x-scale"/> + <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="svg_viewheight"> + <xsl:if test="$anchor-type='as-char'"> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$height"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not ($anchor-type='as-char')"> + <!--Something has to be down because We have Margin-top options--> + <xsl:call-template name="convert-with-scale-and-measure"> + <xsl:with-param name="value" select="$height"/> + <xsl:with-param name="scale" select="$y-scale"/> + <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="svg_viewBox"> + <xsl:value-of select="concat( '0 0 ',substring-before($svg_viewwidth,$tmp_MeasueMark)*10000,' ',substring-before($svg_viewheight,$tmp_MeasueMark)*10000)"/> + </xsl:variable> + <xsl:attribute name="svg:viewBox"> + <xsl:value-of select="$svg_viewBox"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($custom_shapename) > 0"> + <xsl:attribute name="draw:type"> + <xsl:value-of select="$custom_shapename"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($enhanced_path) > 0"> + <xsl:attribute name="draw:enhanced-path"> + <xsl:value-of select="$enhanced_path"/> + </xsl:attribute> + </xsl:if> + <xsl:variable name="typeid_adj"> + <!--for fix the bug of version 1.63: the following description: adj="-11796480,,5400" in OOo should be: modifier =" -11796480 0 5400"--> + <xsl:variable name="tmp_adj"> + <xsl:value-of select="key('shapetype',@type)/@adj"/> + </xsl:variable> + <xsl:if test="contains($tmp_adj, ',') "> + <xsl:variable name="number"> + <xsl:value-of select="string-length(translate($tmp_adj,'+-0123456789 ','' ) )"/> + </xsl:variable> + <xsl:call-template name="get_non_omit_adj"> + <xsl:with-param name="adj_typeid" select="$tmp_adj"/> + <xsl:with-param name="num" select="$number"/> + <xsl:with-param name="mark" select="',' "/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not (contains($tmp_adj, ',') )"> + <xsl:value-of select="$tmp_adj"/> + </xsl:if> + </xsl:variable> + <!--the following choose statement code will process the revised modifier + It happens that if a drawing elements has more than 2 modifier, the modifier (or say adj + in wordml) can be adjusted and only the modified adj is recorded. + what makes it more complicated is that adj support both comma and blanks. + so you have to use kickblanks template to kick the blanks and change it to comma version. + <key('shapetype',@type)/v:textpath[1]--> + <xsl:choose> + <xsl:when test="string-length($typeid_adj) = 0"> + <xsl:if test="contains(@adj,',')"> + <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient. + -####Note that comma can't be recognized by OOo's modifiers + <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/> + <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/> + <xsl:variable name="adjuststr"> + <xsl:if test="$adjust-x and $adjust-y"> + -####Note that comma can't be recognized by OOo's modifiers-> + <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/> + </xsl:if> + </xsl:variable>--> + <xsl:attribute name="draw:modifiers"> + <xsl:value-of select="translate(@adj ,',' ,' ')"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@adj and not(contains(@adj,','))"> + <!--####Note that comma can't be recognized by OOo's modifiers.--> + <xsl:attribute name="draw:modifiers"> + <xsl:value-of select="@adj"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <!--Means that you have to care about 2 adj parameters which is different--> + <xsl:variable name="mark_used_by_typeid"> + <xsl:if test="contains($typeid_adj, ',' )"> + <xsl:value-of select="',' "/> + </xsl:if> + <xsl:if test="not (contains( $typeid_adj, ',' ) ) "> + <xsl:value-of select="' ' "/> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="@adj"> + <xsl:variable name="remained_adj"> + <xsl:if test="contains(@adj,',' ) "> + <xsl:variable name="number"> + <xsl:value-of select="string-length(translate(@adj,'+-0123456789 ','' ) )"/> + </xsl:variable> + <xsl:call-template name="get_remained_adj"> + <xsl:with-param name="adj_typeid" select="$typeid_adj"/> + <xsl:with-param name="num" select="$number+1"/> + <xsl:with-param name="mark" select="$mark_used_by_typeid"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not (contains(@adj,',' ) ) "> + <xsl:variable name="tmp_str_adj"> + <xsl:call-template name="kickblanks"> + <xsl:with-param name="str" select="concat(' ' ,@adj,' ')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="number"> + <xsl:value-of select="string-length(translate($tmp_str_adj,'+-0123456789','' ) )"/> + </xsl:variable> + <xsl:call-template name="get_remained_adj"> + <xsl:with-param name="adj_typeid" select="$typeid_adj"/> + <xsl:with-param name="num" select="$number - 1"/> + <xsl:with-param name="mark" select="$mark_used_by_typeid "/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:attribute name="draw:modifiers"> + <xsl:value-of select="translate(concat(@adj ,',' ,$remained_adj), ',' ,' ' )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:if test="contains($typeid_adj,',')"> + <xsl:attribute name="draw:modifiers"> + <xsl:value-of select="translate($typeid_adj ,',' ,' ')"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="not(contains($typeid_adj,','))"> + <xsl:attribute name="draw:modifiers"> + <xsl:value-of select="$typeid_adj"/> + </xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@type"> + <xsl:apply-templates select="v:textpath" mode="output"> + <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/> + </xsl:apply-templates> + <xsl:apply-templates select="key('shapetype',@type)" mode="output"> + <xsl:with-param name="instance" select="."/> + </xsl:apply-templates> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:choose> + <xsl:when test="$wordshapename='shape' and v:textbox and $element-name='draw:frame' "> + <xsl:element name="draw:text-box"> + <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/> + </xsl:element> + </xsl:when> + <!--It is a case statement for all shapes,so we add v:roundrect here.--> + <xsl:when test="$wordshapename='roundrect' and v:textbox and $element-name='draw:frame' "> + <xsl:element name="draw:text-box"> + <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/> + </xsl:element> + </xsl:when> + <xsl:when test="v:textbox"> + <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:template> + <xsl:template match="w:docOleData" mode="init"> + <xsl:apply-templates select="w:binData[@w:name='oledata.mso']" mode="oledata.mso"/> + </xsl:template> + <xsl:template match="w:binData" mode="oledata.mso"> + <xsl:variable name="tmp" select="ole:insertByName('oledata.mso', translate(text(),'  ','' ) )"/> + </xsl:template> + <xsl:template match="o:OLEObject " mode="output"> + <!-- depends on i43230,we can uncomment this code or find another way after i43230 got fixed --> + <draw:object-ole> + <xsl:element name="office:binary-data"> + <xsl:value-of select="translate(ole:getByName(@ObjectID),' ','')"/> + </xsl:element> + </draw:object-ole> + </xsl:template> + <xsl:template name="get-vml-value"> + <xsl:param name="node1" select="''"/> + <xsl:param name="property-name"/> + <xsl:variable name="pn" select="concat(';',$property-name, ':')"/> + <xsl:choose> + <xsl:when test="string-length(@*[name() = $property-name]) > 0"> + <xsl:value-of select="@*[name() = $property-name]"/> + </xsl:when> + <xsl:when test="string-length(@style) > 0 and contains(concat(';',translate(@style,' ','')),$pn)"> + <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/> + </xsl:when> + <xsl:when test="$node1 and string-length($node1/@*[name() = $property-name]) > 0"> + <xsl:value-of select="$node1/@*[name() = $property-name]"/> + </xsl:when> + <xsl:when test="$node1 and string-length($node1/@style) > 0 and contains(concat(';',translate($node1/@style,' ','')),$pn)"> + <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="v:textpath" mode="text-p"> + <xsl:param name="type-textpath" select="''"/> + <xsl:variable name="the-string"> + <xsl:call-template name="get-vml-value"> + <xsl:with-param name="node1" select="$type-textpath"/> + <xsl:with-param name="property-name" select="'string'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="style-name"> + <xsl:value-of select="'textpath'"/> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/> + </xsl:variable> + <text:p text:style-name="{$style-name}"> + <xsl:value-of select="$the-string"/> + </text:p> + </xsl:template> + <xsl:template match="v:textpath" mode="style"> + <xsl:if test="contains(@style,'font-family:')"> + <xsl:variable name="style-name"> + <xsl:value-of select="'textpath'"/> + <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/> + </xsl:variable> + <xsl:variable name="font-family"> + <!-- we need remove the additional " from font-family --> + <xsl:value-of select="translate(substring-before(substring-after(@style,'font-family:'),';'), '"' ,'')"/> + </xsl:variable> + <xsl:variable name="font-size"> + <xsl:choose> + <xsl:when test="contains(@style,'font-size:')"> + <xsl:value-of select="substring-before(substring-after(@style,'font-size:'),';')"/> + </xsl:when> + <xsl:otherwise>36pt</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <style:style style:name="{$style-name}" style:family="paragraph"> + <style:paragraph-properties text:enable-numbering="false" style:writing-mode="lr-tb"/> + <style:text-properties fo:font-family="{$font-family}" fo:font-size="{$font-size}" style:font-family-generic="roman" style:text-scale="80%"/> + </style:style> + </xsl:if> + </xsl:template> + <xsl:template match="v:textpath" mode="output"> + <xsl:param name="type-textpath" select="''"/> + <xsl:variable name="on"> + <xsl:call-template name="get-vml-value"> + <xsl:with-param name="node1" select="$type-textpath"/> + <xsl:with-param name="property-name" select="'on'"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="starts-with($on,'t')"> + <xsl:attribute name="draw:text-path">true</xsl:attribute> + </xsl:if> + <xsl:variable name="fitshape"> + <xsl:call-template name="get-vml-value"> + <xsl:with-param name="node1" select="$type-textpath"/> + <xsl:with-param name="property-name" select="'fitshape'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="fitpath"> + <xsl:call-template name="get-vml-value"> + <xsl:with-param name="node1" select="$type-textpath"/> + <xsl:with-param name="property-name" select="'fitpath'"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="draw:type">fontwork-plain-text</xsl:attribute> + <xsl:attribute name="draw:text-path-mode"> + <xsl:choose> + <xsl:when test="starts-with($fitpath,'t') ">path</xsl:when> + <xsl:when test="starts-with($fitshape,'t') ">shape</xsl:when> + <xsl:otherwise>normal</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="draw:text-path-scale">path</xsl:attribute> + <!-- xsl:attribute name="draw:text-path-same-letter-heights">false</xsl:attribute --> + <!-- xsl:attribute name="draw:text-path-scale-x">false</xsl:attribute --> + </xsl:template> + <xsl:template match="v:shapetype" mode="output"> + <xsl:param name="instance" select="''"/> + <!--#Dummy after version 1.63 The following test is for the adj attribute of the file. It is Dummy now. + <xsl:if test="not($instance/@adj)"> + <xsl:if test="contains(@adj,',')">--> + <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient. + -####Note that comma can't be recognized by OOo's modifiers + <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/> + <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/> + <xsl:variable name="adjuststr"> + <xsl:if test="$adjust-x and $adjust-y"> + < -####Note that comma can't be recognized by OOo's modifiers.-> + <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/> + </xsl:if> + </xsl:variable>--> + <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers"> + <xsl:value-of select="translate(@adj, ',' , ' ' )"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@adj and not(contains(@adj,','))">--> + <!--####Note that comma can't be recognized by OOo's modifiers.--> + <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers"> + <xsl:value-of select="@adj"/> + </xsl:attribute> + </xsl:if> + </xsl:if>--> + <xsl:variable name="viewbox"> + <xsl:value-of select="'0 0'"/> + <xsl:value-of select="' '"/> + <xsl:if test="string-length(@coordsize) = 0"> + <xsl:value-of select="'1000 1000'"/> + </xsl:if> + <xsl:if test="not(string-length(@coordsize) = 0)"> + <xsl:value-of select="translate(@coordsize,',',' ')"/> + </xsl:if> + </xsl:variable> + <xsl:attribute name="svg:viewBox"> + <xsl:value-of select="$viewbox"/> + </xsl:attribute> + <xsl:attribute name="draw:text-areas"> + <xsl:value-of select="$viewbox"/> + </xsl:attribute> + <!-- This path need be output is instance does not have a path--> + <xsl:if test="not($instance/@path) and string-length(@path) >0"> + <xsl:attribute name="draw:enhanced-path"> + <!--<xsl:call-template name="vmlpath2svgpath">rrrrrrevised--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="@path"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates select="v:formulas | v:handles" mode="output"/> + </xsl:template> + <xsl:template match="v:formulas" mode="output"> + <xsl:apply-templates select="v:f" mode="output"/> + </xsl:template> + <xsl:template match="v:f" mode="output"> + <xsl:element name="draw:equation"> + <xsl:attribute name="draw:formula"> + <xsl:call-template name="v-formula2o-formula"> + <xsl:with-param name="v-formula" select="@eqn"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="draw:name"> + <xsl:value-of select="'f'"/> + <xsl:variable name="the-number"> + <xsl:number format="1" level="single"/> + </xsl:variable> + <xsl:value-of select="$the-number - 1"/> + </xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="v-formula2o-formula"> + <xsl:param name="v-formula"/> + <xsl:variable name="command" select="substring-before(normalize-space($v-formula), ' ')"/> + <xsl:variable name="tmp" select="normalize-space(substring-after($v-formula, $command ))"/> + <xsl:variable name="step1"> + <xsl:choose> + <xsl:when test="$command ='val'"> + <xsl:value-of select="$tmp"/> + </xsl:when> + <!-- (sum a b c) = (a + b - c)--> + <xsl:when test="$command = 'sum' "> + <xsl:call-template name="replace-space"> + <xsl:with-param name="value" select="$tmp"/> + <xsl:with-param name="replace1" select="'+'"/> + <xsl:with-param name="replace2" select="'-'"/> + </xsl:call-template> + </xsl:when> + <!-- (prod a b c) = (a * b / c)--> + <xsl:when test="$command = 'prod'"> + <xsl:call-template name="replace-space"> + <xsl:with-param name="value" select="$tmp"/> + <xsl:with-param name="replace1" select="'*'"/> + <xsl:with-param name="replace2" select="'/'"/> + </xsl:call-template> + </xsl:when> + <!-- (mid a b) = ((a + b) / 2)--> + <xsl:when test="$command = 'mid'"> + <xsl:value-of select="concat('(' , translate($tmp,' ', '+') , ') / 2' )"/> + </xsl:when> + <!-- (if a b c) = (a>0? b : c) Conditional testing. --> + <xsl:when test="$command = 'if' "> + <xsl:value-of select="concat('if(' , translate($tmp,' ', ',') , ')' )"/> + </xsl:when> + <!-- (min a b) = (min (a , b) )--> + <!-- (max a b) = (max (a , b) )--> + <xsl:when test="$command = 'min' or $command = 'max'"> + <xsl:value-of select="concat($command, '(' , translate($tmp,' ', ',') , ')' )"/> + </xsl:when> + <xsl:when test="$command = 'abs' or $command = 'sqrt'"> + <xsl:value-of select="concat($command, '(' , $tmp , ')' )"/> + </xsl:when> + <!-- sin(a,b) = a*sin(b) --> + <xsl:when test="$command = 'sin' or $command = 'cos' or $command = 'tan' "> + <!-- atan is not this kind 2 $command = 'atan2' "--> + <xsl:variable name="value1" select="substring-before($tmp,' ')"/> + <xsl:variable name="value2" select="substring-after($tmp,' ')"/> + <xsl:value-of select="concat( $value1 , ' * ' , $command, '(' , $value2 , ')' )"/> + </xsl:when> + <!-- --> + <xsl:when test="$command = 'atan2' "> + <xsl:variable name="value1" select="substring-before($tmp,' ')"/> + <xsl:variable name="value2" select="substring-after($tmp,' ')"/> + <xsl:value-of select="concat( $command , '( ' , $value2, ',' , $value1 , ')' )"/> + </xsl:when> + <!-- --> + <!--><xsl:when test="$command = 'atan2' "> + <xsl:variable name="value1" select="substring-before($tmp,' ')"/> + <xsl:variable name="value2" select="substring-after($tmp,' ')"/> + <xsl:value-of select="concat( 'atan' , '( ' , $value2, '/' , $value1 , ')' )"/> + </xsl:when><- --> + <!-- ellipse and sumangle are always used by arc command like this + eqn="ellipse @24 @4 height" ; and eqn="sumangle @2 360 0" + mod is always used too.--> + <!--mod =sqrt( v*v + P1×P1 + P2×P2). ( 3 parameters )--> + <xsl:when test="$command='mod' "> + <xsl:variable name="value1" select="substring-before($tmp,' ')"/> + <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/> + <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/> + <xsl:value-of select="concat( 'sqrt( ' , $value3, ' * ',$value3, ' + ' ,$value2, ' * ' ,$value2, ' + ' ,$value1, ' * ', $value1, ' )' )"/> + </xsl:when> + <!--ellipse= P2* sqrt(1 - v*v /P1*P1) ( 3 parameters )--> + <xsl:when test="$command='ellipse' "> + <xsl:variable name="value1" select="substring-before($tmp,' ')"/> + <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/> + <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/> + <xsl:value-of select="concat( $value3 , ' * sqrt( ' , $value2 , ' * ' , $value2, ' - ',$value1 , ' * ', $value1, ' )' ,'/',$value2 )"/> + </xsl:when> + <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )--> + <!--<xsl:when test="$command='sumangle' "> + <xsl:variable name="value1" select="substring-before($tmp,' ')"/> + <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/> + <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/> + <xsl:value-of select="concat( $value1 , '+' , $value2 , ' * ' , '65535',' + ', $value2,' - ' ,$value3 , ' * ', '65535', ' - ', $value3)"/> + </xsl:when>--> + <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )--> + <xsl:when test="$command='sumangle' "> + <xsl:variable name="value1" select="substring-before($tmp,' ')"/> + <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/> + <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/> + <xsl:value-of select="concat( $value1 , '+' , $value2 , '*pi/180',' - ' ,$value3 , '*pi/180' )"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>Find an unsupported formula:<xsl:value-of select="$v-formula"/> + </xsl:message> + <!--<xsl:value-of select="'0'"/><-for release use--> + <xsl:value-of select="concat('not found this:', $v-formula)"/> + <!--for Debug use--> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="step2"> + <xsl:value-of select="translate($step1,'#','$')"/> + </xsl:variable> + <xsl:call-template name="replace-at"> + <xsl:with-param name="value" select="$step2"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="replace-space"> + <xsl:param name="value"/> + <xsl:param name="replace1"/> + <xsl:param name="replace2"/> + <xsl:value-of select=" concat( substring-before($value,' ') , $replace1, translate(substring-after($value,' '), ' ', $replace2 ) ) "/> + </xsl:template> + <xsl:template name="replace-at"> + <xsl:param name="value"/> + <xsl:param name="position" select="1"/> + <xsl:choose> + <xsl:when test="string-length($value) < $position"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:when test="substring($value,$position,1) = '@'"> + <xsl:call-template name="replace-at"> + <xsl:with-param name="value" select="concat(substring($value,1,$position -1) , '?f' , substring($value,$position+1)) "/> + <xsl:with-param name="position" select="$position + 2"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="replace-at"> + <xsl:with-param name="value" select="$value"/> + <xsl:with-param name="position" select="$position + 1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:if test=" substring($value,$position,1) = '@'"> + </xsl:if> + </xsl:template> + <xsl:template match="v:handles" mode="output"> + <xsl:apply-templates select="v:h" mode="output"/> + </xsl:template> + <xsl:template match="v:h" mode="output"> + <xsl:element name="draw:handle"> + <xsl:if test="@position"> + <xsl:attribute name="draw:handle-position"> + <xsl:value-of select="translate(@position,'#,' , '$ ')"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@switch"> + <xsl:attribute name="draw:handle-switched"> + <xsl:value-of select="@switch"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@xrange"> + <xsl:attribute name="draw:handle-range-x-maximum"> + <xsl:value-of select="substring-after(@xrange,',')"/> + </xsl:attribute> + <xsl:attribute name="draw:handle-range-x-minimum"> + <xsl:value-of select="substring-before(@xrange,',')"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@yrange"> + <xsl:attribute name="draw:handle-range-y-maximum"> + <xsl:value-of select="substring-after(@yrange,',')"/> + </xsl:attribute> + <xsl:attribute name="draw:handle-range-y-minimum"> + <xsl:value-of select="substring-before(@yrange,',')"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <!--this template map word's points to svg:viewbox's point they are quite different because word's use pt but svg's use 0.001cm as a unit--> + <xsl:template name="wordpoints2oopoints"> + <xsl:param name="input_points"/> + <xsl:param name="input_x"/> + <xsl:param name="input_y"/> + <xsl:param name="input_width"/> + <xsl:param name="input_height"/> + <xsl:param name="input_boxwidth"/> + <xsl:param name="input_boxheight"/> + <xsl:variable name="ptx" select="substring-before($input_points,',')"/> + <xsl:variable name="tempstr" select="substring-after($input_points,',')"/> + <xsl:variable name="pty" select="substring-before($tempstr,',')"/> + <xsl:variable name="nextinput" select="substring-after ($tempstr,',')"/> + <xsl:if test="$ptx and $pty"> + <xsl:variable name="val_ptx"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$ptx"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="val_pty"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$pty"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round( $input_boxwidth - ( $val_ptx - $input_x ) * 1000 )"/> + <xsl:value-of select="','"/> + <xsl:value-of select="round( ( $val_pty - $input_y ) * 1000 )"/> + </xsl:if> + <xsl:if test="contains($nextinput,',')"> + <xsl:value-of select="' '"/> + <!--Leave a blank first as mark of points group--> + <xsl:call-template name="wordpoints2oopoints"> + <xsl:with-param name="input_points" select="$nextinput"/> + <xsl:with-param name="input_x" select="$input_x"/> + <xsl:with-param name="input_y" select="$input_y"/> + <xsl:with-param name="input_width" select="$input_width"/> + <xsl:with-param name="input_height" select="$input_height"/> + <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/> + <xsl:with-param name="input_boxheight" select="$input_boxheight"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!--template MapConstColor:input is a color in form of const e.g 'red' or number e.g '#ff0010' output is a number color--> + <xsl:template name="MapConstColor"> + <xsl:param name="color"/> + <xsl:choose> + <xsl:when test="$color='black'">#000000</xsl:when> + <xsl:when test="$color='olive'">#808000</xsl:when> + <xsl:when test="$color='red'">#ff0000</xsl:when> + <xsl:when test="$color='teal'">#008080</xsl:when> + <xsl:when test="$color='green'">#00ff00</xsl:when> + <xsl:when test="$color='gray'">#808080</xsl:when> + <xsl:when test="$color='blue'">#0000ff</xsl:when> + <xsl:when test="$color='navy'">#000080</xsl:when> + <xsl:when test="$color='white'">#ffffff</xsl:when> + <xsl:when test="$color='lime'">#00ff00</xsl:when> + <xsl:when test="$color='yellow'">#ffff00</xsl:when> + <xsl:when test="$color='fuchsia'">#ff00ff</xsl:when> + <xsl:when test="$color='purple'">#800080</xsl:when> + <xsl:when test="$color='aqua'">#00ffff</xsl:when> + <xsl:when test="$color='maroon'">#800000</xsl:when> + <xsl:when test="$color='silver'">#c0c0c0</xsl:when> + <xsl:when test="$color='window'">#ffffff</xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="string-length($color) =7"> + <xsl:value-of select="$color"/> + </xsl:when> + <xsl:when test="string-length($color) =4"> + <!--short form representation of color--> + <xsl:variable name="valr"> + <xsl:value-of select="concat(substring($color,2,1),substring($color,2,1))"/> + <!--<xsl:call-template name="shortcolorconv"><xsl:with-param name="value" select="substring($color,2,1)"/></xsl:call-template>--> + </xsl:variable> + <xsl:variable name="valg" select="concat(substring($color,3,1),substring($color,3,1))"/> + <xsl:variable name="valb" select="concat(substring($color,4,1),substring($color,4,1))"/> + <xsl:value-of select="concat('#',$valr,$valg,$valb)"/> + </xsl:when> + <xsl:otherwise>#000000</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="shortcolorconv"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="$value='1'">11</xsl:when> + <xsl:when test="$value='2'">22</xsl:when> + <xsl:when test="$value='3'">33</xsl:when> + <xsl:when test="$value='4'">44</xsl:when> + <xsl:when test="$value='5'">55</xsl:when> + <xsl:when test="$value='6'">66</xsl:when> + <xsl:when test="$value='7'">77</xsl:when> + <xsl:when test="$value='8'">88</xsl:when> + <xsl:when test="$value='9'">99</xsl:when> + <xsl:when test="$value='a'">aa</xsl:when> + <xsl:when test="$value='b'">bb</xsl:when> + <xsl:when test="$value='c'">cc</xsl:when> + <xsl:when test="$value='d'">dd</xsl:when> + <xsl:when test="$value='e'">ee</xsl:when> + <xsl:when test="$value='f'">ff</xsl:when> + <!--I just guess it, maybe it is not right--> + </xsl:choose> + </xsl:template> + <xsl:template name="MapArrowStyle"> + <!--What is a block?normal arrow?--> + <xsl:param name="arrow-name"/> + <xsl:choose> + <xsl:when test="$arrow-name = 'Block' ">Arrow</xsl:when> + <xsl:when test="$arrow-name = 'Diamond' ">Square</xsl:when> + <xsl:when test="$arrow-name = 'Open' ">Line Arrow</xsl:when> + <xsl:when test="$arrow-name = 'Oval' ">Circle</xsl:when> + <xsl:when test="$arrow-name = 'Diamond' ">Square 45</xsl:when> + <xsl:when test="$arrow-name = 'Classic' ">Arrow concave</xsl:when> + <xsl:otherwise>Arrow</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="Add-with-Measure"> + <xsl:param name="value1"/> + <xsl:param name="value2"/> + <xsl:variable name="Current-MeasureMark"> + <xsl:choose> + <xsl:when test="string-length(translate($value1 ,'-.0123456789 ','' )) > 0"> + <xsl:value-of select="translate($value1 ,'-.0123456789 ','' )"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate($value2 ,'-.0123456789 ','' )"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="number-value1"> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="$value1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="number-value2"> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="$value2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat( $number-value1 + $number-value2 , $Current-MeasureMark)"/> + </xsl:template> + <xsl:template name="convert-with-scale-and-measure"> + <xsl:param name="value"/> + <xsl:param name="group-value" select="0"/> + <xsl:param name="coord-value" select="0"/> + <xsl:param name="scale" select="1"/> + <xsl:param name="MeasureMark" select="''"/> + <xsl:param name="Target-Measure" select="''"/> + <xsl:variable name="Current-MeasureMark"> + <xsl:choose> + <xsl:when test="not (translate($value ,'-. 0123456789 ','' ) = '') "> + <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/> + </xsl:when> + <xsl:when test="string-length($MeasureMark) > 0"> + <xsl:value-of select="$MeasureMark"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="number-value"> + <xsl:call-template name="get-number"> + <xsl:with-param name="value" select="$value"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="value-string" select="( $number-value - $coord-value) div $scale + $group-value"/> + <xsl:choose> + <xsl:when test="$value-string = 0">0cm</xsl:when> + <xsl:when test="$Target-Measure = $Current-MeasureMark"> + <xsl:value-of select="concat($value-string , $Current-MeasureMark)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat($value-string , $Current-MeasureMark)"/> + </xsl:call-template> + <xsl:value-of select=" 'cm' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') = '' ">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="number(translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',''))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_field.xsl b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl new file mode 100644 index 000000000..590a97283 --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl @@ -0,0 +1,1581 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v"> + <!--Generally, The MS fields can be represented in two forms, simple field w:fldsimple or complicated field + w:fldChar, so when importing we have to take care of two possible forms of the same type field --> + <xsl:template match="w:instrText"> + <!-- ===this template is to process the w:fldChar fields ====== --> + <xsl:choose> + <xsl:when test="substring(normalize-space(.),1,7) = 'PAGEREF' "> + <xsl:variable name="bookmarkname"> + <xsl:value-of select="normalize-space(substring-before (substring-after( . , 'PAGEREF' ), '\*')) "/> + </xsl:variable> + <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}"> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:bookmark-ref> + </xsl:when> + <xsl:when test="substring( normalize-space(.),1,9) = 'HYPERLINK' "> + <xsl:variable name="hyper-str" select="normalize-space(.)"/> + <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '"')"/> + <xsl:variable name="hyper-bookmark"> + <xsl:if test="contains( $hyper-str, ' \l ')"> + <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '"'), '"') )"/> + </xsl:if> + </xsl:variable> + <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}"> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:a> + </xsl:when> + <xsl:when test="substring( normalize-space(.),1,3) = 'REF' "> + <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(text(), 'REF') , '\') )}"> + + </text:bookmark-ref> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' "> + <text:date> + <xsl:choose> + <xsl:when test="contains(text(), '\@')"> + <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </text:date> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,9) = 'PRINTDATE' "> + <text:print-date> + <xsl:choose> + <xsl:when test="contains(text(), '\@')"> + <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </text:print-date> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,10) = 'CREATEDATE' "> + <text:creation-date> + <xsl:choose> + <xsl:when test="contains(text(), '\@')"> + <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </text:creation-date> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,8) = 'SAVEDATE' "> + <text:modification-date> + <xsl:choose> + <xsl:when test="contains(text(), '\@')"> + <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </text:modification-date> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,4) = 'PAGE' "> + <text:page-number text:select-page="current"> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:page-number> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,8) = 'NUMPAGES' "> + <text:page-count> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:page-count> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,8) = 'NUMWORDS' "> + <text:word-count> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:word-count> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,8) = 'NUMCHARS' "> + <text:character-count> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:character-count> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,6) = 'REVNUM' "> + <text:editing-cycles> + <xsl:value-of select="w:r"/> + </text:editing-cycles> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' "> + <text:sequence> + <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute> + <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:sequence> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,3) = 'SEQ' "> + <text:sequence> + <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + <xsl:variable name="seq_text_name"> + <xsl:call-template name="get_seq_name"> + <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(text(), 'SEQ'))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name"/></xsl:attribute> + <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:sequence> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,6) = 'AUTHOR' "> + <text:initial-creator> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:initial-creator> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,5) = 'TITLE' "> + <text:title> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:title> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,7) = 'SUBJECT' "> + <text:subject> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:subject> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,8) = 'KEYWORDS' "> + <text:keywords> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:keywords> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,6) = 'FILLIN' "> + <text:text-input> + <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(text(), 'FILLIN'), '\*')"/></xsl:attribute> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:text-input> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,11) = 'DOCPROPERTY' "> + <xsl:variable name="instr_command"> + <xsl:value-of select="normalize-space (substring-after(text(), 'DOCPROPERTY' ))"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($instr_command, 'Author' ) "> + <text:user-field-get text:name="Author"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Bytes' ) "> + <text:user-field-get text:name="Bytes"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) "> + <text:user-field-get text:name="CharactersWithSpaces"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Category' ) "> + <text:user-field-get text:name="Category"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Characters' ) "> + <text:user-field-get text:name="Characters"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Comments' ) "> + <text:user-field-get text:name="Comments"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Company' ) "> + <text:user-field-get text:name="Company"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'CreateTime' ) "> + <text:user-field-get text:name="CreateTime"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'HyperlinkBase' ) "> + <text:user-field-get text:name="HyperlinkBase"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Keywords' ) "> + <text:user-field-get text:name="Keywords"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'LastPrinted' ) "> + <text:user-field-get text:name="LastPrinted"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'LastSavedBy' ) "> + <text:user-field-get text:name="LastSavedBy"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'LastSavedTime' ) "> + <text:user-field-get text:name="LastSavedTime"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Lines' ) "> + <text:user-field-get text:name="Lines"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Manager' ) "> + <text:user-field-get text:name="Manager"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'NameofApplication' ) "> + <text:user-field-get text:name="NameofApplication"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'ODMADocId' ) "> + <text:user-field-get text:name="ODMADocId"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Pages' ) "> + <text:user-field-get text:name="Pages"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Paragraphs' ) "> + <text:user-field-get text:name="Paragraphs"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'RevisionNumber' ) "> + <text:user-field-get text:name="RevisionNumber"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Security' ) "> + <text:user-field-get text:name="Security"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Subject' ) "> + <text:user-field-get text:name="Subject"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Template' ) "> + <text:user-field-get text:name="Template"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Title' ) "> + <text:user-field-get text:name="Title"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'TotalEditingTime' ) "> + <text:user-field-get text:name="TotalEditingTime"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Words' ) "> + <text:user-field-get text:name="Words"> + </text:user-field-get> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,10) = 'MERGEFIELD' "> + <text:database-display text:database-name="" text:table-name="" text:table-type="table"> + <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:database-display> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,8) = 'MERGEREC' "> + <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0"> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </text:database-row-number> + </xsl:when> + <xsl:when test="substring(normalize-space(.),1,4) = 'NEXT' "> + <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition=""> + </text:database-next> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="w:fldChar"> + <!-- for complicated field w:fldChar, we only process the w:instrText, please see the template processing w:instrText --> + </xsl:template> + <xsl:template name="get-fldchar-content"> + <!-- this template is to get the content of fldchar in-between w:instrText and w:fldChar/@w:fldCharType ='end' --> + <xsl:param name="next_node"/> + <xsl:param name="sibling_number"/> + <xsl:if test="not ($next_node/w:fldChar/@w:fldCharType ='end' ) and $next_node "> + <xsl:if test="$next_node/w:br"> + <xsl:text>
</xsl:text> + </xsl:if> + <xsl:value-of select="$next_node//w:t"/> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[$sibling_number + 1]"/> + <xsl:with-param name="sibling_number" select="$sibling_number + 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- ====== this template is to process the w:fldsimple fields ======= --> + <xsl:template match="w:fldSimple"> + <xsl:choose> + <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'PAGEREF' "> + <xsl:variable name="bookmarkname"> + <xsl:value-of select="normalize-space(substring-before (substring-after( @w:instr , 'PAGEREF' ), '\*')) "/> + </xsl:variable> + <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}"> + <xsl:value-of select=" .//w:t"/> + </text:bookmark-ref> + </xsl:when> + <xsl:when test="substring( normalize-space(@w:instr),1,9) = 'HYPERLINK' "> + <xsl:variable name="hyper-str" select="normalize-space(@w:instr)"/> + <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '"')"/> + <xsl:variable name="hyper-bookmark"> + <xsl:if test="contains( $hyper-str, ' \l ')"> + <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '"'), '"') )"/> + </xsl:if> + </xsl:variable> + <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}"> + <xsl:value-of select=" .//w:t"/> + </text:a> + </xsl:when> + <xsl:when test="substring( normalize-space(@w:instr),1,3) = 'REF' "> + <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(@w:instr, 'REF') , '\') )}"> + + </text:bookmark-ref> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' "> + <text:date> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + <xsl:value-of select=".//w:t"/> + </text:date> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' "> + <text:print-date> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + <xsl:value-of select=".//w:t"/> + </text:print-date> + </xsl:when> + <xsl:when test=" substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' "> + <text:creation-date> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + <xsl:value-of select=".//w:t"/> + </text:creation-date> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' "> + <text:modification-date> + <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> + <xsl:value-of select=".//w:t"/> + </text:modification-date> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'PAGE' "> + <text:page-number text:select-page="current"> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:page-number> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMPAGES' "> + <text:page-count> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:page-count> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMWORDS' "> + <text:word-count> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:word-count> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMCHARS' "> + <text:character-count> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:character-count> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'REVNUM' "> + <text:editing-cycles> + <xsl:value-of select="w:r"/> + </text:editing-cycles> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'AUTONUM' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMLGL' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMOUT' "> + <text:sequence> + <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute> + <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:sequence> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,3) = 'SEQ' "> + <text:sequence> + <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + <xsl:variable name="seq_text_name"> + <xsl:call-template name="get_seq_name"> + <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(@w:instr, 'SEQ'))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name "/></xsl:attribute> + <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute> + <xsl:variable name="num-format"> + <xsl:call-template name="get_field_num_format"> + <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> + </text:sequence> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'AUTHOR' "> + <text:initial-creator> + <xsl:value-of select=" .//w:t"/> + </text:initial-creator> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,5) = 'TITLE' "> + <text:title> + <xsl:value-of select=" .//w:t"/> + </text:title> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'SUBJECT' "> + <text:subject> + <xsl:value-of select=" .//w:t"/> + </text:subject> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'KEYWORDS' "> + <text:keywords> + <xsl:value-of select=" .//w:t"/> + </text:keywords> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'FILLIN' "> + <text:text-input> + <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(@w:instr, '"'), '"')"/></xsl:attribute> + <xsl:value-of select=" .//w:t"/> + </text:text-input> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' "> + <xsl:variable name="instr_command"> + <xsl:value-of select="normalize-space (substring-after(@w:instr, 'DOCPROPERTY' ))"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($instr_command, 'Author' ) "> + <text:user-field-get text:name="Author"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Bytes' ) "> + <text:user-field-get text:name="Bytes"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Category' ) "> + <text:user-field-get text:name="Category"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) "> + <text:user-field-get text:name="CharactersWithSpaces"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Characters' ) "> + <text:user-field-get text:name="Characters"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Comments' ) "> + <text:user-field-get text:name="Comments"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Company' ) "> + <text:user-field-get text:name="Company"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'CreateTime' ) "> + <text:user-field-get text:name="CreateTime"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'HyperlinkBase' ) "> + <text:user-field-get text:name="HyperlinkBase"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Keywords' ) "> + <text:user-field-get text:name="Keywords"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'LastPrinted' ) "> + <text:user-field-get text:name="LastPrinted"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'LastSavedBy' ) "> + <text:user-field-get text:name="LastSavedBy"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'LastSavedTime' ) "> + <text:user-field-get text:name="LastSavedTime"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Lines' ) "> + <text:user-field-get text:name="Lines"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Manager' ) "> + <text:user-field-get text:name="Manager"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'NameofApplication' ) "> + <text:user-field-get text:name="NameofApplication"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'ODMADocId' ) "> + <text:user-field-get text:name="ODMADocId"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Pages' ) "> + <text:user-field-get text:name="Pages"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Paragraphs' ) "> + <text:user-field-get text:name="Paragraphs"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'RevisionNumber' ) "> + <text:user-field-get text:name="RevisionNumber"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Security' ) "> + <text:user-field-get text:name="Security"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Subject' ) "> + <text:user-field-get text:name="Subject"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Template' ) "> + <text:user-field-get text:name="Template"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Title' ) "> + <text:user-field-get text:name="Title"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'TotalEditingTime' ) "> + <text:user-field-get text:name="TotalEditingTime"> + </text:user-field-get> + </xsl:when> + <xsl:when test="contains($instr_command, 'Words' ) "> + <text:user-field-get text:name="Words"> + </text:user-field-get> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,10) = 'MERGEFIELD' "> + <text:database-display text:database-name="" text:table-name="" text:table-type="table"> + <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute> + <xsl:value-of select=" .//w:t"/> + </text:database-display> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'MERGEREC' "> + <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0"> + <xsl:value-of select=" .//w:t"/> + </text:database-row-number> + </xsl:when> + <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'NEXT' "> + <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition=""> + <xsl:value-of select=" .//w:t"/> + </text:database-next> + </xsl:when> + <xsl:otherwise> + <!-- for MS simple fields that can not map to OOo writer fields, we just import the content of these fields --> + <xsl:value-of select="w:r"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get_seq_name"> + <!-- this template is to get the identifier from the input MS seq string --> + <xsl:param name="input_seq_string"/> + <xsl:choose> + <xsl:when test="contains( $input_seq_string, ' ' )"> + <xsl:value-of select="substring-before($input_seq_string, ' ' )"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$input_seq_string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="default_sequence_declaration"> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="Table"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="Text"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"> + </text:sequence-decl> + <text:sequence-decl text:display-outline-level="0" text:name="AutoNr"> + </text:sequence-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="sequence_declare"> + <text:sequence-decl text:display-outline-level="0"> + <xsl:variable name="seq_variable_name"> + <xsl:choose> + <xsl:when test=" name() = 'w:instrText' "> + <xsl:if test="substring(normalize-space(text()),1,3) = 'SEQ' "> + <xsl:call-template name="get_seq_name"> + <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(text(), 'SEQ' ))"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:when test=" name() = 'w:fldSimple' "> + <xsl:if test="substring(normalize-space(@w:instr),1,3) = 'SEQ' "> + <xsl:call-template name="get_seq_name"> + <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(@w:instr, 'SEQ' ))"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="text:name"><xsl:value-of select="$seq_variable_name"/></xsl:attribute> + </text:sequence-decl> + </xsl:template> + <!-- ===== the following templates are to generate the user fields declarations for MS word DocProperty field importing == --> + <xsl:template name="user_fields_declare_docproperty"> + <xsl:variable name="document-field-root" select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,11) = 'DOCPROPERTY' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ] "/> + <xsl:variable name="field_Author_nodeset" select="$document-field-root[contains(text(), 'Author')] | $document-field-root[contains(@w:instr, 'Author')]"/> + <xsl:variable name="field_Bytes_nodeset" select="$document-field-root[contains(text(), 'Bytes')] | $document-field-root[contains(@w:instr, 'Bytes')]"/> + <xsl:variable name="field_Category_nodeset" select="$document-field-root[contains(text(), 'Category')] | $document-field-root[contains(@w:instr, 'Category')]"/> + <xsl:variable name="field_Characters_nodeset" select="$document-field-root[contains(text(), 'Characters')] | $document-field-root[contains(@w:instr, 'Characters')]"/> + <xsl:variable name="field_CharactersWithSpaces_nodeset" select="$document-field-root[contains(text(), 'CharactersWithSpaces')] | $document-field-root[contains(@w:instr, 'CharactersWithSpaces')]"/> + <xsl:variable name="field_Comments_nodeset" select="$document-field-root[contains(text(), 'Comments')] | $document-field-root[contains(@w:instr, 'Comments')]"/> + <xsl:variable name="field_Company_nodeset" select="$document-field-root[contains(text(), 'Company')] | $document-field-root[contains(@w:instr, 'Company')]"/> + <xsl:variable name="field_CreateTime_nodeset" select="$document-field-root[contains(text(), 'CreateTime')] | $document-field-root[contains(@w:instr, 'CreateTime')]"/> + <xsl:variable name="field_HyperlinkBase_nodeset" select="$document-field-root[contains(text(), 'HyperlinkBase')] | $document-field-root[contains(@w:instr, 'HyperlinkBase')]"/> + <xsl:variable name="field_Keywords_nodeset" select="$document-field-root[contains(text(), 'Keywords')] | $document-field-root[contains(@w:instr, 'Keywords')]"/> + <xsl:variable name="field_LastPrinted_nodeset" select="$document-field-root[contains(text(), 'LastPrinted')] | $document-field-root[contains(@w:instr, 'LastPrinted')]"/> + <xsl:variable name="field_LastSavedBy_nodeset" select="$document-field-root[contains(text(), 'LastSavedBy')] | $document-field-root[contains(@w:instr, 'LastSavedBy')]"/> + <xsl:variable name="field_LastSavedTime_nodeset" select="$document-field-root[contains(text(), 'LastSavedTime')] | $document-field-root[contains(@w:instr, 'LastSavedTime')]"/> + <xsl:variable name="field_Lines_nodeset" select="$document-field-root[contains(text(), 'Lines')] | $document-field-root[contains(@w:instr, 'Lines')]"/> + <xsl:variable name="field_Manager_nodeset" select="$document-field-root[contains(text(), 'Manager')] | $document-field-root[contains(@w:instr, 'Manager')]"/> + <xsl:variable name="field_NameofApplication_nodeset" select="$document-field-root[contains(text(), 'NameofApplication')] | $document-field-root[contains(@w:instr, 'NameofApplication')]"/> + <xsl:variable name="field_ODMADocId_nodeset" select="$document-field-root[contains(text(), 'ODMADocId')] | $document-field-root[contains(@w:instr, 'ODMADocId')]"/> + <xsl:variable name="field_Pages_nodeset" select="$document-field-root[contains(text(), 'Pages')] | $document-field-root[contains(@w:instr, 'Pages')]"/> + <xsl:variable name="field_Paragraphs_nodeset" select="$document-field-root[contains(text(), 'Paragraphs')] | $document-field-root[contains(@w:instr, 'Paragraphs')]"/> + <xsl:variable name="field_RevisionNumber_nodeset" select="$document-field-root[contains(text(), 'RevisionNumber')] | $document-field-root[contains(@w:instr, 'RevisionNumber')]"/> + <xsl:variable name="field_Security_nodeset" select="$document-field-root[contains(text(), 'Security')] | $document-field-root[contains(@w:instr, 'Security')]"/> + <xsl:variable name="field_Subject_nodeset" select="$document-field-root[contains(text(), 'Subject')] | $document-field-root[contains(@w:instr, 'Subject')]"/> + <xsl:variable name="field_Template_nodeset" select="$document-field-root[contains(text(), 'Template')] | $document-field-root[contains(@w:instr, 'Template')]"/> + <xsl:variable name="field_Title_nodeset" select="$document-field-root[contains(text(), 'Title')] | $document-field-root[contains(@w:instr, 'Title')]"/> + <xsl:variable name="field_TotalEditingTime_nodeset" select="$document-field-root[contains(text(), 'TotalEditingTime')] | $document-field-root[contains(@w:instr, 'TotalEditingTime')]"/> + <xsl:variable name="field_Words_nodeset" select="$document-field-root[contains(text(), 'Words')] | $document-field-root[contains(@w:instr, 'Words')]"/> + <xsl:apply-templates select="$field_Author_nodeset[1]" mode="user_field_Author_declare"/> + <xsl:apply-templates select="$field_Bytes_nodeset[1]" mode="user_field_Bytes_declare"/> + <xsl:apply-templates select="$field_Category_nodeset[1]" mode="user_field_Category_declare"/> + <xsl:apply-templates select="$field_Characters_nodeset[1]" mode="user_field_Characters_declare"/> + <xsl:apply-templates select="$field_CharactersWithSpaces_nodeset[1]" mode="user_field_CharactersWithSpaces_declare"/> + <xsl:apply-templates select="$field_Comments_nodeset[1]" mode="user_field_Comments_declare"/> + <xsl:apply-templates select="$field_Company_nodeset[1]" mode="user_field_Company_declare"/> + <xsl:apply-templates select="$field_CreateTime_nodeset[1]" mode="user_field_CreateTime_declare"/> + <xsl:apply-templates select="$field_HyperlinkBase_nodeset[1]" mode="user_field_HyperlinkBase_declare"/> + <xsl:apply-templates select="$field_Keywords_nodeset[1]" mode="user_field_Keywords_declare"/> + <xsl:apply-templates select="$field_LastPrinted_nodeset[1]" mode="user_field_LastPrinted_declare"/> + <xsl:apply-templates select="$field_LastSavedBy_nodeset[1]" mode="user_field_LastSavedBy_declare"/> + <xsl:apply-templates select="$field_LastSavedTime_nodeset[1]" mode="user_field_LastSavedTime_declare"/> + <xsl:apply-templates select="$field_Lines_nodeset[1]" mode="user_field_Lines_declare"/> + <xsl:apply-templates select="$field_Manager_nodeset[1]" mode="user_field_Manager_declare"/> + <xsl:apply-templates select="$field_NameofApplication_nodeset[1]" mode="user_field_NameofApplication_declare"/> + <xsl:apply-templates select="$field_ODMADocId_nodeset[1]" mode="user_field_ODMADocId_declare"/> + <xsl:apply-templates select="$field_Pages_nodeset[1]" mode="user_field_Pages_declare"/> + <xsl:apply-templates select="$field_Paragraphs_nodeset[1]" mode="user_field_Paragraphs_declare"/> + <xsl:apply-templates select="$field_RevisionNumber_nodeset[1]" mode="user_field_RevisionNumber_declare"/> + <xsl:apply-templates select="$field_Security_nodeset[1]" mode="user_field_Security_declare"/> + <xsl:apply-templates select="$field_Subject_nodeset[1]" mode="user_field_Subject_declare"/> + <xsl:apply-templates select="$field_Template_nodeset[1]" mode="user_field_Template_declare"/> + <xsl:apply-templates select="$field_Title_nodeset[1]" mode="user_field_Title_declare"/> + <xsl:apply-templates select="$field_TotalEditingTime_nodeset[1]" mode="user_field_TotalEditingTime_declare"/> + <xsl:apply-templates select="$field_Words_nodeset[1]" mode="user_field_Words_declare"/> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Author_declare"> + <text:user-field-decl office:value-type="string" text:name="Author"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Bytes_declare"> + <text:user-field-decl office:value-type="string" text:name="Bytes"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Category_declare"> + <text:user-field-decl office:value-type="string" text:name="Category"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Characters_declare"> + <text:user-field-decl office:value-type="string" text:name="Characters"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CharactersWithSpaces_declare"> + <text:user-field-decl office:value-type="string" text:name="CharactersWithSpaces"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Comments_declare"> + <text:user-field-decl office:value-type="string" text:name="Comments"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Company_declare"> + <text:user-field-decl office:value-type="string" text:name="Company"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CreateTime_declare"> + <text:user-field-decl office:value-type="string" text:name="CreateTime"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_HyperlinkBase_declare"> + <text:user-field-decl office:value-type="string" text:name="HyperlinkBase"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Keywords_declare"> + <text:user-field-decl office:value-type="string" text:name="Keywords"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastPrinted_declare"> + <text:user-field-decl office:value-type="string" text:name="LastPrinted"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedBy_declare"> + <text:user-field-decl office:value-type="string" text:name="LastSavedBy"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedTime_declare"> + <text:user-field-decl office:value-type="string" text:name="LastSavedTime"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Lines_declare"> + <text:user-field-decl office:value-type="string" text:name="Lines"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Manager_declare"> + <text:user-field-decl office:value-type="string" text:name="Manager"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_NameofApplication_declare"> + <text:user-field-decl office:value-type="string" text:name="NameofApplication"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_ODMADocId_declare"> + <text:user-field-decl office:value-type="string" text:name="ODMADocId"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Pages_declare"> + <text:user-field-decl office:value-type="string" text:name="Pages"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Paragraphs_declare"> + <text:user-field-decl office:value-type="string" text:name="Paragraphs"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_RevisionNumber_declare"> + <text:user-field-decl office:value-type="string" text:name="RevisionNumber"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Security_declare"> + <text:user-field-decl office:value-type="string" text:name="Security"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Subject_declare"> + <text:user-field-decl office:value-type="string" text:name="Subject"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Template_declare"> + <text:user-field-decl office:value-type="string" text:name="Template"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Title_declare"> + <text:user-field-decl office:value-type="string" text:name="Title"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_TotalEditingTime_declare"> + <text:user-field-decl office:value-type="string" text:name="TotalEditingTime"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Words_declare"> + <text:user-field-decl office:value-type="string" text:name="Words"> + <xsl:variable name="field_content"> + <xsl:choose> + <xsl:when test="name() = 'w:instrText' "> + <xsl:call-template name="get-fldchar-content"> + <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> + <xsl:with-param name="sibling_number" select=" 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:value-of select=".//w:t"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> + </text:user-field-decl> + </xsl:template> + <!-- =========this following template to convert the ms number format to OOo writer format === --> + <xsl:template name="get_field_num_format"> + <xsl:param name="input_MS_num_format"/> + <xsl:choose> + <xsl:when test="contains($input_MS_num_format, 'Arabic' ) "> + <xsl:text>1</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'roman' ) "> + <xsl:text>i</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) "> + <xsl:text>I</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) "> + <xsl:text>a</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) "> + <xsl:text>A</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>1</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--xsl:template name="get_field_num_format"> + <xsl:param name="input_MS_num_format"/> + <xsl:choose> + <xsl:when test="contains($input_MS_num_format, 'Arabic' ) "> + <xsl:text>1</xsl:text> + </xsl:when> + <xsl:when test="contains ($input_MS_num_format, 'CircleNum' )"> + <xsl:text>①, ②, ③, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'roman' ) "> + <xsl:text>i</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) "> + <xsl:text>I</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'CHINESENUM3' )"> + <xsl:text>一, 二, 三, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'CHINESENUM2' )"> + <xsl:text>壹, 貳, 參, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'DBNUM3' ) "> + <xsl:text>壱, 弐, 参, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ZODIAC2' ) "> + <xsl:text>子, 丑, 寅, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ZODIAC1' ) "> + <xsl:text>甲, 乙, 丙, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'Iroha' ) "> + <xsl:text>イ, ロ, ハ, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) "> + <xsl:text>ア, イ, ウ, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) "> + <xsl:text>a</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) "> + <xsl:text>A</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'hebrew1' ) "> + <xsl:text>א, י, ק, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'hebrew2' ) "> + <xsl:text>א, ב, ג, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ArabicAlpha' ) "> + <xsl:text>أ, ب, ت, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'ThaiLetter' ) "> + <xsl:text>ก, ข, ฃ, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'Chosung' ) "> + <xsl:text>ㄱ, ㄴ, ㄷ, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'Ganada' ) "> + <xsl:text>가, 나, 다, ...</xsl:text> + </xsl:when> + <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) "> + <xsl:text>ア, イ, ウ, ...</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>1</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template --> + <!-- ========= the following code is to generate the date styles for date/time fields ============ --> + <!--the default date style content --> + <xsl:template name="default_date_style_content"> + <number:year number:style="long"> + </number:year> + <number:text>/</number:text> + <number:month> + </number:month> + <number:text>/</number:text> + <number:day> + </number:day> + <number:text> </number:text> + <number:hours> + </number:hours> + <number:text>:</number:text> + <number:minutes number:style="long"> + </number:minutes> + <number:text>:</number:text> + <number:seconds number:style="long"> + </number:seconds> + <number:am-pm> + </number:am-pm> + </xsl:template> + <!--the default date style --> + <xsl:template name="default_date_style"> + <number:date-style style:name="NDF1"> + <xsl:call-template name="default_date_style_content"/> + </number:date-style> + </xsl:template> + <xsl:template match="w:instrText | w:fldSimple" mode="style"> + <!-- this template is to generate the date, time styles according to the content of DateFormatString ( the string after \@ ) in w:instrText | w:fldSimple/@w:instr --> + <xsl:choose> + <xsl:when test=" name() = 'w:instrText' "> + <xsl:if test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' "> + <number:date-style> + <xsl:attribute name="style:name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> + <xsl:choose> + <xsl:when test="contains(text(), '\@' )"> + <!-- if has the date format string then call the template parse_field_date_format to produce the style--> + <xsl:variable name="MS_date_format"> + <xsl:value-of select="normalize-space(substring-before(substring-after(normalize-space(substring-after(text(), '\@')), '"'), '"'))"/> + </xsl:variable> + <xsl:if test="string-length($MS_date_format) >=1"> + <xsl:call-template name="parse_field_date_format"> + <xsl:with-param name="input_MS_date_format" select="$MS_date_format"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="string-length($MS_date_format) <1"> + <xsl:call-template name="default_date_style_content"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <!-- if doesn't have date format string so we use the following default format --> + <xsl:call-template name="default_date_style_content"/> + </xsl:otherwise> + </xsl:choose> + </number:date-style> + </xsl:if> + </xsl:when> + <xsl:when test="name() = 'w:fldSimple' "> + <xsl:if test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' or substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' or substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' or substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' "> + <!-- we use the default date/time style for w:fldsimple --> + <number:date-style> + <xsl:attribute name="style:name">NDF1</xsl:attribute> + <xsl:call-template name="default_date_style_content"/> + </number:date-style> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="parse_field_date_format"> + <!--this template is to parse and generate the content of the date-time style base on the content of input_MS_date_format --> + <xsl:param name="input_MS_date_format"/> + <xsl:if test="string-length($input_MS_date_format) >= 1"> + <xsl:variable name="date_token_start_position"> + <!-- to find the start position of the token ' d, M, yy, YY,m etc. --> + <xsl:call-template name="find_token_startposition"> + <xsl:with-param name="input_string" select="$input_MS_date_format"/> + <xsl:with-param name="token_start_position" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="date_token"> + <!-- get the matched the token such as MM, YYYY, yy,MMMM etc. --> + <xsl:call-template name="get_date_token"> + <xsl:with-param name="input_string2" select="substring($input_MS_date_format,$date_token_start_position)"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="number($date_token_start_position) > 1"> + <!-- print the text between the tokens --> + <number:text> + <xsl:value-of select="substring($input_MS_date_format,1, number($date_token_start_position - 1) )"/> + </number:text> + </xsl:if> + <xsl:call-template name="map_date_format_pattern"> + <xsl:with-param name="input_date_format_pattern" select="$date_token"/> + </xsl:call-template> + <xsl:variable name="unparsed_string"> + <xsl:value-of select="substring($input_MS_date_format,$date_token_start_position + string-length($date_token))"/> + </xsl:variable> + <xsl:call-template name="parse_field_date_format"> + <xsl:with-param name="input_MS_date_format" select="$unparsed_string"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="find_token_startposition"> + <xsl:param name="input_string"/> + <xsl:param name="token_start_position"/> + <xsl:choose> + <xsl:when test="starts-with( $input_string,'yy') or starts-with($input_string,'YY') or starts-with($input_string,'HH') or starts-with($input_string,'hh') or starts-with($input_string,'ss') or starts-with($input_string,'SS')"> + <xsl:value-of select="$token_start_position"/> + </xsl:when> + <xsl:when test="starts-with($input_string, 'M') or starts-with($input_string,'d') or starts-with($input_string, 'm') or starts-with($input_string,'D') or starts-with($input_string,'h') or starts-with($input_string,'H') or starts-with($input_string,'s') or starts-with($input_string,'S')"> + <xsl:value-of select="$token_start_position"/> + </xsl:when> + <xsl:when test="starts-with($input_string, 'am/pm') or starts-with($input_string, 'AM/PM') "> + <xsl:value-of select="$token_start_position"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="new_string"> + <xsl:value-of select="substring($input_string, 2)"/> + </xsl:variable> + <xsl:call-template name="find_token_startposition"> + <xsl:with-param name="input_string" select="$new_string"/> + <xsl:with-param name="token_start_position" select="$token_start_position +1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get_date_token"> + <xsl:param name="input_string2"/> + <xsl:choose> + <xsl:when test="starts-with($input_string2, 'am/pm') or starts-with($input_string2, 'AM/PM') "> + <xsl:value-of select=" 'am/pm' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'yyyy') or starts-with($input_string2, 'YYYY')"> + <xsl:value-of select=" 'yyyy' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'yy') or starts-with($input_string2, 'YY')"> + <xsl:value-of select=" 'yy' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'MMMM') "> + <xsl:value-of select=" 'MMMM' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'MMM')"> + <xsl:value-of select=" 'MMM' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'MM')"> + <xsl:value-of select=" 'MM' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'M') "> + <xsl:value-of select=" 'M' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'dddd') or starts-with($input_string2, 'DDDD')"> + <xsl:value-of select=" 'dddd' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'ddd') or starts-with($input_string2, 'DDD')"> + <xsl:value-of select=" 'ddd' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'dd') or starts-with($input_string2, 'dd')"> + <xsl:value-of select=" 'dd' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'd') or starts-with($input_string2, 'D')"> + <xsl:value-of select=" 'd' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'mm')"> + <xsl:value-of select=" 'mm' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'm')"> + <xsl:value-of select=" 'm' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'hh') or starts-with($input_string2, 'HH')"> + <xsl:value-of select=" 'hh' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'h') or starts-with($input_string2, 'H')"> + <xsl:value-of select=" 'h' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 'ss') or starts-with($input_string2, 'SS')"> + <xsl:value-of select=" 'ss' "/> + </xsl:when> + <xsl:when test="starts-with($input_string2, 's') or starts-with($input_string2, 'S')"> + <xsl:value-of select=" 's' "/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="map_date_format_pattern"> + <!-- this template map the MS date time format to OOo date time format --> + <xsl:param name="input_date_format_pattern"/> + <xsl:choose> + <xsl:when test="$input_date_format_pattern = 'am/pm' "> + <number:am-pm> + </number:am-pm> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'yyyy' "> + <number:year number:style="long"> + </number:year> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'yy' "> + <number:year> + </number:year> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'MMMM' "> + <number:month number:style="long" number:textual="true"> + </number:month> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'MMM' "> + <number:month number:textual="true"> + </number:month> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'MM' "> + <number:month number:style="long"> + </number:month> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'M' "> + <number:month> + </number:month> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'dddd' "> + <number:day-of-week number:style="long"> + </number:day-of-week> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'ddd' "> + <number:day-of-week> + </number:day-of-week> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'dd' "> + <number:day number:style="long"> + </number:day> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'd' "> + <number:day> + </number:day> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'mm' "> + <number:minutes number:style="long"> + </number:minutes> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'm' "> + <number:minutes> + </number:minutes> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'hh' "> + <number:hours number:style="long"> + </number:hours> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'h' "> + <number:hours> + </number:hours> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 'ss' "> + <number:seconds number:style="long"> + </number:seconds> + </xsl:when> + <xsl:when test="$input_date_format_pattern = 's' "> + <number:seconds> + </number:seconds> + </xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_list.xsl b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl new file mode 100644 index 000000000..71f7039a5 --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl @@ -0,0 +1,648 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v"> + <xsl:template match="w:listPr" mode="style"> + <xsl:variable name="currlistid" select="w:ilfo/@w:val"/> + <xsl:variable name="currlist" select="."/> + <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> + <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/> + <xsl:if test="not(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[1]/w:ilfo/@w:val= $currlistid) and $rootlist/w:lvl "> + <xsl:element name="text:list-style"> + <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/> + </xsl:attribute> + <xsl:apply-templates select="$rootlist/w:lvl"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="w:lvl"> + <xsl:variable name="listtype"> + <xsl:choose> + <xsl:when test="w:nfc/@w:val"> + <xsl:value-of select="w:nfc/@w:val"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$listtype =23 and w:lvlPicBulletId"> + <!-- image characters. wym --> + <xsl:element name="text:list-level-style-image"> + <xsl:call-template name="list-styles-image"/> + </xsl:element> + </xsl:when> + <xsl:when test="$listtype =23"> + <!-- nfcBullet: Bullet character. glu --> + <xsl:element name="text:list-level-style-bullet"> + <xsl:call-template name="list-styles-common"> + <xsl:with-param name="listtype" select="$listtype"/> + <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <!-- all kinds of numbering characters. glu :( --> + <xsl:element name="text:list-level-style-number"> + <xsl:call-template name="list-styles-common"> + <xsl:with-param name="listtype" select="$listtype"/> + <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="list-styles-common"> + <xsl:param name="listtype"/> + <xsl:param name="currlevel"/> + <xsl:variable name="startval" select="w:start/@w:val"/> + <xsl:attribute name="text:level"> + <xsl:value-of select="$currlevel"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="$listtype = 23"> + <!-- bullet character. glu --> + <xsl:attribute name="text:style-name">Bullet_20_Symbols</xsl:attribute> + <xsl:if test="not (contains(w:lvlText/@w:val,'%'))"> + <xsl:attribute name="text:bullet-char"> + <xsl:value-of select="w:lvlText/@w:val"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="contains(w:lvlText/@w:val,'%')"> + <xsl:attribute name="text:bullet-char"> + <xsl:value-of select=" '·' "/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:when test="($listtype >= 0) and ($listtype < 60)"> + <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute> + <xsl:if test="$startval"> + <xsl:choose> + <xsl:when test="$startval > 0"> + <xsl:attribute name="text:start-value"> + <xsl:value-of select="$startval"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:start-value"> + <xsl:value-of select=" '1' "/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!--xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute --> + </xsl:if> + <xsl:attribute name="text:display-levels"> + <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/> + </xsl:attribute> + <xsl:call-template name="nfc2numformat"> + <xsl:with-param name="nfcvalue" select="$listtype"/> + <xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/> + <xsl:with-param name="suffix" select="substring-after(w:lvlText/@w:val, concat('%', $currlevel) )"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute> + <xsl:if test="$startval"> + <xsl:choose> + <xsl:when test="$startval > 0"> + <xsl:attribute name="text:start-value"> + <xsl:value-of select="$startval"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:start-value"> + <xsl:value-of select=" '1' "/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!-- xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute --> + </xsl:if> + <xsl:attribute name="text:display-levels"> + <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/> + </xsl:attribute> + <!-- 'none' in Word 2003. wym --> + <xsl:attribute name="style:num-format"/> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:element name="style:list-level-properties"> + <xsl:choose> + <xsl:when test="w:lvlJc/@w:val='right'"> + <xsl:attribute name="fo:text-align">end</xsl:attribute> + </xsl:when> + <xsl:when test="w:lvlJc/@w:val='center'"> + <xsl:attribute name="fo:text-align">center</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:text-align">start</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="labelwidth"> + <xsl:choose> + <xsl:when test="w:pPr/w:ind/@w:hanging"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="w:pPr/w:ind/@w:first-line"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="leftwidth"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="w:pPr/w:ind/@w:left"> + <xsl:attribute name="text:space-before"> + <xsl:choose> + <xsl:when test=" ( number($leftwidth)-number($labelwidth) ) > 0"> + <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" '0cm' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="text:min-label-width"> + <xsl:choose> + <xsl:when test="$labelwidth > 0"> + <xsl:value-of select="concat($labelwidth,'cm')"/> + </xsl:when> + <xsl:otherwise>0cm</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <!-- In binary word translation, text:min-label-distance do not generate. So, the width of number-symbol will not effect the start position of text. But first line always start same position of second line, no indent. If text:min-label-distance generate, the look of list will change because of uncountable number-symbol's width, now use 0.25cm as default width--> + <xsl:choose> + <xsl:when test="w:suff/@w:val='Space'"> + <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute> + </xsl:when> + <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos"> + <xsl:variable name="tabpos"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="number($tabpos) > (number($leftwidth)-number($labelwidth))"> + <xsl:variable name="min-label-distance"> + <xsl:choose> + <xsl:when test="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25 < 0">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="text:min-label-distance"> + <xsl:value-of select="concat($min-label-distance,'cm')"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + </xsl:choose> + <!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used + <xsl:variable name="currNode" select="/w:wordDocument/w:body//w:listPr[w:ilvl/@w:val = $currlevel][w:ilfo/@w:val = $currlist/w:ilfo/@w:val]"/> + <xsl:choose> + <xsl:when test="($currNode/wx:t/@wx:wTabBefore ) and ($currNode/wx:t/@wx:wTabAfter ) and (not($currNode/following-sibling::w:jc) or $currNode/following-sibling::w:jc/@w:val = 'left')"> + <xsl:attribute name="text:space-before"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabBefore)div 1440) * 2.54"/>cm</xsl:attribute> + <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabAfter)div 1440) * 2.54"/>cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:space-before"><xsl:value-of select="((number(w:pPr/w:ind/@w:left) div 1440) * 2.54) "/>cm</xsl:attribute> + <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440) * 2.54"/>cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose>--> + <xsl:if test="w:rPr/w:rFonts"> + <xsl:if test="w:rPr/w:rFonts/@w:ascii"> + <xsl:attribute name="style:font-name"> + <xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/> + </xsl:attribute> + </xsl:if> + <!-- in Oasis format the style:font-name-asian is not allowed to appear here --> + <!--xsl:if test="w:rPr/w:rFonts/@w:fareast"> + <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute> + </xsl:if --> + <!-- + <xsl:if test="w:rPr/w:rFonts/@w:cs"> + <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute> + </xsl:if> + --> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="list-styles-image"> + <xsl:variable name="currlevel" select="number(@w:ilvl)"/> + <xsl:attribute name="text:level"> + <xsl:value-of select="$currlevel+1"/> + </xsl:attribute> + <xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/> + <office:binary-data> + <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/> + </office:binary-data> + <xsl:element name="style:list-level-properties"> + <xsl:attribute name="style:vertical-pos">middle</xsl:attribute> + <xsl:attribute name="style:vertical-rel">line</xsl:attribute> + <xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/> + <xsl:attribute name="fo:text-align">left</xsl:attribute> + <xsl:attribute name="fo:width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + <xsl:attribute name="fo:height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-after($picsize,'height:')"/> + </xsl:call-template> + <xsl:text>cm</xsl:text> + </xsl:attribute> + <xsl:variable name="labelwidth"> + <xsl:choose> + <xsl:when test="w:pPr/w:ind/@w:hanging"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="w:pPr/w:ind/@w:first-line"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="leftwidth"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="text:space-before"> + <xsl:choose> + <xsl:when test="(number($leftwidth)-number($labelwidth)) > 0 "> + <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" '0cm' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="text:min-label-width"> + <xsl:choose> + <xsl:when test="$labelwidth > 0"> + <xsl:value-of select="concat($labelwidth,'cm')"/> + </xsl:when> + <xsl:otherwise>0cm</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:choose> + <xsl:when test="w:suff/@w:val='Space'"> + <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute> + </xsl:when> + <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos"> + <xsl:variable name="tabpos"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="number($tabpos) > (number($leftwidth)-number($labelwidth))"> + <xsl:attribute name="text:min-label-distance"> + <xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:template> + <!-- avoid listPr in textbox. :( glu --> + <xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]"> + <xsl:call-template name="genlist"/> + </xsl:template> + <xsl:template name="genlist"> + <xsl:variable name="currlistid" select="w:pPr/w:listPr/w:ilfo/@w:val"/> + <xsl:variable name="currlistlvl" select="w:pPr/w:listPr/w:ilvl/@w:val"/> + <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/> + <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> + <xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/> + <xsl:element name="text:list"> + <xsl:attribute name="text:style-name"> + <xsl:choose> + <xsl:when test="string-length($rootlistname) > 0"> + <xsl:value-of select="translate($rootlistname,' ~`!@#$%^*(&)+/,;?<>{}[]:','_')"/> + </xsl:when> + <xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:choose> + <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val"> + <xsl:attribute name="text:continue-numbering">true</xsl:attribute> + <xsl:element name="text:list-item"> + <xsl:call-template name="levels"> + <xsl:with-param name="level" select="$currlistlvl"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="text:list-item"> + <xsl:call-template name="levels"> + <xsl:with-param name="level" select="$currlistlvl"/> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:template> + <xsl:template name="levels"> + <xsl:param name="level"/> + <xsl:choose> + <xsl:when test="$level = '0'"> + <xsl:call-template name="process-common-paragraph"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="text:list"> + <xsl:element name="text:list-item"> + <xsl:call-template name="levels"> + <xsl:with-param name="level" select="$level -1"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="w:style" mode="list"> + <xsl:variable name="listname" select="@w:styleId"/> + <xsl:if test="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]"> + <text:list-style style:name="{$listname}"> + <xsl:apply-templates select="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]/w:lvl"/> + </text:list-style> + </xsl:if> + </xsl:template> + <!-- for create outline style in office:styles --> + <xsl:template name="create-outline-style"> + <xsl:element name="text:outline-style"> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="1"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="2"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="3"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="4"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="5"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="6"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="7"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="8"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="9"/> + </xsl:call-template> + <xsl:call-template name="outline-level-style"> + <xsl:with-param name="level" select="10"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="outline-level-style"> + <xsl:param name="level"/> + <xsl:element name="text:outline-level-style"> + <xsl:choose> + <xsl:when test="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]"> + <xsl:apply-templates select="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]" mode="outline"> + <xsl:with-param name="outlinelevel" select="$level"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:level"> + <xsl:value-of select="$level"/> + </xsl:attribute> + <xsl:attribute name="style:num-format"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:template> + <xsl:template match="w:listPr" mode="outline"> + <xsl:param name="outlinelevel"/> + <xsl:variable name="currlistid" select="w:ilfo/@w:val"/> + <xsl:variable name="currlistlevel"> + <xsl:choose> + <xsl:when test="w:ilvl"> + <xsl:value-of select="w:ilvl/@w:val"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> + <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/> + <xsl:if test="$rootlist/w:lvl[@w:ilvl=$currlistlevel]"> + <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]"> + <xsl:call-template name="list-styles-common"> + <xsl:with-param name="listtype"> + <xsl:choose> + <xsl:when test="w:nfc/@w:val"> + <xsl:value-of select="w:nfc/@w:val"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="currlevel" select="$outlinelevel"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="not($rootlist/w:lvl[@w:ilvl=$currlistlevel])"> + <xsl:attribute name="text:level"> + <xsl:value-of select="'1'"/> + </xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template name="nfc2numformat"> + <xsl:param name="nfcvalue"/> + <xsl:param name="prefix"/> + <xsl:param name="suffix"/> + <xsl:choose> + <xsl:when test="$nfcvalue=0"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=1"> + <xsl:attribute name="style:num-format">I</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=2"> + <xsl:attribute name="style:num-format">i</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=3"> + <xsl:attribute name="style:num-format">A</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=4"> + <xsl:attribute name="style:num-format">a</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$nfcvalue=26"> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="$prefix"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="concat( '.' , $suffix )"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=27 or $nfcvalue=29"> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="concat( $prefix, '(' )"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="concat( ')' , $suffix )"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=57"> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="concat( $prefix, '- ' )"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="concat( ' -' , $suffix )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:num-prefix"> + <xsl:value-of select="$prefix"/> + </xsl:attribute> + <xsl:attribute name="style:num-suffix"> + <xsl:value-of select="$suffix"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- xsl:template name="nfc2numformat"> + <xsl:param name="nfcvalue"/> + <xsl:param name="prefix"/> + <xsl:param name="suffix"/> + <xsl:choose> + <xsl:when test="$nfcvalue=0"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=1"> + <xsl:attribute name="style:num-format">I</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=2"> + <xsl:attribute name="style:num-format">i</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=3"> + <xsl:attribute name="style:num-format">A</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=4"> + <xsl:attribute name="style:num-format">a</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=10 or $nfcvalue=11 or $nfcvalue=17 or $nfcvalue=29 or $nfcvalue=33 or $nfcvalue=35 or $nfcvalue=36 or $nfcvalue=37 or $nfcvalue=39 or $nfcvalue=44"> + <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=12"> + <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=13"> + <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=14 or $nfcvalue=19"> + <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=16"> + <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=18 or $nfcvalue=28"> + <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=20"> + <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=21"> + <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=24"> + <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=25"> + <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=30"> + <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=31"> + <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=34"> + <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=38"> + <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=41 or $nfcvalue=42 or $nfcvalue=43"> + <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=45 or $nfcvalue=47"> + <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=46 or $nfcvalue=48"> + <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=53"> + <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue!=57 and $nfcvalue > 48 and $nfcvalue < 60"> + <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="$nfcvalue=26"> + <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( '.' , $suffix )"/></xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=27 or $nfcvalue=29"> + <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '(' )"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ')' , $suffix )"/></xsl:attribute> + </xsl:when> + <xsl:when test="$nfcvalue=57"> + <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '- ' )"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ' -' , $suffix )"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute> + <xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template --> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_page.xsl b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl new file mode 100644 index 000000000..c53940643 --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl @@ -0,0 +1,402 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v"> + <xsl:template match="w:footnotePr" mode="config"> + <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol"> + <xsl:if test="w:pos"> + <xsl:choose> + <xsl:when test="w:pos/@w:val = 'beneath-text'"> + <xsl:attribute name="text:footnotes-position">document</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:footnotes-position">page</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="w:numStart"> + <xsl:choose> + <xsl:when test="w:numStart/@w:val - 1 > 0"> + <xsl:attribute name="text:start-value"> + <xsl:value-of select="w:numStart/@w:val - 1"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:start-value"> + <xsl:value-of select=" '1' "/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute--> + </xsl:if> + <xsl:if test="w:numFmt"> + <xsl:call-template name="convert-number-format"> + <xsl:with-param name="number-format" select="w:numFmt/@w:val"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="w:numRestart"> + <xsl:choose> + <xsl:when test="w:numRestart/@w:val = 'continuous'"> + <xsl:attribute name="text:start-numbering-at">document</xsl:attribute> + </xsl:when> + <xsl:when test="w:numRestart/@w:val = 'each-sect'"> + <xsl:attribute name="text:start-numbering-at">chapter</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:start-numbering-at">page</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!-- + <xsl:if test="w:footnote[@w:type = 'continuation-separator']"> + <text:footnote-continuation-notice-backward> + <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-separator'])"/> + </text:footnote-continuation-notice-backward> + </xsl:if> + <xsl:if test="w:footnote[@w:type = 'continuation-notice']"> + <text:footnote-continuation-notice-forward> + <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-notice'])"/> + </text:footnote-continuation-notice-forward> + </xsl:if> + --> + </text:notes-configuration> + </xsl:template> + <xsl:template match="w:endnotePr" mode="config"> + <text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol"> + <xsl:if test="w:numStart"> + <xsl:choose> + <xsl:when test="(w:numStart/@w:val - 1) > 0"> + <xsl:attribute name="text:start-value"> + <xsl:value-of select="w:numStart/@w:val - 1"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:start-value"> + <xsl:value-of select=" '1' "/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute --> + </xsl:if> + <xsl:if test="w:numFmt"> + <xsl:call-template name="convert-number-format"> + <xsl:with-param name="number-format" select="w:numFmt/@w:val"/> + </xsl:call-template> + </xsl:if> + </text:notes-configuration> + </xsl:template> + <xsl:template name="convert-number-format"> + <xsl:param name="number-format"/> + <xsl:choose> + <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-zero'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">0</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-enclosed-fullstop'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">.</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-enclosed-paren'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">(</xsl:attribute> + <xsl:attribute name="style:num-suffix">)</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'number-in-dash'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">-</xsl:attribute> + <xsl:attribute name="style:num-suffix">-</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'upper-letter'"> + <xsl:attribute name="style:num-format">A</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'lower-letter'"> + <xsl:attribute name="style:num-format">a</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'upper-roman'"> + <xsl:attribute name="style:num-format">I</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'lower-roman'"> + <xsl:attribute name="style:num-format">i</xsl:attribute> + </xsl:when> + <!-- ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional, + vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting --> + <xsl:otherwise> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="w:bgPict"> + <xsl:if test="w:background/@w:bgcolor"> + <xsl:attribute name="fo:background-color"> + <xsl:call-template name="MapConstColor"> + <xsl:with-param name="color" select="w:background/@w:bgcolor"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:background/@w:background"> + <style:background-image> + <office:binary-data> + <xsl:variable name="the-image" select="key('imagedata',w:background/@w:background)"/> + <xsl:value-of select="translate($the-image/text(),'	  ','' ) "/> + </office:binary-data> + </style:background-image> + </xsl:if> + </xsl:template> + <xsl:template match="w:sectPr" mode="page-layout"> + <style:page-layout> + <xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr" format="1"/> + </xsl:attribute> + <style:page-layout-properties> + <xsl:call-template name="page-layout-properties"/> + <xsl:apply-templates select="/w:wordDocument/w:bgPict"/> + </style:page-layout-properties> + <style:header-style> + <style:header-footer-properties style:dynamic-spacing="true" fo:margin-bottom="0"> + <xsl:variable name="header-margin"> + <xsl:choose> + <xsl:when test="w:pgMar/@w:header"> + <xsl:value-of select="w:pgMar/@w:header"/> + </xsl:when> + <xsl:otherwise>720</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="header-margin-diff"> + <xsl:value-of select="w:pgMar/@w:top - $header-margin"/> + </xsl:variable> + <xsl:variable name="min-height"> + <xsl:choose> + <xsl:when test="$header-margin-diff > 0"> + <xsl:value-of select="$header-margin-diff div 567.0"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:min-height"> + <xsl:value-of select="concat($min-height, 'cm')"/> + </xsl:attribute> + </style:header-footer-properties> + </style:header-style> + </style:page-layout> + </xsl:template> + <xsl:template match="w:sectPr" mode="master-page"> + <!-- style:page-layout style:style--> + + <xsl:variable name="master-page-number"> + <xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any" format="1"/> + </xsl:variable> + <xsl:if test="$master-page-number = '1'"> + <style:master-page style:next-style-name="Standard-1" style:page-layout-name="pm1" style:display-name="First Page" style:name="First_20_Page"> + <style:header> + <xsl:apply-templates select="w:hdr[@w:type='first']/child::*" mode="dispatch"/> + </style:header> + <style:footer> + <xsl:apply-templates select="w:ftr[@w:type='first']/child::*" mode="dispatch"/> + </style:footer> + </style:master-page> + </xsl:if> + <xsl:element name="style:master-page"> + <xsl:attribute name="style:name">Standard-<xsl:value-of select="$master-page-number"/> + </xsl:attribute> + <xsl:attribute name="style:page-layout-name"> + <xsl:value-of select="concat('pm', $master-page-number)"/> + </xsl:attribute> + + <style:header> + <xsl:apply-templates select="w:hdr[@w:type='odd']/child::*" mode="dispatch"/> + </style:header> + <style:header-left> + <xsl:apply-templates select="w:hdr[@w:type='even']/child::*" mode="dispatch"/> + </style:header-left> + <style:footer> + <xsl:apply-templates select="w:ftr[@w:type='odd']/child::*" mode="dispatch"/> + </style:footer> + <style:footer-left> + <xsl:apply-templates select="w:ftr[@w:type='even']/child::*" mode="dispatch"/> + </style:footer-left> + + <!-- Headers and footers--> + <!-- + <style:header-style> + <style:header-footer-properties> + <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:header,'twip')"/></xsl:call-template>cm</xsl:attribute> + <xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute> + <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute> + </style:header-footer-properties> + </style:header-style> + <style:footer-style> + <style:header-footer-properties> + <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'twip')"/></xsl:call-template>cm</xsl:attribute> + <xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute> + <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute> + </style:header-footer-properties> + </style:footer-style> + --> + + <!-- any examples for w:titlePg usage? --> + <xsl:if test="not(w:titlePg)"> + <xsl:apply-templates select="w:hdr[@w:type='odd']"/> + <xsl:apply-templates select="w:hdr[@w:type='even']"/> + <xsl:apply-templates select="w:ftr[@w:type='odd']"/> + <xsl:apply-templates select="w:ftr[@w:type='even']"/> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template match="w:hdr"> + <!-- + <xsl:choose> + <xsl:when test="@w:type = 'odd'"> + <style:header> + <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> + </style:header> + </xsl:when> + <xsl:when test="@w:type = 'even'"> + <style:header> + <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> + </style:header> + </xsl:when> + </xsl:choose> + --> + </xsl:template> + <xsl:template match="w:ftr"> + <!-- + <xsl:choose> + <xsl:when test="@w:type = 'odd'"> + <style:footer> + <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> + </style:footer> + </xsl:when> + <xsl:when test="@w:type = 'even'"> + <style:footer-left> + <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> + </style:footer-left> + </xsl:when> + </xsl:choose> + --> + </xsl:template> + <xsl:template match="wx:pBdrGroup"> + <xsl:apply-templates mode="dispatch"/> + </xsl:template> + <!-- xsl:template name="convert-number-format"> + <xsl:param name="number-format"/> + <xsl:choose> + <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-zero'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">0</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-enclosed-fullstop'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">.</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-enclosed-paren'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">(</xsl:attribute> + <xsl:attribute name="style:num-suffix">)</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'number-in-dash'"> + <xsl:attribute name="style:num-format">1</xsl:attribute> + <xsl:attribute name="style:num-prefix">-</xsl:attribute> + <xsl:attribute name="style:num-suffix">-</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'upper-letter'"> + <xsl:attribute name="style:num-format">A</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'lower-letter'"> + <xsl:attribute name="style:num-format">a</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'upper-roman'"> + <xsl:attribute name="style:num-format">I</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'lower-roman'"> + <xsl:attribute name="style:num-format">i</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-full-width' or $number-format = 'decimal-full-width2'"> + <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'decimal-enclosed-circle-chinese' or $number-format = 'decimal-enclosed-circle'"> + <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'ideograph-enclosed-circle'"> + <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute> + <xsl:attribute name="style:num-prefix">(</xsl:attribute> + <xsl:attribute name="style:num-suffix">)</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'chinese-counting-thousand' or $number-format = 'ideograph-digital' or $number-format = 'japanese-counting' or $number-format = 'japanese-digital-ten-thousand' or $number-format = 'taiwanese-counting-thousand' or $number-format = 'taiwanese-counting' or $number-format = 'taiwanese-digital' or $number-format = 'chinese-counting' or $number-format = 'korean-digital2' or $number-format = 'chinese-not-impl'"> + <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'chinese-legal-simplified'"> + <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'ideograph-legal-traditional'"> + <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'ideograph-traditional'"> + <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'ideograph-zodiac'"> + <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'japanese-legal'"> + <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'aiueo-full-width'"> + <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'aiueo'"> + <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'iroha-full-width'"> + <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'iroha'"> + <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'korean-digital' or $number-format = 'korean-counting' or $number-format = 'korean-legal'"> + <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'chosung'"> + <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'ganada'"> + <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'arabic-alpha' or $number-format = 'arabic-abjad'"> + <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'thai-letters' or $number-format = 'thai-numbers' or $number-format = 'thai-counting'"> + <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'hebrew-1'"> + <xsl:attribute name="style:num-format">א, י, ק, ...</xsl:attribute> + </xsl:when> + <xsl:when test="$number-format = 'hebrew-2'"> + <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute> + </xsl:when> + < ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional, + vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting > + <xsl:otherwise> + <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template --> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_path.xsl b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl new file mode 100644 index 000000000..ed8dbac42 --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl @@ -0,0 +1,1809 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v"> + <xsl:include href="../../common/math.xsl"/> + <xsl:template name="dummy"> + <xsl:call-template name="test"/> + </xsl:template> + <xsl:template name="test-arc"> + <xsl:call-template name="svg-arc2vml-arc"> + <!-- M 125,75 a100,50 0 ?,? 100,50 --> + <xsl:with-param name="x0" select="125"/> + <xsl:with-param name="y0" select="75"/> + <xsl:with-param name="rx" select="100"/> + <xsl:with-param name="ry" select="50"/> + <xsl:with-param name="x-axis-rotation" select="0"/> + <xsl:with-param name="large-arc-flag" select="0"/> + <xsl:with-param name="sweep-flag" select="0"/> + <xsl:with-param name="x" select="225"/> + <xsl:with-param name="y" select="125"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="test"> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="'m,l,4500,3420,2520,6120,4500r2160,l6660,3240,8460,2520,8460,,3960,540r360,720l2700,1260,3240,540,,xe'"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="vmlpath2svgpath"> + <xsl:param name="vml-path"/> + <xsl:param name="svg-path" select="''"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command" select="'m'"/> + <xsl:param name="current-x" select="'0'"/> + <xsl:param name="current-y" select="'0'"/> + <xsl:variable name="command-and-newpos"> + <xsl:call-template name="get-path-command"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/> + <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/> + <xsl:choose> + <xsl:when test="$command = 'm' "> + <!-- absolute moveto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' M ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 't' "> + <!-- relative moveto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' m ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'l' "> + <!-- absolute lineto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'r' "> + <!-- relative lineto --> + <!-- 'l' command is not supported currently, so we use 'L' --> + <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <!-- 'l' command is not supported currently--> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , $new-x ,' ' , $new-y , ' ') "/> + <!-- xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/ --> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummyH' "> + <!-- absolute horizontal lineto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummyh' "> + <!-- relative horizontal lineto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummyV' "> + <!-- absolute vertical lineto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x"/> + <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummyv' "> + <!-- relative horizontal lineto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x"/> + <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'c' "> + <!-- absolute curveto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' C ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'v' "> + <!-- relative curveto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummyS' "> + <!-- absolute shorthand/smooth curveto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control-1"> + <xsl:choose> + <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 "> + <xsl:variable name="previous-control-2"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="count" select="2"/> + <xsl:with-param name="skipcount" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring-before($previous-control-2 , ':') "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($control-and-pos, ':') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummys' "> + <!-- absolute shorthand/smooth curveto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' v ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control-1"> + <xsl:choose> + <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 "> + <xsl:variable name="previous-control-2"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="count" select="2"/> + <xsl:with-param name="skipcount" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring-before($previous-control-2 , ':') "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($control-and-pos, ':') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummyQ' "> + <!-- absolute quadratic bézier curves --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'dummyq' "> + <!-- relative quadratic bézier curves --> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/> + <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ' , $absolute-number , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'x' "> + <!--dummy or $command = 'z' "--> + <!-- closepath --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' Z ' ) "/> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'e' "> + <!-- end path --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' N ' )"/> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <!--Code below is for the support of h-command like ha,hb...hi, maybe still need to revise--> + <xsl:when test="$command = 'ha' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hb' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hc' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hd' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'he' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hf' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hg' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hh' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hi' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'nf' or $command = 'ns' "> + <xsl:variable name="new-svg-path" select="$svg-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'al' "> + <!-- absolute moveto --> + <xsl:variable name="new-svg-path" select="concat($svg-path ,' W ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="6"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2svgpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$svg-path"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- + **Template vmlpath2enhancedpath** + The template is responsible for converting the vml-path to enhanced-path, because the svg:path + can't support command a now.(But heard that will be supported in OOo3.0) + And the 2nd reason of using an enhanced-path is that enhanced-path have a perfect mapping to + vmlpath.(You will find out that often, we even don't need to change the parameters). + --> + <xsl:template name="vmlpath2enhancedpath"> + <xsl:param name="vml-path"/> + <xsl:param name="enhanced-path" select="''"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command" select="'m'"/> + <xsl:param name="current-x" select="'0'"/> + <xsl:param name="current-y" select="'0'"/> + <xsl:variable name="command-and-newpos"> + <xsl:call-template name="get-path-command"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/> + <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/> + <xsl:choose> + <xsl:when test="$command = 'm' "> + <!--####Notice that the "m 0,0,1,1,1,1" means two lines--> + <!-- absolute moveto --> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'l' "> + <!-- absolute lineto --> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'x' "> + <!--dummy or $command = 'z' "--> + <!-- closepath --> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Z ' ) "/> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'e' "> + <!-- end path --> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' N ' )"/> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'c' "> + <!-- absolute curveto --> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 't' "> + <!-- relative moveto --> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/> + <!--####maybe this is not created because t r and v haven't direct image in enhanced-path--> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'r' "> + <!-- relative lineto --> + <!--####maybe this is not created because 't' 'r' and 'v' haven't direct image in enhanced-path--> + <!-- 'l' command is not supported currently, so we use 'L' --> + <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <!-- 'l' command is not supported currently--> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , $new-x ,' ' , $new-y , ' ') "/> + <!-- xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/ --> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'v' "> + <!-- relative curveto --> + <!--####maybe this is not created because 't' 'r' and 'v' haven't direct image in enhanced-path--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/> + <!--<xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template>- + --> + <xsl:variable name="x1"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="y1"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $x1 , ':')"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x2"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $y1 , ':')"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="y2"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $x2 , ':')"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $y2 , ':')"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="y"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after( $x , ':')"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="val_x1"> + <xsl:value-of select="substring-before( $x1 , ':')+$current-x"/> + </xsl:variable> + <xsl:variable name="val_y1"> + <xsl:value-of select="substring-before( $y1 , ':')+$current-y"/> + </xsl:variable> + <xsl:variable name="val_x2"> + <xsl:value-of select="substring-before( $x2 , ':')+$current-x"/> + </xsl:variable> + <xsl:variable name="val_y2"> + <xsl:value-of select="substring-before( $y2 , ':')+$current-y"/> + </xsl:variable> + <xsl:variable name="val_x"> + <xsl:value-of select="substring-before( $x , ':')+$current-x"/> + </xsl:variable> + <xsl:variable name="val_y"> + <xsl:value-of select="substring-before( $y , ':')+$current-y"/> + </xsl:variable> + <xsl:variable name="control-and-pos"> + <xsl:value-of select="concat($val_x1, ' ',$val_y1, ' ',$val_x2, ' ',$val_y2, ' ' )"/> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:value-of select="concat($val_x, ' ',$val_y, ' ' )"/> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ',$control-and-pos , ' ' , $num-and-pos , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $y , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $val_x "/> + <xsl:with-param name="current-y" select=" $val_y "/> + </xsl:call-template> + </xsl:when> + <!--Code below is for the support of h-command like ha,hb...hi, maybe still need to revise--> + <xsl:when test="$command = 'ha' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hb' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hc' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hd' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'he' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hf' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hg' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hh' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'hi' "> + <xsl:variable name="new-enhanced-path" select="$enhanced-path"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'nf' "> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' F ' )"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'ns' "> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' S ' )"/> + <!--simply did nothing which might be wrong--> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <!--The following is 6 command which deal with arcs: + ae -> T al -> U + at -> A ar -> B + wa -> W wr -> V + These pairs of commands have shown the perfect mapping from vml-path to enhanced-path--> + <xsl:when test="$command = 'ae' "> + <!-- arc on the screen with the start and end angles --> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' T ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="6"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'al' "> + <!-- ae command plus an implicitly moveto startpoint--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' U ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="6"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'at' "> + <!-- arc on the screen with the edge box ,start points and end points(Notice it's counter-clockwise)--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' A ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="8"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'ar' "> + <!-- at command plus an implicitly moveto startpoint--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' B ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="8"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'wa' "> + <!-- arc on the screen with the edge box ,start points and end points(Notice it's clockwise)--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' W ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="8"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'wr' "> + <!-- wa command plus an implicitly moveto startpoint--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' V ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="8"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'qx' "> + <!-- Draw a quarter ellipse retated to the x-axis--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' X ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'qy' "> + <!-- Draw a quarter ellipse retated to the y-axis--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Y ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'qb' "> + <!-- quadratic Bezier--> + <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Q ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="vmlpath2enhancedpath"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$enhanced-path"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-before"> + <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newposition + skip $skipcount of numbers + --> + <xsl:param name="vml-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="count" select="1"/> + <xsl:param name="skipcount" select="0"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$count = 0"> + <xsl:value-of select=" concat($number , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-pos"> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="direction" select="-1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="previous-num-and-pos"> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$num-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$skipcount > 0"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count"/> + <xsl:with-param name="skipcount" select="$skipcount - 1"/> + <xsl:with-param name="number" select="$number"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$skipcount = 0"> + <xsl:variable name="new-number"> + <xsl:if test="not($count = 1)"> + <xsl:value-of select="' '"/> + </xsl:if> + <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/> + </xsl:variable> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count - 1"/> + <xsl:with-param name="skipcount" select="0"/> + <xsl:with-param name="number" select="$new-number"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-after"> + <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newposition + skip $skipcount of numbers + --> + <xsl:param name="vml-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="count" select="1"/> + <xsl:param name="skipcount" select="0"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$count = 0"> + <xsl:value-of select=" concat($number , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-pos"> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="direction" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="next-num-and-pos"> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$num-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$skipcount > 0"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count"/> + <xsl:with-param name="skipcount" select="$skipcount - 1"/> + <xsl:with-param name="number" select="$number"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$skipcount = 0"> + <xsl:variable name="new-number"> + <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/> + <xsl:if test="not($count = 1)"> + <xsl:value-of select="' '"/> + </xsl:if> + </xsl:variable> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count - 1"/> + <xsl:with-param name="skipcount" select="0"/> + <xsl:with-param name="number" select="$new-number"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-position"> + <!-- get the next number start position, direction should be 1 or -1--> + <xsl:param name="vml-path"/> + <xsl:param name="position"/> + <xsl:param name="direction" select="1"/> + <xsl:choose> + <xsl:when test="$direction = 1 and $position > string-length($vml-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($vml-path, $position , 1)"/> + </xsl:if> + <xsl:if test="$direction = -1"> + <xsl:value-of select="substring($vml-path, $position -1 , 1)"/> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 "> + <!-- number start--> + <xsl:value-of select="$position"/> + </xsl:when> + <xsl:when test="not($curr-char = ' ')"> + <xsl:value-of select="$position"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position + $direction"/> + <xsl:with-param name="direction" select="$direction"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="skip-space"> + <xsl:param name="vml-path"/> + <xsl:param name="position"/> + <xsl:param name="skip-comma" select="'yes'"/> + <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/> + <xsl:choose> + <xsl:when test="$curr-char = ',' and $skip-comma = 'yes'"> + <xsl:call-template name="skip-space"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position+1"/> + <xsl:with-param name="skip-comma" select="'no'"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$curr-char = ' '"> + <xsl:call-template name="skip-space"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position+1"/> + <xsl:with-param name="skip-comma" select="$skip-comma"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$position"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="format-number-pos"> + <xsl:param name="number"/> + <xsl:param name="position"/> + <xsl:choose> + <xsl:when test="contains($number,'@')"> + <xsl:value-of select="concat('?f',translate($number,'@',''),':' , $position ) "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" concat(round($number) , ':' , $position) "/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-next-number"> + <!-- get the next number from current position--> + <xsl:param name="vml-path"/> + <xsl:param name="position"/> + <xsl:param name="number" select=" '' "/> + <xsl:choose> + <xsl:when test="$position > string-length($vml-path) "> + <xsl:call-template name="format-number-pos"> + <xsl:with-param name="number" select="$number"/> + <xsl:with-param name="position" select="$position"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 "> + <!-- is number --> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="number" select="concat( $number, $curr-char) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0"> + <!-- is number --> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="number" select="concat( $number, $curr-char) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" $number = '' and $curr-char = ',' "> + <xsl:variable name="new-pos"> + <xsl:call-template name="skip-space"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat( '0:' , $new-pos )"/> + </xsl:when> + <xsl:when test=" $number = '' and not($curr-char = ',') "> + <xsl:variable name="new-pos"> + <xsl:call-template name="skip-space"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat( '0:' , $new-pos)"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="new-pos"> + <xsl:call-template name="skip-space"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="format-number-pos"> + <xsl:with-param name="number" select="$number"/> + <xsl:with-param name="position" select="$new-pos"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-previous-number"> + <!-- get the previous number from current position--> + <xsl:param name="vml-path"/> + <xsl:param name="position"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="not($position > 0)"> + <xsl:call-template name="format-number-pos"> + <xsl:with-param name="number" select="$number"/> + <xsl:with-param name="position" select="'0'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($vml-path, $position -1 , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 "> + <!-- is number --> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position -1"/> + <xsl:with-param name="number" select="concat($curr-char , $number) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0"> + <!-- skip it --> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position -1"/> + <xsl:with-param name="number" select="$number "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) > 0"> + <!-- finish it with +/- --> + <xsl:call-template name="format-number-pos"> + <xsl:with-param name="number" select="$number"/> + <xsl:with-param name="position" select="$position"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="format-number-pos"> + <xsl:with-param name="number" select="$number"/> + <xsl:with-param name="position" select="$position"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-path-command_dummy"> + <xsl:param name="vml-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command"/> + <xsl:choose> + <xsl:when test="$position > string-length($vml-path) "/> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , 'mlcxetrvnfsawqyb' ,'')) = 0 "> + <!-- "MmZzLlHhVvCcSsQqTtAa" are all 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="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- + **get-path- command** + This function will collect the next command from a string. If the input string should has a start of number character, + we here implicitly think the command is the last-command + All of the command of vml is listed as following: + __Basic commands:__ + m l c x e t r v nf ns ae al at ar wa wr qx qy qb + __Edit behavior extensions commands__ + ha hb hc hd he hf hg hh hi + + So we know the longest command should be four character.The function is implemented on this basis: + --> + <xsl:template name="get-path-command"> + <xsl:param name="vml-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command"/> + <xsl:choose> + <xsl:when test="$position > string-length($vml-path) "/> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/> + <xsl:variable name="curr-2char" select="substring($vml-path, $position - 1 , 2)"/> + <xsl:choose> + <xsl:when test="$curr-char = 'a' "> + <!--process the commands ae al at ar--> + <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/> + <xsl:variable name="isvalid"> + <xsl:choose> + <xsl:when test="$second-char='e' ">1</xsl:when> + <xsl:when test="$second-char='l' ">1</xsl:when> + <xsl:when test="$second-char='t' ">1</xsl:when> + <xsl:when test="$second-char='r' ">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$isvalid = '1' "> + <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/> + </xsl:if> + <xsl:if test="$isvalid = '0' "> + <xsl:message>ooo2wordml_path.xsl: Error command occurred </xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="$curr-char = 'n' "> + <!--process the commands nf ns --> + <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/> + <xsl:variable name="isvalid"> + <xsl:choose> + <xsl:when test="$second-char='f' ">1</xsl:when> + <xsl:when test="$second-char='s' ">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$isvalid = '1' "> + <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/> + </xsl:if> + <xsl:if test="$isvalid = '0' "> + <xsl:message>ooo2wordml_path.xsl: Error command occurred </xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="$curr-char = 'w' "> + <!--process the commands wa wr--> + <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/> + <xsl:variable name="isvalid"> + <xsl:choose> + <xsl:when test="$second-char='a' ">1</xsl:when> + <xsl:when test="$second-char='r' ">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$isvalid = '1' "> + <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/> + </xsl:if> + <xsl:if test="$isvalid = '0' "> + <xsl:message>ooo2wordml_path.xsl: Error command occurred </xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="$curr-char = 'q' "> + <!--process the commands qx qy qb--> + <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/> + <xsl:variable name="isvalid"> + <xsl:choose> + <xsl:when test="$second-char='x' ">1</xsl:when> + <xsl:when test="$second-char='y' ">1</xsl:when> + <xsl:when test="$second-char='b' ">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$isvalid = '1' "> + <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/> + </xsl:if> + <xsl:if test="$isvalid = '0' "> + <xsl:message>ooo2wordml_path.xsl: Error command occurred </xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="$curr-char = 'h' "> + <!--process the edit behavior extensions commands--> + <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/> + <xsl:variable name="isvalid"> + <xsl:choose> + <xsl:when test="string-length(translate($second-char , 'abcdefghi' ,'')) = 0">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$isvalid = '1' "> + <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/> + </xsl:if> + <xsl:if test="$isvalid = '0' "> + <xsl:message>ooo2wordml_path.xsl: Error command occurred </xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , 'mlcxetrv' ,'')) = 0 "> + <!--process the single character commands m l c x e t r v --> + <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 "> + <!-- number start, use last command --> + <xsl:if test="string-length($last-command) = 0"> + <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message> + </xsl:if> + <xsl:value-of select="concat( $last-command , ':' , $position )"/> + </xsl:when> + <xsl:when test="$curr-2char=',,' "> + <!-- here are two ',' --> + <xsl:if test="string-length($last-command) = 0"> + <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message> + </xsl:if> + <xsl:value-of select="concat( $last-command , ':' , $position )"/> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , ',	  ' ,'')) = 0 "> + <!-- space or ',' should be skip --> + <xsl:call-template name="get-path-command"> + <xsl:with-param name="vml-path" select="$vml-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="svg-arc2vml-arc"> + <xsl:param name="x0"/> + <xsl:param name="y0"/> + <xsl:param name="rx"/> + <xsl:param name="ry"/> + <xsl:param name="x-axis-rotation" select="0"/> + <xsl:param name="large-arc-flag" select="0"/> + <xsl:param name="sweep-flag" select="0"/> + <xsl:param name="x"/> + <xsl:param name="y"/> + <!-- Compute 1/2 distance between current and final point --> + <xsl:variable name="dx2" select="($x0 - $x) div 2"/> + <xsl:variable name="dy2" select="($y0 - $y) div 2"/> + <!-- Convert from degrees to radians --> + <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/> + <!-- Compute (x1, y1). What are x1,y1?--> + <xsl:variable name="cos-rotation"> + <xsl:call-template name="cos"> + <xsl:with-param name="x" select="$rotation-radian"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="sin-rotation"> + <xsl:call-template name="sin"> + <xsl:with-param name="x" select="$rotation-radian"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/> + <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/> + <!-- Make sure radii are large enough --> + <xsl:variable name="rx-abs"> + <xsl:call-template name="abs"> + <xsl:with-param name="x" select="$rx"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="ry-abs"> + <xsl:call-template name="abs"> + <xsl:with-param name="x" select="$ry"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/> + <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/> + <xsl:variable name="x1-sq" select="$x1 * $x1"/> + <xsl:variable name="y1-sq" select="$y1 * $y1"/> + <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/> + <xsl:variable name="radius-check-sqrt"> + <xsl:call-template name="sqrt"> + <xsl:with-param name="x" select="$radius-check"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="new-rx"> + <xsl:choose> + <xsl:when test="$radius-check > 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/import/wordml/wordml2ooo_props.xsl b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl new file mode 100644 index 000000000..85a4555fe --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl @@ -0,0 +1,268 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:an="urn:flr:annotate"> + +<an:page-layout-properties + context-node-input="w:sectPr" + context-node-output="style:page-layout-properties"> +<an:so-supported select="w:pgMar/@w:gutter"/> +<an:so-supported select="w:pgSz/@w:code"/> +</an:page-layout-properties> + +<xsl:template name="page-layout-properties"> + +<!-- NOTE: "div 567.0" converts from twips to cm --> +<xsl:attribute name="fo:margin-top"> + <xsl:variable name="header-margin"> + <xsl:choose> + <xsl:when test="w:pgMar/@w:header"> + <xsl:value-of select="w:pgMar/@w:header"/> + </xsl:when> + <xsl:otherwise>720</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="margin-top"> + <xsl:choose> + <xsl:when test="w:hdr"> + <xsl:choose> + <xsl:when test="w:pgMar/@w:top >= $header-margin"> + <xsl:value-of select="$header-margin"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="w:pgMar/@w:top"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="w:pgMar/@w:top"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat($margin-top div 567.0, 'cm')"/> +</xsl:attribute> +<xsl:attribute name="fo:margin-bottom"> + <xsl:variable name="footer-margin"> + <xsl:choose> + <xsl:when test="w:pgMar/@w:footer"> + <xsl:value-of select="w:pgMar/@w:footer"/> + </xsl:when> + <xsl:otherwise>720</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="margin-bottom"> + <xsl:choose> + <xsl:when test="w:ftr"> + <xsl:value-of select="$footer-margin"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="w:pgMar/@w:bottom"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat($margin-bottom div 567.0, 'cm')"/> +</xsl:attribute> +<xsl:attribute name="fo:margin-left"> + <xsl:value-of select="concat(w:pgMar/@w:left div 567.0, 'cm')"/> +</xsl:attribute> +<xsl:attribute name="fo:margin-right"> + <xsl:value-of select="concat(w:pgMar/@w:right div 567.0, 'cm')"/> +</xsl:attribute> + +<xsl:attribute name="fo:page-width"> + <xsl:value-of select="concat(w:pgSz/@w:w div 567.0, 'cm')"/> +</xsl:attribute> +<xsl:attribute name="fo:page-height"> + <xsl:value-of select="concat(w:pgSz/@w:h div 567.0, 'cm')"/> +</xsl:attribute> +<xsl:attribute name="style:footnote-max-height"> + <xsl:value-of select="'0cm'"/> +</xsl:attribute> +<xsl:attribute name="style:print-orientation"> + <xsl:choose> + <xsl:when test="w:pgSz/@w:orient"> + <xsl:value-of select="w:pgSz/@w:orient"/> + </xsl:when> + <xsl:otherwise>portrait</xsl:otherwise> + </xsl:choose> +</xsl:attribute> +<xsl:apply-templates select="//w:bgPict"/> +<xsl:call-template name="column-properties"/> +</xsl:template> + + +<an:column-properties + context-node-input="w:sectPr" + context-node-output="style:page-layout-properties"> +<an:so-supported select="w:cols/@w:sep"/> +</an:column-properties> +<xsl:template name="column-properties"> +<style:columns> +<xsl:attribute name="fo:column-count"> + <xsl:choose> + <xsl:when test="w:cols/@w:num"> + <xsl:value-of select="w:cols/@w:num"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> +</xsl:attribute> + +<xsl:if test="not(w:cols/w:col)"> +<!-- bug in the OASIS spec resp. bug in xmloff --> +<xsl:attribute name="fo:column-gap"> + <xsl:value-of select="concat(w:cols/@w:space div 567.0, 'cm')"/> +</xsl:attribute> +</xsl:if> + +<xsl:for-each select="w:cols/w:col"> + <style:column> + <xsl:attribute name="style:rel-width"> + <xsl:value-of select="concat(@w:w, '*')"/> + </xsl:attribute> + <xsl:attribute name="fo:start-indent"> + <xsl:value-of select="'0cm'"/> + </xsl:attribute> + <xsl:attribute name="fo:end-indent"> + <xsl:choose> + <xsl:when test="@w:space"> + <xsl:value-of select="concat(@w:space div 567.0, 'cm')"/> + </xsl:when> + <xsl:otherwise>0cm</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </style:column> +</xsl:for-each> +</style:columns> +</xsl:template> + +<an:text-properties + context-node-input="w:rPr" + context-node-output="style:text-properties"> +</an:text-properties > +<xsl:template name="text-properties"> +<xsl:variable name="b-value"> + <xsl:choose> + <xsl:when test="w:b/@val"> + <xsl:value-of select="w:b/@val"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name(w:b)"/> + </xsl:otherwise> + </xsl:choose> +</xsl:variable> +<!-- could be simplified: is "b" actually a valid value of w:b/@val ? --> +<xsl:variable name="font-weight"> + <xsl:choose> + <xsl:when test="$b-value = 'on'">bold</xsl:when> + <xsl:when test="$b-value = 'off'">normal</xsl:when> + <xsl:when test="$b-value = 'b'">bold</xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> +</xsl:variable> +<xsl:attribute name="fo:font-weight"> + <xsl:value-of select="$font-weight"/> +</xsl:attribute> +<xsl:attribute name="style:font-weight-asian"> + <xsl:value-of select="$font-weight"/> +</xsl:attribute> +<xsl:attribute name="style:font-weight-complex"> + <xsl:variable name="b-cs-value"> + <xsl:choose> + <xsl:when test="w:b-cs/@val"> + <xsl:value-of select="w:b-cs/@val"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name(w:b-cs)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- could be simplified: is "b-cs" actually a valid value of w:b-cs/@val --> + <xsl:choose> + <xsl:when test="$b-cs-value = 'on'">bold</xsl:when> + <xsl:when test="$b-cs-value = 'off'">normal</xsl:when> + <xsl:when test="$b-cs-value = 'b-cs'">bold</xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> +</xsl:attribute> +<xsl:variable name="i-value"> + <xsl:choose> + <xsl:when test="w:i/@val"> + <xsl:value-of select="w:i/@val"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name(w:i)"/> + </xsl:otherwise> + </xsl:choose> +</xsl:variable> +<!-- could be simplified: is "i" actually a valid value of w:i/@val ? --> +<xsl:variable name="font-style"> + <xsl:choose> + <xsl:when test="$i-value = 'on'">italic</xsl:when> + <xsl:when test="$i-value = 'off'">normal</xsl:when> + <xsl:when test="$i-value = 'i'">italic</xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> +</xsl:variable> +<xsl:attribute name="fo:font-style"> + <xsl:value-of select="$font-style"/> +</xsl:attribute> +<xsl:attribute name="style:font-style-asian"> + <xsl:value-of select="$font-style"/> +</xsl:attribute> +<xsl:attribute name="style:font-style-complex"> + <xsl:variable name="i-cs-value"> + <xsl:choose> + <xsl:when test="w:i-cs/@val"> + <xsl:value-of select="w:i-cs/@val"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name(w:i-cs)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- could be simplified: is "i-cs" actually a valid value of w:i-cs/@val --> + <xsl:choose> + <xsl:when test="$i-cs-value = 'on'">italic</xsl:when> + <xsl:when test="$i-cs-value = 'off'">normal</xsl:when> + <xsl:when test="$i-cs-value = 'i-cs'">italic</xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> +</xsl:attribute> +<xsl:attribute name="fo:text-transform"> + <xsl:variable name="caps-value"> + <xsl:choose> + <xsl:when test="w:caps/@val"> + <xsl:value-of select="w:caps/@val"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name(w:caps)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- could be simplified: is "caps" actually a valid value of w:caps/@val --> + <xsl:choose> + <xsl:when test="$caps-value = 'on'">uppercase</xsl:when> + <xsl:when test="$caps-value = 'off'">normal</xsl:when> + <xsl:when test="$caps-value = 'caps'">uppercase</xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> +</xsl:attribute> +<xsl:attribute name="fo:font-variant"> + <xsl:variable name="small-caps-value"> + <xsl:choose> + <xsl:when test="w:smallCaps/@val"> + <xsl:value-of select="w:smallCaps/@val"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name(w:smallCaps)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- could be simplified: is "smallCaps" actually a valid value of w:smallCaps/@val --> + <xsl:choose> + <xsl:when test="$small-caps-value = 'on'">small-caps</xsl:when> + <xsl:when test="$small-caps-value = 'off'">normal</xsl:when> + <xsl:when test="$small-caps-value = 'smallCaps'">small-caps</xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> +</xsl:attribute> +</xsl:template> + +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl new file mode 100644 index 000000000..9f8ac81b0 --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl @@ -0,0 +1,60 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v"> + <xsl:template match="w:docPr"> + <office:settings> + <config:config-item-set config:name="view-settings"> + <config:config-item config:name="InBrowseMode" config:type="boolean"> + <xsl:choose> + <xsl:when test="w:view/@w:val = 'outline'">true</xsl:when> + <xsl:when test="w:view/@w:val = 'print'">false</xsl:when> + <!-- others: web, reading, normal, master-pages, none. glu --> + <xsl:otherwise>true</xsl:otherwise> + </xsl:choose> + </config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <xsl:if test="w:zoom"> + <!-- VisibleRight and VisibleBottom are arbitrary positive numbers. ;) glu --> + <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item> + <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item> + <xsl:choose> + <xsl:when test="w:zoom/@w:val = 'best-fit'"> + <config:config-item config:name="ZoomType" config:type="short">3</config:config-item> + </xsl:when> + <xsl:when test="w:zoom/@w:val = 'full-page'"> + <config:config-item config:name="ZoomType" config:type="short">2</config:config-item> + </xsl:when> + <xsl:when test="w:zoom/@w:val = 'text-fit'"> + <config:config-item config:name="ZoomType" config:type="short">1</config:config-item> + </xsl:when> + <xsl:otherwise> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + </xsl:otherwise> + </xsl:choose> + <config:config-item config:name="ZoomFactor" config:type="short"> + <xsl:value-of select="w:zoom/@w:percent"/> + </config:config-item> + </xsl:if> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + </office:settings> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_table.xsl b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl new file mode 100644 index 000000000..6bc520268 --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl @@ -0,0 +1,1277 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v"> + <xsl:template match="w:style[@w:type='table']" mode="table"> + <style:style style:family="table"> + <xsl:attribute name="style:name"> + <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + <xsl:if test="w:basedOn"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:if> + <style:table-properties table:align="margins"/> + </style:style> + </xsl:template> + <xsl:template match="w:tblPr" mode="style"> + <xsl:variable name="table-number"> + <xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1" /> + </xsl:variable> + <xsl:element name="style:style"> + <xsl:attribute name="style:name"> + <xsl:text>Table</xsl:text> + <xsl:value-of select="$table-number"/> + </xsl:attribute> + <xsl:attribute name="style:family">table</xsl:attribute> + <xsl:if test="w:tblStyle"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="concat('w',translate(w:tblStyle/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:if> + <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/> + <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/> + <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/> + <xsl:variable name="last-next-p-tbl" select="$last-section-property[last()]/following::*[name()='w:p' or name()='w:tbl']"/> + <xsl:choose> + <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-next-p-tbl[1]) = generate-id(..) and not(ancestor::w:sectPr or ancestor::w:styles)"> + <xsl:attribute name="style:master-page-name"> + <xsl:text>Standard</xsl:text> + <xsl:value-of select="$section-property-number + 1" /> + </xsl:attribute> + </xsl:when> + <xsl:when test="$table-number = 1 and not(preceding::w:p[ancestor::w:body])"> + <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:element name="style:table-properties"> + <xsl:choose> + <xsl:when test="w:jc/@w:val = 'left' or w:jc/@w:val = 'center' or w:jc/@w:val = 'right'"> + <xsl:attribute name="table:align"> + <xsl:value-of select="w:jc/@w:val"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="table:align">margins</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!-- adopt the width of table and column corresponding the width of page and margins. . --> + <xsl:variable name="sectPr" select="following::w:sectPr[1]"/> + <xsl:variable name="total-page-size" select="$sectPr/w:pgSz/@w:w"/> + <xsl:variable name="page-left-mar" select="$sectPr/w:pgMar/@w:left"/> + <xsl:variable name="page-right-mar" select="$sectPr/w:pgMar/@w:right"/> + <xsl:variable name="page-size-value" select="$total-page-size - $page-left-mar - $page-right-mar"/> + <xsl:variable name="page-size-inch"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat($page-size-value, 'twip') "/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="gridcols" select="../w:tblGrid/w:gridCol"/> + <xsl:variable name="tblsize" select="sum($gridcols/@w:w)"/> + <xsl:variable name="table_indent"> + <xsl:choose> + <xsl:when test="w:tblInd and w:tblInd/@w:w > 0 "> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat(w:tblInd/@w:w, 'twip') "/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="number( '0') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rel-tblsize"> + <xsl:choose> + <xsl:when test="w:tblW/@w:type = 'pct'"> + <xsl:value-of select="(number(w:tblW/@w:w ) div 5000) * $page-size-inch"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat($tblsize, 'twip')"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:width"> + <xsl:value-of select="concat($rel-tblsize, 'in' )"/> + </xsl:attribute> + <xsl:variable name="tbl_margin_left"> + <xsl:choose> + <xsl:when test="not(w:tblpPr ) "> + <xsl:choose> + <xsl:when test="w:bidiVisual"> + <xsl:choose> + <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) > 0"> + <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$table_indent"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="w:tblpPr"> + <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 --> + <xsl:text>0</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="tbl_margin_right"> + <xsl:choose> + <xsl:when test="not(w:tblpPr ) "> + <xsl:choose> + <xsl:when test="w:bidiVisual"> + <xsl:value-of select="$table_indent"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) > 0"> + <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="w:tblpPr"> + <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 --> + <xsl:text>0</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="fo:margin-left"> + <xsl:value-of select="concat( $tbl_margin_left, 'in')"/> + </xsl:attribute> + <xsl:attribute name="fo:margin-right"> + <xsl:value-of select="concat($tbl_margin_right, 'in')"/> + </xsl:attribute> + <!-- If previous w:p has a page break, the table must have the page break attribute applied to it May need this for tables starting on new pages --> + <!-- <xsl:if test="parent::w:tbl/preceding-sibling::w:p[1][descendant::w:br/@w:type='page']"> + <xsl:attribute name="fo:break-before">page</xsl:attribute></xsl:if> --> + <!-- initial values for tables--> + </xsl:element> + </xsl:element> + <!-- the following style is for converting Word table text wrapping to SO Writer. Since SO Writer has no table text wrapping feature, so we use the draw:text-box as a container and put the table in draw:text-box --> + <xsl:if test="w:tblpPr"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">TableFrame<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/> + </xsl:attribute> + <xsl:attribute name="style:family">graphic</xsl:attribute> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select=" 'Frame' "/> + </xsl:attribute> + <xsl:element name="style:graphic-properties"> + <xsl:if test="w:tblpPr/@w:leftFromText"> + <xsl:variable name="left_margin_from_text"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat (w:tblpPr/@w:leftFromText, 'twip') "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:margin-left"> + <xsl:value-of select="concat( $left_margin_from_text, 'in') "/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:tblpPr/@w:rightFromText"> + <xsl:variable name="right_margin_from_text"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat (w:tblpPr/@w:rightFromText, 'twip') "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:margin-right"> + <xsl:value-of select="concat( $right_margin_from_text, 'in') "/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:tblpPr/@w:topFromText"> + <xsl:variable name="top_margin_from_text"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat (w:tblpPr/@w:topFromText, 'twip') "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:margin-top"> + <xsl:value-of select="concat( $top_margin_from_text, 'in') "/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:tblpPr/@w:bottomFromText"> + <xsl:variable name="bottom_margin_from_text"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat (w:tblpPr/@w:bottomFromText, 'twip') "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="fo:margin-bottom"> + <xsl:value-of select="concat( $bottom_margin_from_text, 'in') "/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="style:number-wrapped-paragraphs"> + <xsl:text>no-limit</xsl:text> + </xsl:attribute> + <!--xsl:if test="w:tblpPr/@w:tblpYSpec" to get the vertical alignment--> + <xsl:variable name="vertical_alignment"> + <xsl:choose> + <xsl:when test="w:tblpPr/@w:tblpYSpec = 'top' "> + <xsl:text>top</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpYSpec = 'center' "> + <xsl:text>middle</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpYSpec= 'bottom' "> + <xsl:text>bottom</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpYSpec = 'inside' "> + <xsl:text>from-top</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpYSpec= 'outside' "> + <xsl:text>top</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>from-top</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:vertical-pos"> + <xsl:value-of select="$vertical_alignment"/> + </xsl:attribute> + <!--/xsl:if--> + <!--xsl:if test="w:tblpPr/@w:vertAnchor" to get the vertical anchor related area type --> + <xsl:variable name="frame_v_anchor"> + <xsl:choose> + <xsl:when test="w:tblpPr/@w:vertAnchor = 'text' "> + <xsl:value-of select=" 'paragraph' "/> + </xsl:when> + <xsl:when test="w:tblpPr/@w:vertAnchor = 'margin' "> + <xsl:value-of select=" 'paragraph-content' "/> + </xsl:when> + <xsl:when test="w:tblpPr/@w:vertAnchor = 'page' "> + <xsl:value-of select="w:tblpPr/@w:vertAnchor"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" 'page-content' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:vertical-rel"> + <xsl:value-of select="$frame_v_anchor"/> + </xsl:attribute> + <!--/xsl:if--> + <!--xsl:if test="w:tblpPr/@w:tblpXSpec" to get the horizontal alignment--> + <xsl:variable name="horizental_alignment"> + <xsl:choose> + <xsl:when test="w:tblpPr/@w:tblpXSpec = 'left' "> + <xsl:text>left</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpXSpec = 'center' "> + <xsl:text>center</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpXSpec = 'right' "> + <xsl:text>right</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpXSpec = 'inside' "> + <xsl:text>from-left</xsl:text> + </xsl:when> + <xsl:when test="w:tblpPr/@w:tblpXSpec = 'outside' "> + <xsl:text>outside</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>left</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:horizontal-pos"> + <xsl:value-of select="$horizental_alignment"/> + </xsl:attribute> + <!--/xsl:if--> + <!--xsl:if test="w:tblpPr/@w:horzAnchor" to get the horizental anchor related area type--> + <xsl:variable name="frame_h_anchor"> + <xsl:choose> + <xsl:when test="w:tblpPr/@w:horzAnchor = 'text' "> + <xsl:value-of select=" 'paragraph' "/> + </xsl:when> + <xsl:when test="w:tblpPr/@w:horzAnchor = 'margin' "> + <xsl:value-of select=" 'page-content' "/> + </xsl:when> + <xsl:when test="w:tblpPr/@w:horzAnchor = 'page' "> + <xsl:value-of select="w:tblpPr/@w:horzAnchor"/> + </xsl:when> + <xsl:when test="w:tblpPr/@w:horzAnchor= 'inside' "> + <xsl:value-of select=" 'paragraph-start-margin' "/> + </xsl:when> + <xsl:when test="w:tblpPr/@w:horzAnchor= 'outside' "> + <xsl:value-of select=" 'paragraph-end-margin' "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" 'paragraph-content' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:horizontal-rel"> + <xsl:value-of select="$frame_h_anchor"/> + </xsl:attribute> + <!--/xsl:if--> + <xsl:attribute name="fo:background-color"> + <xsl:text>#ffffff</xsl:text> + </xsl:attribute> + <!-- xsl:attribute name="style:background-transparency"><xsl:text>100%</xsl:text></xsl:attribute --> + <xsl:attribute name="style:wrap"> + <xsl:text>parallel</xsl:text> + </xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="w:gridCol" mode="style"> + <xsl:element name="style:style"> + <xsl:attribute name="style:family">table-column</xsl:attribute> + <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/> + </xsl:attribute> + <xsl:element name="style:table-column-properties"> + <xsl:variable name="column_width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat(@w:w, 'twip') "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:column-width"> + <xsl:value-of select="concat($column_width,'in') "/> + </xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="w:trPr" mode="style"> + <!-- to generate style:style of table-row height. --> + <xsl:element name="style:style"> + <xsl:attribute name="style:family">table-row</xsl:attribute> + <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/> + </xsl:attribute> + <xsl:element name="style:table-row-properties"> + <xsl:choose> + <xsl:when test="w:trHeight/@w:val"> + <xsl:variable name="tbl_row_height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat(w:trHeight/@w:val, 'twip') "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style:min-row-height"> + <xsl:value-of select="concat($tbl_row_height, 'in' )"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="w:tcPr" mode="style"> + <style:style> + <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/> + </xsl:attribute> + <xsl:attribute name="style:family">table-cell</xsl:attribute> + <xsl:variable name="rootStyle" select="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val"/> + <xsl:variable name="rootStyleNode" select="/w:wordDocument/w:styles/w:style[@w:styleId = $rootStyle]"/> + <xsl:element name="style:table-cell-properties"> + <!-- cell background color start --> + <xsl:variable name="tbl_cell_background_color"> + <xsl:choose> + <xsl:when test="w:shd/@w:fill"> + <xsl:value-of select="w:shd/@w:fill"/> + </xsl:when> + <xsl:when test="$rootStyleNode/w:tblpr/w:shd/@w:fill"> + <xsl:value-of select="$rootStyleNode/w:tblpr/w:shd/@w:fill"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test=" string-length($tbl_cell_background_color) > 0 and not( $tbl_cell_background_color ='auto' )"> + <xsl:attribute name="fo:background-color"> + <xsl:value-of select="concat('#',$tbl_cell_background_color)"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <!--cell background color end --> + <!-- table cell vertical alignment start --> + <xsl:if test="w:vAlign"> + <xsl:variable name="tbl_cell_alignment"> + <xsl:choose> + <xsl:when test="w:vAlign/@w:val = 'top' "> + <xsl:text>top</xsl:text> + </xsl:when> + <xsl:when test="w:vAlign/@w:val = 'center' "> + <xsl:text>middle</xsl:text> + </xsl:when> + <xsl:when test="w:vAlign/@w:val = 'bottom' "> + <xsl:text>bottom</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>automatic</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:vertical-align"> + <xsl:value-of select="$tbl_cell_alignment"/> + </xsl:attribute> + </xsl:if> + <!--table cell alignment end --> + <!-- cell margin start --> + <xsl:variable name="tblcell_leftmargin"> + <xsl:choose> + <xsl:when test="w:tcMar/w:left"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat(w:tcMar/w:left/@w:w , w:tcMar/w:left/@w:type) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:left"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:type)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="tblcell_rightmargin"> + <xsl:choose> + <xsl:when test="w:tcMar/w:right"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat(w:tcMar/w:right/@w:w , w:tcMar/w:right/@w:type) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:right"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:type)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="tblcell_topmargin"> + <xsl:choose> + <xsl:when test="w:tcMar/w:top"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat(w:tcMar/w:top/@w:w , w:tcMar/w:top/@w:type) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:top"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:type)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="tblcell_bottommargin"> + <xsl:choose> + <xsl:when test="w:tcMar/w:bottom"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat(w:tcMar/w:bottom/@w:w , w:tcMar/w:bottom/@w:type) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:bottom"> + <xsl:call-template name="convert2in_special"> + <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:type)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="string-length($tblcell_leftmargin) > 0 "> + <xsl:attribute name="fo:padding-left"> + <xsl:value-of select="concat($tblcell_leftmargin, 'in' )"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($tblcell_rightmargin) > 0"> + <xsl:attribute name="fo:padding-right"> + <xsl:value-of select="concat($tblcell_rightmargin, 'in' )"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($tblcell_topmargin) > 0 "> + <xsl:attribute name="fo:padding-top"> + <xsl:value-of select="concat($tblcell_topmargin, 'in' )"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($tblcell_bottommargin) > 0"> + <xsl:attribute name="fo:padding-bottom"> + <xsl:value-of select="concat($tblcell_bottommargin, 'in' )"/> + </xsl:attribute> + </xsl:if> + <!-- cell margin end --> + <xsl:variable name="row-position"> + <xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/> + </xsl:variable> + <!-- cell borders should be carefully converted. a little complex. glu :( --> + <xsl:variable name="Borders" select="ancestor::w:tbl/w:tblPr/w:tblBorders"/> + <xsl:choose> + <xsl:when test="$row-position > 1"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'top'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/> + <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'top'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/> + <xsl:with-param name="style-position-1" select="$Borders/w:top"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:top"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="count(ancestor::w:tr/following-sibling::w:tr) > 0"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'bottom'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/> + <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'bottom'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/> + <xsl:with-param name="style-position-1" select="$Borders/w:bottom"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:bottom"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="count(ancestor::w:tc/preceding-sibling::w:tc) > 0"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'left'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/> + <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'left'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/> + <xsl:with-param name="style-position-1" select="$Borders/w:left"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:left"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="count(ancestor::w:tc/following-sibling::w:tc) > 0"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'right'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/> + <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'right'"/> + <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/> + <xsl:with-param name="style-position-1" select="$Borders/w:right"/> + <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:right"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </style:style> + </xsl:template> + <xsl:template name="get-table-border"> + <xsl:param name="style-pos"/> + <xsl:param name="style-position-0"/> + <xsl:param name="style-position-1"/> + <xsl:param name="style-position-2"/> + <xsl:variable name="size-style"> + <xsl:choose> + <xsl:when test="$style-position-0"> + <xsl:value-of select="$style-position-0/@w:sz"/> + </xsl:when> + <xsl:when test="$style-position-1"> + <xsl:value-of select="$style-position-1/@w:sz"/> + </xsl:when> + <xsl:when test="$style-position-2"> + <xsl:value-of select="$style-position-2/@w:sz"/> + </xsl:when> + <xsl:otherwise>2</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="border-style"> + <xsl:choose> + <xsl:when test="$style-position-0"> + <xsl:value-of select="$style-position-0/@w:val"/> + </xsl:when> + <xsl:when test="$style-position-1"> + <xsl:value-of select="$style-position-1/@w:val"/> + </xsl:when> + <xsl:when test="$style-position-2"> + <xsl:value-of select="$style-position-2/@w:val"/> + </xsl:when> + <xsl:otherwise>single</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="color-border"> + <xsl:choose> + <xsl:when test="$style-position-0 and string-length($style-position-0/@w:color) = 6"> + <xsl:value-of select="$style-position-0/@w:color"/> + </xsl:when> + <xsl:when test="$style-position-0 and $style-position-0/@w:color = 'auto' and contains($border-style, 'set')"> + <xsl:text>c0c0c0</xsl:text> + </xsl:when> + <xsl:when test="$style-position-1 and string-length($style-position-1/@w:color) = 6"> + <xsl:value-of select="$style-position-1/@w:color"/> + </xsl:when> + <xsl:when test="$style-position-1 and $style-position-1/@w:color = 'auto' and contains($border-style, 'set')"> + <xsl:text>c0c0c0</xsl:text> + </xsl:when> + <xsl:when test="$style-position-2 and string-length($style-position-2/@w:color) = 6"> + <xsl:value-of select="$style-position-2/@w:color"/> + </xsl:when> + <xsl:when test="$style-position-2 and $style-position-2/@w:color = 'auto' and contains($border-style, 'set')"> + <xsl:text>c0c0c0</xsl:text> + </xsl:when> + <xsl:otherwise>000000</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- mapping border line widths. glu --> + <xsl:choose> + <xsl:when test="$border-style = 'nil' or $border-style = 'none'"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}">hidden</xsl:attribute> + </xsl:when> + <xsl:when test="$border-style = 'single'"> + <xsl:choose> + <xsl:when test="$size-style < 7"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.002cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 20"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.035cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 30"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.088cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 40"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.141cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.176cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'double'"> + <xsl:choose> + <xsl:when test="$size-style < 10"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.039cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 15"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.092cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 20"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.106cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.265cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'triple'"> + <xsl:choose> + <xsl:when test="$size-style < 5"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.039cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 10"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.092cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">.002cm 0.088cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 15"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.106cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.265cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'thin-thick-small-gap' or $border-style = 'thick-thin-small-gap'"> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-small-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-small-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:choose> + <xsl:when test="$size-style < 20"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.125cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 30"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.178cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.231cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'thin-thick-thin-small-gap'"> + <xsl:choose> + <xsl:when test="$size-style < 20"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.178cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 40"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.231cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.318cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'thin-thick-medium-gap' or $border-style = 'thick-thin-medium-gap'"> + <xsl:choose> + <xsl:when test="$size-style < 10"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.039cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 15"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.106cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 30"> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.212cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.318cm double #', $color-border)"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'thin-thick-thin-medium-gap'"> + <xsl:choose> + <xsl:when test="$size-style < 10"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.039cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 15"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.106cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 30"> + <xsl:choose> + <xsl:when test="$style-pos = 'left' or $style-pos = 'top'"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.212cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.318cm double #', $color-border)"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="$style-pos = 'left' or $style-pos = 'top'"> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'thin-thick-large-gap' or $border-style = 'thick-thin-large-gap'"> + <xsl:choose> + <xsl:when test="$size-style < 7"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.092cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 10"> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.125cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.092cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$size-style < 15"> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.125cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$size-style < 30"> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.178cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$size-style < 40"> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.231cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.318cm double #', $color-border)"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'thin-thick-thin-large-gap'"> + <xsl:choose> + <xsl:when test="$size-style < 5"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.125cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 10"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.178cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 20"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.231cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.318cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="contains( $border-style, 'wave') or $border-style = 'dash-dot-stroked'"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.106cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:when test="contains( $border-style, 'three-d')"> + <xsl:choose> + <xsl:when test="$size-style < 10"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.035cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 20"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.088cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 30"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.176cm solid #', $color-border)"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 40"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.265cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.318cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="contains( $border-style, 'set')"> + <xsl:choose> + <xsl:when test="$size-style < 7"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.092cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:when test="$size-style < 10"> + <xsl:choose> + <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.092cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.125cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$size-style < 15"> + <xsl:choose> + <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.125cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$size-style < 30"> + <xsl:choose> + <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.178cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$size-style < 40"> + <xsl:choose> + <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.159cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.231cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.318cm double #', $color-border)"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}"> + <xsl:value-of select="concat('0.231cm double #', $color-border)"/> + </xsl:attribute> + <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{concat('fo:border-', $style-pos)}">0.002cm solid #000000</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="w:tbl"> + <xsl:choose> + <xsl:when test="w:tblPr/w:tblpPr"> + <!-- if the table is surrounded by text then put the table into a draw:text-box --> + <xsl:element name="text:p"> + <xsl:element name="draw:frame"> + <xsl:attribute name="draw:style-name"> + <xsl:text>TableFrame</xsl:text> + <xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/> + </xsl:attribute> + <xsl:attribute name="draw:name">TableFr<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/> + </xsl:attribute> + <xsl:variable name="tbl_anchor_type"> + <xsl:choose> + <xsl:when test="name(..) = 'w:tc' "> + <xsl:text>as-char</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>paragraph</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="text:anchor-type"> + <xsl:value-of select="$tbl_anchor_type"/> + </xsl:attribute> + <xsl:variable name="tbl_draw_textbox_width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <!-- adjust the width of draw:text-box containing a table with 20dxa + table-width --> + <xsl:with-param name="value" select="concat(string(number(sum(w:tblGrid/w:gridCol/@w:w) +20)), 'twip' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="svg:width"> + <xsl:value-of select="concat ($tbl_draw_textbox_width, 'in') "/> + </xsl:attribute> + <xsl:if test="w:tblPr/w:tblpPr/@w:tblpX"> + <xsl:variable name="x_distance_from_anchor"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpX, 'twip' ) "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="svg:x"> + <xsl:value-of select="concat ($x_distance_from_anchor, 'in' )"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:tblPr/w:tblpPr/@w:tblpY"> + <xsl:variable name="y_distance_from_anchor"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpY, 'twip' ) "/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="svg:y"> + <xsl:value-of select="concat ($y_distance_from_anchor, 'in' )"/> + </xsl:attribute> + </xsl:if> + <!--create table in draw:text-box to produce table wrapping text effect--> + <xsl:element name="draw:text-box"> + <xsl:element name="table:table"> + <xsl:if test="w:tblPr"> + <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="dispatch"/> + </xsl:element> + </xsl:element> + </xsl:element> + <!--draw:text-box end --> + </xsl:element> + <!-- text:p end --> + </xsl:when> + <xsl:otherwise> + <!-- if the table is not surrounded by text then put the table into a draw:text-box --> + <xsl:element name="table:table"> + <xsl:if test="w:tblPr"> + <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="dispatch"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="w:tblGrid"> + <xsl:apply-templates select="w:gridCol"/> + </xsl:template> + <xsl:template match="w:gridCol"> + <xsl:element name="table:table-column"> + <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/> + </xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="w:tr"> + <xsl:element name="table:table-row"> + <!-- generate row in table and add attribute of table:style-name if the style:style exists. cp tom chen. --> + <xsl:if test="w:trPr/w:trHeight"> + <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="dispatch"/> + </xsl:element> + </xsl:template> + <xsl:template match="w:tc"> + <xsl:element name="table:table-cell"> + <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/> + </xsl:attribute> + <xsl:if test="w:tcPr/w:gridSpan and w:tcPr/w:gridSpan/@w:val > 0"> + <xsl:attribute name="table:number-columns-spanned"> + <xsl:value-of select="w:tcPr/w:gridSpan/@w:val"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="dispatch"/> + </xsl:element> + </xsl:template> + <xsl:template name="convert2in_special"> + <!-- this template is specially to deal with w:type ='dxa' situation --> + <xsl:param name="original_value"/> + <xsl:choose> + <xsl:when test="contains($original_value, 'dxa') "> + <xsl:variable name="table_measurement_new_value"> + <xsl:value-of select="concat( substring-before($original_value,'dxa'), 'twip')"/> + </xsl:variable> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="$table_measurement_new_value"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/import/wordml/wordml2ooo_text.xsl b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl new file mode 100644 index 000000000..e2b94b3ec --- /dev/null +++ b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl @@ -0,0 +1,1049 @@ +<?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:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v"> + <xsl:template name="create-default-paragraph-styles"> + <xsl:variable name="default-paragraph-style" select="w:style[@w:default = 'on' and @w:type = 'paragraph']"/> + <xsl:if test="$default-paragraph-style"> + <style:default-style style:family="paragraph"> + <style:paragraph-properties> + <xsl:attribute name="style:tab-stop-distance"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(/w:wordDocument/w:docPr/w:defaultTabStop/@w:val,'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true"> + <xsl:choose> + <xsl:when test="/w:wordDocument/w:fonts/w:defaultFonts"> + <xsl:attribute name="style:font-name"> + <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:ascii"/> + </xsl:attribute> + <xsl:attribute name="style:font-name-asian"> + <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:fareast"/> + </xsl:attribute> + <xsl:attribute name="style:font-name-complex"> + <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:cs"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$default-paragraph-style/w:rPr/w:sz"> + <xsl:attribute name="fo:font-size"> + <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"> + <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="$default-paragraph-style/w:rPr/w:sz-cs"> + <xsl:attribute name="style:font-size-complex"> + <xsl:value-of select="$default-paragraph-style/w:rPr/w:sz-cs/@w:val div 2"/>pt</xsl:attribute> + </xsl:if> + <!-- if not defined default font size in Word, make it out as 10pt. glu --> + <xsl:if test="not($default-paragraph-style/w:rPr/w:sz or w:rPr/w:sz-cs)"> + <xsl:attribute name="fo:font-size">10pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian">10pt</xsl:attribute> + <xsl:attribute name="style:font-size-complex">10pt</xsl:attribute> + </xsl:if> + <xsl:if test="$default-paragraph-style/w:rPr/w:lang"> + <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:val"> + <xsl:attribute name="fo:language"> + <xsl:choose> + <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')"> + <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/> + </xsl:otherwise> + </xsl:choose> + <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/ --> + </xsl:attribute> + <xsl:attribute name="fo:country"> + <xsl:choose> + <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')"> + <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/> + </xsl:otherwise> + </xsl:choose> + <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/--> + </xsl:attribute> + </xsl:if> + <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:fareast"> + <xsl:attribute name="style:language-asian"> + <xsl:choose> + <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"> + <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/> + </xsl:otherwise> + </xsl:choose> + <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/--> + </xsl:attribute> + <xsl:attribute name="style:country-asian"> + <xsl:choose> + <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"> + <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/> + </xsl:otherwise> + </xsl:choose> + <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/ --> + </xsl:attribute> + </xsl:if> + <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:bidi"> + <xsl:attribute name="style:language-complex"> + <xsl:choose> + <xsl:when test="contains( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-') "> + <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi "/> + </xsl:otherwise> + </xsl:choose> + <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/--> + </xsl:attribute> + <xsl:attribute name="style:country-complex"> + <xsl:choose> + <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"> + <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi"/> + </xsl:otherwise> + </xsl:choose> + <!-- xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/ --> + </xsl:attribute> + </xsl:if> + </xsl:if> + </style:text-properties> + </style:default-style> + </xsl:if> + </xsl:template> + <xsl:template name="create-default-text-styles"> + <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/> + <style:style style:name="Numbering_20_Symbols" style:display-name="Numbering Symbols" style:family="text"/> + <style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text"> + <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/> + </style:style> + <style:style style:name="Endnote_20_Symbol" style:display-name="Endnote Symbol" style:family="text"/> + <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text"> + <style:text-properties style:text-position="super 58%"/> + </style:style> + </xsl:template> + <xsl:template match="w:p" mode="style"> + <xsl:variable name="paragraph-number"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/> + </xsl:variable> + <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/> + <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/> + <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/> + <style:style style:family="paragraph" style:name="P{$paragraph-number}"> + <xsl:choose> + <xsl:when test="w:pPr/w:pStyle"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))" /> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:parent-style-name">wNormal</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)"> + <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$paragraph-number = 1"> + <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute> + </xsl:when> + </xsl:choose> + <style:paragraph-properties> + <xsl:apply-templates select="w:pPr"/> + </style:paragraph-properties> + <style:text-properties> + <xsl:apply-templates select="w:pPr/w:rPr"/> + <xsl:apply-templates select="w:rPr"/> + </style:text-properties> + </style:style> + <xsl:if test="w:r/w:br/@w:type='page'"> + <style:style style:family="paragraph" style:name="P{$paragraph-number}page-break"> + <xsl:if test="w:pPr/w:pStyle"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)"> + <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$paragraph-number = 1"> + <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute> + </xsl:when> + </xsl:choose> + <style:paragraph-properties fo:break-before="page"> + <xsl:apply-templates select="w:pPr"/> + </style:paragraph-properties> + </style:style> + </xsl:if> + <xsl:if test="w:r/w:br/@w:type='column'"> + <style:style style:family="paragraph" style:name="P{$paragraph-number}column-break"> + <xsl:if test="w:pPr/w:pStyle"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)"> + <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$paragraph-number = 1"> + <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute> + </xsl:when> + </xsl:choose> + <style:paragraph-properties fo:break-before="column"> + <xsl:apply-templates select="w:pPr"/> + </style:paragraph-properties> + </style:style> + </xsl:if> + </xsl:template> + <xsl:template match="w:pPr"> + <xsl:if test="w:ind/@w:left"> + <xsl:attribute name="fo:margin-left"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:ind/@w:left, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:ind/@w:right"> + <xsl:attribute name="fo:margin-right"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:ind/@w:right, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:ind/@w:first-line"> + <xsl:attribute name="fo:text-indent"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:ind/@w:first-line, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:ind/@w:hanging"> + <xsl:attribute name="fo:text-indent"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat('-',w:ind/@w:hanging, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <!-- bi-directional support--> + <xsl:if test="w:bidi"> + <xsl:choose> + <xsl:when test="w:bidi/@w:val = 'off'"> + <xsl:attribute name="fo:text-align">start</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute> + <xsl:attribute name="fo:text-align">end</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="w:jc"> + <xsl:choose> + <xsl:when test="w:jc/@w:val = 'center'"> + <xsl:attribute name="fo:text-align">center</xsl:attribute> + </xsl:when> + <xsl:when test="w:jc/@w:val = 'left'"> + <xsl:choose> + <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')"> + <xsl:attribute name="fo:text-align">end</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:text-align">start</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="w:jc/@w:val = 'right'"> + <xsl:choose> + <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')"> + <xsl:attribute name="fo:text-align">start</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:text-align">end</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="fo:text-align">justify</xsl:attribute> + <xsl:attribute name="style:justify-single-word">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="w:spacing"> + <xsl:choose> + <xsl:when test="w:spacing/@w:line-rule = 'at-least'"> + <xsl:attribute name="style:line-height-at-least"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:when> + <xsl:when test="w:spacing/@w:line-rule = 'auto'"> + <xsl:attribute name="fo:line-height"> + <xsl:value-of select="round(w:spacing/@w:line div 240 * 100)"/>%</xsl:attribute> + </xsl:when> + <xsl:when test="w:spacing/@w:line-rule = 'exact'"> + <xsl:attribute name="fo:line-height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="w:spacing/@w:before"> + <xsl:attribute name="fo:margin-top"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:spacing/@w:before, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:spacing/@w:after"> + <xsl:attribute name="fo:margin-bottom"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:spacing/@w:after, 'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="w:shd"> + <xsl:variable name="background-color"> + <xsl:choose> + <xsl:when test="string-length(w:shd/@w:fill) = 6"> + <xsl:value-of select="concat('#', w:shd/@w:fill)"/> + </xsl:when> + <xsl:otherwise>#000000</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="w:shd/@w:val = 'solid'"> + <xsl:attribute name="fo:background-color"> + <xsl:value-of select="$background-color"/> + </xsl:attribute> + </xsl:when> + <!-- patterns are necessary in the future. glu --> + <xsl:otherwise/> + </xsl:choose> + </xsl:if> + <xsl:if test="w:pageBreakBefore and not(w:pageBreakBefore/@w:val = 'off')"> + <xsl:attribute name="fo:break-before">page</xsl:attribute> + </xsl:if> + <xsl:if test="w:pageBreakBefore and w:pageBreakBefore/@w:val = 'off'"> + <xsl:attribute name="fo:break-before">auto</xsl:attribute> + </xsl:if> + <xsl:if test="w:keepNext"> + <xsl:attribute name="fo:keep-with-next">always</xsl:attribute> + </xsl:if> + <!-- + <xsl:if test="w:keepLines"> + <xsl:attribute name="style:break-inside">avoid</xsl:attribute> + </xsl:if> + --> + <xsl:if test="w:widowControl='on'"> + <xsl:attribute name="fo:widows">2</xsl:attribute> + <xsl:attribute name="fo:orphans">2</xsl:attribute> + </xsl:if> + <!-- + <xsl:if test="w:suppressAutoHyphens"> + <xsl:attribute name="fo:hyphenate">false</xsl:attribute> + </xsl:if> + --> + <xsl:if test="w:kinsoku/@w:val='off'"> + <xsl:attribute name="style:line-break">normal</xsl:attribute> + </xsl:if> + <xsl:if test="w:overflowPunct/@w:val='off'"> + <xsl:attribute name="style:punctuation-wrap">simple</xsl:attribute> + </xsl:if> + <xsl:if test="w:autoSpaceDE/@w:val='off' or w:autoSpaceDN/@w:val='off'"> + <xsl:attribute name="style:text-autospace">none</xsl:attribute> + </xsl:if> + <xsl:if test="w:textAlignment"> + <xsl:choose> + <xsl:when test="w:textAlignment/@w:val='center'"> + <xsl:attribute name="style:vertical-align">middle</xsl:attribute> + </xsl:when> + <xsl:when test="w:textAlignment/@w:val='baseline'"> + <xsl:attribute name="style:vertical-align">bottom</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:vertical-align"> + <xsl:value-of select="w:textAlignment/@w:val"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="w:pBdr"> + <xsl:if test="w:pBdr/w:top"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'top'"/> + <xsl:with-param name="style-position-0" select="w:pBdr/w:top"/> + </xsl:call-template> + <xsl:attribute name="fo:padding-top"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pBdr/w:top/@w:space,'pt')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:pBdr/w:left"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'left'"/> + <xsl:with-param name="style-position-0" select="w:pBdr/w:left"/> + </xsl:call-template> + <xsl:attribute name="fo:padding-left"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pBdr/w:left/@w:space,'pt')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:pBdr/w:right"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'right'"/> + <xsl:with-param name="style-position-0" select="w:pBdr/w:right"/> + </xsl:call-template> + <xsl:attribute name="fo:padding-right"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pBdr/w:right/@w:space,'pt')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:pBdr/w:bottom"> + <xsl:call-template name="get-table-border"> + <xsl:with-param name="style-pos" select="'bottom'"/> + <xsl:with-param name="style-position-0" select="w:pBdr/w:bottom"/> + </xsl:call-template> + <xsl:attribute name="fo:padding-bottom"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:pBdr/w:bottom/@w:space,'pt')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:pBdr/*/@w:shadow='on'"> + <xsl:attribute name="style:shadow">#000000 0.15cm 0.15cm</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="w:snapToGrid/@w:val='off'"> + <xsl:attribute name="style:snap-to-layout-grid">false</xsl:attribute> + </xsl:if> + <xsl:if test="w:tabs"> + <xsl:element name="style:tab-stops"> + <xsl:for-each select="w:tabs/w:tab"> + <xsl:element name="style:tab-stop"> + <xsl:attribute name="style:position"> + <xsl:if test="@w:pos < 0"> + <xsl:message> + We meet a negative w:pos:<xsl:value-of select="@w:pos"/>. + </xsl:message> + <xsl:value-of select="'0cm'"/> + </xsl:if> + <xsl:if test="not(@w:pos < 0)"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(@w:pos, 'twip')"/> + </xsl:call-template>cm</xsl:if> + </xsl:attribute> + <xsl:choose> + <xsl:when test="@w:val = 'decimal'"> + <xsl:attribute name="style:type">char</xsl:attribute> + <xsl:attribute name="style:char"> + <xsl:value-of select="' '"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="@w:val = 'left' or @w:val = 'right' or @w:val = 'center' "> + <xsl:attribute name="style:type"> + <xsl:value-of select="@w:val"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:type">char</xsl:attribute> + <xsl:attribute name="style:char"> + <xsl:value-of select="' '"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <!-- Detect leader chars in tabs (rp) --> + <xsl:choose> + <xsl:when test="@w:leader = 'hyphen'"> + <xsl:attribute name="style:leader-style">solid</xsl:attribute> + <xsl:attribute name="style:leader-text">-</xsl:attribute> + </xsl:when> + <xsl:when test="@w:leader = 'underscore'"> + <xsl:attribute name="style:leader-style">solid</xsl:attribute> + <xsl:attribute name="style:leader-text">_</xsl:attribute> + </xsl:when> + <xsl:when test="@w:leader = 'dot'"> + <xsl:attribute name="style:leader-style">dotted</xsl:attribute> + <xsl:attribute name="style:leader-text">.</xsl:attribute> + </xsl:when> + </xsl:choose> + <!-- end leader chars (rp) --> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:apply-templates select="w:rPr" mode="paragraph-properties"/> + </xsl:template> + <xsl:template match="w:rPr" mode="style"> + <xsl:element name="style:style"> + <xsl:attribute name="style:name">T<xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/> + </xsl:attribute> + <xsl:attribute name="style:family">text</xsl:attribute> + <xsl:if test="w:rStyle"> + <xsl:attribute name="style:parent-style-name"> + <xsl:value-of select="concat('w',translate(w:rStyle/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:if> + <xsl:element name="style:text-properties"> + + <xsl:apply-templates select="current()"/> + <!-- <xsl:call-template name="text-properties"/> --> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template match="w:rPr"> + <xsl:if test="w:rFonts"> + <xsl:if test="w:rFonts/@w:ascii"> + <xsl:attribute name="style:font-name"> + <xsl:value-of select="w:rFonts/@w:ascii"/> + </xsl:attribute> + <xsl:if test="ancestor::w:body"> + <xsl:attribute name="style:font-name-asian"> + <xsl:value-of select="w:rFonts/@w:ascii"/> + </xsl:attribute> + <xsl:attribute name="style:font-name-complex"> + <xsl:value-of select="w:rFonts/@w:ascii"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="ancestor::w:styles"> + <xsl:if test="w:rFonts/@w:fareast"> + <xsl:attribute name="style:font-name-asian"> + <xsl:value-of select="w:rFonts/@w:fareast"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:rFonts/@w:cs"> + <xsl:attribute name="style:font-name-complex"> + <xsl:value-of select="w:rFonts/@w:cs"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + <xsl:if test="parent::w:r"> + <xsl:if test="w:b"> + <xsl:attribute name="fo:font-weight">bold</xsl:attribute> + <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute> + </xsl:if> + <xsl:if test="w:b-cs"> + <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute> + </xsl:if> + <xsl:if test="w:i"> + <xsl:attribute name="fo:font-style">italic</xsl:attribute> + <xsl:attribute name="style:font-style-asian">italic</xsl:attribute> + </xsl:if> + <xsl:if test="w:i-cs"> + <xsl:attribute name="style:font-style-complex">italic</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="w:caps"> + <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute> + </xsl:if> + <xsl:if test="w:smallCaps"> + <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute> + </xsl:if> + <xsl:if test="w:strike"> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + </xsl:if> + <xsl:if test="w:dstrike"> + <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute> + <xsl:attribute name="style:text-line-through-type">double</xsl:attribute> + </xsl:if> + <xsl:if test="w:outline"> + <xsl:attribute name="style:text-outline">true</xsl:attribute> + </xsl:if> + <xsl:if test="w:shadow"> + <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute> + </xsl:if> + <xsl:if test="w:imprint"> + <xsl:attribute name="style:font-relief">engraved</xsl:attribute> + </xsl:if> + <xsl:if test="w:emboss"> + <xsl:attribute name="style:font-relief">embossed</xsl:attribute> + </xsl:if> + <xsl:if test="w:vanish"> + <xsl:attribute name="text:display">true</xsl:attribute> + </xsl:if> + <xsl:if test="w:color[not(@w:val = 'auto')]"> + <xsl:attribute name="fo:color">#<xsl:value-of select="w:color/@w:val"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:spacing"> + <xsl:attribute name="fo:letter-spacing"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="concat(w:spacing/@w:val,'twip')"/> + </xsl:call-template>cm</xsl:attribute> + </xsl:if> + <xsl:if test="w:w/@w:val"> + <xsl:attribute name="style:text-scale"> + <xsl:value-of select="concat(w:w/@w:val, '%')"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:vertAlign or w:position"> + <xsl:variable name="height"> + <xsl:choose> + <xsl:when test="w:vertAlign[@w:val = 'superscript' or @w:val = 'subscript']">58%</xsl:when> + <xsl:otherwise>100%</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="position"> + <xsl:choose> + <xsl:when test="w:position"> + <!-- con't get font height easily, so just set w:val as percentage. glu --> + <xsl:value-of select="concat( w:position/@w:val, '%')"/> + </xsl:when> + <xsl:when test="w:vertAlign[@w:val = 'superscript']">super</xsl:when> + <xsl:when test="w:vertAlign[@w:val = 'subscript']">sub</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="style:text-position"> + <xsl:value-of select="concat($position, ' ', $height)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="w:sz"> + <xsl:attribute name="fo:font-size"> + <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute> + <xsl:attribute name="style:font-size-asian"> + <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="w:sz-cs"> + <xsl:attribute name="style:font-size-complex"> + <xsl:value-of select="w:sz-cs/@w:val div 2"/>pt</xsl:attribute> + </xsl:if> + <xsl:if test="w:highlight"> + <xsl:choose> + <xsl:when test="w:highlight/@w:val='black'"> + <xsl:attribute name="fo:background-color">#000000</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='yellow'"> + <xsl:attribute name="fo:background-color">#ffff00</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='green'"> + <xsl:attribute name="fo:background-color">#00ff00</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='cyan'"> + <xsl:attribute name="fo:background-color">#00ffff</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='magenta'"> + <xsl:attribute name="fo:background-color">#ff00ff</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='blue'"> + <xsl:attribute name="fo:background-color">#0000ff</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='red'"> + <xsl:attribute name="fo:background-color">#ff0000</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='dark-blue'"> + <xsl:attribute name="fo:background-color">#000080</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='dark-cyan'"> + <xsl:attribute name="fo:background-color">#008080</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='dark-green'"> + <xsl:attribute name="fo:background-color">#008000</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='dark-magenta'"> + <xsl:attribute name="fo:background-color">#800080</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='dark-red'"> + <xsl:attribute name="fo:background-color">#800000</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='dark-yellow'"> + <xsl:attribute name="fo:background-color">#808000</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='dark-gray'"> + <xsl:attribute name="fo:background-color">#808080</xsl:attribute> + </xsl:when> + <xsl:when test="w:highlight/@w:val='light-gray'"> + <xsl:attribute name="fo:background-color">#c0c0c0</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="w:u"> + <xsl:if test="w:u/@w:val = 'thick' or contains(w:u/@w:val,'-heavy')"> + <xsl:attribute name="style:text-underline-width">bold</xsl:attribute> + </xsl:if> + <xsl:if test="w:u/@w:val = 'double' or contains(w:u/@w:val,'-double')"> + <xsl:attribute name="style:text-underline-type">double</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="w:u/@w:val = 'words' or w:u/@w:val = 'single' or w:u/@w:val = 'thick' or w:u/@w:val = 'double'"> + <xsl:attribute name="style:text-underline-style">solid</xsl:attribute> + </xsl:when> + <xsl:when test="contains(w:u/@w:val , 'dotted')"> + <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute> + </xsl:when> + <xsl:when test="w:u/@w:val = 'dashed-heavy' or w:u/@w:val = 'dash'"> + <xsl:attribute name="style:text-underline-style">dash</xsl:attribute> + </xsl:when> + <xsl:when test="w:u/@w:val = 'dash-long' or w:u/@w:val = 'dash-long-heavy'"> + <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute> + </xsl:when> + <xsl:when test="w:u/@w:val = 'dash-dot-heavy' or w:u/@w:val = 'dot-dash'"> + <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute> + </xsl:when> + <xsl:when test="w:u/@w:val = 'dash-dot-dot-heavy' or w:u/@w:val = 'dot-dot-dash'"> + <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute> + </xsl:when> + <xsl:when test="w:u/@w:val = 'wavy-heavy' or w:u/@w:val = 'wavy-double' or w:u/@w:val = 'wavy'"> + <xsl:attribute name="style:text-underline-style">wave</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:if test="string-length(style:text-underline-style) > 0"> + <xsl:attribute name="style:text-underline-style"> + <xsl:value-of select="w:u/@w:val"/> + </xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="w:u/@w:color and not(w:u/@w:color = 'auto')"> + <xsl:attribute name="style:text-underline-color">#<xsl:value-of select="w:u/@w:color"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="w:effect[@w:val = 'blink-background']"> + <xsl:attribute name="style:text-blinking">true</xsl:attribute> + </xsl:if> + <xsl:if test="w:shd and not(w:highlight)"> + <xsl:if test="string-length(w:shd/@w:fill) = 6"> + <xsl:attribute name="fo:background-color">#<xsl:value-of select="w:shd/@w:fill"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="w:em"> + <xsl:choose> + <xsl:when test="w:em/@w:val = 'comma'"> + <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute> + </xsl:when> + <xsl:when test="w:em/@w:val = 'under-dot'"> + <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute> + </xsl:when> + <xsl:when test="w:em/@w:val = 'dot' or w:em/@w:val = 'circle' "> + <xsl:attribute name="style:text-emphasize"> + <xsl:value-of select=" concat(w:em/@w:val,' below') "/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style:text-emphasize">none</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="w:lang"> + <xsl:if test="w:lang/@w:val"> + <xsl:attribute name="fo:language"> + <xsl:choose> + <xsl:when test="contains(w:lang/@w:val, '-')"> + <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="w:lang/@w:val"/> + </xsl:otherwise> + </xsl:choose> + <!--xsl:value-of select="substring-before( w:lang/@w:val, '-')"/--> + </xsl:attribute> + <xsl:attribute name="fo:country"> + <xsl:choose> + <xsl:when test="contains(w:lang/@w:val, '-')"> + <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="w:lang/@w:val"/> + </xsl:otherwise> + </xsl:choose> + <!--xsl:value-of select="substring-after( w:lang/@w:val, '-')"/--> + </xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:template> + <xsl:template match="w:rPr" mode="paragraph-properties"> + <!-- right-to-left support--> + <xsl:if test="w:rtl and not(w:rtl/@w:val = 'off')"> + <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute> + <xsl:attribute name="fo:text-align">end</xsl:attribute> + </xsl:if> + </xsl:template> + <xsl:template match="w:p"> + <xsl:choose> + <!-- because word treats page breaks as separate tags, we must split some paragraphs up so that we can + give the sub para a fo:break-before ="page" or column attribute. --> + <xsl:when test="w:r[w:br/@w:type='page' or w:br/@w:type='column']"> + <xsl:call-template name="process-breaks-in-paragraph"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="process-common-paragraph"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="process-breaks-in-paragraph"> + <xsl:variable name="textruns-with-break" select="w:r[w:br/@w:type='page' or w:br/@w:type='column']"/> + <xsl:call-template name="create-sub-paragraph"> + <xsl:with-param name="textruns" select="$textruns-with-break[1]/preceding-sibling::w:r"/> + </xsl:call-template> + <xsl:for-each select="$textruns-with-break"> + <xsl:variable name="break-position" select="position()"/> + <xsl:call-template name="create-sub-paragraph"> + <!-- added following-sibling::w:fldSimple | following-sibling::w:hlink | following-sibling::aml:annotation to enable these elements to be processed when there are breaks happen G.Yang --> + <xsl:with-param name="textruns" select="following-sibling::w:r[not(w:br/@w:type='page' or w:br/@w:type='column') and (count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position)] | following-sibling::w:fldSimple[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::w:hlink[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::aml:annotation[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] "/> + <xsl:with-param name="textruns-with-break" select="current()"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="create-sub-paragraph"> + <xsl:param name="textruns"/> + <xsl:param name="textruns-with-break"/> + <xsl:if test="$textruns or $textruns-with-break"> + <xsl:variable name="curr-num"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/> + </xsl:variable> + <text:p> + <xsl:choose> + <xsl:when test="$textruns-with-break"> + <xsl:attribute name="text:style-name"> + <xsl:value-of select="concat('P',$curr-num,w:br/@w:type, '-break')"/> + </xsl:attribute> + <xsl:apply-templates select="$textruns-with-break"/> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="text:style-name"> + <xsl:value-of select="concat( 'P', $curr-num)"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$textruns"> + <xsl:apply-templates select="$textruns"/> + </xsl:if> + </text:p> + </xsl:if> + </xsl:template> + <xsl:template name="process-common-paragraph"> + <xsl:variable name="heading-or-paragraph"> + <xsl:choose> + <xsl:when test="key('heading-style', w:pPr/w:pStyle/@w:val)">text:h</xsl:when> + <xsl:otherwise>text:p</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="{$heading-or-paragraph}"> + <xsl:if test="$heading-or-paragraph = 'text:h'"> + <xsl:attribute name="text:outline-level"> + <xsl:value-of select="key('heading-style',w:pPr/w:pStyle/@w:val)/w:pPr/w:outlineLvl/@w:val + 1"/> + </xsl:attribute> + </xsl:if> + <xsl:variable name="curr-num"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/> + </xsl:variable> + <xsl:attribute name="text:style-name"> + <xsl:value-of select="concat( 'P', $curr-num)"/> + </xsl:attribute> + <xsl:variable name="bookmark-and-paragraph" select="preceding::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)] | preceding::w:p"/> + <xsl:if test="count($bookmark-and-paragraph) > 0 and name($bookmark-and-paragraph[last()]) = 'aml:annotation'"> + <xsl:call-template name="create-bookmark"> + <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/> + <xsl:with-param name="position" select="count($bookmark-and-paragraph)"/> + </xsl:call-template> + </xsl:if> + <xsl:apply-templates mode="dispatch"/> + <xsl:if test="not(following::w:p)"> + <xsl:apply-templates select="following::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)]"/> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="create-bookmark"> + <xsl:param name="bookmark-and-paragraph"/> + <xsl:param name="position"/> + <xsl:choose> + <xsl:when test="name($bookmark-and-paragraph[$position]) = 'aml:annotation'"> + <xsl:if test="$position > 0"> + <xsl:call-template name="create-bookmark"> + <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/> + <xsl:with-param name="position" select="$position - 1"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="output-bookmark"> + <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/> + <xsl:with-param name="position" select="$position + 1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="output-bookmark"> + <xsl:param name="bookmark-and-paragraph"/> + <xsl:param name="position"/> + <xsl:apply-templates select="$bookmark-and-paragraph[$position]"/> + <xsl:if test="$position < count($bookmark-and-paragraph)"> + <xsl:call-template name="output-bookmark"> + <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/> + <xsl:with-param name="position" select="$position + 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- WordML contains multiple w:t within one w:r, so in Star Writer text:span should correspond to w:t glu --> + <xsl:template match="w:r"> + <xsl:choose> + <xsl:when test="(preceding-sibling::w:r) or (w:rPr)"> + <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.--> + <xsl:if test="not (preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )"> + <text:span> + <xsl:choose> + <xsl:when test="w:rPr/w:rStyle"> + <xsl:attribute name="text:style-name"> + <xsl:value-of select="concat('w', translate(w:rPr/w:rStyle/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="w:rPr"> + <xsl:variable name="position"> + <xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/> + </xsl:variable> + <xsl:attribute name="text:style-name">T<xsl:value-of select="$position + 1"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:apply-templates mode="dispatch"/> + </text:span> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES, etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.--> + <xsl:if test="not( preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )"> + <xsl:apply-templates mode="dispatch"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="aml:annotation"> + <xsl:choose> + <xsl:when test="@w:type = 'Word.Bookmark.Start'"> + <text:bookmark-start text:name="{@w:name}"/> + </xsl:when> + <xsl:when test="@w:type = 'Word.Bookmark.End'"> + <xsl:variable name="id" select="@aml:id"/> + <text:bookmark-end text:name="{preceding::aml:annotation[@aml:id = $id]/@w:name}"/> + </xsl:when> + <xsl:when test="@w:type = 'Word.Comment'"> + <office:annotation office:display="true"> + <dc:creator> + <xsl:value-of select="@aml:author"/> + </dc:creator> + <dc:date> + <xsl:value-of select="substring(@aml:createdate,1,10)"/> + </dc:date> + <xsl:apply-templates select="aml:content/w:p"/> + </office:annotation> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="w:hlink"> + <xsl:element name="text:a"> + <xsl:attribute name="xlink:type">simple</xsl:attribute> + <xsl:choose> + <xsl:when test="@w:dest and @w:bookmark"> + <xsl:attribute name="xlink:href"> + <xsl:value-of select="concat( @w:dest, concat('#', @w:bookmark) )"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="@w:dest"> + <xsl:attribute name="xlink:href"> + <xsl:value-of select="@w:dest"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="@w:bookmark"> + <xsl:attribute name="xlink:href"> + <xsl:value-of select="concat('#', @w:bookmark)"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="@w:target"> + <xsl:attribute name="office:target-frame-name"> + <xsl:value-of select="@w:target"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="dispatch"/> + </xsl:element> + </xsl:template> + <xsl:template match="w:t"> + <xsl:choose> + <xsl:when test="string(.) = ' ' "> + <xsl:element name="text:s"/> + </xsl:when> + <xsl:when test="contains(.,' ')"> + <xsl:call-template name="replace-spaces"> + <xsl:with-param name="curr-string" select="."/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="replace-spaces"> + <xsl:param name="curr-string"/> + <xsl:if test="contains($curr-string,' ')"> + <xsl:value-of select="substring-before($curr-string,' ')"/> + <text:s text:c="2"/> + <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/> + <xsl:choose> + <xsl:when test="contains($next-string, ' ')"> + <xsl:call-template name="replace-spaces"> + <xsl:with-param name="curr-string" select="$next-string"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$next-string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="w:tab"> + <xsl:element name="text:tab"/> + </xsl:template> + <xsl:template match="w:br"> + <xsl:if test="@w:type='text-wrapping' or not(@w:type)"> + <text:line-break/> + </xsl:if> + </xsl:template> + <xsl:template match="w:footnote"> + <xsl:variable name="footnote-position"> + <xsl:number from="/w:wordDocument/w:body" count="w:footnote" level="any"/> + </xsl:variable> + <text:note text:note-class="footnote" text:id="ftn{$footnote-position}"> + <text:note-citation/> + <text:note-body> + <xsl:apply-templates mode="dispatch"/> + </text:note-body> + </text:note> + </xsl:template> + <xsl:template match="w:endnote"> + <xsl:variable name="endnote-position"> + <xsl:number from="/w:wordDocument/w:body" count="w:endnote" level="any" format="1"/> + </xsl:variable> + <text:endnote text:id="edn{$endnote-position}"> + <text:endnote-body> + <xsl:apply-templates mode="dispatch"/> + </text:endnote-body> + </text:endnote> + </xsl:template> +</xsl:stylesheet> |