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/export | |
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/export')
20 files changed, 23946 insertions, 0 deletions
diff --git a/filter/source/xslt/export/common/ooo2ms_docpr.xsl b/filter/source/xslt/export/common/ooo2ms_docpr.xsl new file mode 100644 index 000000000..df1de5fb1 --- /dev/null +++ b/filter/source/xslt/export/common/ooo2ms_docpr.xsl @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template match="office:meta"> + <o:DocumentProperties> + <o:Title> + <xsl:value-of select="dc:title"/> + </o:Title> + <o:Subject> + <xsl:value-of select="dc:subject"/> + </o:Subject> + <o:Keywords> + <xsl:for-each select="meta:keywords/meta:keyword"> + <xsl:value-of select="."/> + <xsl:if test="position()!=last()">, </xsl:if> + </xsl:for-each> + </o:Keywords> + <o:Description> + <xsl:value-of select="dc:description"/> + </o:Description> + <o:Category> + <xsl:value-of select="meta:user-defined[@meta:name = 'Category']"/> + </o:Category> + <o:Author> + <xsl:value-of select="meta:initial-creator"/> + </o:Author> + <o:LastAuthor> + <xsl:value-of select="dc:creator"/> + </o:LastAuthor> + <o:Manager> + <xsl:value-of select="meta:user-defined[@meta:name = 'Manager']"/> + </o:Manager> + <o:Company> + <xsl:value-of select="meta:user-defined[@meta:name = 'Company']"/> + </o:Company> + <o:HyperlinkBase> + <xsl:value-of select="meta:user-defined[@meta:name = 'HyperlinkBase']"/> + </o:HyperlinkBase> + <o:Revision> + <xsl:value-of select="meta:editing-cycles"/> + </o:Revision> + <!-- PresentationFormat, Guid, AppName, Version --> + <o:TotalTime> + <xsl:if test="meta:editing-duration"> + <xsl:variable name="hours"> + <xsl:choose> + <xsl:when test="contains(meta:editing-duration, 'H')"> + <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'H')"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="minutes"> + <xsl:choose> + <xsl:when test="contains(meta:editing-duration, 'M') and contains(meta:editing-duration, 'H')"> + <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'H'), 'M')"/> + </xsl:when> + <xsl:when test="contains(meta:editing-duration, 'M')"> + <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'M')"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$hours * 60 + $minutes"/> + </xsl:if> + </o:TotalTime> + <o:LastPrinted> + <xsl:if test="meta:print-date"> + <xsl:value-of select="concat( meta:print-date, 'Z')"/> + </xsl:if> + </o:LastPrinted> + <o:Created> + <xsl:if test="meta:creation-date"> + <xsl:value-of select="concat( meta:creation-date, 'Z')"/> + </xsl:if> + </o:Created> + <o:LastSaved> + <xsl:if test="dc:date"> + <xsl:value-of select="concat( dc:date, 'Z')"/> + </xsl:if> + </o:LastSaved> + <o:Pages> + <xsl:value-of select="meta:document-statistic/@meta:page-count"/> + </o:Pages> + <o:Words> + <xsl:value-of select="meta:document-statistic/@meta:word-count"/> + </o:Words> + <o:Characters> + <xsl:value-of select="meta:document-statistic/@meta:character-count"/> + </o:Characters> + <!-- CharactersWithSpaces, Bytes, Lines --> + <o:Paragraphs> + <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/> + </o:Paragraphs> + </o:DocumentProperties> + <o:CustomDocumentProperties> + <o:Editor dt:dt="string"> + <xsl:value-of select="meta:generator"/> + </o:Editor> + <o:Language dt:dt="string"> + <xsl:value-of select="dc:language"/> + </o:Language> + <xsl:for-each select="meta:user-defined"> + <!-- transfer strings to XML QName, necessary to convert several characters --> + <!-- {} --> + <xsl:variable name="foo">.,| ~`!@#$%^*()&<>+=[];:"/\?{}'</xsl:variable> + <xsl:element name="{concat( 'o:', translate(@meta:name,string($foo),'_'))}"> + <xsl:attribute name="dt:dt">string</xsl:attribute> + <xsl:value-of select="."/> + </xsl:element> + </xsl:for-each> + </o:CustomDocumentProperties> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/spreadsheetml/formular.xsl b/filter/source/xslt/export/spreadsheetml/formular.xsl new file mode 100644 index 000000000..f284e342d --- /dev/null +++ b/filter/source/xslt/export/spreadsheetml/formular.xsl @@ -0,0 +1,631 @@ +<?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:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" + xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:dom="http://www.w3.org/2001/xml-events" + xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" + xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" + xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" + xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" + xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" + xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" + xmlns:ooo="http://openoffice.org/2004/office" + xmlns:oooc="http://openoffice.org/2004/calc" + xmlns:ooow="http://openoffice.org/2004/writer" + xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" + xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" + xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" + xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" + xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xt="http://www.jclark.com/xt" + xmlns:common="http://exslt.org/common" + xmlns:xalan="http://xml.apache.org/xalan" + xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan"> + + + <!-- Mapping @table:formula to @ss:Formula translating the expression syntax --> + <xsl:template match="@table:formula"> + <xsl:param name="calculatedCellPosition" /> + <xsl:param name="calculatedRowPosition" /> + + <xsl:attribute name="ss:Formula"> + <xsl:call-template name="translate-formular-expression"> + <xsl:with-param name="rowPos" select="$calculatedRowPosition" /> + <xsl:with-param name="columnPos" select="$calculatedCellPosition" /> + <xsl:with-param name="expression" select="." /> + </xsl:call-template> + </xsl:attribute> + </xsl:template> + + + <!-- Translate OOOC formula expressions of table cells to spreadsheetml expression + + For example: + "oooc:=ROUNDDOWN(123.321;2)" + to "=ROUNDDOWN(123.321,2)" + "oooc:=([.B2]-[.C2])" + to "=(RC[-2]-RC[-1])" + "oooc:=DCOUNTA([.E14:.F21];[.F14];[.H14:.I15])" + to "=DCOUNTA(R[-17]C[3]:R[-10]C[4],R[-17]C[4],R[-17]C[6]:R[-16]C[7])" --> + <xsl:template name="translate-formular-expression"> + <!-- return position or range for formula or other --> + <xsl:param name="rowPos" /> <!-- the position in row (vertical) of cell --> + <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) --> + <xsl:param name="expression" /> <!-- the expression string to be converted --> + + <xsl:choose> + <xsl:when test="$expression != ''"> + <xsl:choose> + <!-- OASIS Open Document XML formular expressions --> + <xsl:when test="starts-with($expression,'oooc:')"> + <!-- giving out the '=', which will be removed with 'oooc:=' to enable recursive string parsing --> + <xsl:text>=</xsl:text> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <!-- 1) remove 'oooc:=' prefix and exchange ';' with ',' --> + <xsl:with-param name="expression" select="translate(substring($expression,7),';',',')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$expression" /> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$expression" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- As the function API of our Office and MS Office show differences in the argumentlists, + - sometimes the last parameter have to be neglected + - sometimes a default have to be added + these exchanges have to be done as well --> + <xsl:template name="function-parameter-mapping"> + <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) --> + <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) --> + <xsl:param name="expression" /> <!-- expression to be exchanged --> + + <!-- Choose if the expression contains one of the function, which might need changes --> + <xsl:choose> + <!-- if not contain one of the functions, which need parameter mapping --> + <xsl:when test="not(contains($expression, 'ADDRESS(') or + contains($expression, 'CEILING(') or + contains($expression, 'FLOOR(') or + contains($expression, 'IF(') or + contains($expression, 'ROUND('))"> + <!-- simply translate possibly existing column & row references --> + <xsl:call-template name="translate-oooc-expression"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="$expression"/> + </xsl:call-template> + </xsl:when> + <!-- functions to be mapped --> + <xsl:otherwise> + <xsl:variable name="functionPrefix" select="substring-before($expression, '(')" /> + <xsl:variable name="expressionSuffix" select="substring-after($expression, '(')" /> + + <!-- translate in case the expression contains row/cell references aside of the function name --> + <xsl:call-template name="translate-oooc-expression"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="$functionPrefix"/> + </xsl:call-template> + <!-- Prefix do not include the bracket --> + <xsl:text>(</xsl:text> + <xsl:choose> + <xsl:when test="not(contains($functionPrefix, 'ADDRESS') or + contains($functionPrefix, 'CEILING') or + contains($functionPrefix, 'FLOOR') or + (contains($functionPrefix, 'IF') and not( + contains($functionPrefix, 'COUNTIF') or + contains($functionPrefix, 'SUMIF'))) or + contains($functionPrefix, 'ROUND'))"> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="$expressionSuffix"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="contains($functionPrefix, 'ADDRESS')"> + <xsl:call-template name="find-parameters"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + <xsl:with-param name="parameterRemoval" select="4" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($functionPrefix, 'CEILING') or + contains($functionPrefix, 'FLOOR')"> + <xsl:call-template name="find-parameters"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + <xsl:with-param name="parameterRemoval" select="3" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($functionPrefix, 'IF')"> + <xsl:if test="not(contains($functionPrefix, 'COUNTIF') or + contains($functionPrefix, 'SUMIF'))"> + <xsl:call-template name="find-parameters"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + <xsl:with-param name="parameterAddition" select="'true'" /> + <xsl:with-param name="additonAfterLastParameter" select="2" /> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:when test="contains($functionPrefix, 'ROUND')"> + <xsl:call-template name="find-parameters"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + <xsl:with-param name="parameterAddition" select="'null'" /> + <xsl:with-param name="additonAfterLastParameter" select="1" /> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Each parameter of the argumentlist have to be determined. + Due to the low level string functionality in XSLT it becomes a clumsy task --> + <xsl:template name="find-parameters"> + <!-- used for mapping of row/column reference --> + <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) --> + <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) --> + <!-- used for mapping of parameter --> + <xsl:param name="parameterRemoval" /> + <xsl:param name="parameterAddition" /> + <xsl:param name="additonAfterLastParameter" /> + <!-- used as helper to find a parameter --> + <xsl:param name="expressionSuffix" /> + <xsl:param name="parameterNumber" select="1" /> + + <xsl:variable name="parameter"> + <xsl:call-template name="getParameter"> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <!-- if it is not the last parameter --> + <xsl:when test="starts-with(substring-after($expressionSuffix, $parameter), ',')"> + <!-- searches the argument for functions to be mapped --> + <xsl:if test="not($parameterRemoval = $parameterNumber)"> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression"> + <xsl:choose> + <!-- in case a character will be removed the preceding won't make a comma --> + <xsl:when test="$parameterRemoval = ($parameterNumber + 1)"> + <xsl:value-of select="$parameter" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($parameter, ',')" /> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + <!-- searches for the next parameter --> + <xsl:call-template name="find-parameters"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expressionSuffix" select="substring-after(substring-after($expressionSuffix, $parameter),',')"/> + <xsl:with-param name="parameterAddition" select="$parameterAddition" /> + <xsl:with-param name="parameterRemoval" select="$parameterRemoval" /> + <xsl:with-param name="additonAfterLastParameter" select="$additonAfterLastParameter" /> + <xsl:with-param name="parameterNumber" select="$parameterNumber + 1" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- the last parameter --> + <xsl:choose> + <xsl:when test="$parameterRemoval = $parameterNumber"> + <!-- searches the rest of the expression for functions to be mapped --> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="substring-after($expressionSuffix, $parameter)"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$parameterAddition and ($parameterNumber = $additonAfterLastParameter)"> + <!-- searches the rest of the expression for functions to be mapped --> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="$parameter" /> + </xsl:call-template> + <!-- searches last parameter and additional parameters for functions to be mapped --> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <!-- for the final parameter the latter substring is the ')' --> + <xsl:with-param name="expression" select="concat(',', $parameterAddition, substring-after($expressionSuffix, $parameter))"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- searches the argument for functions to be mapped --> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="$parameter" /> + </xsl:call-template> + <!-- searches the rest of the expression for functions to be mapped --> + <xsl:call-template name="function-parameter-mapping"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="substring-after($expressionSuffix, $parameter)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="getParameter"> + <xsl:param name="closingBracketCount" select="0" /> + <xsl:param name="openingBracketCount" select="0" /> + <xsl:param name="expressionSuffix" /> + <xsl:param name="parameterCandidate"> + <xsl:choose> + <!-- if there are multiple parameter --> + <xsl:when test="contains(substring-before($expressionSuffix, ')'), ',')"> + <xsl:value-of select="substring-before($expressionSuffix, ',')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($expressionSuffix, ')')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + <xsl:param name="earlierCandidate" select="$parameterCandidate" /> + + <xsl:choose> + <xsl:when test="contains($parameterCandidate, '(') or contains($parameterCandidate, ')')"> + <xsl:choose> + <!-- contains only closing bracket(s) --> + <xsl:when test="contains($parameterCandidate, '(') and not(contains($parameterCandidate, ')'))"> + <xsl:call-template name="getParameter"> + <xsl:with-param name="openingBracketCount" select="$openingBracketCount + 1" /> + <xsl:with-param name="closingBracketCount" select="$closingBracketCount" /> + <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, '(')" /> + <xsl:with-param name="earlierCandidate" select="$earlierCandidate" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + </xsl:call-template> + </xsl:when> + <!-- contains only opening bracket(s) --> + <xsl:when test="not(contains($parameterCandidate, '(')) and contains($parameterCandidate, ')')"> + <xsl:call-template name="getParameter"> + <xsl:with-param name="openingBracketCount" select="$openingBracketCount" /> + <xsl:with-param name="closingBracketCount" select="$closingBracketCount + 1" /> + <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, ')')" /> + <xsl:with-param name="earlierCandidate" select="$earlierCandidate" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="string-length(substring-before($parameterCandidate, '(')) < + string-length(substring-before($parameterCandidate, ')'))"> + <xsl:call-template name="getParameter"> + <xsl:with-param name="openingBracketCount" select="$openingBracketCount + 1" /> + <xsl:with-param name="closingBracketCount" select="$closingBracketCount" /> + <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, '(')" /> + <xsl:with-param name="earlierCandidate" select="$earlierCandidate" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="getParameter"> + <xsl:with-param name="openingBracketCount" select="$openingBracketCount" /> + <xsl:with-param name="closingBracketCount" select="$closingBracketCount + 1" /> + <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, ')')" /> + <xsl:with-param name="earlierCandidate" select="$earlierCandidate" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$openingBracketCount = $closingBracketCount"> + <xsl:value-of select="$earlierCandidate" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$earlierCandidate" /> + <xsl:variable name="parameterCandidate2"> + <xsl:variable name="formularAfterCandidate" select="substring-after($expressionSuffix, $earlierCandidate)" /> + <xsl:variable name="parameterTillBracket" select="concat(substring-before($formularAfterCandidate,')'),')')" /> + <xsl:variable name="parameterTillComma" select="substring-before(substring-after($expressionSuffix, $parameterTillBracket),',')" /> + <xsl:choose> + <xsl:when test="string-length($parameterTillComma) > 0 and + not(contains($parameterTillComma, '('))"> + <xsl:choose> + <xsl:when test="starts-with($formularAfterCandidate, ',')"> + <xsl:value-of select="concat(',',substring-before(substring-after($formularAfterCandidate,','),','))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($formularAfterCandidate,',')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$parameterTillBracket"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="getParameter"> + <xsl:with-param name="closingBracketCount" select="$closingBracketCount" /> + <xsl:with-param name="openingBracketCount" select="$openingBracketCount" /> + <xsl:with-param name="parameterCandidate" select="$parameterCandidate2" /> + <xsl:with-param name="earlierCandidate" select="$parameterCandidate2" /> + <xsl:with-param name="expressionSuffix" select="$expressionSuffix" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Mapping table-cell definitions by exchangomg all table cell definitions: + a) a pair of cells e.g. "[.E14:.F21]" to "R[-17]C[3]:R[-10]C[4]" + b) a single cell e.g. "[.F14]" to "R[-17]"--> + <xsl:template name="translate-oooc-expression"> + <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) --> + <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) --> + <xsl:param name="expression" /> <!-- expression to be exchanged --> + + <xsl:choose> + <xsl:when test="contains($expression, '[')"> + + <!-- Giving out the part before '[.' --> + <xsl:value-of select="substring-before($expression, '[')" /> + + <!-- Mapping cell definitions + 1) a pair of cells e.g. "[.E14:.F21]" to "R[-17]C[3]:R[-10]C[4]" + 2) a single cell e.g. "[.F14]" to "R[-17]"--> + <xsl:variable name="remainingExpression" select="substring-after($expression, '[')"/> + <xsl:choose> + <xsl:when test="contains(substring-before($remainingExpression, ']'), ':')"> + <xsl:call-template name="translate-cell-expression"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="substring-before($remainingExpression, ':')" /> + </xsl:call-template> + <xsl:value-of select="':'" /> + <xsl:call-template name="translate-cell-expression"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="substring-after(substring-before($remainingExpression, ']'), ':')" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="translate-cell-expression"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="substring-before($remainingExpression, ']')" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="translate-oooc-expression"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="substring-after($remainingExpression,']')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- Giving out the remaining part --> + <xsl:value-of select="$expression" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- A cell expression has usually starts with a '.' otherwise it references to a sheet --> + <xsl:template name="translate-cell-expression"> + <xsl:param name="rowPos" /> <!-- the vertical position of the current cell --> + <xsl:param name="columnPos" /> <!-- the horizontal position of the current cell --> + <xsl:param name="targetRowPos" select="0"/> <!-- the vertical position of the target cell --> + <xsl:param name="targetColumnPos" select="0"/> <!-- the horizontal position of the target cell --> + <xsl:param name="charPos" select="0"/> <!-- current column position (needed for multiplying) --> + <xsl:param name="digitPos" select="0"/> <!-- current row position (needed for multiplying) --> + <xsl:param name="expression" /> <!-- expression to be parsed by character --> + <xsl:param name="isRow" select="true()"/> <!-- the string (e.g. $D39 is parsed character per character from the back, + first the row, later the column is parsed --> + + <xsl:choose> + <xsl:when test="starts-with($expression, '.')"> + <xsl:variable name="expLength" select="string-length($expression)" /> + <xsl:choose> + <!-- parsing from the end, till only the '.' remains --> + <xsl:when test="$expLength != 1"> + <xsl:variable name="token" select="substring($expression, $expLength)" /> + <xsl:choose> + <xsl:when test="$token='0' or $token='1' or $token='2' or $token='3' or $token='4' or $token='5' or $token='6' or $token='7' or $token='8' or $token='9'"> + <xsl:variable name="multiplier"> + <xsl:call-template name="calculate-square-numbers"> + <xsl:with-param name="base" select="10" /> + <xsl:with-param name="exponent" select="$digitPos"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="translate-cell-expression"> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="targetColumnPos" select="$targetColumnPos" /> + <xsl:with-param name="targetRowPos" select="$targetRowPos + $multiplier * $token" /> + <xsl:with-param name="digitPos" select="$digitPos + 1" /> + <xsl:with-param name="charPos" select="$charPos" /> + <!-- removing the last character--> + <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" /> + <xsl:with-param name="isRow" select="true()" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="$token = '$'"> + <xsl:choose> + <!-- if this is the first '$' after '.' (column--> + <xsl:when test="$expLength = 2"> + <xsl:text>C</xsl:text><xsl:value-of select="$targetColumnPos"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>R</xsl:text><xsl:value-of select="$targetRowPos"/> + <xsl:call-template name="translate-cell-expression"> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="targetColumnPos" select="$targetColumnPos" /> + <xsl:with-param name="targetRowPos" select="$targetRowPos" /> + <xsl:with-param name="charPos" select="$charPos" /> + <!-- removing the last character--> + <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" /> + <xsl:with-param name="isRow" select="false()" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- in case of a letter --> + <xsl:otherwise> + <xsl:if test="$isRow"> + <xsl:text>R</xsl:text> + <xsl:if test="$targetRowPos != $rowPos"> + <xsl:text>[</xsl:text><xsl:value-of select="$targetRowPos - $rowPos"/><xsl:text>]</xsl:text> + </xsl:if> + </xsl:if> + <xsl:variable name="multiplier"> + <xsl:call-template name="calculate-square-numbers"> + <xsl:with-param name="base" select="26" /> + <xsl:with-param name="exponent" select="$charPos"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="tokenNumber"> + <xsl:call-template name="character-to-number"> + <xsl:with-param name="character" select="$token" /> + </xsl:call-template> + </xsl:variable> + + <xsl:call-template name="translate-cell-expression"> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="targetColumnPos" select="$targetColumnPos + $multiplier * $tokenNumber" /> + <xsl:with-param name="targetRowPos" select="$targetRowPos" /> + <xsl:with-param name="digitPos" select="$digitPos" /> + <xsl:with-param name="charPos" select="$charPos + 1" /> + <!-- removing the last character--> + <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" /> + <xsl:with-param name="isRow" select="false()" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:text>C</xsl:text> + <xsl:if test="$targetColumnPos != $columnPos"> + <xsl:text>[</xsl:text><xsl:value-of select="$targetColumnPos - $columnPos"/><xsl:text>]</xsl:text> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="sheetName" select="substring-before($expression, '.')" /> + <xsl:value-of select="$sheetName"/><xsl:text>!</xsl:text> + <xsl:call-template name="translate-cell-expression"> + <xsl:with-param name="rowPos" select="$rowPos" /> + <xsl:with-param name="columnPos" select="$columnPos" /> + <xsl:with-param name="expression" select="substring-after($expression, $sheetName)" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="calculate-square-numbers"> + <xsl:param name="base" /> + <xsl:param name="exponent" /> + <xsl:param name="return" select="1" /> + + <xsl:choose> + <xsl:when test="$exponent > '1'"> + <xsl:call-template name="calculate-square-numbers"> + <xsl:with-param name="base" select="$base" /> + <xsl:with-param name="exponent" select="$exponent - 1"/> + <xsl:with-param name="return" select="$return * $base" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="$exponent = '1'"> + <xsl:value-of select="$return * $base"/> + </xsl:when> + <!-- if exponent is equal '0' --> + <xsl:otherwise> + <xsl:value-of select="1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="character-to-number"> + <xsl:param name="character" /> + <xsl:choose> + <xsl:when test="$character = 'A'">1</xsl:when> + <xsl:when test="$character = 'B'">2</xsl:when> + <xsl:when test="$character = 'C'">3</xsl:when> + <xsl:when test="$character = 'D'">4</xsl:when> + <xsl:when test="$character = 'E'">5</xsl:when> + <xsl:when test="$character = 'F'">6</xsl:when> + <xsl:when test="$character = 'G'">7</xsl:when> + <xsl:when test="$character = 'H'">8</xsl:when> + <xsl:when test="$character = 'I'">9</xsl:when> + <xsl:when test="$character = 'J'">10</xsl:when> + <xsl:when test="$character = 'K'">11</xsl:when> + <xsl:when test="$character = 'L'">12</xsl:when> + <xsl:when test="$character = 'M'">13</xsl:when> + <xsl:when test="$character = 'N'">14</xsl:when> + <xsl:when test="$character = 'O'">15</xsl:when> + <xsl:when test="$character = 'P'">16</xsl:when> + <xsl:when test="$character = 'Q'">17</xsl:when> + <xsl:when test="$character = 'R'">18</xsl:when> + <xsl:when test="$character = 'S'">19</xsl:when> + <xsl:when test="$character = 'T'">20</xsl:when> + <xsl:when test="$character = 'U'">21</xsl:when> + <xsl:when test="$character = 'V'">22</xsl:when> + <xsl:when test="$character = 'W'">23</xsl:when> + <xsl:when test="$character = 'X'">24</xsl:when> + <xsl:when test="$character = 'Y'">25</xsl:when> + <xsl:when test="$character = 'Z'">26</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl b/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl new file mode 100644 index 000000000..321369efc --- /dev/null +++ b/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl @@ -0,0 +1,408 @@ +<?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:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" + xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:dom="http://www.w3.org/2001/xml-events" + xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" + xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" + xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" + xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" + xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" + xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" + xmlns:ooo="http://openoffice.org/2004/office" + xmlns:oooc="http://openoffice.org/2004/calc" + xmlns:ooow="http://openoffice.org/2004/writer" + xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" + xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" + xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" + xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" + xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink"> + + + <!--+++++ INCLUDED XSL MODULES +++++--> + + <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)--> + <xsl:import href="../../common/measure_conversion.xsl" /> + + <!-- excel table handling --> + <xsl:include href="table.xsl" /> + + <!-- mapping rules of office style properties to Excel style properties --> + <xsl:include href="style_mapping.xsl" /> + + <!-- creating the Excel styles element --> + <xsl:include href="styles.xsl" /> + + <!-- mapping formular Expressions --> + <xsl:include href="formular.xsl" /> + + <xsl:output method = "xml" + indent = "no" + encoding = "UTF-8" + omit-xml-declaration = "no" /> + + <xsl:strip-space elements="ss:Data html:Data" /> + + + <!-- common table handling --> + <xsl:variable name="namespace" select="'urn:schemas-microsoft-com:office:spreadsheet'" /> + + <!--+++++ PARAMETER SECTION +++++--> + + <!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a (relative) URL to the target directory. + Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix --> + <xsl:param name="targetBaseURL" select="'./'" /> + + <!-- OPTIONAL: (MANDATORY: for input document with relative internal links) + To access contents of an office file (content like the meta.xml, styles.xml file or graphics) a URL could be chosen. + This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be + "jar:file:/C:/temp/Test.sxw!/" for example. + When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the jared document. --> + <xsl:param name="sourceBaseURL" select="'./'" /> + + <!-- OPTIONAL: (MANDATORY: for session management by URL rewriting) + Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is being used (the session is appended to the URL). + This URL session is used for example when links to graphics are created by XSLT. Otherwise the user has to log again in for every graphic he likes to see. --> + <xsl:param name="optionalURLSuffix" /> + + <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) --> + <xsl:param name="metaFileURL" /> + + <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) --> + <xsl:param name="stylesFileURL" /> + + <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality + (e.g. encoding chapter names for the content-table as href and anchors ) --> + <xsl:param name="java" select="true()" /> + <xsl:param name="javaEnabled" select="boolean($java)" /> + + <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside --> + <xsl:param name="debug" select="false()" /> + <xsl:param name="debugEnabled" select="boolean($debug)" /> + + <!-- matching configuration entries --> + <xsl:key name="config" use="@config:name" + match="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item | + /*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry/config:config-item" /> + + <xsl:key name="colors" match="/*/office:styles//@*[name() = 'fo:background-color' or name() = 'fo:color'] | + /*/office:automatic-styles//@*[name() = 'fo:background-color' or name() = 'fo:color']" use="/" /> + <xsl:key name="colorRGB" match="@fo:background-color | @fo:color" use="." /> + <!-- *************************** --> + <!-- *** Built up Excel file *** --> + <!-- *************************** --> + <xsl:template match="/"> + <xsl:processing-instruction name="mso-application">progid="Excel.Sheet"</xsl:processing-instruction> + <!-- Note: for debugging purpose include schema location + <Workbook xsi:schemaLocation="urn:schemas-microsoft-com:office:spreadsheet <YOUR_SCHEMA_URL>/excelss.xsd"> --> + <Workbook> + <!-- adding some default settings --> + <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> + <Colors> + <xsl:for-each select="key('colors', /) + [generate-id(.) = + generate-id(key('colorRGB', .)[1]) and starts-with(., '#')] "> + <xsl:sort select="." /> + <Color> + <Index><xsl:value-of select="position() + 2" /></Index> + <RGB><xsl:value-of select="." /></RGB> + </Color> + </xsl:for-each> + <xsl:for-each select="key('config', 'TabColor')[not(.=preceding::config:config-item)]"> + <xsl:sort select="." /> + <Color> + <Index><xsl:value-of select="56 - position()" /></Index> + <RGB> + <xsl:call-template name="colordecimal2rgb"> + <xsl:with-param name="colordecimal" select="."/> + </xsl:call-template> + </RGB> + </Color> + </xsl:for-each> + </Colors> + </OfficeDocumentSettings> + <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> + <xsl:if test="key('config', 'HasSheetTabs') = 'false'"> + <xsl:element name="HideWorkbookTabs" /> + </xsl:if> + <WindowHeight>9000</WindowHeight> + <WindowWidth>13860</WindowWidth> + <WindowTopX>240</WindowTopX> + <WindowTopY>75</WindowTopY> + <ProtectStructure>False</ProtectStructure> + <ProtectWindows>False</ProtectWindows> + </ExcelWorkbook> + <!-- Note: the following handling will exchange the default, later + <x:ExcelWorkbook> + <xsl:apply-templates select="table:calculation-settings" /> + </x:ExcelWorkbook> + --> + <xsl:element name="Styles"> + <!-- our application default will not be used for export to Excel + <xsl:apply-templates select="/*/office:styles/style:default-style" mode="styles" />--> + <xsl:apply-templates select="/*/office:styles/style:style" mode="styles" /> + <xsl:apply-templates select="/*/office:automatic-styles/style:style" mode="styles" > + <xsl:with-param name="isAutomatic" select="true()" /> + </xsl:apply-templates> + </xsl:element> + <xsl:apply-templates select="/*/office:body" /> + </Workbook> + </xsl:template> + + <xsl:template name="colordecimal2rgb"> + <xsl:param name="colordecimal"/> + <xsl:choose> + <xsl:when test="$colordecimal <= 16777215 and $colordecimal >= 65536"> + <xsl:variable name="redValue" select="floor(($colordecimal) div 65536)"/> + <xsl:variable name="greenValue" select="floor(($colordecimal - ($redValue*65536)) div 256)"/> + <xsl:variable name="blueValue" select="$colordecimal - ($redValue*65536) - ($greenValue*256)"/> + <xsl:call-template name="dec_rgb2Hex"> + <xsl:with-param name="decRedValue" select="$redValue"/> + <xsl:with-param name="decGreenValue" select="$greenValue"/> + <xsl:with-param name="decBlueValue" select="$blueValue"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$colordecimal <= 65535 and $colordecimal >= 256"> + <xsl:variable name="redValue" select="0"/> + <xsl:variable name="greenValue" select="$colordecimal div 256"/> + <xsl:variable name="blueValue" select="$colordecimal - ($greenValue*256)"/> + <xsl:call-template name="dec_rgb2Hex"> + <xsl:with-param name="decRedValue" select="$redValue"/> + <xsl:with-param name="decGreenValue" select="$greenValue"/> + <xsl:with-param name="decBlueValue" select="$blueValue"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$colordecimal <= 255 and $colordecimal >= 0"> + <xsl:variable name="redValue" select="0"/> + <xsl:variable name="greenValue" select="0"/> + <xsl:variable name="blueValue" select="$colordecimal"/> + <xsl:call-template name="dec_rgb2Hex"> + <xsl:with-param name="decRedValue" select="$redValue"/> + <xsl:with-param name="decGreenValue" select="$greenValue"/> + <xsl:with-param name="decBlueValue" select="$blueValue"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="dec_rgb2Hex"> + <xsl:param name="decRedValue"/> + <xsl:param name="decGreenValue"/> + <xsl:param name="decBlueValue"/> + <xsl:variable name="hexRedValue"> + <xsl:variable name="tmpHexRedValue"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="$decRedValue"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($tmpHexRedValue) = 1"> + <xsl:value-of select="concat('0',$tmpHexRedValue)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$tmpHexRedValue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="hexGreenValue"> + <xsl:variable name="tmpHexGreenValue"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="$decGreenValue"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($tmpHexGreenValue) = 1"> + <xsl:value-of select="concat('0',$tmpHexGreenValue)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$tmpHexGreenValue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="hexBlueValue"> + <xsl:variable name="tmpHexBlueValue"> + <xsl:call-template name="decimal2hex"> + <xsl:with-param name="dec-number" select="$decBlueValue"/> + <xsl:with-param name="last-value" select="'H'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($tmpHexBlueValue) = 1"> + <xsl:value-of select="concat('0',$tmpHexBlueValue)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$tmpHexBlueValue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('#',$hexRedValue,$hexGreenValue,$hexBlueValue)"/> + </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 name="GetTabColorIndex"> + <xsl:param name="SheetColor"/> + <xsl:for-each select="key('config', 'TabColor')[not(.=preceding::config:config-item)]"> + <xsl:sort select="." /> + <xsl:variable name="tmpColor" select="."/> + <xsl:if test=". = $SheetColor" > + <xsl:value-of select="56 - position()"/> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template match="office:body"> + <!-- office:body table:table children are spreadsheets --> + <xsl:apply-templates /> + </xsl:template> + + <xsl:template match="office:spreadsheet"> + <xsl:apply-templates /> + </xsl:template> + + <!-- office:body table:table children are spreadsheets --> + <xsl:template match="office:spreadsheet/table:table"> + <xsl:element name="ss:Worksheet"> + <xsl:variable name="TableName"> + <xsl:value-of select="@table:name" /> + </xsl:variable> + <xsl:attribute name="ss:Name"> + <xsl:value-of select="$TableName" /> + </xsl:attribute> + <xsl:call-template name="table:table" /> + <xsl:element name="x:WorksheetOptions"> + <xsl:if test="key('config', 'ShowGrid') = 'false'"> + <xsl:element name="x:DoNotDisplayGridlines" /> + </xsl:if> + <xsl:if test="key('config', 'HasColumnRowHeaders') = 'false'"> + <xsl:element name="x:DoNotDisplayHeadings" /> + </xsl:if> + <xsl:if test="key('config', 'IsOutlineSymbolsSet') = 'false'"> + <xsl:element name="x:DoNotDisplayOutline" /> + </xsl:if> + <xsl:if test="key('config', 'ShowZeroValues') = 'false'"> + <xsl:element name="x:DoNotDisplayZeros" /> + </xsl:if> + <xsl:if test="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry[@config:name=$TableName]/config:config-item[@config:name='TabColor']"> + <xsl:element name="x:TabColorIndex"> + <xsl:variable name="TabColorIndex"> + <xsl:call-template name="GetTabColorIndex"> + <xsl:with-param name="SheetColor" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry[@config:name=$TableName]/config:config-item[@config:name='TabColor']"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$TabColorIndex"/> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:template> + + <xsl:template match="table:decls" mode="ExcelWorkbook"> + <xsl:apply-templates mode="ExcelWorkbook" /> + </xsl:template> + + <xsl:template match="table:calculation-settings" mode="ExcelWorkbook"> + <xsl:if test="table:precision-as-shown"> + <x:PrecisionAsDisplayed/> + </xsl:if> + <xsl:if test="table:null-date/@office:date-value='1904-01-01'"> + <x:Date1904/> + </xsl:if> + <xsl:apply-templates select="table:iteration" /> + </xsl:template> + + <xsl:template match="table:iteration" mode="ExcelWorkbook"> + <xsl:element name="x:ExcelWorkbook"> + <xsl:if test="@table:status = 'enable'"> + <x:Iteration/> + </xsl:if> + <xsl:if test="@table:steps"> + <xsl:element name="x:MaxIterations"> + <xsl:value-of select="@table:steps" /> + </xsl:element> + </xsl:if> + <xsl:if test="@table:maximum-difference"> + <xsl:element name="x:MaxChange"> + <xsl:value-of select="@table:maximum-difference" /> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> diff --git a/filter/source/xslt/export/spreadsheetml/style_mapping.xsl b/filter/source/xslt/export/spreadsheetml/style_mapping.xsl new file mode 100644 index 000000000..b338afcc2 --- /dev/null +++ b/filter/source/xslt/export/spreadsheetml/style_mapping.xsl @@ -0,0 +1,381 @@ +<?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:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" + xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:dom="http://www.w3.org/2001/xml-events" + xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" + xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" + xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" + xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" + xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" + xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" + xmlns:ooo="http://openoffice.org/2004/office" + xmlns:oooc="http://openoffice.org/2004/calc" + xmlns:ooow="http://openoffice.org/2004/writer" + xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" + xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" + xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" + xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" + xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xt="http://www.jclark.com/xt" + xmlns:common="http://exslt.org/common" + xmlns:xalan="http://xml.apache.org/xalan" + xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan"> + + <xsl:variable name="namespace-html" select="'http://www.w3.org/TR/REC-html40'" /> + + <xsl:template match="@table:style-name | @table:default-cell-style-name"> + <xsl:if test="not(name() = 'Default')"> + <xsl:attribute name="ss:StyleID"> + <xsl:value-of select="." /> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <xsl:key match="table:table-cell" name="getCellByStyle" use="@table:style-name"/> + <xsl:template match="@table:style-name" mode="table-row"> + <!-- only row styles used by cells are exported, + as usual row style properties are already written as row attributes --> + <xsl:if test="key('getCellByStyle', '.')"> + <xsl:attribute name="ss:StyleID"> + <xsl:value-of select="." /> + </xsl:attribute> + </xsl:if> + </xsl:template> + + <xsl:template name="style-and-contents"> + <xsl:param name="cellStyleName" /> + + <!-- WorkAround of Excel2003 issue: + Styles from the CellStyle will not be inherited to HTML content (e.g. Colour style). + --> + <xsl:choose> + <xsl:when test="@text:style-name"> + <xsl:variable name="styles"> + <xsl:copy-of select="key('styles', @text:style-name)/*" /> + <xsl:copy-of select="key('styles', $cellStyleName)/*" /> + </xsl:variable> + <xsl:choose> + <xsl:when test="function-available('xalan:nodeset')"> + <xsl:call-template name="create-nested-format-tags"> + <xsl:with-param name="styles" select="xalan:nodeset($styles)" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('xt:node-set')"> + <xsl:call-template name="create-nested-format-tags"> + <xsl:with-param name="styles" select="xt:node-set($styles)" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('common:node-set')"> + <xsl:call-template name="create-nested-format-tags"> + <xsl:with-param name="styles" select="common:node-set($styles)" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">The required node-set function was not found!</xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@table:style-name"> + <xsl:variable name="styles"> + <xsl:copy-of select="key('styles', @text:style-name)/*" /> + <xsl:copy-of select="key('styles', $cellStyleName)/*" /> + </xsl:variable> + + <xsl:choose> + <xsl:when test="function-available('xalan:nodeset')"> + <xsl:call-template name="create-nested-format-tags"> + <xsl:with-param name="styles" select="xalan:nodeset($styles)" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('xt:node-set')"> + <xsl:call-template name="create-nested-format-tags"> + <xsl:with-param name="styles" select="xt:node-set($styles)" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('common:node-set')"> + <xsl:call-template name="create-nested-format-tags"> + <xsl:with-param name="styles" select="common:node-set($styles)" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">The required node-set function was not found!</xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- *********************************** --> + <!-- *** creating nested format tags *** --> + <!-- *********************************** --> + + <!-- Bold --> + <xsl:template name="create-nested-format-tags"> + <xsl:param name="styles" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="$styles/*/@fo:font-weight = 'bold' or $styles/*/@fo:font-weight = 'bolder'"> + <xsl:element namespace="{$namespace-html}" name="B"> + <xsl:call-template name="italic"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="italic"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- Italic --> + <xsl:template name="italic"> + <xsl:param name="styles" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="$styles/*/@fo:font-style = 'italic' or $styles/*/@fo:font-style = 'oblique'"> + <xsl:element namespace="{$namespace-html}" name="I"> + <xsl:call-template name="underline"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="underline"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- Underline --> + <xsl:template name="underline"> + <xsl:param name="styles" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="$styles/*/@style:text-underline-type and not($styles/*/@style:text-underline-type = 'none')"> + <xsl:element namespace="{$namespace-html}" name="U"> + <xsl:call-template name="strikethrough"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="strikethrough"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + + </xsl:template> + + + <!-- strikethrough --> + <xsl:template name="strikethrough"> + <xsl:param name="styles" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="$styles/*/@style:text-line-through-style and not($styles/*/@style:text-line-through-style = 'none')"> + <xsl:element namespace="{$namespace-html}" name="S"> + <xsl:call-template name="super-subscript"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="super-subscript"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + + <!-- superscript & subscript --> + <xsl:template name="super-subscript"> + <xsl:param name="styles" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="$styles/*/@style:text-position"> + <xsl:variable name="textPosition" select="number(substring-before($styles/*/@style:text-position, '% '))" /> + <xsl:choose> + <xsl:when test="$textPosition > 0"> + <xsl:element namespace="{$namespace-html}" name="Sup"> + <xsl:call-template name="align"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="$textPosition < 0"> + <xsl:element namespace="{$namespace-html}" name="Sub"> + <xsl:call-template name="align"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="align"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="align"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- Alignment - normally called by strikethrough, but no DIV elements in HTML --> + <xsl:template name="align"> + <xsl:param name="styles" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="$styles/*/@fo:font-align"> + <xsl:element namespace="{$namespace-html}" name="DIV"> + <xsl:attribute name="html:style"> + <xsl:choose> + <xsl:when test="$styles/*/@fo:font-align = 'start'"> + <xsl:text>text-align:left;</xsl:text> + </xsl:when> + <xsl:when test="$styles/*/@fo:font-align = 'end'"> + <xsl:text>text-align:right;</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>text-align:center;</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:call-template name="font"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="font"> + <xsl:with-param name="styles" select="$styles" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- Font (size and color) --> + <xsl:template name="font"> + <xsl:param name="styles" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="$styles/*/@style:font-name or + $styles/*/@fo:font-size or + $styles/*/@fo:color"> + <xsl:element namespace="{$namespace-html}" name="Font"> + <xsl:if test="$styles/*/@style:font-name"> + <xsl:attribute name="html:Face"> + <xsl:value-of select="$styles/*/@style:font-name" /> + </xsl:attribute> + </xsl:if> + <xsl:if test="$styles/*/@fo:color"> + <xsl:attribute name="html:Color"> + <xsl:value-of select="$styles/*/@fo:color" /> + </xsl:attribute> + </xsl:if> + <xsl:if test="$styles/*/@fo:font-size"> + <!-- WORKAROUND TO EXCEL2003 issue where nested FONT elements with size attributes result in unloadable documents --> + <!-- Only create size attribute if parent do not have already one --> + + <!--<xsl:choose> + <xsl:when test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)"> --> + <xsl:if test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)"> + <xsl:attribute name="html:Size"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$styles/*/@fo:font-size" /> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <!--</xsl:when> + <xsl:otherwise> + <xsl:message>Due Excel issue we have to neglect size from @text:style-name '<xsl:value-of select="@text:style-name"/>'!</xsl:message> + </xsl:otherwise> + </xsl:choose>--> + </xsl:if> + <!-- get the embedded content --> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:apply-templates> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <!-- get the embedded content --> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/filter/source/xslt/export/spreadsheetml/styles.xsl b/filter/source/xslt/export/spreadsheetml/styles.xsl new file mode 100644 index 000000000..a3c4b8bae --- /dev/null +++ b/filter/source/xslt/export/spreadsheetml/styles.xsl @@ -0,0 +1,686 @@ +<?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:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" + xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:dom="http://www.w3.org/2001/xml-events" + xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" + xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" + xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" + xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" + xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" + xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" + xmlns:ooo="http://openoffice.org/2004/office" + xmlns:oooc="http://openoffice.org/2004/calc" + xmlns:ooow="http://openoffice.org/2004/writer" + xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" + xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" + xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" + xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" + xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xt="http://www.jclark.com/xt" + xmlns:common="http://exslt.org/common" + xmlns:xalan="http://xml.apache.org/xalan" + xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan"> + + <!-- Used in case of 'style:map', conditional formatting, where a style references to another --> + <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name" /> + <!-- + Mapping of OOo style:name and style:family to excel ss:ID + Styles form style:style map from style:name to ss:Name + style:parent-style map to ss:Parent + --> + <!-- default styles of the application + <xsl:template match="style:default-style" mode="styles" > + <xsl:call-template name="style:style"> + <xsl:with-param name="styleName" select="'Default'" /> + </xsl:call-template> + </xsl:template> + --> + + <xsl:template match="style:style" mode="styles"> + <xsl:param name="isAutomatic" /> + <xsl:param name="styleName" select="@style:name" /> + <xsl:param name="styleParentName" select="@style:parent-style-name" /> + + <!-- only row styles used by cells are exported, + as usual row style properties are already exported as row attributes --> + <xsl:if test="not(@style:family='table-row') or @style:family='table-row' and key('getCellByStyle', '.')"> + <xsl:element name="Style"> + <xsl:attribute name="ss:ID"> + <!-- neglecting that a style is only unique in conjunction with its family name --> + <xsl:value-of select="@style:name" /> + </xsl:attribute> + <xsl:choose> + <xsl:when test="not($isAutomatic)"> + <xsl:choose> + <xsl:when test="@style:display-name"> + <xsl:attribute name="ss:Name"><xsl:value-of select="@style:display-name"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="ss:Name"><xsl:value-of select="@style:name" /></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <!-- when a non-allowed parent style is found + (in spreadsheetml no style with ss:Name is able to have a ss:Parent) --> + <xsl:when test="@style:parent-style-name"> + <!-- styles have to be merged (flatting heritance tree) --> + <xsl:variable name="stylePropertiesContainer"> + <xsl:call-template name="merge-all-parent-styles"> + <xsl:with-param name="currentStyle" select="." /> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="function-available('xalan:nodeset')"> + <xsl:call-template name="write-style-properties"> + <xsl:with-param name="styleProperties" select="xalan:nodeset($stylePropertiesContainer)/*" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('common:node-set')"> + <xsl:call-template name="write-style-properties"> + <xsl:with-param name="styleProperties" select="common:node-set($stylePropertiesContainer)/*" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('xt:node-set')"> + <xsl:call-template name="write-style-properties"> + <xsl:with-param name="styleProperties" select="xt:node-set($stylePropertiesContainer)/*" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">WARNING: The required node set function was not found!</xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="write-style-properties" /> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- automatic styles are implicit inheriting from a style called 'Default', + furthermore nor in spreadsheetml nor in OpenDocument automatic styles are able to inherit from each other --> + <xsl:choose> + <xsl:when test="@style:parent-style-name and not(@style:parent-style-name = 'Default')"> + <xsl:attribute name="ss:Parent"><xsl:value-of select="@style:parent-style-name" /></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:call-template name="write-style-properties" /> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + </xsl:template> + + <!-- resolving the style inheritance by starting from uppermost parent and + overriding existing style properties by new found child properties --> + <xsl:template name="merge-all-parent-styles"> + <xsl:param name="currentStyle" /> + + <xsl:choose> + <!-- in case of a parent, styles have to be merged (flatting heritance tree) --> + <xsl:when test="$currentStyle/@style:parent-style-name"> + <!-- collect parent style properties --> + <xsl:variable name="parentStyleContainer"> + <!-- take a look if the parent style has a parent himself --> + <xsl:call-template name="merge-all-parent-styles" > + <xsl:with-param name="currentStyle" select="key('styles', $currentStyle/@style:parent-style-name)" /> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="function-available('xalan:nodeset')"> + <xsl:call-template name="merge-style-properties"> + <xsl:with-param name="childStyleContainer" select="$currentStyle" /> + <xsl:with-param name="parentStyleContainer" select="xalan:nodeset($parentStyleContainer)" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('common:node-set')"> + <xsl:call-template name="merge-style-properties"> + <xsl:with-param name="childStyleContainer" select="$currentStyle" /> + <xsl:with-param name="parentStyleContainer" select="common:node-set($parentStyleContainer)" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('xt:node-set')"> + <xsl:call-template name="merge-style-properties"> + <xsl:with-param name="childStyleContainer" select="$currentStyle" /> + <xsl:with-param name="parentStyleContainer" select="xt:node-set($parentStyleContainer)" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">WARNING: The required node-set function was not found!</xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- called for top parents (or styles without parents) --> + <xsl:otherwise> + <xsl:copy-of select="$currentStyle/*"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="merge-style-properties"> + <xsl:param name="childStyleContainer" /> + <xsl:param name="parentStyleContainer" /> + + <xsl:choose> + <xsl:when test="$parentStyleContainer/*"> + <xsl:apply-templates select="$parentStyleContainer/*" mode="inheritance"> + <xsl:with-param name="childStyleContainer" select="$childStyleContainer" /> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$childStyleContainer/*"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="*" mode="inheritance"> + <xsl:param name="childStyleContainer" /> + + <!-- create an element named equal to the current properties parent element (e.g. style:table-cell-properties) --> + <xsl:element name="{name()}" namespace="urn:oasis:names:tc:opendocument:xmlns:style:1.0"> + <!-- attributes will be automatically replaced --> + <xsl:copy-of select="@*" /> + <xsl:copy-of select="$childStyleContainer/*[name() = name(current() )]/@*"/> + + <!-- elements are not needed yet, will be neglected for simplicity reasons --> + </xsl:element> + </xsl:template> + + <xsl:key match="/*/office:styles/number:date-style | + /*/office:styles/number:time-style | + /*/office:styles/number:number-style | + /*/office:styles/number:percentage-style | + /*/office:styles/number:currency-style | + /*/office:automatic-styles/number:date-style | + /*/office:automatic-styles/number:time-style | + /*/office:automatic-styles/number:number-style | + /*/office:automatic-styles/number:percentage-style | + /*/office:automatic-styles/number:currency-style" name="number-style" use="@style:name" /> + + + <xsl:template name="write-style-properties"> + <xsl:param name="styleProperties" select="key('styles', @style:name)/*" /> + + <xsl:call-template name="Alignment"> + <xsl:with-param name="styleProperties" select="$styleProperties" /> + </xsl:call-template> + <xsl:call-template name="Border"> + <xsl:with-param name="styleProperties" select="$styleProperties" /> + </xsl:call-template> + <xsl:call-template name="Font"> + <xsl:with-param name="styleProperties" select="$styleProperties" /> + <xsl:with-param name="styleParentName" select="@style:parent-style-name" /> + </xsl:call-template> + <xsl:call-template name="Interior"> + <xsl:with-param name="styleProperties" select="$styleProperties" /> + </xsl:call-template> + <xsl:call-template name="NumberFormat"> + <xsl:with-param name="styleProperties" select="$styleProperties" /> + </xsl:call-template> + </xsl:template> + + <!-- context is element 'style:style' --> + <xsl:template name="NumberFormat"> + <xsl:if test="@style:data-style-name"> + <xsl:variable name="numberStyleName" select="@style:data-style-name" /> + <xsl:variable name="numberStyle" select="key('number-style', $numberStyleName)" /> + + <xsl:element name="NumberFormat"> + <xsl:attribute name="ss:Format"> + <xsl:choose> + <xsl:when test="not($numberStyle/node())"> + <!-- Excel2003sp1 issue: 'General' and 'General Number' is not supported --> + <xsl:text>General</xsl:text> + </xsl:when> + <xsl:when test="name($numberStyle) = 'number:number-style'"> + <xsl:choose> + <xsl:when test="$numberStyle/number:scientific-number"> + <xsl:text>Scientific</xsl:text> + </xsl:when> + <!-- Excel2003sp1 issue: 'General Number' not supported --> + <xsl:when test="$numberStyle/number:number/@number:decimal-places and + $numberStyle/number:number/@number:decimal-places='0'"> + <xsl:text>General</xsl:text> + </xsl:when> + <xsl:when test="$numberStyle/number:text"> + <xsl:choose> + <xsl:when test="$numberStyle/number:text = 'No' or $numberStyle/number:text = 'Nein'"> + <xsl:text>Yes/No</xsl:text> + </xsl:when> + <xsl:when test="$numberStyle/number:text = 'False' or $numberStyle/number:text = 'Falsch'"> + <xsl:text>True/False</xsl:text> + </xsl:when> + <xsl:when test="$numberStyle/number:text = 'Off' or $numberStyle/number:text = 'Aus'"> + <xsl:text>On/Off</xsl:text> + </xsl:when> + <!-- Excel2003sp1 issue: currency is saved as 'float' --> + <xsl:when test="$numberStyle/number:currency-symbol"> + <xsl:choose> + <xsl:when test="contains($numberStyle/number:currency-symbol, '€')"> + <xsl:text>Euro Currency</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Currency</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- Excel2003sp1 issue: 'Currency' is saved as 'float' --> + <xsl:when test="contains($numberStyle/number:text, '$')"> + <xsl:text>Currency</xsl:text> + </xsl:when> + <!-- OASIS XML adaptation --> + <xsl:otherwise> + <xsl:text>General</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$numberStyle/number:grouping"> + <xsl:text>Standard</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Fixed</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name($numberStyle) = 'number:time-style'"> + <xsl:choose> + <xsl:when test="$numberStyle/number:am-pm"> + <xsl:choose> + <xsl:when test="$numberStyle/number:seconds"> + <xsl:text>Long Time</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Medium Time</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:text>Short Time</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name($numberStyle) = 'number:percentage-style'"> + <xsl:text>Percent</xsl:text> + </xsl:when> + <xsl:when test="name($numberStyle) = 'number:currency-style'"> + <xsl:choose> + <xsl:when test="contains($numberStyle/number:currency-symbol, '€')"> + <xsl:text>Euro Currency</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Currency</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$numberStyle/number:month"> + <xsl:choose> + <xsl:when test="$numberStyle/number:month/@number:textual and + $numberStyle/number:month/@number:textual=true()"> + <xsl:text>Medium Date</xsl:text> + <!-- Excel2003 sp1 issue: No difference between 'Long Date' and 'Medium Date' --> + </xsl:when> + <xsl:when test="$numberStyle/number:hours"> + <xsl:text>General Date</xsl:text> + </xsl:when> + <xsl:when test="$numberStyle/number:year/@number:style and + $numberStyle/number:year/@number:style='long'"> + <xsl:text>Short Date</xsl:text> + </xsl:when> + <!-- OASIS XML adaptation --> + <xsl:otherwise> + <xsl:text>Short Date</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- OASIS XML adaptation --> + <xsl:otherwise> + <xsl:text>General</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:template> + + <xsl:template name="Alignment"> + <xsl:param name="styleProperties" /> + + <!-- An empty Alignment element, might overwrite parents setting by + the default attributes --> + <xsl:if test="$styleProperties/@fo:text-align or + $styleProperties/@style:vertical-align or + $styleProperties/@fo:wrap-option or + $styleProperties/@fo:margin-left or + $styleProperties/@style:rotation-angle or + $styleProperties/@style:direction"> + <xsl:element name="Alignment"> + <xsl:if test="$styleProperties/@fo:text-align"> + <xsl:attribute name="ss:Horizontal"> + <xsl:choose> + <xsl:when test="$styleProperties/@fo:text-align = 'center'">Center</xsl:when> + <xsl:when test="$styleProperties/@fo:text-align = 'end'">Right</xsl:when> + <xsl:when test="$styleProperties/@fo:text-align = 'justify'">Justify</xsl:when> + <xsl:otherwise>Left</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:vertical-align"> + <xsl:attribute name="ss:Vertical"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:vertical-align = 'top'">Top</xsl:when> + <xsl:when test="$styleProperties/@style:vertical-align = 'bottom'">Bottom</xsl:when> + <xsl:when test="$styleProperties/@style:vertical-align = 'middle'">Center</xsl:when> + <xsl:otherwise>Automatic</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@fo:wrap-option = 'wrap'"> + <xsl:attribute name="ss:WrapText">1</xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@fo:margin-left"> + <xsl:attribute name="ss:Indent"> + <xsl:variable name="margin"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$styleProperties/@fo:margin-left" /> + <xsl:with-param name="rounding-factor" select="1" /> + </xsl:call-template> + </xsl:variable> + <!-- one ss:Indent is equal to 10 points --> + <xsl:value-of select="number($margin) div 10"/> + </xsl:attribute> + </xsl:if> + <!-- Excel is only able to rotate between 90 and -90 degree (inclusive). + Other degrees will be mapped by 180 degrees --> + <xsl:if test="$styleProperties/@style:rotation-angle"> + <xsl:attribute name="ss:Rotate"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:rotation-angle > 90"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:rotation-angle >= 270"> + <xsl:value-of select="$styleProperties/@style:rotation-angle - 360" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:rotation-angle - 180" /> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$styleProperties/@style:rotation-angle < -90"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:rotation-angle <= -270"> + <xsl:value-of select="$styleProperties/@style:rotation-angle + 360" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:rotation-angle + 180" /> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:rotation-angle" /> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:direction = 'ttb'"> + <xsl:attribute name="ss:VerticalText">1</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + + + <xsl:template name="Border"> + <xsl:param name="styleProperties" /> + + <!-- An empty border element, might overwrite parents setting by + the default attributes --> + <xsl:if test="$styleProperties/@fo:border or + $styleProperties/@fo:border-bottom or + $styleProperties/@fo:border-left or + $styleProperties/@fo:border-right or + $styleProperties/@fo:border-top"> + <xsl:element name="Borders"> + <xsl:if test="$styleProperties/@fo:border-bottom and not($styleProperties/@fo:border-bottom = 'none')"> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Bottom</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-bottom" /> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@fo:border-left and not($styleProperties/@fo:border-left = 'none')"> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Left</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-left" /> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@fo:border-right and not($styleProperties/@fo:border-right = 'none')"> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Right</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-right" /> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@fo:border-top and not($styleProperties/@fo:border-top = 'none')"> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Top</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-top" /> + </xsl:call-template> + </xsl:element> + </xsl:if> + <!-- write out all table border --> + <xsl:if test="$styleProperties/@fo:border and not($styleProperties/@fo:border = 'none')"> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Bottom</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" /> + </xsl:call-template> + </xsl:element> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Left</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" /> + </xsl:call-template> + </xsl:element> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Right</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" /> + </xsl:call-template> + </xsl:element> + <xsl:element name="Border"> + <xsl:attribute name="ss:Position">Top</xsl:attribute> + <xsl:call-template name="border-attributes"> + <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" /> + </xsl:call-template> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + + + <xsl:template name="border-attributes"> + <xsl:param name="border_properties" /> + + <xsl:variable name="border-width"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-before($border_properties, ' ')" /> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="border-style" select="substring-before(substring-after($border_properties, ' '), ' ')" /> + <xsl:variable name="border-color" select="substring-after(substring-after($border_properties, ' '), ' ')" /> +<!-- + <xsl:message>border-width:<xsl:value-of select="$border-width" /></xsl:message> + <xsl:message>border-style:<xsl:value-of select="$border-style" /></xsl:message> + <xsl:message>border-color:<xsl:value-of select="$border-color" /></xsl:message> + --> + + <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet --> + <xsl:attribute name="ss:LineStyle"> + <xsl:choose> + <xsl:when test="$border-style = 'none'">None</xsl:when> + <xsl:when test="$border-style = 'double'">Double</xsl:when> + <xsl:otherwise>Continuous</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + + <xsl:attribute name="ss:Weight"> + <xsl:choose> + <!-- 0: Hairline --> + <xsl:when test="$border-width <= 0.002">0</xsl:when> + <!-- 1: Thin --> + <xsl:when test="$border-width <= 0.035">1</xsl:when> + <!-- 2: Medium --> + <xsl:when test="$border-width <= 0.088">2</xsl:when> + <!-- 3: Thick --> + <xsl:otherwise>3</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + + <xsl:attribute name="ss:Color"> + <xsl:choose> + <xsl:when test="$border-color"><xsl:value-of select="$border-color" /></xsl:when> + <xsl:otherwise>Automatic</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:template> + + + <xsl:template name="Font"> + <xsl:param name="styleProperties" /> + <xsl:param name="styleParentName" /> + + <!-- An empty font element, might overwrite parents setting by + the default attributes --> + <xsl:if test="$styleProperties/@style:font-weight or + $styleProperties/@fo:color or + $styleProperties/@style:font-name or + $styleProperties/@fo:font-style or + $styleProperties/@style:text-outline or + $styleProperties/@style:text-shadow or + $styleProperties/@style:font-size or + $styleProperties/@style:text-line-through-style or + $styleProperties/@style:text-underline-type or + $styleProperties/@style:text-underline-style or + $styleProperties/@style:text-position"> + + + <xsl:element name="Font"> + <xsl:call-template name="getParentBold"> + <xsl:with-param name="styleProperties" select="$styleProperties" /> + <xsl:with-param name="styleParentName" select="$styleParentName" /> + </xsl:call-template> + <xsl:if test="$styleProperties/@fo:color"> + <xsl:attribute name="ss:Color"><xsl:value-of select="$styleProperties/@fo:color" /></xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:font-name"> + <xsl:attribute name="ss:FontName"><xsl:value-of select="$styleProperties/@style:font-name" /></xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@fo:font-style = 'italic'"> + <xsl:attribute name="ss:Italic">1</xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-outline = 'true'"> + <xsl:attribute name="ss:Outline">1</xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-shadow = 'shadow'"> + <xsl:attribute name="ss:Shadow">1</xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@fo:font-size"> + <xsl:attribute name="ss:Size"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$styleProperties/@fo:font-size" /> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-line-through-style and $styleProperties/@style:text-line-through-style != 'none'"> + <xsl:attribute name="ss:StrikeThrough">1</xsl:attribute> + </xsl:if> + <xsl:if test="($styleProperties/@style:text-underline-type and $styleProperties/@style:text-underline-type != 'none') or + ($styleProperties/@style:text-underline-style and $styleProperties/@style:text-underline-style != 'none')"> + <xsl:attribute name="ss:Underline"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:text-underline-type = 'double'">Double</xsl:when> + <xsl:otherwise>Single</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-position"> + <xsl:attribute name="ss:VerticalAlign"> + <xsl:choose> + <xsl:when test="substring-before($styleProperties/@style:text-position, '% ') > 0">Superscript</xsl:when> + <xsl:otherwise>Subscript</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + + <xsl:template name="Interior"> + <xsl:param name="styleProperties" /> + <xsl:if test="$styleProperties/@fo:background-color and not($styleProperties/@fo:background-color = 'transparent')"> + <xsl:element name="Interior"> + <xsl:attribute name="ss:Color"> + <xsl:value-of select="$styleProperties/@fo:background-color" /> + </xsl:attribute> + <!-- Background color (i.e. Interior/ss:Color) not shown without ss:Pattern (or with 'none') + Therefore a default is set --> + <xsl:attribute name="ss:Pattern">Solid</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:template> + + <!-- Excel issue workaround: <Font ss:Bold="1"> is not inherited --> + <xsl:template name="getParentBold"> + <xsl:param name="styleProperties" /> + <xsl:param name="styleParentName" /> + <xsl:param name="styleName" /> + + <xsl:if test="$styleParentName and $styleParentName != $styleName"> + <xsl:choose> + <xsl:when test="$styleProperties/@fo:font-weight = 'bold'"> + <xsl:attribute name="ss:Bold">1</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="getParentBold"> + <xsl:with-param name="styleProperties" select="key('styles', $styleParentName)/*" /> + <xsl:with-param name="styleParentName" select="key('styles', $styleParentName)/@style:parent-style-name" /> + <xsl:with-param name="styleName" select="$styleParentName" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + +</xsl:stylesheet> diff --git a/filter/source/xslt/export/spreadsheetml/table.xsl b/filter/source/xslt/export/spreadsheetml/table.xsl new file mode 100644 index 000000000..73d16b3eb --- /dev/null +++ b/filter/source/xslt/export/spreadsheetml/table.xsl @@ -0,0 +1,928 @@ +<?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:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" + xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:dom="http://www.w3.org/2001/xml-events" + xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" + xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" + xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" + xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" + xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" + xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" + xmlns:ooo="http://openoffice.org/2004/office" + xmlns:oooc="http://openoffice.org/2004/calc" + xmlns:ooow="http://openoffice.org/2004/writer" + xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" + xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" + xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" + xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" + xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xt="http://www.jclark.com/xt" + xmlns:common="http://exslt.org/common" + xmlns:xalan="http://xml.apache.org/xalan" + xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan"> + + + <!-- ************** --> + <!-- *** Table *** --> + <!-- ************** --> + + <!-- check existence of default cell style --> + <xsl:variable name="firstDefaultCellStyle" select="descendant::table:table-column/@table:default-cell-style-name" /> + + + <xsl:template match="table:table" name="table:table"> + <xsl:element name="Table"> + <xsl:apply-templates select="@table:style-name" /> + + <!-- find all columns in the table --> + <xsl:variable name="columnNodes" select="descendant::table:table-column" /> + <!-- calculate the overall column amount --> + <xsl:variable name="maxColumnNo"> + <xsl:choose> + <xsl:when test="$columnNodes/@table:number-columns-repeated"> + <xsl:value-of select="count($columnNodes) + + number(sum($columnNodes/@table:number-columns-repeated)) + - count($columnNodes/@table:number-columns-repeated)" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="count($columnNodes)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- create columns --> + <xsl:apply-templates select="$columnNodes[1]"> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + <xsl:with-param name="maxColumnNo" select="$maxColumnNo" /> + </xsl:apply-templates> + + <!-- create rows --> + <xsl:choose> + <xsl:when test="not($columnNodes/@table:number-columns-repeated)"> + <xsl:call-template name="optimized-row-handling"> + <xsl:with-param name="rowNodes" select="descendant::table:table-row" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- To be able to match from a cell to the corresponding column to match @table:default-cell-style-name, + the repeated columns are being resolved by copying them in a helper variable --> + <xsl:variable name="columnNodes-RTF"> + <xsl:for-each select="$columnNodes"> + <xsl:call-template name="adding-column-styles-entries" /> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="function-available('xalan:nodeset')"> + <xsl:call-template name="optimized-row-handling"> + <xsl:with-param name="rowNodes" select="descendant::table:table-row" /> + <xsl:with-param name="columnNodes" select="xalan:nodeset($columnNodes-RTF)" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('common:node-set')"> + <xsl:call-template name="optimized-row-handling"> + <xsl:with-param name="rowNodes" select="descendant::table:table-row" /> + <xsl:with-param name="columnNodes" select="common:node-set($columnNodes-RTF)" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('xt:node-set')"> + <xsl:call-template name="optimized-row-handling"> + <xsl:with-param name="rowNodes" select="descendant::table:table-row" /> + <xsl:with-param name="columnNodes" select="xt:node-set($columnNodes-RTF)" /> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:template> + + + <!-- **************** --> + <!-- *** Columns *** --> + <!-- **************** --> + + <xsl:template match="table:table-column"> + <xsl:param name="columnNodes" /> + <xsl:param name="currentColumnNumber" select="1" /> + <xsl:param name="setIndex" select="false()" /> + <xsl:param name="maxColumnNo" /> + + <xsl:element name="Column"> + <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'"> + <xsl:attribute name="ss:Hidden">1</xsl:attribute> + </xsl:if> + + <xsl:if test="@table:number-columns-repeated"> + <xsl:attribute name="ss:Span"> + <xsl:value-of select="@table:number-columns-repeated - 1" /> + </xsl:attribute> + </xsl:if> + + <xsl:if test="$setIndex"> + <xsl:attribute name="ss:Index"> + <xsl:value-of select="$currentColumnNumber" /> + </xsl:attribute> + </xsl:if> + + <xsl:choose> + <xsl:when test="@style:use-optimal-column-width = 'true'"> + <xsl:attribute name="ss:AutoFitWidth">1</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="width" select="key('styles', @table:style-name)/style:table-column-properties/@style:column-width" /> + <xsl:if test="$width"> + <xsl:attribute name="ss:Width"> + <!-- using the absolute width in point --> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$width" /> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="@table:number-columns-repeated"> + <xsl:attribute name="ss:Span"> + <xsl:value-of select="@table:number-columns-repeated - 1" /> + </xsl:attribute> + </xsl:if> + </xsl:element> + + <xsl:variable name="columnNumber"> + <xsl:choose> + <xsl:when test="@table:number-columns-repeated"> + <xsl:value-of select="$currentColumnNumber + @table:number-columns-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$currentColumnNumber"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$columnNumber < $maxColumnNo"> + <xsl:variable name="nextColumnNodes" select="$columnNodes[position() != 1]" /> + <xsl:choose> + <xsl:when test="@table:number-columns-repeated"> + <xsl:apply-templates select="$nextColumnNodes[1]"> + <xsl:with-param name="columnNodes" select="$nextColumnNodes" /> + <xsl:with-param name="currentColumnNumber" select="$columnNumber" /> + <xsl:with-param name="maxColumnNo" select="$maxColumnNo" /> + <xsl:with-param name="setIndex" select="true()" /> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$nextColumnNodes[1]"> + <xsl:with-param name="columnNodes" select="$nextColumnNodes" /> + <xsl:with-param name="currentColumnNumber" select="$columnNumber + 1" /> + <xsl:with-param name="maxColumnNo" select="$maxColumnNo" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + + <!-- current node is a table:table-column --> + <xsl:template name="adding-column-styles-entries"> + <xsl:choose> + <xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)"> + <!-- writes an entry of a column in the columns-variable --> + <xsl:copy-of select="." /> + </xsl:when> + <xsl:otherwise> + <!-- repeated columns will be written explicit several times in the variable--> + <xsl:call-template name="repeat-adding-table-column"> + <xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- current node is a table:table-column --> + <!-- duplicates column elements in case of column-repeated attribute --> + <xsl:template name="repeat-adding-table-column"> + <xsl:param name="table:table-column" /> + <xsl:param name="numberColumnsRepeated" /> + + <xsl:choose> + <xsl:when test="$numberColumnsRepeated > 1"> + <!-- writes an entry of a column in the columns-variable --> + <xsl:copy-of select="." /> + <!-- repeat calling this method until all elements written out --> + <xsl:call-template name="repeat-adding-table-column"> + <xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- writes an entry of a column in the columns-variable --> + <xsl:copy-of select="." /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- ************* --> + <!-- *** Rows *** --> + <!-- ************* --> + + + <!-- Recursions are much faster when the stack size is small --> + <xsl:template name="optimized-row-handling"> + <xsl:param name="rowNodes" /> + <xsl:param name="columnNodes" /> + <xsl:param name="offset" select="0"/> + <xsl:param name="threshold" select="10"/> + + <xsl:variable name="rowCount" select="count($rowNodes)"/> + <xsl:choose> + <xsl:when test="$rowCount <= $threshold"> + <xsl:apply-templates select="$rowNodes[1]"> + <xsl:with-param name="rowNodes" select="$rowNodes" /> + <xsl:with-param name="offset" select="$offset" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="rowCountHalf" select="floor($rowCount div 2)"/> + <xsl:variable name="rowNodesSetA" select="$rowNodes[position() <= $rowCountHalf]"/> + <xsl:variable name="rowNodesSetB" select="$rowNodes[position() > $rowCountHalf]"/> + <!-- to keep track of the rownumber, the repeated rows have to kept into accounts --> + <xsl:variable name="rowsCreatedByRepetition"> + <xsl:choose> + <xsl:when test="$rowNodesSetA/@table:number-rows-repeated"> + <xsl:value-of select="number(sum($rowNodesSetA/@table:number-rows-repeated)) + - count($rowNodesSetA/@table:number-rows-repeated)" /> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$rowCountHalf > $threshold"> + <xsl:call-template name="optimized-row-handling"> + <xsl:with-param name="rowNodes" select="$rowNodesSetA"/> + <xsl:with-param name="offset" select="$offset" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + <xsl:call-template name="optimized-row-handling"> + <xsl:with-param name="rowNodes" select="$rowNodesSetB"/> + <xsl:with-param name="offset" select="$offset + $rowCountHalf + $rowsCreatedByRepetition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$rowNodesSetA[1]"> + <xsl:with-param name="rowNodes" select="$rowNodesSetA"/> + <xsl:with-param name="offset" select="$offset" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + <xsl:apply-templates select="$rowNodesSetB[1]"> + <xsl:with-param name="rowNodes" select="$rowNodesSetB" /> + <xsl:with-param name="offset" select="$offset + $rowCountHalf + $rowsCreatedByRepetition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- + Rows as "table:table-row" might be grouped in + "table:table-header-rows" or "table:table-row-group" + This row-tree will be traversed providing each Row with its + calculatedRowPosition and earlierRowNumber. + By this repeated empty rows might be neglected in the spreadsheetml output, + as the following row will notice the 'gap' and provide @ss:Index, + which results in filling up the gap by a row without style and content. + + In Excel created rows by ss:Index are 'default' rows. + --> + <xsl:template match="table:table-row"> + <xsl:param name="earlierRowNumber" select="0" /> + <xsl:param name="offset" /> + <xsl:param name="calculatedRowPosition" select="$offset + 1" /> + <xsl:param name="rowNodes" /> + <xsl:param name="columnNodes" /> + + <xsl:choose> + <xsl:when test="@table:number-rows-repeated > 1"> + <xsl:call-template name="write-table-row"> + <xsl:with-param name="earlierRowNumber" select="$earlierRowNumber" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + <xsl:if test="@table:number-rows-repeated > 2 and (table:table-cell/@office:value-type or $firstDefaultCellStyle != '')"> + <!-- In case a cell is being repeated, the cell will be created + in a variable, which is as many times given out, as being repeated --> + <xsl:variable name="tableRow"> + <xsl:call-template name="write-table-row"> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="optimized-row-repeating"> + <xsl:with-param name="tableRow" select="$tableRow" /> + <xsl:with-param name="repetition" select="@table:number-rows-repeated - 1" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="write-table-row"> + <xsl:with-param name="earlierRowNumber" select="$earlierRowNumber" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + + <xsl:variable name="nextRowNodes" select="$rowNodes[position()!=1]" /> + <xsl:choose> + <xsl:when test="@table:number-rows-repeated > 1"> + <xsl:apply-templates select="$nextRowNodes[1]"> + <xsl:with-param name="earlierRowNumber" select="$calculatedRowPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition + @table:number-rows-repeated" /> + <xsl:with-param name="rowNodes" select="$nextRowNodes" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$nextRowNodes[1]"> + <xsl:with-param name="earlierRowNumber" select="$calculatedRowPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition + 1" /> + <xsl:with-param name="rowNodes" select="$nextRowNodes" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="write-table-row"> + <xsl:param name="earlierRowNumber" select="0" /> + <xsl:param name="calculatedRowPosition" select="1" /> + <xsl:param name="columnNodes" /> + + <xsl:element name="Row"> + <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'"> + <xsl:attribute name="ss:Hidden">1</xsl:attribute> + </xsl:if> + <xsl:if test="not($earlierRowNumber + 1 = $calculatedRowPosition)"> + <xsl:attribute name="ss:Index"><xsl:value-of select="$calculatedRowPosition" /></xsl:attribute> + </xsl:if> + + <!-- writing the style of the row --> + <xsl:apply-templates select="@table:style-name" mode="table-row" /> + + <xsl:variable name="rowProperties" select="key('styles', @table:style-name)/*" /> + <xsl:if test="$rowProperties/@style:use-optimal-row-height = 'false'"> + <!-- default is '1', therefore write only '0' --> + <xsl:attribute name="ss:AutoFitHeight">0</xsl:attribute> + </xsl:if> + + <xsl:variable name="height" select="$rowProperties/@style:row-height" /> + <xsl:if test="$height"> + <xsl:attribute name="ss:Height"> + <!-- using the absolute height in point --> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$height" /> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates select="table:table-cell[1]"> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="cellNodes" select="table:table-cell" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:element> + </xsl:template> + + + <!-- Recursions are much faster when the stack size is small --> + <xsl:template name="optimized-row-repeating"> + <xsl:param name="tableRow" /> + <xsl:param name="repetition" /> + <!-- resource optimization: instead of '1' it will be '1000' and the column is not full --> + <xsl:param name="thresholdmax" select="512"/> + <xsl:param name="thresholdmin" select="256"/> + + <xsl:choose> + <xsl:when test="$repetition <= $thresholdmax"> + <xsl:copy-of select="$tableRow" /> + <xsl:if test="$repetition >= $thresholdmin"> + <xsl:call-template name="optimized-row-repeating"> + <xsl:with-param name="repetition" select="$repetition - 1"/> + <xsl:with-param name="tableRow" select="$tableRow" /> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$repetition mod 2 = 1"> + <xsl:copy-of select="$tableRow" /> + </xsl:if> + <xsl:variable name="repetitionHalf" select="floor($repetition div 2)"/> + <xsl:call-template name="optimized-row-repeating"> + <xsl:with-param name="repetition" select="$repetitionHalf"/> + <xsl:with-param name="tableRow" select="$tableRow" /> + </xsl:call-template> + <xsl:call-template name="optimized-row-repeating"> + <xsl:with-param name="repetition" select="$repetitionHalf"/> + <xsl:with-param name="tableRow" select="$tableRow" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + + <!-- ************** --> + <!-- *** Cells *** --> + <!-- ************** --> + + <!-- Table cells are able to be repeated by attribute in StarOffice, + but not in Excel. If more cells are repeated --> + <xsl:template name="table:table-cell" match="table:table-cell"> + <xsl:param name="calculatedCellPosition" select="1" /><!-- the later table position of the current cell --> + <xsl:param name="calculatedRowPosition" /><!-- the later table position of the current row --> + <xsl:param name="setIndex" select="false()" /> <!-- if not '0' @ss:Index used for neglecting repeated empty cells --> + <xsl:param name="repetition" select="@table:number-columns-repeated" /> <!-- used for explicit written out cells --> + <xsl:param name="repetitionCellPosition" select="$calculatedCellPosition" /><!-- during repetition formula needs exact cell positioning --> + <xsl:param name="nextMatchedCellPosition"><!-- the later table position of the next cell --> + <xsl:choose> + <xsl:when test="not(@table:number-columns-repeated) and not(@table:number-columns-spanned)"> + <xsl:value-of select="$calculatedCellPosition + 1" /> + </xsl:when> + <xsl:when test="not(@table:number-columns-spanned)"> + <xsl:value-of select="$calculatedCellPosition + @table:number-columns-repeated" /> + </xsl:when> + <xsl:when test="not(@table:number-columns-repeated)"> + <xsl:value-of select="$calculatedCellPosition + @table:number-columns-spanned" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$calculatedCellPosition + @table:number-columns-spanned * @table:number-columns-repeated" /> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + <xsl:param name="cellNodes" /><!-- cells to be handled --> + <xsl:param name="columnNodes" /> + + <xsl:choose> + <!-- in case a repetition took place --> + <xsl:when test="$repetition > 0"> + <xsl:choose> + <!-- In case of no cell content (text, subelements, attribute, except repeated style) the ss:Index could be used --> + <xsl:when test="not(text()) and not(*) and not(@*[name() != 'table:number-columns-repeated'])"> + <xsl:choose> + <xsl:when test="count($cellNodes) = 1"> + <xsl:call-template name="create-table-cell"> + <xsl:with-param name="setIndex" select="true()" /> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition - 1" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$cellNodes[2]"> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="setIndex" select="true()" /> + <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- Fastest cell repetition by creating cell once and copying, works not for + a) cells with formula (need of actual cell position) + b) cells, which start with ss:Index (as ss:Index is not allowed to be repeated) --> + <xsl:when test="not(@table:formula) and not($setIndex)"> + <!-- In case a non-empty cell is being repeated, the cell will be created + in a variable, which is as many times given out, as being repeated --> + <xsl:variable name="tableCell"> + <xsl:call-template name="create-table-cell"> + <xsl:with-param name="setIndex" select="false()" /><!-- copied cells may not have indices --> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="repeat-copy-table-cell"> + <xsl:with-param name="tableCell" select="$tableCell" /> + <xsl:with-param name="repetition" select="$repetition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + <xsl:apply-templates select="$cellNodes[2]"> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:when> + <!-- explicit writing (instead of copying) of cell for the cases mentioned above --> + <xsl:otherwise> + <xsl:call-template name="create-table-cell"> + <xsl:with-param name="setIndex" select="$setIndex" /><!-- a possible Index will be created --> + <xsl:with-param name="calculatedCellPosition" select="$repetitionCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + <xsl:choose> + <!-- as long there is a repetition (higher '1') stay on the same cell node --> + <xsl:when test="$repetition > 1"> + <xsl:call-template name="table:table-cell"> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="repetitionCellPosition"> + <xsl:choose> + <xsl:when test="@table:number-columns-spanned"> + <xsl:value-of select="$repetitionCellPosition + @table:number-columns-spanned" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$repetitionCellPosition + 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="nextMatchedCellPosition" select="$nextMatchedCellPosition" /> + <xsl:with-param name="repetition" select="$repetition - 1" /> + <xsl:with-param name="cellNodes" select="$cellNodes" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$cellNodes[2]"> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- in case no repetition took place --> + <xsl:choose> + <!-- neglect an empty cell by using ss:Index Attribute --> + <xsl:when test="not(text()) and not(*) and not(@*)"> + <xsl:choose> + <!-- if it is the last cell, write this cell --> + <xsl:when test="count($cellNodes) = 1"> + <xsl:call-template name="create-table-cell"> + <xsl:with-param name="setIndex" select="true()" /> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition - 1" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$cellNodes[2]"> + <xsl:with-param name="setIndex" select="true()" /> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- create cell and use/unset the ss:Index --> + <xsl:call-template name="create-table-cell"> + <xsl:with-param name="setIndex" select="$setIndex" /> + <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:call-template> + <xsl:apply-templates select="$cellNodes[2]"> + <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" /> + <xsl:with-param name="columnNodes" select="$columnNodes" /> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Copies the variable 'tableCell' to the output as often as 'repetition' --> + <xsl:template name="repeat-copy-table-cell"> + <xsl:param name="tableCell" /> + <xsl:param name="repetition" /> + + <xsl:if test="$repetition > 0"> + <xsl:copy-of select="$tableCell"/> + <xsl:call-template name="repeat-copy-table-cell"> + <xsl:with-param name="tableCell" select="$tableCell" /> + <xsl:with-param name="repetition" select="$repetition - 1" /> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="create-table-cell"> + <xsl:param name="setIndex" select="false()" /> + <xsl:param name="calculatedCellPosition" /> + <xsl:param name="calculatedRowPosition" /> + <xsl:param name="columnNodes" /> + + <xsl:element name="Cell" namespace="urn:schemas-microsoft-com:office:spreadsheet"> + <xsl:if test="$setIndex"> + <xsl:attribute name="ss:Index"> + <xsl:value-of select="$calculatedCellPosition"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@table:number-columns-spanned > 1"> + <xsl:attribute name="ss:MergeAcross"> + <xsl:value-of select="@table:number-columns-spanned - 1" /> + </xsl:attribute> + </xsl:if> + <xsl:if test="@table:number-rows-spanned > 1"> + <xsl:attribute name="ss:MergeDown"> + <xsl:value-of select="@table:number-rows-spanned - 1" /> + </xsl:attribute> + </xsl:if> + <xsl:variable name="link" select="descendant::text:a/@xlink:href" /> + <xsl:if test="$link"> + <xsl:attribute name="ss:HRef"> + <xsl:value-of select="$link" /> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="@table:style-name"> + <xsl:apply-templates select="@table:style-name" /> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$firstDefaultCellStyle != ''"> + <xsl:variable name="defaultCellStyle" select="$columnNodes/table:table-column[position() = $calculatedCellPosition]/@table:default-cell-style-name" /> + <xsl:if test="$defaultCellStyle"> + <xsl:if test="not($defaultCellStyle = 'Default')"> + <xsl:attribute name="ss:StyleID"><xsl:value-of select="$defaultCellStyle"/></xsl:attribute> + </xsl:if> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="@table:formula"> + <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" /> + <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" /> + </xsl:apply-templates> + <xsl:choose> + <xsl:when test="*"> + <!-- in case it is not an empty cell + + As the sequence of comment and data is opposite in Excel and Calc no match work here, in both comments exist only once + Possible Table Content of interest: text:h|text:p|text:list --> + <xsl:if test="text:h | text:p | text:list"> + <xsl:variable name="valueType"> + <xsl:choose> + <xsl:when test="@office:value-type"> + <xsl:value-of select="@office:value-type" /> + </xsl:when> + <xsl:otherwise>string</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="ss:Data"> + <xsl:with-param name="valueType" select="$valueType" /> + <xsl:with-param name="cellStyleName" select="@table:style-name" /> + </xsl:call-template> + </xsl:if> + + <xsl:if test="office:annotation"> + <xsl:element name="Comment"> + <xsl:if test="office:annotation/@office:author"> + <xsl:attribute name="ss:Author"><xsl:value-of select="office:annotation/@office:author" /></xsl:attribute> + </xsl:if> + <xsl:if test="office:annotation/@office:display = 'true'"> + <xsl:attribute name="ss:ShowAlways">1</xsl:attribute> + </xsl:if> + <!-- ss:Data is obligatory, but not the same as the ss:Cell ss:Data child, as it has no attributes --> + <ss:Data xmlns="http://www.w3.org/TR/REC-html40"> + <xsl:for-each select="office:annotation/text:p"> + <xsl:choose> + <xsl:when test="*"> + <!-- paragraph style have to be neglected due to Excel error, + which does not allow shadowing their HTML attributes --> + <xsl:for-each select="*"> + <xsl:call-template name="style-and-contents" /> + </xsl:for-each> + </xsl:when> + <xsl:when test="@text:style-name"> + <xsl:call-template name="style-and-contents" /> + </xsl:when> + <xsl:otherwise> + <!-- if no style is set, BOLD is set as default --> + <B> + <xsl:call-template name="style-and-contents" /> + </B> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </ss:Data> + </xsl:element> + </xsl:if> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:template> + + <!-- comments are handled separately in the cell --> + <xsl:template match="office:annotation" /> + <xsl:template match="dc:date" /> + + <xsl:template name="ss:Data"> + <!-- the default value is 'String' in the office --> + <xsl:param name="valueType" select="'string'" /> + <xsl:param name="cellStyleName" /> + + <xsl:choose> + <xsl:when test="descendant::*/@text:style-name"> + <xsl:choose> + <xsl:when test="$valueType = 'string'"> + <ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:apply-templates> + </ss:Data> + </xsl:when> + <xsl:when test="$valueType = 'boolean'"> + <ss:Data ss:Type="Boolean" xmlns="http://www.w3.org/TR/REC-html40"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:apply-templates> + </ss:Data> + </xsl:when> + <xsl:when test="$valueType = 'date'"> + <ss:Data ss:Type="DateTime" xmlns="http://www.w3.org/TR/REC-html40"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:apply-templates> + </ss:Data> + </xsl:when> + <!-- float, time, percentage, currency (no 'Error' setting) --> + <xsl:otherwise> + <ss:Data ss:Type="Number" xmlns="http://www.w3.org/TR/REC-html40"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:apply-templates> + </ss:Data> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:element name="Data"> + <xsl:call-template name="ss:Type"> + <xsl:with-param name="valueType" select="$valueType" /> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template name="ss:Type"> + <xsl:param name="valueType" select="'string'" /> + + <xsl:choose> + <xsl:when test="$valueType = 'string'"> + <xsl:attribute name="ss:Type">String</xsl:attribute> + <xsl:apply-templates select="*"/> + </xsl:when> + <xsl:when test="$valueType = 'boolean'"> + <xsl:attribute name="ss:Type">Boolean</xsl:attribute> + <xsl:choose> + <xsl:when test="@office:boolean-value = 'true'">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$valueType = 'date' or $valueType = 'time'"> + <!-- issue in Excel: can not have an empty 'DateTime' cell --> + <xsl:attribute name="ss:Type">DateTime</xsl:attribute> + <!-- Gathering information of two StarOffice date/time attributes + Excel always needs both pieces of information in one attribute --> + <xsl:choose> + <xsl:when test="@office:date-value"> + <!-- office:date-value may contain time (after 'T')--> + <xsl:choose> + <xsl:when test="contains(@office:date-value, 'T')"> + <!-- in case time is also part of the date --> + <xsl:value-of select="substring-before(@office:date-value, 'T')" /> + <xsl:text>T</xsl:text> + <xsl:value-of select="substring-after(@office:date-value,'T')" /> + <xsl:if test="not(contains(@office:date-value,'.'))"> + <xsl:text>.</xsl:text> + </xsl:if> + <xsl:text>000</xsl:text> + </xsl:when> + <xsl:when test="@office:time-value"> + <!-- contains date and time (time will be evaluated later --> + <xsl:value-of select="@office:date-value" /> + <xsl:text>T</xsl:text> + <xsl:choose> + <xsl:when test="@table:formula or contains(@office:time-value,',')"> + <!-- customized number types not implemented yet --> + <xsl:text>00:00:00.000</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate(substring-after(@office:time-value,'PT'),'HMS','::.')" /> + <xsl:if test="not(contains(@office:time-value,'S'))"> + <xsl:text>.</xsl:text> + </xsl:if> + <xsl:text>000</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@office:date-value" /> + <xsl:text>T00:00:00.000</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:if test="@office:time-value"> + <xsl:text>1899-12-31T</xsl:text> + <xsl:choose> + <xsl:when test="@table:formula or contains(@office:time-value,',')"> + <!-- customized number types not implemented yet --> + <xsl:text>00:00:00.000</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate(substring-after(@office:time-value,'PT'),'HMS','::.')" /> + <xsl:if test="not(contains(@office:time-value,'S'))"> + <xsl:text>.</xsl:text> + </xsl:if> + <xsl:text>000</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <!-- float, percentage, currency (no 'Error' setting) --> + <xsl:otherwise> + <xsl:attribute name="ss:Type">Number</xsl:attribute> + <xsl:value-of select="@office:value" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- ******************** --> + <!-- *** Common Rules *** --> + <!-- ******************** --> + + <xsl:template match="*"> + <xsl:param name="cellStyleName" /> + +<!-- LineBreak in Cell --> + <xsl:if test="preceding-sibling::text:p[1]"><xsl:text> </xsl:text></xsl:if> + <xsl:call-template name="style-and-contents"> + <xsl:with-param name="cellStyleName" select="$cellStyleName" /> + </xsl:call-template> + </xsl:template> + + <!-- disabling draw:frames --> + <xsl:template match="draw:frame" /> + + <xsl:template match="text:s"> + <xsl:call-template name="write-breakable-whitespace"> + <xsl:with-param name="whitespaces" select="@text:c" /> + </xsl:call-template> + </xsl:template> + + <!--write the number of 'whitespaces' --> + <xsl:template name="write-breakable-whitespace"> + <xsl:param name="whitespaces" /> + + <xsl:text> </xsl:text> + <xsl:if test="$whitespaces >= 1"> + <xsl:call-template name="write-breakable-whitespace"> + <xsl:with-param name="whitespaces" select="$whitespaces - 1" /> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- allowing all matched text nodes --> + <xsl:template match="text()"><xsl:value-of select="." /></xsl:template> + +</xsl:stylesheet> + diff --git a/filter/source/xslt/export/uof/odf2uof_presentation.xsl b/filter/source/xslt/export/uof/odf2uof_presentation.xsl new file mode 100644 index 000000000..a18113c58 --- /dev/null +++ b/filter/source/xslt/export/uof/odf2uof_presentation.xsl @@ -0,0 +1,3392 @@ +<?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:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:数="http://www.w3.org/1998/Math/MathML" xmlns:图="http://schemas.uof.org/cn/2003/graph" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="no" omit-xml-declaration="no"/> + <xsl:variable name="impresswithUnit"> + <xsl:value-of select="/office:document/office:styles/style:style[@style:family='graphic']/style:graphic-properties/@svg:stroke-width"/> + </xsl:variable> + <xsl:variable name="uofUnit"> + <xsl:choose> + <xsl:when test="contains($impresswithUnit,'inch')">inch</xsl:when> + <xsl:when test="contains($impresswithUnit,'cm')">cm</xsl:when> + <xsl:when test="contains($impresswithUnit,'mm')">mm</xsl:when> + <xsl:when test="contains($impresswithUnit,'pt')">pt</xsl:when> + <xsl:otherwise>cm</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="cm-to-other"> + <xsl:choose> + <xsl:when test="$uofUnit='cm'">1</xsl:when> + <xsl:when test="$uofUnit='inch'">0.394</xsl:when> + <xsl:when test="$uofUnit='pt'">28.346</xsl:when> + <xsl:when test="$uofUnit='mm'">10</xsl:when> + <xsl:when test="$uofUnit='pica'">2.364</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/> + <xsl:template match="/"> + <xsl:apply-templates select="office:document"/> + </xsl:template> + <xsl:template match="office:document"> + <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:数="http://www.w3.org/1998/Math/MathML" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uof:language="cn" uof:version="1.0" uof:locID="u0000" uof:mimetype="vnd.uof.presentation"> + <xsl:apply-templates select="office:meta"/> + <xsl:if test="//text:bookmark|//text:bookmark-start"> + <uof:书签集 uof:locID="u0027"> + <xsl:for-each select="//text:bookmark|//text:bookmark-start"> + <uof:书签 uof:名称="{@text:name}" uof:locID="u0028" uof:attrList="名称"> + <uof:文本位置 uof:区域引用="{generate-id(.)}" uof:locID="u0029" uof:attrList="区域引用"/> + </uof:书签> + </xsl:for-each> + </uof:书签集> + </xsl:if> + <xsl:if test="/office:document/office:body/text:p/text:a | /office:document/office:body/text:p/draw:a"> + <uof:链接集 uof:locID="u0031"> + <xsl:for-each select="/office:document/office:body/text:p/text:a | /office:document/office:body/text:p/draw:a"> + <xsl:variable name="hyperStr" select="@xlink:href"/> + <uof:超级链接 uof:locID="u0032" uof:attrList="标识符 目标 书签 式样引用 已访问式样引用 提示 链源"> + <xsl:if test="contains($hyperStr,'#')"> + <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute> + <xsl:attribute name="uof:提示"><xsl:value-of select="."/></xsl:attribute> + </xsl:if> + <xsl:variable name="num"> + <xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/> + </xsl:variable> + <xsl:attribute name="uof:链源"><xsl:value-of select="concat('hlnk',$num)"/></xsl:attribute> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('hyk_','hlnk',$num)"/></xsl:attribute> + <xsl:if test="not(contains($hyperStr,'#'))"> + <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute> + <xsl:choose> + <xsl:when test="contains($hyperStr,'@')"> + <xsl:attribute name="uof:提示">链接到邮件地址</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="uof:提示">链接文件</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@text:style-name"> + <xsl:attribute name="uof:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="@text:visited-style-name"> + <xsl:attribute name="uof:已访问式样引用"><xsl:value-of select="@text:visited-style-name"/></xsl:attribute> + </xsl:if> + </uof:超级链接> + </xsl:for-each> + </uof:链接集> + </xsl:if> + <uof:对象集 uof:locID="u0033"> + <xsl:apply-templates select="office:master-styles/style:handout-master" mode="styles"/> + <xsl:apply-templates select="office:master-styles/style:master-page" mode="styles"/> + <xsl:apply-templates select="office:body/office:presentation/draw:page" mode="styles"/> + <xsl:apply-templates select="office:styles/style:presentation-page-layout/presentation:placeholder" mode="graphic"/> + <xsl:apply-templates select="office:body/office:presentation/draw:page/presentation:notes" mode="styles"/> + <xsl:for-each select="(/office:document/office:styles/draw:fill-image) | (/office:document/office:automatic-styles/draw:fill-image)"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">jpg</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="office:binary-data"/> + </uof:数据> + </uof:其他对象> + </xsl:for-each> + <xsl:for-each select="(/office:document/office:styles/style:style/style:graphic-properties/text:list-style/text:list-level-style-image) | (/office:document/office:automatic-styles/style:style/style:graphic-properties/text:list-style/text:list-level-style-image)"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">jpg</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="office:binary-data"/> + </uof:数据> + </uof:其他对象> + </xsl:for-each> + </uof:对象集> + <uof:式样集 uof:locID="u0039"> + <xsl:apply-templates select="office:font-face-decls"/> + <xsl:element name="uof:自动编号集"> + <xsl:attribute name="uof:locID">u0042</xsl:attribute> + <xsl:for-each select="/office:document//text:list-style"> + <xsl:element name="字:自动编号"> + <xsl:attribute name="uof:locID">t0169</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 父编号引用 多级编号</xsl:attribute> + <xsl:attribute name="字:标识符"> + <xsl:variable name="count1" select="count(preceding::text:list-style)"/> + <xsl:choose><xsl:when test="@style:name"><xsl:value-of select="concat(@style:name,$count1)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(../../@style:name,$count1)"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:多级编号">true</xsl:attribute> + <xsl:for-each select="./* "> + <xsl:if test="number(@text:level) < 10"> + <xsl:element name="字:级别"> + <xsl:attribute name="uof:locID">t0159</xsl:attribute> + <xsl:attribute name="uof:attrList">级别值 编号对齐方式 尾随字符</xsl:attribute> + <xsl:attribute name="字:级别值"><xsl:value-of select="number(@text:level)"/></xsl:attribute> + <xsl:if test="style:list-level-properties/@fo:text-align"> + <xsl:attribute name="字:编号对齐方式"><xsl:value-of select="style:list-level-properties/@fo:text-align"/></xsl:attribute> + </xsl:if> + <xsl:variable name="level"> + <xsl:value-of select="@text:level"/> + </xsl:variable> + <xsl:if test="office:binary-data"> + <xsl:element name="字:图片符号引用" uof:locID="t0164" uof:attrList="宽度 高度"> + <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:width,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:height,$uofUnit)"/></xsl:attribute> + <xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/> + </xsl:element> + </xsl:if> + <xsl:if test="@text:bullet-char"> + <xsl:element name="字:项目符号"> + <xsl:attribute name="uof:locID">t0171</xsl:attribute> + <xsl:value-of select="@text:bullet-char"/> + </xsl:element> + </xsl:if> + <xsl:element name="字:符号字体"> + <xsl:attribute name="uof:locID">t0160</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:call-template name="字:句属性"/> + </xsl:element> + <xsl:if test="@style:num-format"> + <xsl:choose> + <xsl:when test="string(@style:num-format)='a'"> + <xsl:element name="字:编号格式" uof:locID="t0162">lower-letter</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='A'"> + <xsl:element name="字:编号格式" uof:locID="t0162">upper-letter</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='i'"> + <xsl:element name="字:编号格式" uof:locID="t0162">lower-roman</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='I'"> + <xsl:element name="字:编号格式" uof:locID="t0162">upper-roman</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='①, ②, ③, ...'"> + <xsl:element name="字:编号格式" uof:locID="t0162">decimal-enclosed-circle</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='甲, 乙, 丙, ...'"> + <xsl:element name="字:编号格式" uof:locID="t0162">ideograph-traditional</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='子, 丑, 寅, ...'"> + <xsl:element name="字:编号格式" uof:locID="t0162">ideograph-zodiac</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='一, 二, 三, ...'"> + <xsl:element name="字:编号格式" uof:locID="t0162">chinese-counting</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='壹, 贰, 叁, ...'"> + <xsl:element name="字:编号格式" uof:locID="t0162">chinese-legal-simplified</xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:编号格式" uof:locID="t0162">decimal</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:variable name="jibie"> + <xsl:value-of select="position()"/> + </xsl:variable> + <xsl:variable name="xianshijibie"> + <xsl:choose> + <xsl:when test="@text:display-levels"> + <xsl:value-of select="@text:display-levels"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <字:编号格式表示 uof:locID="t0163"> + <xsl:call-template name="字:编号格式表示"> + <xsl:with-param name="bubianjibie" select="$jibie"/> + <xsl:with-param name="jibie" select="$jibie"/> + <xsl:with-param name="xianshijibie" select="$xianshijibie"/> + <xsl:with-param name="biaoshi" select="concat(string(@style:num-prefix),'%',$jibie,string(@style:num-suffix))"/> + </xsl:call-template> + </字:编号格式表示> + <xsl:element name="字:缩进"> + <xsl:attribute name="uof:locID">t0165</xsl:attribute> + <xsl:call-template name="字:缩进类型"/> + </xsl:element> + <xsl:element name="字:制表符位置"> + <xsl:attribute name="uof:locID">t0166</xsl:attribute> + <xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/> + </xsl:element> + <xsl:if test="@text:start-value"> + <xsl:element name="字:起始编号"> + <xsl:value-of select="@text:start-value"/> + </xsl:element> + </xsl:if> + <xsl:if test="@text:num-regular-exp"> + <xsl:element name="字:正规格式" uof:locID="t0168" uof:attrList="值"> + <xsl:attribute name="值"><xsl:value-of select="@text:num-regular-exp"/></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + </xsl:element> + <xsl:for-each select="/office:document//text:list-style/*"> + <xsl:if test="style:text-properties/@fo:font-family"> + <xsl:element name="uof:句式样"> + <xsl:attribute name="uof:locID">u0043</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute> + <xsl:variable name="count"><xsl:value-of select="count(preceding::node())"/></xsl:variable> + <xsl:attribute name="字:标识符"><xsl:value-of select="concat('ID',$count)"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="concat(ancestor::style:style/@style:name,@text:level)"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:if test="ancestor::style:style/@style:parent-style-name"> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="ancestor::style:style/@style:parent-style-name"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="字:句属性"/> + </xsl:element> + </xsl:if> + </xsl:for-each> + <xsl:apply-templates select="office:styles | office:automatic-styles" mode="style"/> + <xsl:for-each select="/office:document/office:master-styles/style:master-page"> + <xsl:for-each select="child::draw:frame"> + <xsl:variable name="stylename" select="@presentation:style-name"/> + <xsl:variable name="parent" select="/office:document/office:automatic-styles/style:style[@style:name=$stylename]/@style:parent-style-name"/> + <xsl:for-each select="/office:document/*/style:style[@style:name=$parent]"> + <xsl:if test="not(contains(@style:name,'outline'))"> + <xsl:call-template name="段落式样"/> + </xsl:if> + </xsl:for-each> + </xsl:for-each> + </xsl:for-each> + <xsl:for-each select="/office:document/office:styles/style:style[contains(@style:name,'outline')]"> + <xsl:call-template name="段落式样"/> + </xsl:for-each> + </uof:式样集> + <uof:演示文稿 uof:locID="u0048"> + <演:公用处理规则 uof:locID="p0000"> + <xsl:element name="演:度量单位"> + <xsl:attribute name="uof:locID">p0055</xsl:attribute> + <xsl:value-of select="$uofUnit"/> + </xsl:element> + <演:页面设置集 uof:locID="p0001"> + <xsl:apply-templates select="office:automatic-styles/style:page-layout"/> + </演:页面设置集> + <演:配色方案集 uof:locID="p0007"> + <xsl:for-each select="/office:document/office:master-styles/*[@draw:style-name]"> + <xsl:call-template name="配色方案"/> + </xsl:for-each> + <xsl:for-each select="/office:document/office:body/office:presentation/draw:page"> + <xsl:call-template name="配色方案"/> + </xsl:for-each> + </演:配色方案集> + <演:页面版式集 uof:locID="p0017"> + <xsl:apply-templates select="office:styles/style:presentation-page-layout" mode="pagestyle"/> + </演:页面版式集> + <xsl:if test="office:styles/style:style='标准-title' or office:styles/style:style='标准-outline'" > + <演:文本式样集 uof:locID="p0131"> + <xsl:for-each select="office:styles/style:style"> + <xsl:variable name="name"><xsl:value-of select="@style:name"/></xsl:variable> + <xsl:if test="$name='标准-title' or contains($name,'标准-outline')"> + <演:文本式样 uof:locID="p0132" uof:attrList="标识符 名称"> + <xsl:attribute name="演:标识符">text-style</xsl:attribute> + <xsl:attribute name="演:名称">文本式样</xsl:attribute> + <xsl:element name="演:段落式样"> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:if test="@style:parent-style-name"> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:别名"><xsl:value-of select="@style:class"/></xsl:attribute> + <xsl:call-template name="ParaAttribute"> + <xsl:with-param name="text-style-name" select="@text:style-name"/> + </xsl:call-template> + <xsl:call-template name="字:句属性"/> + </xsl:element> + </演:文本式样> + </xsl:if> + </xsl:for-each> + </演:文本式样集> + </xsl:if> + <演:显示比例 uof:locID="p0020"> + <xsl:variable name="VisibleAreaWidth"> + <xsl:value-of select="/office:document/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item[@config:name='VisibleAreaWidth']"/> + </xsl:variable> + <xsl:value-of select="substring-before((13997 div $VisibleAreaWidth)*100,'.')"/> + </演:显示比例> + <演:放映设置 uof:locID="p0021"> + <演:幻灯片序列 uof:locID="p0022" uof:attrList="标识符 名称 自定义"> + <xsl:attribute name="演:标识符">customList</xsl:attribute> + <xsl:attribute name="演:名称">幻灯片序列</xsl:attribute> + <xsl:attribute name="演:自定义">true</xsl:attribute> + <xsl:choose> + <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:start-page"> + <xsl:variable name="start-page"> + <xsl:value-of select="office:body/office:presentation/presentation:settings/@presentation:start-page"/> + </xsl:variable> + <xsl:variable name="before-slides"> + <xsl:call-template name="幻灯片序列"> + <xsl:with-param name="start-node" select="office:body/office:presentation/draw:page[@draw:name=$start-page]"/> + <xsl:with-param name="end-node" select="office:body/office:presentation/draw:page[last()]"/> + <xsl:with-param name="value"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="after-slides"> + <xsl:for-each select="office:body/office:presentation/draw:page[@draw:name=$start-page]"> + <xsl:call-template name="幻灯片序列"> + <xsl:with-param name="start-node" select="/office:document/office:body/office:presentation/draw:page[1]"/> + <xsl:with-param name="end-node" select="preceding-sibling::node()[1]"/> + <xsl:with-param name="value"/> + </xsl:call-template> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="concat($before-slides,' ',$after-slides)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="幻灯片序列"> + <xsl:with-param name="start-node" select="office:body/office:presentation/draw:page[1]"/> + <xsl:with-param name="end-node" select="office:body/office:presentation/draw:page[last()]"/> + <xsl:with-param name="value"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </演:幻灯片序列> + <演:放映顺序 uof:locID="p0023" uof:attrList="名称 序列引用"> + <xsl:attribute name="演:名称">放映顺序</xsl:attribute> + <xsl:attribute name="演:序列引用">customList</xsl:attribute> + </演:放映顺序> + <演:全屏放映 uof:locID="p0024"> + <xsl:choose> + <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:full-screen='false'">false</xsl:when> + <xsl:otherwise>true</xsl:otherwise> + </xsl:choose> + </演:全屏放映> + <演:循环放映 uof:locID="p0025"> + <xsl:choose> + <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:endless='true'">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </演:循环放映> + <xsl:if test="office:body/office:presentation/presentation:settings/@presentation:pause"> + <演:放映间隔 uof:locID="p0026"> + <xsl:variable name="hms"> + <xsl:value-of select="substring-after(office:body/office:presentation/presentation:settings/@presentation:pause,'PT')"/> + </xsl:variable> + <xsl:value-of select="concat('P0Y0M0DT',$hms)"/> + </演:放映间隔> + </xsl:if> + <演:手动方式 uof:locID="p0027"> + <xsl:choose> + <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:force-manual='true'">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </演:手动方式> + <演:导航帮助 uof:locID="p0029"> + <xsl:choose> + <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:start-with-navigator='true'">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </演:导航帮助> + <演:放映动画 uof:locID="p0030"> + <xsl:choose> + <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:animations='disabled'">false</xsl:when> + <xsl:otherwise>true</xsl:otherwise> + </xsl:choose> + </演:放映动画> + <演:前端显示 uof:locID="p0031"> + <xsl:choose> + <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:stay-on-top='true'">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </演:前端显示> + </演:放映设置> + </演:公用处理规则> + <演:主体 uof:locID="p0034"> + <演:母版集 uof:locID="p0035"> + <xsl:apply-templates select="office:master-styles"/> + </演:母版集> + <演:幻灯片集 uof:locID="p0039"> + <xsl:apply-templates select="office:body/office:presentation/draw:page"/> + </演:幻灯片集> + </演:主体> + </uof:演示文稿> + </uof:UOF> + </xsl:template> +<xsl:template name="配色方案"> + <xsl:variable name="page-name"><xsl:value-of select="@draw:style-name"/></xsl:variable> + <演:配色方案 uof:locID="p0008" uof:attrList="标识符 名称 类型"> + <xsl:attribute name="演:标识符"> + <xsl:choose> + <xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when> + <xsl:otherwise><xsl:value-of select="@draw:style-name"/></xsl:otherwise> + </xsl:choose> + + </xsl:attribute> + <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name = $page-name]"> + <xsl:attribute name="演:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="演:类型"><xsl:choose><xsl:when test="not(contains(@style:name,'color'))">custom</xsl:when><xsl:otherwise>standard</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="style:drawing-page-properties/@draw:fill-color"> + <演:背景色 uof:locID="p0009"> + <xsl:value-of select="style:drawing-page-properties/@draw:fill-color"/> + </演:背景色> + </xsl:if> + <xsl:if test="style:drawing-page-properties/@svg:stroke-color"> + <演:文本和线条 uof:locID="p0010"> + <xsl:value-of select="style:drawing-page-properties/@svg:stroke-color"/> + </演:文本和线条> + </xsl:if> + <xsl:if test="style:drawing-page-properties/@draw:shadow-color"> + <演:阴影 uof:locID="p0011"> + <xsl:value-of select="style:drawing-page-properties/@draw:shadow-color"/> + </演:阴影> + </xsl:if> + <xsl:if test="style:drawing-page-properties/@svg:stroke-color"> + <演:标题文本 uof:locID="p0012"> + <xsl:value-of select="style:drawing-page-properties/@svg:stroke-color"/> + </演:标题文本> + </xsl:if> + <xsl:if test="style:drawing-page-properties/@draw:fill-color"> + <演:填充 uof:locID="p0013"> + <xsl:value-of select="style:drawing-page-properties/@draw:fill-color"/> + </演:填充> + </xsl:if> + <演:强调 uof:locID="p0014">#FFFFFF</演:强调> + <演:强调和超级链接 uof:locID="p0015">#FF0000</演:强调和超级链接> + <演:强调和尾随超级链接 uof:locID="p0016">#FF00FF</演:强调和尾随超级链接> + </xsl:for-each> + </演:配色方案> +</xsl:template> + <xsl:template name="幻灯片序列"> + <xsl:param name="start-node"/> + <xsl:param name="end-node"/> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="not($start-node/@draw:name = $end-node/@draw:name)"> + <xsl:for-each select="$start-node"> + <xsl:variable name="value1"> + <xsl:value-of select="concat($value,@draw:name,'_',@draw:style-name,' ')"/> + </xsl:variable> + <xsl:call-template name="幻灯片序列"> + <xsl:with-param name="start-node" select="following-sibling::node()[1]"/> + <xsl:with-param name="end-node" select="$end-node"/> + <xsl:with-param name="value" select="$value1"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($value,$start-node/@draw:name)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="字:编号格式表示"> + <xsl:param name="bubianjibie"/> + <xsl:param name="jibie"/> + <xsl:param name="xianshijibie"/> + <xsl:param name="biaoshi"/> + <xsl:choose> + <xsl:when test="number($xianshijibie)= 1"> + <xsl:value-of select="$biaoshi"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-prefix"> + <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-prefix"/> + </xsl:variable> + <xsl:variable name="num-suffix"> + <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-suffix"/> + </xsl:variable> + <xsl:call-template name="字:编号格式表示"> + <xsl:with-param name="bubianjibie" select="$bubianjibie"/> + <xsl:with-param name="jibie" select="$jibie -1"/> + <xsl:with-param name="xianshijibie" select="$xianshijibie -1"/> + <xsl:with-param name="biaoshi" select="concat($num-prefix,'%',number($jibie -1),$num-suffix,'.',$biaoshi)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="字:句属性"> + <xsl:element name="字:字体"> + <xsl:attribute name="uof:locID">t0088</xsl:attribute> + <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute> + <xsl:if test=".//@fo:font-size or .//@style:font-size-asian or .//@style:font-size-complex"> + <xsl:choose> + <xsl:when test="contains(.//@fo:font-size,'%') or contains(.//@style:font-size-asian,'%')"> + <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'%')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-complex"><xsl:value-of select="substring-before(.//@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test=".//@style:font-name"> + <xsl:attribute name="字:西文字体引用"><xsl:value-of select=".//@style:font-name"/></xsl:attribute> + </xsl:if> + <xsl:if test=".//@style:font-name-asian"> + <xsl:attribute name="字:中文字体引用"><xsl:value-of select=".//@style:font-name-asian"/></xsl:attribute> + </xsl:if> + <xsl:if test=".//@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test=".//@style:text-background-color and not(.//@style:text-background-color='transparent')"> + <xsl:element name="字:填充"> + <xsl:element name="图:图案"> + <xsl:attribute name="uof:locID">g0036</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 图形引用 前景色 背景色</xsl:attribute> + <xsl:if test=".//@style:text-background-color"> + <xsl:attribute name="图:前景色"><xsl:value-of select=".//@style:text-background-color"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:font-weight or .//@style:font-weight-asian"> + <xsl:element name="字:粗体"> + <xsl:attribute name="uof:locID">t0089</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:font-weight-asian='bold' or .//@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:font-style or .//@style:font-style-asian"> + <xsl:element name="字:斜体"> + <xsl:attribute name="uof:locID">t0090</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@fo:font-style='italic' or .//@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:text-crossing-out"> + <xsl:element name="字:删除线"> + <xsl:attribute name="uof:locID">t0094</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"><xsl:with-param name="lineType" select=".//@style:text-crossing-out"/></xsl:call-template></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:text-underline"> + <xsl:element name="字:下划线"> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"><xsl:with-param name="lineType" select=".//@style:text-underline"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="uof:locID">t0095</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:if test=".//@style:text-underline-color"> + <xsl:attribute name="字:颜色"><xsl:value-of select=".//@style:text-underline-color"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:text-shadow and not(.//@fo:text-shadow='none')"> + <xsl:element name="字:阴影"> + <xsl:attribute name="uof:locID">t0100</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:text-emphasize"> + <xsl:element name="字:着重号"> + <xsl:attribute name="uof:locID">t0096</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute> + <xsl:choose> + <xsl:when test=".//@style:text-emphasize='none'"> + <xsl:attribute name="字:字着重号">false</xsl:attribute> + <xsl:attribute name="字:类型">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:字着重号">true</xsl:attribute> + <xsl:attribute name="字:类型">dot</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test=".//@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test=".//@text:display and not(.//@text:display='none')"> + <xsl:element name="字:隐藏文字"> + <xsl:attribute name="uof:locID">t0097</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:text-outline and not(.//@style:text-outline='none')"> + <xsl:element name="字:空心"> + <xsl:attribute name="uof:locID">t0098</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select=".//@style:text-outline"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:font-relief and not(.//@style:font-relief='none')"> + <xsl:element name="字:浮雕"> + <xsl:attribute name="uof:locID">t0099</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test=".//@style:font-relief='embossed'">emboss</xsl:when><xsl:when test=".//@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:text-transform or .//@fo:font-variant"> + <xsl:element name="字:醒目字体"> + <xsl:attribute name="uof:locID">t0101</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test=".//@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test=".//@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test=".//@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test=".//@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:text-position"> + <xsl:element name="字:位置"> + <xsl:attribute name="uof:locID">t0102</xsl:attribute> + <xsl:value-of select=".//@style:text-position"/> + </xsl:element> + <字:上下标 uof:locID="t0205" uof:attrList="值"> + <xsl:attribute name="字:值">none</xsl:attribute> + </字:上下标> + </xsl:if> + <xsl:if test=".//@style:text-scale"> + <xsl:element name="字:缩放"> + <xsl:attribute name="uof:locID">t0103</xsl:attribute> + <xsl:value-of select=".//@style:text-scale"/> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:letter-spacing"> + <xsl:element name="字:字符间距"> + <xsl:attribute name="uof:locID">t0104</xsl:attribute> + <xsl:value-of select=".//@fo:letter-spacing"/> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:letter-kerning"> + <xsl:element name="字:调整字间距"> + <xsl:attribute name="uof:locID">t015</xsl:attribute> + <xsl:value-of select=".//@style:letter-kerning"/> + </xsl:element> + </xsl:if> + <xsl:element name="字:字符对齐网格"> + <xsl:attribute name="字:值">false</xsl:attribute> + <xsl:attribute name="uof:locID">t0106</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="style:presentation-page-layout" mode="pagestyle"> + <演:页面版式 uof:locID="p0018" uof:attrList="标识符 名称"> + <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="演:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <演:布局 uof:locID="p0129" uof:attrList="类型"> + <xsl:attribute name="演:类型"> + <xsl:variable name="layout" select="substring-after(@style:name,'T')"/> + <xsl:choose> + <xsl:when test="$layout='0'">title-subtitle</xsl:when><xsl:when test="$layout='1'">title-body</xsl:when><xsl:when test="$layout='19'">title-only</xsl:when><xsl:when test="$layout='12'">column-2-rows</xsl:when><xsl:when test="$layout='15'">2-rows-column</xsl:when><xsl:when test="$layout='16'">2-columns-row</xsl:when><xsl:when test="$layout='17'">2-rows</xsl:when><xsl:when test="$layout='18'">4-objects</xsl:when><xsl:when test="$layout='27'">v-2-rows</xsl:when><xsl:when test="$layout='28'">v-title-body</xsl:when><xsl:when test="$layout='29'">big-object</xsl:when><xsl:when test="$layout='30'">2-columns</xsl:when> + <xsl:otherwise>title-only</xsl:otherwise> + </xsl:choose></xsl:attribute> + </演:布局> + <xsl:apply-templates select="presentation:placeholder" mode="anchor"/> + </演:页面版式> + </xsl:template> + <xsl:template match="presentation:placeholder" mode="anchor"> + <演:占位符 uof:locID="p0130" uof:attrList="类型"> + <xsl:attribute name="演:类型"><xsl:choose><xsl:when test="@presentation:object = 'vertical_outline'">vertical_text</xsl:when><xsl:when test="@presentation:object = 'date-time'">date</xsl:when><xsl:when test="@presentation:object = 'page_number'">number</xsl:when><xsl:otherwise><xsl:value-of select="@presentation:object"/></xsl:otherwise></xsl:choose></xsl:attribute> + <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符"> + <xsl:attribute name="uof:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:图形引用"><xsl:variable name="number"><xsl:value-of select="concat('_',count(preceding-sibling::presentation:placeholder))"/></xsl:variable><xsl:value-of select="concat(parent::style:presentation-page-layout/@style:name,$number)"/></xsl:attribute> + </uof:锚点> + </演:占位符> + </xsl:template> + <xsl:template match="presentation:placeholder" mode="graphic"> + <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象" 图:层次="3"> + <xsl:attribute name="图:标识符"><xsl:variable name="number"><xsl:value-of select="concat('_',count(preceding-sibling::presentation:placeholder))"/></xsl:variable><xsl:value-of select="concat(parent::style:presentation-page-layout/@style:name,$number)"/></xsl:attribute> + </图:图形> + </xsl:template> + <xsl:template match="office:master-styles"> + <xsl:apply-templates select="style:handout-master"/> + <xsl:apply-templates select="style:master-page"/> + <xsl:if test="style:master-page/presentation:notes"> + <xsl:apply-templates select="style:master-page/presentation:notes"/> + </xsl:if> + </xsl:template> + <xsl:template match="style:handout-master"> + <演:母版 uof:locID="p0036" uof:attrList="标识符 名称 类型 页面设置引用 配色方案引用 页面版式引用 文本式样引用" 演:名称="handout母版" 演:类型="handout"> + <xsl:attribute name="演:页面设置引用"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute> + <xsl:if test="@draw:style-name"> + <xsl:attribute name="演:配色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="@presentation:presentation-page-layout-name"> + <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="产生锚点"/> + </演:母版> + </xsl:template> + <xsl:template match="style:master-page"> + <演:母版 uof:locID="p0036" uof:attrList="标识符 名称 类型 页面设置引用 配色方案引用 页面版式引用 文本式样引用" 演:名称="slide母版" 演:类型="slide"> + <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="演:页面设置引用"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute> + <xsl:if test="@draw:style-name"> + <xsl:attribute name="演:配色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="@presentation:presentation-page-layout-name"> + <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="产生锚点"/> + <xsl:variable name="stylename"> + <xsl:value-of select="@draw:style-name"/> + </xsl:variable> + <xsl:variable name="name"> + <xsl:value-of select="name(.)"/> + </xsl:variable> + <xsl:for-each select="/office:document/*/style:style[@style:name=$stylename]/style:drawing-page-properties"> + <xsl:if test="@draw:fill and not(@draw:fill='none')"> + <演:背景 uof:locID="p0057"> + <xsl:call-template name="填充"> + <xsl:with-param name="picname" select="$stylename"/> + <xsl:with-param name="nodename" select="$name"/> + </xsl:call-template> + </演:背景> + </xsl:if> + </xsl:for-each> + </演:母版> + </xsl:template> + <xsl:template match="presentation:notes"> + <演:母版 uof:locID="p0036" uof:attrList="标识符 名称 类型 页面设置引用 配色方案引用 页面版式引用 文本式样引用" 演:名称="notes母版" 演:类型="notes"> + <xsl:attribute name="演:标识符"><xsl:value-of select="concat('note-',parent::style:master-page/@style:name)"/></xsl:attribute> + <xsl:attribute name="演:页面设置引用"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute> + <xsl:if test="@draw:style-name"> + <xsl:attribute name="演:配色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="@presentation:presentation-page-layout-name"> + <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="产生锚点"/> + </演:母版> + </xsl:template> + <xsl:template match="draw:page"> + <演:幻灯片 uof:locID="p0040" uof:attrList="名称 标识符 母版引用 配色方案引用 页面版式引用 显示 显示背景 显示背景对象"> + <xsl:attribute name="演:标识符"><xsl:value-of select="concat(@draw:name,'_',@draw:style-name)"/></xsl:attribute> + <xsl:attribute name="演:名称"><xsl:value-of select="@draw:name"/></xsl:attribute> + <xsl:attribute name="演:母版引用"><xsl:value-of select="@draw:master-page-name"/></xsl:attribute> + <xsl:if test="@presentation:presentation-page-layout-name"> + <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute> + </xsl:if> + <xsl:call-template name="产生锚点"/> + <xsl:apply-templates select="presentation:notes" mode="page"/> + <xsl:variable name="stylename"> + <xsl:value-of select="@draw:style-name"/> + </xsl:variable> + <xsl:variable name="name"> + <xsl:value-of select="name(.)"/> + </xsl:variable> + <xsl:for-each select="/office:document/*/style:style[@style:name=$stylename]/style:drawing-page-properties"> + <xsl:if test="@draw:fill and not(@draw:fill='none')"> + <演:背景 uof:locID="p0057"> + <xsl:call-template name="填充"> + <xsl:with-param name="picname" select="$stylename"/> + <xsl:with-param name="nodename" select="$name"/> + </xsl:call-template> + </演:背景> + </xsl:if> + </xsl:for-each> + <演:切换 uof:locID="p0058" uof:attrList="效果 速度"> + <xsl:for-each select="key('graphicset',$stylename)/style:drawing-page-properties"> + <xsl:attribute name="演:速度"><xsl:choose><xsl:when test="@presentation:transition-speed='slow'">slow</xsl:when><xsl:otherwise>fast</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="演:效果"><xsl:variable name="type"><xsl:value-of select="@smil:type"/></xsl:variable><xsl:variable name="subtype"><xsl:value-of select="@smil:subtype"/></xsl:variable><xsl:choose><xsl:when test="$type='irisWipe' and $subtype='rectangle' and @smil:direction='reverse'">box in</xsl:when><xsl:when test="$type='irisWipe' and $subtype='rectangle'">box out</xsl:when><xsl:when test="$type='checkerBoardWipe' and $subtype='across'">checkerboard across</xsl:when><xsl:when test="$type='checkerBoardWipe' and $subtype='down'">checkerboard down</xsl:when><xsl:when test="$type='pushWipe' and $subtype='combHorizontal'">comb horizontal</xsl:when><xsl:when test="$type='pushWipe' and $subtype='combVertical'">comb vertical</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTop' and @smil:direction='reverse'">uncover down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromRight' and @smil:direction='reverse'">uncover left</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromLeft' and @smil:direction='reverse'">uncover right</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottom' and @smil:direction='reverse'">uncover up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopRight' and @smil:direction='reverse'">uncover left-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomRight' and @smil:direction='reverse'">uncover left-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopLeft' and @smil:direction='reverse'">uncover right-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomLeft' and @smil:direction='reverse'">uncover right-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTop'">cover down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromRight'">cover left</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromLeft'">cover right</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottom'">cover up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopRight'">cover left-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomRight'">cover left-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopLeft'">cover right-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomLeft'">cover right-up</xsl:when><xsl:when test="$type='fade' and $subtype='fadeOverColor'">fade through black</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromTop'">push down</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromRight'">push left</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromLeft'">push right</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromBottom'">push up</xsl:when><xsl:when test="$type='randomBarWipe' and $subtype='horizontal'">random bars horizontal</xsl:when><xsl:when test="$type='randomBarWipe' and $subtype='vertical'">random bars vertical</xsl:when><xsl:when test="$type='ellipseWipe' and $subtype='circle'">shape circle</xsl:when><xsl:when test="$type='irisWipe' and $subtype='diamond'">shape diamond</xsl:when><xsl:when test="$type='fourBoxWipe' and $subtype='cornersOut'">shape plus</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='horizontal' and @smil:direction='reverse'">split horizontal in</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='horizontal'">split horizontal out</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='vertical' and @smil:direction='reverse'">split vertical in</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='vertical'">split vertical out</xsl:when><xsl:when test="$type='fanWipe' and $subtype='centerTop'">wedge</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='oneBlade'">wheel clockwise – 1 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='twoBladeVertical'">wheel clockwise – 2 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='threeBlade'">wheel clockwise – 3 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='fourBlade'">wheel clockwise – 4 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='eightBlade'">wheel clockwise – 8 spoke</xsl:when><xsl:when test="$type='barWipe' and $subtype='leftToRight' and @smil:direction='reverse'">wipe left</xsl:when><xsl:when test="$type='barWipe' and $subtype='leftToRight'">wipe right</xsl:when><xsl:when test="$type='barWipe' and $subtype='topToBottom' and @smil:direction='reverse'">wipe up</xsl:when><xsl:when test="$type='barWipe' and $subtype='topToBottom'">wipe down</xsl:when><xsl:when test="$type='blindsWipe' and $subtype='vertical'">blinds vertical</xsl:when><xsl:when test="$type='blindsWipe' and $subtype='horizontal'">blinds horizontal</xsl:when><xsl:when test="$type='dissolve'">dissolve</xsl:when><xsl:when test="$type='random'">random transition</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <演:声音 uof:locID="p0061" uof:attrList="预定义声音 自定义声音"> + <xsl:choose> + <xsl:when test="not(presentation:sound)"> + <xsl:attribute name="演:预定义声音">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="lujing"> + <xsl:value-of select="substring-after(presentation:sound/@xlink:href,'share/gallery/sounds/')"/> + </xsl:variable> + <xsl:variable name="ming"> + <xsl:value-of select="substring-before($lujing,'.wav')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$ming='applause'"> + <xsl:attribute name="演:预定义声音">applause</xsl:attribute> + </xsl:when> + <xsl:when test="$ming='explos'"> + <xsl:attribute name="演:预定义声音">explosion</xsl:attribute> + </xsl:when> + <xsl:when test="$ming='laser'"> + <xsl:attribute name="演:预定义声音">laser</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:自定义声音"><xsl:value-of select="presentation:sound/@xlink:href"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </演:声音> + <演:方式 uof:locID="p0062"> + <演:单击鼠标 uof:locID="p0065"> + <xsl:choose> + <xsl:when test="@presentation:transition-type='automatic'">false</xsl:when> + <xsl:otherwise>true</xsl:otherwise> + </xsl:choose> + </演:单击鼠标> + <xsl:if test="@presentation:duration"> + <演:时间间隔 uof:locID="p0066"> + <xsl:variable name="hms"> + <xsl:value-of select="substring-after(@presentation:duration,'PT')"/> + </xsl:variable> + <xsl:variable name="h"> + <xsl:value-of select="number(substring-before($hms,'H'))"/> + </xsl:variable> + <xsl:variable name="ms"> + <xsl:value-of select="substring-after($hms,'H')"/> + </xsl:variable> + <xsl:variable name="m"> + <xsl:value-of select="number(substring-before($ms,'M'))"/> + </xsl:variable> + <xsl:variable name="s"> + <xsl:value-of select="number(substring-before(substring-after($ms,'M'),'S'))"/> + </xsl:variable> + <xsl:value-of select="$h *3600 + $m * 60 + $s"/> + </演:时间间隔> + </xsl:if> + </演:方式> + </xsl:for-each> + </演:切换> + </演:幻灯片> + </xsl:template> + <xsl:template match="presentation:notes" mode="page"> + <演:幻灯片备注 uof:locID="p0054" uof:attrList="备注母版引用"> + <xsl:attribute name="演:备注母版引用"><xsl:variable name="cute"><xsl:value-of select="parent::node()/@draw:master-page-name"/></xsl:variable><xsl:value-of select="concat('note-',$cute)"/></xsl:attribute> + <xsl:call-template name="产生锚点"/> + <演:背景 uof:locID="p0057"> + <图:颜色 uof:locID="g0034">#ffffff</图:颜色> + </演:背景> + </演:幻灯片备注> + </xsl:template> + <xsl:template name="产生锚点"> + <xsl:for-each select="child::node( )"> + <xsl:choose> + <xsl:when test="substring-before(name(),':')='draw'"> + <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符"> + <xsl:variable name="nodename"> + <xsl:value-of select="name(.)"/> + </xsl:variable> + <xsl:variable name="refpicname"> + <xsl:choose> + <xsl:when test="@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@presentation:style-name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="picnumber"> + <xsl:choose> + <xsl:when test="@draw:style-name"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="count(preceding::*[@presentation:style-name=$refpicname])"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="uof:x坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:y坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="@svg:width"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgx"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:width,$uofUnit))"/></xsl:variable><xsl:variable name="maxx"><xsl:call-template name="groupmaxx"><xsl:with-param name="value" select="$svgx + $width"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxx - $minx"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="@svg:height"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgy"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/></xsl:variable><xsl:variable name="height"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:height,$uofUnit))"/></xsl:variable><xsl:variable name="maxy"><xsl:call-template name="groupmaxy"><xsl:with-param name="value" select="$svgy + $height"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxy - $miny"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:图形引用"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:when test="not(@draw:style-name) and name()='draw:g'"><xsl:value-of select="concat(child::node()[1]/@draw:style-name,'_',$picnumber)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:随动方式"><xsl:choose><xsl:when test="key('graphicset',$refpicname)/node()/@style:protect"><xsl:for-each select="key('graphicset',$refpicname)/node()"><xsl:choose><xsl:when test="@style:protect='size'">move</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:for-each></xsl:when><xsl:otherwise>movesize</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="name(.)='draw:page-thumbnail'"> + <xsl:attribute name="uof:缩略图">true</xsl:attribute> + </xsl:if> + <xsl:if test="not(name(parent::node())='style:handout-master')"> + <xsl:attribute name="uof:占位符"><xsl:choose><xsl:when test="@presentation:object"><xsl:value-of select="@presentation:object"/></xsl:when><xsl:when test=".//draw:image">graphic</xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="@presentation:class"> + <xsl:attribute name="uof:占位符"><xsl:value-of select="@presentation:class"/></xsl:attribute> + </xsl:if> + </xsl:if> + </uof:锚点> + </xsl:when> + <xsl:when test="name()= 'anim:par'"> + <演:动画 uof:locID="p0042"> + <xsl:apply-templates select="anim:seq"/> + </演:动画> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template match="anim:seq"> + <xsl:apply-templates select="anim:par/anim:par/anim:par"/> + <xsl:apply-templates select="anim:par/anim:par/anim:iterate"/> + </xsl:template> + <xsl:template match="anim:par | anim:iterate"> + <演:序列 uof:locID="p0043" uof:attrList="段落引用 动画对象"> + <xsl:attribute name="演:动画对象"><xsl:choose> + <xsl:when test=".//@smil:targetElement"><xsl:value-of select=".//@smil:targetElement"/></xsl:when><xsl:when test="@anim:id"><xsl:value-of select="@anim:id"/></xsl:when><xsl:otherwise><xsl:value-of select="../@smil:targetElement"/></xsl:otherwise></xsl:choose></xsl:attribute> + + <演:定时 uof:locID="p0067" uof:attrList="事件 延时 速度 重复 回卷"> + <xsl:attribute name="演:事件"> + <xsl:choose> + <xsl:when test="@presentation:node-type='on-click'">on click</xsl:when> + <xsl:when test="@presentation:node-type='with-previous'">with previous</xsl:when> + <xsl:otherwise><xsl:value-of select="@presentation:node-type"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="演:延时"><xsl:value-of select="substring-before(@smil:begin,'s')"/></xsl:attribute> + <xsl:attribute name="演:速度"><xsl:choose><xsl:when test="anim:animate/@smil:dur='0.5s'">very fast</xsl:when><xsl:when test="anim:animate/@smil:dur='1s'">fast</xsl:when><xsl:when test="anim:animate/@smil:dur='2s'">medium</xsl:when><xsl:when test="anim:animate/@smil:dur='3s'">slow</xsl:when><xsl:when test="anim:animate/@smil:dur='5s'">very slow</xsl:when><xsl:otherwise>medium</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="演:重复"><xsl:choose><xsl:when test="@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="@smil:repeatCount ='2' or @smil:repeatCount ='3' or @smil:repeatCount ='4' or @smil:repeatCount ='5' or @smil:repeatCount ='10' "><xsl:value-of select="@smil:repeatCount"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="演:回卷"><xsl:choose><xsl:when test="@smil:fill='remove'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </演:定时> + <演:增强 uof:locID="p0068"> + <演:动画播放后 uof:locID="p0070" uof:attrList="颜色 变暗 播放后隐藏 单击后隐藏"> + <xsl:if test="../anim:animateColor"> + <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="../anim:animateColor"> + <xsl:attribute name="演:变暗">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:变暗">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@presentation:preset-property='Direction;Accelerate;Decelerate' "> + <xsl:attribute name="演:播放后隐藏">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:播放后隐藏">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="../anim:set/@smil:to"> + <xsl:attribute name="演:单击后隐藏">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:单击后隐藏">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </演:动画播放后> + <演:动画文本 uof:locID="p0071" uof:attrList="发送 间隔 动画形状 相反顺序"> + <xsl:attribute name="演:发送"><xsl:choose><xsl:when test="@anim:iterate-type = 'by-word' ">by word</xsl:when><xsl:when test="@anim:iterate-type = 'by-letter' ">by letter</xsl:when><xsl:otherwise>all at once</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="演:间隔"><xsl:choose><xsl:when test="@anim:iterate-interval"><xsl:value-of select="substring-before(@anim:iterate-interval,'s')"/> +</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="演:动画形状">false</xsl:attribute> + <xsl:attribute name="演:相反顺序">false</xsl:attribute> + </演:动画文本> + <xsl:if test="anim:audio"> + <演:声音 uof:locID="p0061" uof:attrList="预定义声音 自定义声音"> + <xsl:variable name="audioname"> + <xsl:value-of select="substring-after(anim:audio/@xlink:href,'gallery/sounds/')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="not($audioname='')"> + <xsl:attribute name="演:预定义声音"><xsl:choose><xsl:when test="anim:audio/@xlink:href"><xsl:value-of select="anim:audio/@xlink:href"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:自定义声音"><xsl:value-of select="anim:audio/@xlink:href"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </演:声音> + </xsl:if> + </演:增强> + <演:效果 uof:locID="p0069"> + <xsl:choose> + <xsl:when test="./@presentation:preset-class = 'entrance'"> + <演:进入 uof:locID="p0073"> + <xsl:apply-templates select="@presentation:preset-id"/> + </演:进入> + </xsl:when> + <xsl:when test="./@presentation:preset-class = 'exit'"> + <演:退出 uof:locID="p0074"> + <xsl:apply-templates select="@presentation:preset-id"/> + </演:退出> + </xsl:when> + <xsl:when test="./@presentation:preset-class = 'emphasis' "> + <演:强调 uof:locID="p0075"> + <xsl:apply-templates select="@presentation:preset-id"/> + </演:强调> + </xsl:when> + <xsl:otherwise> + <演:动作路径 uof:locID="p0133" uof:attrList="路径"> + <xsl:attribute name="演:路径"> + <xsl:value-of select="anim:animateMotion/@svg:path"/> + </xsl:attribute> + </演:动作路径> + </xsl:otherwise> + </xsl:choose> + </演:效果> + </演:序列> + </xsl:template> + <xsl:template name="anim_speed"> + <xsl:param name="speed"/> + <xsl:choose> + <xsl:when test="$speed='0.5s' or $speed='0.25s'">very fast</xsl:when> + <xsl:when test="$speed='1s'">fast</xsl:when> + <xsl:when test="$speed='2s'">medium</xsl:when> + <xsl:when test="$speed='3s'">slow</xsl:when> + <xsl:when test="$speed='5s'">very slow</xsl:when> + <xsl:otherwise>medium</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-venetian-blinds']"> + <演:百叶窗 uof:locID="p0080" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:百叶窗> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-appear']"> + <演:出现 uof:locID="p0081"> + </演:出现> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-box']"> + <演:盒状 uof:locID="p0082" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:盒状> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-diagonal-squares']"> + <演:阶梯状 uof:locID="p0083" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'left-to-bottom' ">left down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'left-to-top' ">left up</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-bottom' ">right down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-top' ">right up</xsl:when></xsl:choose></xsl:attribute> + </演:阶梯状> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wheel']"> + <演:轮子 uof:locID="p0084" uof:attrList="速度 辐射状"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:辐射状"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:轮子> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-checkerboard']"> + <演:棋盘 uof:locID="p0085" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:subtype"/></xsl:attribute> + </演:棋盘> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-flash-once']"> + <演:闪烁一次 uof:locID="p0086" uof:attrList="速度"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:set/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + </演:闪烁一次> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-plus']"> + <演:十字形扩展 uof:locID="p0087" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:十字形扩展> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-random']"> + <演:随机效果 uof:locID="p0088"> + </演:随机效果> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-circle']"> + <演:圆形扩展 uof:locID="p0089" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:圆形扩展> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wipe']"> + <演:擦除 uof:locID="p0090" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute> + </演:擦除> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fly-in']"> + <演:飞入 uof:locID="p0091" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-right'">from top-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-left'">from top-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-left'">from bottom-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-right'">from bottom-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when></xsl:choose></xsl:attribute> + </演:飞入> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fly-in-slow']"> + <演:缓慢飞入 uof:locID="p0092" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute> + </演:缓慢飞入> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-diamond']"> + <演:菱形 uof:locID="p0093" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:菱形> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-split']"> + <演:劈裂 uof:locID="p0094" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'horizontal-out'">horizontal out</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'horizontal-in'">horizontal in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-in'">vertical in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-out'">vertical out</xsl:when></xsl:choose></xsl:attribute> + </演:劈裂> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-peek-in']"> + <演:切入 uof:locID="p0095" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute> + </演:切入> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wedge']"> + <演:扇形展开 uof:locID="p0096" uof:attrList="速度"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + </演:扇形展开> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-random-bars']"> + <演:随机线条 uof:locID="p0097" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:随机线条> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-dissolve-in']"> + <演:向内溶解 uof:locID="p0098" uof:attrList="速度"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + </演:向内溶解> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-boomerang']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-bounce']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-curve-up']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-falling-in']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-flip']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-float']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fold']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-glide']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-magnify']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-movie-credits']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-pinwheel']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-breaks']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-sling']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-spiral-in']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-swivel']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-thread']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-whip']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'oooo-entrance-ascend']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-center-revolve']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-colored-lettering']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-compress']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-descend']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-ease-in']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-rise-up']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-spin-in']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-stretchy']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-turn-and-grow']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-unfold']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-colored-lettering']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-expand']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in-and-swivel']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in-and-zoom']"> + <演:其他 uof:locID="p0099"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-fill-color']"> + <演:更改填充颜色 uof:locID="p0124" uof:attrList="速度 颜色"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateColor/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute> + </演:更改填充颜色> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-color']"> + <演:更改字体颜色 uof:locID="p0126" uof:attrList="速度 颜色"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateColor/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute> + </演:更改字体颜色> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-grow-and-shrink']"> + <演:缩放 uof:locID="p0120" uof:attrList="速度 方向 预定义尺寸 自定义尺寸"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateTransform/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向">horizontal</xsl:attribute> + <xsl:choose> + <xsl:when test="../anim:animateTransform/@smil:to='0.25,1' "> + <xsl:attribute name="演:预定义尺寸">tiny</xsl:attribute> + </xsl:when> + <xsl:when test="../anim:animateTransform/@smil:to='0.5,1' "> + <xsl:attribute name="演:预定义尺寸">smaller</xsl:attribute> + </xsl:when> + <xsl:when test="../anim:animateTransform/@smil:to='1.5,1' "> + <xsl:attribute name="演:预定义尺寸">larger</xsl:attribute> + </xsl:when> + <xsl:when test="../anim:animateTransform/@smil:to='4,1' "> + <xsl:attribute name="演:预定义尺寸">huge</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:自定义尺寸"><xsl:choose><xsl:when test="../anim:animateTransform/@smil:to"><xsl:value-of select="../anim:animateTransform/@smil:to"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </演:缩放> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-size']"> + <演:更改字号 uof:locID="p0125" uof:attrList="速度 预定义尺寸 自定义尺寸"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:choose> + <xsl:when test="parent::anim:par/anim:animate/@smil:to='0.25,1' "> + <xsl:attribute name="演:预定义尺寸">tiny</xsl:attribute> + </xsl:when> + <xsl:when test="parent::anim:par/anim:animate/@smil:to='0.5,1' "> + <xsl:attribute name="演:预定义尺寸">smaller</xsl:attribute> + </xsl:when> + <xsl:when test="parent::anim:par/anim:animate/@smil:to='1.5,1' "> + <xsl:attribute name="演:预定义尺寸">larger</xsl:attribute> + </xsl:when> + <xsl:when test="parent::anim:par/anim:animate/@smil:to='4,1' "> + <xsl:attribute name="演:预定义尺寸">huge</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:自定义尺寸"><xsl:choose><xsl:when test="parent::anim:par/anim:animate/@smil:to"><xsl:value-of select="parent::anim:par/anim:animate/@smil:to"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </演:更改字号> + </xsl:template> + <xsl:template name="getfontstyle_emphasis"> + <xsl:value-of select="concat(@smil:to,' ')"/> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-style']"> + <演:更改字形 uof:locID="p0122" uof:attrList="字形 期间"> + <xsl:attribute name="演:字形"><xsl:variable name="fontstyle"><xsl:for-each select="../anim:set"><xsl:call-template name="getfontstyle_emphasis"/></xsl:for-each></xsl:variable><xsl:value-of select="$fontstyle"/></xsl:attribute> + <xsl:attribute name="演:期间"><xsl:choose><xsl:when test="../@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="../@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="../@smil:repeatCount ='2' or ../@smil:repeatCount ='3' or ../@smil:repeatCount ='4' or ../@smil:repeatCount ='5' or ../@smil:repeatCount ='10'"><xsl:value-of select="../@smil:repeatCount"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </演:更改字形> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-line-color']"> + <演:更改线条颜色 uof:locID="p0121" uof:attrList="速度 颜色"> + <xsl:attribute name="演:速度">medium</xsl:attribute> + <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute> + </演:更改线条颜色> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-spin']"> + <演:陀螺旋 uof:locID="p0123" uof:attrList="速度 顺时针方向 预定义角度 自定义角度"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animateTransform/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:顺时针方向">true</xsl:attribute> + <xsl:choose> + <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='90'"> + <xsl:attribute name="演:预定义角度">quarter spin</xsl:attribute> + </xsl:when> + <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='180'"> + <xsl:attribute name="演:预定义角度">half spin</xsl:attribute> + </xsl:when> + <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='360'"> + <xsl:attribute name="演:预定义角度">full spin</xsl:attribute> + </xsl:when> + <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='720'"> + <xsl:attribute name="演:预定义角度">two spins</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:自定义角度"><xsl:value-of select="parent::anim:par/anim:animateTransform/@smil:by"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </演:陀螺旋> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-transparency']"> + <演:透明 uof:locID="p0127" uof:attrList="预定义透明度 自定义透明度 期间"> + <xsl:choose> + <xsl:when test="../anim:set/@smil:to='0.25' "> + <xsl:attribute name="演:预定义透明度">25</xsl:attribute> + </xsl:when> + <xsl:when test="../anim:set/@smil:to='0.5' "> + <xsl:attribute name="演:预定义透明度">50</xsl:attribute> + </xsl:when> + <xsl:when test="../anim:set/@smil:to='0.75' "> + <xsl:attribute name="演:预定义透明度">75</xsl:attribute> + </xsl:when> + <xsl:when test="../anim:set/@smil:to='1' "> + <xsl:attribute name="演:预定义透明度">100</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="演:自定义透明度"><xsl:value-of select="../anim:set/@smil:to"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="演:期间"><xsl:choose><xsl:when test="../@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="../@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="../@smil:repeatCount ='2' or ../@smil:repeatCount ='3' or ../@smil:repeatCount ='4' or ../@smil:repeatCount ='5' or ../@smil:repeatCount ='10'"><xsl:value-of select="../@smil:repeatCount"/></xsl:when><xsl:otherwise>until next click</xsl:otherwise></xsl:choose></xsl:attribute> + </演:透明> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-blast']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-blink']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-bold-reveal']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-style-emphasis']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-wave']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-flicker']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-grow-with-color']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-shimmer']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-teeter']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-bold-flash']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-blend']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-over-by-letter']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-over-by-word']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-complementary-color']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-complementary-color-2']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-contrasting-color']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-darken']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-desaturate']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-flash-bulb']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-lighten']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-reveal-underline']"> + <演:其他 uof:locID="p0128"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-box']"> + <演:盒状 uof:locID="p0111" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:盒状> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-checkerboard']"> + <演:棋盘 uof:locID="p0114" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:subtype"/></xsl:attribute> + </演:棋盘> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-circle']"> + <演:圆形扩展 uof:locID="p0109" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:圆形扩展> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-crawl-out']"> + <演:缓慢移出 uof:locID="p0102" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when></xsl:choose></xsl:attribute> + </演:缓慢移出> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-diagonal-squares']"> + <演:阶梯状 uof:locID="p0112" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'left-to-bottom' ">left down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'left-to-top' ">left up</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-bottom' ">right down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-top' ">right up</xsl:when></xsl:choose></xsl:attribute> + </演:阶梯状> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-diamond']"> + <演:菱形 uof:locID="p0103" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:菱形> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-disappear']"> + <演:消失 uof:locID="p0118"> + </演:消失> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-dissolve']"> + <演:向外溶解 uof:locID="p0108" uof:attrList="速度"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + </演:向外溶解> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-flash-once']"> + <演:闪烁一次 uof:locID="p0115" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + </演:闪烁一次> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fly-out']"> + <演:飞出 uof:locID="p0101" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-right'">to top-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-left'">to top-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-left'">to bottom-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-right'">to bottom-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when></xsl:choose></xsl:attribute> + </演:飞出> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-peek-out']"> + <演:切出 uof:locID="p0105" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when></xsl:choose></xsl:attribute> + </演:切出> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-plus']"> + <演:十字形扩展 uof:locID="p0116" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:十字形扩展> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-random-bars']"> + <演:随机线条 uof:locID="p0107" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:随机线条> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-random']"> + <演:随机效果 uof:locID="p0117"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:choose><xsl:when test="parent::anim:par/anim:transitionFilter/@smil:dur"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:when><xsl:otherwise><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:otherwise></xsl:choose></xsl:with-param></xsl:call-template></xsl:attribute> + </演:随机效果> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-split']"> + <演:劈裂 uof:locID="p0104" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'horizontal-out'">horizontal out</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'horizontal-in'">horizontal in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-in'">vertical in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-out'">vertical out</xsl:when></xsl:choose></xsl:attribute> + </演:劈裂> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-venetian-blinds']"> + <演:百叶窗 uof:locID="p0100" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:百叶窗> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wedge']"> + <演:扇形展开 uof:locID="p0106" uof:attrList="速度"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + </演:扇形展开> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wheel']"> + <演:轮子 uof:locID="p0113" uof:attrList="速度 轮辐"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:轮辐"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute> + </演:轮子> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wipe']"> + <演:擦除 uof:locID="p0110" uof:attrList="速度 方向"> + <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute> + <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute> + </演:擦除> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-boomerang']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-bounce']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-curve-down']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-flip']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-float']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fold']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-glide']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-magnify']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-movie-credits']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-pinwheel']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-breaks']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-sling']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-swish']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-swivel']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-thread']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-whip']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-ascend']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-center-revolve']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-collapse']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-colored-lettering']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-descend']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-ease-out']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-sink-down']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-spin-out']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-stretchy']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-turn-and-grow ']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-unfold']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-zoom']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-contract']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out-and-swivel']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out-and-zoom']"> + <演:其他 uof:locID="p0119"> + <xsl:copy-of select="parent::node()"/> + </演:其他> + </xsl:template> + <xsl:template match="draw:page" mode="styles"> + <xsl:call-template name="creategraphicstyles"/> + </xsl:template> + <xsl:template match="style:handout-master" mode="styles"> + <xsl:call-template name="creategraphicstyles"/> + </xsl:template> + <xsl:template match="style:master-page" mode="styles"> + <xsl:apply-templates select="presentation:notes" mode="styles"/> + <xsl:call-template name="creategraphicstyles"/> + </xsl:template> + <xsl:template match="presentation:notes" mode="styles"> + <xsl:call-template name="creategraphicstyles"/> + </xsl:template> + <xsl:template name="creategraphicstyles"> + <xsl:for-each select="node()"> + <xsl:variable name="nodename1"> + <xsl:value-of select="name()"/> + </xsl:variable> + <xsl:if test="(substring-before($nodename1,':') = 'draw')"> + <xsl:call-template name="draw"> + <xsl:with-param name="nodename1" select="$nodename1"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="draw"> + <xsl:param name="nodename1"/> + <xsl:choose> + <xsl:when test="substring-after($nodename1,':') = 'a'"> + <xsl:for-each select="child::*"> + <xsl:call-template name="draw"> + <xsl:with-param name="nodename"> + <xsl:value-of select="name()"/> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:when test="substring-after($nodename1,':') = 'g'"> + <xsl:call-template name="draw:g"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="creategraphic"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="draw:g"> + <xsl:for-each select="child::*"> + <xsl:choose> + <xsl:when test="name()='draw:g'"> + <xsl:call-template name="draw:g"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="creategraphic"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <xsl:call-template name="creategraphic"/> + </xsl:template> + <xsl:template name="zuheliebiao"> + <xsl:param name="allnode"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="../child::*[$pos]"> + <xsl:for-each select="../child::*[$pos]"> + <xsl:variable name="nodepos"> + <xsl:value-of select="@draw:style-name"/> + </xsl:variable> + <xsl:variable name="picnumber1"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/> + </xsl:variable> + <xsl:variable name="pic-name1"> + <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/> + </xsl:variable> + <xsl:variable name="allnode1"> + <xsl:value-of select="concat($allnode,',',$pic-name1)"/> + </xsl:variable> + <xsl:call-template name="zuheliebiao"> + <xsl:with-param name="allnode" select="$allnode1"/> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$allnode"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="creategraphic"> + <xsl:variable name="nodename"> + <xsl:value-of select="name()"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="@draw:style-name or name()='draw:g'"> + <xsl:variable name="pic-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:variable> + <xsl:variable name="pic-num"> + <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/> + </xsl:variable> + <xsl:variable name="picnumber"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/> + </xsl:variable> + <xsl:call-template name="pic-process"> + <xsl:with-param name="pic-name" select="$pic-name"/> + <xsl:with-param name="nodename" select="$nodename"/> + <xsl:with-param name="picnumber" select="$picnumber"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@presentation:style-name"> + <xsl:variable name="pic-name"> + <xsl:value-of select="@presentation:style-name"/> + </xsl:variable> + <xsl:variable name="pic-num"> + <xsl:value-of select="count(/descendant::*[@presentation:style-name=$pic-name])"/> + </xsl:variable> + <xsl:variable name="picnumber"> + <xsl:value-of select="count(preceding::*[@presentation:style-name=$pic-name])"/> + </xsl:variable> + <xsl:call-template name="pic-process"> + <xsl:with-param name="pic-name" select="$pic-name"/> + <xsl:with-param name="picnumber" select="$picnumber"/> + <xsl:with-param name="nodename" select="$nodename"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="pic-process"> + <xsl:param name="pic-name"/> + <xsl:param name="nodename"/> + <xsl:param name="picnumber"/> + <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象"> + <xsl:attribute name="图:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:when test="not(@draw:style-name) and name()='draw:g'"><xsl:value-of select="concat(child::node()[1]/@draw:style-name,'-',$picnumber)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when> + <xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise> + </xsl:choose></xsl:attribute> + <xsl:if test="$nodename='draw:g'"> + <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute> + </xsl:if> + <xsl:if test=".//office:binary-data"> + <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:variable name="arrow-sign"> + <xsl:choose> + <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end"> + <xsl:value-of select="'1'"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:page-thumbnail' or $nodename='draw:frame' or $nodename='draw:path'or $nodename='draw:g'"> + <图:预定义图形 uof:locID="g0005"> + <图:类别 uof:locID="g0006"> + <xsl:choose> + <xsl:when test="$nodename='draw:rect'">11</xsl:when> + <xsl:when test="$nodename='draw:line'">61</xsl:when> + <xsl:when test="$nodename='draw:circle'">19</xsl:when> + <xsl:when test="$nodename='draw:polygon'">65</xsl:when> + <xsl:when test="$nodename='draw:polyline'">66</xsl:when> + <xsl:when test="$nodename='draw:ellipse'">19</xsl:when> + <xsl:when test="$nodename='draw:page-thumbnail'">67</xsl:when> + <xsl:when test="$nodename='draw:frame'">3</xsl:when> + <xsl:when test="$nodename='draw:path'">64</xsl:when> + <xsl:when test="$nodename='draw:g'">4</xsl:when> + </xsl:choose> + </图:类别> + <图:名称 uof:locID="g0007"> + <xsl:choose> + <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when> + <xsl:when test="$nodename='draw:line'">Line</xsl:when> + <xsl:when test="$nodename='draw:circle'">Oval</xsl:when> + <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when> + <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when> + <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when> + <xsl:when test="$nodename='draw:page-thumbnail'">缩略图</xsl:when> + <xsl:when test="$nodename='draw:frame'">文本框</xsl:when> + <xsl:when test="$nodename='draw:path'">Curve</xsl:when> + <xsl:when test="$nodename='draw:g'">group</xsl:when> + </xsl:choose> + </图:名称> + <图:生成软件 uof:locID="g0008">PNG</图:生成软件> + <xsl:if test="./@draw:points or ./@svg:d"> + <图:关键点坐标 uof:locID="g0009" uofattrList="路径"> + <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute> + </图:关键点坐标> + </xsl:if> + <图:属性 uof:locID="g0011"> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/*/style:style[@style:name=$pic-name]) "> + <xsl:for-each select="style:graphic-properties"> + <xsl:if test="not(@draw:fill='none')"> + <图:填充 uof:locID="g0012"> + <xsl:call-template name="填充"> + <xsl:with-param name="nodename" select="$nodename"/> + <xsl:with-param name="picname" select="$pic-name"/> + </xsl:call-template> + </图:填充> + </xsl:if> + </xsl:for-each> + <xsl:if test="style:graphic-properties/@svg:stroke-color"> + <图:线颜色 uof:locID="g0013"> + <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/> + </图:线颜色> + </xsl:if> + <图:线型 uof:locID="g0014"> + <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/> + <xsl:choose> + <xsl:when test="not(style:graphic-properties/@draw:stroke)"> + <xsl:choose> + <xsl:when test="not(style:graphic-properties/@svg:stroke-width)">single</xsl:when> + <xsl:otherwise>thick</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:stroke = 'none'">none</xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$linetype='Fine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dash-long-heavy</xsl:when> + <xsl:when test="$linetype='Fine_20_Dashed'">dash-long</xsl:when> + <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash' and style:graphic-properties/@svg:stroke-width">dash-dot-dot-heavy</xsl:when> + <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash'">dot-dot-dash</xsl:when> + <xsl:when test="$linetype='Ultrafine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dashed-heavy</xsl:when> + <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'and style:graphic-properties/@svg:stroke-width">dotted-heavy</xsl:when> + <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'">dotted</xsl:when> + <xsl:when test="$linetype='Line_20_with_20_Fine_20_Dots'">double</xsl:when> + <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_' and style:graphic-properties/@svg:stroke-width">dash-dot-heavy</xsl:when> + <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_'">dot-dash</xsl:when> + <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'and style:graphic-properties/@svg:stroke-width">wavy-heavy</xsl:when> + <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'">wave</xsl:when> + <xsl:when test="$linetype='Fine_20_Dashed_20__28_var_29_'">wavy-double</xsl:when> + <xsl:otherwise>dash</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </图:线型> + <xsl:if test="style:graphic-properties/@svg:stroke-width"> + <图:线粗细 uof:locID="g0016"> + <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/> + </图:线粗细> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)>0"> + <图:前端箭头 uof:locID="g0017"> + <图:式样 uof:locID="g0018"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Line_20_Arrow'">open</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow_20_concave'">stealth</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Square_20_45'">diamond</xsl:when> + <xsl:otherwise>normal</xsl:otherwise> + </xsl:choose> + </图:式样> + <xsl:if test="style:graphic-properties/@draw:marker-start-width"> + <图:大小 uof:locID="g0019"> + <xsl:variable name="width"> + <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="($width<0.05 and 0<$width) or $width=0.05">1</xsl:when> + <xsl:when test="($width<0.10 and 0.05<$width) or $width=0.10">2</xsl:when> + <xsl:when test="($width<0.15 and 0.10<$width) or $width=0.15">3</xsl:when> + <xsl:when test="($width<0.20 and 0.15<$width) or $width=0.20">4</xsl:when> + <xsl:when test="($width<0.25 and 0.20<$width) or $width=0.25">5</xsl:when> + <xsl:when test="($width<0.30 and 0.25<$width) or $width=0.30">6</xsl:when> + <xsl:when test="($width<0.35 and 0.30<$width) or $width=0.35">7</xsl:when> + <xsl:when test="($width<0.40 and 0.35<$width) or $width=0.40">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </图:大小> + </xsl:if> + </图:前端箭头> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:marker-end"> + <图:后端箭头 uof:locID="g0020"> + <图:式样 uof:locID="g0021"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Line_20_Arrow'">open</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow_20_concave'">stealth</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Square_20_45'">diamond</xsl:when> + <xsl:otherwise>normal</xsl:otherwise> + </xsl:choose> + </图:式样> + <xsl:if test="style:graphic-properties/@draw:marker-end-width"> + <图:大小 uof:locID="g0022"> + <xsl:variable name="width"> + <xsl:value-of select="number(substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit))"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="($width<0.05 and 0<$width) or $width=0.05">1</xsl:when> + <xsl:when test="($width<0.10 and 0.05<$width) or $width=0.10">2</xsl:when> + <xsl:when test="($width<0.15 and 0.10<$width) or $width=0.15">3</xsl:when> + <xsl:when test="($width<0.20 and 0.15<$width) or $width=0.20">4</xsl:when> + <xsl:when test="($width<0.25 and 0.20<$width) or $width=0.25">5</xsl:when> + <xsl:when test="($width<0.30 and 0.25<$width) or $width=0.30">6</xsl:when> + <xsl:when test="($width<0.35 and 0.30<$width) or $width=0.35">7</xsl:when> + <xsl:when test="($width<0.40 and 0.35<$width) or $width=0.40">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </图:大小> + </xsl:if> + </图:后端箭头> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:opacity or style:graphic-properties/@svg:stroke-opacity or style:graphic-properties/@svg:stroke-opacity"> + <图:透明度 uof:locID="g0038"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:opacity"> + <xsl:variable name="transparency"> + <xsl:value-of select="substring-before(style:graphic-properties/@draw:opacity,'%')"/> + </xsl:variable> + <xsl:value-of select="(100 - $transparency) div 100"/> + </xsl:when> + <xsl:when test="style:graphic-properties/@svg:stroke-opacity"> + <xsl:variable name="transparency"> + <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-opacity,'%')"/> + </xsl:variable> + <xsl:value-of select="(100 - $transparency) div 100"/> + </xsl:when> + <xsl:when test="style:properties/@svg:stroke-opacity"> + <xsl:value-of select="substring-before(style:properties/@svg:stroke-opacity,'%')"/> + </xsl:when> + </xsl:choose> + </图:透明度> + </xsl:if> + </xsl:for-each> + <xsl:choose> + <xsl:when test="@svg:x1"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:x"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:width"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + </xsl:choose> + <图:旋转角度 uof:locID="g0025"> + <xsl:choose> + <xsl:when test="@draw:transform"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="@draw:transform"/> + </xsl:variable> + <xsl:variable name="rotate-temp"> + <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/> + </xsl:variable> + <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/> + </xsl:when> + <xsl:otherwise>0.0</xsl:otherwise> + </xsl:choose> + </图:旋转角度> + <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例> + <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例> + <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比> + <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例> + <图:打印对象 uof:locID="g0032">true</图:打印对象> + <图:Web文字 uof:locID="g0033"/> + </图:属性> + </图:预定义图形> + </xsl:when> + </xsl:choose> + <xsl:if test="./text:p or ./draw:text-box"> + <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接"> + <xsl:if test="$nodename='draw:text-box'"> + <xsl:attribute name="图:文本框">true</xsl:attribute> + <xsl:if test="./@draw:name = /office:document/office:body +//draw:text-box/@draw:chain-next-name"> + <xsl:attribute name="图:前一链接"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body +//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute> + </xsl:if> + <xsl:if test="./@draw:chain-next-name"> + <xsl:attribute name="图:后一链接"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body +//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) "> + <xsl:if test="style:graphic-properties/@fo:padding-left"> + <xsl:attribute name="图:左边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:右边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:上边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:下边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:文字排列方向"> + <xsl:choose> + <xsl:when test="style:paragraph-properties/@style:writing-mode"> + <xsl:choose> + <xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl' and style:graphic-properties/@draw:textarea-vertical-align='bottom'">vert-l2r</xsl:when> + <xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when> + <xsl:otherwise>hori-l2r</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:if test="style:graphic-properties/@fo:wrap-option"> + <xsl:attribute name="图:自动换行">true</xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true'"> + <xsl:attribute name="图:大小适应文字">true</xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:if test="./draw:text-box"> + <xsl:for-each select="draw:text-box/node( )"> + <xsl:choose> + <xsl:when test="name()='text:list'"> + <xsl:call-template name="unordered-ordered-list"> + <xsl:with-param name="currlistlvl" select="number('1')"/> + <xsl:with-param name="liststylename" select="@text:style-name"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name()='text:p'or name()='text:h'"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:if> + <xsl:if test="./text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:if> + </图:文本内容> + </xsl:if> + <图:控制点 uof:locID="g0003" uof:attrList="x坐标 y坐标"> + <xsl:attribute name="图:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute> + </图:控制点> + <图:翻转 uof:locID="g0040" uof:attrList="方向" 图:方向="x"/> + </图:图形> + <xsl:if test="name(..)='draw:g'"> + <图:组合位置 uof:locID="g0041" uof:attrList="x坐标 y坐标"> + <xsl:attribute name="图:x坐标"><xsl:variable name="minx"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-minx - $minx"/></xsl:when><xsl:otherwise><xsl:variable name="current-x" select="number(substring-before(@svg:x,$uofUnit))"/><xsl:value-of select="$current-x - $minx"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:y坐标"><xsl:variable name="miny"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-miny - $miny"/></xsl:when><xsl:otherwise><xsl:variable name="current-y" select="number(substring-before(@svg:y,$uofUnit))"/><xsl:value-of select="$current-y - $miny"/></xsl:otherwise></xsl:choose></xsl:attribute> + </图:组合位置> + </xsl:if> + <xsl:if test="name()='draw:frame' and ./draw:image"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <xsl:attribute name="uof:公共类型">jpg</xsl:attribute> + <xsl:if test="./draw:image/office:binary-data"> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="./draw:image/office:binary-data"/> + </uof:数据> + </xsl:if> + <xsl:if test="./draw:image/@xlink:href"> + <uof:路径 uof:locID="u0038"> + <xsl:value-of select="./draw:image/@xlink:href"/> + </uof:路径> + </xsl:if> + </uof:其他对象> + </xsl:if> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) "> + <xsl:if test="style:graphic-properties/@draw:fill-image-name and @draw:fill='bitmap'"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:公共类型">jpg</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <xsl:variable name="fill-name"> + <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/> + </xsl:variable> + <uof:数据 uof:locID="u0037"> + <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]"> + <xsl:value-of select="office:binary-data"/> + </xsl:for-each> + </uof:数据> + <uof:路径 uof:locID="u0038"> + <xsl:value-of select="@xlink:href"/> + </uof:路径> + </uof:其他对象> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="unordered-ordered-list"> + <xsl:param name="currlistlvl"/> + <xsl:param name="liststylename"/> + <xsl:for-each select="text:list-item"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="$currlistlvl"/> + <xsl:with-param name="liststylename" select="$liststylename"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:for-each select="node( )"> + <xsl:if test="name()='text:list'"> + <xsl:call-template name="unordered-ordered-list"> + <xsl:with-param name="currlistlvl" select="$currlistlvl +1"/> + <xsl:with-param name="liststylename" select="$liststylename"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + <xsl:template name="groupminx"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:x][position()=$pos]"> + <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/> + <xsl:call-template name="groupminx"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$othervalue"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="groupminy"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:y][position()=$pos]"> + <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/> + <xsl:call-template name="groupminy"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$othervalue"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="groupmaxx"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:x][position()=$pos]"> + <xsl:variable name="svgx"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="width"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:width,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="othervalue" select="$svgx + $width"/> + <xsl:call-template name="groupminx"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$othervalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="groupmaxy"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:y][position()=$pos]"> + <xsl:variable name="svgy"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="height"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:height,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="othervalue" select="$svgy + $height"/> + <xsl:call-template name="groupminy"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$othervalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="draw:points"> + <xsl:param name="point"/> + <xsl:param name="lujing"/> + <xsl:choose> + <xsl:when test="contains($point,' ' )"> + <xsl:variable name="first-point" select="substring-before($point,' ')"/> + <xsl:variable name="other-point" select="substring-after($point,' ')"/> + <xsl:variable name="xzuobiao"> + <xsl:value-of select="substring-before($first-point,',') div 1000"/> + </xsl:variable> + <xsl:variable name="yzuobiao"> + <xsl:value-of select="substring-after($first-point,',') div 1000"/> + </xsl:variable> + <xsl:call-template name="draw:points"> + <xsl:with-param name="point" select="$other-point"/> + <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="xzuobiao"> + <xsl:value-of select="substring-before($point,',') div 1000"/> + </xsl:variable> + <xsl:variable name="yzuobiao"> + <xsl:value-of select="substring-after($point,',') div 1000"/> + </xsl:variable> + <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="execParagraph"> + <xsl:param name="currlistlvl"/> + <xsl:param name="liststylename"/> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <xsl:if test="@text:id"> + <xsl:attribute name="字:动画标识"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:if> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:choose><xsl:when test="@text:id"><xsl:value-of select="@text:id"/></xsl:when><xsl:otherwise><xsl:value-of select="@text:style-name"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="not(number($currlistlvl) =number('0'))"> + <xsl:variable name="parent-position"> + <xsl:number from="/office:document/office:body/text:ordered-list" level="any" count="text:list-item/text:p" format="1"/> + </xsl:variable> + <xsl:element name="字:自动编号信息"> + <xsl:attribute name="uof:locID">t0059</xsl:attribute> + <xsl:attribute name="uof:attrList">编号引用 编号级别 重新编号 起始编号</xsl:attribute> + <xsl:attribute name="字:编号引用"><xsl:value-of select="$liststylename"/></xsl:attribute> + <xsl:attribute name="字:编号级别"><xsl:value-of select="$currlistlvl"/></xsl:attribute> + <xsl:attribute name="字:重新编号"><xsl:choose><xsl:when test="number($parent-position)=number('1')">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="字:起始编号"><xsl:for-each select="//text:list-style[$liststylename=@style:name]/*[number($currlistlvl)=number(@text:level)]"><xsl:choose><xsl:when test="@text:start-value"><xsl:value-of select="@text:start-value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:for-each></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:variable name="stylename"> + <xsl:value-of select="@text:style-name"/> + </xsl:variable> + <xsl:for-each select="(//style:style[@style:name=$stylename])"> + <xsl:call-template name="ParaAttribute"> + <xsl:with-param name="text-style-name" select="@text:style-name"/> + </xsl:call-template> + </xsl:for-each> + </xsl:element> + <xsl:for-each select="node( )"> + <xsl:choose> + <xsl:when test="self::node( )[name(.)='text:span']"> + <xsl:call-template name="textspan"/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:time']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:s']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="substring-before(name(.),':')='draw' and not(name(.)='draw:a')"> + </xsl:when> + <xsl:when test="name(.)='text:a'"> + <字:句 uof:locID="t0085"> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <字:字体 uof:locID="t0088" uof:attrList="西文字体引用 中文字体引用 字号 颜色" 字:颜色="#0000ff"/> + <字:下划线 uof:locID="t0095" 字:类型="single" 字:颜色="#0000ff" uof:attrList="类型 颜色 字下划线"/> + </xsl:element> + <xsl:element name="字:区域开始"> + <xsl:attribute name="字:标识符">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute> + <xsl:attribute name="字:名称">Hyperlink</xsl:attribute> + <xsl:attribute name="字:类型">hyperlink</xsl:attribute> + <xsl:attribute name="uof:locID">t0121</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + </xsl:element> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="."/> + </字:文本串> + <xsl:element name="字:区域结束"> + <xsl:attribute name="字:标识符引用">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0122</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute> + </xsl:element> + </字:句> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="字:句"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </字:段落> + </xsl:template> + <xsl:template name="字:句"> + <xsl:if test="not(name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data')"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"> + <xsl:choose> + <xsl:when test="@text:style-name"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:式样引用"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </字:句属性> + <xsl:choose> + <xsl:when test="(preceding-sibling::text:bookmark-start) and (following-sibling::text:bookmark-end)"> + <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型"> + <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark-start/@text:name"/></xsl:attribute> + <xsl:attribute name="字:名称">Bookmark</xsl:attribute> + <xsl:attribute name="字:类型">bookmark</xsl:attribute> + </字:区域开始> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="string(.)"/> + </字:文本串> + <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用"> + <xsl:attribute name="字:标识符引用"><xsl:value-of select="following-sibling::text:bookmark-end/@text:name"/></xsl:attribute> + </字:区域结束> + </xsl:when> + <xsl:when test="preceding-sibling::text:bookmark"> + <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型"> + <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark/@text:name"/></xsl:attribute> + <xsl:attribute name="字:名称">Bookmark</xsl:attribute> + <xsl:attribute name="字:类型">bookmark</xsl:attribute> + </字:区域开始> + <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用"> + <xsl:attribute name="字:标识符引用"><xsl:value-of select="preceding-sibling::text:bookmark/@text:name"/></xsl:attribute> + </字:区域结束> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="string(.)"/> + </字:文本串> + </xsl:when> + <xsl:when test="name(.)='draw:a'"> + <xsl:variable name="link-name"> + <xsl:value-of select="substring-after(@xlink:href,'#')"/> + </xsl:variable> + <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型"> + <xsl:attribute name="字:标识符"><xsl:value-of select="$link-name"/></xsl:attribute> + <xsl:attribute name="字:名称">Bookmark</xsl:attribute> + <xsl:attribute name="字:类型">bookmark</xsl:attribute> + </字:区域开始> + <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用"> + <xsl:attribute name="字:标识符引用"><xsl:value-of select="$link-name"/></xsl:attribute> + </字:区域结束> + </xsl:when> + <xsl:when test="self::node( )[name(.)='text:tab-stop']"> + <xsl:element name="字:制表符"> + <xsl:attribute name="uof:locID">t0123</xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data'"> + </xsl:when> + <xsl:otherwise> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="string(.)"/> + </字:文本串> + </xsl:otherwise> + </xsl:choose> + </字:句> + </xsl:if> + </xsl:template> + <xsl:template name="jiaozhu"> + <字:脚注 uof:locID="t0107" uof:attrList="引文体"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </字:脚注> + </xsl:template> + <xsl:template match="text:s"> + <xsl:param name="bText"/> + <xsl:choose> + <xsl:when test="$bText='0'"> + <xsl:variable name="count"> + <xsl:choose> + <xsl:when test="not(@text:c)">1</xsl:when> + <xsl:otherwise> + <xsl:value-of select="@text:c+1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <字:句 uof:locID="t0085"> + <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/> + </字:句> + </xsl:when> + <xsl:otherwise> + <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="weizhu"> + <字:尾注 uof:locID="t0108" uof:attrList="引文体"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </字:尾注> + </xsl:template> + <xsl:template match="text:time"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'TIME'"/></xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + </xsl:element> + <xsl:element name="字:域代码"> + <字:段落 uof:locID="t0051"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="timefmt"> + <xsl:variable name="aa" select="@style:data-style-name"/> + <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text"> + <xsl:choose> + <xsl:when test="@number:style='long' "> + <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="self::node( )[name(.)='number:text']"> + <xsl:value-of select="."/> + </xsl:if> + <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if> + <xsl:if test="self::node( )[name(.)='number:am-pm']">AMPM</xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="quote">"</xsl:variable> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="concat('TIME \@ ',$quote,$timefmt,$quote,' \* MERGEFORMAT ')"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="ParaAttribute"> + <xsl:param name="text-style-name"/> + <xsl:for-each select="/office:document/office:styles/style:style"> + <xsl:if test="@style:name=$text-style-name and not($text-style-name='Standard')"> + <xsl:element name="字:格式修订"> + <xsl:attribute name="uof:locID">t0053</xsl:attribute> + <xsl:attribute name="uof:attrList">修订信息引用</xsl:attribute> + <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@style:name"/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:if> + </xsl:for-each> + <xsl:if test="@style:name='Heading'"> + <xsl:element name="字:大纲级别"> + <xsl:attribute name="uof:locID">t0054</xsl:attribute> + <xsl:value-of select="substring-after(@style:name,'Heading')"/> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:text-align or .//@style:vertical-align"> + <xsl:element name="字:对齐"> + <xsl:attribute name="uof:locID">t0055</xsl:attribute> + <xsl:attribute name="uof:attrList">水平对齐 文字对齐</xsl:attribute> + <xsl:attribute name="字:水平对齐"><xsl:choose><xsl:when test=".//@fo:text-align='end'">right</xsl:when><xsl:when test=".//@fo:text-align='center'">center</xsl:when><xsl:when test=".//@fo:text-align='justify' and not(.//@fo:text-align-last='justify')">justified</xsl:when><xsl:when test=".//@fo:text-align='justify' and .//@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="字:文字对齐"><xsl:choose><xsl:when test=".//@style:vertical-align='baseline'">base</xsl:when><xsl:when test=".//@style:vertical-align='top'">top</xsl:when><xsl:when test=".//@style:vertical-align='middle'">center</xsl:when><xsl:when test=".//@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:margin-left or .//@fo:margin-right or .//@fo:text-indent"> + <xsl:element name="字:缩进"> + <xsl:attribute name="uof:locID">t0056</xsl:attribute> + <xsl:call-template name="字:缩进类型"/> + </xsl:element> + </xsl:if> + <xsl:element name="字:行距"> + <xsl:attribute name="uof:locID">t0057</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 值</xsl:attribute> + <xsl:choose> + <xsl:when test="contains(.//@fo:line-height,$uofUnit)"> + <xsl:attribute name="字:类型">fixed</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:line-height,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="contains(.//@fo:line-height,'%')"> + <xsl:attribute name="字:类型">multi-lines</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:line-height,'%') div 100"/></xsl:attribute> + </xsl:when> + <xsl:when test=".//@style:line-height-at-least"> + <xsl:attribute name="字:类型">at-least</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@style:line-height-at-least,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test=".//@style:line-spacing"> + <xsl:attribute name="字:类型">line-space</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@style:line-spacing,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:类型">multi-lines</xsl:attribute> + <xsl:attribute name="字:值">1.0</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test=".//@fo:orphans"> + <xsl:element name="字:孤行控制"> + <xsl:attribute name="uof:locID">t0060</xsl:attribute> + <xsl:value-of select=".//@fo:orphans"/> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:widows"> + <xsl:element name="字:寡行控制"> + <xsl:attribute name="uof:locID">t0061</xsl:attribute> + <xsl:value-of select=".//@fo:widows"/> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:break-inside"> + <xsl:element name="字:段中不分页"> + <xsl:attribute name="uof:locID">t0062</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:keep-with-next"> + <xsl:element name="字:与下段同页"> + <xsl:attribute name="uof:locID">t0063</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:break-before"> + <xsl:element name="字:段前分页"> + <xsl:attribute name="uof:locID">t0064</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:snap-to-layout-grid"> + <xsl:element name="字:对齐网格"> + <xsl:attribute name="uof:locID">t0069</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:snap-to-layout-grid='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//style:drop-cap"> + <xsl:element name="字:首字下沉"> + <xsl:attribute name="uof:locID">t0070</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 字体引用 字符数 行数 间距</xsl:attribute> + <xsl:attribute name="字:类型">dropped</xsl:attribute> + <xsl:if test=".//style:drop-cap/@style:style-name"> + <xsl:attribute name="字:字体引用"><xsl:value-of select=".//style:drop-cap/@style:style-name"/></xsl:attribute> + </xsl:if> + <xsl:if test=".//style:drop-cap/@style:distance"> + <xsl:attribute name="字:间距"><xsl:value-of select="substring-before(.//style:drop-cap/@style:distance,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test=".//style:drop-cap/@style:length"> + <xsl:attribute name="字:字符数"><xsl:value-of select=".//style:drop-cap/@style:length"/></xsl:attribute> + </xsl:if> + <xsl:if test=".//style:drop-cap/@style:lines"> + <xsl:attribute name="字:行数"><xsl:value-of select=".//style:drop-cap/@style:lines"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:hyphenate"> + <xsl:element name="字:取消断字"> + <xsl:attribute name="uof:locID">t0071</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select=".//@fo:hyphenate"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@text:number-lines"> + <xsl:element name="字:取消行号"> + <xsl:attribute name="字:值"><xsl:value-of select=".//@text:number-lines"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0072</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="字:允许单词断字"> + <xsl:attribute name="字:值">true</xsl:attribute> + <xsl:attribute name="uof:locID">t0073</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + <xsl:if test=".//@style:punctuation-wrap"> + <xsl:element name="字:行首尾标点控制"> + <xsl:attribute name="uof:locID">t0074</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:punctuation-wrap='hanging'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="字:是否行首标点压缩"> + <xsl:attribute name="uof:locID">t0075</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">false</xsl:attribute> + </xsl:element> + <xsl:if test=".//@style:line-break "> + <xsl:element name="字:中文习惯首尾字符"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:line-break='strict'">true</xsl:when><xsl:when test=".//@style:line-break='normal'">false</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0076</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:text-autospace"> + <xsl:element name="字:自动调整中英文字符间距"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:text-autospace='ideograph-alpha'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0077</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@style:text-autospace"> + <xsl:element name="字:自动调整中文与数字间距"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:text-autospace='ideograph-alpha'">true </xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0078</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="字:有网格自动调整右缩进"> + <xsl:attribute name="字:值">false</xsl:attribute> + <xsl:attribute name="uof:locID">t0195</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + <xsl:if test=".//@fo:border or .//@fo:border-top or .//@fo:border-bottom or .//@fo:border-left or .//@fo:border-right or .//@style:shadow[.!='none']"> + <xsl:element name="字:边框"> + <xsl:attribute name="uof:locID">t0065</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:background-color"> + <xsl:element name="字:填充"> + <xsl:attribute name="uof:locID">t0066</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test=".//@fo:margin-top or .//@fo:margin-bottom"> + <字:段间距 uof:locID="t0058"> + <xsl:if test=".//@fo:margin-top"> + <字:段前距 uof:locID="t0196"> + <字:绝对值 uof:locID="t0199" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:margin-top,$uofUnit)"/></xsl:attribute> + </字:绝对值> + </字:段前距> + </xsl:if> + <xsl:if test=".//@fo:margin-bottom"> + <字:段后距 uof:locID="t0196"> + <字:绝对值 uof:locID="t0202" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:margin-bottom,$uofUnit)"/></xsl:attribute> + </字:绝对值> + </字:段后距> + </xsl:if> + </字:段间距> + </xsl:if> + <xsl:if test=".//style:tab-stops"> + <xsl:element name="字:制表位设置"> + <xsl:attribute name="uof:locID">t0067</xsl:attribute> + <xsl:for-each select=".//style:tab-stops/style:tab-stop"> + <xsl:element name="字:制表位"> + <xsl:attribute name="uof:locID">t0068</xsl:attribute> + <xsl:attribute name="uof:attrList">位置 类型 前导符</xsl:attribute> + <xsl:attribute name="字:位置"><xsl:value-of select="@style:position"/></xsl:attribute> + <xsl:variable name="aa"> + <xsl:value-of select="@style:type"/> + </xsl:variable> + <xsl:variable name="zbflx"> + <xsl:choose> + <xsl:when test="$aa='right'">right</xsl:when> + <xsl:when test="$aa='center'">center</xsl:when> + <xsl:when test="$aa='char'and @style:char!=''">decimal</xsl:when> + <xsl:otherwise>left</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="字:类型"><xsl:value-of select="$zbflx"/></xsl:attribute> + <xsl:if test="$zbflx='decimal'"> + <xsl:attribute name="字:制表位字符"><xsl:value-of select="@style:char"/></xsl:attribute> + </xsl:if> + <xsl:if test="@style:leader-char"> + <xsl:attribute name="字:前导符"><xsl:value-of select="@style:leader-char"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="textspan"> + <字:句 uof:locID="t0085"> + <xsl:choose> + <xsl:when test="./text:footnote"> + <xsl:call-template name="jiaozhu"/> + </xsl:when> + <xsl:when test="./text:endnote"> + <xsl:call-template name="weizhu"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:variable name="textstyle"> + <xsl:value-of select="@text:style-name"/> + </xsl:variable> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']"> + <xsl:if test="@style:name=$textstyle and not(@style:parent-style-name='Standard')"> + <xsl:if test="@style:parent-style-name=/office:document/office:styles/style:style/@style:name"> + <xsl:call-template name="SentenceXD"> + <xsl:with-param name="Sentencestyle" select="@style:parent-style-name"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="/office:document/office:styles//style:style[@style:family='text']"> + <xsl:if test="@style:name=$textstyle"> + <xsl:call-template name="SentenceXD"> + <xsl:with-param name="Sentencestyle" select="@style:name"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:element> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="string(.)"/> + </字:文本串> + </xsl:otherwise> + </xsl:choose> + </字:句> + </xsl:template> + <xsl:template name="SentenceXD"> + <xsl:param name="Sentencestyle"/> + <xsl:element name="字:格式修订"> + <xsl:attribute name="uof:locID">t0087</xsl:attribute> + <xsl:attribute name="uof:attrList">修订信息引用</xsl:attribute> + <xsl:attribute name="字:修订信息引用"><xsl:value-of select="$Sentencestyle"/></xsl:attribute> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="$Sentencestyle"/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="add-space"> + <xsl:param name="number"/> + <xsl:if test="$number > 1"> + <xsl:call-template name="add-space"> + <xsl:with-param name="number" select="$number - 1"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:template> + <xsl:template match="office:styles | office:automatic-styles" mode="style"> + <xsl:for-each select="style:style[@style:family= 'paragraph' or @style:family= 'text']"> + <xsl:choose> + <xsl:when test="@style:family = 'text'"> + <xsl:call-template name="句式样"/> + </xsl:when> + <xsl:when test="@style:family = 'paragraph'"> + <xsl:call-template name="段落式样"/> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="段落式样"> + <xsl:element name="uof:段落式样"> + <xsl:attribute name="uof:locID">u0044</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute> + <xsl:variable name="count"><xsl:value-of select="count(preceding::style:style)"/></xsl:variable> + <xsl:attribute name="字:标识符"><xsl:value-of select="concat(@style:name,$count)"/></xsl:attribute> + <xsl:attribute name="字:类型">default</xsl:attribute> + <xsl:attribute name="字:基式样引用"><xsl:variable name="stylename" select="@style:name"/><xsl:variable name="frame-parent"><xsl:choose><xsl:when test="/office:document/office:master-styles/style:master-page/draw:frame[draw:text-box//text:p/@text:style-name = $stylename]"><xsl:for-each select="/office:document/office:master-styles/style:master-page/draw:frame[draw:text-box//text:p/@text:style-name = $stylename][1]"><xsl:variable name="frame-style" select="@presentation:style-name"/><xsl:value-of select="/office:document/*/style:style[@style:name=$frame-style]/@style:parent-style-name"/></xsl:for-each></xsl:when><xsl:otherwise>not-master</xsl:otherwise></xsl:choose></xsl:variable><xsl:choose><xsl:when test="@style:parent-style-name"><xsl:value-of select="@style:parent-style-name"/></xsl:when><xsl:when test="not($frame-parent='not-master')"><xsl:value-of select="$frame-parent"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:apply-templates select="style:paragraph-properties"/> + <xsl:for-each select="style:text-properties"> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:call-template name="字:句属性"/> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template match="style:paragraph-properties"> + <xsl:element name="字:缩进"> + <xsl:attribute name="uof:locID">t0056</xsl:attribute> + <xsl:call-template name="字:缩进类型"/> + </xsl:element> + <xsl:if test="@fo:text-align | @fotext-align-last"> + <xsl:element name="字:对齐"> + <xsl:attribute name="uof:locID">t0055</xsl:attribute> + <xsl:if test="@fo:text-align"> + <xsl:attribute name="字:水平对齐"><xsl:choose><xsl:when test=".//@fo:text-align='end'">right</xsl:when><xsl:when test=".//@fo:text-align='center'">center</xsl:when><xsl:when test=".//@fo:text-align='justify' and not(.//@fo:text-align-last='justify')">justified</xsl:when><xsl:when test=".//@fo:text-align='justify' and .//@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="@style:vertical-align"> + <xsl:attribute name="字:文字对齐"><xsl:choose><xsl:when test=".//@style:vertical-align='baseline'">base</xsl:when><xsl:when test=".//@style:vertical-align='top'">top</xsl:when><xsl:when test=".//@style:vertical-align='middle'">center</xsl:when><xsl:when test=".//@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:attribute name="uof:attrList">水平对齐 文字对齐</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="句式样"> + <xsl:element name="uof:句式样"> + <xsl:attribute name="uof:locID">u0043</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:call-template name="字:句属性"/> + </xsl:element> + </xsl:template> + <xsl:template match="style:text-properties"> + <xsl:element name="字:字体"> + <xsl:attribute name="uof:locID">t0088</xsl:attribute> + <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute> + <xsl:if test=".//@fo:font-size or .//@style:font-size-asian or .//@style:font-size-complex"> + <xsl:choose> + <xsl:when test="contains(.//@fo:font-size,'%') or contains(.//@style:font-size-asian,'%')"> + <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'%')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-complex"><xsl:value-of select="substring-before(.//@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test=".//@style:font-name"> + <xsl:attribute name="字:西文字体引用"><xsl:value-of select=".//@style:font-name"/></xsl:attribute> + </xsl:if> + <xsl:if test=".//@style:font-name-asian"> + <xsl:attribute name="字:中文字体引用"><xsl:value-of select=".//@style:font-name-asian"/></xsl:attribute> + </xsl:if> + <xsl:if test=".//@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test="(@fo:font-weight='bold') or (@fo:font-weight-asian='bold') or (@style:font-weight-asian='bold') or (@style:font-weight-complex='bold')"> + <xsl:element name="字:粗体"> + <xsl:attribute name="字:值">1</xsl:attribute> + <xsl:attribute name="uof:locID">t0089</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="(@style:font-style-asian='italic') or (@style:font-style-complex='italic') or (@fo:font-style-asian='italic') or (@fo:font-style='italic')"> + <xsl:element name="字:斜体"> + <xsl:attribute name="字:值">1</xsl:attribute> + <xsl:attribute name="uof:locID">t0090</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="style:page-layout"> + <xsl:element name="演:页面设置"> + <xsl:attribute name="uof:locID">p0002</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称</xsl:attribute> + <xsl:attribute name="演:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="演:名称">页面设置</xsl:attribute> + <xsl:element name="演:纸张"> + <xsl:attribute name="uof:locID">p0003</xsl:attribute> + <xsl:attribute name="uof:attrList">宽度 高度 纸型</xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-width,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-height,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="style:page-layout-properties/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="style:page-layout-properties/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$height='29.7cm' and $width='42cm'">A3</xsl:when><xsl:when test="$height='21cm' and $width='29.7cm'">A4</xsl:when><xsl:when test="$height='14.8cm' and $width='21cm'">A5</xsl:when><xsl:when test="$height='25cm' and $width='35.3cm'">B4</xsl:when><xsl:when test="$height='17.6cm' and $width='25cm'">B5</xsl:when><xsl:when test="$height='12.5cm' and $width='17.6cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:element name="演:页边距"> + <xsl:attribute name="uof:locID">p0004</xsl:attribute> + <xsl:attribute name="uof:attrList">左 上 右 下</xsl:attribute> + <xsl:attribute name="uof:左"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-left,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:上"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-top,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:右"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-right,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:下"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-bottom,$uofUnit)"/></xsl:attribute> + </xsl:element> + <xsl:variable name="PageNumberFormat"> + <xsl:value-of select="/office:document/office:settings/config:config-item-set/config:config-item[@config:name='PageNumberFormat']"/> + </xsl:variable> + <xsl:if test="not($PageNumberFormat='5')"> + <xsl:element name="演:页码格式"> + <xsl:attribute name="uof:locID">p0005</xsl:attribute> + <xsl:choose> + <xsl:when test="$PageNumberFormat='0'">upper-letter</xsl:when> + <xsl:when test="$PageNumberFormat='1'">lower-letter</xsl:when> + <xsl:when test="$PageNumberFormat='2'">upper-roman</xsl:when> + <xsl:when test="$PageNumberFormat='3'">lower-letter</xsl:when> + <xsl:when test="$PageNumberFormat='4'">decimal</xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="演:纸张方向"> + <xsl:attribute name="uof:locID">p0006</xsl:attribute> + <xsl:choose> + <xsl:when test="style:page-layout-properties/@style:print-orientation"> + <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/> + </xsl:when> + <xsl:otherwise>portrait</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="obtain_anim_type"> + <xsl:param name="flytype"/> + <xsl:variable name="flytypestr" select="substring-after($flytype,'from-')"/> + <xsl:choose> + <xsl:when test="contains($flytypestr,'-')"> + <xsl:value-of select="concat(substring-before($flytypestr,'-'),substring-after($flytypestr,'-'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$flytypestr"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="cm2pt"> + <xsl:param name="cmval"/> + <xsl:value-of select="substring-before($cmval,$uofUnit)* $cm-to-other "/> + </xsl:template> + <xsl:template match="office:font-face-decls"> + <uof:字体集 uof:locID="u0040"> + <uof:默认字体 uof:ascii="Times New Roman" uof:fareast="宋体" uof:h-ansi="宋体" uof:cs="宋体"/> + <xsl:for-each select="style:font-face"> + <xsl:element name="uof:字体声明"> + <xsl:attribute name="uof:attrList">标识符 名称 字体族</xsl:attribute> + <xsl:attribute name="uof:locID">u0041</xsl:attribute> + <xsl:attribute name="uof:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="uof:字体族"><xsl:value-of select="@svg:font-family"/></xsl:attribute> + <xsl:if test="@style:font-charset= '02'"> + <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute> + </xsl:if> + <xsl:if test="@style:font-family-generic"> + <xsl:choose> + <xsl:when test="@style:font-family-generic = 'swiss'"> + <xsl:attribute name="uof:字体族">Swiss</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='modern'"> + <xsl:attribute name="uof:字符集">Modern</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic='roman'"> + <xsl:attribute name="uof:字符集">Roman</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='script'"> + <xsl:attribute name="uof:字符集">Script</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='decorative'"> + <xsl:attribute name="uof:字符集">Decorative</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='system'"> + <xsl:attribute name="uof:字符集">System</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="uof:字符集">System</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:for-each> + <xsl:apply-templates select="style:font-decl"/> + </uof:字体集> + </xsl:template> + <xsl:template match="office:meta"> + <uof:元数据 uof:locID="u0001"> + <uof:标题 uof:locID="u0002"> + <xsl:value-of select="dc:title"/> + </uof:标题> + <uof:创建应用程序 uof:locID="u0011"> + <xsl:value-of select="meta:generator"/> + </uof:创建应用程序> + <uof:摘要 uof:locID="u0007"> + <xsl:value-of select="dc:description"/> + </uof:摘要> + <uof:主题 uof:locID="u0003"> + <xsl:value-of select="dc:subject"/> + </uof:主题> + <uof:创建者 uof:locID="u0004"/> + <uof:作者 uof:locID="u0005"> + <xsl:value-of select="meta:initial-creator"/> + </uof:作者> + <uof:创建日期 uof:locID="u0008"> + <xsl:value-of select="meta:creation-date"/> + </uof:创建日期> + <uof:最后作者 uof:locID="u0006"> + <xsl:value-of select="dc:creator"/> + </uof:最后作者> + <uof:关键字集 uof:locID="u0014"> + <xsl:for-each select="."> + <uof:关键字 uof:locID="u0015"> + <xsl:value-of select="meta:keywords/@meta:keyword"/> + </uof:关键字> + </xsl:for-each> + </uof:关键字集> + <uof:编辑次数 uof:locID="u0009"> + <xsl:value-of select="meta:editing-cycles"/> + </uof:编辑次数> + <xsl:if test="meta:editing-duration"> + <uof:编辑时间 uof:locID="u0010"> + <xsl:value-of select="meta:editing-duration"/> + </uof:编辑时间> + </xsl:if> + <xsl:if test="meta:template/@xlink:href"> + <uof:文档模板 uof:locID="u0013"> + <xsl:value-of select="meta:template/@xlink:href"/> + </uof:文档模板> + </xsl:if> + <xsl:if test="meta:user-defined/@meta:name"> + <uof:用户自定义元数据集 uof:locID="u0016"> + <xsl:for-each select="meta:user-defined"> + <uof:用户自定义元数据 uof:locID="u0017" uof:attrList="名称 类型"> + <xsl:attribute name="uof:名称"><xsl:value-of select="@meta:name"/></xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute> + </uof:用户自定义元数据> + </xsl:for-each> + </uof:用户自定义元数据集> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:page-count"> + <uof:页数 uof:locID="u0020"> + <xsl:value-of select="meta:document-statistic/@meta:page-count"/> + </uof:页数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:paragraph-count"> + <uof:段落数 uof:locID="u0025"> + <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/> + </uof:段落数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:object-count"> + <uof:对象数 uof:locID="u0026"> + <xsl:value-of select="meta:document-statistic/@meta:object-count"/> + </uof:对象数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:character-count"> + <uof:字数 uof:locID="u0021"> + <xsl:value-of select="meta:document-statistic/@meta:character-count"/> + </uof:字数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:word-count"> + <uof:中文字符数 uof:locID="u0023"> + <xsl:value-of select="meta:document-statistic/@meta:word-count"/> + </uof:中文字符数> + </xsl:if> + </uof:元数据> + </xsl:template> + <xsl:template name="填充"> + <xsl:param name="picname"/> + <xsl:param name="nodename"/> + <xsl:choose> + <xsl:when test="@draw:fill='gradient'"> + <xsl:variable name="gradient-name"> + <xsl:value-of select="@draw:fill-gradient-name"/> + </xsl:variable> + <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]"> + <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型"> + <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute> + <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute> + <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute> + <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute> + <xsl:variable name="angle"> + <xsl:value-of select="@draw:angle div 10"/> + </xsl:variable> + <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0<$angle and $angle<25">0</xsl:when><xsl:when test="25<$angle and $angle<70">45</xsl:when><xsl:when test="70<$angle and $angle<115">90</xsl:when><xsl:when test="115<$angle and $angle<160">135</xsl:when><xsl:when test="160<$angle and $angle<205">180</xsl:when><xsl:when test="205<$angle and $angle<250">225</xsl:when><xsl:when test="250<$angle and $angle<295">270</xsl:when><xsl:when test="295<$angle and $angle<340">315</xsl:when><xsl:when test="340<$angle and $angle<360">360</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute> + <xsl:if test="@draw:cx"> + <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="@draw:cy"> + <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:类型">-2</xsl:attribute> + </图:渐变> + </xsl:for-each> + </xsl:when> + <xsl:when test="@draw:fill='bitmap'"> + <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称"> + <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(@style:repeat)">title</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="@style:repeat = 'repeat'">title</xsl:when><xsl:when test="@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:图形引用"><xsl:value-of select="@draw:fill-image-name"/></xsl:attribute> + <xsl:attribute name="图:类型">png</xsl:attribute> + <xsl:attribute name="图:名称"><xsl:value-of select="concat($picname,'_b1')"/></xsl:attribute> + </图:图片> + </xsl:when> + <xsl:when test="@draw:fill='hatch'"> + <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色"> + <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute> + <xsl:attribute name="图:图形引用"/> + <xsl:attribute name="图:前景色"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute> + <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="@draw:fill-color"><xsl:value-of select="@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute> + </图:图案> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$nodename='draw:frame'"> + <xsl:if test="@draw:fill='solid'"> + <图:颜色 uof:locID="g0034"> + <xsl:value-of select="@draw:fill-color"/> + </图:颜色> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <图:颜色 uof:locID="g0034"> + <xsl:choose> + <xsl:when test="@draw:fill-color"> + <xsl:value-of select="@draw:fill-color"/> + </xsl:when> + <xsl:otherwise>#99ccff</xsl:otherwise> + </xsl:choose> + </图:颜色> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="字:缩进类型"> + <xsl:if test="style:list-level-properties/@text:space-before"> + <字:左 uof:locID="t0182"> + <字:绝对 uof:locID="t0185" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:space-before,$uofUnit)"/></xsl:attribute> + </字:绝对> + </字:左> + </xsl:if> + <xsl:if test="style:list-level-properties/@text:min-label-width"> + <字:右 uof:locID="t0183"> + <字:绝对 uof:locID="t0187" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/></xsl:attribute> + </字:绝对> + </字:右> + </xsl:if> + <xsl:if test="style:list-level-properties/@text:min-label-distance"> + <字:首行 uof:locID="t0184"> + <字:绝对 uof:locID="t0189" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-distance,$uofUnit)"/></xsl:attribute> + </字:绝对> + </字:首行> + </xsl:if> + </xsl:template> + <xsl:template name="uof:线型类型"> + <xsl:param name="lineType"/> + <xsl:choose> + <xsl:when test="$lineType='single-line'">single</xsl:when> + <xsl:when test="$lineType='double-line'">double</xsl:when> + <xsl:when test="$lineType='single'">single</xsl:when> + <xsl:when test="$lineType='double'">double</xsl:when> + <xsl:when test="$lineType='dash'">dash</xsl:when> + <xsl:when test="$lineType='long-dash'">dash-long</xsl:when> + <xsl:when test="$lineType='dot-dash'">dot-dash</xsl:when> + <xsl:when test="$lineType='dot-dot-dash'">dot-dot-dash</xsl:when> + <xsl:when test="$lineType='wave'">wave</xsl:when> + <xsl:when test="$lineType='bold-dotted'">dotted-heavy</xsl:when> + <xsl:when test="$lineType='bold-dash'">dashed-heavy</xsl:when> + <xsl:when test="$lineType='bold-long-dash'">dash-long-heavy</xsl:when> + <xsl:when test="$lineType='bold-dot-dash'">dash-dot-heavy</xsl:when> + <xsl:when test="$lineType='bold-dot-dot-dash'">dash-dot-dot-heavy</xsl:when> + <xsl:when test="$lineType='bold-wave'">wavy-heavy</xsl:when> + <xsl:when test="$lineType='double-wave'">wavy-double</xsl:when> + <xsl:when test="$lineType='bold'">bold</xsl:when> + <xsl:when test="$lineType='small-wave'">wave</xsl:when> + <xsl:when test="$lineType='dotted'">dotted</xsl:when> + <xsl:when test="$lineType='none'">none</xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl new file mode 100644 index 000000000..e8bb6fa79 --- /dev/null +++ b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl @@ -0,0 +1,6245 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + * 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="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/> + <xsl:variable name="scValueWithUnit"> + <xsl:value-of select="/office:document/office:automatic-styles/style:style[@style:name='co1']/style:table-column-properties/@style:column-width"/> + </xsl:variable> + <xsl:variable name="uofUnit"> + <xsl:choose> + <xsl:when test="contains($scValueWithUnit,'in')">inch</xsl:when> + <xsl:when test="contains($scValueWithUnit,'cm')">cm</xsl:when> + <xsl:when test="contains($scValueWithUnit,'mm')">mm</xsl:when> + <xsl:when test="contains($scValueWithUnit,'pt')">pt</xsl:when> + <xsl:otherwise>inch</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="ooUnit"> + <xsl:choose> + <xsl:when test="contains($scValueWithUnit,'inch')">inch</xsl:when> + <xsl:when test="contains($scValueWithUnit,'cm')">cm</xsl:when> + <xsl:when test="contains($scValueWithUnit,'mm')">mm</xsl:when> + <xsl:when test="contains($scValueWithUnit,'pt')">pt</xsl:when> + <xsl:otherwise>inch</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:template match="office:document"> + <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" uof:language="cn" uof:locID="u0000" uof:version="1.0" uof:mimetype="vnd.uof.spreadsheet"> + <xsl:apply-templates select="/office:document/office:meta"/> + <uof:对象集 uof:locID="u0033"> + <xsl:if test="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation"> + <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation"> + <xsl:variable name="num"> + <xsl:value-of select="substring-after(@draw:style-name,'gr')"/> + </xsl:variable> + <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象"> + <xsl:attribute name="图:标识符"><xsl:value-of select="concat('pz',$num)"/></xsl:attribute> + <xsl:variable name="name" select="@draw:style-name"/> + <图:预定义图形 uof:locID="g0005"> + <图:属性 uof:locID="g0011"> + <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name]"> + <xsl:call-template name="graphicattr"/> + </xsl:for-each> + <xsl:choose> + <xsl:when test="@svg:x1"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:x"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:width"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + </xsl:choose> + <图:旋转角度 uof:locID="g0025"> + <xsl:choose> + <xsl:when test="@draw:transform"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="@draw:transform"/> + </xsl:variable> + <xsl:variable name="rotate-temp"> + <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/> + </xsl:variable> + <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/> + </xsl:when> + <xsl:otherwise>0.0</xsl:otherwise> + </xsl:choose> + </图:旋转角度> + <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例> + <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例> + <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比> + <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例> + <图:打印对象 uof:locID="g0032">true</图:打印对象> + <图:Web文字 uof:locID="g0033"/> + </图:属性> + </图:预定义图形> + <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接"> + <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name]"> + <xsl:attribute name="图:文字排列方向"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="style:graphic-properties/@draw:textarea-horizontal-align"> + <xsl:attribute name="图:水平对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-horizontal-align"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:textarea-vertical-align"> + <xsl:attribute name="图:垂直对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-vertical-align"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@fo:wrap-option"> + <xsl:attribute name="图:自动换行">true</xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'"> + <xsl:attribute name="图:大小适应文字">true</xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="./text:p"> + <xsl:call-template name="textp"/> + </xsl:for-each> + </图:文本内容> + </图:图形> + </xsl:for-each> + </xsl:if> + <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation"> + <xsl:variable name="name1" select="@draw:style-name"/> + <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name1]"> + <xsl:if test="style:graphic-properties/@draw:fill-image-name"> + <xsl:variable name="bsh"> + <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/> + </xsl:variable> + <xsl:for-each select="/office:document/office:styles/draw:fill-image"> + <xsl:if test="@draw:name=$bsh"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($name1,'_b1')"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="office:binary-data"/> + </uof:数据> + </uof:其他对象> + </xsl:if> + </xsl:for-each> + </xsl:if> + </xsl:for-each> + </xsl:for-each> + <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table/table:shapes/child::* | /office:document/office:body/office:spreadsheet/table:table/table:table-row/table:table-cell/child::*"> + <xsl:if test="starts-with(name(.),'draw:')"> + <xsl:choose> + <xsl:when test="name(.)='draw:frame' and self::node()/draw:object"> + <xsl:for-each select="draw:image"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="office:binary-data"/> + </uof:数据> + </uof:其他对象> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="draw"> + <xsl:with-param name="nodename1" select="name(.)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:for-each> + </uof:对象集> + <xsl:if test="/office:document/office:body//text:bookmark-start"> + <uof:书签集 uof:locID="u0027"> + <xsl:for-each select="/office:document/office:body//text:bookmark-start"> + <xsl:element name="uof:书签"> + <xsl:attribute name="uof:名称"><xsl:value-of select="@text:name"/></xsl:attribute> + <xsl:attribute name="uof:locID">u0028</xsl:attribute> + <xsl:attribute name="uof:attrList">名称</xsl:attribute> + <xsl:element name="uof:文本位置"> + <xsl:attribute name="字:区域引用"><xsl:value-of select="concat('bk_',@text:name)"/></xsl:attribute> + <xsl:attribute name="uof:locID">u0029</xsl:attribute> + <xsl:attribute name="uof:attrList">区域引用</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:for-each> + </uof:书签集> + </xsl:if> + <xsl:if test="/office:document/office:body/text:p/text:a"> + <uof:链接集 uof:locID="u0031"> + <xsl:for-each select="/office:document/office:body/text:p/text:a"> + <!--chengxz 要改--> + <xsl:variable name="hyperStr" select="@xlink:href"/> + <xsl:element name="uof:超级链接"> + <xsl:if test="contains($hyperStr,'#')"> + <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute> + </xsl:if> + <!--暂时不写uof:提示--> + <xsl:attribute name="uof:链源">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute> + <xsl:if test="contains($hyperStr,'http://') or contains($hyperStr,'mailto')"> + <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="uof:locID">u0032</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 目标 书签 式样引用 已访问式样引用 提示 链源</xsl:attribute> + </xsl:element> + </xsl:for-each> + </uof:链接集> + </xsl:if> + <uof:式样集 uof:locID="u0039"> + <xsl:apply-templates select="/office:document/office:font-face-decls"/> + <xsl:apply-templates select="/office:document/office:styles/style:style" mode="styles"/> + <xsl:apply-templates select="/office:document/office:automatic-styles/style:style" mode="styles"> + <xsl:with-param name="isAutomatic" select="true()"/> + </xsl:apply-templates> + </uof:式样集> + <uof:电子表格 uof:locID="u0049"> + <表:公用处理规则 uof:locID="s0000"> + <表:度量单位 uof:locID="s0001"> + <xsl:value-of select="$uofUnit"/> + </表:度量单位> + <xsl:apply-templates select="/office:document/office:body/office:spreadsheet/table:calculation-settings" mode="common"/> + <xsl:apply-templates select="/office:document/office:body/office:spreadsheet/table:content-validations" mode="common"/> + <xsl:if test="/office:document/office:automatic-styles/style:style[@style:family='table-cell' and style:map]"> + <xsl:element name="表:条件格式化集"> + <xsl:attribute name="uof:locID">s0016</xsl:attribute> + <xsl:call-template name="create-condition-format"/> + </xsl:element> + </xsl:if> + <xsl:if test="/office:document/office:body/office:spreadsheet/table:database-ranges/table:database-range"> + <表:区域公式集 uof:locID="s0122"> + <表:区域公式 uof:locID="s0123" uof:attrList="类型"> + <xsl:attribute name="表:类型">table</xsl:attribute> + <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:database-ranges/table:database-range"> + <表:区域 uof:locID="s0007"> + <xsl:value-of select="@table:target-range-address"/> + </表:区域> + <表:公式 uof:locID="s0125"/> + </xsl:for-each> + </表:区域公式> + </表:区域公式集> + </xsl:if> + <表:是否RC引用 uof:locID="s0124" uof:attrList="值" 表:值="false"/> + </表:公用处理规则> + <表:主体 uof:locID="s0024"> + <xsl:apply-templates select="office:body"/> + </表:主体> + </uof:电子表格> + </uof:UOF> + </xsl:template> + <xsl:template match="office:body"> + <xsl:apply-templates select="office:spreadsheet"/> + </xsl:template> + <xsl:template match="office:spreadsheet"> + <xsl:apply-templates select="./*"/> + </xsl:template> + <xsl:template match="office:meta"> + <uof:元数据 uof:locID="u0001"> + <uof:标题 uof:locID="u0002"> + <xsl:value-of select="dc:title"/> + </uof:标题> + <uof:创建应用程序 uof:locID="u0011"> + <xsl:value-of select="meta:generator"/> + </uof:创建应用程序> + <uof:摘要 uof:locID="u0007"> + <xsl:value-of select="dc:description"/> + </uof:摘要> + <uof:主题 uof:locID="u0003"> + <xsl:value-of select="dc:subject"/> + </uof:主题> + <uof:创建者 uof:locID="u0004"/> + <uof:作者 uof:locID="u0005"> + <xsl:value-of select="meta:initial-creator"/> + </uof:作者> + <uof:创建日期 uof:locID="u0008"> + <xsl:value-of select="meta:creation-date"/> + </uof:创建日期> + <xsl:if test="dc:creator"> + <uof:最后作者 uof:locID="u0006"> + <xsl:value-of select="dc:creator"/> + </uof:最后作者> + </xsl:if> + <uof:关键字集 uof:locID="u0014"> + <uof:关键字 uof:locID="u0015"> + <xsl:value-of select="meta:keyword"/> + </uof:关键字> + </uof:关键字集> + <uof:编辑次数 uof:locID="u0009"> + <xsl:value-of select="meta:editing-cycles"/> + </uof:编辑次数> + <xsl:if test="meta:editing-duration"> + <uof:编辑时间 uof:locID="u0010"> + <xsl:value-of select="meta:editing-duration"/> + </uof:编辑时间> + </xsl:if> + <xsl:if test="meta:template/@xlink:href"> + <uof:文档模板 uof:locID="u0013"> + <xsl:value-of select="meta:template/@xlink:href"/> + </uof:文档模板> + </xsl:if> + <xsl:if test="meta:user-defined/@meta:name"> + <uof:用户自定义元数据集 uof:locID="u0016"> + <xsl:for-each select="meta:user-defined"> + <uof:用户自定义元数据 uof:locID="u0017" uof:attrList="名称 类型"> + <xsl:attribute name="uof:名称"><xsl:value-of select="@meta:name"/></xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute> + <xsl:value-of select="."/> + </uof:用户自定义元数据> + </xsl:for-each> + </uof:用户自定义元数据集> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:page-count"> + <uof:页数 uof:locID="u0020"> + <xsl:value-of select="meta:document-statistic/@meta:page-count"/> + </uof:页数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:paragraph-count"> + <uof:段落数 uof:locID="u0025"> + <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/> + </uof:段落数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:object-count"> + <uof:对象数 uof:locID="u0026"> + <xsl:value-of select="meta:document-statistic/@meta:object-count"/> + </uof:对象数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:character-count"> + <uof:字数 uof:locID="u0021"> + <xsl:value-of select="meta:document-statistic/@meta:character-count"/> + </uof:字数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:word-count"> + <uof:中文字符数 uof:locID="u0023"> + <xsl:value-of select="meta:document-statistic/@meta:word-count"/> + </uof:中文字符数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count"> + <uof:英文字符数 uof:locID="u0022"> + <xsl:value-of select="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count"/> + </uof:英文字符数> + </xsl:if> + <xsl:if test="meta:document-statistic/@meta:character-count"> + <uof:行数 uof:locID="u0024"> + <xsl:variable name="quzhi"> + <xsl:value-of select="(meta:document-statistic/@meta:character-count div 39) + 0.9"/> + </xsl:variable> + <xsl:value-of select="substring-before($quzhi,'.')"/> + </uof:行数> + </xsl:if> + <xsl:if test="meta:user-defined[@meta:name='Category']"> + <uof:分类 uof:locID="u0012"> + <xsl:value-of select="meta:user-defined[@meta:name='Category']"/> + </uof:分类> + </xsl:if> + <xsl:if test="meta:user-defined[@meta:name='Manager']"> + <uof:经理名称 uof:locID="u0019"> + <xsl:value-of select="meta:user-defined[meta:name='Manager']"/> + </uof:经理名称> + </xsl:if> + <xsl:if test="meta:user-defined[@meta:name='Company']"> + <uof:公司名称 uof:locID="u0018"> + <xsl:value-of select="meta:user-defined[meta:name='Company']"/> + </uof:公司名称> + </xsl:if> + </uof:元数据> + </xsl:template> + <xsl:template match="table:table"> + <xsl:element name="表:工作表"> + <xsl:attribute name="uof:locID">s0025</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 隐藏 背景 式样引用</xsl:attribute> + <xsl:attribute name="表:标识符"><xsl:value-of select="@table:name"/></xsl:attribute> + <xsl:attribute name="表:名称"><xsl:value-of select="@table:name"/></xsl:attribute> + <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:style-name='ta1'"><xsl:value-of select="'false'"/></xsl:when><xsl:otherwise><xsl:value-of select="'true'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:背景"><xsl:choose><xsl:when test="/office:document/office:automatic-styles/style:page-master/style:table-properties/@fo:background-color"><xsl:value-of select="/office:document/office:automatic-styles/style:page-master/style:table-properties/@fo:background-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:式样引用"><xsl:value-of select="@table:style-name"/></xsl:attribute> + <xsl:element name="表:工作表属性"> + <xsl:attribute name="uof:locID">s0026</xsl:attribute> + <表:标签前景色 uof:locID="s0027">#000000</表:标签前景色> + <表:标签背景色 uof:locID="s0028">#ffffff</表:标签背景色> + <xsl:call-template name="create-page-setting"> + <xsl:with-param name="master-page" select="/*/office:master-styles/style:master-page"/> + <xsl:with-param name="page-master-style" select="/*/office:automatic-styles/style:page-layout/style:page-layout-properties"/> + </xsl:call-template> + <xsl:call-template name="create-view"> + <xsl:with-param name="table-name" select="/*/office:body/office:spreadsheet/table:table/@table:name"/> + <xsl:with-param name="view-id" select="count(preceding-sibling::table:table) + 1"/> + <xsl:with-param name="aaa" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry"/> + </xsl:call-template> + </xsl:element> + <xsl:call-template name="table"/> + <xsl:variable name="filter" select="/*/office:body/office:spreadsheet/table:database-ranges/table:database-range"/> + <xsl:if test="$filter"> + <xsl:variable name="target-range-address" select="//table:database-range[table:filter]/@table:target-range-address"/> + <xsl:element name="表:筛选"> + <xsl:attribute name="uof:locID">s0101</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$filter/@table:display-filter-buttons">auto</xsl:when><xsl:otherwise>advance</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:element name="表:范围"> + <xsl:attribute name="uof:locID">s0102</xsl:attribute> + <xsl:value-of select="$filter/@table:target-range-address"/> + </xsl:element> + <xsl:variable name="column-and-row" select="substring-before(substring-after($target-range-address,'.'),':')"/> + <xsl:variable name="dd" select="number(substring($column-and-row,2,1))"/> + <xsl:variable name="zone-left-column-string"> + <xsl:choose> + <xsl:when test="contains($dd,'NaN') "> + <xsl:value-of select="substring($column-and-row,1,2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring($column-and-row,1,1)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="zone-left-column-num"> + <xsl:call-template name="translate-column-char-to-number"> + <xsl:with-param name="string" select="$zone-left-column-string"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="create-filter-conditions"> + <xsl:with-param name="filter-condition-set" select="$filter//table:filter-condition"/> + <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/> + </xsl:call-template> + <xsl:if test="$filter/@table:condition-source-range-address"> + <xsl:element name="表:条件区域"> + <xsl:attribute name="uof:locID">s0108</xsl:attribute> + <xsl:value-of select="$filter/@table:condition-source-range-address"/> + </xsl:element> + </xsl:if> + <xsl:if test="$filter/@table:display-duplicates"> + <xsl:element name="表:结果区域"> + <xsl:attribute name="uof:locID">s0109</xsl:attribute> + <xsl:value-of select="$filter/@table:display-duplicates"/> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="key('styles', .//@table:style-name)/style:table-row-properties/@fo:break-before = 'page' or key('styles',.//@table:style-name)/style:table-column-properties/@fo:break-before='page'"> + <xsl:element name="表:分页符集"> + <xsl:attribute name="uof:locID">s0111</xsl:attribute> + <xsl:call-template name="分页符集"/> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:param name="tableElement" select="'表:工作表内容'"/> + <xsl:param name="rowElement" select="'表:行'"/> + <!--xsl:param name="cellElement" select="'表:单元格'" /--> + <!-- ************** --> + <!-- *** Table *** --> + <!-- ************** --> + <xsl:template name="table"> + <!-- The table will only be created if the table:scenario is active --> + <xsl:if test="not(table:scenario) or table:scenario/@table:is-active"> + <xsl:call-template name="create-table"/> + </xsl:if> + </xsl:template> + <xsl:template name="create-table"> + <!-- collecting all visible "table:table-row" elements of the table --> + <xsl:variable name="allVisibleTableRows" select="table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')] | table:table-header-rows/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')] | table:table-row-group/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]"/> + <xsl:call-template name="create-table-element"> + <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="create-table-element"> + <xsl:param name="allVisibleTableRows"/> + <xsl:element name="表:工作表内容"> + <xsl:attribute name="uof:locID">s0018</xsl:attribute> + <xsl:attribute name="uof:attrList">最大行 最大列 缺省行高 缺省列宽</xsl:attribute> + <xsl:variable name="group-column" select="./table:table-column-group"/> + <xsl:variable name="group-row" select="./table:table-row-group"/> + <xsl:apply-templates select="@table:style-name"/> + <xsl:for-each select="table:table-column"> + <表:列 uof:locID="s0048" uof:attrList="列号 隐藏 列宽 式样引用 跨度"> + <xsl:attribute name="表:列号"><xsl:value-of select="position()"/></xsl:attribute> + <xsl:if test="@table:visibility"> + <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:visibility='collapse'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:attribute name="表:列宽"><xsl:value-of select="substring-before(key('styles',@table:style-name)/style:table-column-properties/@style:column-width,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:式样引用"><xsl:value-of select="@table:style-name"/></xsl:attribute> + <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="@table:number-columns-repeated"><xsl:value-of select="@table:number-columns-repeated"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute> + </表:列> + </xsl:for-each> + <xsl:variable name="columnNodes" select="table:table-column"/> + <xsl:variable name="columnsRepeated" select="table:table-column/@table:number-columns-repeated"/> + <xsl:variable name="columnCount"> + <xsl:choose> + <xsl:when test="$columnNodes[last()]/@table:number-columns-repeated > 99"> + <xsl:value-of select="count($columnNodes)+ number(sum($columnsRepeated))- count($columnsRepeated)- $columnNodes[last()]/@table:number-columns-repeated+ 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="count($columnNodes)+ number(sum($columnsRepeated))- count($columnsRepeated)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="table-name" select="@table:name"/> + <xsl:apply-templates select="table:table-row"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + </xsl:apply-templates> + <xsl:if test="table:table-row-group//table:table-row"> + <xsl:apply-templates select="table:table-row-group//table:table-row"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + </xsl:apply-templates> + </xsl:if> + <xsl:for-each select="table:shapes/child::*"> + <xsl:if test="starts-with(name(.),'draw:')"> + <xsl:choose> + <xsl:when test="name(.)='draw:frame' and self::node()/draw:object"> + <xsl:call-template name="draw:chart-frame"> + <xsl:with-param name="table-name" select="$table-name"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="uof锚点"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:for-each> + <xsl:if test="table:table-row-group or table:table-column-group"> + <xsl:element name="表:分组集"> + <xsl:attribute name="uof:locID">s0098</xsl:attribute> + <xsl:for-each select="table:table-column-group"> + <xsl:variable name="numcolumnrep" select="count(descendant::table:table-column[@table:number-columns-repeated])"/> + <xsl:variable name="numrep" select="sum(descendant::table:table-column/@table:number-columns-repeated)"/> + <xsl:variable name="numcolumn" select="count(descendant::table:table-column)"/> + <xsl:call-template name="table:table-column-group"> + <xsl:with-param name="start" select="count(preceding::table:table-column)"/> + <xsl:with-param name="end" select="count(preceding::table:table-column) + $numrep + $numcolumn - $numcolumnrep"/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="table:table-row-group"> + <xsl:variable name="numrowrep" select="count(descendant::table:table-row[@table:number-rows-repeated])"/> + <xsl:variable name="numrep" select="sum(descendant::table:table-row/@table:number-rows-repeated)"/> + <xsl:variable name="numrow" select="count(descendant::table:table-row)"/> + <xsl:call-template name="table:table-row-group"> + <xsl:with-param name="start" select="count(preceding::table:table-row)"/> + <xsl:with-param name="end" select="count(preceding::table:table-row) + $numrep + $numrow - $numrowrep"/> + </xsl:call-template> + </xsl:for-each> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="table:table-row-group"> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:element name="表:行"> + <xsl:attribute name="uof:locID">s0100</xsl:attribute> + <xsl:attribute name="uof:attrList">起始 终止 隐藏</xsl:attribute> + <xsl:attribute name="表:起始"><xsl:value-of select="$start + 1"/></xsl:attribute> + <xsl:attribute name="表:终止"><xsl:value-of select="$end"/></xsl:attribute> + <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:display"><xsl:value-of select="'true'"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:for-each select="table:table-row-group"> + <xsl:call-template name="table:table-row-group"> + <xsl:with-param name="start" select="count(preceding::table:table-row) + number(sum(preceding::table:table-row/@table:number-rows-repeated)) - count(preceding::table:table-row[@table:number-rows-repeated])"/> + <xsl:with-param name="end" select="count(preceding::table:table-row) + number(sum(preceding::table:table-row/@table:number-rows-repeated)) - count(preceding::table:table-row[@table:number-rows-repeated]) + number(sum(descendant::table:table-row/@table:number-rows-repeated)) + count(descendant::table:table-row) - count(descendant::table:table-row[@table:number-rows-repeated])"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="table:table-column-group"> + <xsl:param name="start"/> + <xsl:param name="end"/> + <xsl:element name="表:列"> + <xsl:attribute name="uof:locID">s0099</xsl:attribute> + <xsl:attribute name="uof:attrList">起始 终止 隐藏</xsl:attribute> + <xsl:attribute name="表:起始"><xsl:value-of select="$start + 1"/></xsl:attribute> + <xsl:attribute name="表:终止"><xsl:value-of select="$end"/></xsl:attribute> + <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:display"><xsl:value-of select="'true'"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:for-each select="table:table-column-group"> + <xsl:call-template name="table:table-column-group"> + <xsl:with-param name="start" select="count(preceding::table:table-column) + number(sum(preceding::table:table-column/@table:number-columns-repeated)) - count(preceding::table:table-column[@table:number-columns-repeated])"/> + <xsl:with-param name="end" select="count(preceding::table:table-column) + number(sum(preceding::table:table-column/@table:number-columns-repeated)) - count(preceding::table:table-column[@table:number-columns-repeated]) + number(sum(descendant::table:table-column/@table:number-columns-repeated)) + count(descendant::table:table-column) - count(descendant::table:table-column[@table:number-columns-repeated])"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="uof锚点"> + <xsl:if test="not(name(.)='draw:glue-point')"> + <xsl:variable name="name"> + <xsl:value-of select="name(.)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="name='draw:a'"> + <xsl:for-each select="child::node( )"> + <xsl:call-template name="uof锚点"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符"> + <xsl:attribute name="uof:x坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:y坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="@svg:width"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgx"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:width,$uofUnit))"/></xsl:variable><xsl:variable name="maxx"><xsl:call-template name="groupmaxx"><xsl:with-param name="value" select="$svgx + $width"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxx - $minx"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="@svg:height"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgy"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/></xsl:variable><xsl:variable name="height"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:height,$uofUnit))"/></xsl:variable><xsl:variable name="maxy"><xsl:call-template name="groupmaxy"><xsl:with-param name="value" select="$svgy + $height"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxy - $miny"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:variable name="refpicname"> + <xsl:choose> + <xsl:when test="./@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:when> + <xsl:when test="./@table:end-cell-address"> + <xsl:value-of select="@table:end-cell-address"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./@draw:id"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="uof:图形引用"><xsl:variable name="picnumber"><xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/></xsl:variable><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:attribute> + <xsl:attribute name="uof:随动方式"><xsl:choose><xsl:when test="key('graphicset',$refpicname)/style:graphic-properties/@style:protect"><xsl:for-each select="key('graphicset',$refpicname)/style:graphic-properties"><xsl:choose><xsl:when test="@style:protect='size'">move</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:for-each></xsl:when><xsl:otherwise>movesize</xsl:otherwise></xsl:choose></xsl:attribute> + </uof:锚点> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <!--end 06.02.14 --> + <!-- **************** --> + <!-- *** Columns *** --> + <!-- **************** --> + <!--Redoffice comment liliang 06.05.23--> + <!--xsl:template name="create-table-column"> + <xsl:param name="columnNodes"/> + <xsl:param name="currentColumn"/> + <xsl:param name="columnCount"/> + <xsl:param name="columnNo"/> + <xsl:param name="columnNodeNo"/> + <xsl:param name="index"/> + <xsl:element name="表:列"> + <xsl:attribute name="locID">s0048</xsl:attribute> + <xsl:attribute name="attrList">列号 隐藏 列宽 式样引用 跨度</xsl:attribute> + <xsl:if test="$currentColumn/@table:visibility = 'collapse' or $currentColumn/@table:visibility = 'filter'"> + <xsl:attribute name="表:隐藏">true</xsl:attribute> + </xsl:if> + <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="$currentColumn/@table:number-columns-repeated"><xsl:value-of select="$currentColumn/@table:number-columns-repeated - 1"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$index"> + <xsl:attribute name="表:列号"><xsl:value-of select="$columnNo"/></xsl:attribute> + </xsl:if--> + <!--自动列宽没有,暂略 autofitwidth--> + <!--Redoffice comment liliang 06.05.22--> + <!--xsl:variable name="width"> + <xsl:value-of select="key('styles', $currentColumn/@table:style-name)/style:properties/@style:column-width"/> + </xsl:variable--> + <!--end--> + <!--xsl:if test="$width"> + <xsl:attribute name="表:宽度"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$width"/></xsl:call-template></xsl:attribute> + </xsl:if> + <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="$currentColumn/@table:number-columns-repeated"><xsl:value-of select="$currentColumn/@table:number-columns-repeated - 1"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:if test="$columnNo < $columnCount"> + <xsl:choose> + <xsl:when test="@table:number-columns-repeated"> + <xsl:call-template name="create-table-column"> + <xsl:with-param name="columnNodes" select="$columnNodes"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="columnNo" select="$columnNo + $currentColumn/@table:number-columns-repeated"/> + <xsl:with-param name="columnNodeNo" select="$columnNodeNo + 1"/> + <xsl:with-param name="currentColumn" select="$columnNodes[$columnNodeNo + 1]"/> + <xsl:with-param name="index" select="true()"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create-table-column"> + <xsl:with-param name="columnNodes" select="$columnNodes"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="columnNo" select="$columnNo + 1"/> + <xsl:with-param name="columnNodeNo" select="$columnNodeNo + 1"/> + <xsl:with-param name="currentColumn" select="$columnNodes[$columnNodeNo + 1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template--> + <!-- ************* --> + <!-- *** Rows *** --> + <!-- ************* --> + <xsl:template match="table:table-row"> + <xsl:param name="table-name"/> + <xsl:param name="columnCount"/> + <xsl:choose> + <xsl:when test="@table:number-rows-repeated > 1"> + <xsl:choose> + <xsl:when test="(last() or (last() - 1)) and @table:number-rows-repeated > 99"> + <xsl:call-template name="write-table-row"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="lastRow" select="true()"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- In case a cell is being repeated, the cell will be created + in a variable, which is as many times given out, as being repeated --> + <xsl:variable name="tableRow"> + <xsl:call-template name="write-table-row"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="repeat-write-table-row"> + <xsl:with-param name="tableRow" select="$tableRow"/> + <xsl:with-param name="repetition" select="@table:number-rows-repeated"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="write-table-row"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="write-table-row"> + <xsl:param name="table-name"/> + <xsl:param name="columnCount"/> + <xsl:param name="lastRow"/> + <xsl:element name="表:行"> + <xsl:attribute name="uof:locID">s0049</xsl:attribute> + <xsl:attribute name="uof:attrList">行号 隐藏 行高 式样引用 跨度</xsl:attribute> + <xsl:if test="./table:table-cell/@office:value-type"> + <xsl:attribute name="表:行号"><xsl:value-of select="count(preceding::table:table-row[not(@table:number-rows-repeated)])+1+number(sum(preceding::table:table-row[@table:number-rows-repeated]/@table:number-rows-repeated))"/></xsl:attribute> + </xsl:if> + <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'"> + <xsl:attribute name="表:隐藏">true</xsl:attribute> + </xsl:if> + <!-- although valid, can not be opened with Excel - issue i31949) + <xsl:if test="$lastRow"> + <xsl:attribute name="ss:Span"><xsl:value-of select="@table:number-rows-repeated - 1" /></xsl:attribute> + </xsl:if>--> + <!-- writing the style of the row --> + <xsl:apply-templates select="@table:style-name"/> + <xsl:variable name="rowProperties" select="key('styles', @table:style-name)/*"/> + <!--xsl:if test="$rowProperties/@style:use-optimal-row-height = 'false'"> + <! - - default is '1', therefore write only '0' - -> + <xsl:attribute name="ss:AutoFitHeight">0</xsl:attribute> + </xsl:if--> + <xsl:variable name="height" select="$rowProperties/@style:row-height"/> + <xsl:if test="$height"> + <xsl:attribute name="表:行高"><!-- using the absolute height in point --><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$height"/></xsl:call-template></xsl:attribute> + </xsl:if> + <xsl:apply-templates select="table:table-cell"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + </xsl:apply-templates> + </xsl:element> + </xsl:template> + <xsl:template name="repeat-write-table-row"> + <xsl:param name="tableRow"/> + <xsl:param name="repetition"/> + <xsl:copy-of select="$tableRow"/> + <xsl:if test="$repetition > 1"> + <xsl:call-template name="repeat-write-table-row"> + <xsl:with-param name="tableRow" select="$tableRow"/> + <xsl:with-param name="repetition" select="$repetition - 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- ************** --> + <!-- *** Cells *** --> + <!-- ************** --> + <!-- Table cells are able to be repeated by attribute in StarOffice, + but not in Excel. If more cells are repeated + (e.g. for emulating background) only as many cells as columns are + allowed to be written out. --> + <xsl:template match="table:table-cell"> + <xsl:param name="table-name"/> + <xsl:param name="columnCount"/> + <!--xsl:choose> + <xsl:when test="@table:number-columns-repeated > 1"> + <xsl:variable name="tableCell"> + <xsl:call-template name="write-table-cell"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="not(following-sibling::table:table-cell)"> + <xsl:call-template name="repeat-write-table-cell"> + <xsl:with-param name="tableCell" select="$tableCell"/> + <xsl:with-param name="repetition" select="@table:number-columns-repeated"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="cellNo" select="position()+ sum(preceding-sibling::table:table-cell/@table:number-columns-repeated)- count(preceding-sibling::table:table-cell/@table:number-columns-repeated)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="repeat-write-table-cell"> + <xsl:with-param name="tableCell" select="$tableCell"/> + <xsl:with-param name="repetition" select="@table:number-columns-repeated"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="write-table-cell"/> + </xsl:otherwise> + </xsl:choose--> + <xsl:choose> + <xsl:when test="@table:number-columns-repeated"> + <xsl:call-template name="write-table-cell"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="repeat-table-cell-no" select="@table:number-columns-repeated"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="write-table-cell"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="repeat-table-cell-no" select="number(1)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--xsl:template name="repeat-write-table-cell"> + <xsl:param name="tableCell"/> + <xsl:param name="repetition"/> + <xsl:param name="columnCount"/> + <xsl:param name="cellNo"/> + <xsl:copy-of select="$tableCell"/> + <xsl:if test="$repetition > 1"> + <xsl:choose> + <xsl:when test="$cellNo"> + <xsl:if test="$cellNo < $columnCount"> + <xsl:call-template name="repeat-write-table-cell"> + <xsl:with-param name="tableCell" select="$tableCell"/> + <xsl:with-param name="repetition" select="$repetition - 1"/> + <xsl:with-param name="columnCount" select="$columnCount"/> + <xsl:with-param name="cellNo" select="$cellNo + 1"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="repeat-write-table-cell"> + <xsl:with-param name="tableCell" select="$tableCell"/> + <xsl:with-param name="repetition" select="$repetition - 1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template--> + <xsl:template name="write-table-cell"> + <xsl:param name="table-name"/> + <xsl:param name="repeat-table-cell-no"/> + <xsl:if test="$repeat-table-cell-no > 0"> + <表:单元格 uof:locID="s0050" uof:attrList="列号 式样引用 超链接引用 合并列数 合并行数"> + <xsl:if test="@table:number-columns-spanned > 1"> + <xsl:attribute name="表:合并列数"><xsl:value-of select="@table:number-columns-spanned - 1"/></xsl:attribute> + </xsl:if> + <xsl:if test="@table:number-rows-spanned > 1"> + <xsl:attribute name="表:合并行数"><xsl:value-of select="@table:number-rows-spanned - 1"/></xsl:attribute> + </xsl:if> + <xsl:variable name="link" select="descendant::text:a/@xlink:href"/> + <xsl:if test="$link"> + <xsl:attribute name="表:超链接引用"><xsl:value-of select="$link"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="@table:style-name"> + <xsl:apply-templates select="@table:style-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="ancestor::table:table/table:table-column/@table:default-cell-style-name"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="*"> + <xsl:if test="text:p"> + <xsl:variable name="valueType"> + <xsl:choose> + <xsl:when test="@office:value-type"> + <xsl:value-of select="@office:value-type"/> + </xsl:when> + <xsl:otherwise>string</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="表的数据"> + <xsl:with-param name="valueType" select="$valueType"/> + <xsl:with-param name="cellStyleName" select="@table:style-name"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="office:annotation"> + <xsl:element name="表:批注"> + <xsl:attribute name="uof:locID">s0053</xsl:attribute> + <xsl:attribute name="uof:attrList">是否显示</xsl:attribute> + <xsl:attribute name="表:是否显示"><xsl:choose><xsl:when test="office:annotation/@office:display = 'true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符"> + <xsl:variable name="num"> + <xsl:value-of select="substring-after(office:annotation/@draw:style-name,'gr')"/> + </xsl:variable> + <xsl:attribute name="uof:图形引用"><xsl:value-of select="concat('pz',$num)"/></xsl:attribute> + <xsl:attribute name="uof:x坐标"><xsl:value-of select="substring-before(office:annotation/@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:y坐标"><xsl:value-of select="substring-before(office:annotation/@svg:y,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(office:annotation/@svg:width,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(office:annotation/@svg:height,$uofUnit)"/></xsl:attribute> + </uof:锚点> + </xsl:element> + </xsl:if> + </xsl:when> + </xsl:choose> + <xsl:for-each select="child::*"> + <xsl:if test="starts-with(name(.),'draw:')"> + <xsl:choose> + <xsl:when test="name(.)='draw:frame' and self::node()/draw:object"> + <xsl:call-template name="draw:chart-frame"> + <xsl:with-param name="table-name" select="$table-name"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="uof锚点"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:for-each> + <xsl:if test="/office:document/office:body/office:spreadsheet/table:tracked-changes and not(self::node()/@table:style-name) and self::node()/text:p"> + <xsl:element name="表:数据"> + <xsl:attribute name="uof:locID">s0051</xsl:attribute> + <xsl:attribute name="uof:attrList">数据类型</xsl:attribute> + <xsl:element name="字:句"> + <xsl:attribute name="uof:locID">t0085</xsl:attribute> + <xsl:call-template name="table:tracked-changes"/> + </xsl:element> + </xsl:element> + </xsl:if> + </表:单元格> + <xsl:variable name="repeat-table-cell-no1"> + <xsl:value-of select="$repeat-table-cell-no - 1"/> + </xsl:variable> + <xsl:call-template name="write-table-cell"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="repeat-table-cell-no" select="$repeat-table-cell-no1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template match="office:annotation"/> + <xsl:template match="dc:date"/> + <xsl:template name="表的数据"> + <xsl:param name="valueType"/> + <xsl:param name="cellStyleName"/> + <xsl:choose> + <xsl:when test="descendant::*/@text:style-name"> + <xsl:choose> + <xsl:when test="$valueType = 'string'"> + <表:数据 表:数据类型="string" uof:locID="s0051" uof:attrList="数据类型"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName"/> + </xsl:apply-templates> + </表:数据> + </xsl:when> + <xsl:when test="$valueType = 'boolean'"> + <表:数据 表:数据类型="boolean" uof:locID="s0051" uof:attrList="数据类型"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName"/> + </xsl:apply-templates> + </表:数据> + </xsl:when> + <xsl:when test="$valueType = 'date'"> + <表:数据 表:数据类型="date" uof:locID="s0051" uof:attrList="数据类型"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName"/> + </xsl:apply-templates> + </表:数据> + </xsl:when> + <xsl:otherwise> + <表:数据 表:数据类型="number" uof:locID="s0051" uof:attrList="数据类型"> + <xsl:apply-templates> + <xsl:with-param name="cellStyleName" select="$cellStyleName"/> + </xsl:apply-templates> + </表:数据> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <表:数据 uof:locID="s0051" uof:attrList="数据类型"> + <xsl:choose> + <xsl:when test="$valueType = 'string'"> + <xsl:attribute name="表:数据类型">text</xsl:attribute> + <!--xsl:attribute name="表:数据数值"><xsl:value-of select="@office:string-value"/></xsl:attribute--> + <!--chengxz schema no this attr--> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="text:p"/> + </字:文本串> + </字:句> + </xsl:when> + <xsl:when test="$valueType = 'boolean'"> + <xsl:attribute name="表:数据类型">boolean</xsl:attribute> + <字:句 uof:locID="t0085"> + <xsl:choose> + <xsl:when test="@table:boolean-value = 'true'"> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath">true</字:文本串> + </xsl:when> + <xsl:otherwise> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath">false</字:文本串> + </xsl:otherwise> + </xsl:choose> + </字:句> + </xsl:when> + <xsl:when test="$valueType = 'date'"> + <xsl:attribute name="表:数据类型">date</xsl:attribute> + <xsl:attribute name="表:数据数值"><xsl:value-of select="@office:date-value"/></xsl:attribute> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="text:p"/> + </字:文本串> + </字:句> + </xsl:when> + <xsl:when test="$valueType = 'time'"> + <xsl:attribute name="表:数据类型">time</xsl:attribute> + <xsl:attribute name="表:数据数值"><xsl:value-of select="@office:time-value"/></xsl:attribute> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="text:p"/> + </字:文本串> + </字:句> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="表:数据类型">number</xsl:attribute> + <xsl:attribute name="表:数据数值"><xsl:value-of select="@office:value"/></xsl:attribute> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="text:p"/> + </字:文本串> + </字:句> + </xsl:otherwise> + </xsl:choose> + </表:数据> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="分页符集"> + <xsl:for-each select="table:table-row"> + <xsl:if test="key('styles', @table:style-name)/style:table-row-properties/@fo:break-before"> + <xsl:variable name="table-break-before"> + <xsl:value-of select="key('styles', @table:style-name)/style:table-row-properties/@fo:break-before"/> + </xsl:variable> + <xsl:if test="$table-break-before = 'page'"> + <xsl:element name="表:分页符"> + <xsl:attribute name="uof:locID">s0112</xsl:attribute> + <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute> + <xsl:if test="preceding-sibling::table:table-row/@table:number-rows-repeated"> + <xsl:attribute name="表:行号"><xsl:value-of select="sum(preceding-sibling::table:table-row/@table:number-rows-repeated)"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(preceding-sibling::table:table-row/@table:number-rows-repeated)"> + <xsl:attribute name="表:行号">1</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:if> + <xsl:if test="key('styles', @table:style-name)/style:table-row-properties/@fo:break-after"> + <xsl:variable name="table-break-after" select="key('styles', @table:style-name)/style:table-row-properties/@fo:break-after"/> + <xsl:if test="$table-break-after = 'page'"> + <xsl:element name="表:分页符"> + <xsl:attribute name="uof:locID">s0112</xsl:attribute> + <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute> + <xsl:if test="preceding-sibling::table:table-row/@table:number-rows-repeated"> + <xsl:attribute name="表:行号"><xsl:value-of select="sum(preceding-sibling::table:table-row/@table:number-rows-repeated)"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(preceding-sibling::table:table-row/@table:number-rows-repeated)"> + <xsl:attribute name="表:行号">1</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="table:table-column"> + <xsl:if test="key('styles', @table:style-name)/style:table-column-properties/@fo:break-before"> + <xsl:variable name="table-break-before" select="key('styles', @table:style-name)/style:table-column-properties/@fo:break-before"/> + <xsl:if test="$table-break-before = 'page'"> + <xsl:element name="表:分页符"> + <xsl:attribute name="uof:locID">s0112</xsl:attribute> + <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute> + <xsl:if test="preceding-sibling::table:table-column/@table:number-columns-repeated"> + <xsl:attribute name="表:列号"><xsl:value-of select="sum(preceding-sibling::table:table-column/@table:number-columns-repeated)"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(preceding-sibling::table:table-column/@table:number-columns-repeated)"> + <xsl:attribute name="表:列号">1</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:if> + <xsl:if test="key('styles', @table:style-name)/style:table-column-properties/@fo:break-after"> + <xsl:variable name="table-break-after" select="key('styles', @table:style-name)/style:table-column-properties/@fo:break-after"/> + <xsl:if test="$table-break-after = 'page'"> + <xsl:element name="表:分页符"> + <xsl:attribute name="uof:locID">s0112</xsl:attribute> + <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute> + <xsl:if test="preceding-sibling::table:table-column/@table:number-columns-repeated"> + <xsl:attribute name="表:列号"><xsl:value-of select="sum(preceding-sibling::table:table-column/@table:number-columns-repeated)"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(preceding-sibling::table:table-column/@table:number-columns-repeated)"> + <xsl:attribute name="表:列号">1</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template match="text:s"> + <xsl:call-template name="write-breakable-whitespace"> + <xsl:with-param name="whitespaces" select="@text:c"/> + </xsl:call-template> + </xsl:template> + <!--write the number of 'whitespaces' --> + <xsl:template name="write-breakable-whitespace"> + <xsl:param name="whitespaces"/> + <xsl:text> </xsl:text> + <xsl:if test="$whitespaces >= 1"> + <xsl:call-template name="write-breakable-whitespace"> + <xsl:with-param name="whitespaces" select="$whitespaces - 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- allowing all matched text nodes --> + <!--chengxz0630--> + <!--xsl:template match="text()"> + <字:句 uof:locID="t0085"> + <xsl:element name="字:文本串"> + <xsl:attribute name="locID">t0109</xsl:attribute> + + <xsl:value-of select="." /> + </xsl:element> + </字:句> + </xsl:template--> + <xsl:variable name="namespace-html" select="'http://www.w3.org/TR/REC-html40'"/> + <xsl:template match="@table:style-name | @table:default-cell-style-name"> + <xsl:attribute name="表:式样引用"><!--ss:styleID--><xsl:value-of select="."/><!--chengxz 060114--></xsl:attribute> + </xsl:template> + <xsl:template name="style-and-contents"> + <xsl:param name="cellStyleName"/> + <字:句 uof:locID="t0085"> + <xsl:element name="字:文本串"> + <!--chengxz0630--> + </xsl:element> + </字:句> + </xsl:template> + <!-- *************88--> + <xsl:param name="dpi" select="111"/> + <xsl:param name="centimeter-in-mm" select="10"/> + <xsl:param name="inch-in-mm" select="25.4"/> + <xsl:param name="didot-point-in-mm" select="0.376065"/> + <xsl:param name="pica-in-mm" select="4.2333333"/> + <xsl:param name="point-in-mm" select="0.3527778"/> + <xsl:param name="twip-in-mm" select="0.017636684"/> + <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/> + <!-- ***** MEASUREMENT CONVERSIONS ***** + PARAM 'value' + The measure to be converted. + The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...) + directly added to the number. + + PARAM 'rounding-factor' + Is used for the rounding of decimal places. + The parameter number is the product of 1 and some '10', where + every zero represents a decimal place. + + For example, providing as parameter: + <xsl:param name="rounding-factor" select="10000" /> + Gives by default four decimal places. + + To round two decimal places, basically the following is done: + <xsl:value-of select="round(100 * value) div 100"/> + + RETURN The converted number, by default rounded to four decimal places. + In case the input measure could not be matched the same value is + returned and a warning message is written out. + + + + MEASURE LIST: + * 1 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> + <xsl:template name="convert2px"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="contains($value, 'mm')"> + <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'cm')"> + <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'in')"> + <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'pt')"> + <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'dpt')"> + <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'pica')"> + <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'twip')"> + <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/> + </xsl:when> + <xsl:when test="contains($value, 'px')"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:otherwise> + <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:key match="draw:object/office:document/office:automatic-styles/style:style" name="chart-style-name" use="@style:name"/> + <xsl:template name="draw:chart-frame"> + <xsl:param name="table-name"/> + <表:图表 uof:locID="s0055" uof:attrList="类型 子类型 宽度 高度 x坐标 y坐标 随动方式"> + <xsl:variable name="plot-area"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@chart:style-name"/> + </xsl:variable> + <xsl:variable name="data-area"> + <xsl:value-of select="draw:object/@draw:notify-on-update-of-ranges"/> + </xsl:variable> + <xsl:variable name="series-generate"> + <xsl:for-each select="key('chart-style-name',$plot-area)"> + <xsl:choose> + <xsl:when test="style:chart-properties/@chart:series-source='columns'">col</xsl:when> + <xsl:otherwise>row</xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="表:图表"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + </xsl:call-template> + <表:图表区 uof:locID="s0056"> + <xsl:call-template name="表:图表区"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + </xsl:call-template> + </表:图表区> + <表:绘图区 uof:locID="s0060"> + <xsl:attribute name="表:宽度"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:width,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:高度"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:height,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:x坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:y坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:y,$uofUnit)"/></xsl:attribute> + <xsl:call-template name="表:绘图区"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + </xsl:call-template> + </表:绘图区> + <表:分类轴 uof:locID="s0061" uof:attrList="主刻度类型 次刻度类型 刻度线标志"> + <xsl:variable name="axis-style-name"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[child::chart:categories]/@chart:style-name"/> + </xsl:variable> + <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$axis-style-name]"> + <xsl:attribute name="表:主刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true' and style:chart-properties/@chart:tick-marks-major-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='false'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:次刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true' and style:chart-properties/@chart:tick-marks-minor-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:刻度线标志"><xsl:choose><xsl:when test="style:chart-properties/@chart:display-label='true'">next to axis</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:call-template name="表:坐标轴类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="axis-type" select="category-axis"/> + </xsl:call-template> + </xsl:for-each> + </表:分类轴> + <表:数值轴 uof:locID="s0082" uof:attrList="主刻度类型 次刻度类型 刻度线标志"> + <xsl:variable name="axis-style-name"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[child::chart:grid]/@chart:style-name"/> + </xsl:variable> + <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$axis-style-name]"> + <xsl:attribute name="表:主刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true' and style:chart-properties/@chart:tick-marks-major-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:次刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true' and style:chart-properties/@chart:tick-marks-minor-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:刻度线标志"><xsl:choose><xsl:when test="style:chart-properties/@chart:display-label='true'">next to axis</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:call-template name="表:坐标轴类型"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="axis-type" select="category-axis"/> + </xsl:call-template> + </xsl:for-each> + </表:数值轴> + <表:图例 uof:locID="s0083" uof:attrList="位置"> + <xsl:attribute name="表:位置"><xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@chart:legend-position"/></xsl:attribute> + <xsl:attribute name="表:x坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:y坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@svg:y,$uofUnit)"/></xsl:attribute> + <xsl:call-template name="表:图例"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + </xsl:call-template> + </表:图例> + <!--表:数据表 uof:locID="s0085"> + <xsl:call-template name="表:数据表"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + </xsl:call-template> + </表:数据表--> + <表:数据系列集 uof:locID="s0086"> + <xsl:variable name="data-series-path" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series"/> + <xsl:call-template name="表:数据系列"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="data-series-path" select="$data-series-path"/> + </xsl:call-template> + </表:数据系列集> + <!--0825 by lil --> + <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series"> + <表:数据点集 uof:locID="s0090"> + <xsl:variable name="data-series-path" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series"/> + <xsl:call-template name="表:数据点"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="data-series-path" select="$data-series-path"/> + </xsl:call-template> + </表:数据点集> + </xsl:if> + <!--end--> + <表:网格线集 uof:locID="s0092"> + <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x' and @chart:style-name]/chart:grid"> + <xsl:call-template name="表:网格线"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="grid-type" select="'category axis'"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/@chart:style-name"> + <xsl:call-template name="表:网格线"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="grid-type" select="'value axis'"/> + </xsl:call-template> + </xsl:if> + </表:网格线集> + <表:数据源 uof:locID="s0094" uof:attrList="数据区域 系列产生"> + <xsl:variable name="series-row-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring-before(substring(substring-after($data-area,'.'),2),':')"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="series-row-end"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after(substring-after($data-area,'.'),'.'),2)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="series-col-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after($data-area,'.'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="series-col-end"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="substring(substring-after(substring-after($data-area,'.'),'.'),1,1)"/> + <xsl:with-param name="output-type" select="'ARABIC'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="series-value-count"> + <xsl:choose> + <xsl:when test="$series-generate='col'"> + <xsl:value-of select="$series-col-end -$series-col-start +1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$series-row-end -$series-row-start +1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="表:数据区域"><xsl:value-of select="draw:object/@draw:notify-on-update-of-ranges"/></xsl:attribute> + <xsl:attribute name="表:系列产生"><xsl:choose><xsl:when test="contains($series-generate,'col')">col</xsl:when><xsl:when test="contains($series-generate,'row')">row</xsl:when></xsl:choose></xsl:attribute> + <xsl:call-template name="表:系列"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="series-row-start" select="$series-row-start"/> + <xsl:with-param name="series-row-end" select="$series-row-end"/> + <xsl:with-param name="series-col-start" select="$series-col-start"/> + <xsl:with-param name="series-col-end" select="$series-col-end"/> + <xsl:with-param name="series-value-current" select="'1'"/> + <xsl:with-param name="series-value-count" select="$series-value-count"/> + </xsl:call-template> + </表:数据源> + <表:标题集 uof:locID="s0096"> + <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:title"> + <xsl:call-template name="表:标题"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="caption-type" select="'chart'"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']"> + <xsl:call-template name="表:标题"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="caption-type" select="'category axis'"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']"> + <xsl:call-template name="表:标题"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="caption-type" select="'value axis'"/> + </xsl:call-template> + </xsl:if> + </表:标题集> + </表:图表> + </xsl:template> + <xsl:template name="表:图表"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:variable name="chart-class"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:class"/> + </xsl:variable> + <xsl:variable name="chart-area"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:style-name"/> + </xsl:variable> + <xsl:variable name="plot-area"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@chart:style-name"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$chart-class='chart:bar'"> + <xsl:variable name="chart-sub-class"> + <xsl:value-of select="key('chart-style-name',$plot-area)/style:chart-properties/@chart:vertical"/> + </xsl:variable> + <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$chart-sub-class='true'">bar</xsl:when><xsl:when test="$chart-sub-class='false'">column</xsl:when><xsl:otherwise/></xsl:choose></xsl:attribute> + <xsl:attribute name="表:子类型"><xsl:choose><xsl:when test="$chart-sub-class='true'"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">bar_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">bar_stacked</xsl:when><xsl:otherwise>bar_standard</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="$chart-sub-class='false'"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">column_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">column_stacked</xsl:when><xsl:otherwise>column_standard</xsl:otherwise></xsl:choose></xsl:when></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="$chart-class='chart:line'"> + <xsl:attribute name="表:类型">line</xsl:attribute> + <xsl:attribute name="表:子类型"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">line_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">line_stacked</xsl:when><xsl:otherwise>line_standard</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:when test="$chart-class='chart:circle'"> + <xsl:attribute name="表:类型">pie</xsl:attribute> + <xsl:variable name="data-point-end" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series[1]/chart:data-point"/> + <xsl:choose> + <xsl:when test="count($data-point-end) <=1"> + <xsl:attribute name="表:子类型">pie_standard</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="data-point-position-1"> + <xsl:for-each select="$data-point-end[position()=1]"> + <xsl:choose> + <xsl:when test="@chart:style-name"> + <xsl:for-each select="key('chart-style-name',@chart:style-name)"> + <xsl:choose> + <xsl:when test="style:chart-properties/@chart:pie-offset">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="$data-point-position-1='0'"> + <xsl:attribute name="表:子类型">pie_standard</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="$data-point-end[position()=2]"> + <xsl:choose> + <xsl:when test="@chart:style-name"> + <xsl:for-each select="key('chart-style-name',@chart:style-name)"> + <xsl:choose> + <xsl:when test="style:chart-properties/@chart:pie-offset"> + <xsl:attribute name="表:子类型">pie_offset2</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="表:子类型">pie_offset1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="表:子类型">pie_offset1</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$chart-class='chart:ring'"> + <xsl:attribute name="表:类型">pie</xsl:attribute> + <xsl:attribute name="表:子类型">pie_ring</xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:attribute name="表:宽度"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:高度"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="表:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute> + <xsl:choose> + <xsl:when test="@draw:style-name"> + <xsl:variable name="draw-style-name" select="@draw:style-name"/> + <xsl:for-each select="draw:object//office:document/office:automatic-styles/style:style[@style:name=$draw-style-name]"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:move-protect='true' and style:graphic-properties/@draw:size-protect='true'"> + <xsl:attribute name="表:随动方式">none</xsl:attribute> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:size-protect='true'"> + <xsl:attribute name="表:随动方式">move</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="表:随动方式">move and re-size</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="表:随动方式">move and re-size</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:图表区"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:variable name="chart-style-name" select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:style-name"/> + <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$chart-style-name]"> + <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影"> + <xsl:call-template name="表:边框"/> + </表:边框> + <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))"> + <表:填充 uof:locID="s0058"> + <xsl:call-template name="图:填充类型"/> + </表:填充> + </xsl:if> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"> + </xsl:call-template> + </表:字体> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:绘图区"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:variable name="plot-style-name" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:wall/@chart:style-name"/> + <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$plot-style-name]"> + <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影"> + <xsl:call-template name="表:边框"/> + </表:边框> + <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))"> + <表:填充 uof:locID="s0058"> + <xsl:call-template name="图:填充类型2"/> + </表:填充> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:图例"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:variable name="legend"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@chart:style-name"/> + </xsl:variable> + <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$legend]"> + <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影"> + <xsl:call-template name="表:边框"/> + </表:边框> + <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))"> + <表:填充 uof:locID="s0058"> + <xsl:call-template name="图:填充类型"/> + </表:填充> + </xsl:if> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"/> + </表:字体> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:图例项"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <表:图例项 uof:locID="s0084" uof:attrList="系列"> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"/> + </表:字体> + </表:图例项> + </xsl:template> + <xsl:template name="表:数据表"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))"> + <表:填充 uof:locID="s0058"> + <xsl:call-template name="图:填充类型"/> + </表:填充> + </xsl:if> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"/> + </表:字体> + </xsl:template> + <xsl:template name="表:数据系列"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:param name="data-series-path"/> + <xsl:for-each select="$data-series-path"> + <表:数据系列 uof:locID="s0087" uof:attrList="系列"> + <xsl:variable name="data-series-position"> + <xsl:value-of select="position()"/> + </xsl:variable> + <xsl:attribute name="表:系列"><xsl:value-of select="$data-series-position"/></xsl:attribute> + <xsl:variable name="data-series-point" select="@chart:style-name"/> + <xsl:call-template name="表:数据点类型"> + <xsl:with-param name="data-series-point" select="$data-series-point"/> + <xsl:with-param name="data-series-position" select="$data-series-position"/> + </xsl:call-template> + </表:数据系列> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:数据点"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:param name="data-series-path"/> + <xsl:for-each select="$data-series-path"> + <xsl:variable name="data-series-position" select="position()"/> + <xsl:for-each select="chart:data-point"> + <!--xsl:if test="@chart:style-name"--> + <xsl:variable name="data-point-position"> + <xsl:call-template name="count-chart-data-point"> + <xsl:with-param name="data-point-count" select="'1'"/> + <xsl:with-param name="data-point-position-temp" select="position() -1"/> + </xsl:call-template> + </xsl:variable> + <表:数据点 uof:locID="s0091" uof:attrList="系列 点"> + <xsl:attribute name="表:系列"><xsl:value-of select="$data-series-position"/></xsl:attribute> + <xsl:attribute name="表:点"><xsl:value-of select="$data-point-position"/></xsl:attribute> + <xsl:variable name="data-series-point" select="@chart:style-name"/> + <xsl:for-each select="../../../../../office:automatic-styles/style:style[@style:name=$data-series-point]"> + <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影"> + <xsl:call-template name="表:边框"/> + </表:边框> + <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))"> + <表:填充 uof:locID="s0058"> + <xsl:call-template name="图:填充类型"/> + </表:填充> + </xsl:if> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"/> + </表:字体> + <表:显示标志 uof:locID="s0088" uof:attrList="系列名 类别名 数值 百分数 分隔符 图例标志"> + <xsl:attribute name="表:系列名"/> + <xsl:attribute name="表:分隔符"/> + <xsl:if test="style:chart-properties/@chart:data-label-text"> + <xsl:attribute name="表:类别名"><xsl:value-of select="style:chart-properties/@chart:data-label-text"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:data-label-number"> + <xsl:choose> + <xsl:when test="style:chart-properties/@chart:data-label-number='value'"> + <xsl:attribute name="表:数值">true</xsl:attribute> + </xsl:when> + <xsl:when test="style:chart-properties/@chart:data-label-number='percentage'"> + <xsl:attribute name="表:百分数">true</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:data-label-symbol"> + <xsl:attribute name="表:图例标志"><xsl:value-of select="style:chart-properties/@chart:data-label-symbol"/></xsl:attribute> + </xsl:if> + </表:显示标志> + <表:系列名 uof:locID="s0089"> + <xsl:value-of select="concat('系列',$data-series-position)"/> + </表:系列名> + </xsl:for-each> + </表:数据点> + <!--/xsl:if--> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:网格线"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:param name="grid-type"/> + <xsl:if test="$grid-type='category axis'"> + <xsl:variable name="category-axis-grid"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/@chart:style-name"/> + </xsl:variable> + <xsl:for-each select="key('chart-style-name',$category-axis-grid)"> + <表:网格线 uof:locID="s0093" uof:attrList="类型 宽度 边距 颜色 阴影 位置"> + <xsl:call-template name="表:边框"/> + <xsl:attribute name="表:位置"><xsl:value-of select="$grid-type"/></xsl:attribute> + </表:网格线> + </xsl:for-each> + </xsl:if> + <xsl:if test="$grid-type='value axis'"> + <xsl:variable name="value-axis-grid"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/@chart:style-name"/> + </xsl:variable> + <xsl:for-each select="key('chart-style-name',$value-axis-grid)"> + <表:网格线 uof:locID="s0093" uof:attrList="类型 宽度 边距 颜色 阴影 位置"> + <xsl:call-template name="表:边框"/> + <xsl:attribute name="表:位置"><xsl:value-of select="$grid-type"/></xsl:attribute> + </表:网格线> + </xsl:for-each> + </xsl:if> + </xsl:template> + <xsl:template name="表:系列"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:param name="series-row-start"/> + <xsl:param name="series-row-end"/> + <xsl:param name="series-col-start"/> + <xsl:param name="series-col-end"/> + <xsl:param name="series-value-current"/> + <xsl:param name="series-value-count"/> + <xsl:choose> + <xsl:when test="$series-value-current>$series-value-count"/> + <xsl:otherwise> + <表:系列 uof:locID="s0095" uof:attrList="系列名 系列值 分类名"> + <xsl:attribute name="表:系列名"><xsl:value-of select="concat('系列',$series-value-current)"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$series-generate='col'"> + <xsl:variable name="series-col-letter-start"> + <xsl:call-template name="General-Char-Transition"> + <xsl:with-param name="input-char" select="$series-col-start +$series-value-current -1"/> + <xsl:with-param name="output-type" select="'CHARS_UPPER_LETTER'"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="表:系列值"><xsl:value-of select="concat($table-name,'!',$series-col-letter-start,$series-row-start,':',$series-col-letter-start,$series-row-end)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="series-col-letter-start"> + <xsl:value-of select="substring(substring-after($data-area,'.'),1,1)"/> + </xsl:variable> + <xsl:variable name="series-col-letter-end"> + <xsl:value-of select="substring(substring-after(substring-after($data-area,'.'),'.'),1,1)"/> + </xsl:variable> + <xsl:attribute name="表:系列值"><xsl:value-of select="concat($table-name,'!',$series-col-letter-start,$series-row-start +$series-value-current -1,':',$series-col-letter-end,$series-row-start +$series-value-current -1)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </表:系列> + <xsl:call-template name="表:系列"> + <xsl:with-param name="table-name" select="$table-name"/> + <xsl:with-param name="data-area" select="$data-area"/> + <xsl:with-param name="series-generate" select="$series-generate"/> + <xsl:with-param name="series-row-start" select="$series-row-start"/> + <xsl:with-param name="series-row-end" select="$series-row-end"/> + <xsl:with-param name="series-col-start" select="$series-col-start"/> + <xsl:with-param name="series-col-end" select="$series-col-end"/> + <xsl:with-param name="series-value-current" select="$series-value-current +1"/> + <xsl:with-param name="series-value-count" select="$series-value-count"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:标题"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:param name="caption-type"/> + <xsl:if test="$caption-type='chart'"> + <xsl:variable name="chart-title"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:title/@chart:style-name"/> + </xsl:variable> + <xsl:variable name="chart-title-name"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:title/text:p"/> + </xsl:variable> + <xsl:for-each select="key('chart-style-name',$chart-title)"> + <表:标题 uof:locID="s0097" uof:attrList="名称 位置"> + <xsl:attribute name="表:名称"><xsl:value-of select="$chart-title-name"/></xsl:attribute> + <xsl:attribute name="表:位置"><xsl:value-of select="$caption-type"/></xsl:attribute> + <xsl:call-template name="表:标题类型"/> + </表:标题> + </xsl:for-each> + </xsl:if> + <xsl:if test="$caption-type='category axis'"> + <xsl:variable name="category-axis-title"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/chart:title/@chart:style-name"/> + </xsl:variable> + <xsl:variable name="category-axis-title-name"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/chart:title/text:p"/> + </xsl:variable> + <xsl:for-each select="key('chart-style-name',$category-axis-title)"> + <表:标题 uof:locID="s0097" uof:attrList="名称 位置"> + <xsl:attribute name="表:名称"><xsl:value-of select="$category-axis-title-name"/></xsl:attribute> + <xsl:attribute name="表:位置"><xsl:value-of select="$caption-type"/></xsl:attribute> + <xsl:call-template name="表:标题类型"/> + </表:标题> + </xsl:for-each> + </xsl:if> + <xsl:if test="$caption-type='value axis'"> + <xsl:variable name="value-axis-title"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/chart:title/@chart:style-name"/> + </xsl:variable> + <xsl:variable name="value-axis-title-name"> + <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/chart:title/text:p"/> + </xsl:variable> + <xsl:for-each select="key('chart-style-name',$value-axis-title)"> + <表:标题 uof:locID="s0097" uof:attrList="名称 位置"> + <xsl:attribute name="表:名称"><xsl:value-of select="$value-axis-title-name"/></xsl:attribute> + <xsl:attribute name="表:位置"><xsl:value-of select="$caption-type"/></xsl:attribute> + <xsl:call-template name="表:标题类型"/> + </表:标题> + </xsl:for-each> + </xsl:if> + </xsl:template> + <xsl:template name="表:坐标轴类型"> + <xsl:param name="table-name"/> + <xsl:param name="data-area"/> + <xsl:param name="series-generate"/> + <xsl:param name="axis-type"/> + <表:线型 uof:locID="s0062" uof:attrList="类型 宽度 边距 颜色 阴影"> + <xsl:attribute name="uof:类型"><xsl:call-template name="表:线型"/></xsl:attribute> + </表:线型> + <表:数值 uof:locID="s0063" uof:attrList="链接到源 分类名称 格式码"> + <xsl:attribute name="表:链接到源"><xsl:choose><xsl:when test="style:chart-properties/@chart:link-data-style-to-source"><xsl:value-of select="style:chart-properties/@chart:link-data-style-to-source"/></xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="@style:data-style-name"> + <xsl:call-template name="Chart-NumberFormat"> + <xsl:with-param name="temp-style" select="@style:data-style-name"/> + </xsl:call-template> + </xsl:if> + </表:数值> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"/> + </表:字体> + <表:刻度 uof:locID="s0064"> + <xsl:call-template name="表:刻度类型"/> + </表:刻度> + <表:对齐 uof:locID="s0078"> + <xsl:if test="style:chart-properties/@style:direction"> + <xsl:element name="表:文字方向"> + <xsl:attribute name="uof:locID">s0079</xsl:attribute> + <xsl:choose> + <xsl:when test="style:chart-properties/@style:direction = 'ttb'">vertical</xsl:when> + <xsl:otherwise>horizontal</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="style:chart-properties/@text:rotation-angle"> + <表:旋转角度 uof:locID="s0080"> + <xsl:value-of select="style:chart-properties/@text:rotation-angle"/> + </表:旋转角度> + </xsl:if> + <表:偏移量 uof:locID="s0081"/> + </表:对齐> + </xsl:template> + <xsl:template name="Chart-NumberFormat"> + <xsl:param name="temp-style"/> + <xsl:for-each select="(preceding-sibling::*[@style:name=$temp-style]) | (following-sibling::*[@style:name=$temp-style])"> + <xsl:attribute name="表:分类名称"><xsl:choose><xsl:when test="name(.)='number:currency-style'">currency</xsl:when><xsl:when test="name(.)='number:percentage-style'">percentage</xsl:when><xsl:when test="name(.)='number:date-style'">date</xsl:when><xsl:when test="name(.)='number:time-style'">time</xsl:when><xsl:when test="name(.)='number:boolean-style'">custom</xsl:when><xsl:when test="name(.)='number:text-style'">text</xsl:when><xsl:when test="name(.)='number:number-style'"><xsl:choose><xsl:when test="number:fraction">fraction</xsl:when><xsl:when test="number:scientific-number">scientific</xsl:when><xsl:otherwise>number</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>general</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:格式码"><xsl:call-template name="element-attribute"/><xsl:for-each select="style:map"><xsl:text>[</xsl:text><xsl:value-of select="@style:condition"/><xsl:text>]</xsl:text><xsl:variable name="apply-style" select="@style:apply-style-name"/><xsl:for-each select="../../child::*[@style:name=$apply-style]/*"><xsl:call-template name="general-number-format"/></xsl:for-each><xsl:text>;</xsl:text></xsl:for-each><xsl:for-each select="*[not(name(.)='style:map')]"><xsl:call-template name="general-number-format"/></xsl:for-each></xsl:attribute> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:数据点类型"> + <xsl:param name="data-series-point"/> + <xsl:param name="data-series-position"/> + <xsl:for-each select="ancestor::draw:object/office:document/office:automatic-styles/style:style[@style:name=$data-series-point]"> + <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影"> + <xsl:call-template name="表:边框"/> + </表:边框> + <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))"> + <表:填充 uof:locID="s0058"> + <xsl:call-template name="图:填充类型"/> + </表:填充> + </xsl:if> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"/> + </表:字体> + <表:显示标志 uof:locID="s0088" uof:attrList="系列名 类别名 数值 百分数 分隔符 图例标志"> + <xsl:attribute name="表:系列名">true</xsl:attribute> + <xsl:if test="style:chart-properties/@chart:data-label-text"> + <xsl:attribute name="表:类别名"><xsl:value-of select="style:chart-properties/@chart:data-label-text"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:data-label-number"> + <xsl:choose> + <xsl:when test="style:chart-properties/@chart:data-label-number='value'"> + <xsl:attribute name="表:数值">true</xsl:attribute> + </xsl:when> + <xsl:when test="style:chart-properties/@chart:data-label-number='percentage'"> + <xsl:attribute name="表:百分数">true</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:data-label-symbol"> + <xsl:attribute name="表:图例标志"><xsl:value-of select="style:chart-properties/@chart:data-label-symbol"/></xsl:attribute> + </xsl:if> + </表:显示标志> + <表:系列名 uof:locID="s0089"> + <xsl:value-of select="concat('系列',$data-series-position)"/> + </表:系列名> + </xsl:for-each> + </xsl:template> + <xsl:template name="表:标题类型"> + <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影"> + <xsl:call-template name="表:边框"/> + </表:边框> + <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))"> + <表:填充 uof:locID="s0058"> + <xsl:call-template name="图:填充类型"/> + </表:填充> + </xsl:if> + <表:字体 uof:locID="s0059" uof:attrList="式样引用"> + <xsl:call-template name="字:句属性类型"/> + </表:字体> + <表:对齐 uof:locID="s0020"> + <xsl:call-template name="表:对齐格式类型"/> + </表:对齐> + </xsl:template> + <xsl:template name="count-chart-data-point"> + <xsl:param name="data-point-count"/> + <xsl:param name="data-point-position-temp"/> + <xsl:choose> + <xsl:when test="$data-point-position-temp=0"> + <xsl:value-of select="$data-point-count"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="temp"> + <xsl:for-each select="../chart:data-point[position()=$data-point-position-temp]"> + <xsl:choose> + <xsl:when test="@chart:repeated"> + <xsl:value-of select="@chart:repeated"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="count-chart-data-point"> + <xsl:with-param name="data-point-count" select="$data-point-count +$temp"/> + <xsl:with-param name="data-point-position-temp" select="$data-point-position-temp -1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:边框"> + <xsl:attribute name="uof:类型"><xsl:call-template name="表:线型"/></xsl:attribute> + <xsl:if test="style:graphic-properties/@svg:stroke-width"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@svg:stroke-color"> + <xsl:attribute name="uof:颜色"><xsl:value-of select="style:graphic-properties/@svg:stroke-color"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="uof:阴影">false</xsl:attribute> + </xsl:template> + <xsl:template name="图:填充类型"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:fill='gradient'"> + <xsl:variable name="gradient-name"> + <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/> + </xsl:variable> + <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]"> + <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型"> + <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute> + <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute> + <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute> + <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute> + <xsl:variable name="angle"> + <xsl:value-of select="@draw:angle div 10"/> + </xsl:variable> + <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0<$angle and $angle<25">0</xsl:when><xsl:when test="25<$angle and $angle<70">45</xsl:when><xsl:when test="70<$angle and $angle<115">90</xsl:when><xsl:when test="115<$angle and $angle<160">135</xsl:when><xsl:when test="160<$angle and $angle<205">180</xsl:when><xsl:when test="205<$angle and $angle<250">225</xsl:when><xsl:when test="250<$angle and $angle<295">270</xsl:when><xsl:when test="295<$angle and $angle<340">315</xsl:when><xsl:when test="340<$angle and $angle<360">360</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute> + <xsl:if test="@draw:cx"> + <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="@draw:cy"> + <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:类型">-2</xsl:attribute> + </图:渐变> + </xsl:for-each> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:fill-image-name"> + <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称"> + <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute> + <xsl:attribute name="图:类型">png</xsl:attribute> + <xsl:attribute name="图:名称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute> + </图:图片> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:fill='hatch'"> + <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色"> + <xsl:attribute name="图:类型"><xsl:value-of select="../../office:styles/draw:hatch/@draw:name"/></xsl:attribute> + <xsl:attribute name="图:图形引用">gr1</xsl:attribute> + <xsl:attribute name="图:前景色"><xsl:value-of select="../../office:styles/draw:hatch/@draw:color"/></xsl:attribute> + <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute> + </图:图案> + </xsl:when> + <xsl:otherwise> + <图:颜色 uof:locID="g0034"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:fill-color"> + <xsl:value-of select="style:graphic-properties/@draw:fill-color"/> + </xsl:when> + <xsl:otherwise>#99ccff</xsl:otherwise> + </xsl:choose> + </图:颜色> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="图:填充类型2"> + <xsl:if test="style:graphic-properties/@draw:fill-color"> + <图:颜色 uof:locID="g0034"> + <xsl:value-of select="style:graphic-properties/@draw:fill-color"/> + </图:颜色> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:fill-image-name"> + <xsl:variable name="chart-image-name" select="style:graphic-properties/@draw:fill-image-name"/> + <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称"> + <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:for-each select="../../office:styles/draw:fill-image[@draw:name=$chart-image-name]"> + <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute> + </xsl:for-each> + <xsl:attribute name="图:类型">png</xsl:attribute> + <xsl:attribute name="图:名称"><xsl:value-of select="$chart-image-name"/></xsl:attribute> + </图:图片> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:fill-hatch-name"> + <xsl:variable name="chart-hatch-name" select="style:graphic-properties/@draw:fill-hatch-name"/> + <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色"> + <xsl:for-each select="../../office:styles/draw:hatch[@draw:name=$chart-hatch-name]"> + <xsl:attribute name="图:类型"><xsl:value-of select="@draw:style"/></xsl:attribute> + <xsl:attribute name="图:前景色"><xsl:value-of select="@draw:color"/></xsl:attribute> + <xsl:attribute name="图:背景色"/> + <xsl:attribute name="图:距离"><xsl:value-of select="@draw:distance"/></xsl:attribute> + <xsl:attribute name="图:旋转度"><xsl:value-of select="@draw:rotation"/></xsl:attribute> + </xsl:for-each> + <xsl:attribute name="图:图形引用"><xsl:value-of select="$chart-hatch-name"/></xsl:attribute> + </图:图案> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:fill-gradient-name"> + <xsl:variable name="chart-gradient-name" select="style:graphic-properties/@draw:fill-gradient-name"/> + <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型"> + <xsl:for-each select="../../office:styles/draw:gradient[@draw:name=$chart-gradient-name]"> + <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute> + <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute> + <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute> + <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute> + <xsl:variable name="angle"> + <xsl:value-of select="@draw:angle div 10"/> + </xsl:variable> + <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0<$angle and $angle<25">0</xsl:when><xsl:when test="25<$angle and $angle<70">45</xsl:when><xsl:when test="70<$angle and $angle<115">90</xsl:when><xsl:when test="115<$angle and $angle<160">135</xsl:when><xsl:when test="160<$angle and $angle<205">180</xsl:when><xsl:when test="205<$angle and $angle<250">225</xsl:when><xsl:when test="250<$angle and $angle<295">270</xsl:when><xsl:when test="295<$angle and $angle<340">315</xsl:when><xsl:when test="340<$angle and $angle<360">360</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute> + <xsl:if test="@draw:cx"> + <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="@draw:cy"> + <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:类型">-2</xsl:attribute> + </xsl:for-each> + <xsl:attribute name="图:图形引用"><xsl:value-of select="$chart-gradient-name"/></xsl:attribute> + </图:渐变> + </xsl:if> + </xsl:template> + <xsl:template name="表:对齐格式类型"> + <xsl:if test="style:chart-properties/@style:rotation-angle"> + <表:文字旋转角度 uof:locID="s0080"> + <xsl:value-of select="style:chart-properties/@style:rotation-angle"/> + </表:文字旋转角度> + </xsl:if> + <xsl:if test="style:chart-properties/@fo:text-align"> + <xsl:element name="表:水平对齐方式"> + <xsl:attribute name="uof:locID">s0115</xsl:attribute> + <xsl:choose> + <xsl:when test="style:chart-properties/@fo:text-align = 'center'">center</xsl:when> + <xsl:when test="style:chart-properties/@fo:text-align = 'end'">right</xsl:when> + <xsl:when test="style:chart-properties/@fo:text-align = 'justify'">justify</xsl:when> + <xsl:when test="style:chart-properties/@fo:text-align = 'start'">left</xsl:when> + <xsl:otherwise>fill</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="(style:chart-properties/@style:vertical-align) or (style:chart-properties/@fo:vertical-align)"> + <xsl:element name="表:垂直对齐方式"> + <xsl:attribute name="uof:locID">s0116</xsl:attribute> + <xsl:choose> + <xsl:when test="style:chart-properties/@fo:vertical-align = 'top'">top</xsl:when> + <xsl:when test="style:chart-properties/@fo:vertical-align = 'middle'">center</xsl:when> + <xsl:when test="style:chart-properties/@fo:vertical-align = 'bottom'">bottom</xsl:when> + <xsl:when test="style:chart-properties/@fo:vertical-align = 'justify'">justify</xsl:when> + <xsl:otherwise>distributed</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:margin-left"> + <表:缩进 uof:locID="s0117"> + <xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-left,$uofUnit)"/> + </表:缩进> + </xsl:if> + <xsl:element name="表:文字方向"> + <xsl:attribute name="uof:locID">s0118</xsl:attribute> + <xsl:choose> + <xsl:when test="style:chart-properties/@style:direction = 'ttb'">vertical</xsl:when> + <xsl:otherwise>horizontal</xsl:otherwise> + </xsl:choose> + </xsl:element> + <表:自动换行 uof:locID="s0120" uof:attrList="值"> + <xsl:attribute name="表:值">true</xsl:attribute> + </表:自动换行> + <表:缩小字体填充 uof:locID="s0121" uof:attrList="值"> + <xsl:attribute name="表:值">true</xsl:attribute> + </表:缩小字体填充> + </xsl:template> + <xsl:template name="表:线型"> + <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/> + <xsl:variable name="stroke" select="style:graphic-properties/@draw:stroke"/> + <xsl:choose> + <xsl:when test="$stroke='solid'">single</xsl:when> + <xsl:when test="$stroke='none'">none</xsl:when> + <xsl:when test="$stroke='dash'"> + <xsl:choose> + <xsl:when test="$linetype='Ultrafine_20_Dashed'">dash</xsl:when> + <xsl:when test="$linetype='Fine_20_Dashed'">dashed-heavy</xsl:when> + <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'">dot-dash</xsl:when> + <xsl:when test="$linetype='Fine_20_Dotted'">dotted</xsl:when> + <xsl:when test="$linetype='Line_20_with_20_Fine_20_Dots'">dash-long-heavy</xsl:when> + <xsl:when test="$linetype='Fine_20_Dashed_20__28_var_29_'">dash-long</xsl:when> + <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_'">dash-dot-dot</xsl:when> + <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'">dotted-heavy</xsl:when> + <xsl:when test="$linetype='Line_20_Style_20_9'">thick</xsl:when> + <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash'">dot-dot-dash</xsl:when> + <xsl:when test="$linetype='Dashed_20__28_var_29_'">dash-dot-dot-heavy</xsl:when> + <xsl:when test="$linetype='Dash_20_10'">dash-dot-heavy</xsl:when> + <xsl:otherwise>single</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>single</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="表:刻度类型"> + <xsl:if test="style:chart-properties/@chart:minimum"> + <表:最小值 uof:locID="s0065"> + <xsl:value-of select="style:chart-properties/@chart:minimum"/> + </表:最小值> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:maximum"> + <表:最大值 uof:locID="s0066"> + <xsl:value-of select="style:chart-properties/@chart:maximum"/> + </表:最大值> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:interval-major"> + <表:主单位 uof:locID="s0067"> + <xsl:value-of select="style:chart-properties/@chart:interval-major"/> + </表:主单位> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:interval-minor"> + <表:次单位 uof:locID="s0068"> + <xsl:value-of select="style:chart-properties/@chart:interval-minor"/> + </表:次单位> + </xsl:if> + <xsl:if test="style:chart-properties/@chart:origin"> + <表:分类交叉点 uof:locID="s0069"> + <xsl:value-of select="style:chart-properties/@chart:origin"/> + </表:分类交叉点> + </xsl:if> + <表:单位 uof:locID="s0070">none</表:单位> + <表:显示单位 uof:locID="s0071" uof:attrList="值" 表:值="false"/> + <表:对数 uof:locID="s0072" uof:attrList="值" 表:值="false"/> + </xsl:template> + <xsl:template name="字:句属性类型"> + <xsl:element name="字:字体"> + <xsl:attribute name="uof:locID">t0088</xsl:attribute> + <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute> + <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size-complex"> + <xsl:choose> + <xsl:when test="contains(style:text-properties/@fo:font-size,'%') or contains(style:text-properties/@style:font-size-asian,'%')"> + <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'%')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-complex"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="style:text-properties/@fo:font-family"> + <xsl:attribute name="字:西文字体引用"><xsl:value-of select="style:text-properties/@fo:font-family"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@style:font-family-asian"> + <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-family-asian"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test="style:text-properties/@style:text-background-color and not(style:text-properties/@style:text-background-color='transparent')"> + <xsl:element name="字:填充"> + <xsl:element name="图:图案"> + <xsl:attribute name="uof:locID">g0036</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 图形引用 前景色 背景色</xsl:attribute> + <xsl:if test="style:text-properties/@style:text-background-color"> + <xsl:attribute name="图:前景色"><xsl:value-of select="style:text-properties/@style:text-background-color"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian"> + <xsl:element name="字:粗体"> + <xsl:attribute name="uof:locID">t0089</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian"> + <xsl:element name="字:斜体"> + <xsl:attribute name="uof:locID">t0090</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-line-through-style and not(style:text-properties/@style:text-line-through-style='none')"> + <xsl:element name="字:删除线"> + <xsl:attribute name="uof:locID">t0094</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-underline"> + <xsl:element name="字:下划线"> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0095</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:if test="style:text-properties/@style:text-underline-color"> + <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:text-shadow"> + <xsl:element name="字:阴影"> + <xsl:attribute name="uof:locID">t0100</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-emphasize"> + <xsl:element name="字:着重号"> + <xsl:attribute name="uof:locID">t0096</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute> + <xsl:choose> + <xsl:when test="style:text-properties/@style:text-emphasize='none'"> + <xsl:attribute name="字:字着重号">false</xsl:attribute> + <xsl:attribute name="字:类型">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:字着重号">true</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:着重号类型"><xsl:with-param name="te" select="style:text-properties/@style:text-emphasize"/></xsl:call-template></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="style:text-properties/@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@text:display"> + <xsl:element name="字:隐藏文字"> + <xsl:attribute name="uof:locID">t0097</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-outline"> + <xsl:element name="字:空心"> + <xsl:attribute name="uof:locID">t0098</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="style:text-properties/@style:text-outline"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:font-relief"> + <xsl:element name="字:浮雕"> + <xsl:attribute name="uof:locID">t0099</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant"> + <xsl:element name="字:醒目字体"> + <xsl:attribute name="uof:locID">t0101</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-position"> + <xsl:element name="字:位置"> + <xsl:attribute name="uof:locID">t0102</xsl:attribute> + <xsl:value-of select="style:text-properties/@style:text-position"/> + </xsl:element> + <字:上下标 uof:locID="t0205" uof:attrList="值"> + <xsl:attribute name="字:值">none</xsl:attribute> + </字:上下标> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-scale"> + <xsl:element name="字:缩放"> + <xsl:attribute name="uof:locID">t0103</xsl:attribute> + <xsl:value-of select="style:text-properties/@style:text-scale"/> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:letter-spacing"> + <xsl:element name="字:字符间距"> + <xsl:attribute name="uof:locID">t0104</xsl:attribute> + <xsl:value-of select="style:text-properties/@fo:letter-spacing"/> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:letter-kerning"> + <xsl:element name="字:调整字间距"> + <xsl:attribute name="uof:locID">t015</xsl:attribute> + <xsl:value-of select="style:text-properties/@style:letter-kerning"/> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="uof:着重号类型"> + <xsl:param name="te"/> + <xsl:choose> + <xsl:when test="$te='disc above' ">disc above</xsl:when> + <xsl:when test="$te='circle above' ">circle above</xsl:when> + <xsl:when test="$te='dot above' ">dot above</xsl:when> + <xsl:when test="$te='accent above' ">accent above</xsl:when> + <xsl:when test="$te='dot below' ">dot below</xsl:when> + <xsl:when test="$te='circle below' ">circle below</xsl:when> + <xsl:when test="$te='disc below' ">disc below</xsl:when> + <xsl:when test="$te='accent below' ">accent below</xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:线型类型"> + <xsl:variable name="spath" select="style:text-properties/@style:text-underline-style"/> + <xsl:variable name="wpath" select="style:text-properties/@style:text-underline-width"/> + <xsl:variable name="tpath" select="style:text-properties/@style:text-underline-type"/> + <xsl:choose> + <xsl:when test="$spath='solid' and not($tpath='double' ) and $wpath='auto' ">single</xsl:when> + <xsl:when test="$spath='solid' and $tpath='double' and $wpath='auto' ">double</xsl:when> + <xsl:when test="$spath='solid' and not($tpath='double' )and $wpath='bold' ">thick</xsl:when> + <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='auto' ">dotted</xsl:when> + <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='bold' ">dotted-heavy</xsl:when> + <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='auto' ">dash</xsl:when> + <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='bold' ">dashed-heavy</xsl:when> + <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='auto' ">dash-long</xsl:when> + <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='bold' ">dash-long-heavy</xsl:when> + <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dash</xsl:when> + <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-heavy</xsl:when> + <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dot-dash</xsl:when> + <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-dot-heavy</xsl:when> + <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='auto' ">wave</xsl:when> + <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='bold' ">wavy-heavy</xsl:when> + <xsl:when test="$spath='wave' and $tpath='double' and $wpath='auto' ">wavy-double</xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:delete线型类型"> + <xsl:variable name="wpath" select="style:text-properties/@style:text-line-through-width"/> + <xsl:variable name="textpath" select="style:text-properties/@style:text-line-through-text"/> + <xsl:variable name="umpath" select="style:text-properties/@style:text-underline-mode"/> + <xsl:variable name="tmpath" select="style:text-properties/@style:text-line-through-mode"/> + <xsl:variable name="tpath" select="style:text-properties/@style:text-line-through-type"/> + <xsl:choose> + <xsl:when test="$umpath='continuous' and $tmpath='continuous'">single</xsl:when> + <xsl:when test="$tpath='double'">double</xsl:when> + <xsl:when test="$wpath='bold'">bold</xsl:when> + <xsl:when test="$textpath='/'">带/</xsl:when> + <xsl:when test="$textpath='X'">带X</xsl:when> + <xsl:otherwise>none</xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--comment: if input char is Roman,please add a prefix 'Roman_'--> + <xsl:template name="General-Char-Transition"> + <xsl:param name="input-char"/> + <xsl:param name="output-type"/> + <xsl:choose> + <xsl:when test="$input-char='A' or $input-char='a' or $input-char='1' or $input-char='Roman_I' or $input-char='Roman_i' or $input-char='一' or $input-char='壹' or $input-char='甲' or $input-char='子'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">1</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">甲</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">子</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='B' or $input-char='b' or $input-char='2' or $input-char='Roman_II' or $input-char='Roman_ii' or $input-char='二' or $input-char='贰' or $input-char='乙' or $input-char='丑'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">2</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">b</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">B</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">II</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">ii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">2</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">2</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">2</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">乙</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">丑</xsl:when> + <xsl:otherwise>2</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='C' or $input-char='c' or $input-char='3' or $input-char='Roman_III' or $input-char='Roman_iii' or $input-char='三' or $input-char='叁' or $input-char='丙' or $input-char='寅'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">3</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">c</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">C</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">III</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">iii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">3</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">三</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">3</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">叁</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">3</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">丙</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">寅</xsl:when> + <xsl:otherwise>3</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='D' or $input-char='d' or $input-char='4' or $input-char='Roman_IV' or $input-char='Roman_iv' or $input-char='四' or $input-char='肆' or $input-char='丁' or $input-char='卯'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">4</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">d</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">D</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">IV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">iv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">4</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">四</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">4</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">肆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">4</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">丁</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">卯</xsl:when> + <xsl:otherwise>4</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='E' or $input-char='e' or $input-char='5' or $input-char='Roman_V' or $input-char='Roman_v' or $input-char='五' or $input-char='伍' or $input-char='戊' or $input-char='辰'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">5</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">e</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">E</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">V</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">v</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">5</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">五</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">5</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">伍</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">5</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">戊</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">辰</xsl:when> + <xsl:otherwise>5</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='F' or $input-char='f' or $input-char='6' or $input-char='Roman_VI' or $input-char='Roman_vi' or $input-char='六' or $input-char='陆' or $input-char='己' or $input-char='巳'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">6</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">f</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">F</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">VI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">vi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">6</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">六</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">6</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">陆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">6</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">己</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">巳</xsl:when> + <xsl:otherwise>6</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='G' or $input-char='g' or $input-char='7' or $input-char='Roman_VII' or $input-char='Roman_vii' or $input-char='七' or $input-char='柒' or $input-char='庚' or $input-char='午'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">7</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">g</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">G</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">VII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">vii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">7</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">七</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">7</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">柒</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">7</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">庚</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">午</xsl:when> + <xsl:otherwise>7</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='H' or $input-char='h' or $input-char='8' or $input-char='Roman_VIII' or $input-char='Roman_viii' or $input-char='八' or $input-char='捌' or $input-char='辛' or $input-char='未'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">8</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">h</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">H</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">VIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">viii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">8</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">八</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">8</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">捌</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">8</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">辛</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">未</xsl:when> + <xsl:otherwise>8</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='I' or $input-char='i' or $input-char='9' or $input-char='Roman_IX' or $input-char='Roman_ix' or $input-char='九' or $input-char='玖' or $input-char='壬' or $input-char='申'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">9</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">i</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">I</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">IX</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">ix</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">9</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">九</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">9</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">玖</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">9</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">壬</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">申</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='J' or $input-char='j' or $input-char='10' or $input-char='Roman_X' or $input-char='Roman_x' or $input-char='十' or $input-char='拾' or $input-char='癸' or $input-char='酉'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">10</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">j</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">J</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">X</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">x</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">10</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">10</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">10</xsl:when> + <xsl:when test="$output-type='TIAN_GAN_ZH'">癸</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">酉</xsl:when> + <xsl:otherwise>10</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='K' or $input-char='k' or $input-char='11' or $input-char='Roman_XI' or $input-char='Roman_xi' or $input-char='十一' or $input-char='拾壹' or $input-char='戌'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">11</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">k</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">K</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">11</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">11</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">11</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">戌</xsl:when> + <xsl:otherwise>11</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='L' or $input-char='l' or $input-char='12' or $input-char='Roman_XII' or $input-char='Roman_xii' or $input-char='十二' or $input-char='拾贰' or $input-char='亥'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">12</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">l</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">L</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">12</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十二</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">12</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾贰</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">12</xsl:when> + <xsl:when test="$output-type='DI_ZI_ZH'">亥</xsl:when> + <xsl:otherwise>12</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='M' or $input-char='m' or $input-char='13' or $input-char='Roman_XIII' or $input-char='Roman_xiii' or $input-char='十三' or $input-char='拾叁'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">13</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">m</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">M</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xiii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">13</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十三</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">13</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾叁</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">13</xsl:when> + <xsl:otherwise>13</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='N' or $input-char='n' or $input-char='14' or $input-char='Roman_XIV' or $input-char='Roman_xiv' or $input-char='十四' or $input-char='拾肆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">14</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">n</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">N</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XIV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xiv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">14</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十四</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">14</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾肆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">14</xsl:when> + <xsl:otherwise>14</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='O' or $input-char='o' or $input-char='15' or $input-char='Roman_XV' or $input-char='Roman_xv' or $input-char='十五' or $input-char='拾伍'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">15</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">o</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">O</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">15</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十五</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">15</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾伍</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">15</xsl:when> + <xsl:otherwise>15</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='P' or $input-char='p' or $input-char='16' or $input-char='Roman_XVI' or $input-char='Roman_xvi' or $input-char='十六' or $input-char='拾陆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">16</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">p</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">P</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XVI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xvi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">16</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十六</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">16</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾陆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">16</xsl:when> + <xsl:otherwise>16</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='Q' or $input-char='q' or $input-char='17' or $input-char='Roman_XVII' or $input-char='Roman_xvii' or $input-char='十七' or $input-char='拾柒'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">17</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">q</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Q</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XVII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xvii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">17</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十七</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">17</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾柒</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">17</xsl:when> + <xsl:otherwise>17</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='R' or $input-char='r' or $input-char='18' or $input-char='Roman_XVIII' or $input-char='Roman_xviii' or $input-char='十八' or $input-char='拾捌'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">18</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">r</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">R</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XVIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xviii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">18</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十八</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">18</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾捌</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">18</xsl:when> + <xsl:otherwise>18</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='S' or $input-char='s' or $input-char='19' or $input-char='Roman_XIX' or $input-char='Roman_xix' or $input-char='十九' or $input-char='拾玖'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">19</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">s</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">S</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XIX</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xix</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">19</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十九</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">19</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾玖</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">19</xsl:when> + <xsl:otherwise>19</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='T' or $input-char='t' or $input-char='20' or $input-char='Roman_XX' or $input-char='Roman_xx' or $input-char='二十' or $input-char='贰拾'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">20</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">t</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">T</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XX</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xx</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">20</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">20</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">20</xsl:when> + <xsl:otherwise>20</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='U' or $input-char='u' or $input-char='21' or $input-char='Roman_XXI' or $input-char='Roman_xxi' or $input-char='二十一' or $input-char='贰拾壹'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">21</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">u</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">U</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">21</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">21</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">21</xsl:when> + <xsl:otherwise>21</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='V' or $input-char='v' or $input-char='22' or $input-char='Roman_XXII' or $input-char='Roman_xxii' or $input-char='二十二' or $input-char='贰拾贰'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">22</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">v</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">V</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">22</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十二</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">22</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾贰</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">22</xsl:when> + <xsl:otherwise>22</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='W' or $input-char='w' or $input-char='23' or $input-char='Roman_XXIII' or $input-char='Roman_xxiii' or $input-char='二十三' or $input-char='贰拾叁'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">23</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">w</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">W</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXIII</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxiii</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">23</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十三</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">23</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾叁</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">23</xsl:when> + <xsl:otherwise>23</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='X' or $input-char='x' or $input-char='24' or $input-char='Roman_XXIV' or $input-char='Roman_xxiv' or $input-char='二十四' or $input-char='贰拾肆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">24</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">x</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">X</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXIV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxiv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">24</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十四</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">24</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾肆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">24</xsl:when> + <xsl:otherwise>24</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='Y' or $input-char='y' or $input-char='25' or $input-char='Roman_XXV' or $input-char='Roman_xxv' or $input-char='二十五' or $input-char='贰拾伍'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">25</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">y</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Y</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXV</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxv</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">25</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十五</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">25</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾伍</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">25</xsl:when> + <xsl:otherwise>25</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$input-char='Z' or $input-char='z' or $input-char='26' or $input-char='Roman_XXVI' or $input-char='Roman_xxvi' or $input-char='二十六' or $input-char='贰拾陆'"> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">26</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">z</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Z</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">XXVI</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">xxvi</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">26</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十六</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">26</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾陆</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">26</xsl:when> + <xsl:otherwise>26</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$output-type='ARABIC'">1</xsl:when> + <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when> + <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when> + <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when> + <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when> + <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when> + <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when> + <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--RedOffice comment (Zengjh) end charts--> + <!-- 以下模板的作用是将网格线的R或者G或者B颜色从十进制转换为16进制--> + <xsl:template name="transform-decimal-to-hexadecimal"> + <xsl:param name="color-decimal"/> + <xsl:variable name="first-number" select="floor($color-decimal div 16)"/> + <xsl:variable name="first-char"> + <xsl:call-template name="decimal-to-hex"> + <xsl:with-param name="number" select="$first-number"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="second-number" select="$color-decimal - ($first-number * 16)"/> + <xsl:variable name="second-char"> + <xsl:call-template name="decimal-to-hex"> + <xsl:with-param name="number" select="$second-number"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat($first-char,$second-char)"/> + </xsl:template> + <!-- 以下模板的作用为将0到15的整数转换为16进制数--> + <xsl:template name="decimal-to-hex"> + <xsl:param name="number"/> + <xsl:choose> + <xsl:when test="$number=0">0</xsl:when> + <xsl:when test="$number=1">1</xsl:when> + <xsl:when test="$number=2">2</xsl:when> + <xsl:when test="$number=3">3</xsl:when> + <xsl:when test="$number=4">4</xsl:when> + <xsl:when test="$number=5">5</xsl:when> + <xsl:when test="$number=6">6</xsl:when> + <xsl:when test="$number=7">7</xsl:when> + <xsl:when test="$number=8">8</xsl:when> + <xsl:when test="$number=9">9</xsl:when> + <xsl:when test="$number=10">a</xsl:when> + <xsl:when test="$number=11">b</xsl:when> + <xsl:when test="$number=12">c</xsl:when> + <xsl:when test="$number=13">d</xsl:when> + <xsl:when test="$number=14">e</xsl:when> + <xsl:when test="$number='15'">f</xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="setDefaultPageWidth"> + <xsl:choose> + <xsl:when test="$uofUnit='inch'"> + <xsl:value-of select="'7.9'"/> + </xsl:when> + <xsl:when test="$uofUnit='cm'"> + <xsl:value-of select="'20.999'"/> + </xsl:when> + <xsl:when test="$uofUnit='mm'"> + <xsl:value-of select="'200.99'"/> + </xsl:when> + <xsl:when test="$uofUnit='pt'"> + <xsl:value-of select="'7870'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'20.990'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="setDefaultPageHeight"> + <xsl:choose> + <xsl:when test="$uofUnit='inch'"> + <xsl:value-of select="'10.14'"/> + </xsl:when> + <xsl:when test="$uofUnit='cm'"> + <xsl:value-of select="'26.999'"/> + </xsl:when> + <xsl:when test="$uofUnit='mm'"> + <xsl:value-of select="'269.99'"/> + </xsl:when> + <xsl:when test="$uofUnit='pt'"> + <xsl:value-of select="'1023'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'26.990'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--ro000179 chenjh--> + <xsl:template name="create-condition-format"> + <xsl:variable name="unique-map-cellstyle" select="/office:document/office:automatic-styles/style:style[style:map and not(style:map/@style:condition=preceding-sibling::style:style/style:map/@style:condition and style:map/@style:apply-style-name=preceding-sibling::style:style/style:map/@style:apply-style-name and style:map/@style:base-cell-address=preceding-sibling::style:style/style:map/@style:base-cell-address)]"/> + <xsl:for-each select="$unique-map-cellstyle"> + <xsl:call-template name="create-cell-condition-format"/> + </xsl:for-each> + </xsl:template> + <xsl:template name="create-cell-condition-format"> + <xsl:element name="表:条件格式化"> + <xsl:attribute name="uof:locID">s0017</xsl:attribute> + <xsl:element name="表:区域"> + <xsl:attribute name="uof:locID">s0007</xsl:attribute> + <xsl:variable name="cellstylenamelist"> + <xsl:call-template name="createcellnamelist"> + <xsl:with-param name="list"> + <xsl:value-of select="/office:document/office:automatic-styles/style:style[style:map and (style:map/@style:condition=current()/style:map/@style:condition and style:map/@style:apply-style-name=current()/style:map/@style:apply-style-name and style:map/@style:base-cell-address=current()/style:map/@style:base-cell-address)]"/> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + <!-- <xsl:value-of select="concat($cellstylenamelist,'end')"/>--> + <xsl:variable name="left-top"> + <xsl:call-template name="search-left-top"> + <xsl:with-param name="cellstylenamelist" select="$cellstylenamelist"/> + </xsl:call-template> + </xsl:variable> + <!-- <xsl:value-of select="concat('qqqqqqqq ',$left-top)"/> --> + <xsl:variable name="after-translated-left-top"> + <xsl:call-template name="translate-left-top-condition"> + <xsl:with-param name="left-top" select="$left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat($after-translated-left-top,':',style:map/@style:base-cell-address)"/> + </xsl:element> + <xsl:for-each select="style:map"> + <xsl:element name="表:条件"> + <xsl:attribute name="uof:locID">s0019</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:variable name="conditiontext" select="@style:condition"/> + <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="contains($conditiontext,'cell-content')">cell value</xsl:when><xsl:when test="contains($conditiontext,'is-true-formula')">formula</xsl:when><xsl:otherwise>条件字符串错误!</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:element name="表:操作码"> + <xsl:attribute name="uof:locID">s0009</xsl:attribute> + <xsl:choose> + <xsl:when test="starts-with($conditiontext,'is-true-formula')">equal to</xsl:when> + <xsl:when test="starts-with($conditiontext,'cell-content()')"> + <xsl:variable name="operatortext" select="substring-after($conditiontext,'cell-content()')"/> + <xsl:choose> + <xsl:when test="starts-with($operatortext,'<=')">less than or equal to</xsl:when> + <xsl:when test="starts-with($operatortext,'>=')">greater than or equal to</xsl:when> + <xsl:when test="starts-with($operatortext,'<')">less than</xsl:when> + <xsl:when test="starts-with($operatortext,'>')">greater than</xsl:when> + <xsl:when test="starts-with($operatortext,'!=')">not equal to</xsl:when> + <xsl:when test="starts-with($operatortext,'=')">equal to</xsl:when> + <!-- 注意:uof有的另几种操作码在oo中没有,他们是contain,not contain,start with,not start with, end with,not end with--> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'cell-content-is-between')">between</xsl:when> + <xsl:when test="starts-with($conditiontext,'cell-content-is-not-between')">not between</xsl:when> + </xsl:choose> + </xsl:element> + <xsl:element name="表:第一操作数"> + <xsl:attribute name="uof:locID">s0010</xsl:attribute> + <xsl:choose> + <xsl:when test="starts-with($conditiontext,'is-true-formula')"> + <xsl:value-of select="substring(substring-after($conditiontext,'is-true-formula('),1,string-length($conditiontext)-1-string-length('is-true-formula('))"/> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'cell-content-is-between')"> + <xsl:value-of select="substring-before(substring-after($conditiontext,'cell-content-is-between('),',')"/> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'cell-content-is-not-between')"> + <xsl:value-of select="substring-before(substring-after($conditiontext,'cell-content-is-not-between('),',')"/> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'cell-content()')"> + <xsl:variable name="operatortext" select="substring-after($conditiontext,'cell-content()')"/> + <xsl:choose> + <xsl:when test="starts-with($operatortext,'<=')"> + <xsl:value-of select="substring-after($conditiontext,'<=')"/> + </xsl:when> + <xsl:when test="starts-with($operatortext,'>=')"> + <xsl:value-of select="substring-after($conditiontext,'>=')"/> + </xsl:when> + <xsl:when test="starts-with($operatortext,'<')"> + <xsl:value-of select="substring-after($conditiontext,'<')"/> + </xsl:when> + <xsl:when test="starts-with($operatortext,'>')"> + <xsl:value-of select="substring-after($conditiontext,'>')"/> + </xsl:when> + <xsl:when test="starts-with($operatortext,'!=')"> + <xsl:value-of select="substring-after($conditiontext,'!=')"/> + </xsl:when> + <xsl:when test="starts-with($operatortext,'=')"> + <xsl:value-of select="substring-after($conditiontext,'=')"/> + </xsl:when> + <!-- 注意:uof有的另几种操作码在oo中没有,他们是contain,not contain,start with,not start with, end with,not end with--> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:if test="starts-with($conditiontext,'cell-content-is-between') or starts-with($conditiontext,'cell-content-is-not-between')"> + <xsl:element name="表:第二操作数"> + <xsl:attribute name="uof:locID">s0011</xsl:attribute> + <xsl:value-of select="substring(substring-after($conditiontext,','),1,string-length(substring-after($conditiontext,','))-1)"/> + </xsl:element> + </xsl:if> + <xsl:element name="表:格式"> + <xsl:variable name="apply-style-name" select="@style:apply-style-name"/> + <xsl:attribute name="uof:locID">s0023</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="表:式样引用"><xsl:value-of select="$apply-style-name"/></xsl:attribute> + <!--xsl:attribute name="表:式样引用"><xsl:value-of select="generate-id(//style:style[@style:name=$apply-style-name])"/></xsl:attribute--> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="createcellnamelist"> + <xsl:param name="list"/> + <xsl:choose> + <xsl:when test="$list"> + <xsl:variable name="first" select="$list[1]"/> + <xsl:variable name="stringlist-of-rest"> + <xsl:call-template name="createcellnamelist"> + <xsl:with-param name="list" select="$list[position()!=1]"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat($first/@style:name,' ',$stringlist-of-rest)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="search-left-top"> + <xsl:param name="cellstylenamelist"/> + <xsl:choose> + <xsl:when test="$cellstylenamelist!=''"> + <xsl:variable name="first-cellstylename" select="substring-before($cellstylenamelist, ' ')"/> + <xsl:variable name="tableslist" select="/office:document/office:body/office:spreadsheet/table:table"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-with-one-cellstyle"> + <xsl:with-param name="cellstylename" select="$first-cellstylename"/> + <xsl:with-param name="tableslist" select="$tableslist"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top"> + <xsl:with-param name="cellstylenamelist" select="substring-after($cellstylenamelist,' ')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="final-left-top"> + <xsl:choose> + <xsl:when test="$rest-left-top =''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$first-left-top =''"> + <xsl:value-of select="$rest-left-top"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="after-compared-left-top"> + <xsl:call-template name="compare-two-left-top"> + <xsl:with-param name="first" select="$first-left-top"/> + <xsl:with-param name="second" select="$rest-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$after-compared-left-top"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$final-left-top"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-left-top-condition"> + <xsl:param name="left-top"/> + <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/> + <xsl:variable name="column-number1"> + <xsl:value-of select="floor( $column-number div 26 )"/> + </xsl:variable> + <xsl:variable name="column-number2"> + <xsl:value-of select="$column-number mod 26"/> + </xsl:variable> + <xsl:variable name="column-character1"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-character2"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat(substring-before($left-top,'.'),'.',$column-character1,$column-character2,substring-after($left-top,' '))"/> + </xsl:template> + <xsl:template name="search-left-top-with-one-cellstyle"> + <xsl:param name="cellstylename"/> + <xsl:param name="tableslist"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$tableslist and $return=''"> + <xsl:variable name="firsttablerows" select="$tableslist[1]//table:table-row"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-with-one-cellstyle-inatable"> + <xsl:with-param name="row-num" select="'1'"/> + <xsl:with-param name="firsttablerows" select="$firsttablerows"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-with-one-cellstyle"> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top!=''"> + <xsl:value-of select="$rest-left-top"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="compare-two-left-top"> + <xsl:param name="first"/> + <xsl:param name="second"/> + <xsl:variable name="first-column" select="substring-before(substring-after($first,'.'),' ')"/> + <xsl:variable name="first-row" select="substring-after($first,' ')"/> + <xsl:variable name="second-column" select="substring-before(substring-after($second,'.'),' ')"/> + <xsl:variable name="second-row" select="substring-after($second,' ')"/> + <xsl:choose> + <xsl:when test="$first-row<$second-row"> + <xsl:value-of select="$first"/> + </xsl:when> + <xsl:when test="$first-row=$second-row"> + <xsl:choose> + <xsl:when test="$first-column<=$second-column"> + <xsl:value-of select="$first"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$second"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$second"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="search-left-top-with-one-cellstyle-inatable"> + <xsl:param name="row-num"/> + <xsl:param name="firsttablerows"/> + <xsl:param name="cellstylename"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$firsttablerows and $return=''"> + <xsl:variable name="firstcells" select="$firsttablerows[1]/table:table-cell"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-with-one-cellstyle-inarow"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="column-num" select="'1'"/> + <xsl:with-param name="firstcells" select="$firstcells"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="row-num-p"> + <xsl:choose> + <xsl:when test="$firsttablerows[1]/@table:number-rows-repeated"> + <xsl:value-of select="$row-num+ $firsttablerows[1]/@table:number-rows-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$row-num+1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-with-one-cellstyle-inatable"> + <xsl:with-param name="row-num" select="$row-num-p"/> + <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top !=''"> + <xsl:value-of select="$rest-left-top "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="search-left-top-with-one-cellstyle-inarow"> + <xsl:param name="row-num"/> + <xsl:param name="column-num"/> + <xsl:param name="firstcells"/> + <xsl:param name="cellstylename"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$firstcells and $return=''"> + <xsl:variable name="firstcell" select="$firstcells[1]"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-with-one-cellstyle-inacell"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="column-num" select="$column-num"/> + <xsl:with-param name="cell" select="$firstcell"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-num-p"> + <xsl:choose> + <xsl:when test="$firstcell/@table:number-columns-repeated"> + <xsl:value-of select="$column-num+ $firstcell/@table:number-columns-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$column-num+ 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-with-one-cellstyle-inarow"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="column-num" select="$column-num-p"/> + <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top !=''"> + <xsl:value-of select="$rest-left-top "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="search-left-top-with-one-cellstyle-inacell"> + <xsl:param name="row-num"/> + <xsl:param name="column-num"/> + <xsl:param name="cell"/> + <xsl:param name="cellstylename"/> + <xsl:choose> + <xsl:when test="$cell/@table:style-name"> + <xsl:if test="$cell/@table:style-name=$cellstylename"> + <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="style-is-default"> + <xsl:call-template name="is-default-or-not"> + <xsl:with-param name="column-num" select="$column-num"/> + <xsl:with-param name="cell" select="$cell"/> + <xsl:with-param name="preceding-cellstylename" select="''"/> + <xsl:with-param name="temp-num" select="'0'"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="table-columns" select="$cell/ancestor::table:table//table:table-column "/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$style-is-default='yes' "> + <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="is-default-or-not"> + <xsl:param name="column-num"/> + <xsl:param name="cell"/> + <xsl:param name="preceding-cellstylename"/> + <xsl:param name="temp-num"/> + <xsl:param name="cellstylename"/> + <xsl:param name="table-columns"/> + <xsl:choose> + <xsl:when test="$temp-num<$column-num"> + <xsl:variable name="firstcolumn"> + <xsl:choose> + <xsl:when test="$table-columns[1]/@table:number-columns-repeated"> + <xsl:value-of select="$table-columns[1]/@table:number-columns-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'1'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="preceding-cellstylename-to-param"> + <xsl:choose> + <xsl:when test="$table-columns[1]/@table:default-cell-style-name"> + <xsl:value-of select="$table-columns[1]/@table:default-cell-style-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="is-default-or-not"> + <xsl:with-param name="column-num" select="$column-num"/> + <xsl:with-param name="temp-num" select="$temp-num + $firstcolumn"/> + <xsl:with-param name="preceding-cellstylename" select="$preceding-cellstylename-to-param"/> + <xsl:with-param name="cellstylename" select="$cellstylename"/> + <xsl:with-param name="table-columns" select="$table-columns[position()!=1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$cellstylename=$preceding-cellstylename"> + <xsl:value-of select="'yes'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'no'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="table:tracked-changes"> + <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:tracked-changes"> + <xsl:if test="table:cell-content-change/table:cell-address"> + <xsl:variable name="row" select="table:cell-content-change/table:cell-address/@table:row"/> + <xsl:variable name="column" select="table:cell-content-change/table:cell-address/@table:column"/> + <xsl:element name="字:修订开始"> + <xsl:attribute name="uof:locID">t0206</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="concat($row,'-',$column)"/></xsl:attribute> + <xsl:attribute name="字:类型">format</xsl:attribute> + <xsl:if test="table:cell-content-change/office:change-info and table:cell-content-change/table:previous"> + <xsl:variable name="creator" select="table:cell-content-change/office:change-info/dc:creator"/> + <xsl:variable name="date" select="table:cell-content-change/office:change-info/dc:date"/> + <xsl:variable name="text" select="table:cell-content-change/table:previous/table:change-track-table-cell/text:p"/> + <xsl:attribute name="字:修订信息引用"><xsl:value-of select="concat($creator,'+',$date,'%',$text)"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="字:修订结束"> + <xsl:attribute name="uof:locID">t0207</xsl:attribute> + <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template match="office:font-face-decls"> + <uof:字体集 uof:locID="u0040"> + <xsl:for-each select="style:font-face"> + <xsl:element name="uof:字体声明"> + <xsl:attribute name="uof:attrList">标识符 名称 字体族</xsl:attribute> + <xsl:attribute name="uof:locID">u0041</xsl:attribute> + <xsl:attribute name="uof:标识符"><xsl:value-of select="translate(@style:name,' ','_')"/></xsl:attribute> + <xsl:attribute name="uof:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="uof:字体族"><xsl:value-of select="@svg:font-family"/></xsl:attribute> + <!-- added by glu, for process special fonts e.g. Marlett, --> + <!--chengxz 060821 delete uof:字符集,because there is no this attr--> + <!--xsl:if test="@style:font-charset= '02'"> + <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute> + </xsl:if--> + <!--xsl:if test="@style:font-family-generic"> + <xsl:choose> + <xsl:when test="@style:font-family-generic = 'swiss'"> + <xsl:attribute name="uof:字体族">Swiss</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='modern'"> + <xsl:attribute name="uof:字体族">Modern</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic='roman'"> + <xsl:attribute name="uof:字体族">Roman</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='script'"> + <xsl:attribute name="uof:字体族">Script</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='decorative'"> + <xsl:attribute name="uof:字体族">Decorative</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='system'"> + <xsl:attribute name="uof:字体族">System</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="uof:字体族">System</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if--> + <!--xsl:if test="@style:font-pitch"> + <xsl:attribute name="uof:字号">12</xsl:attribute> + </xsl:if--> + </xsl:element> + </xsl:for-each> + <xsl:apply-templates select="style:font-face"/> + </uof:字体集> + </xsl:template> + <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/> + <xsl:template match="style:style" mode="styles"> + <xsl:param name="isAutomatic"/> + <xsl:param name="styleName" select="@style:name"/> + <xsl:choose> + <xsl:when test="@style:family='text'"> + <xsl:element name="uof:句式样"> + <xsl:attribute name="uof:locID">u0043</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:call-template name="字:字体"/> + </xsl:element> + </xsl:when> + <xsl:when test="@style:family='paragraph'"> + <xsl:element name="uof:段落式样"> + <xsl:attribute name="uof:locID">u0044</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + </xsl:element> + <xsl:if test="style:text-properties"> + <xsl:element name="uof:句式样"> + <xsl:attribute name="uof:locID">u0043</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">custum</xsl:attribute> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + <xsl:call-template name="字:字体"/> + </xsl:element> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:element name="uof:单元格式样"> + <xsl:attribute name="uof:locID">u0046</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + <xsl:attribute name="表:标识符"><xsl:value-of select="$styleName"/></xsl:attribute> + <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="ancestor::office:automatic-styles">auto</xsl:when><xsl:when test="ancestor::office:styles">custom</xsl:when><xsl:otherwise>default</xsl:otherwise></xsl:choose></xsl:attribute> + <!--xsl:attribute name="表:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute--> + <xsl:choose> + <xsl:when test="style:map"> + <xsl:attribute name="表:名称"><xsl:value-of select="style:map/@style:apply-style-name"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="表:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="not($isAutomatic)"> + <xsl:choose> + <xsl:when test="$styleName='Default'"> + <xsl:attribute name="表:名称"><xsl:value-of select="'Normal'"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="表:名称"><xsl:value-of select="$styleName"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!--xsl:if test="@style:parent-style-name"> + <xsl:attribute name="表:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + </xsl:if--> + <!--chengxz change the order--> + <xsl:variable name="styleProperties" select="key('styles', $styleName)/*"/> + <xsl:call-template name="Font"> + <xsl:with-param name="styleProperties" select="$styleProperties"/> + </xsl:call-template> + <xsl:call-template name="Alignment"> + <xsl:with-param name="styleProperties" select="$styleProperties"/> + </xsl:call-template> + <!--chenjh changed 1103--> + <!--xsl:if test="/*/office:automatic-styles/style:style[@style:name=/*/office:body/table:table/table:table-row/table:table-cell/@table:style-name]/style:properties/@fo:border"--> + <xsl:if test="@style:data-style-name"> + <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26--> + <xsl:call-template name="NumberFormat"> + <xsl:with-param name="temp-style" select="@style:data-style-name"/> + </xsl:call-template> + <!--RedOffice comment (Zengjh) end--> + </xsl:if> + <xsl:call-template name="Border"> + <xsl:with-param name="styleProperties" select="$styleProperties"/> + <!--xsl:with-param name="styleProperties" select="/*/office:automatic-styles/style:style"/--> + </xsl:call-template> + <!--/xsl:if--> + <!--chenjh end 1103--> + <xsl:call-template name="Interior"> + <xsl:with-param name="styleProperties" select="$styleProperties"/> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="字:字体"> + <xsl:element name="字:字体"> + <xsl:attribute name="uof:locID">t0088</xsl:attribute> + <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute> + <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@fo:font-size-asian or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size"> + <xsl:attribute name="字:字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@fo:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size"><xsl:value-of select="substring-before(style:text-properties/@style:font-size,'pt')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@style:font-name"> + <xsl:attribute name="字:西文字体引用"><xsl:value-of select="style:text-properties/@style:font-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@style:font-name-complex"> + <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-name-complex"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian"> + <xsl:element name="字:粗体"> + <xsl:attribute name="uof:locID">t0089</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian"> + <xsl:element name="字:斜体"> + <xsl:attribute name="uof:locID">t0090</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-line-through-style and not(style:text-properties/@style:text-line-through-style='none')"> + <xsl:element name="字:删除线"> + <xsl:attribute name="uof:locID">t0094</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-underline-style"> + <xsl:element name="字:下划线"> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0095</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:if test="style:text-properties/@style:text-underline-color"> + <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:text-shadow"> + <xsl:element name="字:阴影"> + <xsl:attribute name="uof:locID">t0100</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-position"> + <xsl:element name="字:位置"> + <xsl:attribute name="uof:locID">t0102</xsl:attribute> + <xsl:value-of select="style:text-properties/@style:text-position"/> + </xsl:element> + </xsl:if> + </xsl:template> + <!--RedOffice Comment from Zengjh:UOF0020 2006-04-01 Based on Original--> + <xsl:template name="NumberFormat"> + <xsl:param name="temp-style"/> + <xsl:for-each select="(/*/office:styles/child::*[@style:name=$temp-style]) | (/*/office:automatic-styles/child::*[@style:name=$temp-style])"> + <表:数字格式 uof:locID="s0021" uof:attrList="分类名称 格式码"> + <xsl:attribute name="表:分类名称"><xsl:choose><xsl:when test="name(.)='number:currency-style'">currency</xsl:when><xsl:when test="name(.)='number:percentage-style'">percentage</xsl:when><xsl:when test="name(.)='number:date-style'">date</xsl:when><xsl:when test="name(.)='number:time-style'">time</xsl:when><xsl:when test="name(.)='number:boolean-style'">custom</xsl:when><xsl:when test="name(.)='number:text-style'">text</xsl:when><xsl:when test="name(.)='number:number-style'"><xsl:choose><xsl:when test="number:fraction">fraction</xsl:when><xsl:when test="number:scientific-number">scientific</xsl:when><xsl:otherwise>number</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>general</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:格式码"><xsl:call-template name="element-attribute"/><xsl:for-each select="style:map"><xsl:text>[</xsl:text><xsl:value-of select="@style:condition"/><xsl:text>]</xsl:text><xsl:variable name="apply-style" select="@style:apply-style-name"/><xsl:for-each select="../../child::*[@style:name=$apply-style]/*"><xsl:call-template name="general-number-format"/></xsl:for-each><xsl:text>;</xsl:text></xsl:for-each><xsl:for-each select="*[not(name(.)='style:map')]"><xsl:call-template name="general-number-format"/></xsl:for-each></xsl:attribute> + </表:数字格式> + </xsl:for-each> + </xsl:template> + <xsl:template name="general-number-format"> + <xsl:choose> + <xsl:when test="name(.)='style:text-properties'"> + <xsl:call-template name="general-color-format"/> + </xsl:when> + <xsl:when test="name(.)='number:text'">"<xsl:value-of select="text()"/>"</xsl:when> + <xsl:when test="name(.)='number:text-content' ">@</xsl:when> + <xsl:when test="name(.)='number:boolean'">boolean</xsl:when> + <xsl:when test="name(.)='number:currency-symbol'"> + <xsl:call-template name="general-currency-format"/> + </xsl:when> + <xsl:when test="name(.)='number:fraction' or name(.)='number:number' or name(.)='number:scientific-number'"> + <xsl:if test="@number:min-integer-digits and not(@number:grouping)"> + <xsl:choose> + <xsl:when test="@number:min-integer-digits='0'">#</xsl:when> + <xsl:when test="@number:min-integer-digits='1'">0</xsl:when> + <xsl:when test="@number:min-integer-digits='2'">00</xsl:when> + <xsl:when test="@number:min-integer-digits='3'">000</xsl:when> + <xsl:when test="@number:min-integer-digits='4'">0000</xsl:when> + <xsl:when test="@number:min-integer-digits='5'">00000</xsl:when> + <xsl:when test="@number:min-integer-digits='6'">000000</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@number:min-integer-digits and @number:grouping"> + <xsl:choose> + <xsl:when test="@number:min-integer-digits='0'">#,###</xsl:when> + <xsl:when test="@number:min-integer-digits='1'">#,##0</xsl:when> + <xsl:when test="@number:min-integer-digits='2'">#,#00</xsl:when> + <xsl:when test="@number:min-integer-digits='3'">#,000</xsl:when> + <xsl:when test="@number:min-integer-digits='4'">##0,000</xsl:when> + <xsl:when test="@number:min-integer-digits='5'">#00,000</xsl:when> + <xsl:when test="@number:min-integer-digits='6'">#,000,000</xsl:when> + <xsl:when test="@number:min-integer-digits='7'">##0,000,000</xsl:when> + <xsl:when test="@number:min-integer-digits='8'">#,#00,000,000</xsl:when> + <xsl:otherwise>#,##0</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@number:decimal-places and not(@number:decimal-replacement)"> + <xsl:choose> + <xsl:when test="@number:decimal-places='0'"/> + <xsl:when test="@number:decimal-places='1'">.0</xsl:when> + <xsl:when test="@number:decimal-places='2'">.00</xsl:when> + <xsl:when test="@number:decimal-places='3'">.000</xsl:when> + <xsl:when test="@number:decimal-places='4'">.0000</xsl:when> + <xsl:when test="@number:decimal-places='5'">.00000</xsl:when> + <xsl:when test="@number:decimal-places='6'">.000000</xsl:when> + <xsl:otherwise>.00</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@number:decimal-places and @number:decimal-replacement"> + <xsl:choose> + <xsl:when test="@number:decimal-places='0'"/> + <xsl:when test="@number:decimal-places='1'">.#</xsl:when> + <xsl:when test="@number:decimal-places='2'">.##</xsl:when> + <xsl:when test="@number:decimal-places='3'">.###</xsl:when> + <xsl:when test="@number:decimal-places='4'">.####</xsl:when> + <xsl:when test="@number:decimal-places='5'">.#####</xsl:when> + <xsl:when test="@number:decimal-places='6'">.######</xsl:when> + <xsl:otherwise>.##</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@number:display-factor"> + <xsl:choose> + <xsl:when test="@number:display-factor='1000'">,</xsl:when> + <xsl:when test="@number:display-factor='1000000'">,,</xsl:when> + <xsl:when test="@number:display-factor='1000000000'">,,,</xsl:when> + <xsl:when test="@number:display-factor='1000000000000000'">,,,,</xsl:when> + <xsl:when test="@number:display-factor='1000000000000000000'">,,,,,</xsl:when> + <xsl:when test="@number:display-factor='1000000000000000000000'">,,,,,</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:if> + <xsl:if test="@number:min-exponent-digits"> + <xsl:choose> + <xsl:when test="@number:min-exponent-digits='1'">E+0</xsl:when> + <xsl:when test="@number:min-exponent-digits='2'">E+00</xsl:when> + <xsl:when test="@number:min-exponent-digits='3'">E+000</xsl:when> + <xsl:when test="@number:min-exponent-digits='4'">E+0000</xsl:when> + <xsl:when test="@number:min-exponent-digits='5'">E+00000</xsl:when> + <xsl:when test="@number:min-exponent-digits='6'">E+000000</xsl:when> + <xsl:otherwise>E+00</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@number:min-numerator-digits"> + <xsl:choose> + <xsl:when test="@number:min-numerator-digits='1' "> ?</xsl:when> + <xsl:when test="@number:min-numerator-digits='2' "> ??</xsl:when> + <xsl:when test="@number:min-numerator-digits='3' "> ???</xsl:when> + <xsl:when test="@number:min-numerator-digits='4' "> ????</xsl:when> + <xsl:when test="@number:min-numerator-digits='5' "> ?????</xsl:when> + <xsl:when test="@number:min-numerator-digits='6' "> ??????</xsl:when> + <xsl:otherwise> ???</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@number:min-denominator-digits"> + <xsl:choose> + <xsl:when test="@number:min-denominator-digits='1' ">/?</xsl:when> + <xsl:when test="@number:min-denominator-digits='2' ">/??</xsl:when> + <xsl:when test="@number:min-denominator-digits='3' ">/???</xsl:when> + <xsl:when test="@number:min-denominator-digits='4' ">/????</xsl:when> + <xsl:when test="@number:min-denominator-digits='5' ">/?????</xsl:when> + <xsl:when test="@number:min-denominator-digits='6' ">/??????</xsl:when> + <xsl:otherwise>/???</xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="name(.)='number:year'"> + <xsl:choose> + <xsl:when test="@number:style='long'">YYYY</xsl:when> + <xsl:otherwise>YY</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:month'"> + <xsl:choose> + <xsl:when test="@number:style='long' and @number:textual='true'">MMMM</xsl:when> + <xsl:when test="not(@number:style='long') and @number:textual='true'">MMM</xsl:when> + <xsl:when test="@number:style='long' and not(@number:textual)">MM</xsl:when> + <xsl:when test="not(@number:style='long') and not(@number:textual)">M</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:day'"> + <xsl:choose> + <xsl:when test="@number:style='long'">DD</xsl:when> + <xsl:otherwise>D</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:day-of-week'"> + <xsl:choose> + <xsl:when test="@number:style='long'">NNNN</xsl:when> + <xsl:otherwise>NNN</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:quarter'"> + <xsl:choose> + <xsl:when test="@number:style='long'">QQ</xsl:when> + <xsl:otherwise>Q</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:hours'"> + <xsl:choose> + <xsl:when test="@number:style='long' and ../@number:truncate-on-overflow='false'">[HH]</xsl:when> + <xsl:when test="@number:style='long'">HH</xsl:when> + <xsl:otherwise>H</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:minutes'"> + <xsl:choose> + <xsl:when test="@number:style='long'">MM</xsl:when> + <xsl:otherwise>M</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:seconds'"> + <xsl:choose> + <xsl:when test="@number:style='long' and @number:decimal-places='2'">SS.00</xsl:when> + <xsl:when test="@number:style='long'">SS</xsl:when> + <xsl:otherwise>S</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name(.)='number:am-pm'">AM/PM</xsl:when> + <xsl:when test="name(.)='number:week-of-year'"> + <xsl:choose> + <xsl:when test="@number:style='long'">WW</xsl:when> + <xsl:otherwise>WW</xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="general-color-format"> + <xsl:choose> + <xsl:when test="@fo:color='#000000'">[Black]</xsl:when> + <xsl:when test="@fo:color='#0000ff'">[Blue]</xsl:when> + <xsl:when test="@fo:color='#00ffff'">[Cyan]</xsl:when> + <xsl:when test="@fo:color='#00ff00'">[Green]</xsl:when> + <xsl:when test="@fo:color='#ff00ff'">[Magenta]</xsl:when> + <xsl:when test="@fo:color='#ff0000'">[Red]</xsl:when> + <xsl:when test="@fo:color='#ffffff'">[White]</xsl:when> + <xsl:when test="@fo:color='#ffff00'">[Yellow]</xsl:when> + <xsl:otherwise>[Black]</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="general-currency-format"> + <xsl:choose> + <xsl:when test="text()='¥' and @number:language='zh' and @number:country='CN'">[$¥-804]</xsl:when> + <xsl:when test="text()='$' and @number:language='en' and @number:country='US'">[$$-409]</xsl:when> + <xsl:when test="text()='$' and @number:language='es' and @number:country='AR'">[$$-2C0A]</xsl:when> + <xsl:when test="text()='$' and @number:language='fr' and @number:country='CA'">[$$-C0C]</xsl:when> + <xsl:when test="text()='CNY'">[$CNY]</xsl:when> + <xsl:when test="text()='AFA'">[$AFA]</xsl:when> + <xsl:when test="text()='CCC'">CCC</xsl:when> + <xsl:otherwise>¥</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="element-attribute"> + <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='short'">[NatNum1]</xsl:if> + <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='medium'">[NatNum7]</xsl:if> + <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='long'">[NatNum4]</xsl:if> + <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='short'">[NatNum2]</xsl:if> + <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='medium'">[NatNum8]</xsl:if> + <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='long'">[NatNum5]</xsl:if> + <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='short'">[NatNum3]</xsl:if> + <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='medium'">[NatNum0]</xsl:if> + <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='long'">[NatNum6]</xsl:if> + <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='short'">[NatNum0]</xsl:if> + <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='medium'">[NatNum0]</xsl:if> + <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='long'">[NatNum0]</xsl:if> + <xsl:if test="@number:transliteration-language='zh' and @number:transliteration-country='CN'">[$-804]</xsl:if> + </xsl:template> + <!--RedOffice comment (Zengjh) end--> + <!--huangzf0715--> + <xsl:template name="Alignment"> + <xsl:param name="styleProperties"/> + <xsl:if test="($styleProperties/@fo:text-align) or ($styleProperties/@style:vertical-align) or ($styleProperties/@fo:wrap-option) or($styleProperties/@fo:margin-left) or ($styleProperties/@style:rotation-angle) or ($styleProperties/@style:direction)"> + <xsl:element name="表:对齐格式"> + <xsl:attribute name="uof:locID">s0114</xsl:attribute> + <xsl:if test="$styleProperties/@fo:margin-left"> + <xsl:attribute name="表:缩进"><xsl:variable name="margin"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@fo:margin-left"/><xsl:with-param name="rounding-factor" select="1"/></xsl:call-template></xsl:variable><xsl:value-of select="number($margin) div 10"/></xsl:attribute> + </xsl:if> + <xsl:element name="表:水平对齐方式"> + <xsl:attribute name="uof:locID">s0115</xsl:attribute> + <xsl:choose> + <xsl:when test="$styleProperties/@fo:text-align"> + <xsl:choose> + <xsl:when test="$styleProperties/@fo:text-align = 'center'">center</xsl:when> + <xsl:when test="$styleProperties/@fo:text-align = 'end'">right</xsl:when> + <xsl:when test="$styleProperties/@fo:text-align = 'justify'">justify</xsl:when> + <xsl:when test="$styleProperties/@fo:text-align = 'start'">left</xsl:when> + <xsl:otherwise>fill</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>general</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="($styleProperties/@style:vertical-align) or ($styleProperties/@fo:vertical-align)"> + <xsl:element name="表:垂直对齐方式"> + <xsl:attribute name="uof:locID">s0116</xsl:attribute> + <xsl:choose> + <xsl:when test="$styleProperties/@fo:vertical-align = 'top'">top</xsl:when> + <xsl:when test="$styleProperties/@fo:vertical-align = 'bottom'">bottom</xsl:when> + <xsl:when test="$styleProperties/@fo:vertical-align = 'middle'">center</xsl:when> + <xsl:when test="$styleProperties/@fo:vertical-align = 'justify'">justify</xsl:when> + <xsl:when test="$styleProperties/@fo:vertical-align = 'top'">top</xsl:when> + <xsl:otherwise>distributed</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="表:文字方向"> + <xsl:attribute name="uof:locID">s0118</xsl:attribute> + <xsl:choose> + <xsl:when test="$styleProperties/@style:direction = 'ttb'">vertical</xsl:when> + <xsl:otherwise>horizontal</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="$styleProperties/@style:rotation-angle"> + <xsl:element name="表:文字旋转角度"> + <xsl:attribute name="uof:locID">s0119</xsl:attribute> + <xsl:choose> + <xsl:when test="$styleProperties/@style:rotation-angle > 90"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:rotation-angle >= 270"> + <xsl:value-of select="$styleProperties/@style:rotation-angle - 360"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:rotation-angle - 180"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$styleProperties/@style:rotation-angle < -90"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:rotation-angle <= -270"> + <xsl:value-of select="$styleProperties/@style:rotation-angle + 360"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:rotation-angle + 180"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:rotation-angle"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@fo:wrap-option = 'wrap'"> + <xsl:element name="表:自动换行"> + <xsl:attribute name="uof:locID">s0120</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@style:shrink-to-fit"> + <xsl:element name="表:缩小字体填充"> + <xsl:attribute name="uof:locID">s0121</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值"><xsl:value-of select="$styleProperties/@style:shrink-to-fit"/></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="Font"> + <xsl:param name="styleProperties"/> + <!--xsl:if test="(style:text-properties/@fo:font-weight) or (style:text-properties/@fo:color) or ($styleProperties/@style:font-name) or ($styleProperties/@fo:font-style) or ($styleProperties/@style:text-outline) or ($styleProperties/@style:text-shadow) or ($styleProperties/@style:font-size) or ($styleProperties/@style:text-crossing-out) or ($styleProperties/@style:text-underline) or ($styleProperties/@style:text-underline-style) or ($styleProperties/@style:text-position)"--> + <xsl:if test="not(@style:name='Default')"> + <xsl:element name="表:字体格式"> + <xsl:attribute name="uof:locID">s0113</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:if test="$styleProperties/@fo:font-weight or $styleProperties/@style:font-weight-asian"> + <xsl:element name="字:粗体"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$styleProperties/@style:font-weight-asian='bold' or $styleProperties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0089</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@fo:font-style or $styleProperties/@style:font-style-asian"> + <xsl:element name="字:斜体"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$styleProperties/@fo:font-style='italic' or $styleProperties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0090</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-outline = 'true'"> + <字:空心 uof:locID="t0098" uof:attrList="值" 字:值="true"/> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-shadow = 'shadow'"> + <字:阴影 uof:locID="t0100" uof:attrList="值" 字:值="true"/> + </xsl:if> + <xsl:if test="(style:text-properties/@style:text-underline-style) and ($styleProperties/@style:text-underline-style != 'none')"> + <xsl:element name="字:下划线"> + <xsl:attribute name="uof:locID">t0095</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 颜色 字下划线</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute> + <xsl:attribute name="字:字下划线">true</xsl:attribute> + <xsl:if test="$styleProperties/@style:text-underline-color"> + <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="$styleProperties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="$styleProperties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-line-through-style and not($styleProperties/@style:text-line-through-style='none')"> + <xsl:element name="字:删除线"> + <xsl:attribute name="uof:locID">t0094</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-emphasize"> + <xsl:element name="字:着重号"> + <xsl:attribute name="uof:locID">t0096</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute> + <xsl:choose> + <xsl:when test="$styleProperties/@style:text-emphasize='none'"> + <xsl:attribute name="字:字着重号">false</xsl:attribute> + <xsl:attribute name="字:类型">none</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:字着重号">true</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:着重号类型"><xsl:with-param name="te" select="$styleProperties/@style:text-emphasize"/></xsl:call-template></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$styleProperties/@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="$styleProperties/@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$styleProperties/@style:text-position"> + <xsl:element name="字:上下标"> + <xsl:choose> + <xsl:when test="substring-before($styleProperties/@style:text-position, '% ') > 0"> + <xsl:attribute name="字:上下标">sup</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:上下标">sub</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="字:字体"> + <xsl:attribute name="uof:locID">t0088</xsl:attribute> + <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute> + <xsl:if test="$styleProperties/@style:font-name-asian"> + <xsl:attribute name="字:中文字体引用"><xsl:value-of select="translate($styleProperties/@style:font-name-asian,' ','_')"/></xsl:attribute> + </xsl:if> + <xsl:if test="$styleProperties/@style:font-name or $styleProperties/@fo:font-family"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:font-name"> + <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($styleProperties/@style:font-name,' ','_')"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($styleProperties/@fo:font-family,' ','_')"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$styleProperties/@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="$styleProperties/@fo:color"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="$styleProperties/@fo:font-size"> + <xsl:attribute name="字:字号"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@fo:font-size"/></xsl:call-template></xsl:attribute> + </xsl:when> + <xsl:when test="$styleProperties/@style:font-size-asian"> + <xsl:attribute name="字:字号"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@style:font-size-asian"/></xsl:call-template></xsl:attribute> + </xsl:when> + <xsl:when test="$styleProperties/@style:font-size-complex"> + <xsl:attribute name="字:字号"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@style:font-size-complex"/></xsl:call-template></xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:if test="style:text-properties/@style:font-relief"> + <xsl:element name="字:浮雕"> + <xsl:attribute name="uof:locID">t0099</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant"> + <xsl:element name="字:醒目字体"> + <xsl:attribute name="uof:locID">t0101</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:text-shadow"> + <xsl:element name="字:阴影"> + <xsl:attribute name="uof:locID">t0100</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template name="Border"> + <xsl:param name="styleProperties"/> + <xsl:if test="style:table-cell-properties/@fo:border and not($styleProperties/@fo:border-top or $styleProperties/@fo:border-left or $styleProperties/@fo:border-bottom or $styleProperties/@fo:border-right)"> + <xsl:element name="表:边框"> + <xsl:attribute name="uof:locID">s0022</xsl:attribute> + <xsl:variable name="border"> + <xsl:value-of select="$styleProperties/@fo:border"/> + </xsl:variable> + <xsl:element name="uof:左"> + <xsl:attribute name="uof:locID">u0057</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'-')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="uof:上"> + <xsl:attribute name="uof:locID">u0058</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'-')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="uof:右"> + <xsl:attribute name="uof:locID">u0059</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="substring-before(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) >0 or contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'+')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="uof:下"> + <xsl:attribute name="uof:locID">u0060</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="substring-before(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) >0 or contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'+')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test="$styleProperties/@style:diagonal-bl-tr"> + <xsl:element name="uof:对角线1"> + <xsl:attribute name="uof:locID">u0061</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="border-width"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:diagonal-bl-tr !='none'"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-bl-tr, ' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:diagonal-bl-tr" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/> + <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <!--end of uo:对角线1--> + <!--xsl:if test="$styleProperties/@fo:border and $styleProperties/@style:diagonal-tl-br"--> + <xsl:if test="$styleProperties/@style:diagonal-tl-br"> + <xsl:element name="uof:对角线2"> + <xsl:attribute name="uof:locID">u0062</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="border-width"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:diagonal-tl-br !='none'"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-tl-br, ' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:diagonal-tl-br" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/> + <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <!--end of uo:对角线2--> + </xsl:element> + </xsl:if> + <!--end of fo:border--> + <xsl:if test="$styleProperties/@fo:border-top or $styleProperties/@fo:border-left or $styleProperties/@fo:border-bottom or $styleProperties/@fo:border-right or $styleProperties/@style:diagonal-tl-br or $styleProperties/@style:diagonal-bl-tr"> + <xsl:element name="表:边框"> + <xsl:attribute name="uof:locID">s0022</xsl:attribute> + <xsl:if test="$styleProperties/@fo:border-left or $styleProperties/@style:shadow"> + <xsl:element name="uof:左"> + <xsl:attribute name="uof:locID">u0057</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="borderleft"> + <xsl:value-of select="$styleProperties/@fo:border-left"/> + </xsl:variable> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderleft!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderleft,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderleft,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$borderleft!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderleft,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderleft,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'-')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <!--end of uof:左--> + <xsl:if test="$styleProperties/@fo:border-top or $styleProperties/@style:shadow"> + <xsl:element name="uof:上"> + <xsl:attribute name="uof:locID">u0058</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="bordertop"> + <xsl:value-of select="$styleProperties/@fo:border-top"/> + </xsl:variable> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$bordertop!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($bordertop,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($bordertop,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$bordertop!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($bordertop,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($bordertop,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'-')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <!--end of uof:上--> + <xsl:if test="$styleProperties/@fo:border-right or $styleProperties/@style:shadow"> + <xsl:element name="uof:右"> + <xsl:attribute name="uof:locID">u0059</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="borderright"> + <xsl:value-of select="$styleProperties/@fo:border-right"/> + </xsl:variable> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderright!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderright,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderright,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$borderright!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderright,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderright,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="substring-before(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit)>0 or contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'+')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <!--end of uof:右--> + <xsl:if test="$styleProperties/@fo:border-bottom or $styleProperties/@style:shadow"> + <xsl:element name="uof:下"> + <xsl:attribute name="uof:locID">u0060</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="borderbottom"> + <xsl:value-of select="$styleProperties/@fo:border-bottom"/> + </xsl:variable> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderbottom!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderbottom,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderbottom,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$borderbottom!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderbottom,' '),$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderbottom,' '),' ')"/></xsl:attribute> + </xsl:if> + <xsl:if test="substring-before(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) >0 or contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'+')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <!--end of uof:下--> + <xsl:if test="$styleProperties/@style:diagonal-bl-tr"> + <xsl:element name="uof:对角线1"> + <xsl:attribute name="uof:locID">u0061</xsl:attribute> + <xsl:attribute name="attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="border-width"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:diagonal-bl-tr !='none'"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-bl-tr, ' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:diagonal-bl-tr" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/> + <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <!--end of uo:对角线1--> + <xsl:if test="$styleProperties/@style:diagonal-tl-br"> + <xsl:element name="uof:对角线2"> + <xsl:attribute name="uof:locID">u0062</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="border-width"> + <xsl:choose> + <xsl:when test="$styleProperties/@style:diagonal-tl-br !='none'"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-tl-br, ' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$styleProperties/@style:diagonal-tl-br" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/> + <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <!--end of uo:对角线2--> + </xsl:element> + <!--end of 表:边框--> + </xsl:if> + <!--chenjh 边框 E --> + </xsl:template> + <xsl:template name="border-attributes"> + <xsl:param name="border_properties"/> + <xsl:attribute name="attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:variable name="border-width"> + <xsl:choose> + <xsl:when test="$border_properties !='none'"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-before($border_properties, ' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$border_properties" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="border-style" select="substring-before(substring-after($border_properties, ' '), ' ')"/> + <xsl:variable name="border-color" select="substring-after(substring-after($border_properties, ' '), ' ')"/> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:otherwise><xsl:value-of select="$border-style"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:template> + <xsl:template name="Interior"> + <xsl:param name="styleProperties"/> + <xsl:if test="style:table-cell-properties/@fo:background-color and not($styleProperties/@fo:background-color = 'transparent')"> + <xsl:element name="表:填充"> + <!--chenp modify redo0000047--> + <xsl:attribute name="uof:locID">s0058</xsl:attribute> + <!--0821 by lil --> + <xsl:choose> + <xsl:when test="$styleProperties/@fo:background-color"> + <xsl:element name="图:颜色"> + <xsl:attribute name="uof:locID">g0034</xsl:attribute> + <xsl:value-of select="$styleProperties/@fo:background-color"/> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="表:图案"> + <xsl:value-of select="' Solid'"/> + <xsl:attribute name="xsl:lodID">g0036</xsl:attribute> + <xsl:attribute name="attrList">类型 图形引用 前景色 背景色</xsl:attribute> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <!--end--> + </xsl:element> + </xsl:if> + </xsl:template> + <!--chengxz 0621 E--> + <!--xsl:template name="image"> + + <xsl:element name="图:图形"> + <xsl:attribute name="图:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute> + <xsl:attribute name="uof:locID">g0000</xsl:attribute> + <xsl:attribute name="uof:attrList">层次 标识符 组合列表 其他对象</xsl:attribute> + <xsl:element name="图:预定义图形"> + <xsl:attribute name="uof:locID">g0005</xsl:attribute> + <xsl:element name="图:类别">图片</xsl:element> + <xsl:element name="图:生成软件"><xsl:value-of select="office:binary-data" ></xsl:value-of></xsl:element> + <xsl:element name="图:属性"> + <xsl:element name="图:宽度"><xsl:value-of select="substring-before(@svg:width,'cm')"/></xsl:element> + <xsl:element name="图:高度"><xsl:value-of select="substring-before(@svg:height,'cm')"/></xsl:element> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:template--> + <!--1新增内容--> + <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/> + <xsl:template name="draw"> + <xsl:param name="nodename1"/> + <xsl:choose> + <xsl:when test="substring-after($nodename1,':') = 'a'"> + <xsl:for-each select="child::*"> + <xsl:call-template name="draw"> + <xsl:with-param name="nodename"> + <xsl:value-of select="name()"/> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:when test="substring-after($nodename1,':') = 'g'"> + <xsl:call-template name="draw:g"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="creategraphicstyles"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="draw:g"> + <!--xsl:variable name="picnumber1"> + <xsl:value-of select="count(preceding::draw:g)"/> + </xsl:variable> + <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象"> + <xsl:attribute name="图:标识符"><xsl:value-of select="concat(@draw:style-name,'_',$picnumber1)"/></xsl:attribute> + <xsl:attribute name="图:层次"><xsl:value-of select="@draw:z-index"/></xsl:attribute> + <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute> + </图:图形> + <xsl:for-each select="child::*"> + <xsl:choose> + <xsl:when test="name()='draw:g'"> + <xsl:call-template name="draw:g"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="creategraphicstyles"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each--> + <!--根据新修改的Schema做的修改--> + <xsl:for-each select="child::*"> + <xsl:choose> + <xsl:when test="name()='draw:g'"> + <xsl:call-template name="draw:g"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="creategraphicstyles"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <xsl:call-template name="creategraphicstyles"/> + </xsl:template> + <xsl:template name="zuheliebiao"> + <xsl:param name="allnode"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="../child::*[$pos]"> + <xsl:for-each select="../child::*[$pos]"> + <xsl:variable name="nodepos"> + <!--add by lvxg --> + <xsl:choose> + <xsl:when test="./@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@draw:id"/> + </xsl:otherwise> + </xsl:choose> + <!--end--> + </xsl:variable> + <xsl:variable name="picnumber1"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/> + </xsl:variable> + <xsl:variable name="pic-name1"> + <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/> + </xsl:variable> + <xsl:variable name="allnode1"> + <xsl:value-of select="concat($allnode,',',$pic-name1)"/> + </xsl:variable> + <xsl:call-template name="zuheliebiao"> + <xsl:with-param name="allnode" select="$allnode1"/> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$allnode"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="creategraphicstyles"> + <xsl:variable name="nodename"> + <xsl:value-of select="name()"/> + </xsl:variable> + <xsl:variable name="pic-name"> + <xsl:choose> + <xsl:when test="./@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:when> + <xsl:when test="./@table:end-cell-address"> + <xsl:value-of select="@table:end-cell-address"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./@draw:id"/> + </xsl:otherwise> + </xsl:choose> + <!--end --> + </xsl:variable> + <xsl:variable name="pic-num"> + <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/> + </xsl:variable> + <xsl:variable name="picnumber"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/> + </xsl:variable> + <xsl:call-template name="pic-process"> + <xsl:with-param name="pic-name" select="$pic-name"/> + <xsl:with-param name="nodename" select="$nodename"/> + <xsl:with-param name="picnumber" select="$picnumber"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="pic-process"> + <xsl:param name="pic-name"/> + <xsl:param name="nodename"/> + <xsl:param name="picnumber"/> + <xsl:variable name="aa"> + <xsl:choose> + <xsl:when test="./@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:when> + <xsl:when test="./@table:end-cell-address"> + <xsl:value-of select="@table:end-cell-address"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="./@draw:id"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象"> + <xsl:attribute name="图:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute> + <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when></xsl:choose></xsl:attribute> + <xsl:if test="$nodename='draw:g'"> + <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name | @draw:id"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1 or @draw:id=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute> + </xsl:if> + <xsl:if test=".//office:binary-data"> + <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:variable name="arrow-sign"> + <xsl:choose> + <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end"> + <xsl:value-of select="'1'"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:path'or $nodename='draw:g'"> + <图:预定义图形 uof:locID="g0005"> + <图:类别 uof:locID="g0006"> + <xsl:choose> + <xsl:when test="$nodename='draw:line' and $arrow-sign='1'">62</xsl:when> + <xsl:when test="$nodename='draw:rect'">11</xsl:when> + <xsl:when test="$nodename='draw:line'">61</xsl:when> + <xsl:when test="$nodename='draw:circle'">19</xsl:when> + <xsl:when test="$nodename='draw:polygon'">65</xsl:when> + <xsl:when test="$nodename='draw:polyline'">66</xsl:when> + <xsl:when test="$nodename='draw:ellipse'">19</xsl:when> + <xsl:when test="$nodename='draw:path'">64</xsl:when> + <xsl:when test="$nodename='draw:g'">4</xsl:when> + </xsl:choose> + </图:类别> + <图:名称 uof:locID="g0007"> + <xsl:choose> + <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when> + <xsl:when test="$nodename='draw:line'">Line</xsl:when> + <xsl:when test="$nodename='draw:circle'">Oval</xsl:when> + <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when> + <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when> + <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when> + <xsl:when test="$nodename='draw:path'">Curve</xsl:when> + <xsl:when test="$nodename='draw:g'">group</xsl:when> + </xsl:choose> + </图:名称> + <图:生成软件 uof:locID="g0008">PNG</图:生成软件> + <xsl:if test="./@draw:points or ./@svg:d"> + <图:关键点坐标 uof:locID="g0009" uofattrList="路径"> + <!--xsl:call-template name="draw:points"> + <xsl:with-param name="point" select="./@draw:points"/> + </xsl:call-template--> + <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute> + </图:关键点坐标> + </xsl:if> + <图:属性 uof:locID="g0011"> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$aa]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$aa]) "> + <xsl:call-template name="graphicattr"/> + </xsl:for-each> + <xsl:choose> + <xsl:when test="@svg:x1"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:x"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:width"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + </xsl:choose> + <图:旋转角度 uof:locID="g0025"> + <xsl:choose> + <xsl:when test="@draw:transform"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="@draw:transform"/> + </xsl:variable> + <xsl:variable name="rotate-temp"> + <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/> + </xsl:variable> + <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/> + </xsl:when> + <xsl:otherwise>0.0</xsl:otherwise> + </xsl:choose> + </图:旋转角度> + <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例> + <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例> + <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比> + <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例> + <图:打印对象 uof:locID="g0032">true</图:打印对象> + <图:Web文字 uof:locID="g0033"/> + <!--0820 by lil --> + </图:属性> + </图:预定义图形> + </xsl:when> + </xsl:choose> + <xsl:if test="string(.//text:p)"> + <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接"> + <xsl:if test="$nodename='draw:text-box'"> + <xsl:attribute name="图:文本框">true</xsl:attribute> + <xsl:if test="./@draw:name = /office:document/office:body +//draw:text-box/@draw:chain-next-name"> + <xsl:attribute name="图:前一链接"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body +//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute> + </xsl:if> + <xsl:if test="./@draw:chain-next-name"> + <xsl:attribute name="图:后一链接"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body +//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) "> + <xsl:if test="style:graphic-properties/@fo:padding-left"> + <xsl:attribute name="图:左边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:右边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:上边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:下边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:文字排列方向"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="style:graphic-properties/@fo:wrap-option"> + <xsl:attribute name="图:自动换行">true</xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' or style:graphic-properties/@draw:auto-grow-height='true'"> + <xsl:attribute name="图:大小适应文字">true</xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="text:p"> + <xsl:attribute name="字:标识符"><xsl:value-of select="@text:style-name"/></xsl:attribute> + <xsl:if test="style:paragraph-properties"> + <xsl:apply-templates select="style:paragraph-properties"/> + </xsl:if> + <xsl:call-template name="textp"/> + </xsl:for-each> + </图:文本内容> + </xsl:if> + <图:控制点 uof:locID="g0003" uof:attrList="x坐标 y坐标"> + <xsl:attribute name="图:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute> + </图:控制点> + <!--新增内容--> + <xsl:if test="name(..)='draw:g'"> + <图:组合位置 uof:locID="g0041" uof:attrList="x坐标 y坐标"> + <xsl:attribute name="图:x坐标"><xsl:variable name="minx"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-minx - $minx"/></xsl:when><xsl:otherwise><xsl:variable name="current-x" select="number(substring-before(@svg:x,$uofUnit))"/><xsl:value-of select="$current-x - $minx"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:y坐标"><xsl:variable name="miny"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-miny - $miny"/></xsl:when><xsl:otherwise><xsl:variable name="current-y" select="number(substring-before(@svg:y,$uofUnit))"/><xsl:value-of select="$current-y - $miny"/></xsl:otherwise></xsl:choose></xsl:attribute> + </图:组合位置> + </xsl:if> + <!--Redoffice comment liliang 06.03.28 end--> + </图:图形> + <xsl:if test="name()='draw:image'"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:if test="./office:binary-data"> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="./office:binary-data"/> + </uof:数据> + </xsl:if> + <xsl:if test="@xlink:href"> + <uof:路径 uof:locID="u0038"> + <xsl:value-of select="@xlink:href"/> + </uof:路径> + </xsl:if> + </uof:其他对象> + </xsl:if> + <xsl:if test="name()='draw:frame'"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:if test="draw:image/office:binary-data"> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="draw:image/office:binary-data"/> + </uof:数据> + </xsl:if> + <xsl:if test="@xlink:href"> + <uof:路径 uof:locID="u0038"> + <xsl:value-of select="@xlink:href"/> + </uof:路径> + </xsl:if> + </uof:其他对象> + </xsl:if> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) "> + <xsl:if test="style:graphic-properties/@draw:fill-image-name"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <xsl:variable name="fill-name"> + <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/> + </xsl:variable> + <uof:数据 uof:locID="u0037"> + <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]"> + <xsl:value-of select="office:binary-data"/> + </xsl:for-each> + </uof:数据> + <uof:路径 uof:locID="u0038"> + <xsl:value-of select="@xlink:href"/> + </uof:路径> + </uof:其他对象> + </xsl:if> + </xsl:for-each> + </xsl:template> + <!--Redoffice comment liliang 06.03.29--> + <!--新增内容--> + <xsl:template name="graphicattr"> + <xsl:variable name="aa" select="@style:name"/> + <xsl:if test="not(style:graphic-properties/@draw:fill='none')"> + <图:填充 uof:locID="g0012"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:fill='gradient'"> + <xsl:variable name="gradient-name"> + <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/> + </xsl:variable> + <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]"> + <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型"> + <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute> + <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute> + <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute> + <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute> + <xsl:variable name="angle"> + <xsl:value-of select="@draw:angle div 10"/> + </xsl:variable> + <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0<$angle and $angle<25">0</xsl:when><xsl:when test="25<$angle and $angle<70">45</xsl:when><xsl:when test="70<$angle and $angle<115">90</xsl:when><xsl:when test="115<$angle and $angle<160">135</xsl:when><xsl:when test="160<$angle and $angle<205">180</xsl:when><xsl:when test="205<$angle and $angle<250">225</xsl:when><xsl:when test="250<$angle and $angle<295">270</xsl:when><xsl:when test="295<$angle and $angle<340">315</xsl:when><xsl:when test="340<$angle and $angle<360">360</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute> + <xsl:if test="@draw:cx"> + <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="@draw:cy"> + <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:类型">-2</xsl:attribute> + </图:渐变> + </xsl:for-each> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:fill-image-name"> + <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称"> + <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:图形引用"><xsl:value-of select="concat($aa,'_b1')"/></xsl:attribute> + <xsl:attribute name="图:类型">png</xsl:attribute> + <xsl:attribute name="图:名称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute> + </图:图片> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:fill='hatch'"> + <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色"> + <xsl:if test="/office:document/office:styles/draw:hatch/@draw:name"> + <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:图形引用">rogr1</xsl:attribute> + <xsl:if test="/office:document/office:styles/draw:hatch/@draw:color"> + <xsl:attribute name="图:前景色"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute> + </图:图案> + </xsl:when> + <xsl:otherwise> + <图:颜色 uof:locID="g0034"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:fill-color"> + <xsl:value-of select="style:graphic-properties/@draw:fill-color"/> + </xsl:when> + <xsl:otherwise>#99ccff</xsl:otherwise> + </xsl:choose> + </图:颜色> + </xsl:otherwise> + </xsl:choose> + </图:填充> + </xsl:if> + <xsl:if test="style:graphic-properties/@svg:stroke-color"> + <图:线颜色 uof:locID="g0013"> + <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/> + </图:线颜色> + </xsl:if> + <图:线型 uof:locID="g0014"> + <xsl:call-template name="表:线型"/> + </图:线型> + <xsl:if test="style:graphic-properties/@svg:stroke-width"> + <图:线粗细 uof:locID="g0016"> + <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/> + </图:线粗细> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)>0"> + <图:前端箭头 uof:locID="g0017"> + <图:式样 uof:locID="g0018"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Line Arrow'">open</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow concave'">stealth</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Square 45'">diamond</xsl:when> + <xsl:otherwise>normal</xsl:otherwise> + </xsl:choose> + </图:式样> + <xsl:if test="style:graphic-properties/@draw:marker-start-width"> + <图:大小 uof:locID="g0019"> + <xsl:variable name="width"> + <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="($width<0.05 and 0<$width) or $width=0.05">1</xsl:when> + <xsl:when test="($width<0.10 and 0.05<$width) or $width=0.10">2</xsl:when> + <xsl:when test="($width<0.15 and 0.10<$width) or $width=0.15">3</xsl:when> + <xsl:when test="($width<0.20 and 0.15<$width) or $width=0.20">4</xsl:when> + <xsl:when test="($width<0.25 and 0.20<$width) or $width=0.25">5</xsl:when> + <xsl:when test="($width<0.30 and 0.25<$width) or $width=0.30">6</xsl:when> + <xsl:when test="($width<0.35 and 0.30<$width) or $width=0.35">7</xsl:when> + <xsl:when test="($width<0.40 and 0.35<$width) or $width=0.40">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </图:大小> + </xsl:if> + </图:前端箭头> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:marker-end"> + <!--0820 by lil --> + <图:后端箭头 uof:locID="g0020"> + <图:式样 uof:locID="g0021"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Line Arrow'">open</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow concave'">stealth</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Square 45'">diamond</xsl:when> + <xsl:otherwise>normal</xsl:otherwise> + </xsl:choose> + </图:式样> + <xsl:if test="style:graphic-properties/@draw:marker-end-width"> + <图:大小 uof:locID="g0022"> + <xsl:variable name="width"> + <xsl:value-of select="number(substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit))"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="($width<0.05 and 0<$width) or $width=0.05">1</xsl:when> + <xsl:when test="($width<0.10 and 0.05<$width) or $width=0.10">2</xsl:when> + <xsl:when test="($width<0.15 and 0.10<$width) or $width=0.15">3</xsl:when> + <xsl:when test="($width<0.20 and 0.15<$width) or $width=0.20">4</xsl:when> + <xsl:when test="($width<0.25 and 0.20<$width) or $width=0.25">5</xsl:when> + <xsl:when test="($width<0.30 and 0.25<$width) or $width=0.30">6</xsl:when> + <xsl:when test="($width<0.35 and 0.30<$width) or $width=0.35">7</xsl:when> + <xsl:when test="($width<0.40 and 0.35<$width) or $width=0.40">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </图:大小> + </xsl:if> + </图:后端箭头> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:opacity"> + <xsl:variable name="trans" select="style:graphic-properties/@draw:opacity"/> + <图:透明度 uof:locID="g0038"> + <xsl:value-of select="substring($trans,1,2)"/> + </图:透明度> + </xsl:if> + </xsl:template> + <xsl:template name="groupminx"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:x][position()=$pos]"> + <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/> + <xsl:call-template name="groupminx"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$othervalue"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--Redoffice comment liliang end 06.03.29--> + <!--Redoffice comment liliang 06.03.29--> + <!--新增内容--> + <xsl:template name="groupminy"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:y][position()=$pos]"> + <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/> + <xsl:call-template name="groupminy"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$othervalue"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="groupmaxx"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:x][position()=$pos]"> + <xsl:variable name="svgx"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="width"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:width,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="othervalue" select="$svgx + $width"/> + <xsl:call-template name="groupminx"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$othervalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="groupmaxy"> + <xsl:param name="value"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="descendant::node()[@svg:y][position()=$pos]"> + <xsl:variable name="svgy"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="height"> + <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:height,$uofUnit))"/> + </xsl:variable> + <xsl:variable name="othervalue" select="$svgy + $height"/> + <xsl:call-template name="groupminy"> + <xsl:with-param name="value"> + <xsl:choose> + <xsl:when test="$value>$othervalue"> + <xsl:value-of select="$value"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$othervalue"/> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--Redoffice comment liliang end 06.03.29--> + <xsl:template name="draw:points"> + <xsl:param name="point"/> + <xsl:param name="lujing"/> + <xsl:choose> + <xsl:when test="contains($point,' ' )"> + <xsl:variable name="first-point" select="substring-before($point,' ')"/> + <xsl:variable name="other-point" select="substring-after($point,' ')"/> + <xsl:variable name="xzuobiao"> + <xsl:value-of select="substring-before($first-point,',') div 1000"/> + </xsl:variable> + <xsl:variable name="yzuobiao"> + <xsl:value-of select="substring-after($first-point,',') div 1000"/> + </xsl:variable> + <xsl:call-template name="draw:points"> + <xsl:with-param name="point" select="$other-point"/> + <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="xzuobiao"> + <xsl:value-of select="substring-before($point,',') div 1000"/> + </xsl:variable> + <xsl:variable name="yzuobiao"> + <xsl:value-of select="substring-after($point,',') div 1000"/> + </xsl:variable> + <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--Redoffice comment end liliang--> + <!--chenjh add 20050624--> + <xsl:template name="create-page-setting"> + <xsl:param name="master-page"/> + <xsl:param name="page-master-style"/> + <xsl:element name="表:页面设置"> + <xsl:attribute name="uof:locID">s0029</xsl:attribute> + <xsl:attribute name="uof:attrList">名称</xsl:attribute> + <xsl:attribute name="表:名称"><xsl:value-of select="$master-page/@style:name"/></xsl:attribute> + <xsl:element name="表:纸张"> + <xsl:attribute name="uof:locID">s0030</xsl:attribute> + <xsl:attribute name="uof:attrList">纸型 宽度 高度</xsl:attribute> + <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="$page-master-style/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="$page-master-style/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$width='29.699cm' and $height='42cm'">A3</xsl:when><xsl:when test="not($page-master-style/@fo:page-height) and not($page-master-style/@fo:page-width)">A4</xsl:when><xsl:when test="$width='14.799cm' and $height='20.999cm'">A5</xsl:when><xsl:when test="$width='25cm' and $height='35.299cm'">B4</xsl:when><xsl:when test="$width='17.598cm' and $height='25cm'">B5</xsl:when><xsl:when test="$width='12.499cm' and $height='17.598cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="$page-master-style/@fo:page-width"><xsl:value-of select="substring-before($page-master-style/@fo:page-width,$uofUnit)"/></xsl:when><xsl:otherwise><xsl:call-template name="setDefaultPageWidth"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="$page-master-style/@fo:page-height"><xsl:value-of select="substring-before($page-master-style/@fo:page-height,$uofUnit)"/></xsl:when><xsl:otherwise><xsl:call-template name="setDefaultPageHeight"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:element name="表:纸张方向"> + <xsl:attribute name="uof:locID">s0031</xsl:attribute> + <xsl:choose> + <xsl:when test="$page-master-style/@style:print-orientation"> + <xsl:value-of select="$page-master-style/@style:print-orientation"/> + </xsl:when> + <xsl:otherwise>portrait</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="表:缩放"> + <xsl:attribute name="uof:locID">s0032</xsl:attribute> + <xsl:choose> + <xsl:when test="$page-master-style/@style:scale-to"> + <xsl:value-of select="$page-master-style/@style:scale-to"/> + </xsl:when> + <xsl:otherwise>100</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="$page-master-style/@fo:margin-left or $page-master-style/@fo:margin-top or $page-master-style/@fo:margin-right or $page-master-style/@fo:margin-bottom"> + <xsl:element name="表:页边距"> + <xsl:attribute name="uof:locID">s0033</xsl:attribute> + <xsl:attribute name="uof:attrList">左 上 右 下</xsl:attribute> + <xsl:attribute name="uof:左"><xsl:value-of select="substring-before($page-master-style/@fo:margin-left,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:上"><xsl:value-of select="substring-before($page-master-style/@fo:margin-top,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:右"><xsl:value-of select="substring-before($page-master-style/@fo:margin-right,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="uof:下"><xsl:value-of select="substring-before($page-master-style/@fo:margin-bottom,$uofUnit)"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:for-each select="$master-page[@style:page-layout-name='pm1']/style:header/child::*"> + <表:页眉页脚 uof:locID="s0034" uof:attrList="位置"> + <xsl:attribute name="表:位置"><xsl:choose><xsl:when test="name()='style:region-left'">headerleft</xsl:when><xsl:when test="name()='style:region-right'">headerright</xsl:when><xsl:otherwise>headercenter</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:call-template name="create-page-header-footer-paragraph"> + <xsl:with-param name="paragraph-set" select="text:p"/> + </xsl:call-template> + </表:页眉页脚> + </xsl:for-each> + <xsl:for-each select="$master-page[@style:page-layout-name='pm1']/style:footer/child::*"> + <表:页眉页脚 uof:locID="s0034" uof:attrList="位置"> + <xsl:attribute name="表:位置"><xsl:choose><xsl:when test="name()='style:region-left'">footerleft</xsl:when><xsl:when test="name()='style:region-right'">footerright</xsl:when><xsl:otherwise>footercenter</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:call-template name="create-page-header-footer-paragraph"> + <xsl:with-param name="paragraph-set" select="text:p"/> + </xsl:call-template> + </表:页眉页脚> + </xsl:for-each> + <xsl:if test="$page-master-style/@style:print-page-order or $page-master-style/@style:print"> + <表:打印 uof:locID="s126" uof:attrList="网格线 行号列标 按草稿方式 先列后行"> + <xsl:if test="$page-master-style/@style:print-page-order='ltr'"> + <xsl:attribute name="表:先列后行">true</xsl:attribute> + </xsl:if> + <xsl:if test="contains($page-master-style/@style:print,'grid')"> + <xsl:attribute name="表:网格线">true</xsl:attribute> + </xsl:if> + </表:打印> + </xsl:if> + <xsl:if test="$page-master-style/@style:table-centering='vertical' or $page-master-style/@style:table-centering='both'"> + <表:垂直对齐 uof:locID="s0128" uof:attrList="对齐方式"> + <xsl:attribute name="表:对齐方式">center</xsl:attribute> + </表:垂直对齐> + </xsl:if> + <xsl:if test="$page-master-style/@style:table-centering='horizontal' or $page-master-style/@style:table-centering='both'"> + <表:水平对齐 uof:locID="s0129" uof:attrList="对齐方式"> + <xsl:attribute name="表:对齐方式">center</xsl:attribute> + </表:水平对齐> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="create-page-header-footer-paragraph"> + <xsl:param name="paragraph-set"/> + <xsl:choose> + <xsl:when test="$paragraph-set"> + <xsl:element name="字:段落"> + <xsl:attribute name="uof:locID">t0051</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:element name="字:句"> + <xsl:attribute name="uof:locID">t0085</xsl:attribute> + <xsl:apply-templates select="$paragraph-set//text()"> + <xsl:with-param name="bText" select="'0'"/> + </xsl:apply-templates> + </xsl:element> + </xsl:element> + <xsl:call-template name="create-page-header-footer-paragraph"> + <xsl:with-param name="paragraph-set" select="$paragraph-set[position()!=1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template match="text:p" name="textp"> + <xsl:apply-templates select="text()|text:span|text:tab-stop|text:line-break|text:s|text:ruby|text:bookmark|text:bookmark-start|text:bookmark-end|text:a|text:footnote|text:endnote"> + <xsl:with-param name="bText" select="'1'"/> + <xsl:with-param name="sText" select="'1'"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="text:a"> + <xsl:param name="bText"/> + <xsl:choose> + <xsl:when test="$bText='0'"> + <xsl:element name="字:句"> + <xsl:attribute name="uof:locID">t0085</xsl:attribute> + <xsl:element name="字:区域开始"> + <xsl:attribute name="字:标识符"><xsl:value-of select="generate-id(.)"/></xsl:attribute> + <xsl:attribute name="字:类型">hyperlink</xsl:attribute> + <xsl:attribute name="uof:locID">t0121</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:区域开始"> + <xsl:attribute name="字:标识符"><xsl:value-of select="generate-id(.)"/></xsl:attribute> + <xsl:attribute name="字:类型">hyperlink</xsl:attribute> + <xsl:attribute name="uof:locID">t0121</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="text()"> + <xsl:param name="bText"/> + <xsl:param name="sText"/> + <xsl:if test="normalize-space(.)!=''"> + <xsl:choose> + <xsl:when test="$bText='1' and $sText='1'"> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + </xsl:when> + <xsl:otherwise> + <字:文本串 uof:locID="t0109" uof:attrList="udsPath"> + <xsl:value-of select="."/> + </字:文本串> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="text:span"> + <xsl:param name="bText"/> + <xsl:choose> + <xsl:when test="$bText='0'"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </字:句属性> + <xsl:apply-templates select="text:s|text()|text:line-break|text:tab-stop| text:a | text:footnote|text:endnote|draw:image|office:annotation|draw:frame"> + <xsl:with-param name="bText" select="1"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用" 字:式样引用="{@text:style-name}"/> + <xsl:apply-templates select="text:s|text()|text:line-break|text:tab-stop| text:a |text:footnote|text:endnote|draw:image|office:annotation|draw:frame"> + <xsl:with-param name="bText" select="1"/> + </xsl:apply-templates> + </字:句> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="text:s"> + <xsl:param name="bText"/> + <xsl:choose> + <xsl:when test="$bText='0'"> + <xsl:variable name="count"> + <xsl:choose> + <xsl:when test="not(@text:c)">1</xsl:when> + <xsl:otherwise> + <xsl:value-of select="@text:c"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <字:句 uof:locID="t0085"> + <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/> + </字:句> + </xsl:when> + <xsl:otherwise> + <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="text:line-break"> + <xsl:param name="bText"/> + <xsl:choose> + <xsl:when test="$bText='0'"> + <字:句 uof:locID="t0085"> + <字:换行符 uof:locID="t0124"/> + </字:句> + </xsl:when> + <xsl:otherwise> + <字:换行符 uof:locID="t0124"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="text:tab-stop"> + <xsl:param name="bText"/> + <xsl:choose> + <xsl:when test="$bText='0'"> + <字:句 uof:locID="t0085"> + <字:制表符 uof:locID="t0123"/> + </字:句> + </xsl:when> + <xsl:otherwise> + <字:制表符 uof:locID="t0123"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--chenjh0713--> + <!--chenjh0629E--> + <!--chenjh add 20050629 --> + <!--字符串转换为数字--> + <xsl:template name="translate-column-char-to-number"> + <xsl:param name="string"/> + <xsl:choose> + <xsl:when test="string-length($string)=1"> + <xsl:call-template name="char-to-number"> + <xsl:with-param name="char" select="$string"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="tens-place"> + <xsl:call-template name="char-to-number"> + <xsl:with-param name="char" select="substring($string,1,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="units-place"> + <xsl:call-template name="char-to-number"> + <xsl:with-param name="char" select="substring($string,2,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$tens-place * 26 + $units-place"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="char-to-number"> + <xsl:param name="char"/> + <xsl:choose> + <xsl:when test="$char='A'">1</xsl:when> + <xsl:when test="$char='B'">2</xsl:when> + <xsl:when test="$char='C'">3</xsl:when> + <xsl:when test="$char='D'">4</xsl:when> + <xsl:when test="$char='E'">5</xsl:when> + <xsl:when test="$char='F'">6</xsl:when> + <xsl:when test="$char='G'">7</xsl:when> + <xsl:when test="$char='H'">8</xsl:when> + <xsl:when test="$char='I'">9</xsl:when> + <xsl:when test="$char='J'">10</xsl:when> + <xsl:when test="$char='K'">11</xsl:when> + <xsl:when test="$char='L'">12</xsl:when> + <xsl:when test="$char='M'">13</xsl:when> + <xsl:when test="$char='N'">14</xsl:when> + <xsl:when test="$char='O'">15</xsl:when> + <xsl:when test="$char='P'">16</xsl:when> + <xsl:when test="$char='Q'">17</xsl:when> + <xsl:when test="$char='R'">18</xsl:when> + <xsl:when test="$char='S'">19</xsl:when> + <xsl:when test="$char='T'">20</xsl:when> + <xsl:when test="$char='U'">21</xsl:when> + <xsl:when test="$char='V'">22</xsl:when> + <xsl:when test="$char='W'">23</xsl:when> + <xsl:when test="$char='X'">24</xsl:when> + <xsl:when test="$char='Y'">25</xsl:when> + <xsl:when test="$char='Z'">26</xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="create-filter-conditions"> + <xsl:param name="filter-condition-set"/> + <xsl:param name="zone-left-column-num"/> + <xsl:if test="$filter-condition-set"> + <xsl:variable name="first-condition" select="$filter-condition-set"/> + <xsl:element name="表:条件"> + <xsl:attribute name="uof:locID">s0103</xsl:attribute> + <xsl:attribute name="uof:attrList">列号</xsl:attribute> + <xsl:attribute name="表:列号"><xsl:value-of select="$zone-left-column-num + $first-condition/@table:field-number"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$first-condition/@table:operator ='top values'"> + <xsl:element name="表:普通"> + <xsl:attribute name="uof:locID">s0104</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 值</xsl:attribute> + <xsl:attribute name="表:类型">topitem</xsl:attribute> + <xsl:attribute name="表:值"><xsl:value-of select="$first-condition/@table:value"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="表:自定义"> + <xsl:attribute name="uof:locID">s0105</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:element name="表:操作条件"> + <xsl:attribute name="uof:locID">s0106</xsl:attribute> + <!--redoffice comment from lvxg 8.27--> + <xsl:if test="$first-condition/@table:operator"> + <xsl:element name="表:操作码"> + <xsl:attribute name="uof:locID">s0009</xsl:attribute> + <xsl:variable name="operator-text" select="$first-condition/@table:operator"/> + <xsl:choose> + <xsl:when test="$operator-text ='<' ">less than</xsl:when> + <xsl:when test="$operator-text ='>' ">greater than</xsl:when> + <xsl:when test="$operator-text ='=' ">equal to</xsl:when> + <xsl:when test="$operator-text ='>=' ">greater than or equal to</xsl:when> + <xsl:when test="$operator-text ='<=' ">less than or equal to</xsl:when> + <xsl:when test="$operator-text ='!=' ">not equal to</xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="表:值"> + <xsl:attribute name="uof:locID">s0107</xsl:attribute> + <xsl:value-of select="$first-condition/@table:value"/> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:call-template name="create-filter-conditions"> + <xsl:with-param name="filter-condition-set" select="$filter-condition-set[position()!=1]"/> + <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="create-view"> + <xsl:param name="table-name"/> + <xsl:param name="view-id"/> + <!--xsl:param name="ActiveTable"/--> + <xsl:param name="aaa"/> + <!--xsl:variable name="aaa" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed"--> + <xsl:element name="表:视图"> + <xsl:attribute name="uof:locID">s0035</xsl:attribute> + <xsl:attribute name="uof:attrList">窗口标识符</xsl:attribute> + <xsl:attribute name="表:窗口标识符"><xsl:value-of select="$view-id"/></xsl:attribute> + <xsl:if test="$table-name='ActiveTable'"> + <xsl:element name="表:选中"> + <xsl:attribute name="uof:locID">s0036</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值">1</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:variable name="name" select="./@table:name"/> + <xsl:choose> + <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitMode']/text()='2' or $aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=name]/config:config-item[@config:name='VerticalSplitMode']/text()='2' "> + <xsl:element name="表:冻结"> + <xsl:attribute name="uof:locID">s0038</xsl:attribute> + <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute> + <xsl:attribute name="表:行号"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitPosition']/text()"/></xsl:attribute> + <xsl:attribute name="表:列号"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitPosition']/text()"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="表:拆分"> + <xsl:attribute name="uof:locID">s0037</xsl:attribute> + <xsl:attribute name="uof:attrList">宽度 高度</xsl:attribute> + <xsl:attribute name="表:宽度"><xsl:choose><xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitMode']/text()='1'"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitPosition']/text()"/></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="表:高度"><xsl:choose><xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitMode']/text()='1'"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitPosition']/text()"/></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <xsl:element name="表:最上行"> + <xsl:attribute name="uof:locID">s0039</xsl:attribute> + <!--xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$table-name]/config:config-item[@config:name='PositionBottom']/text()+1"/--> + <xsl:choose> + <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionBottom']/text()"> + <xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionBottom']/text()"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="表:最左列"> + <xsl:attribute name="uof:locID">s0040</xsl:attribute> + <!--xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$table-name]/config:config-item[@config:name='PositionLeft']/text() + 1"/--> + <xsl:choose> + <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionRight']/text()"> + <xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionRight']/text()"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="表:当前视图"> + <xsl:attribute name="uof:locID">s0041</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$aaa/config:config-item[@config:name='ShowPageBreakPreview']/text()='true'">page</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:element name="表:网格"> + <xsl:attribute name="uof:locID">s0043</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值"><xsl:choose><xsl:when test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ShowGrid']/text()='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:element name="表:网格颜色"> + <xsl:attribute name="uof:locID">s0044</xsl:attribute> + <xsl:variable name="GridColor-text"> + <xsl:value-of select="//config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='GridColor']/text()"/> + </xsl:variable> + <xsl:variable name="R-color" select="floor($GridColor-text div 65536)"/> + <xsl:variable name="G-color" select="floor(($GridColor-text - ($R-color * 65536)) div 256)"/> + <xsl:variable name="B-color" select="$GridColor-text - ($R-color * 65536)- ($G-color * 256)"/> + <xsl:variable name="R-color-in-16"> + <xsl:call-template name="transform-decimal-to-hexadecimal"> + <xsl:with-param name="color-decimal" select="$R-color"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="G-color-in-16"> + <xsl:call-template name="transform-decimal-to-hexadecimal"> + <xsl:with-param name="color-decimal" select="$G-color"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="B-color-in-16"> + <xsl:call-template name="transform-decimal-to-hexadecimal"> + <xsl:with-param name="color-decimal" select="$B-color"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat('#',$R-color-in-16,$G-color-in-16,$B-color-in-16)"/> + </xsl:element> + <xsl:if test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomType']/text()=0"> + <xsl:element name="表:缩放"> + <xsl:attribute name="uof:locID">s0045</xsl:attribute> + <xsl:value-of select="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomValue']/text()"/> + </xsl:element> + </xsl:if> + <xsl:if test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomType']/text()=1"> + <xsl:element name="表:分页缩放"> + <xsl:attribute name="uof:locID">s0046</xsl:attribute> + <xsl:value-of select="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomValue']/text()"/> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="hexNumber2dec"> + <xsl:param name="hex-value"/> + <xsl:choose> + <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')"> + <xsl:value-of select="10"/> + </xsl:when> + <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')"> + <xsl:value-of select="11"/> + </xsl:when> + <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')"> + <xsl:value-of select="12"/> + </xsl:when> + <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')"> + <xsl:value-of select="13"/> + </xsl:when> + <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')"> + <xsl:value-of select="14"/> + </xsl:when> + <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')"> + <xsl:value-of select="15"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$hex-value"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="hex2decimal"> + <xsl:param name="hex-number"/> + <xsl:param name="index"/> + <xsl:param name="str-length"/> + <xsl:param name="last-value"/> + <xsl:variable name="dec-char"> + <xsl:call-template name="hexNumber2dec"> + <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/> + <xsl:if test="$index < $str-length"> + <xsl:call-template name="hex2decimal"> + <xsl:with-param name="hex-number" select="$hex-number"/> + <xsl:with-param name="index" select="$index + 1"/> + <xsl:with-param name="str-length" select="$str-length"/> + <xsl:with-param name="last-value" select="$current-value"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$index = $str-length"> + <xsl:value-of select="$current-value"/> + </xsl:if> + </xsl:template> + <xsl:template match="table:calculation-settings" mode="common"> + <xsl:if test="@table:precision-as-shown"> + <xsl:element name="表:精确度以显示值为准"> + <xsl:attribute name="uof:locID">s0002</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值"><xsl:value-of select="@table:precision-as-shown"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="表:日期系统-1904"> + <xsl:attribute name="uof:locID">s0003</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值"><xsl:choose><xsl:when test="table:null-date/@table:date-value='1904-01-01'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:if test="table:iteration/@table:status='enable'"> + <表:计算设置 uof:locID="s0004" uof:attrList="迭代次数 偏差值"> + <xsl:attribute name="表:迭代次数"><xsl:value-of select="table:iteration/@table:steps"/></xsl:attribute> + <xsl:attribute name="表:偏差值"><xsl:choose><xsl:when test="table:iteration/@table:maximum-difference"><xsl:value-of select="table:iteration/@table:maximum-difference"/></xsl:when><xsl:otherwise>0.001</xsl:otherwise></xsl:choose><!--xsl:value-of select="table:iteration/@table:maximum-difference"/--></xsl:attribute> + </表:计算设置> + </xsl:if> + </xsl:template> + <xsl:template match="office:automatic-styles" mode="common"> + <xsl:element name="表:条件格式化集"> + <xsl:attribute name="uof:locID">s0016</xsl:attribute> + <xsl:variable name="temp-path" select="../office:automatic-styles/style:style"/> + <xsl:for-each select="$temp-path/style:map"> + <xsl:element name="表:条件格式化"> + <xsl:attribute name="uof:locID">s0017</xsl:attribute> + <xsl:element name="表:区域"> + <xsl:attribute name="uof:locID">s0007</xsl:attribute> + <xsl:variable name="range-name"> + <xsl:value-of select="substring-before(@style:base-cell-address,'.')"/> + </xsl:variable> + <xsl:variable name="range-value"> + <xsl:value-of select="substring-after(@style:base-cell-address,'.')"/> + </xsl:variable> + <xsl:value-of select="concat("'",$range-name,"'",'!$',substring($range-value,1,1),'$',substring($range-value,2))"/> + </xsl:element> + <xsl:element name="表:条件"> + <xsl:attribute name="uof:locID">s0019</xsl:attribute> + <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="contains(@style:condition,'formula')"><xsl:value-of select="'formula'"/></xsl:when><xsl:otherwise><xsl:value-of select="'cell value'"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:element name="表:操作码"> + <xsl:attribute name="uof:locID">s0009</xsl:attribute> + <xsl:choose> + <xsl:when test="contains(@style:condition,'!=')"> + <xsl:value-of select="'not equal to'"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'<=')"> + <xsl:value-of select="'less than or equal to'"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'>=')"> + <xsl:value-of select="'greater than or equal to'"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'<')"> + <xsl:value-of select="'less than'"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'>')"> + <xsl:value-of select="'greater than'"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'=')"> + <xsl:value-of select="'equal to'"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'not-between')"> + <xsl:value-of select="'not-between'"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'between')"> + <xsl:value-of select="'between'"/> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:element name="表:第一操作数"> + <xsl:attribute name="uof:locID">s0010</xsl:attribute> + <xsl:choose> + <xsl:when test="contains(@style:condition,'formula')"> + <xsl:value-of select="substring-after(substring-before(@style:condition,')'),'(')"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'=')"> + <xsl:value-of select="substring-after(@style:condition,'=')"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'<') and not(contains(@style:condition,'<='))"> + <xsl:value-of select="substring-after(@style:condition,'<')"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'>') and not(contains(@style:condition,'>='))"> + <xsl:value-of select="substring-after(@style:condition,'>')"/> + </xsl:when> + <xsl:when test="contains(@style:condition,'between')"> + <xsl:value-of select="substring-before(substring-after(@style:condition,'('),',')"/> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:if test="contains(@style:condition,',')"> + <xsl:element name="表:第二操作数"> + <xsl:attribute name="uof:locID">s0011</xsl:attribute> + <xsl:choose> + <xsl:when test="contains(@style:condition,'between')"> + <xsl:value-of select="substring-before(substring-after(@style:condition,','),')')"/> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="表:格式"> + <xsl:attribute name="uof:locID">s0023</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="表:式样引用"><xsl:value-of select="@style:apply-style-name"/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template match="table:content-validations" mode="common"> + <xsl:element name="表:数据有效性集"> + <xsl:attribute name="uof:locID">s0005</xsl:attribute> + <xsl:call-template name="create-validation-set"> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template name="create-validation-set"> + <xsl:for-each select="//table:content-validation"> + <xsl:element name="表:数据有效性"> + <xsl:attribute name="uof:locID">s0006</xsl:attribute> + <xsl:variable name="conditiontext" select="@table:condition"/> + <xsl:variable name="operatortext" select="substring-after($conditiontext,'and ')"/> + <xsl:element name="表:区域"> + <xsl:attribute name="uof:locID">s0007</xsl:attribute> + <xsl:variable name="left-top"> + <xsl:call-template name="search-left-top-validation"> + <xsl:with-param name="validation-name" select="@table:name"/> + <xsl:with-param name="tableslist" select="/*/office:body/office:spreadsheet/table:table"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="after-translated-left-top"> + <xsl:call-template name="translate-left-top"> + <xsl:with-param name="left-top" select="$left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="base" select="@table:base-cell-address"/> + <xsl:variable name="base-column-and-row" select="substring-after($base,'.')"/> + <xsl:variable name="dd" select="number(substring($base-column-and-row,2,1))"/> + <xsl:variable name="base-column"> + <xsl:choose> + <xsl:when test="contains($dd,'NaN') "> + <xsl:value-of select="substring($base-column-and-row,1,2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring($base-column-and-row,1,1)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="base-row" select="substring-after($base,$base-column)"/> + <xsl:variable name="after-translated-base-left-top"> + <xsl:value-of select="concat('$',substring-before($base,'.'),'.$',$base-column,'$',$base-row)"/> + </xsl:variable> + <xsl:value-of select="concat('$',$after-translated-left-top,':',$after-translated-base-left-top)"/> + </xsl:element> + <xsl:element name="表:校验类型"> + <xsl:attribute name="uof:locID">s0008</xsl:attribute> + <xsl:variable name="listtest">cell-content-is-in-list("</xsl:variable> + <xsl:choose> + <xsl:when test="contains($conditiontext,'cell-content-is-whole-number()')">whole number</xsl:when> + <xsl:when test="contains($conditiontext,'cell-content-is-decimal-number()')">decimal</xsl:when> + <xsl:when test="contains($conditiontext,'cell-content-is-date()')">date</xsl:when> + <xsl:when test="contains($conditiontext,'cell-content-is-time()')">time</xsl:when> + <xsl:when test="contains($conditiontext,'cell-content-is-in-list') and not(contains($conditiontext,$listtest))">cell range</xsl:when> + <xsl:when test="contains($conditiontext,'cell-content-is-in-list') and contains($conditiontext,$listtest)">list</xsl:when> + <xsl:when test="contains($conditiontext,'cell-content-text-length')">text length</xsl:when> + <xsl:otherwise>any value</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="表:操作码"> + <xsl:attribute name="uof:locID">s0009</xsl:attribute> + <xsl:choose> + <xsl:when test="starts-with($operatortext,'cell-content()<=')">less than or equal to</xsl:when> + <xsl:when test="starts-with($operatortext,'cell-content()>=')">greater than or equal to</xsl:when> + <xsl:when test="starts-with($operatortext,'cell-content()<')">less than</xsl:when> + <xsl:when test="starts-with($operatortext,'cell-content()>')">greater than</xsl:when> + <xsl:when test="starts-with($operatortext,'cell-content()!=')">not equal to</xsl:when> + <xsl:when test="starts-with($operatortext,'cell-content()=')">equal to</xsl:when> + <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length()')"> + <xsl:variable name="operator" select="substring-after($conditiontext,'oooc:cell-content-text-length()')"/> + <xsl:choose> + <xsl:when test="starts-with($operator,'<=')">less than or equal to</xsl:when> + <xsl:when test="starts-with($operator,'>=')">greater than or equal to</xsl:when> + <xsl:when test="starts-with($operator,'<')">less than</xsl:when> + <xsl:when test="starts-with($operator,'>')">greater than</xsl:when> + <xsl:when test="starts-with($operator,'!=')">not equal to</xsl:when> + <xsl:when test="starts-with($operator,'=')">equal to</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="contains($conditiontext,'is-between')">between</xsl:when> + <xsl:when test="contains($conditiontext,'is-not-between')">not between</xsl:when> + <!-- 注意:uof有的另几种操作码在oo中没有,他们是contain,not contain,start with,not start with, end with,not end with--> + </xsl:choose> + </xsl:element> + <xsl:element name="表:第一操作数"> + <xsl:attribute name="uof:locID">s0010</xsl:attribute> + <xsl:choose> + <xsl:when test="starts-with($operatortext,'cell-content-is-between')"> + <xsl:value-of select="substring-before(substring-after($operatortext,'cell-content-is-between('),',')"/> + </xsl:when> + <xsl:when test="starts-with($operatortext,'cell-content-is-not-between')"> + <xsl:value-of select="substring-before(substring-after($operatortext,'cell-content-is-not-between('),',')"/> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length()')"> + <xsl:variable name="operator" select="substring-after($conditiontext,'cell-content-text-length()')"/> + <xsl:choose> + <xsl:when test="starts-with($operator,'<=')"> + <xsl:value-of select="substring-after($operator,'<=')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'>=')"> + <xsl:value-of select="substring-after($operator,'>=')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'<')"> + <xsl:value-of select="substring-after($operator,'<')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'>')"> + <xsl:value-of select="substring-after($operator,'>')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'!=')"> + <xsl:value-of select="substring-after($operator,'!=')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'=')"> + <xsl:value-of select="substring-after($operator,'=')"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'oooc:cell-content-is-in-list')"> + <xsl:value-of select="substring-after($conditiontext,'oooc:cell-content-is-in-list')"/> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length-is-not-between')"> + <xsl:value-of select="substring-before(substring-after($conditiontext,'oooc:cell-content-text-length-is-not-between('),',')"/> + </xsl:when> + <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length-is-between')"> + <xsl:value-of select="substring-before(substring-after($conditiontext,'oooc:cell-content-text-length-is-between('),',')"/> + </xsl:when> + <xsl:when test="starts-with($operatortext,'cell-content()')"> + <xsl:variable name="operator" select="substring-after($conditiontext,'oooc:cell-content()')"/> + <xsl:choose> + <xsl:when test="starts-with($operator,'<=')"> + <xsl:value-of select="substring-after($operator,'<=')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'>=')"> + <xsl:value-of select="substring-after($operator,'>=')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'<')"> + <xsl:value-of select="substring-after($operator,'<')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'>')"> + <xsl:value-of select="substring-after($operator,'>')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'!=')"> + <xsl:value-of select="substring-after($operator,'!=')"/> + </xsl:when> + <xsl:when test="starts-with($operator,'=')"> + <xsl:value-of select="substring-after($operator,'=')"/> + </xsl:when> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:if test="starts-with($operatortext,'cell-content-is-between') or starts-with($operatortext,'cell-content-is-not-between')"> + <xsl:element name="表:第二操作数"> + <xsl:attribute name="uof:locID">s0011</xsl:attribute> + <xsl:value-of select="substring-before(substring-after($operatortext,','),')')"/> + </xsl:element> + </xsl:if> + <xsl:if test="starts-with($conditiontext,'oooc:cell-content-text-length-is-not-between') or starts-with($conditiontext,'oooc:cell-content-text-length-is-between')"> + <xsl:element name="表:第二操作数"> + <xsl:attribute name="uof:locID">s0011</xsl:attribute> + <xsl:value-of select="substring-before(substring-after($conditiontext,','),')')"/> + </xsl:element> + </xsl:if> + <xsl:element name="表:忽略空格"> + <xsl:attribute name="uof:locID">s0012</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值"><xsl:value-of select="@table:allow-empty-cell"/></xsl:attribute> + </xsl:element> + <xsl:if test="contains($conditiontext,'cell-content-is-in-list') "> + <xsl:element name="表:下拉箭头"> + <xsl:attribute name="uof:locID">s0013</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="表:值">false</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="table:help-message"> + <xsl:element name="表:输入提示"> + <xsl:attribute name="uof:locID">s0014</xsl:attribute> + <xsl:attribute name="uof:attrList">显示 标题 内容</xsl:attribute> + <xsl:attribute name="表:显示"><xsl:value-of select="table:help-message/@table:display"/></xsl:attribute> + <xsl:attribute name="表:标题"><xsl:choose><xsl:when test="table:help-message/@table:title"><xsl:value-of select="table:help-message/@table:title"/></xsl:when><xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:variable name="content"> + <xsl:call-template name="create-help-error-message-content"> + <xsl:with-param name="text-p-set" select="table:help-message/text:p"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="表:内容"><xsl:value-of select="$content"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="table:error-message"> + <xsl:element name="表:错误提示"> + <xsl:attribute name="uof:locID">s0015</xsl:attribute> + <xsl:attribute name="uof:attrList">显示 类型 标题 内容</xsl:attribute> + <xsl:attribute name="表:显示"><xsl:value-of select="table:error-message/@table:display"/></xsl:attribute> + <xsl:attribute name="表:类型"><xsl:value-of select="table:error-message/@table:message-type"/></xsl:attribute> + <xsl:attribute name="表:标题"><xsl:choose><xsl:when test="table:error-message/@table:title"><xsl:value-of select="table:error-message/@table:title"/></xsl:when><xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:variable name="content"> + <xsl:call-template name="create-help-error-message-content"> + <xsl:with-param name="text-p-set" select="table:error-message/text:p"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="表:内容"><xsl:value-of select="$content"/></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:template> + <xsl:template name="search-left-top-validation"> + <xsl:param name="validation-name"/> + <xsl:param name="tableslist"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$tableslist and $return=''"> + <xsl:variable name="firsttablerows" select="$tableslist[1]//table:table-row"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-validation-inatable"> + <xsl:with-param name="row-num" select="'1'"/> + <xsl:with-param name="firsttablerows" select="$firsttablerows"/> + <xsl:with-param name="validation-name" select="$validation-name"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-validation"> + <xsl:with-param name="validation-name" select="$validation-name"/> + <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top!=''"> + <xsl:value-of select="$rest-left-top"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="translate-left-top"> + <xsl:param name="left-top"/> + <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/> + <xsl:variable name="column-number1"> + <xsl:value-of select="floor( $column-number div 26 )"/> + </xsl:variable> + <xsl:variable name="column-number2"> + <xsl:value-of select="$column-number mod 26"/> + </xsl:variable> + <xsl:variable name="column-character1"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-character2"> + <xsl:call-template name="number-to-character"> + <xsl:with-param name="number" select="$column-number2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat(substring-before($left-top,'.'),'.','$',$column-character1,$column-character2,'$',substring-after($left-top,' '))"/> + </xsl:template> + <xsl:template name="create-help-error-message-content"> + <xsl:param name="text-p-set"/> + <xsl:if test="$text-p-set"> + <!--此处有问题!!!!应该是有一个模块调用等--> + <!--xsl:value-of select="' '"/--> + <xsl:value-of select="$text-p-set"/> + <xsl:call-template name="create-help-error-message-content"> + <xsl:with-param name="text-p-set" select="$text-p-set[position()!=1]"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="search-left-top-validation-inatable"> + <xsl:param name="row-num"/> + <xsl:param name="firsttablerows"/> + <xsl:param name="validation-name"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$firsttablerows and $return=''"> + <xsl:variable name="firstcells" select="$firsttablerows[1]/table:table-cell"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-validation-inarow"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="column-num" select="'1'"/> + <xsl:with-param name="firstcells" select="$firstcells"/> + <xsl:with-param name="validation-name" select="$validation-name"/> + <xsl:with-param name="return" select="''"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="row-num-p"> + <xsl:choose> + <xsl:when test="$firsttablerows[1]/@table:number-rows-repeated"> + <xsl:value-of select="$row-num+ $firsttablerows[1]/@table:number-rows-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$row-num+1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-validation-inatable"> + <xsl:with-param name="row-num" select="$row-num-p"/> + <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/> + <xsl:with-param name="validation-name" select="$validation-name"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top !=''"> + <xsl:value-of select="$rest-left-top "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="number-to-character"> + <xsl:param name="number"/> + <xsl:choose> + <xsl:when test="$number = 0"/> + <xsl:when test="$number = 1">A</xsl:when> + <xsl:when test="$number = 2">B</xsl:when> + <xsl:when test="$number = 3">C</xsl:when> + <xsl:when test="$number = 4">D</xsl:when> + <xsl:when test="$number = 5">E</xsl:when> + <xsl:when test="$number = 6">F</xsl:when> + <xsl:when test="$number = 7">G</xsl:when> + <xsl:when test="$number = 8">H</xsl:when> + <xsl:when test="$number = 9">I</xsl:when> + <xsl:when test="$number = 10">J</xsl:when> + <xsl:when test="$number = 11">K</xsl:when> + <xsl:when test="$number = 12">L</xsl:when> + <xsl:when test="$number = 13">M</xsl:when> + <xsl:when test="$number = 14">N</xsl:when> + <xsl:when test="$number = 15">O</xsl:when> + <xsl:when test="$number = 16">P</xsl:when> + <xsl:when test="$number = 17">Q</xsl:when> + <xsl:when test="$number = 18">R</xsl:when> + <xsl:when test="$number = 19">S</xsl:when> + <xsl:when test="$number = 20">T</xsl:when> + <xsl:when test="$number = 21">U</xsl:when> + <xsl:when test="$number = 22">V</xsl:when> + <xsl:when test="$number = 23">W</xsl:when> + <xsl:when test="$number = 24">X</xsl:when> + <xsl:when test="$number = 25">Y</xsl:when> + <xsl:when test="$number = 26">Z</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="search-left-top-validation-inacell"> + <xsl:param name="row-num"/> + <xsl:param name="column-num"/> + <xsl:param name="cell"/> + <xsl:param name="validation-name"/> + <xsl:choose> + <xsl:when test="$cell/@table:content-validation-name=$validation-name"> + <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="search-left-top-validation-inarow"> + <xsl:param name="row-num"/> + <xsl:param name="column-num"/> + <xsl:param name="firstcells"/> + <xsl:param name="validation-name"/> + <xsl:param name="return"/> + <xsl:choose> + <xsl:when test="$firstcells and $return=''"> + <xsl:variable name="firstcell" select="$firstcells[1]"/> + <xsl:variable name="first-left-top"> + <xsl:call-template name="search-left-top-validation-inacell"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="column-num" select="$column-num"/> + <xsl:with-param name="cell" select="$firstcell"/> + <xsl:with-param name="validation-name" select="$validation-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="column-num-p"> + <xsl:choose> + <xsl:when test="$firstcell/@table:number-columns-repeated"> + <xsl:value-of select="$column-num+ $firstcell/@table:number-columns-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$column-num+ 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="rest-left-top"> + <xsl:call-template name="search-left-top-validation-inarow"> + <xsl:with-param name="row-num" select="$row-num"/> + <xsl:with-param name="column-num" select="$column-num-p"/> + <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/> + <xsl:with-param name="validation-name" select="$validation-name"/> + <xsl:with-param name="return" select="$first-left-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$first-left-top!=''"> + <xsl:value-of select="$first-left-top"/> + </xsl:when> + <xsl:when test="$rest-left-top !=''"> + <xsl:value-of select="$rest-left-top "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="''"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$return"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/uof/odf2uof_text.xsl b/filter/source/xslt/export/uof/odf2uof_text.xsl new file mode 100644 index 000000000..4ca67c256 --- /dev/null +++ b/filter/source/xslt/export/uof/odf2uof_text.xsl @@ -0,0 +1,4456 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + * 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="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/> + <!--xsl:key name="colWidth" match="/office:automatic/style:style/" use="@style:column-width"/--> + <xsl:variable name="swValueWithUnit"> + <xsl:value-of select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/@fo:page-width"/> + </xsl:variable> + <xsl:variable name="uofUnit"> + <xsl:choose> + <xsl:when test="contains($swValueWithUnit,'in')">inch</xsl:when> + <xsl:when test="contains($swValueWithUnit,'cm')">cm</xsl:when> + <xsl:when test="contains($swValueWithUnit,'mm')">mm</xsl:when> + <xsl:when test="contains($swValueWithUnit,'pt')">pt</xsl:when> + <xsl:otherwise>inch</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="ooUnit"> + <xsl:choose> + <xsl:when test="contains($swValueWithUnit,'in')">inch</xsl:when> + <xsl:when test="contains($swValueWithUnit,'cm')">cm</xsl:when> + <xsl:when test="contains($swValueWithUnit,'mm')">mm</xsl:when> + <xsl:when test="contains($swValueWithUnit,'pt')">pt</xsl:when> + <xsl:otherwise>inch</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:template match="/"> + <xsl:apply-templates select="office:document"/> + </xsl:template> + <xsl:template match="office:document"> + <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" uof:language="cn" uof:locID="u0000" uof:version="1.0" uof:mimetype="vnd.uof.text"> + <xsl:apply-templates select="office:meta"/> + <xsl:if test="/office:document/office:body/office:text/text:p/text:bookmark-start|/office:document/office:body/office:text/text:p/text:bookmark"> + <uof:书签集 uof:locID="u0027"> + <xsl:for-each select="/office:document/office:body/office:text/text:p/text:bookmark-start|/office:document/office:body/office:text/text:p/text:bookmark"> + <uof:书签 uof:locID="u0028" uof:attrList="名称"> + <xsl:attribute name="uof:名称"><xsl:value-of select="@text:name"/></xsl:attribute> + <uof:文本位置 uof:locID="u0029" uof:attrList="区域引用"> + <xsl:attribute name="字:区域引用"><xsl:value-of select="generate-id()"/></xsl:attribute> + </uof:文本位置> + </uof:书签> + </xsl:for-each> + </uof:书签集> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:a | /office:document/office:body/office:text/text:p/draw:a | /office:document/office:body/office:text/table:table/table:table-row/table:table-cell/text:p/text:a | /office:document/office:body/office:text/text:table-of-content/text:index-body/text:p/text:a"> + <uof:链接集 uof:locID="u0031"> + <xsl:for-each select="/office:document/office:body/office:text/text:p/text:a | /office:document/office:body/office:text/text:p/draw:a | /office:document/office:body/office:text/table:table/table:table-row/table:table-cell/text:p/text:a | /office:document/office:body/office:text/text:table-of-content/text:index-body/text:p/text:a"> + <xsl:variable name="hyperStr" select="@xlink:href"/> + <uof:超级链接 uof:locID="u0032" uof:attrList="标识符 目标 书签 式样引用 已访问式样引用 提示 链源"> + <xsl:if test="contains($hyperStr,'#')"> + <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute> + </xsl:if> + <xsl:variable name="num"> + <xsl:number from="/office:document/office:body/office:text" level="any" count="text:a | table:table/table:table-row/table:table-cell/text:a"/> + </xsl:variable> + <xsl:attribute name="uof:链源"><xsl:value-of select="concat('hlnk',$num)"/></xsl:attribute> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('hyk_','hlnk',$num)"/></xsl:attribute> + <xsl:if test="not(contains($hyperStr,'#'))"> + <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute> + </xsl:if> + <xsl:if test="@office:name"> + <xsl:attribute name="uof:提示"><xsl:value-of select="@office:name"/></xsl:attribute> + </xsl:if> + <xsl:if test="@text:style-name"> + <xsl:attribute name="uof:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="@text:visited-style-name"> + <xsl:attribute name="uof:已访问式样引用"><xsl:value-of select="@text:visited-style-name"/></xsl:attribute> + </xsl:if> + </uof:超级链接> + </xsl:for-each> + </uof:链接集> + </xsl:if> + <uof:式样集 uof:locID="u0039"> + <xsl:apply-templates select="office:font-face-decls"/> + <xsl:call-template name="自动编号集"/> + <xsl:call-template name="shiyang"/> + <xsl:apply-templates select="office:automatic-styles/style:style" mode="style"/> + </uof:式样集> + <uof:对象集 uof:locID="u0033"> + <xsl:for-each select="/office:document/office:body/office:text/draw:*"> + <xsl:variable name="nodename1"> + <xsl:value-of select="name()"/> + </xsl:variable> + <xsl:call-template name="draw"> + <xsl:with-param name="nodename1" select="$nodename1"/> + </xsl:call-template> + </xsl:for-each> + <xsl:apply-templates select="/office:document/office:body/office:text//text:p" mode="styles"/> + <xsl:apply-templates select="/office:document/office:master-styles/style:master-page/style:header/text:p" mode="styles"/> + <xsl:apply-templates select="/office:document/office:master-styles/style:master-page/style:footer/text:p" mode="styles"/> + <xsl:for-each select="(/office:document/office:styles/style:style/style:paragraph-properties/style:background-image) | (/office:document/office:automatic-styles/style:style/style:paragraph-properties/style:background-image) | (/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image) | /office:document/office:automatic-styles/style:style/style:table-cell-properties/style:background-image | /office:document/office:automatic-styles/style:style/style:table-properties/style:background-image | /office:document/office:automatic-styles/style:style/style:graphic-properties/style:background-image"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('background-image_',count(preceding::style:background-image))"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="office:binary-data"/> + </uof:数据> + </uof:其他对象> + </xsl:for-each> + <xsl:for-each select="(/office:document/office:styles/text:list-style/text:list-level-style-image) | (/office:document/office:automatic-styles/text:list-style/text:list-level-style-image)"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="office:binary-data"/> + </uof:数据> + </uof:其他对象> + </xsl:for-each> + <xsl:for-each select="/office:document/office:styles/draw:fill-image"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="office:binary-data"/> + </uof:数据> + </uof:其他对象> + </xsl:for-each> + <!--xsl:apply-templates select="/office:document/office:automatic-styles/style:style[@style:family = 'graphics']"/> + <xsl:apply-templates select="office:styles/style:style[@style:family = 'graphics']"/> + <xsl:apply-templates select="office:styles/style:default-style [@style:family = 'graphics']"/--> + </uof:对象集> + <uof:文字处理 uof:locID="u0047"> + <字:公用处理规则 uof:locID="t0000"> + <xsl:apply-templates select="office:settings"/> + <xsl:call-template name="GetUsers"/> + <xsl:call-template name="GetTrackChanges"/> + <xsl:call-template name="GetAnnotations"/> + </字:公用处理规则> + <字:主体 uof:locID="t0016"> + <xsl:for-each select="office:automatic-styles/style:page-layout[@style:name='pm1']"> + <xsl:call-template name="style:page-layout"/> + </xsl:for-each> + <!--xsl:call-template name="office:automatic-styles/style:page-layout[@style:name='pm1']"/--> + <!--xsl:apply-templates select="office:automatic-styles/style:page-layout[@style:name='pm1']"/--> + <xsl:apply-templates select="office:body/office:text"/> + <xsl:call-template name="logic-chapter"/> + </字:主体> + </uof:文字处理> + </uof:UOF> + </xsl:template> + <xsl:template name="logic-chapter"> + <xsl:element name="字:逻辑章节"> + <xsl:attribute name="uof:locID">t0050</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="GetAnnotations"> + <xsl:if test="/*/office:body/office:text//office:annotation "> + <字:批注集 uof:locID="t0014"> + <xsl:for-each select="/*/office:body/office:text//office:annotation"> + <字:批注 uof:locID="t0015" uof:attrList="区域引用 作者 日期 作者缩写"> + <xsl:attribute name="字:作者"><xsl:value-of select="generate-id()"/></xsl:attribute> + <xsl:attribute name="字:日期"><xsl:value-of select="dc:date"/></xsl:attribute> + <xsl:attribute name="字:区域引用">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute> + <xsl:for-each select="./node()"> + <xsl:choose> + <xsl:when test="name()='text:p'"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name()='table:table'"> + <xsl:call-template name="exec_table"/> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </字:批注> + </xsl:for-each> + </字:批注集> + </xsl:if> + </xsl:template> + <xsl:template name="GetTrackChanges"> + <xsl:if test="/*/office:body/office:text/text:tracked-changes"> + <字:修订信息集 uof:locID="t0012"> + <xsl:for-each select="/*/office:body/office:text/text:tracked-changes/text:changed-region"> + <字:修订信息 字:标识符="{@text:id}" 字:作者="{generate-id()}" 字:日期="{node()//office:change-info/dc:date}" uof:locID="t0013" uof:attrList="标识符 作者 日期"/> + </xsl:for-each> + </字:修订信息集> + </xsl:if> + </xsl:template> + <xsl:template name="GetUsers"> + <xsl:if test="/*/office:body/office:text/text:tracked-changes//office:change-info/dc:creator or //office:annotation/@office:author or //office:annotation/dc:creator"> + <字:用户集 uof:locID="t0010"> + <xsl:for-each select="/*/office:body/office:text/text:tracked-changes/text:changed-region"> + <字:用户 字:标识符="{generate-id()}" 字:姓名="{node()//office:change-info/dc:creator}" uof:locID="t0011" uof:attrList="标识符 姓名"/> + </xsl:for-each> + <xsl:for-each select="//office:annotation"> + <字:用户 字:标识符="{generate-id()}" 字:姓名="{dc:creator}" uof:locID="t0011" uof:attrList="标识符 姓名"/> + </xsl:for-each> + </字:用户集> + </xsl:if> + </xsl:template> + <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/> + <xsl:template match="text:p" mode="styles"> + <xsl:for-each select="child::*"> + <xsl:variable name="nodename1"> + <xsl:value-of select="name()"/> + </xsl:variable> + <xsl:if test="(substring-before($nodename1,':') = 'draw')"> + <xsl:call-template name="draw"> + <xsl:with-param name="nodename1" select="$nodename1"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="draw"> + <xsl:param name="nodename1"/> + <xsl:choose> + <xsl:when test="substring-after($nodename1,':') = 'a'"> + <xsl:for-each select="child::*"> + <xsl:call-template name="draw"> + <xsl:with-param name="nodename"> + <xsl:value-of select="name()"/> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:when test="substring-after($nodename1,':') = 'g'"> + <xsl:call-template name="draw:g"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="creategraphicstyles"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="draw:g"> + <xsl:variable name="picnumber1"> + <xsl:value-of select="count(preceding::draw:g)"/> + </xsl:variable> + <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象"> + <xsl:attribute name="图:标识符"><xsl:value-of select="concat(@draw:style-name,'_',$picnumber1)"/></xsl:attribute> + <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when><xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute> + </图:图形> + <xsl:for-each select="child::*"> + <xsl:choose> + <xsl:when test="name()='draw:g'"> + <xsl:call-template name="draw:g"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="creategraphicstyles"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="zuheliebiao"> + <xsl:param name="allnode"/> + <xsl:param name="pos"/> + <xsl:choose> + <xsl:when test="../child::*[$pos]"> + <xsl:for-each select="../child::*[$pos]"> + <xsl:variable name="nodepos"> + <xsl:value-of select="@draw:style-name"/> + </xsl:variable> + <xsl:variable name="picnumber1"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/> + </xsl:variable> + <xsl:variable name="pic-name1"> + <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/> + </xsl:variable> + <xsl:variable name="allnode1"> + <xsl:value-of select="concat($allnode,',',$pic-name1)"/> + </xsl:variable> + <xsl:call-template name="zuheliebiao"> + <xsl:with-param name="allnode" select="$allnode1"/> + <xsl:with-param name="pos" select="$pos+1"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$allnode"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="creategraphicstyles"> + <xsl:variable name="nodename"> + <xsl:value-of select="name()"/> + </xsl:variable> + <xsl:variable name="pic-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:variable> + <xsl:variable name="pic-num"> + <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/> + </xsl:variable> + <xsl:variable name="picnumber"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/> + </xsl:variable> + <xsl:call-template name="pic-process"> + <xsl:with-param name="pic-name" select="$pic-name"/> + <xsl:with-param name="nodename" select="$nodename"/> + <xsl:with-param name="picnumber" select="$picnumber"/> + </xsl:call-template> + </xsl:template> + <!--xsl:key match="/office:document/office:automatic-styles/style:style" name="graphicset" use="@style:name"/> + + <xsl:template match="style:style[@style:family = 'graphics']"> + <xsl:variable name="pic-name"> + <xsl:value-of select="@style:name"/> + </xsl:variable> + <xsl:variable name="pic-num"> + <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/> + </xsl:variable> + <xsl:call-template name="pic-process"> + <xsl:with-param name="pic-name" select="$pic-name"/> + <xsl:with-param name="pic-num" select="$pic-num"/> + <xsl:with-param name="current-num" select="1"/> + </xsl:call-template> + </xsl:template--> + <xsl:template name="pic-process"> + <xsl:param name="pic-name"/> + <xsl:param name="nodename"/> + <xsl:param name="picnumber"/> + <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象"> + <xsl:attribute name="图:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute> + <xsl:attribute name="图:层次"><xsl:value-of select="@draw:z-index"/></xsl:attribute> + <xsl:if test=".//office:binary-data"> + <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:variable name="arrow-sign"> + <xsl:choose> + <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end"> + <xsl:value-of select="'1'"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:path'or $nodename='draw:g' or $nodename='draw:text-box' or child::draw:text-box"> + <图:预定义图形 uof:locID="g0005"> + <图:类别 uof:locID="g0006"> + <xsl:choose> + <xsl:when test="$nodename='draw:line' and $arrow-sign='1'">62</xsl:when> + <xsl:when test="$nodename='draw:rect'">11</xsl:when> + <xsl:when test="$nodename='draw:line'">61</xsl:when> + <xsl:when test="$nodename='draw:circle'">19</xsl:when> + <xsl:when test="$nodename='draw:polygon'">65</xsl:when> + <xsl:when test="$nodename='draw:polyline'">66</xsl:when> + <xsl:when test="$nodename='draw:ellipse'">19</xsl:when> + <xsl:when test="child::draw:text-box[@fo:min-height]">22</xsl:when> + <xsl:when test="child::draw:text-box">23</xsl:when> + </xsl:choose> + </图:类别> + <图:名称 uof:locID="g0007"> + <xsl:choose> + <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when> + <xsl:when test="$nodename='draw:line'">Line</xsl:when> + <xsl:when test="$nodename='draw:circle'">Oval</xsl:when> + <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when> + <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when> + <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when> + <xsl:when test="$nodename='draw:frame' and child::draw:text-box[@fo:min-height]">排版框</xsl:when> + <xsl:when test="$nodename='draw:frame' and child::draw:text-box">排版框</xsl:when> + </xsl:choose> + </图:名称> + <图:生成软件 uof:locID="g0008">PNG</图:生成软件> + <xsl:if test="./@draw:points or ./@svg:d"> + <图:关键点坐标 uof:locID="g0009" uof:attrList="路径"> + <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute> + </图:关键点坐标> + </xsl:if> + <图:属性 uof:locID="g0011"> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) "> + <xsl:if test="style:graphic-properties/@draw:fill-color or style:graphic-properties/@fo:background-color or style:graphic-properties/@draw:fill-image-name or style:graphic-properties/@draw:fill-gradient-name"> + <图:填充 uof:locID="g0012"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:fill='gradient'"> + <xsl:variable name="gradient-name"> + <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/> + </xsl:variable> + <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]"> + <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型"> + <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute> + <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute> + <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute> + <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute> + <xsl:variable name="angle"> + <xsl:value-of select="@draw:angle div 10"/> + </xsl:variable> + <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0<$angle and $angle<25">0</xsl:when><xsl:when test="25<$angle and $angle<70">45</xsl:when><xsl:when test="70<$angle and $angle<115">90</xsl:when><xsl:when test="115<$angle and $angle<160">135</xsl:when><xsl:when test="160<$angle and $angle<205">180</xsl:when><xsl:when test="205<$angle and $angle<250">225</xsl:when><xsl:when test="250<$angle and $angle<295">270</xsl:when><xsl:when test="295<$angle and $angle<340">315</xsl:when><xsl:when test="340<$angle and $angle<360">360</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute> + <xsl:if test="@draw:cx"> + <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute> + </xsl:if> + <xsl:if test="@draw:cy"> + <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:类型">-2</xsl:attribute> + </图:渐变> + </xsl:for-each> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:fill-image-name or style:graphic-properties/style:background-image/office:binary-data"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:fill-image-name"> + <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称"> + <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:图形引用"><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:attribute> + <xsl:attribute name="图:类型">png</xsl:attribute> + <xsl:attribute name="图:名称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute> + </图:图片> + </xsl:when> + <xsl:when test="style:graphic-properties/style:background-image/office:binary-data"> + <xsl:for-each select="style:graphic-properties"> + <xsl:call-template name="图:填充"/> + </xsl:for-each> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:fill='hatch'"> + <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色"> + <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute> + <xsl:attribute name="图:图形引用"/> + <xsl:attribute name="图:前景色"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute> + <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute> + </图:图案> + </xsl:when> + <xsl:otherwise> + <图:颜色 uof:locID="g0034"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:fill-color"> + <xsl:value-of select="style:graphic-properties/@draw:fill-color"/> + </xsl:when> + <xsl:when test="style:graphic-properties/@fo:background-color"> + <xsl:value-of select="style:graphic-properties/@fo:background-color"/> + </xsl:when> + <xsl:otherwise>#99ccff</xsl:otherwise> + </xsl:choose> + </图:颜色> + </xsl:otherwise> + </xsl:choose> + </图:填充> + </xsl:if> + <xsl:if test="style:graphic-properties/@svg:stroke-color"> + <图:线颜色 uof:locID="g0013"> + <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/> + </图:线颜色> + </xsl:if> + <图:线型 uof:locID="g0014"> + <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/> + <xsl:choose> + <xsl:when test="style:graphic-properties/@fo:border='none'">none</xsl:when> + <xsl:when test="not(style:graphic-properties/@draw:stroke)"> + <xsl:choose> + <xsl:when test="not(style:graphic-properties/@svg:stroke-width)">single</xsl:when> + <xsl:otherwise>thick</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:stroke = 'none'">none</xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$linetype='Fine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dash-long-heavy</xsl:when> + <xsl:when test="$linetype='Fine_20_Dashed'">dash-long</xsl:when> + <xsl:when test="$linetype='2 Dots 1 Dash' and style:graphic-properties/@svg:stroke-width">dash-dot-dot-heavy</xsl:when> + <xsl:when test="$linetype='2 Dots 1 Dash'">dot-dot-dash</xsl:when> + <xsl:when test="$linetype='Ultrafine Dashed' and style:graphic-properties/@svg:stroke-width">dashed-heavy</xsl:when> + <xsl:when test="$linetype='Ultrafine Dotted (var)'and style:graphic-properties/@svg:stroke-width">dotted-heavy</xsl:when> + <xsl:when test="$linetype='Ultrafine Dotted (var)'">dotted</xsl:when> + <xsl:when test="$linetype='Line with Fine Dots'">double</xsl:when> + <xsl:when test="$linetype='3 Dashes 3 Dots (var)' and style:graphic-properties/@svg:stroke-width">dash-dot-heavy</xsl:when> + <xsl:when test="$linetype='3 Dashes 3 Dots (var)'">dot-dash</xsl:when> + <xsl:when test="$linetype='Ultrafine 2 Dots 3 Dashes'and style:graphic-properties/@svg:stroke-width">wavy-heavy</xsl:when> + <xsl:when test="$linetype='Ultrafine 2 Dots 3 Dashes'">wave</xsl:when> + <xsl:when test="$linetype='Fine Dashed (var)'">wavy-double</xsl:when> + <xsl:otherwise>dash</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </图:线型> + <xsl:if test="style:graphic-properties/@svg:stroke-width"> + <图:线粗细 uof:locID="g0016"> + <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/> + </图:线粗细> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)>0"> + <图:前端箭头 uof:locID="g0017"> + <图:式样 uof:locID="g0018"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Line Arrow'">open</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow concave'">stealth</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-start='Square 45'">diamond</xsl:when> + <xsl:otherwise>normal</xsl:otherwise> + </xsl:choose> + </图:式样> + <图:大小 uof:locID="g0019"> + <xsl:choose> + <xsl:when test="not(style:graphic-properties/@draw:marker-start-width)">4</xsl:when> + <xsl:otherwise> + <xsl:call-template name="graphsize"> + <xsl:with-param name="width" select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/> + <xsl:with-param name="Unitofsize" select="$uofUnit"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </图:大小> + </图:前端箭头> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:marker-end"> + <图:后端箭头 uof:locID="g0017"> + <图:式样 uof:locID="g0018"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Line Arrow'">open</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow concave'">stealth</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when> + <xsl:when test="style:graphic-properties/@draw:marker-end='Square 45'">diamond</xsl:when> + <xsl:otherwise>normal</xsl:otherwise> + </xsl:choose> + </图:式样> + <图:大小 uof:locID="g0022"> + <xsl:choose> + <xsl:when test="not(style:properties/@draw:marker-start-width)">4</xsl:when> + <xsl:otherwise> + <xsl:variable name="width"> + <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="(not($width>0.05) and 0<$width) or $width=0.05">1</xsl:when> + <xsl:when test="(not($width>0.10) and 0.05<$width) or $width=0.10">2</xsl:when> + <xsl:when test="(not($width>0.15) and 0.10<$width) or $width=0.15">3</xsl:when> + <xsl:when test="(not($width>0.20) and 0.15<$width) or $width=0.20">4</xsl:when> + <xsl:when test="(not($width>0.25) and 0.20<$width) or $width=0.25">5</xsl:when> + <xsl:when test="(not($width>0.30) and 0.25<$width) or $width=0.30">6</xsl:when> + <xsl:when test="(not($width>0.35) and 0.30<$width) or $width=0.35">7</xsl:when> + <xsl:when test="(not($width>0.40) and 0.35<$width) or $width=0.40">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </图:大小> + </图:后端箭头> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:opacity or style:graphic-properties/@draw:transparency"> + <图:透明度 uof:locID="g0038"> + <xsl:choose> + <xsl:when test="style:graphic-properties/@draw:transparency"> + <xsl:value-of select="substring-before(style:graphic-properties/@draw:transparency,'%')"/> + </xsl:when> + <xsl:when test="style:graphic-properties/@draw:opacity"> + <xsl:value-of select="100 - substring-before(style:graphic-properties/@draw:opacity,'%')"/> + </xsl:when> + </xsl:choose> + </图:透明度> + </xsl:if> + </xsl:for-each> + <xsl:choose> + <xsl:when test="@svg:x1"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:x"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="child::draw:text-box/@fo:min-height"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(child::draw:text-box/@fo:min-height,$uofUnit)"/> + </图:高度> + </xsl:when> + <xsl:when test="@svg:width"> + <图:宽度 uof:locID="g0023"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </图:宽度> + <图:高度 uof:locID="g0024"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </图:高度> + </xsl:when> + </xsl:choose> + <图:旋转角度 uof:locID="g0025"> + <xsl:choose> + <xsl:when test="@draw:transform"> + <xsl:variable name="rotate-angle"> + <xsl:value-of select="@draw:transform"/> + </xsl:variable> + <xsl:variable name="rotate-temp"> + <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/> + </xsl:variable> + <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/> + </xsl:when> + <xsl:otherwise>0.0</xsl:otherwise> + </xsl:choose> + </图:旋转角度> + <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例> + <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例> + <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比> + <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例> + <图:打印对象 uof:locID="g0032">true</图:打印对象> + <图:Web文字 uof:locID="g0033"/> + </图:属性> + </图:预定义图形> + </xsl:when> + <xsl:when test="name()='draw:path'"> + <图:svg图形对象 图:version="1.1" 图:xmlns_xlink="http://www.w3.org/1999/xlink"> + <xsl:attribute name="图:x"><xsl:value-of select="@svg:x"/></xsl:attribute> + <xsl:attribute name="图:y"><xsl:value-of select="@svg:y"/></xsl:attribute> + <xsl:attribute name="图:width"><xsl:value-of select="@svg:width"/></xsl:attribute> + <xsl:attribute name="图:height"><xsl:value-of select="@svg:height"/></xsl:attribute> + <xsl:attribute name="图:viewBox"><xsl:value-of select="@svg:viewBox"/></xsl:attribute> + <图:path> + <xsl:attribute name="图:d"><xsl:value-of select="@svg:d"/></xsl:attribute> + </图:path> + </图:svg图形对象> + </xsl:when> + </xsl:choose> + <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接"> + <xsl:if test="./draw:text-box"> + <xsl:attribute name="图:文本框">true</xsl:attribute> + <xsl:if test="./@draw:name = /office:document/office:body/office:text//draw:text-box/@draw:chain-next-name"> + <xsl:attribute name="图:前一链接"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body/office:text//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute> + </xsl:if> + <xsl:if test="./@draw:chain-next-name"> + <xsl:attribute name="图:后一链接"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body/office:text//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) "> + <xsl:if test="style:text-properties/@fo:padding-left"> + <xsl:attribute name="图:左边距"><xsl:value-of select="style:text-properties/@fo:padding-left"/></xsl:attribute> + <xsl:attribute name="图:右边距"><xsl:value-of select="style:text-properties/@fo:padding-right"/></xsl:attribute> + <xsl:attribute name="图:上边距"><xsl:value-of select="style:text-properties/@fo:padding-top"/></xsl:attribute> + <xsl:attribute name="图:下边距"><xsl:value-of select="style:text-properties/@fo:padding-bottom"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="图:文字排列方向"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:graphic-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when><xsl:when test="style:paragraph-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="style:text-properties/@fo:wrap-option"> + <xsl:attribute name="图:自动换行">true</xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:textarea-horizontal-align"> + <xsl:attribute name="图:水平对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-horizontal-align"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:textarea-vertical-align"> + <xsl:attribute name="图:垂直对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-vertical-align"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'"> + <xsl:attribute name="图:大小适应文字"><xsl:choose><xsl:when test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="text:p"> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <xsl:if test="style:paragraph-properties"> + <字:段落属性 uof:locID="t0052" uof:attrList="式样引用"> + <xsl:apply-templates select="style:paragraph-properties"/> + </字:段落属性> + </xsl:if> + <xsl:call-template name="textp"/> + </字:段落> + </xsl:for-each> + <xsl:for-each select="draw:text-box/text:p"> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <xsl:if test="style:paragraph-properties"> + <字:段落属性 uof:locID="t0052" uof:attrList="式样引用"> + <xsl:apply-templates select="style:paragraph-properties"/> + </字:段落属性> + </xsl:if> + <xsl:call-template name="textp"/> + </字:段落> + </xsl:for-each> + </图:文本内容> + <xsl:if test="@svg:x and @svg:y"> + <图:控制点 uof:locID="g0003" uof:attrList="x坐标 y坐标"> + <xsl:attribute name="图:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="图:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute> + </图:控制点> + </xsl:if> + </图:图形> + <xsl:if test="name()='draw:frame' and ./draw:image"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <xsl:variable name="pic"> + <xsl:choose> + <xsl:when test="contains(./draw:image/@xlink:href,'.png')">png</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.jpg')">jpg</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.gif')">gif</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.bmp')">bmp</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.pbm')">pbm</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.ras')">ras</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.txt')">text</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.xml')">xml</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.htm')">html</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.html')">html</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.wav')">wav</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.mid')">midi</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.ra')">ra</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.au')">au</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.mp3')">mp3</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.snd')">snd</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.svg')">svg</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.avi')">avi</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.mpeg')">mpeg4</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.qt')">qt</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.rm')">rm</xsl:when> + <xsl:when test="contains(./draw:image/@xlink:href,'.asf')">asf</xsl:when> + <xsl:otherwise>图片</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$pic!='图片'"> + <xsl:attribute name="uof:公共类型"><xsl:value-of select="$pic"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="uof:私有类型">图片</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="./draw:image/office:binary-data"> + <uof:数据 uof:locID="u0037"> + <xsl:value-of select="./draw:image/office:binary-data"/> + </uof:数据> + </xsl:if> + <xsl:if test="./draw:image/@xlink:href"> + <uof:路径 uof:locID="u0038"> + <xsl:value-of select="./draw:image/@xlink:href"/> + </uof:路径> + </xsl:if> + </uof:其他对象> + </xsl:if> + <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) "> + <xsl:if test="style:text-properties/@draw:fill-image-name"> + <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型"> + <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'-b1')"/></xsl:attribute> + <xsl:attribute name="uof:公共类型">png</xsl:attribute> + <xsl:attribute name="uof:内嵌">true</xsl:attribute> + <xsl:variable name="fill-name"> + <xsl:value-of select="style:text-properties/@draw:fill-image-name"/> + </xsl:variable> + <uof:数据 uof:locID="u0037"> + <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]"> + <xsl:value-of select="office:binary-data"/> + </xsl:for-each> + </uof:数据> + <uof:路径 uof:locID="u0038"> + <xsl:value-of select="@xlink:href"/> + </uof:路径> + </uof:其他对象> + </xsl:if> + </xsl:for-each> + </xsl:template> + <xsl:template name="draw:points"> + <xsl:param name="point"/> + <xsl:param name="lujing"/> + <xsl:choose> + <xsl:when test="contains($point,' ' )"> + <xsl:variable name="first-point" select="substring-before($point,' ')"/> + <xsl:variable name="other-point" select="substring-after($point,' ')"/> + <xsl:variable name="xzuobiao"> + <xsl:value-of select="substring-before($first-point,',') div 1000"/> + </xsl:variable> + <xsl:variable name="yzuobiao"> + <xsl:value-of select="substring-after($first-point,',') div 1000"/> + </xsl:variable> + <xsl:call-template name="draw:points"> + <xsl:with-param name="point" select="$other-point"/> + <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="xzuobiao"> + <xsl:value-of select="substring-before($point,',') div 1000"/> + </xsl:variable> + <xsl:variable name="yzuobiao"> + <xsl:value-of select="substring-after($point,',') div 1000"/> + </xsl:variable> + <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="office:meta"> + <uof:元数据 uof:locID="u0001"> + <uof:标题 uof:locID="u0002"> + <xsl:value-of select="dc:title"/> + </uof:标题> + <uof:创建应用程序 uof:locID="u0011"> + <xsl:value-of select="meta:generator"/> + </uof:创建应用程序> + <uof:摘要 uof:locID="u0007"> + <xsl:value-of select="dc:description"/> + </uof:摘要> + <uof:主题 uof:locID="u0003"> + <xsl:value-of select="dc:subject"/> + </uof:主题> + <uof:创建者 uof:locID="u0004"> + <xsl:value-of select="meta:initial-creator"/> + </uof:创建者> + <!--uof:作者 uof:locID="u0005"> + <xsl:value-of select="meta:initial-creator"/> + </uof:作者--> + <uof:创建日期 uof:locID="u0008"> + <xsl:value-of select="meta:creation-date"/> + </uof:创建日期> + <uof:最后作者 uof:locID="u0006"> + <xsl:value-of select="dc:creator"/> + </uof:最后作者> + <uof:关键字集 uof:locID="u0014"> + <xsl:for-each select="."> + <uof:关键字 uof:locID="u0015"> + <xsl:value-of select="meta:keywords/@meta:keyword"/> + </uof:关键字> + </xsl:for-each> + </uof:关键字集> + <uof:编辑次数 uof:locID="u0009"> + <xsl:value-of select="meta:editing-cycles"/> + </uof:编辑次数> + <xsl:if test="meta:editing-duration"> + <uof:编辑时间 uof:locID="u0010"> + <xsl:value-of select="meta:editing-duration"/> + </uof:编辑时间> + </xsl:if> + <xsl:if test="meta:template/@xlink:href"> + <uof:文档模板 uof:locID="u0013"> + <xsl:value-of select="meta:template/@xlink:href"/> + </uof:文档模板> + </xsl:if> + <xsl:if test="meta:user-defined/@meta:name"> + <uof:用户自定义元数据集 uof:locID="u0016"> + <xsl:for-each select="meta:user-defined"> + <uof:用户自定义元数据 uof:locID="u0017" uof:attrList="名称 类型"> + <xsl:attribute name="uof:名称"><xsl:value-of select="@meta:name"/></xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute> + </uof:用户自定义元数据> + </xsl:for-each> + </uof:用户自定义元数据集> + </xsl:if> + <!--xsl:if test="meta:document-statistic/@meta:page-count"--> + <uof:页数 uof:locID="u0020"> + <xsl:value-of select="meta:document-statistic/@meta:page-count"/> + </uof:页数> + <!--/xsl:if--> + <!--xsl:if test="meta:document-statistic/@meta:paragraph-count"--> + <uof:段落数 uof:locID="u0025"> + <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/> + </uof:段落数> + <!--/xsl:if--> + <!--xsl:if test="meta:document-statistic/@meta:object-count"--> + <uof:对象数 uof:locID="u0026"> + <xsl:value-of select="meta:document-statistic/@meta:object-count"/> + </uof:对象数> + <!--/xsl:if--> + <!--xsl:if test="meta:document-statistic/@meta:character-count"--> + <uof:字数 uof:locID="u0021"> + <xsl:value-of select="meta:document-statistic/@meta:character-count"/> + </uof:字数> + <!--/xsl:if--> + <!--xsl:if test="meta:document-statistic/@meta:word-count"--> + <uof:中文字符数 uof:locID="u0023"> + <xsl:value-of select="meta:document-statistic/@meta:word-count"/> + </uof:中文字符数> + <!--/xsl:if--> + <uof:英文字符数 uof:locID="u0022"> + <xsl:value-of select="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count"/> + </uof:英文字符数> + <uof:行数 uof:locID="u0024"> + <xsl:variable name="quzhi"> + <xsl:value-of select="(meta:document-statistic/@meta:character-count div 39) + 0.9"/> + </xsl:variable> + <xsl:value-of select="substring-before($quzhi,'.')"/> + </uof:行数> + <uof:分类 uof:locID="u0012"> + <xsl:value-of select="meta:user-defined[@meta:name='Category']"/> + </uof:分类> + <uof:经理名称 uof:locID="u0019"> + <xsl:value-of select="meta:user-defined[meta:name='Manager']"/> + </uof:经理名称> + <uof:公司名称 uof:locID="u0018"> + <xsl:value-of select="meta:user-defined[meta:name='Company']"/> + </uof:公司名称> + </uof:元数据> + </xsl:template> + <xsl:template match="office:font-face-decls"> + <uof:字体集 uof:locID="u0040"> + <xsl:for-each select="style:font-face"> + <xsl:element name="uof:字体声明"> + <xsl:attribute name="uof:attrList">标识符 名称 字体族</xsl:attribute> + <xsl:attribute name="uof:locID">u0041</xsl:attribute> + <xsl:attribute name="uof:名称"><xsl:value-of select="@svg:font-family"/></xsl:attribute> + <xsl:attribute name="uof:标识符"><xsl:value-of select="translate(@style:name,' ','_')"/></xsl:attribute> + <xsl:if test="@style:font-charset= '02'"> + <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute> + </xsl:if> + <xsl:if test="@style:font-family-generic"> + <xsl:choose> + <xsl:when test="@style:font-family-generic = 'swiss'"> + <xsl:attribute name="uof:字体族">Swiss</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='modern'"> + <xsl:attribute name="uof:字体族">Modern</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic='roman'"> + <xsl:attribute name="uof:字体族">Roman</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='script'"> + <xsl:attribute name="uof:字体族">Script</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='decorative'"> + <xsl:attribute name="uof:字体族">Decorative</xsl:attribute> + </xsl:when> + <xsl:when test="@style:font-family-generic ='system'"> + <xsl:attribute name="uof:字体族">System</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="uof:字体族">System</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:for-each> + <xsl:apply-templates select="style:font-decl"/> + </uof:字体集> + </xsl:template> + <xsl:template name="自动编号集"> + <xsl:element name="uof:自动编号集"> + <xsl:attribute name="uof:locID">u0042</xsl:attribute> + <xsl:for-each select="/office:document//text:list-style"> + <xsl:element name="字:自动编号"> + <xsl:attribute name="uof:locID">t0169</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 父编号引用 多级编号</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:if test=".//@text:style-name"> + <xsl:attribute name="字:名称"><xsl:value-of select=".//@text:style-name"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="字:多级编号">true</xsl:attribute> + <xsl:for-each select="./* "> + <xsl:if test="not(number(@text:level)=10)"> + <xsl:element name="字:级别"> + <xsl:attribute name="uof:locID">t0159</xsl:attribute> + <xsl:attribute name="uof:attrList">级别值 编号对齐方式 尾随字符</xsl:attribute> + <xsl:attribute name="字:级别值"><xsl:value-of select="number(@text:level) - 1"/></xsl:attribute> + <xsl:if test="@style:num-suffix"> + <xsl:attribute name="字:尾随字符"><xsl:choose><xsl:when test="@style:num-suffix=' '">space</xsl:when><xsl:when test="@style:num-suffix=' '">tab</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="style:list-level-properties/@fo:text-align"> + <xsl:attribute name="字:编号对齐方式"><xsl:variable name="vv"><xsl:value-of select="style:list-level-properties/@fo:text-align"/></xsl:variable><xsl:choose><xsl:when test="$vv='center' ">center</xsl:when><xsl:when test="$vv='end' ">right</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="@text:bullet-char"> + <xsl:element name="字:项目符号"> + <xsl:attribute name="uof:locID">t0171</xsl:attribute> + <xsl:value-of select="@text:bullet-char"/> + </xsl:element> + </xsl:if> + <xsl:if test="@text:style-name"> + <xsl:element name="字:符号字体"> + <xsl:attribute name="uof:locID">t0160</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="@style:num-format"> + <xsl:choose> + <xsl:when test="string(@style:num-format)='a'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>lower-letter</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='A'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>upper-letter</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='i'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>lower-roman</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='I'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>upper-roman</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='①, ②, ③, ...'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>decimal-enclosed-circle</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='甲, 乙, 丙, ...'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>ideograph-traditional</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='子, 丑, 寅, ...'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>ideograph-zodiac</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='一, 二, 三, ...'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>chinese-counting</xsl:element> + </xsl:when> + <xsl:when test="string(@style:num-format)='壹, 贰, 叁, ...'"> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>chinese-legal-simplified</xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:编号格式"> + <xsl:attribute name="uof:locID">t0162</xsl:attribute>decimal</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:variable name="jibie"> + <xsl:value-of select="position()"/> + </xsl:variable> + <xsl:variable name="xianshijibie"> + <xsl:choose> + <xsl:when test="@text:display-levels"> + <xsl:value-of select="@text:display-levels"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="字:编号格式表示"> + <xsl:attribute name="uof:locID">t0163</xsl:attribute> + <xsl:call-template name="字:编号格式表示"> + <xsl:with-param name="bubianjibie" select="$jibie"/> + <xsl:with-param name="jibie" select="$jibie"/> + <xsl:with-param name="xianshijibie" select="$xianshijibie"/> + <xsl:with-param name="biaoshi" select="concat(string(@style:num-prefix),'%',$jibie,string(@style:num-suffix))"/> + </xsl:call-template> + </xsl:element> + <xsl:if test="office:binary-data"> + <xsl:element name="字:图片符号引用"> + <xsl:attribute name="uof:locID">t0164</xsl:attribute> + <xsl:attribute name="uof:attrList">宽度 高度</xsl:attribute> + <xsl:if test="style:list-level-properties/@fo:width"> + <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:width,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:list-level-properties/@fo:height"> + <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:height,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:margin-left or style:paragraph-properties/@fo:margin-right or style:paragraph-properties/@fo:text-indent"> + <xsl:element name="字:缩进"> + <xsl:attribute name="uof:locID">t0165</xsl:attribute> + <xsl:for-each select="style:paragraph-properties"> + <xsl:call-template name="字:缩进类型"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="style:list-level-properties/@text:min-label-width"> + <xsl:element name="字:制表符位置"> + <xsl:attribute name="uof:locID">t0166</xsl:attribute> + <xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/> + </xsl:element> + </xsl:if> + <xsl:if test="@text:start-value"> + <xsl:element name="字:起始编号"> + <xsl:attribute name="uof:locID">t0167</xsl:attribute> + <xsl:value-of select="@text:start-value"/> + </xsl:element> + </xsl:if> + <xsl:if test="@text:num-regular-exp"> + <xsl:element name="字:正规格式"> + <xsl:attribute name="uof:locID">t0168</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="@text:num-regular-exp"/></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:if> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="shiyang"> + <xsl:for-each select="office:styles/style:style"> + <xsl:choose> + <xsl:when test="@style:family='text'"> + <xsl:element name="uof:句式样"> + <xsl:attribute name="uof:locID">u0043</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:choose> + <xsl:when test="@style:parent-style-name"> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:name"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="字:句属性"/> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <xsl:for-each select="office:automatic-styles/style:style"> + <xsl:choose> + <xsl:when test="@style:family='text'"> + <xsl:element name="uof:句式样"> + <xsl:attribute name="uof:locID">u0043</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">custom</xsl:attribute> + <xsl:choose> + <xsl:when test="@style:parent-style-name"> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="@style:parent-style-name and not(@style:parent-style-name='Standard')"> + <xsl:variable name="stylename" select="@style:parent-style-name"/> + <xsl:for-each select="/office:document/office:styles/style:style[@style:name=$stylename]"> + <xsl:call-template name="字:句属性"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="字:句属性"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <xsl:for-each select="office:styles/style:style"> + <xsl:choose> + <xsl:when test="@style:family='paragraph'"> + <xsl:element name="uof:段落式样"> + <xsl:attribute name="uof:locID">u0044</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:if test="@style:parent-style-name"> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:if test="@style:display-name"> + <xsl:attribute name="字:别名"><xsl:value-of select="@style:display-name"/></xsl:attribute> + </xsl:if> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:call-template name="字:句属性"/> + </xsl:element> + <xsl:call-template name="ParaAttribute"/> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + <xsl:for-each select="office:automatic-styles/style:style"> + <xsl:choose> + <xsl:when test="@style:family='paragraph'"> + <xsl:element name="uof:段落式样"> + <xsl:attribute name="uof:locID">u0044</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">custom</xsl:attribute> + <xsl:if test="@style:parent-style-name"> + <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:call-template name="字:句属性"/> + </xsl:element> + <xsl:call-template name="ParaAttribute"/> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="字:编号格式表示"> + <xsl:param name="bubianjibie"/> + <xsl:param name="jibie"/> + <xsl:param name="xianshijibie"/> + <xsl:param name="biaoshi"/> + <xsl:choose> + <xsl:when test="number($xianshijibie)= 1"> + <xsl:value-of select="$biaoshi"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-prefix"> + <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-prefix"/> + </xsl:variable> + <xsl:variable name="num-suffix"> + <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-suffix"/> + </xsl:variable> + <xsl:call-template name="字:编号格式表示"> + <xsl:with-param name="bubianjibie" select="$bubianjibie"/> + <xsl:with-param name="jibie" select="$jibie -1"/> + <xsl:with-param name="xianshijibie" select="$xianshijibie -1"/> + <xsl:with-param name="biaoshi" select="concat($num-prefix,'%',number($jibie -1),$num-suffix,'.',$biaoshi)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="style:style[ancestor::office:automatic-styles]" mode="style"> + <xsl:for-each select="."> + <xsl:choose> + <xsl:when test="@style:family='table' "> + <xsl:element name="uof:文字表式样"> + <xsl:attribute name="uof:locID">u0045</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:别名"><xsl:value-of select="@style:name"/></xsl:attribute> + <xsl:attribute name="字:类型">auto</xsl:attribute> + <xsl:if test="style:table-properties"> + <xsl:element name="字:宽度"> + <xsl:attribute name="字:绝对宽度"><xsl:value-of select="substring-before(style:table-properties/@style:width,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0130</xsl:attribute> + <xsl:attribute name="uof:attrList">绝对宽度 相对宽度</xsl:attribute> + </xsl:element> + <字:对齐 uof:locID="t0133"> + <xsl:choose> + <xsl:when test="style:table-properties/@table:align='right'">right</xsl:when> + <xsl:when test="style:table-properties/@table:align='center'">center</xsl:when> + <xsl:otherwise>left</xsl:otherwise> + </xsl:choose> + </字:对齐> + </xsl:if> + </xsl:element> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template match="office:settings"> + <字:文档设置 uof:locID="t0001"> + <字:度量单位 uof:locID="t0006"> + <xsl:value-of select="$ooUnit"/> + </字:度量单位> + <字:默认制表位位置 uof:locID="t0004"> + <xsl:variable name="aa" select="substring-before(/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance,$ooUnit)"/> + <xsl:variable name="bb" select="$aa - 0.74"/> + <xsl:value-of select="substring($bb,1,4)"/> + </字:默认制表位位置> + <字:当前视图 uof:locID="t0002"> + <xsl:choose> + <xsl:when test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item[@config:name='InBrowseMode']='false'">page</xsl:when> + <xsl:when test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item[@config:name='InBrowseMode']='true'">web</xsl:when> + <xsl:otherwise>page</xsl:otherwise> + </xsl:choose> + </字:当前视图> + <xsl:if test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry/config:config-item[@config:name='ZoomFactor']"> + <字:缩放 uof:locID="t0003"> + <xsl:value-of select="config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry/config:config-item[@config:name='ZoomFactor']"/> + </字:缩放> + </xsl:if> + <字:修订 uof:locID="t0005"> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="/office:document/office:body/office:text/text:tracked-changes">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </字:修订> + <xsl:if test="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']"> + <字:标点禁则 uof:locID="t0007"> + <字:行首字符 uof:locID="t0008"> + <xsl:value-of select="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']/config:config-item[@config:name='BeginLine']"/> + </字:行首字符> + <字:行尾字符 uof:locID="t0009"> + <xsl:value-of select="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']/config:config-item[@config:name='EndLine']"/> + </字:行尾字符> + </字:标点禁则> + <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']"> + <字:尾注位置 uof:locID="t0210" uof:attrList="位置"> + <xsl:attribute name="字:位置">doc-end</xsl:attribute> + </字:尾注位置> + </xsl:if> + </xsl:if> + </字:文档设置> + </xsl:template> + <xsl:template name="style:page-layout"> + <字:分节 uof:locID="t0017" uof:attrList="名称"> + <xsl:attribute name="字:名称"><xsl:variable name="stylename"><xsl:value-of select="@style:name"/></xsl:variable><xsl:value-of select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$stylename]/@style:name"/></xsl:attribute> + <字:节属性 uof:locID="t0018"> + <字:节类型 uof:locID="t0020">new-page</字:节类型> + <xsl:element name="字:页边距"> + <xsl:attribute name="uof:locID">t0021</xsl:attribute> + <xsl:attribute name="uof:attrList">左 上 右 下</xsl:attribute> + <xsl:attribute name="uof:上"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="uof:左"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-left,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="uof:下"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="uof:右"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-right,$ooUnit)"/></xsl:attribute> + </xsl:element> + <xsl:element name="字:纸张"> + <xsl:attribute name="uof:locID">t0022</xsl:attribute> + <xsl:attribute name="uof:attrList">纸型 宽度 高度</xsl:attribute> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-width,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-height,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="style:page-layout-properties/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="style:page-layout-properties/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$width='29.702cm' and $height='42cm'">A3</xsl:when><xsl:when test="$width='21.001cm' and $height='29.7cm'">A4</xsl:when><xsl:when test="$width='14.799cm' and $height='20.999cm'">A5</xsl:when><xsl:when test="$width='25cm' and $height='35.3cm'">B4</xsl:when><xsl:when test="$width='17.598cm' and $height='25cm'">B5</xsl:when><xsl:when test="$width='12.5cm' and $height='17.6cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:if test="/office:document/office:master-styles/style:master-page/style:header-left"> + <xsl:element name="字:奇偶页页眉页脚不同"> + <xsl:attribute name="uof:locID">t0023</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="字:首页页眉页脚不同"> + <xsl:attribute name="uof:locID">t0024</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">false</xsl:attribute> + </xsl:element> + <xsl:if test="style:header-style/style:header-footer-properties"> + <xsl:element name="字:页眉位置"> + <xsl:attribute name="uof:locID">t0025</xsl:attribute> + <xsl:attribute name="uof:attrList">距边界 距版芯</xsl:attribute> + <xsl:attribute name="字:距边界"><xsl:value-of select="substring-before(style:header-style/style:header-footer-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute> + <xsl:variable name="long1" select="substring-before(style:header-style/style:header-footer-properties/@fo:margin-bottom,$ooUnit)"/> + <xsl:variable name="long2" select="substring-before(style:header-style/style:header-footer-properties/@svg:height,$ooUnit)"/> + <xsl:attribute name="字:距版芯"><xsl:value-of select="$long2 - $long1"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:footer-style/style:header-footer-properties"> + <xsl:element name="字:页脚位置"> + <xsl:attribute name="uof:locID">t0026</xsl:attribute> + <xsl:attribute name="uof:attrList">距边界 距版芯</xsl:attribute> + <xsl:attribute name="字:距边界"><xsl:value-of select="substring-before(style:footer-style/style:header-footer-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute> + <xsl:variable name="long1" select="substring-before(style:footer-style/style:header-footer-properties/@fo:margin-top,$ooUnit)"/> + <xsl:variable name="long2" select="substring-before(style:footer-style/style:header-footer-properties/@svg:height,$ooUnit)"/> + <xsl:attribute name="字:距版芯"><xsl:value-of select="$long2 - $long1"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:variable name="masterPages" select="'Standard'"/> + <xsl:variable name="mp"> + <xsl:value-of select="@style:name"/> + </xsl:variable> + <xsl:for-each select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$mp and @style:name=$masterPages]"> + <xsl:if test="style:header-left or style:header"> + <字:页眉 uof:locID="t0027"> + <xsl:choose> + <xsl:when test="style:header-left"> + <xsl:for-each select="style:header"> + <字:首页页眉 uof:locID="t0030"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="table:table"> + <xsl:for-each select="table:table"> + <xsl:call-template name="exec_table"/> + </xsl:for-each> + </xsl:if> + </字:首页页眉> + </xsl:for-each> + <xsl:for-each select="style:header-left"> + <字:偶数页页眉 uof:locID="t0029"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="table:table"> + <xsl:for-each select="table:table"> + <xsl:call-template name="exec_table"/> + </xsl:for-each> + </xsl:if> + </字:偶数页页眉> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="style:header"> + <字:奇数页页眉 uof:locID="t0028"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="table:table"> + <xsl:for-each select="table:table"> + <xsl:call-template name="exec_table"/> + </xsl:for-each> + </xsl:if> + </字:奇数页页眉> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </字:页眉> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$mp and @style:name=$masterPages]"> + <xsl:if test="style:footer-left or style:footer"> + <字:页脚 uof:locID="t0031"> + <xsl:choose> + <xsl:when test="style:footer-left"> + <xsl:for-each select="style:footer"> + <字:首页页脚 uof:locID="t0034"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="table:table"> + <xsl:for-each select="table:table"> + <xsl:call-template name="exec_table"/> + </xsl:for-each> + </xsl:if> + </字:首页页脚> + </xsl:for-each> + <xsl:for-each select="style:footer-left"> + <字:偶数页页脚 uof:locID="t0033"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="table:table"> + <xsl:for-each select="table:table"> + <xsl:call-template name="exec_table"/> + </xsl:for-each> + </xsl:if> + </字:偶数页页脚> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="style:footer"> + <字:奇数页页脚 uof:locID="t0032"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:if test="table:table"> + <xsl:for-each select="table:table"> + <xsl:call-template name="exec_table"/> + </xsl:for-each> + </xsl:if> + </字:奇数页页脚> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </字:页脚> + </xsl:if> + </xsl:for-each> + <xsl:if test="@style:page-usage"> + <字:对称页边距 uof:locID="t0036" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:page-usage='mirrored'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </字:对称页边距> + </xsl:if> + <xsl:if test="@style:page-usage='mirrored'"> + <xsl:element name="字:拼页"> + <xsl:attribute name="uof:locID">t0037</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">1</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="字:纸张方向"> + <xsl:attribute name="uof:locID">t0038</xsl:attribute> + <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/> + </xsl:element> + <xsl:if test="style:page-layout-properties/@style:paper-tray-name"> + <字:纸张来源 uof:locID="t0039" uof:attrList="首页 其他页" 字:首页="false" 字:其他页="style:page-layout-properties/@style:paper-tray-name"/> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:num-format"> + <xsl:element name="字:页码设置"> + <xsl:attribute name="uof:locID">t0042</xsl:attribute> + <xsl:attribute name="uof:attrList">首页显示 格式 包含章节号 章节起始样式引用 分隔符 起始编号</xsl:attribute> + <xsl:attribute name="字:首页显示">1</xsl:attribute> + <xsl:attribute name="字:格式"><xsl:variable name="format"><xsl:value-of select="style:page-layout-properties/@style:num-format"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute> + <xsl:if test="style:text-properties/@style:first-page-number"> + <xsl:attribute name="字:起始编号"><xsl:value-of select="style:text-properties/@style:first-page-number"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="字:包含章节号">false</xsl:attribute> + <!--xsl:attribute name="字:章节起始样式引用">false</xsl:attribute--> + <xsl:attribute name="字:分隔符">hyphen</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='footnote']"> + <xsl:element name="字:脚注设置"> + <xsl:attribute name="uof:locID">t0040</xsl:attribute> + <xsl:attribute name="uof:attrList">位置 格式 起始编号 编号方式</xsl:attribute> + <xsl:for-each select="/office:document/office:styles/text:notes-configuration[@text:note-class='footnote']"> + <xsl:attribute name="字:位置"><xsl:choose><xsl:when test="@text:footnotes-position='page'">page-bottom</xsl:when><xsl:when test="@text:footnotes-position='document'">below-text</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="字:编号方式"><xsl:choose><xsl:when test="@text:start-numbering-at='document'">continuous</xsl:when><xsl:when test="@text:start-numbering-at='chapter'">section</xsl:when><xsl:when test="@text:start-numbering-at='page'">page</xsl:when></xsl:choose></xsl:attribute> + <xsl:attribute name="字:起始编号"><xsl:value-of select="@text:start-value + 1"/></xsl:attribute> + <xsl:attribute name="字:格式"><xsl:variable name="format"><xsl:value-of select="@style:num-format"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']"> + <字:尾注设置 uof:locID="t0041" uof:attrList="格式 起始编号 编号方式"> + <xsl:for-each select="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']"> + <xsl:attribute name="字:格式"><xsl:variable name="format"><xsl:value-of select="@style:num-format"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="字:起始编号"><xsl:value-of select="@text:start-value + 1"/></xsl:attribute> + </xsl:for-each> + </字:尾注设置> + </xsl:if> + <xsl:if test="/office:document/office:styles/text:linenumbering-configuration"> + <字:行号设置 uof:locID="t0043" uof:attrList="使用行号 编号方式 起始编号 距边界 行号间隔"> + <xsl:for-each select="/office:document/office:styles/text:linenumbering-configuration"> + <xsl:choose> + <xsl:when test="@text:number-lines='false'"> + <xsl:attribute name="字:使用行号">false</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:使用行号">true</xsl:attribute> + <xsl:attribute name="字:编号方式"><xsl:choose><xsl:when test="@text:count-in-floating-frames='true'">section</xsl:when><xsl:when test="@text:restart-on-page='true'">page</xsl:when><xsl:when test="@text:count-empty-lines='false'"/><xsl:otherwise>continuous</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@style:num-format"> + <xsl:attribute name="字:起始编号"><xsl:value-of select="@style:num-format"/></xsl:attribute> + </xsl:if> + <xsl:if test="@text:offset"> + <xsl:attribute name="字:距边界"><xsl:value-of select="substring-before(@text:offset,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@text:increment"> + <xsl:attribute name="字:行号间隔"><xsl:value-of select="@text:increment"/></xsl:attribute> + </xsl:if> + </xsl:for-each> + </字:行号设置> + </xsl:if> + <xsl:variable name="aa"> + <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-ruby-height,$ooUnit)"/> + </xsl:variable> + <xsl:if test="style:page-layout-properties/@style:layout-grid-display and $aa='0' "> + <字:网格设置 uof:locID="t0044" uof:attrList="网格类型 宽度 高度 显示网格 打印网格"> + <xsl:if test="style:page-layout-properties/@style:layout-grid-mode"> + <xsl:attribute name="字:网格类型"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both-nosnap'">line-char</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both'">char</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='line'">line</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='none'">none</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:layout-grid-base-width"> + <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-width,$ooUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:layout-grid-base-height"> + <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-height,$ooUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:layout-grid-display"> + <xsl:attribute name="字:显示网格"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-display='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:layout-grid-print"> + <xsl:attribute name="字:打印网格"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-print='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </字:网格设置> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:layout-grid-display and not($aa = '0')"> + <字:稿纸设置 uof:locID="t0211" uof:attrList="类型 格式 线型 颜色 方向"> + <xsl:variable name="mode"> + <xsl:value-of select="style:page-layout-properties/@style:layout-grid-mode"/> + </xsl:variable> + <xsl:variable name="ruby"> + <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-ruby-height,$ooUnit)"/> + </xsl:variable> + <xsl:variable name="width"> + <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-width,$ooUnit)"/> + </xsl:variable> + <xsl:variable name="height"> + <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-height,$ooUnit)"/> + </xsl:variable> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='line'">letter-paper</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both'">draft-paper</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:layout-grid-mode"> + <xsl:attribute name="字:格式"><xsl:choose><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='0.496' ">fourth-gear</xsl:when><xsl:when test="$mode='both' and $width='0.584' and $height='0.584' and $ruby='0.64' ">third-gear</xsl:when><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='0.905' ">second-gear</xsl:when><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='1.633' ">first-gear</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:layout-grid-color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="style:page-layout-properties/@style:layout-grid-color"/></xsl:attribute> + </xsl:if> + </字:稿纸设置> + </xsl:if> + <xsl:if test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/@style:writing-mode='lr-tb' or style:text-properties/@style:writing-mode='rl-tb'"> + <字:垂直对齐方式 uof:locID="t0045"> + <xsl:variable name="path" select="/office:document/office:automatic-styles/style:style/style:paragraph-properties"/> + <xsl:choose> + <xsl:when test="$path/@fo:text-align='start'">top</xsl:when> + <xsl:when test="$path/@fo:text-align='end'">bottom</xsl:when> + <xsl:when test="$path/@fo:text-align='center'">center</xsl:when> + <xsl:otherwise>justified</xsl:otherwise> + </xsl:choose> + </字:垂直对齐方式> + </xsl:if> + <字:文字排列方向 uof:locID="t0046"> + <xsl:variable name="writing_mode"> + <xsl:value-of select="style:page-layout-properties/@style:writing-mode"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="$writing_mode='lr-tb' or $writing_mode='lr'">hori-l2r</xsl:when> + <xsl:when test="$writing_mode='rl-tb' or $writing_mode='rl'">hori-r2l</xsl:when> + <xsl:when test="$writing_mode='tb-rl'">vert-r2l</xsl:when> + <xsl:when test="$writing_mode='tb-lr'">vert-l2r</xsl:when> + <xsl:otherwise>hori-l2r</xsl:otherwise> + </xsl:choose> + </字:文字排列方向> + <xsl:if test="style:page-layout-properties/@fo:border or style:page-layout-properties/@fo:border-top or style:page-layout-properties/@fo:border-bottom or style:page-layout-properties/@fo:border-left or style:page-layout-properties/@fo:border-right or style:page-layout-properties/@style:shadow[.!='none']"> + <xsl:element name="字:边框"> + <xsl:attribute name="uof:locID">t0047</xsl:attribute> + <xsl:for-each select="style:page-layout-properties"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:background-color"> + <xsl:element name="字:填充"> + <xsl:attribute name="uof:locID">t0048</xsl:attribute> + <xsl:for-each select="style:page-layout-properties"> + <xsl:call-template name="图:填充"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="style:page-layout-properties/style:columns"> + <xsl:element name="字:分栏"> + <xsl:attribute name="uof:locID">t0049</xsl:attribute> + <xsl:attribute name="uof:attrList">栏数 等宽 分隔线 分隔线宽度 分隔线颜色</xsl:attribute> + <xsl:if test="//@fo:column-count"> + <xsl:attribute name="字:栏数"><xsl:choose><xsl:when test="//@fo:column-count='0'">1</xsl:when><xsl:otherwise><xsl:value-of select="//@fo:column-count"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:variable name="第一宽度"> + <xsl:value-of select="style:page-layout-properties/style:columns/style:column/@style:rel-width"/> + </xsl:variable> + <xsl:variable name="dkm"> + <xsl:for-each select="style:page-layout-properties/style:columns/style:column"> + <xsl:if test="$第一宽度 != @style:rel-width"> + <xsl:value-of select="boolean($第一宽度 = @style:rel-width)"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="style:page-layout-properties/style:columns/@fo:column-gap"> + <xsl:attribute name="字:等宽">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:等宽">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="style:page-layout-properties/style:columns/style:column-sep"> + <xsl:attribute name="字:分隔线宽度"><xsl:value-of select="substring-before(style:page-layout-properties/style:columns/style:column-sep/@style:width,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="字:分隔线颜色"><xsl:value-of select="style:page-layout-properties/style:columns/style:column-sep/@style:color"/></xsl:attribute> + <xsl:attribute name="字:分隔线">single</xsl:attribute> + </xsl:if> + <xsl:for-each select="style:page-layout-properties/style:columns/style:column"> + <xsl:element name="字:栏"> + <xsl:variable name="left"> + <xsl:value-of select="substring-before(@fo:start-indent,$uofUnit)"/> + </xsl:variable> + <xsl:variable name="right"> + <xsl:value-of select="substring-before(@fo:end-indent,$uofUnit)"/> + </xsl:variable> + <xsl:if test="@style:rel-width"> + <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(@style:rel-width,'*')"/></xsl:attribute> + </xsl:if> + <xsl:if test="@fo:start-indent or @fo:end-indent"> + <xsl:choose> + <xsl:when test="parent::style:columns/@fo:column-gap"> + <xsl:attribute name="字:间距"><xsl:choose><xsl:when test="$left - $right >0 "><xsl:value-of select="$left - $right"/></xsl:when><xsl:when test="$right - $left > 0 "><xsl:value-of select="$right - $left"/></xsl:when><xsl:otherwise><xsl:value-of select="$right"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:间距"><xsl:value-of select="$right"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:attribute name="uof:locID">t0050</xsl:attribute> + <xsl:attribute name="uof:attrList">宽度 间距</xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:if> + </字:节属性> + </字:分节> + </xsl:template> + <xsl:template match="office:text"> + <xsl:for-each select="node( )"> + <xsl:choose> + <xsl:when test="name()='text:list'or name()='text:ordered-list'"> + <xsl:call-template name="unordered-ordered-list"> + <xsl:with-param name="currlistlvl" select="number('1')"/> + <xsl:with-param name="liststylename" select="@text:style-name"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name()='text:p'or name()='text:h'"> + <xsl:variable name="bs" select="./@text:style-name"/> + <xsl:if test="/office:document/office:automatic-styles/style:style[@style:name=$bs]/@style:master-page-name"> + <xsl:variable name="bs1" select="/office:document/office:automatic-styles/style:style[@style:name=$bs]/@style:master-page-name"/> + <xsl:if test="/office:document/office:master-styles/style:master-page[@style:name=$bs1]/@style:page-layout-name"> + <xsl:variable name="bs2" select="/office:document/office:master-styles/style:master-page[@style:name=$bs1]/@style:page-layout-name"/> + <xsl:for-each select="/office:document/office:automatic-styles/style:page-layout[@style:name=$bs2]"> + <xsl:call-template name="style:page-layout"/> + </xsl:for-each> + </xsl:if> + </xsl:if> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name()='table:table'"> + <xsl:variable name="tbs" select="./@table:style-name"/> + <xsl:if test="/office:document/office:automatic-styles/style:style[@style:name=$tbs]/@style:master-page-name"> + <xsl:variable name="tbs1" select="/office:document/office:automatic-styles/style:style[@style:name=$tbs]/@style:master-page-name"/> + <xsl:if test="/office:document/office:master-styles/style:master-page[@style:name=$tbs1]/@style:page-layout-name"> + <xsl:variable name="tbs2" select="/office:document/office:master-styles/style:master-page[@style:name=$tbs1]/@style:page-layout-name"/> + <xsl:for-each select="/office:document/office:automatic-styles/style:page-layout[@style:name=$tbs2]"> + <xsl:call-template name="style:page-layout"/> + </xsl:for-each> + </xsl:if> + </xsl:if> + <xsl:call-template name="exec_table"/> + </xsl:when> + <xsl:when test="name()='text:table-of-content'"> + <xsl:call-template name="text:table-of-content"/> + </xsl:when> + <xsl:when test="name()='text:alphabetical-index'"> + <xsl:call-template name="text:alphabetical-index"/> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="jiaozhu"> + <字:脚注 uof:locID="t0107" uof:attrList="引文体"> + <xsl:for-each select="text:note-citation"> + <xsl:attribute name="字:引文体"><xsl:value-of select="."/></xsl:attribute> + </xsl:for-each> + <xsl:for-each select="text:note-body/text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </字:脚注> + </xsl:template> + <xsl:template name="weizhu"> + <字:尾注 uof:locID="t0108" uof:attrList="引文体"> + <xsl:for-each select="text:note-citation"> + <xsl:attribute name="字:引文体"><xsl:value-of select="."/></xsl:attribute> + </xsl:for-each> + <xsl:for-each select="text:note-body/text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:for-each> + </字:尾注> + </xsl:template> + <xsl:template name="unordered-ordered-list"> + <xsl:param name="currlistlvl"/> + <xsl:param name="liststylename"/> + <xsl:for-each select="text:list-item"> + <xsl:if test="text:p"> + <xsl:for-each select="text:p"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="$currlistlvl"/> + <xsl:with-param name="liststylename" select="$liststylename"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> + <xsl:for-each select="node( )"> + <xsl:if test="name()='text:list'"> + <xsl:call-template name="unordered-ordered-list"> + <xsl:with-param name="currlistlvl" select="$currlistlvl +1"/> + <xsl:with-param name="liststylename" select="$liststylename"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:for-each> + </xsl:template> + <xsl:template name="execParagraph"> + <xsl:param name="currlistlvl"/> + <xsl:param name="liststylename"/> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:if test="@text:style-name"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:if> + <xsl:if test="not(number($currlistlvl) =number('0'))"> + <xsl:variable name="parent-position"> + <xsl:number from="/office:document/office:body/office:text/text:list" level="any" count="text:list-item/text:p" format="1"/> + </xsl:variable> + <xsl:element name="字:自动编号信息"> + <xsl:attribute name="uof:locID">t0059</xsl:attribute> + <xsl:attribute name="uof:attrList">编号引用 编号级别 重新编号 起始编号</xsl:attribute> + <xsl:attribute name="字:编号引用"><xsl:value-of select="$liststylename"/></xsl:attribute> + <xsl:attribute name="字:编号级别"><xsl:value-of select="$currlistlvl - 1"/></xsl:attribute> + <xsl:attribute name="字:重新编号"><xsl:choose><xsl:when test="number($parent-position)=number('1')">1</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="字:起始编号"><xsl:for-each select="/office:document//text:list-style[$liststylename=@style:name]/*[number($currlistlvl)=number(@text:level)]"><xsl:choose><xsl:when test="@text:start-value"><xsl:value-of select="@text:start-value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:for-each></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:variable name="stylename"> + <xsl:value-of select="@text:style-name"/> + </xsl:variable> + <xsl:for-each select="/office:document//style:style"> + <xsl:if test="@style:name=$stylename"> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="$stylename"/></xsl:attribute> + <xsl:call-template name="字:句属性"/> + </xsl:element> + <xsl:call-template name="ParaAttribute"> + <xsl:with-param name="text-style-name" select="@style:name"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:element> + <xsl:call-template name="textp"/> + <xsl:if test="parent::office:text and not(preceding-sibling::text:p) and preceding-sibling::*[substring-before(name(),':')='draw']"> + <xsl:for-each select="preceding-sibling::*[substring-before(name(),':')='draw']"> + <字:句 uof:locID="t0085"> + <xsl:call-template name="字:锚点"/> + </字:句> + </xsl:for-each> + </xsl:if> + <xsl:if test="draw:frame/draw:text-box/text:p"> + <xsl:for-each select="draw:frame/draw:text-box/text:p"> + <xsl:for-each select="child::*[substring-before(name(),':')='draw']"> + <字:句 uof:locID="t0085"> + <xsl:call-template name="字:锚点"/> + </字:句> + </xsl:for-each> + </xsl:for-each> + </xsl:if> + <xsl:variable name="aa"> + <xsl:value-of select="@text:style-name"/> + </xsl:variable> + <xsl:if test="//office:document/office:automatic-styles/style:style[@style:name=$aa]/style:paragraph-properties/@fo:break-before='column'"> + <字:句 uof:locID="t0085"> + <xsl:element name="字:分栏符"> + <xsl:attribute name="uof:locID">t0125</xsl:attribute> + </xsl:element> + </字:句> + </xsl:if> + <xsl:if test="//office:document/office:automatic-styles/style:style[@style:name=$aa]/style:paragraph-properties/@fo:break-before='page'"> + <字:句 uof:locID="t0085"> + <xsl:element name="字:分页符"> + <xsl:attribute name="uof:locID">t0127</xsl:attribute> + </xsl:element> + </字:句> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:initial-creator"> + <xsl:apply-templates select="text:initial-creator"/> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:title"> + <xsl:apply-templates select="text:title"/> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:subject"> + <xsl:apply-templates select="text:subject"/> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:file-name"> + <xsl:apply-templates select="text:file-name"/> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:author-name"> + <xsl:apply-templates select="text:author-name"/> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:author-initials"> + <xsl:apply-templates select="text:author-initials"/> + </xsl:if> + <xsl:if test="/office:document/office:body/office:text/text:p/text:span/text:date"> + <xsl:apply-templates select="text:date"/> + </xsl:if> + </字:段落> + </xsl:template> + <xsl:template name="ParaAttribute"> + <xsl:param name="text-style-name"/> + <xsl:if test="substring-after(@style:display-name,'Heading')"> + <xsl:element name="字:大纲级别"> + <xsl:attribute name="uof:locID">t0054</xsl:attribute> + <xsl:value-of select="substring-after(@style:display-name,'Heading ')"/> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:text-align or style:paragraph-properties/@style:vertical-align"> + <xsl:element name="字:对齐"> + <xsl:attribute name="uof:locID">t0055</xsl:attribute> + <xsl:attribute name="uof:attrList">水平对齐 文字对齐</xsl:attribute> + <xsl:attribute name="字:水平对齐"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:text-align='end'">right</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='center'">center</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='justify' and not(style:paragraph-properties/@fo:text-align-last='justify')">justified</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='justify' and style:paragraph-properties/@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="字:文字对齐"><xsl:choose><xsl:when test="style:paragraph-properties/@style:vertical-align='baseline'">base</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='top'">top</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='middle'">center</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:margin-left or style:paragraph-properties/@fo:margin-right or style:paragraph-properties/@fo:text-indent"> + <xsl:element name="字:缩进"> + <xsl:attribute name="uof:locID">t0056</xsl:attribute> + <xsl:for-each select="style:paragraph-properties"> + <xsl:call-template name="字:缩进类型"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:element name="字:行距"> + <xsl:attribute name="uof:locID">t0057</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 值</xsl:attribute> + <xsl:choose> + <xsl:when test="contains(style:paragraph-properties/@fo:line-height,$ooUnit)"> + <xsl:attribute name="字:类型">fixed</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:line-height,$ooUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="contains(style:paragraph-properties/@fo:line-height,'%')"> + <xsl:attribute name="字:类型">multi-lines</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:line-height,'%') div 100"/></xsl:attribute> + </xsl:when> + <xsl:when test="style:paragraph-properties/@style:line-height-at-least"> + <xsl:attribute name="字:类型">at-least</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@style:line-height-at-least,$ooUnit)"/></xsl:attribute> + </xsl:when> + <xsl:when test="style:paragraph-properties/@style:line-spacing"> + <xsl:attribute name="字:类型">line-space</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@style:line-spacing,$ooUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:类型">multi-lines</xsl:attribute> + <xsl:attribute name="字:值">1.0</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="style:paragraph-properties/@fo:widows"> + <xsl:element name="字:孤行控制"> + <xsl:attribute name="uof:locID">t0060</xsl:attribute> + <xsl:value-of select="style:paragraph-properties/@fo:widows"/> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:orphans"> + <xsl:element name="字:寡行控制"> + <xsl:attribute name="uof:locID">t0061</xsl:attribute> + <xsl:value-of select="style:paragraph-properties/@fo:orphans"/> + </xsl:element> + </xsl:if> + <xsl:element name="字:段中不分页"> + <xsl:attribute name="uof:locID">t0062</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:keep-together='always'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:if test="style:paragraph-properties/@fo:keep-with-next"> + <xsl:element name="字:与下段同页"> + <xsl:attribute name="uof:locID">t0063</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:break-before"> + <xsl:element name="字:段前分页"> + <xsl:attribute name="uof:locID">t0064</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@style:snap-to-layout-grid"> + <xsl:element name="字:对齐网格"> + <xsl:attribute name="uof:locID">t0069</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:snap-to-layout-grid='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/style:drop-cap/@style:lines"> + <xsl:element name="字:首字下沉"> + <xsl:attribute name="uof:locID">t0070</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 字体引用 字符数 行数 间距</xsl:attribute> + <xsl:attribute name="字:类型">dropped</xsl:attribute> + <xsl:if test="style:paragraph-properties/style:drop-cap/@style:style-name"> + <xsl:attribute name="字:字体引用"><xsl:value-of select="translate(style:paragraph-properties/style:drop-cap/@style:style-name,' ','_')"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="字:间距"><xsl:choose><xsl:when test="style:paragraph-properties/style:drop-cap/@style:distance"><xsl:value-of select="substring-before(style:paragraph-properties/style:drop-cap/@style:distance,$ooUnit)"/></xsl:when><xsl:otherwise>0.00</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="style:paragraph-properties/style:drop-cap/@style:length"> + <xsl:attribute name="字:字符数"><xsl:value-of select="style:paragraph-properties/style:drop-cap/@style:length"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:paragraph-properties/style:drop-cap/@style:lines"> + <xsl:attribute name="字:行数"><xsl:value-of select="style:paragraph-properties/style:drop-cap/@style:lines"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:element name="字:取消断字"> + <xsl:attribute name="uof:locID">t0071</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:hyphenate"><xsl:value-of select="style:paragraph-properties/@fo:hyphenate"/></xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:element name="字:取消行号"> + <xsl:attribute name="uof:locID">t0072</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:variable name="aa"> + <xsl:value-of select="style:paragraph-properties/@text:number-lines"/> + </xsl:variable> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$aa='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + <xsl:element name="字:允许单词断字"> + <xsl:attribute name="字:值">true</xsl:attribute> + <xsl:attribute name="uof:locID">t0073</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + <xsl:if test="style:paragraph-properties/@style:punctuation-wrap"> + <xsl:element name="字:行首尾标点控制"> + <xsl:attribute name="uof:locID">t0074</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:punctuation-wrap='hanging'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="字:是否行首标点压缩"> + <xsl:attribute name="uof:locID">t0075</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">false</xsl:attribute> + </xsl:element> + <xsl:if test="style:paragraph-properties/@style:line-break "> + <xsl:element name="字:中文习惯首尾字符"> + <xsl:attribute name="uof:locID">t0076</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:line-break='strict'">true</xsl:when><xsl:when test="style:paragraph-properties/@style:line-break='normal'">false</xsl:when></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@style:text-autospace"> + <xsl:element name="字:自动调整中英文字符间距"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:text-autospace='ideograph-alpha'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0077</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@style:text-autospace"> + <xsl:element name="字:自动调整中文与数字间距"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:text-autospace='ideograph-alpha'">true </xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0078</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="字:有网格自动调整右缩进"> + <xsl:attribute name="字:值">false</xsl:attribute> + <xsl:attribute name="uof:locID">t0195</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + <xsl:if test="style:paragraph-properties/@fo:border or style:paragraph-properties/@fo:border-top or style:paragraph-properties/@fo:border-bottom or style:paragraph-properties/@fo:border-left or style:paragraph-properties/@fo:border-right or style:paragraph-properties/@style:shadow[.!='none']"> + <xsl:element name="字:边框"> + <xsl:attribute name="uof:locID">t0065</xsl:attribute> + <xsl:for-each select="style:paragraph-properties"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:background-color"> + <xsl:element name="字:填充"> + <xsl:attribute name="uof:locID">t0066</xsl:attribute> + <xsl:for-each select="style:paragraph-properties"> + <xsl:call-template name="图:填充"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:margin-top or style:paragraph-properties/@fo:margin-bottom"> + <字:段间距 uof:locID="t0058"> + <xsl:if test="style:paragraph-properties/@fo:margin-top"> + <字:段前距 uof:locID="t0196"> + <字:绝对值 uof:locID="t0199" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute> + </字:绝对值> + </字:段前距> + </xsl:if> + <xsl:if test="style:paragraph-properties/@fo:margin-bottom"> + <字:段后距 uof:locID="t0197"> + <字:绝对值 uof:locID="t0202" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute> + </字:绝对值> + </字:段后距> + </xsl:if> + </字:段间距> + </xsl:if> + <xsl:if test="style:paragraph-properties/style:tab-stops"> + <xsl:element name="字:制表位设置"> + <xsl:attribute name="uof:locID">t0067</xsl:attribute> + <xsl:for-each select="style:paragraph-properties/style:tab-stops/style:tab-stop"> + <xsl:element name="字:制表位"> + <xsl:attribute name="uof:locID">t0068</xsl:attribute> + <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute> + <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(@style:position,$ooUnit)"/></xsl:attribute> + <xsl:variable name="aa"> + <xsl:value-of select="@style:type"/> + </xsl:variable> + <xsl:variable name="zbflx"> + <xsl:choose> + <xsl:when test="$aa='right'">right</xsl:when> + <xsl:when test="$aa='center'">center</xsl:when> + <xsl:when test="$aa='char'and @style:char!=''">decimal</xsl:when> + <xsl:otherwise>left</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="字:类型"><xsl:value-of select="$zbflx"/></xsl:attribute> + <xsl:attribute name="字:制表位字符"><xsl:value-of select="@style:leader-text"/></xsl:attribute> + <xsl:if test="@style:leader-style"> + <xsl:attribute name="字:前导符"><xsl:value-of select="@style:leader-style"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="text:s"> + <xsl:param name="bText"/> + <xsl:choose> + <xsl:when test="$bText='0'"> + <xsl:variable name="count"> + <xsl:choose> + <xsl:when test="not(@text:c)">1</xsl:when> + <xsl:otherwise> + <xsl:value-of select="@text:c"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <字:句 uof:locID="t0085"> + <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/> + </字:句> + </xsl:when> + <xsl:otherwise> + <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="textp" match="text:p"> + <xsl:variable name="parentstyle"> + <xsl:value-of select="@text:style-name"/> + </xsl:variable> + <xsl:for-each select="node( )"> + <xsl:choose> + <xsl:when test="self::node()[name(.)='text:span']"> + <xsl:call-template name="textspan"/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:sequence']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()/draw:text-box/text:p/text:sequence"> + <xsl:for-each select="draw:text-box/text:p/node()"> + <xsl:choose> + <xsl:when test="self::node()[name(.)='text:sequence']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="not(self::node()[substring-before(name(.),':')='draw'])"> + <xsl:call-template name="字:句"> + <xsl:with-param name="parentstyle" select="$parentstyle"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:date']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:time']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:s']"> + <xsl:apply-templates select="."> + <xsl:with-param name="bText" select="0"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:file-name']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:chapter']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:editing-duration']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:creation-time']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:creation-date']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:character-count']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:page-count']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:page-number']"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:when test="substring-before(name(.),':')='draw' and not(name(.)='draw:a')"> + <字:句 uof:locID="t0085"> + <xsl:call-template name="字:锚点"/> + </字:句> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:note']/@text:note-class='footnote'"> + <字:句 uof:locID="t0085"> + <xsl:call-template name="jiaozhu"/> + </字:句> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:note']/@text:note-class='endnote'"> + <字:句 uof:locID="t0085"> + <xsl:call-template name="weizhu"/> + </字:句> + </xsl:when> + <xsl:when test="name(.)='text:alphabetical-index-mark-start'"> + <xsl:element name="字:句"> + <xsl:element name="字:区域开始"> + <xsl:attribute name="uof:locId">t0121</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + <xsl:attribute name="字:类型">user-data</xsl:attribute> + <xsl:attribute name="字:名称"><xsl:value-of select="@text:string-value-phonetic"/></xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:when test="name(.)='text:alphabetical-index-mark-end'"> + <xsl:element name="字:句"> + <xsl:element name="字:区域结束" uof:locID="t0122" uof:attrList="标识符引用"> + <xsl:attribute name="字:标识符引用"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:when test="name(.)='text:bookmark' "> + <字:句 uof:locID="t0085"> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + </xsl:element> + <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型" 字:名称="{@text:name}" 字:类型="bookmark" 字:标识符="{generate-id()}"/> + <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用" 字:标识符引用="{generate-id()}"/> + </字:句> + </xsl:when> + <xsl:when test="name(.)='text:a'"> + <字:句 uof:locID="t0085"> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + </xsl:element> + <xsl:element name="字:区域开始"> + <xsl:attribute name="字:标识符">hlnk<xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/></xsl:attribute> + <xsl:attribute name="字:名称">Hyperlink</xsl:attribute> + <xsl:attribute name="字:类型">hyperlink</xsl:attribute> + <xsl:attribute name="uof:locID">t0121</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + </xsl:element> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="."/> + </xsl:element> + <xsl:element name="字:区域结束"> + <xsl:attribute name="字:标识符引用">hlnk<xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0122</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute> + </xsl:element> + </字:句> + </xsl:when> + <xsl:when test="name(.)='office:annotation'"> + <字:句 uof:locID="t0085"> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + </xsl:element> + <xsl:element name="字:区域开始"> + <xsl:attribute name="字:标识符">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute> + <xsl:attribute name="字:名称">Comment</xsl:attribute> + <xsl:attribute name="字:类型">annotation</xsl:attribute> + <xsl:attribute name="uof:locID">t0121</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + </xsl:element> + <xsl:element name="字:区域结束"> + <xsl:attribute name="字:标识符引用">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0122</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute> + </xsl:element> + </字:句> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:change-start'] or self::node()[name(.)='text:change'] or self::node()[name(.)='text:change-end']"> + <xsl:call-template name="xiuding"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="字:句"> + <xsl:with-param name="parentstyle" select="$parentstyle"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="xiuding"> + <xsl:choose> + <xsl:when test="self::node()[name(.)='text:change-start']or self::node()[name(.)='text:change']"> + <xsl:variable name="changeID"> + <xsl:value-of select="@text:change-id"/> + </xsl:variable> + <xsl:for-each select="/office:document/office:body/office:text/text:tracked-changes/text:changed-region"> + <xsl:if test="$changeID=@text:id"> + <xsl:choose> + <xsl:when test="text:insertion"> + <xsl:element name="字:修订开始"> + <xsl:attribute name="uof:locID">t0206</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute> + <xsl:attribute name="字:类型">insert</xsl:attribute> + <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="text:format-change"> + <xsl:element name="字:修订开始"> + <xsl:attribute name="uof:locID">t0206</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute> + <xsl:attribute name="字:类型">format</xsl:attribute> + <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="text:deletion"> + <xsl:element name="字:修订开始"> + <xsl:attribute name="uof:locID">t0206</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute> + <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute> + <xsl:attribute name="字:类型">delete</xsl:attribute> + <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:for-each> + </xsl:when> + <xsl:when test="self::node()[name(.)='text:change-end']"> + <xsl:variable name="changeendID"> + <xsl:value-of select="@text:change-id"/> + </xsl:variable> + <xsl:for-each select="/office:document/office:body/office:text/text:tracked-changes/text:changed-region"> + <xsl:if test="$changeendID=@text:id"> + <xsl:choose> + <xsl:when test="text:insertion"> + <xsl:element name="字:修订结束"> + <xsl:attribute name="uof:locID">t0207</xsl:attribute> + <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute> + <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="text:deletion"> + <xsl:element name="字:修订结束"> + <xsl:attribute name="uof:locID">t0207</xsl:attribute> + <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute> + <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="text:format-change"> + <xsl:element name="字:修订结束"> + <xsl:attribute name="uof:locID">t0207</xsl:attribute> + <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute> + <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:for-each> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="字:句"> + <xsl:param name="parentstyle"/> + <xsl:if test="not(name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data' or name(.)='text:page-number' or name(.)='text:page-count' or name(.)='text:initial-creator' or name(.)='text:author-name' or name(.)='text:author-initials' or name(.)='text:creation-time' or name(.)='text:creation-date' or name(.)='text:title' or name(.)='text:subject' or name(.)='text:file-name' or name(.)='text:editing-duration' or name(.)='text:character-count' or name(.)='text:chapter')"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"> + <xsl:choose> + <xsl:when test="@text:style-name"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:when> + <xsl:when test="parent::text:h/@text:outline-level"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="concat('Heading_20_',parent::text:h/@text:outline-level)"/></xsl:attribute> + </xsl:when> + <xsl:when test="parent::node()/@text:style-name"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute> + </xsl:when> + </xsl:choose> + </字:句属性> + <xsl:if test="ancestor::text:note-body"> + <字:引文符号> + <xsl:value-of select="ancestor::text:note/text:note-citation"/> + </字:引文符号> + </xsl:if> + <xsl:choose> + <xsl:when test="(preceding-sibling::text:bookmark-start) and (following-sibling::text:bookmark-end)"> + <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型"> + <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark-start/@text:name"/></xsl:attribute> + <xsl:attribute name="字:名称">Bookmark</xsl:attribute> + <xsl:attribute name="字:类型">bookmark</xsl:attribute> + </字:区域开始> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </xsl:element> + <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用"> + <xsl:attribute name="字:标识符引用"><xsl:value-of select="following-sibling::text:bookmark-end/@text:name"/></xsl:attribute> + </字:区域结束> + </xsl:when> + <xsl:when test="name(.)='draw:a'"> + <xsl:variable name="link-name"> + <xsl:value-of select="substring-after(@xlink:href,'#')"/> + </xsl:variable> + <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型"> + <xsl:attribute name="字:标识符"><xsl:value-of select="$link-name"/></xsl:attribute> + <xsl:attribute name="字:名称">Bookmark</xsl:attribute> + <xsl:attribute name="字:类型">bookmark</xsl:attribute> + </字:区域开始> + <xsl:call-template name="字:锚点"/> + <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用"> + <xsl:attribute name="字:标识符引用"><xsl:value-of select="$link-name"/></xsl:attribute> + </字:区域结束> + </xsl:when> + <xsl:when test="self::node( )[name(.)='text:tab']"> + <xsl:element name="字:制表符"> + <xsl:attribute name="uof:locID">t0123</xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="self::node( )[name(.)='text:line-break']"> + <xsl:element name="字:换行符"> + <xsl:attribute name="uof:locID">t0124</xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data'"> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </字:句> + </xsl:if> + </xsl:template> + <xsl:template match="draw:text-box"> + <xsl:apply-templates/> + </xsl:template> + <xsl:template name="text"> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute> + </xsl:element> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </xsl:element> + </xsl:template> + <xsl:template name="textspan"> + <字:句 uof:locID="t0085"> + <xsl:choose> + <xsl:when test="./text:note/@text:note-class='footnote'"> + <xsl:for-each select="text:note"> + <xsl:call-template name="jiaozhu"/> + </xsl:for-each> + </xsl:when> + <xsl:when test="./text:note/@text:note-class='endnote'"> + <xsl:for-each select="text:note"> + <xsl:call-template name="weizhu"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:句属性"> + <xsl:attribute name="uof:locID">t0086</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:variable name="textstyle"> + <xsl:value-of select="@text:style-name"/> + </xsl:variable> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']"> + <xsl:if test="@style:name=$textstyle and not(@style:parent-style-name='Standard')"> + <xsl:if test="@style:parent-style-name=/office:document/office:styles/style:style/@style:name"> + <xsl:call-template name="SentenceXD"> + <xsl:with-param name="Sentencestyle" select="@style:parent-style-name"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']"> + <xsl:if test="@style:name=$textstyle"> + <xsl:call-template name="SentenceXD"> + <xsl:with-param name="Sentencestyle" select="@style:name"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:element> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </字:句> + </xsl:template> + <xsl:template name="SentenceXD"> + <xsl:param name="Sentencestyle"/> + </xsl:template> + <xsl:template name="字:锚点"> + <xsl:if test="not(name(.)='draw:glue-point')"> + <xsl:variable name="name"> + <xsl:value-of select="name(.)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="name='draw:a'"> + <xsl:for-each select="child::node( )"> + <xsl:call-template name="字:锚点"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$name = 'draw:g'"> + <xsl:for-each select="child::*"> + <xsl:call-template name="字:锚点"/> + </xsl:for-each> + </xsl:if> + <字:锚点 uof:locID="t0110" uof:attrList="标识符 类型"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char'"> + <xsl:attribute name="字:类型">inline</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:类型">normal</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <字:锚点属性 uof:locID="t0111"> + <字:宽度 uof:locID="t0112"> + <xsl:choose> + <xsl:when test="@svg:width"> + <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/> + </xsl:when> + <xsl:when test="@svg:x1"> + <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/> + </xsl:when> + </xsl:choose> + </字:宽度> + <字:高度 uof:locID="t0113"> + <xsl:choose> + <xsl:when test="@svg:height"> + <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/> + </xsl:when> + <xsl:when test="@svg:x1"> + <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/> + </xsl:when> + <xsl:when test="child::draw:text-box/@fo:min-height"> + <xsl:value-of select="substring-before(child::draw:text-box/@fo:min-height,$uofUnit)"/> + </xsl:when> + </xsl:choose> + </字:高度> + <xsl:if test="not(@text:anchor-type='as-char')"> + <字:位置 uof:locID="t0114"> + <字:水平 uof:locID="t0176" uof:attrList="相对于"> + <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties"> + <xsl:attribute name="字:相对于"><xsl:choose><xsl:when test="@style:horizontal-rel='page'">page</xsl:when><xsl:when test="@style:horizontal-rel='paragraph'">margin</xsl:when><xsl:when test="@style:horizontal-rel='page-content'">margin</xsl:when><xsl:when test="@style:horizontal-rel='paragraph-content'">margin</xsl:when><xsl:when test="@style:horizontal-rel='char'">char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:for-each> + <xsl:choose> + <xsl:when test="@svg:x or @svg:x1"> + <字:绝对 uof:locID="t0177" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:attribute> + </字:绝对> + </xsl:when> + <xsl:otherwise> + <字:相对 uof:locID="t0178" uof:attrList="参考点 值"> + <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:horizontal-pos='left'">left</xsl:when><xsl:when test="@style:horizontal-pos='right'">right</xsl:when><xsl:when test="@style:horizontal-pos='center'">center</xsl:when></xsl:choose></xsl:attribute> + </xsl:for-each> + </字:相对> + </xsl:otherwise> + </xsl:choose> + </字:水平> + <字:垂直 uof:locID="t0179" uof:attrList="相对于"> + <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties"> + <xsl:attribute name="字:相对于"><xsl:choose><xsl:when test="@style:vertical-rel='page'">page</xsl:when><xsl:when test="@style:vertical-rel='paragraph'">paragraph</xsl:when><xsl:when test="@style:vertical-rel='page-content'">margin</xsl:when><xsl:when test="@style:vertical-rel='paragraph-content'">margin</xsl:when><xsl:when test="@style:vertical-rel='line'">line</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:for-each> + <xsl:choose> + <xsl:when test="@svg:y or @svg:y1"> + <字:绝对 uof:locID="t0180" uof:attrList="值"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:attribute> + </字:绝对> + </xsl:when> + <xsl:otherwise> + <字:相对 uof:locID="t0181" uof:attrList="参考点 值"> + <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:vertical-pos='bottom'">bottom</xsl:when><xsl:when test="@style:vertical-pos='top'">top</xsl:when><xsl:when test="@style:vertical-pos='middle'">center</xsl:when><xsl:when test="@style:vertical-pos='below'">inside</xsl:when></xsl:choose></xsl:attribute> + </xsl:for-each> + </字:相对> + </xsl:otherwise> + </xsl:choose> + </字:垂直> + </字:位置> + </xsl:if> + <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties"> + <字:绕排 uof:locID="t0115" uof:attrList="绕排方式 环绕文字 绕排顶点"> + <xsl:variable name="wrap_type1"> + <xsl:value-of select="@style:wrap"/> + </xsl:variable> + <xsl:variable name="wrap_type2"> + <xsl:value-of select="@style:run-through"/> + </xsl:variable> + <xsl:variable name="a"> + <xsl:value-of select="@style:number-wrapped-paragraphs"/> + </xsl:variable> + <xsl:if test="$wrap_type1"> + <xsl:attribute name="字:绕排方式"><xsl:choose><xsl:when test="$wrap_type1='run-through' and $wrap_type2='background' ">behindtext</xsl:when><xsl:when test="$wrap_type1='run-through' and $a='1'">infrontoftext</xsl:when><xsl:when test="$wrap_type1='run-through'">through</xsl:when><xsl:when test="$wrap_type1='dynamic' ">top-bottom</xsl:when><xsl:when test="$wrap_type1='parallel' ">square</xsl:when><xsl:when test="$wrap_type1='left' or $wrap_type1='right'">tight</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + <xsl:if test="$wrap_type1='left' or $wrap_type1='right'"> + <xsl:attribute name="字:环绕文字"><xsl:choose><xsl:when test="$wrap_type1='left'">left</xsl:when><xsl:when test="$wrap_type1='right'">right</xsl:when></xsl:choose></xsl:attribute> + </xsl:if> + </字:绕排> + <字:边距 uof:locID="t0116" uof:attrList="上 左 右 下"> + <xsl:choose> + <xsl:when test="@fo:margin-top"> + <xsl:attribute name="字:上"><xsl:value-of select="substring-before(@fo:margin-top,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:下"><xsl:value-of select="substring-before(@fo:margin-bottom,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:上">0.0</xsl:attribute> + <xsl:attribute name="字:下">0.0</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@fo:margin-right"> + <xsl:attribute name="字:右"><xsl:value-of select="substring-before(@fo:margin-right,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:左"><xsl:value-of select="substring-before(@fo:margin-left,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:右">0.0</xsl:attribute> + <xsl:attribute name="字:左">0.0</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </字:边距> + <字:锁定 uof:attrList="值" uof:locID="t0117"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@draw:move-protect='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </字:锁定> + <字:保护 uof:locID="t0118" uof:attrList="值"> + <xsl:choose> + <xsl:when test="$name='draw:image' or $name='draw:text-box'"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:protect = 'content size position' or @style:protect = 'content' or @style:protect = 'content size' or @style:protect = 'size position' or @style:protect = 'size' or @style:protect = 'position' or @style:protect = 'content position' and @draw:size-protect= 'true'and @draw:move-protect= 'true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:protect = 'position size'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </字:保护> + </xsl:for-each> + <字:允许重叠 uof:locID="t0119" uof:attrList="值" 字:值="true"/> + </字:锚点属性> + <字:图形 uof:locID="t0120" uof:attrList="图形引用"> + <xsl:variable name="refpicname"> + <xsl:if test="@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="picnumber"> + <xsl:if test="@draw:style-name"> + <xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/> + </xsl:if> + </xsl:variable> + <xsl:attribute name="字:图形引用"><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:attribute> + </字:图形> + </字:锚点> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template name="liekuan"> + <xsl:param name="count"/> + <xsl:param name="width"/> + <xsl:if test="$count > 0"> + <字:列宽 uof:locID="t0132"> + <xsl:value-of select="$width"/> + </字:列宽> + <xsl:call-template name="liekuan"> + <xsl:with-param name="count" select="$count -1"/> + <xsl:with-param name="width" select="$width"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="exec_table" match="table:table"> + <xsl:param name="tabletype"/> + <字:文字表 uof:locID="t0128" uof:attrList="类型"> + <xsl:choose> + <xsl:when test="@table:is-sub-table='true'"> + <xsl:attribute name="字:类型">sub-table</xsl:attribute> + <xsl:element name="字:文字表属性"> + <xsl:attribute name="uof:locID">t0129</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:element name="字:列宽集"> + <xsl:attribute name="uof:locID">t0131</xsl:attribute> + <xsl:for-each select="table:table-column"> + <xsl:variable name="tableColName" select="@table:style-name"/> + <xsl:variable name="colWidth" select="substring-before(//style:style[@style:name=$tableColName and @style:family='table-column']/style:table-column-properties/@style:column-width,$ooUnit)"/> + <xsl:choose> + <xsl:when test="@table:number-columns-repeated"> + <xsl:call-template name="liekuan"> + <xsl:with-param name="count" select="@table:number-columns-repeated"/> + <xsl:with-param name="width" select="$colWidth"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <字:列宽 uof:locID="t0132"> + <xsl:value-of select="$colWidth"/> + </字:列宽> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:类型">table</xsl:attribute> + <xsl:element name="字:文字表属性"> + <xsl:attribute name="uof:locID">t0129</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@table:style-name"/></xsl:attribute> + <xsl:variable name="tableName" select="@table:style-name"/> + <xsl:element name="字:列宽集"> + <xsl:attribute name="uof:locID">t0131</xsl:attribute> + <xsl:for-each select="table:table-column"> + <xsl:variable name="tableColName" select="@table:style-name"/> + <xsl:variable name="colWidth" select="substring-before(//style:style[@style:name=$tableColName and @style:family='table-column']/style:table-column-properties/@style:column-width,$ooUnit)"/> + <xsl:choose> + <xsl:when test="@table:number-columns-repeated"> + <xsl:call-template name="liekuan"> + <xsl:with-param name="count" select="@table:number-columns-repeated"/> + <xsl:with-param name="width" select="$colWidth"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <字:列宽 uof:locID="t0132"> + <xsl:value-of select="$colWidth"/> + </字:列宽> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + <xsl:for-each select="key('set_styleStyle',$tableName)"> + <xsl:element name="字:宽度"> + <xsl:attribute name="uof:locID">t0130</xsl:attribute> + <xsl:attribute name="uof:attrList">绝对宽度 相对宽度</xsl:attribute> + <xsl:attribute name="字:绝对宽度"><xsl:value-of select="substring-before(style:table-properties/@style:width,$ooUnit)"/></xsl:attribute> + <xsl:if test="style:table-properties/@style:rel-width"> + <xsl:attribute name="字:相对宽度"><xsl:value-of select="substring-before(style:table-properties/@style:rel-width,'%') div 100"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="字:对齐"> + <xsl:attribute name="uof:locID">t0133</xsl:attribute> + <xsl:choose> + <xsl:when test="style:table-properties/@table:align='right'">right</xsl:when> + <xsl:when test="style:table-properties/@table:align='center'">center</xsl:when> + <xsl:otherwise>left</xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="style:table-properties/@fo:margin-left"> + <xsl:element name="字:左缩进"> + <xsl:attribute name="uof:locID">t0134</xsl:attribute> + <xsl:value-of select="substring-before(style:table-properties/@fo:margin-left,$ooUnit)"/> + </xsl:element> + </xsl:if> + <xsl:element name="字:绕排"> + <xsl:attribute name="uof:locID">t0135</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">around</xsl:attribute> + </xsl:element> + <xsl:element name="字:边框"> + <xsl:attribute name="uof:locID">t0137</xsl:attribute> + <xsl:for-each select="style:table-properties"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + </xsl:element> + <xsl:if test="style:table-properties/style:background-image/office:binary-data or style:table-properties/@fo:background-color or style:page-layout-properties/@fo:background-color"> + <字:填充 uof:locID="t0138"> + <xsl:for-each select="style:table-properties"> + <xsl:call-template name="图:填充"> + <xsl:with-param name="style-name" select="$tableName"/> + </xsl:call-template> + </xsl:for-each> + </字:填充> + </xsl:if> + <xsl:element name="字:绕排边距"> + <xsl:attribute name="uof:locID">t0139</xsl:attribute> + <xsl:attribute name="uof:attrList">上 左 右 下</xsl:attribute> + <xsl:if test="style:table-properties/@fo:margin-top"> + <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:table-properties/@fo:margin-left"> + <xsl:attribute name="字:左"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-left,$ooUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:table-properties/@fo:margin-right"> + <xsl:attribute name="字:右"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-right,$ooUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:table-properties/@fo:margin-bottom"> + <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:element name="字:自动调整大小"> + <xsl:attribute name="字:值">true</xsl:attribute> + <xsl:attribute name="uof:locID">t0140</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + <xsl:element name="字:默认单元格边距"> + <xsl:attribute name="uof:locID">t0141</xsl:attribute> + <xsl:attribute name="uof:attrList">上 左 右 下</xsl:attribute> + <xsl:attribute name="字:上">0.10</xsl:attribute> + <xsl:attribute name="字:左">0.10</xsl:attribute> + <xsl:attribute name="字:右">0.10</xsl:attribute> + <xsl:attribute name="字:下">0.10</xsl:attribute> + </xsl:element> + <xsl:element name="字:默认单元格间距"> + <xsl:attribute name="uof:locID">t0142</xsl:attribute> + <xsl:value-of select="'0.00'"/> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="table:table-header-rows/table:table-row"/> + <xsl:apply-templates select="table:table-row"/> + </字:文字表> + </xsl:template> + <xsl:key name="set_colWidth" match="//office:automatic-styles/style:style[@style:family='table-column']" use="@style:name"/> + <xsl:key name="set_styleStyle" match="//office:automatic-styles/style:style" use="@style:name"/> + <xsl:template match="table:table-row"> + <xsl:element name="字:行"> + <xsl:attribute name="uof:locID">t0143</xsl:attribute> + <xsl:variable name="rowStyleName" select="@table:style-name|table:table-row/@table:style-name"/> + <xsl:element name="字:表行属性"> + <xsl:attribute name="uof:locID">t0144</xsl:attribute> + <xsl:for-each select="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:row-height or @style:min-row-height]"> + <xsl:element name="字:高度"> + <xsl:if test="@style:row-height"> + <xsl:attribute name="字:固定值"><xsl:value-of select="substring-before(@style:row-height,$ooUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@style:min-row-height"> + <xsl:attribute name="字:最小值"><xsl:value-of select="substring-before(@style:min-row-height,$ooUnit)"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="uof:locID">t0145</xsl:attribute> + <xsl:attribute name="uof:attrList">固定值 最小值</xsl:attribute> + </xsl:element> + </xsl:for-each> + <xsl:if test="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:keep-together]"> + <xsl:element name="字:跨页"> + <xsl:attribute name="uof:locID">t0146</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:for-each select="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:keep-together]"> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:keep-together='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="name(..)='table:table-header-rows'"> + <xsl:element name="字:表头行"> + <xsl:attribute name="uof:locID">t0147</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:element> + <xsl:for-each select="node()"> + <xsl:choose> + <xsl:when test="name()='table:table-cell'"> + <xsl:element name="字:单元格"> + <xsl:attribute name="uof:locID">t0148</xsl:attribute> + <xsl:call-template name="execTableCellAttribute"/> + <xsl:for-each select="node( )"> + <xsl:choose> + <xsl:when test="name()='text:p'"> + <xsl:call-template name="execParagraph"> + <xsl:with-param name="currlistlvl" select="number('0')"/> + <xsl:with-param name="liststylename" select="string('00000')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name()='table:table' or name()='table:sub-table' or self::node()/@table:is-sub-table='true'"> + <xsl:call-template name="exec_table"> + <xsl:with-param name="tabletype" select="name()"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:template name="execTableCellAttribute"> + <xsl:element name="字:单元格属性"> + <xsl:attribute name="uof:locID">t0149</xsl:attribute> + <xsl:variable name="StyleName" select="@table:style-name"/> + <xsl:element name="字:宽度"> + <xsl:attribute name="uof:locID">t0150</xsl:attribute> + <xsl:attribute name="uof:attrList">绝对值 相对值</xsl:attribute> + <xsl:variable name="sn"> + <xsl:number from="/office:document/office:body/office:text" level="single" count="table:table-cell" format="1"/> + </xsl:variable> + <xsl:variable name="sn1"> + <xsl:choose> + <xsl:when test="../../table:table-column[number($sn)]/@table:style-name"> + <xsl:value-of select="$sn"/> + </xsl:when> + <xsl:when test=" name(../..)='table:table-header-rows' and ../../../table:table-column[number($sn)]/@table:style-name"> + <xsl:value-of select="$sn"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'1'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="KuanDu"> + <xsl:choose> + <xsl:when test=" name(../..)='table:table-header-rows' and ../../../table:table-column[number($sn)]/@table:style-name"> + <xsl:value-of select="../../../table:table-column[number($sn1)]/@table:style-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="../../table:table-column[number($sn1)]/@table:style-name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="字:绝对值"><xsl:value-of select="substring-before(key('set_colWidth',$KuanDu)/style:table-column-properties/@style:column-width,$ooUnit)"/></xsl:attribute> + <xsl:if test="key('set_colWidth',$KuanDu)/style:table-column-properties/@style:rel-column-width"> + <xsl:attribute name="字:相对值"><xsl:value-of select="substring-before(key('set_colWidth',$KuanDu)/style:table-column-properties/@style:rel-column-width,'*')"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test="@table:number-columns-spanned"> + <xsl:element name="字:跨列"> + <xsl:attribute name="uof:locID">t0156</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="@table:number-columns-spanned"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:for-each select="key('set_styleStyle',$StyleName)"> + <xsl:element name="字:单元格边距"> + <xsl:attribute name="uof:locID">t0151</xsl:attribute> + <xsl:attribute name="uof:attrList">上 左 右 下</xsl:attribute> + <xsl:choose> + <xsl:when test="style:table-cell-properties/@fo:padding"> + <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:左"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:右"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:左"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:右"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute> + <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:if test="style:table-cell-properties/@fo:border or style:table-cell-properties/@fo:border-top or style:table-cell-properties/@fo:border-bottom or style:table-cell-properties/@fo:border-left or style:table-cell-properties/@fo:border-right or style:table-cell-properties/@style:shadow"> + <xsl:element name="字:边框"> + <xsl:attribute name="uof:locID">t0152</xsl:attribute> + <xsl:for-each select="style:table-cell-properties"> + <xsl:call-template name="uof:边框"/> + </xsl:for-each> + </xsl:element> + </xsl:if> + <xsl:if test="style:table-cell-properties/style:background-image/office:binary-data or style:table-cell-properties/@fo:background-color"> + <字:填充 uof:locID="t0153"> + <xsl:for-each select="style:table-cell-properties"> + <xsl:call-template name="图:填充"/> + </xsl:for-each> + </字:填充> + </xsl:if> + <字:垂直对齐方式 uof:locID="t0154"> + <xsl:choose> + <xsl:when test="style:table-cell-properties/@style:vertical-align='middle'">center</xsl:when> + <xsl:when test="style:table-cell-properties/@style:vertical-align='bottom'">bottom</xsl:when> + <xsl:otherwise>top</xsl:otherwise> + </xsl:choose> + </字:垂直对齐方式> + <xsl:element name="字:自动换行"> + <xsl:attribute name="字:值">true</xsl:attribute> + <xsl:attribute name="uof:locID">t0157</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + <xsl:element name="字:适应文字"> + <xsl:attribute name="字:值">true</xsl:attribute> + <xsl:attribute name="uof:locID">t0158</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:for-each> + </xsl:element> + </xsl:template> + <xsl:key name="bpath" match="//office:document/office:body/office:text/text:p/text:span" use="@text:style-name"/> + <xsl:template name="字:句属性"> + <xsl:element name="字:字体"> + <xsl:attribute name="uof:locID">t0088</xsl:attribute> + <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute> + <xsl:if test="contains(@style:parent-style-name,'Header') or contains(@style:parent-style-name,'Foot') or contains(@style:parent-style-name,'Endnote')"> + <xsl:attribute name="字:字号">9</xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size-complex"> + <xsl:choose> + <xsl:when test="contains(style:text-properties/@fo:font-size,'%') or contains(style:text-properties/@style:font-size-asian,'%')"> + <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'%')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-complex"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="style:text-properties/@style:font-name"> + <xsl:variable name="xiwen" select="style:text-properties/@style:font-name"/> + <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($xiwen,' ','_')"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@style:font-name-asian"> + <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-name-asian"/></xsl:attribute> + </xsl:if> + <xsl:if test="style:text-properties/@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + <xsl:if test="style:text-properties/@fo:background-color and not(style:text-properties/@style:text-background-color='transparent')"> + <xsl:element name="字:填充"> + <xsl:attribute name="uof:locID">t0093</xsl:attribute> + <xsl:element name="图:图案"> + <xsl:attribute name="uof:locID">g0036</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 图形引用 前景色 背景色</xsl:attribute> + <xsl:if test="style:text-properties/@fo:background-color"> + <xsl:attribute name="图:前景色"><xsl:choose><xsl:when test="style:text-properties/@fo:background-color='transparent'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@fo:background-color"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian"> + <xsl:element name="字:粗体"> + <xsl:attribute name="uof:locID">t0089</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian"> + <xsl:element name="字:斜体"> + <xsl:attribute name="uof:locID">t0090</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:background-color|style:text-properties/@style:text-background-color"> + <xsl:element name="字:突出显示"> + <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@fo:background-color='transparent' or style:text-properties/@style:text-background-color='transparent'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@fo:background-color|style:text-properties/@style:text-background-color"/></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="uof:locID">t0091</xsl:attribute> + <xsl:attribute name="uof:attrList">颜色</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-line-through-style"> + <xsl:element name="字:删除线"> + <xsl:attribute name="uof:locID">t0094</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:删除线类型"><xsl:with-param name="lineType" select="style:text-properties/@style:text-line-through-style"/></xsl:call-template></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-underline-style"> + <xsl:element name="字:下划线"> + <xsl:attribute name="uof:locID">t0095</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 颜色 字下划线</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute> + <xsl:if test="style:text-properties/@style:text-underline-color"> + <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:text-shadow"> + <xsl:element name="字:阴影"> + <xsl:attribute name="uof:locID">t0100</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-emphasize"> + <xsl:element name="字:着重号"> + <xsl:attribute name="uof:locID">t0096</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:call-template name="uof:着重号类型"><xsl:with-param name="te" select="style:text-properties/@style:text-emphasize"/></xsl:call-template></xsl:attribute> + <xsl:if test="style:text-properties/@fo:color"> + <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@text:display"> + <xsl:element name="字:隐藏文字"> + <xsl:attribute name="uof:locID">t0097</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-outline"> + <xsl:element name="字:空心"> + <xsl:attribute name="uof:locID">t0098</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值"><xsl:value-of select="style:text-properties/@style:text-outline"/></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:font-relief"> + <xsl:element name="字:浮雕"> + <xsl:attribute name="uof:locID">t0099</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant"> + <xsl:element name="字:醒目字体"> + <xsl:attribute name="uof:locID">t0101</xsl:attribute> + <xsl:attribute name="uof:attrList">类型</xsl:attribute> + <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-position"> + <xsl:element name="字:位置"> + <xsl:attribute name="uof:locID">t0102</xsl:attribute> + <xsl:variable name="aa"> + <xsl:value-of select="style:text-properties/@style:text-position"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="contains($aa,'sub')"> + <xsl:value-of select="substring-before($aa,' ')"/> + </xsl:when> + <xsl:when test="contains($aa,'super')"> + <xsl:value-of select="substring-before($aa,' ')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate($aa,'%','')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:text-scale"> + <xsl:element name="字:缩放"> + <xsl:attribute name="uof:locID">t0103</xsl:attribute> + <xsl:variable name="scale" select="style:text-properties/@style:text-scale"/> + <xsl:choose> + <xsl:when test="contains($scale,'%')"> + <xsl:value-of select="substring-before($scale,'%')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="style:text-properties/@style:text-scale"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@fo:letter-spacing"> + <xsl:element name="字:字符间距"> + <xsl:attribute name="uof:locID">t0104</xsl:attribute> + <xsl:value-of select="substring-before(style:text-properties/@fo:letter-spacing,$uofUnit)"/> + </xsl:element> + </xsl:if> + <xsl:if test="style:text-properties/@style:letter-kerning"> + <xsl:element name="字:调整字间距"> + <xsl:variable name="tt" select="style:text-properties/@style:letter-kerning"/> + <xsl:attribute name="uof:locID">t0105</xsl:attribute> + <xsl:choose> + <xsl:when test="$tt='true'">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:element name="字:字符对齐网格"> + <xsl:attribute name="字:值">false</xsl:attribute> + <xsl:attribute name="uof:locID">t0106</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="uof:线型类型"> + <xsl:variable name="spath" select="style:text-properties/@style:text-underline-style"/> + <xsl:variable name="wpath" select="style:text-properties/@style:text-underline-width"/> + <xsl:variable name="tpath" select="style:text-properties/@style:text-underline-type"/> + <xsl:choose> + <xsl:when test="$spath='solid' and not($tpath='double' ) and $wpath='auto' ">single</xsl:when> + <xsl:when test="$spath='solid' and $tpath='double' and $wpath='auto' ">double</xsl:when> + <xsl:when test="$spath='solid' and not($tpath='double' )and $wpath='bold' ">thick</xsl:when> + <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='auto' ">dotted</xsl:when> + <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='bold' ">dotted-heavy</xsl:when> + <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='auto' ">dash</xsl:when> + <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='bold' ">dashed-heavy</xsl:when> + <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='auto' ">dash-long</xsl:when> + <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='bold' ">dash-long-heavy</xsl:when> + <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dash</xsl:when> + <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-heavy</xsl:when> + <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dot-dash</xsl:when> + <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-dot-heavy</xsl:when> + <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='auto' ">wave</xsl:when> + <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='bold' ">wavy-heavy</xsl:when> + <xsl:when test="$spath='wave' and $tpath='double' and $wpath='auto' ">wavy-double</xsl:when> + <xsl:otherwise>none</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:删除线类型"> + <xsl:param name="lineType"/> + <xsl:variable name="tw" select="style:text-properties/@style:text-line-through-width"/> + <xsl:variable name="tt" select="style:text-properties/@style:text-line-through-text"/> + <xsl:variable name="ttp" select="style:text-properties/@style:text-line-through-type"/> + <xsl:choose> + <xsl:when test="$lineType='solid'and $ttp='double'">double</xsl:when> + <xsl:when test="$lineType='solid'and $tw='bold'">bold</xsl:when> + <xsl:when test="$lineType='solid'and $tt='X'">xl</xsl:when> + <xsl:when test="$lineType='solid'and $tt='/'">/l</xsl:when> + <xsl:otherwise> + <xsl:if test="not($lineType='none') ">single</xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:着重号类型"> + <xsl:param name="te"/> + <xsl:choose> + <xsl:when test="$te='disc above' ">disc above</xsl:when> + <xsl:when test="$te='circle above' ">circle above</xsl:when> + <xsl:when test="$te='dot above' ">dot above</xsl:when> + <xsl:when test="$te='accent above' ">accent above</xsl:when> + <xsl:when test="$te='dot below' ">dot</xsl:when> + <xsl:when test="$te='circle below' ">circle below</xsl:when> + <xsl:when test="$te='disc below' ">disc below</xsl:when> + <xsl:when test="$te='accent below' ">accent below</xsl:when> + <xsl:otherwise>none</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:边框"> + <xsl:choose> + <xsl:when test="@fo:border"> + <xsl:call-template name="uof:左边框"> + <xsl:with-param name="border" select="@fo:border"/> + </xsl:call-template> + <xsl:call-template name="uof:上边框"> + <xsl:with-param name="border" select="@fo:border"/> + </xsl:call-template> + <xsl:call-template name="uof:右边框"> + <xsl:with-param name="border" select="@fo:border"/> + </xsl:call-template> + <xsl:call-template name="uof:下边框"> + <xsl:with-param name="border" select="@fo:border"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:if test="@fo:border-left or contains(substring-before(substring-after(@style:shadow,' '),' '),'-')"> + <xsl:call-template name="uof:左边框"> + <xsl:with-param name="border" select="@fo:border-left"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="@fo:border-top or contains(substring-after(substring-after(@style:shadow,' '),' '),'-')"> + <xsl:call-template name="uof:上边框"> + <xsl:with-param name="border" select="@fo:border-top"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="@fo:border-right or substring-before(substring-before(substring-after(@style:shadow,' '),' '),$ooUnit) >0 or contains(substring-before(substring-after(@style:shadow,' '),' '),'+')"> + <xsl:call-template name="uof:右边框"> + <xsl:with-param name="border" select="@fo:border-right"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="@fo:border-bottom or substring-before(substring-after(substring-after(@style:shadow,' '),' '),$ooUnit) >0 or contains(substring-after(substring-after(@style:shadow,' '),' '),'+')"> + <xsl:call-template name="uof:下边框"> + <xsl:with-param name="border" select="@fo:border-bottom"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="uof:左边框"> + <xsl:param name="border"/> + <xsl:element name="uof:左"> + <xsl:attribute name="uof:locID">u0057</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + <xsl:if test="@fo:padding or @fo:padding-left"> + <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-left"><xsl:value-of select="substring-before(@fo:padding-left,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="contains(substring-before(substring-after(@style:shadow,' '),' '),'-')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="uof:上边框"> + <xsl:param name="border"/> + <xsl:element name="uof:上"> + <xsl:attribute name="uof:locID">u0058</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + <xsl:if test="@fo:padding or @fo:padding-top"> + <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-top"><xsl:value-of select="substring-before(@fo:padding-top,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="contains(substring-after(substring-after(@style:shadow,' '),' '),'-')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="uof:右边框"> + <xsl:param name="border"/> + <xsl:element name="uof:右"> + <xsl:attribute name="uof:locID">u0059</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + <xsl:if test="@fo:padding or @fo:padding-right"> + <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-right"><xsl:value-of select="substring-before(@fo:padding-right,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="substring-before(substring-before(substring-after(@style:shadow,' '),' '),$ooUnit) >0 or contains(substring-before(substring-after(@style:shadow,' '),' '),'+')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:template name="uof:下边框"> + <xsl:param name="border"/> + <xsl:element name="uof:下"> + <xsl:attribute name="uof:locID">u0060</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute> + <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dashed'">dash</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='dotted'">dotted</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:if test="$border!='none'"> + <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute> + <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute> + <xsl:if test="@fo:padding or @fo:padding-bottom"> + <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-bottom"><xsl:value-of select="substring-before(@fo:padding-bottom,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="substring-before(substring-after(substring-after(@style:shadow,' '),' '),$ooUnit) >0 or contains(substring-after(substring-after(@style:shadow,' '),' '),'+')"> + <xsl:attribute name="uof:阴影">true</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + <xsl:key name="geshi" match="//office:document/office:automatic-styles/number:date-style | //office:document/office:automatic-styles/number:time-style" use="@style:name"/> + <xsl:template name="inline-text"> + <xsl:param name="pStyleName"/> + <xsl:param name="bText"/> + <xsl:apply-templates select="text()|textspan|jiaozhu|weizhu|office:annotation|text:sequence|text:date|text:time|text:page-number|text:page-count|text:subject|text:title|text:initial-creator|text:author-name|text:author-initials|text:file-name|text:change-start|text:change-end|text:change"> + <xsl:with-param name="pStyleName" select="$pStyleName"/> + <xsl:with-param name="bText" select="$bText"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="text:sequence"> + <xsl:param name="tStyle"/> + <xsl:if test="@text:name='Illustration' or @text:name='Text' or @text:name='Drawing' or @text:name='Table'"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'seq'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <xsl:if test="$tStyle!=''"> + <字:句属性 字:式样引用="{$tStyle}" uof:locID="t0086" uof:attrList="式样引用"/> + </xsl:if> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="@style:num-format"/> + </xsl:call-template> + </xsl:variable> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="concat('SEQ ',@text:name,' \* ',$fmt,' \f ',@text:formula)"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="text:time"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'time'"/></xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="timefmt"> + <xsl:variable name="aa" select="@style:data-style-name"/> + <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text"> + <xsl:choose> + <xsl:when test="@number:style='long' "> + <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="self::node( )[name(.)='number:text']"> + <xsl:value-of select="."/> + </xsl:if> + <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if> + <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="quote">"</xsl:variable> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="concat('TIME \@ ',$quote,$timefmt,$quote)"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:date"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'date'"/></xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="datefmt"> + <xsl:variable name="bb" select="@style:data-style-name"/> + <xsl:for-each select="key('geshi',$bb)/number:year | key('geshi',$bb)/number:month | key('geshi',$bb)/number:day | key('geshi',$bb)/number:hours | key('geshi',$bb)/number:minutes | key('geshi',$bb)/number:seconds | key('geshi',$bb)/number:quarter | key('geshi',$bb)/number:day-of-week | key('geshi',$bb)/number:week-of-year | key('geshi',$bb)/number:text | key('geshi',$bb)/number:am-pm"> + <xsl:choose> + <xsl:when test="@number:style='long' "> + <xsl:if test="self::node( )[name(.)='number:year']">yyyy</xsl:if> + <xsl:if test="self::node( )[name(.)='number:month']">MM</xsl:if> + <xsl:if test="self::node( )[name(.)='number:day']">dd</xsl:if> + <xsl:if test="self::node( )[name(.)='number:hours']">hh</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">mm</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">ss</xsl:if> + <xsl:if test="self::node( )[name(.)='number:quarter']">第QQ季度</xsl:if> + <xsl:if test="self::node( )[name(.)='number:day-of-week']">星期N</xsl:if> + <xsl:if test="self::node( )[name(.)='number:week-of-year']">WW</xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="self::node( )[name(.)='number:text']"> + <xsl:value-of select="."/> + </xsl:if> + <xsl:if test="self::node( )[name(.)='number:year']">yy</xsl:if> + <xsl:if test="self::node( )[name(.)='number:month']">M</xsl:if> + <xsl:if test="self::node( )[name(.)='number:day']">d</xsl:if> + <xsl:if test="self::node( )[name(.)='number:hours']">h</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">m</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">s</xsl:if> + <xsl:if test="self::node( )[name(.)='number:quarter']">Q季</xsl:if> + <xsl:if test="self::node( )[name(.)='number:day-of-week']">星期N</xsl:if> + <xsl:if test="self::node( )[name(.)='number:week-of-year']">WW</xsl:if> + <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="quote">"</xsl:variable> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="concat('CREATEDATE \@ ',$quote,$datefmt,$quote)"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="oo数字格式域开关"> + <xsl:param name="oo_format"/> + <xsl:choose> + <xsl:when test="$oo_format='1'">Arabic</xsl:when> + <xsl:when test="$oo_format='I'">ROMAN</xsl:when> + <xsl:when test="$oo_format='i'">roman</xsl:when> + <xsl:when test="$oo_format='A'">ALPHABETIC</xsl:when> + <xsl:when test="$oo_format='a'">alphabetic</xsl:when> + <xsl:when test="$oo_format='1, 2, 3, ...'">GB1</xsl:when> + <xsl:when test="$oo_format='①, ②, ③, ...'">GB3</xsl:when> + <xsl:when test="$oo_format='一, 二, 三, ...'">CHINESENUM3</xsl:when> + <xsl:when test="$oo_format='壹, 贰, 叁, ...'">CHINESENUM2</xsl:when> + <xsl:when test="$oo_format='甲, 乙, 丙, ...'">ZODIAC1</xsl:when> + <xsl:when test="$oo_format='子, 丑, 寅, ...'">ZODIAC2</xsl:when> + <xsl:otherwise>Arabic</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="text:page-number"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'page'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="@style:num-format"/> + </xsl:call-template> + </xsl:variable> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:choose> + <xsl:when test="@style:num-format"> + <xsl:value-of select="concat('PAGE \* ',$fmt)"/> + </xsl:when> + <xsl:otherwise>PAGE</xsl:otherwise> + </xsl:choose> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:page-count"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'numpages'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="@style:num-format"/> + </xsl:call-template> + </xsl:variable> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:choose> + <xsl:when test="@style:num-format"> + <xsl:value-of select="concat('NumPages \* ',$fmt,' \* Upper')"/> + </xsl:when> + <xsl:otherwise>NumPages</xsl:otherwise> + </xsl:choose> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:initial-creator"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'author'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <!--xsl:value-of select="concat('AUTHOR \* ','Caps',' \* MERGEFORMAT')"/--> + <xsl:value-of select="'AUTHOR'"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="string(.)"/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:author-name"> + <xsl:param name="tStyle"/> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'username'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <xsl:if test="$tStyle!=''"> + <字:句属性 字:式样引用="{$tStyle}" uof:locID="t0086" uof:attrList="式样引用"/> + </xsl:if> + <字:文本串 uof:locID="t0109" uof:attrList="标识符">AUTHOR</字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:author-initials"> + <xsl:param name="tStyle"/> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'userinitials'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <xsl:if test="$tStyle!=''"> + <字:句属性 字:式样引用="{$tStyle}" uof:locID="t0086" uof:attrList="式样引用"/> + </xsl:if> + <字:文本串 uof:locID="t0109" uof:attrList="标识符">AUTHOR</字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:title"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'title'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="titlename" select="/office:document/office:meta/dc:title"/> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="concat('TITLE',' \* Upper')"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:subject"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'subject'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="concat('SUBJECT \* ','Caps',' \* MERGEFORMAT')"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:file-name"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'filename'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <!--xsl:value-of select="concat('FILENAME \* ','Caps',' \* MERGEFORMAT')"/--> + <xsl:value-of select="concat('FILENAME',' \p')"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template match="text:editing-duration"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'edittime'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="timefmt"> + <xsl:variable name="aa" select="@style:data-style-name"/> + <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text"> + <xsl:choose> + <xsl:when test="@number:style='long' "> + <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="self::node( )[name(.)='number:text']"> + <xsl:value-of select="."/> + </xsl:if> + <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if> + <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if> + <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if> + <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="quote">"</xsl:variable> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="concat('EDITTIME \@ ',$quote,$timefmt,$quote,' \* MERGEFORMAT ')"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:key name="path" match="//office:document/office:automatic-styles/style:style" use="@style:name"/> + <xsl:template name="text:table-of-content"> + <xsl:element name="字:段落"> + <xsl:attribute name="uof:locID">t0051</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="text:index-body/text:p/@text:style-name"/></xsl:attribute> + <xsl:element name="字:制表位设置"> + <xsl:attribute name="uof:locID">t0067</xsl:attribute> + <xsl:element name="字:制表位"> + <xsl:attribute name="uof:locID">t0068</xsl:attribute> + <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute> + <xsl:variable name="aa" select="text:index-body/text:p/@text:style-name"/> + <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute> + <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute> + <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"> + <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + <xsl:element name="字:是否行首标点压缩"> + <xsl:attribute name="uof:locID">t0075</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + <xsl:element name="字:中文习惯首尾字符"> + <xsl:attribute name="字:值">true</xsl:attribute> + <xsl:attribute name="uof:locID">t0076</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:element> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'REF'"/></xsl:attribute> + <xsl:if test="@text:protected"> + <xsl:attribute name="字:锁定"><xsl:value-of select="@text:protected"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="'TOC \o 1-10 \h \z'"/> + </字:文本串> + </字:句> + </字:段落> + <xsl:for-each select="text:index-body/text:index-title/text:p"> + <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符"> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:element> + <xsl:element name="字:句"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </字:句属性> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="self::node()"/> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="text:index-body/text:p"> + <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符"> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + <xsl:element name="字:制表位设置"> + <xsl:attribute name="uof:locID">t0067</xsl:attribute> + <xsl:element name="字:制表位"> + <xsl:attribute name="uof:locID">t0068</xsl:attribute> + <xsl:attribute name="uof:attrList">位置 类型 前导符</xsl:attribute> + <xsl:variable name="aa" select="@text:style-name"/> + <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute> + <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute> + <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"> + <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + <xsl:element name="字:是否行首标点压缩"> + <xsl:attribute name="uof:locID">t0075</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + <xsl:attribute name="字:值">true</xsl:attribute> + </xsl:element> + <xsl:element name="字:中文习惯首尾字符"> + <xsl:attribute name="字:值">true</xsl:attribute> + <xsl:attribute name="uof:locID">t0076</xsl:attribute> + <xsl:attribute name="uof:attrList">值</xsl:attribute> + </xsl:element> + </xsl:element> + <xsl:if test="self::node()/text:a"> + <字:句 uof:locID="t0085"> + <xsl:variable name="num"> + <xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/> + </xsl:variable> + <xsl:element name="字:区域开始"> + <xsl:attribute name="字:标识符"><xsl:value-of select="concat('hlnk',$num + 1)"/></xsl:attribute> + <xsl:attribute name="字:名称">Hyperlink</xsl:attribute> + <xsl:attribute name="字:类型">hyperlink</xsl:attribute> + <xsl:attribute name="uof:locID">t0121</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute> + </xsl:element> + <xsl:for-each select="text:a/node()"> + <xsl:choose> + <xsl:when test="name(.)='text:tab-stop' or name(.)='text:tab'"> + <xsl:element name="字:制表符" uof:locID="t0123"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="."/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <xsl:element name="字:区域结束"> + <xsl:attribute name="字:标识符引用"><xsl:value-of select="concat('hlnk',$num + 1)"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0122</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute> + </xsl:element> + <xsl:variable name="stt"> + <xsl:value-of select="./text:a"/> + </xsl:variable> + <xsl:variable name="end"> + <xsl:value-of select="."/> + </xsl:variable> + <xsl:variable name="bijiao"> + <xsl:value-of select="substring-after($end,$stt)"/> + </xsl:variable> + <xsl:if test="not($bijiao='')"> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="$bijiao"/> + </xsl:element> + </xsl:if> + </字:句> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:element> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="text:alphabetical-index"> + <xsl:element name="字:段落"> + <xsl:attribute name="uof:locID">t0051</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="text:index-body/text:p/@text:style-name"/></xsl:attribute> + <xsl:element name="字:制表位设置"> + <xsl:attribute name="uof:locID">t0067</xsl:attribute> + <xsl:element name="字:制表位"> + <xsl:attribute name="uof:locID">t0068</xsl:attribute> + <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute> + <xsl:variable name="aa" select="text:index-body/text:p/@text:style-name"/> + <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute> + <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute> + <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"> + <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:element> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'INDEX'"/></xsl:attribute> + <xsl:if test="@text:protected"> + <xsl:attribute name="字:锁定"><xsl:value-of select="@text:protected"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:文本串> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="'TOC \o 1-10 \h \z'"/> + </字:文本串> + </字:句> + </字:段落> + <xsl:for-each select="text:index-body/text:index-title/text:p"> + <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符"> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </xsl:element> + <xsl:element name="字:句"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + </字:句属性> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="self::node()"/> + </xsl:element> + </xsl:element> + </xsl:element> + </xsl:for-each> + <xsl:for-each select="text:index-body/text:p"> + <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符"> + <xsl:element name="字:段落属性"> + <xsl:attribute name="uof:locID">t0052</xsl:attribute> + <xsl:attribute name="uof:attrList">式样引用</xsl:attribute> + <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute> + <xsl:element name="字:制表位设置"> + <xsl:attribute name="uof:locID">t0067</xsl:attribute> + <xsl:element name="字:制表位"> + <xsl:attribute name="uof:locID">t0068</xsl:attribute> + <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute> + <xsl:variable name="aa" select="@text:style-name"/> + <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute> + <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute> + <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute> + <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"> + <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:element> + </xsl:element> + <xsl:for-each select="node()"> + <字:句 uof:locID="t0085"> + <xsl:choose> + <xsl:when test="name(.)='text:tab-stop' or name(.)='text:tab'"> + <xsl:element name="字:制表符" uof:locID="t0123"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="字:文本串"> + <xsl:attribute name="uof:locID">t0109</xsl:attribute> + <xsl:attribute name="uof:attrList">标识符</xsl:attribute> + <xsl:value-of select="."/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </字:句> + </xsl:for-each> + </xsl:element> + </xsl:for-each> + </xsl:element> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:template> + <xsl:template name="oo数字格式"> + <xsl:param name="oo_format"/> + <xsl:choose> + <xsl:when test="$oo_format='1'">decimal</xsl:when> + <xsl:when test="$oo_format='I'">upper-roman</xsl:when> + <xsl:when test="$oo_format='i'">lower-roman</xsl:when> + <xsl:when test="$oo_format='A'">upper-letter</xsl:when> + <xsl:when test="$oo_format='a'">lower-letter</xsl:when> + <xsl:when test="$oo_format='1, 2, 3, ...'">decimal-full-width</xsl:when> + <xsl:when test="$oo_format='①, ②, ③, ...'">decimal-enclosed-circle</xsl:when> + <xsl:when test="$oo_format='一, 二, 三, ...'">chinese-counting</xsl:when> + <xsl:when test="$oo_format='壹, 贰, 叁, ...'">chinese-legal-simplified</xsl:when> + <xsl:when test="$oo_format='甲, 乙, 丙, ...'">ideograph-traditional</xsl:when> + <xsl:when test="$oo_format='子, 丑, 寅, ...'">ideograph-zodiac</xsl:when> + <xsl:otherwise>decimal</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="图:填充"> + <xsl:param name="style-name"/> + <xsl:choose> + <xsl:when test="style:background-image/office:binary-data"> + <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称"> + <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:background-image/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:background-image/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:background-image/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:background-image/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute> + <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('background-image_',count(preceding::style:background-image))"/></xsl:attribute> + <xsl:attribute name="图:类型">png</xsl:attribute> + <xsl:attribute name="图:名称">background-image</xsl:attribute> + </图:图片> + </xsl:when> + <xsl:when test="@fo:background-color"> + <图:颜色 uof:locID="g0034"> + <xsl:choose> + <xsl:when test="@fo:background-color='transparent' ">auto</xsl:when> + <xsl:otherwise> + <xsl:value-of select="@fo:background-color"/> + </xsl:otherwise> + </xsl:choose> + </图:颜色> + </xsl:when> + <xsl:when test="@draw:fill='gradient'"> + </xsl:when> + <xsl:when test="@draw:fill='hatch'"> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:template> + <xsl:template name="字:缩进类型"> + <xsl:if test="@text:space-before or @fo:margin-left"> + <字:左 uof:locID="t0182"> + <字:绝对 uof:locID="t0185" uof:attrList="值"> + <xsl:if test="@text:space-before"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:space-before,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@fo:margin-left"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:margin-left,$uofUnit)"/></xsl:attribute> + </xsl:if> + </字:绝对> + </字:左> + </xsl:if> + <xsl:if test="@text:min-label-width or @fo:margin-right"> + <字:右 uof:locID="t0183"> + <字:绝对 uof:locID="t0187" uof:attrList="值"> + <xsl:if test="@text:min-label-width"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:min-label-width,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@fo:margin-right"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:margin-right,$uofUnit)"/></xsl:attribute> + </xsl:if> + </字:绝对> + </字:右> + </xsl:if> + <xsl:if test="@text:min-label-distance or @fo:text-indent"> + <字:首行 uof:locID="t0184"> + <字:绝对 uof:locID="t0189" uof:attrList="值"> + <xsl:if test="@text:min-label-distance"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:min-label-distance,$uofUnit)"/></xsl:attribute> + </xsl:if> + <xsl:if test="@fo:text-indent"> + <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:text-indent,$uofUnit)"/></xsl:attribute> + </xsl:if> + </字:绝对> + </字:首行> + </xsl:if> + </xsl:template> + <xsl:template name="graphsize"> + <xsl:param name="width"/> + <xsl:param name="Unitofsize"/> + <xsl:if test="$Unitofsize='pt'"> + <xsl:choose> + <xsl:when test="(not($width>1.42) and 0<$width)">1</xsl:when> + <xsl:when test="(not($width>2.84) and 1.42<$width)">2</xsl:when> + <xsl:when test="(not($width>4.26) and 2.84<$width)">3</xsl:when> + <xsl:when test="(not($width>5.68) and 4.26<$width)">4</xsl:when> + <xsl:when test="(not($width>7.10) and 5.68<$width)">5</xsl:when> + <xsl:when test="(not($width>8.52) and 7.10<$width)">6</xsl:when> + <xsl:when test="(not($width>9.94) and 8.52<$width)">7</xsl:when> + <xsl:when test="(not($width>11.36) and 9.94<$width)">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$uofUnit='in'"> + <xsl:choose> + <xsl:when test="(not($width>0.02) and 0<$width)">1</xsl:when> + <xsl:when test="(not($width>0.04) and 0.02<$width)">2</xsl:when> + <xsl:when test="(not($width>0.06) and 0.04<$width)">3</xsl:when> + <xsl:when test="(not($width>0.08) and 0.06<$width)">4</xsl:when> + <xsl:when test="(not($width>0.10) and 0.08<$width)">5</xsl:when> + <xsl:when test="(not($width>0.12) and 0.10<$width)">6</xsl:when> + <xsl:when test="(not($width>0.14) and 0.12<$width)">7</xsl:when> + <xsl:when test="(not($width>0.16) and 0.14<$width)">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$uofUnit='mm'"> + <xsl:choose> + <xsl:when test="(not($width>0.5) and 0<$width) or $width=0.5">1</xsl:when> + <xsl:when test="(not($width>1.0) and 0.5<$width) or $width=1.0">2</xsl:when> + <xsl:when test="(not($width>1.5) and 0.10<$width) or $width=1.5">3</xsl:when> + <xsl:when test="(not($width>2.0) and 1.5<$width) or $width=2.0">4</xsl:when> + <xsl:when test="(not($width>2.5) and 2.0<$width) or $width=2.5">5</xsl:when> + <xsl:when test="(not($width>3.0) and 2.5<$width) or $width=3.0">6</xsl:when> + <xsl:when test="(not($width>3.5) and 3.0<$width) or $width=3.5">7</xsl:when> + <xsl:when test="(not($width>4.0) and 3.5<$width) or $width=4.0">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$uofUnit='cm'"> + <xsl:choose> + <xsl:when test="(not($width>0.05) and 0<$width) or $width=0.05">1</xsl:when> + <xsl:when test="(not($width>0.10) and 0.05<$width) or $width=0.10">2</xsl:when> + <xsl:when test="(not($width>0.15) and 0.10<$width) or $width=0.15">3</xsl:when> + <xsl:when test="(not($width>0.20) and 0.15<$width) or $width=0.20">4</xsl:when> + <xsl:when test="(not($width>0.25) and 0.20<$width) or $width=0.25">5</xsl:when> + <xsl:when test="(not($width>0.30) and 0.25<$width) or $width=0.30">6</xsl:when> + <xsl:when test="(not($width>0.35) and 0.30<$width) or $width=0.35">7</xsl:when> + <xsl:when test="(not($width>0.40) and 0.35<$width) or $width=0.40">8</xsl:when> + <xsl:otherwise>9</xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + <xsl:template match="text:character-count"> + <xsl:element name="字:域开始"> + <xsl:attribute name="字:类型"><xsl:value-of select="'numchars'"/></xsl:attribute> + <xsl:attribute name="uof:locID">t0079</xsl:attribute> + <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute> + <xsl:choose> + <xsl:when test="text:fixed='1'or text:fixed='true'"> + <xsl:attribute name="字:锁定">true</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="字:锁定">false</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + <xsl:element name="字:域代码"> + <xsl:attribute name="uof:locID">t0080</xsl:attribute> + <字:段落 uof:locID="t0051" uof:attrList="标识符"> + <字:句 uof:locID="t0085"> + <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/> + <xsl:variable name="quote" select="'"'"/> + <xsl:variable name="fmt"> + <xsl:call-template name="oo数字格式域开关"> + <xsl:with-param name="oo_format" select="@style:num-format"/> + </xsl:call-template> + </xsl:variable> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="concat('NUMCHARS \* ',$fmt,' \# ',$quote,0,$quote)"/> + </字:文本串> + </字:句> + </字:段落> + </xsl:element> + <字:句 uof:locID="t0085"> + <字:文本串 uof:locID="t0109" uof:attrList="标识符"> + <xsl:value-of select="."/> + </字:文本串> + </字:句> + <xsl:element name="字:域结束"> + <xsl:attribute name="uof:locID">t0081</xsl:attribute> + </xsl:element> + </xsl:template> + <!-- measure_conversion.xsl Begin--> + <!--xsl:param name="dpi" select="111"/> + <xsl:param name="centimeter-in-mm" select="10"/> + <xsl:param name="inch-in-mm" select="25.4"/> + <xsl:param name="didot-point-in-mm" select="0.376065"/> + <xsl:param name="pica-in-mm" select="4.2333333"/> + <xsl:param name="point-in-mm" select="0.3527778"/> + <xsl:param name="twip-in-mm" select="0.017636684"/> + <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/--> + <!-- ***** MEASUREMENT CONVERSIONS ***** + PARAM 'value' + The measure to be converted. + The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...) + directly added to the number. + + PARAM 'rounding-factor' + Is used for the rounding of decimal places. + The parameter number is the product of 1 and some '10', where + every zero represents a decimal place. + + For example, providing as parameter: + <xsl:param name="rounding-factor" select="10000" /> + Gives by default four decimal places. + + To round two decimal places, basically the following is done: + <xsl:value-of select="round(100 * value) div 100"/> + + RETURN The converted number, by default rounded to four decimal places. + In case the input measure could not be matched the same value is + returned and a warning message is written out. + + + + MEASURE LIST: + * 1 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:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml.xsl b/filter/source/xslt/export/wordml/ooo2wordml.xsl new file mode 100644 index 000000000..6cebb3ca5 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml.xsl @@ -0,0 +1,209 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="yes"/> + <xsl:include href="../../common/measure_conversion.xsl"/> + <xsl:include href="../common/ooo2ms_docpr.xsl"/> + <xsl:include href="ooo2wordml_settings.xsl"/> + <xsl:include href="ooo2wordml_border.xsl"/> + <xsl:include href="ooo2wordml_page.xsl"/> + <xsl:include href="ooo2wordml_text.xsl"/> + <xsl:include href="ooo2wordml_list.xsl"/> + <xsl:include href="ooo2wordml_field.xsl"/> + <xsl:include href="ooo2wordml_table.xsl"/> + <xsl:include href="ooo2wordml_draw.xsl"/> + <xsl:include href="ooo2wordml_path.xsl"/> + <xsl:key name="paragraph-style" match="style:style[@style:family='paragraph']" use="@style:name"/> + <xsl:key name="text-style" match="style:style[@style:family='text']" use="@style:name"/> + <xsl:key name="section-style" match="style:style[@style:family='section']" use="@style:name"/> + <xsl:key name="master-page" match="style:master-page" use="@style:name"/> + <xsl:key name="page-layout" match="style:page-layout" use="@style:name"/> + <xsl:key name="slave-style" match="style:style[string-length(normalize-space(@style:master-page-name)) > 0]" use="@style:name"/> + <xsl:key name="list-style" match="office:styles/text:list-style | office:automatic-styles/text:list-style" use="@style:name"/> + <xsl:key name="graphics-style" match="style:style[@style:family='graphic']" use="@style:name"/> + <xsl:template match="/"> + <xsl:apply-templates select="office:document"/> + </xsl:template> + <xsl:template match="office:document"> + <xsl:processing-instruction name="mso-application">progid="Word.Document"</xsl:processing-instruction> + <xsl:variable name="embeddedObjPresent"> + <xsl:choose> + <xsl:when test="//draw:object-ole[1]">yes</xsl:when> + <xsl:otherwise>no</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:wordDocument xml:space="preserve" w:embeddedObjPresent="{$embeddedObjPresent}"> + <xsl:apply-templates select="office:meta"/> + <xsl:apply-templates select="office:font-face-decls"/> + <xsl:if test="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style"> + <xsl:call-template name="ListStyles"/> + </xsl:if> + <w:styles> + <xsl:apply-templates select="office:styles"/> + <xsl:apply-templates select="office:automatic-styles"/> + <xsl:call-template name="add_hyperlink_style"/> + <!--add for hyperlink character style G.Y.--> + <xsl:call-template name="add_comments_style"/> + <!--add for comments style G.Y.--> + </w:styles> + <xsl:call-template name="export-oledata"/> + <xsl:apply-templates select="office:settings"/> + <xsl:apply-templates select="office:body"/> + </w:wordDocument> + </xsl:template> + <xsl:template match="office:body"> + <xsl:call-template name="page-background"/> + <xsl:apply-templates select="office:text"/> + </xsl:template> + <xsl:template match="office:font-face-decls"> + <!-- get default font from default paragraph properties --> + <w:fonts> + <xsl:variable name="default-paragraph-properties" select="/office:document/office:styles/style:default-style[@style:family = 'paragraph']/style:paragraph-properties"/> + <w:defaultFonts w:ascii="{$default-paragraph-properties/@style:font-name}" w:h-ansi="{$default-paragraph-properties/@style:font-name}" w:fareast="{$default-paragraph-properties/@style:font-name-asian}" w:cs="{$default-paragraph-properties/@style:font-name-complex}"/> + <xsl:for-each select="style:font-face"> + <w:font w:name="{@style:name}"> + <xsl:if test="@style:font-charset = 'x-symbol'"> + <w:charset w:val="02"/> + </xsl:if> + <xsl:choose> + <xsl:when test="@style:font-family-generic = 'swiss'"> + <w:family w:val="Swiss"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'modern'"> + <w:family w:val="Modern"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'roman'"> + <w:family w:val="Roman"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'script'"> + <w:family w:val="Script"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'decorative'"> + <w:family w:val="Decorative"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'system'"> + <w:family w:val="System"/> + </xsl:when> + <xsl:otherwise> + <w:family w:val="System"/> + </xsl:otherwise> + </xsl:choose> + <w:pitch w:val="{@style:font-pitch}"/> + </w:font> + </xsl:for-each> + </w:fonts> + </xsl:template> + <xsl:template match="office:styles | office:automatic-styles"> + <xsl:for-each select="*[(name()='style:style' or name()='style:default-style') and (@style:family= 'paragraph' or @style:family= 'text' or @style:family='table')]"> + <xsl:variable name="style-name"> + <xsl:choose> + <xsl:when test="name() = 'style:default-style'"> + <xsl:value-of select="concat('default-', @style:family, '-style')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style:name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:style w:styleId="{$style-name}"> + <xsl:choose> + <xsl:when test="@style:family = 'paragraph'"> + <xsl:attribute name="w:type">paragraph</xsl:attribute> + </xsl:when> + <xsl:when test="@style:family = 'text'"> + <xsl:attribute name="w:type">character</xsl:attribute> + </xsl:when> + <xsl:when test="@style:family = 'table'"> + <xsl:attribute name="w:type">table</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="name() = 'style:default-style'"> + <xsl:attribute name="w:default">on</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="@style:parent-style-name"> + <w:basedOn w:val="{@style:parent-style-name}"/> + </xsl:when> + <xsl:when test="name() = 'style:style' and @style:family= 'paragraph'"> + <w:basedOn w:val="{concat('default-', @style:family, '-style')}"/> + </xsl:when> + </xsl:choose> + <w:name w:val="{$style-name}"/> + <xsl:if test="parent::office:automatic-styles"> + <w:hidden w:val="on"/> + </xsl:if> + <xsl:if test="@style:next-style-name"> + <w:next w:val="{@style:next-style-name}"/> + </xsl:if> + <xsl:choose> + <xsl:when test="@style:family = 'paragraph'"> + <xsl:apply-templates select="style:paragraph-properties" mode="paragraph"/> + </xsl:when> + <xsl:when test="@style:family = 'table'"> + <w:tblPr> + <xsl:apply-templates select="style:table-properties" mode="table"/> + </w:tblPr> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="style:text-properties" mode="character"/> + </w:style> + </xsl:for-each> + </xsl:template> + <xsl:template match="office:text"> + <w:body> + <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list |table:table"/> + <xsl:variable name="paragraph-heading-table" select=".//*[name() = 'text:p' or name() = 'text:h' or name() = 'table:table']"/> + <xsl:variable name="page" select="$paragraph-heading-table[key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/> + <w:sectPr> + <!--w:type w:val="continuous"/ --> + <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:choose> + <xsl:when test="count($page) > 0"> + <xsl:apply-templates select="key('master-page', key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/@style:master-page-name)"/> + <xsl:if test="key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"> + <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page --> + <xsl:variable name="pagenumber_start"> + <xsl:value-of select=" key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/> + </xsl:variable> + <xsl:if test=" number($pagenumber_start) > 0 "> + <w:pgNumType w:start="{$pagenumber_start}"/> + </xsl:if> + <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 --> + <!-- w:pgNumType w:start="{key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/--> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$paragraph-heading-table[last()]/ancestor::text:section"> + <xsl:apply-templates select="key('section-style',$paragraph-heading-table[last()]/ancestor::text:section[1]/@text:style-name)" mode="section"/> + </xsl:if> + </w:sectPr> + </w:body> + </xsl:template> + <xsl:template match="text:section"> + <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list | table:table"/> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_border.xsl b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl new file mode 100644 index 000000000..9ca50dc64 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <!-- multiple usage: get size, type, color of table-cell, paragraph, and page borders. --> + <xsl:template name="get-border-size"> + <xsl:param name="border"/> + <xsl:param name="border-line-width"/> + <xsl:choose> + <xsl:when test="$border = 'none' or $border = 'hidden'"> + <xsl:text>none;0</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="border-value"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="$border"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="border-style"> + <xsl:choose> + <xsl:when test="contains($border,'solid')">solid</xsl:when> + <xsl:when test="contains($border,'double')">double</xsl:when> + <xsl:otherwise>none</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- MS word and SO writer borders Mapping + MS word Borders SO borders + w:val="single" w:sz="0" 0.05pt(0.002cm);solid + w:val="single" w:sz="12" 1.00pt(0.035cm);solid + w:val="single" w:sz="18" 2.50pt(0.088cm);solid + w:val="single" w:sz="36" 4.00pt(0.141cm);solid + w:val="single" w:sz="48" 5.00pt(0.176cm);solid + w:val="double" w:sz="2" 1.10pt(0.039cm);double + w:val="double" w:sz="6" 2.60pt(0.092cm);double + w:val="thin-thick-small-gap" w:sz="12" 3.00pt(0.105cm);double + w:val="thin-thick-large-gap" w:sz="18" 3.55pt(0.125cm);double + w:val="thick-thin-medium-gap" w:sz="24" 4.50pt(0.158cm);double + w:val="thin-thick-medium-gap" w:sz="24" 5.05pt(0.178cm);double + w:val="thin-thick-small-gap" w:sz="24" 6.00pt(0.211cm);double + w:val="thin-thick-medium-gap" w:sz="36" 6.55pt(0.231cm);double + w:val="double" w:sz="18" 7.50pt(0.264cm);double + w:val="thin-thick-medium-gap" w:sz="48" 9.00pt(0.317cm);double;style:border-line-width="0.088cm 0.088cm 0.141cm" + w:val="double" w:sz="24" 9.00pt(0.317cm);double;style:border-line-width="0.141cm 0.088cm 0.088cm" + we adjust the criteria by adding about 1/2 range of this current criteria and next criteria. Gary. Yang --> + <xsl:variable name="microsoft-border-style-size"> + <xsl:choose> + <xsl:when test=" $border-style = 'solid'"> + <xsl:choose> + <xsl:when test="$border-value <= 0.018">single;0</xsl:when> + <xsl:when test="$border-value <= 0.055">single;12</xsl:when> + <xsl:when test="$border-value <= 0.110">single;18</xsl:when> + <xsl:when test="$border-value <= 0.155">single;36</xsl:when> + <xsl:when test="$border-value <= 0.198">single;48</xsl:when> + <xsl:otherwise>single;48</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'double'"> + <xsl:choose> + <xsl:when test="$border-value < 0.064">double;2</xsl:when> + <xsl:when test="$border-value < 0.098">double;6</xsl:when> + <xsl:when test="$border-value < 0.115">thin-thick-small-gap;12</xsl:when> + <xsl:when test="$border-value < 0.135">thin-thick-large-gap;18</xsl:when> + <xsl:when test="$border-value < 0.168">thick-thin-medium-gap;24</xsl:when> + <xsl:when test="$border-value < 0.190">thin-thick-medium-gap;24</xsl:when> + <xsl:when test="$border-value < 0.221">thin-thick-small-gap;24</xsl:when> + <xsl:when test="$border-value < 0.241">thin-thick-medium-gap;36</xsl:when> + <xsl:when test="$border-value < 0.300">double;18</xsl:when> + <xsl:when test="$border-value < 0.430"> + <xsl:variable name="border-inner-line-value"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="$border-line-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$border-inner-line-value < 0.10">thin-thick-medium-gap;48</xsl:if> + <xsl:if test="$border-inner-line-value > 0.10">double;24</xsl:if> + </xsl:when> + <xsl:otherwise>double;24</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>none;0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$microsoft-border-style-size"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- get bottom and right border style, size, color --> + <xsl:template name="get-border"> + <xsl:param name="so-border"/> + <xsl:param name="so-border-line-width"/> + <xsl:param name="so-border-position"/> + <xsl:variable name="ms-style-width"> + <xsl:call-template name="get-border-size"> + <xsl:with-param name="border" select="$so-border"/> + <xsl:with-param name="border-line-width" select="$so-border-line-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$so-border-position = 'bottom' or $so-border-position = 'right'"> + <!-- if border style is bottom or right border we need to change the thin-thick to thick-thin; Vice Versa --> + <xsl:choose> + <xsl:when test="substring-before($ms-style-width, '-')='thin'"> + <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thick-thin', substring-after(substring-before($ms-style-width, ';'), 'k' ))"/></xsl:attribute> + </xsl:when> + <xsl:when test="substring-before($ms-style-width, '-')='thick'"> + <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thin-thick', substring-after(substring-before($ms-style-width, ';'), 'n' ))"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width, ';')"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute> + </xsl:when> + <xsl:when test="$so-border-position = 'top' or $so-border-position = 'left'"> + <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width,';')"/></xsl:attribute> + <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <!--get border color --> + <xsl:choose> + <xsl:when test="contains($so-border,'#')"> + <xsl:attribute name="w:color"><xsl:value-of select="substring-after($so-border, '#')"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:color">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl new file mode 100644 index 000000000..923b19a9e --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl @@ -0,0 +1,275 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template name="ooo_custom_draw2ms_word_draw_map"> + <xsl:param name="ooo_predefined_type"/> + <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl--> + <xsl:choose> + <xsl:when test="$ooo_predefined_type = 'isosceles-triangle' "> + <xsl:value-of select=" '#_x0000_t5' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-triangle' "> + <xsl:value-of select=" '#_x0000_t6' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'trapezoid' "> + <xsl:value-of select=" '#_x0000_t8' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'diamond' "> + <xsl:value-of select=" '#_x0000_t4' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'hexagon' "> + <xsl:value-of select=" '#_x0000_t9' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'parallelogram' "> + <xsl:value-of select=" '#_x0000_t7' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'pentagon' "> + <xsl:value-of select=" '#_x0000_t56' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'octagon' "> + <xsl:value-of select=" '#_x0000_t10' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'cross' "> + <xsl:value-of select=" '#_x0000_t11' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'ring' "> + <xsl:value-of select=" '#_x0000_t23' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'block-arc' "> + <xsl:value-of select=" '#_x0000_t95' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'can' "> + <xsl:value-of select=" '#_x0000_t22' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'cube' "> + <xsl:value-of select=" '#_x0000_t16' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'paper' "> + <xsl:value-of select=" '#_x0000_t65' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'smiley' "> + <xsl:value-of select=" '#_x0000_t96' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'sun' "> + <xsl:value-of select=" '#_x0000_t183' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'moon' "> + <xsl:value-of select=" '#_x0000_t184' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'heart' "> + <xsl:value-of select=" '#_x0000_t74' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'forbidden' "> + <xsl:value-of select=" '#_x0000_t57' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-bracket' "> + <xsl:value-of select=" '#_x0000_t85' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-bracket' "> + <xsl:value-of select=" '#_x0000_t86' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-brace' "> + <xsl:value-of select=" '#_x0000_t87' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-brace' "> + <xsl:value-of select=" '#_x0000_t88' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'bracket-pair' "> + <xsl:value-of select=" '#_x0000_t185' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'brace-pair' "> + <xsl:value-of select=" '#_x0000_t186' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'quad-bevel' "> + <xsl:value-of select=" '#_x0000_t189' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-arrow' "> + <xsl:value-of select=" '#_x0000_t66' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'down-arrow' "> + <xsl:value-of select=" '#_x0000_t67' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-arrow' "> + <xsl:value-of select=" '#_x0000_t68' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-arrow' "> + <xsl:value-of select=" '#_x0000_t13' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-right-arrow' "> + <xsl:value-of select=" '#_x0000_t69' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-down-arrow' "> + <xsl:value-of select=" '#_x0000_t70' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'mso-spt89' "> + <xsl:value-of select=" '#_x0000_t89' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'quad-arrow' "> + <xsl:value-of select=" '#_x0000_t76' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'notched-right-arrow' "> + <xsl:value-of select=" '#_x0000_t94' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'pentagon-right' "> + <xsl:value-of select=" '#_x0000_t177' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'chevron' "> + <xsl:value-of select=" '#_x0000_t55' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-arrow-callout' "> + <xsl:value-of select=" '#_x0000_t79' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'down-arrow-callout' "> + <xsl:value-of select=" '#_x0000_t80' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-down-arrow-callout' "> + <xsl:value-of select=" '#_x0000_t82' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'circular-arrow' "> + <xsl:value-of select=" '#_x0000_t103' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-process' "> + <xsl:value-of select=" '#_x0000_t109' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-alternate-process' "> + <xsl:value-of select=" '#_x0000_t116' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-decision' "> + <xsl:value-of select=" '#_x0000_t110' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-data' "> + <xsl:value-of select=" '#_x0000_t111' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-predefined-process' "> + <xsl:value-of select=" '#_x0000_t112' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-internal-storage' "> + <xsl:value-of select=" '#_x0000_t113' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-document' "> + <xsl:value-of select=" '#_x0000_t114' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-multidocument' "> + <xsl:value-of select=" '#_x0000_t115' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-terminator' "> + <xsl:value-of select=" '#_x0000_t116' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-preparation' "> + <xsl:value-of select=" '#_x0000_t117' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-manual-input' "> + <xsl:value-of select=" '#_x0000_t118' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-manual-operation' "> + <xsl:value-of select=" '#_x0000_t119' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-connector' "> + <xsl:value-of select=" '#_x0000_t120' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-off-page-connector' "> + <xsl:value-of select=" '#_x0000_t177' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-card' "> + <xsl:value-of select=" '#_x0000_t121' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-punched-tape' "> + <xsl:value-of select=" '#_x0000_t122' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-summing-junction' "> + <xsl:value-of select=" '#_x0000_t123' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-or' "> + <xsl:value-of select=" '#_x0000_t124' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-collate' "> + <xsl:value-of select=" '#_x0000_t125' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-sort' "> + <xsl:value-of select=" '#_x0000_t126' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-extract' "> + <xsl:value-of select=" '#_x0000_t127' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-merge' "> + <xsl:value-of select=" '#_x0000_t128' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-stored-data' "> + <xsl:value-of select=" '#_x0000_t130' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-delay' "> + <xsl:value-of select=" '#_x0000_t135' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-sequential-access' "> + <xsl:value-of select=" '#_x0000_t131' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-magnetic-disk' "> + <xsl:value-of select=" '#_x0000_t132' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-direct-access-storage' "> + <xsl:value-of select=" '#_x0000_t133' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-display' "> + <xsl:value-of select=" '#_x0000_t134' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'rectangular-callout' "> + <xsl:value-of select=" '#_x0000_t61' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'round-rectangular-callout' "> + <xsl:value-of select=" '#_x0000_t62' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'round-callout' "> + <xsl:value-of select=" '#_x0000_t63' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'cloud-callout' "> + <xsl:value-of select=" '#_x0000_t106' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'line-callout-1' "> + <xsl:value-of select=" '#_x0000_t50' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'line-callout-2' "> + <xsl:value-of select=" '#_x0000_t51' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'line-callout-3' "> + <xsl:value-of select=" '#_x0000_t47' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'bang' "> + <xsl:value-of select=" '#_x0000_t72' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star4' "> + <xsl:value-of select=" '#_x0000_t187' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star5' "> + <xsl:value-of select=" '#_x0000_t12' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star8' "> + <xsl:value-of select=" '#_x0000_t58' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star24' "> + <xsl:value-of select=" '#_x0000_t92' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'vertical-scroll' "> + <xsl:value-of select=" '#_x0000_t97' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'horizontal-scroll' "> + <xsl:value-of select=" '#_x0000_t98' "/> + </xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl new file mode 100644 index 000000000..1e68ffe38 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl @@ -0,0 +1,1760 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:ole="http://libreoffice.org/2011/xslt/ole" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow ole"> + <xsl:include href="ooo2wordml_custom_draw.xsl"/> + + <xsl:key name="stroke-dash-style" match="draw:stroke-dash" use="@draw:name"/> + <xsl:key name="fill-image" match="draw:fill-image" use="@draw:name"/> + <xsl:key name="draw-gradient" match="draw:gradient " use="@draw:name"/> + <xsl:template name="PageLevelGraphic"> + <xsl:for-each select="//draw:*[@text:anchor-type='page']"> + <xsl:apply-templates select="."/> + </xsl:for-each> + </xsl:template> + <xsl:template match="draw:*"> + <xsl:param name="TargetMeasure" select="'pt'"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:param name="force-draw" select="'false'"/> + <xsl:variable name="MeasureMark"> + <xsl:choose> + <xsl:when test="$TargetMeasure = 'twip'"/> + <xsl:otherwise> + <xsl:value-of select="$TargetMeasure"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <!-- + deal with captions and frames first. draw:text-box is a powerful element in OOo, its GUI name is frame. And OOo use it to contain Captions + Since there is not a corresponding object in word, so we draw the text-box itself and its children separately. If it look like a Caption only frame + we'll adjust the text-box position to make it look pretty + --> + <!-- skip all not force draw children , must be first case --> + <xsl:when test="ancestor::draw:text-box and $force-draw='false' "/> + <xsl:when test="name() = 'draw:text-box'"> + <!-- draw the text-box itself --> + <w:r> + <w:pict> + <xsl:variable name="text-y-adjust"> + <xsl:choose> + <xsl:when test="count(text:p/draw:*) = 1 and (string-length(text:p/draw:*[position()=1]/@svg:x) =0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0) and (string-length(text:p/draw:*[position()=1]/@svg:y)=0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0 ) "> + <xsl:variable name="pic-height"> + <xsl:choose> + <xsl:when test="name(text:p/draw:*[position()=1]) = 'draw:g' or name(text:p/draw:*[position()=1]) = 'draw:a'"> + <xsl:variable name="BigestWindow"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="text:p/draw:*[position()=1]/draw:*"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')) + number(concat('0',translate($y-adjust,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','')))"/> + </xsl:when> + <xsl:when test="text:p/draw:*[position()=1]/@svg:height"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@svg:height"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="text:p/draw:*[position()=1]/@fo:min-height"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@fo:min-height"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="ancestor::draw:frame"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="ancestor::draw:frame/@svg:height"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min-height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="@fo:min-height"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$min-height - $pic-height < 0.001"> + <!-- If control goes here, it much like that this text-box is used for contain graphic caption only --> + <xsl:value-of select="$pic-height - 0.1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="shape-type"> + <xsl:choose> + <xsl:when test="$text-y-adjust = $y-adjust"> + <xsl:value-of select="'#_x0000_t202'"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="DrawElements"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$text-y-adjust"/> + <xsl:with-param name="force-draw" select="'true'"/> + <xsl:with-param name="shape-type" select="$shape-type"/> + </xsl:call-template> + </w:pict> + </w:r> + <!-- draw the real object first --> + <xsl:if test="./text:p/draw:*"> + <xsl:apply-templates select="./text:p/draw:*"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="@svg:x"/> + <xsl:with-param name="value2" select="$x-adjust"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="y-adjust"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="@svg:y"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="force-draw" select="'true'"/> + </xsl:apply-templates> + </xsl:if> + </xsl:when> + <!-- end deal with captions and frames --> + <xsl:when test=" name() = 'draw:frame' "> + <xsl:variable name="BigestWindow"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="."/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:apply-templates select="draw:* "> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> + <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="name() = 'draw:g'"> + <w:r> + <w:pict> + <xsl:element name="v:group"> + <xsl:variable name="BigestWindow"> + <xsl:choose> + <xsl:when test="name() = 'draw:g'"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="draw:*"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'draw:frame'"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="."/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="y"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(number(substring-after(substring-before($BigestWindow,';y2'), 'x2:')) - number(substring-after(substring-before($BigestWindow,';y1'), 'x1:')) , 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')), 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="id"> + <xsl:value-of select="generate-id()"/> + </xsl:attribute> + <xsl:variable name="absolute"> + <xsl:choose> + <xsl:when test="ancestor::draw:a"/> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/> + <xsl:otherwise>position:absolute</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$TargetMeasure= 'pt'"> + <xsl:attribute name="style"> + <xsl:if test="string-length($absolute) > 0"> + <xsl:value-of select="concat($absolute, ';')"/> + </xsl:if> + <xsl:value-of select="concat('margin-left:',$x ,$MeasureMark,';margin-top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/> + </xsl:attribute> + <xsl:attribute name="coordorigin"> + <xsl:choose> + <!-- if we are in a text-box then oo will use comparative positions on us--> + <xsl:when test="name() = 'draw:frame' "> + <xsl:value-of select=" '0 0' "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat(round($x * 20), ',' , round($y * 20))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="coordsize"> + <xsl:value-of select="concat(round($width * 20),',', round($height * 20) )"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$TargetMeasure= 'twip' "> + <xsl:attribute name="style"> + <xsl:if test="string-length($absolute) > 0"> + <xsl:value-of select="concat($absolute, ';')"/> + </xsl:if> + <xsl:value-of select="concat('left:',$x ,$MeasureMark,';top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/> + </xsl:attribute> + <xsl:attribute name="coordorigin"> + <xsl:choose> + <!-- if we are in a text-box then oo will use comparative positions on us--> + <xsl:when test="name() = 'draw:frame' "> + <xsl:value-of select=" '0 0' "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($x , ',' , $y)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="coordsize"> + <xsl:value-of select="concat($width,',', $height )"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <!-- if we are in a text-box then oo will use comparative positions on us--> + <xsl:when test="ancestor::draw:text-box"> + <xsl:apply-templates select="draw:*"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> + <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="draw:*"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </w:pict> + </w:r> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="name() = 'draw:a'"> + <xsl:call-template name="export_hyoerlink"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <w:r> + <w:pict> + <xsl:call-template name="DrawElements"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:call-template> + </w:pict> + </w:r> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetWindowSize"> + <xsl:param name="CurrPos" select="1"/> + <xsl:param name="nodeSet"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:variable name="CurrNodeWindow"> + <xsl:call-template name="GetNodeWindow"> + <xsl:with-param name="CurrNode" select=" $nodeSet[ $CurrPos ]"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <!-- if we got to the last node, return it directly, or return the max window of current one and following ones --> + <xsl:when test="$CurrPos = count($nodeSet)"> + <xsl:value-of select="$CurrNodeWindow"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="CurrentWindow"> + <xsl:variable name="FollowingWindow"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="$nodeSet"/> + <xsl:with-param name="CurrPos" select="$CurrPos + 1"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="GetBigestWindows"> + <xsl:with-param name="Window1" select="$CurrNodeWindow"/> + <xsl:with-param name="Window2" select="$FollowingWindow"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$CurrentWindow"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetNodeWindow"> + <xsl:param name="CurrNode"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:choose> + <xsl:when test="name($CurrNode)='draw:g'"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="$CurrNode/draw:*"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="x"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="$CurrNode/@svg:x"/> + <xsl:with-param name="value2" select="$x-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="y"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="$CurrNode/@svg:y"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$CurrNode/@svg:width"/> + <xsl:with-param name="TargetMeasure" select="'in'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height"> + <xsl:choose> + <xsl:when test="$CurrNode/@svg:height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$CurrNode/@svg:height"/> + <xsl:with-param name="TargetMeasure" select="'in'"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$CurrNode/@fo:min-height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$CurrNode/@fo:min-height"/> + <xsl:with-param name="TargetMeasure" select="'in'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('x1:' , $x, ';y1:' , $y, ';x2:' , string($x + $width), ';y2:', string($y + $height) ) "/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetBigestWindows"> + <xsl:param name="Window1"/> + <xsl:param name="Window2"/> + <xsl:variable name="w1x1" select="substring-after( substring-before($Window1,';y1'),'x1:') "/> + <xsl:variable name="w2x1" select="substring-after( substring-before($Window2,';y1'),'x1:') "/> + <xsl:variable name="w1y1" select="substring-after( substring-before($Window1,';x2'),'y1:') "/> + <xsl:variable name="w2y1" select="substring-after( substring-before($Window2,';x2'),'y1:') "/> + <xsl:variable name="w1x2" select="substring-after( substring-before($Window1,';y2'),'x2:') "/> + <xsl:variable name="w2x2" select="substring-after( substring-before($Window2,';y2'),'x2:') "/> + <xsl:variable name="w1y2" select="substring-after( $Window1,';y2:') "/> + <xsl:variable name="w2y2" select="substring-after( $Window2,';y2:') "/> + <xsl:variable name="x1"> + <xsl:choose> + <xsl:when test="$w1x1 > $w2x1"> + <xsl:value-of select="$w2x1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w1x1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y1"> + <xsl:choose> + <xsl:when test="$w1y1 > $w2y1"> + <xsl:value-of select="$w2y1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w1y1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="x2"> + <xsl:choose> + <xsl:when test="$w1x2 > $w2x2"> + <xsl:value-of select="$w1x2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w2x2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y2"> + <xsl:choose> + <xsl:when test="$w1y2 > $w2y2"> + <xsl:value-of select="$w1y2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w2y2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('x1:' , $x1 , ';y1:' , $y1 , ';x2:' , $x2, ';y2:' , $y2)"/> + </xsl:template> + <!-- convert percent value to x% numeric x/100 --> + <xsl:template name="ValueOfPercent"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="contains($value, '%')"> + <xsl:value-of select="substring-before($value, '%') div 100"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="points2points"> + <xsl:param name="input_points"/> + <xsl:param name="input_x"/> + <xsl:param name="input_y"/> + <xsl:param name="input_width"/> + <xsl:param name="input_height"/> + <xsl:param name="input_boxwidth"/> + <xsl:param name="input_boxheight"/> + <xsl:variable name="onepoint" select="substring($input_points,1,string-length($input_points) - string-length(substring-after($input_points,' ')) )"/> + <xsl:if test="substring-before($input_points,' ')"> + <xsl:value-of select="round($input_x + (($input_boxwidth - number(substring-before($onepoint,','))) ) * $input_width div $input_boxwidth)"/> + <xsl:value-of select="'pt,'"/> + <xsl:value-of select="round($input_y + ((number(substring-after($onepoint,',')) ) ) * $input_height div $input_boxheight)"/> + <xsl:value-of select="'pt'"/> + </xsl:if> + <xsl:if test="string-length(substring($input_points,string-length($onepoint) + 1)) > 0"> + <xsl:value-of select="','"/> + <xsl:call-template name="points2points"> + <xsl:with-param name="input_points" select="substring($input_points,string-length($onepoint) + 1)"/> + <xsl:with-param name="input_x" select="$input_x"/> + <xsl:with-param name="input_y" select="$input_y"/> + <xsl:with-param name="input_width" select="$input_width"/> + <xsl:with-param name="input_height" select="$input_height"/> + <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/> + <xsl:with-param name="input_boxheight" select="$input_boxheight"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="path2path"> + <xsl:param name="input_points"/> + <xsl:param name="x_or_y" select="'x'"/> + <xsl:param name="input_x"/> + <xsl:param name="input_y"/> + <xsl:param name="input_width"/> + <xsl:param name="input_height"/> + <xsl:param name="input_boxwidth"/> + <xsl:param name="input_boxheight"/> + <xsl:variable name="space-pos" select="string-length($input_points) - string-length(substring-after($input_points,' '))"/> + <xsl:variable name="minus-pos" select="string-length($input_points) - string-length(substring-after($input_points,'-'))"/> + <xsl:variable name="m-pos" select="string-length($input_points) - string-length(substring-after($input_points,'m'))"/> + <xsl:variable name="c-pos" select="string-length($input_points) - string-length(substring-after($input_points,'c'))"/> + <xsl:variable name="e-pos" select="string-length($input_points) - string-length(substring-after($input_points,'e'))"/> + <xsl:variable name="min1"> + <xsl:choose> + <xsl:when test="$space-pos < $minus-pos"> + <xsl:value-of select="$space-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$minus-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min2"> + <xsl:choose> + <xsl:when test="$m-pos < $min1"> + <xsl:value-of select="$m-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$min1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min3"> + <xsl:choose> + <xsl:when test="$c-pos < $min2"> + <xsl:value-of select="$c-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$min2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min4"> + <xsl:choose> + <xsl:when test="$e-pos < $min3"> + <xsl:value-of select="$e-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$min3"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min-special-char-pos" select="$min4"/> + <xsl:variable name="special-char" select="substring($input_points,$min-special-char-pos,1)"/> + <xsl:variable name="one-value" select="substring($input_points,1,$min-special-char-pos - 1)"/> + <xsl:variable name="left-points" select="substring($input_points,$min-special-char-pos + 1)"/> + <xsl:if test="not($special-char = 'm')"> + <xsl:if test="$x_or_y = 'x'"> + <xsl:value-of select="round($input_x + $one-value * $input_width div $input_boxwidth)"/> + </xsl:if> + <xsl:if test="$x_or_y = 'y'"> + <xsl:value-of select="round($input_y + $one-value * $input_height div $input_boxheight)"/> + </xsl:if> + </xsl:if> + <!-- output the separator--> + <xsl:choose> + <xsl:when test="$special-char = '-' or $special-char = ' ' "> + <xsl:value-of select="','"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$special-char"/> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="next-xy"> + <xsl:if test="$x_or_y = 'x'"> + <xsl:value-of select="'y'"/> + </xsl:if> + <xsl:if test="$x_or_y = 'y'"> + <xsl:value-of select="'x'"/> + </xsl:if> + </xsl:variable> + <xsl:if test="string-length($left-points) > 0"> + <xsl:call-template name="path2path"> + <xsl:with-param name="input_points" select="$left-points"/> + <xsl:with-param name="x_or_y" select="$next-xy"/> + <xsl:with-param name="input_x" select="$input_x"/> + <xsl:with-param name="input_y" select="$input_y"/> + <xsl:with-param name="input_width" select="$input_width"/> + <xsl:with-param name="input_height" select="$input_height"/> + <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/> + <xsl:with-param name="input_boxheight" select="$input_boxheight"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="get_dashstyle"> + <xsl:param name="stroke-width" select="0.1"/> + <xsl:param name="style-name" select="@draw:style-name"/> + <xsl:variable name="graph-style" select="key('graphics-style', $style-name)/style:graphic-properties"/> + <xsl:variable name="dash-style" select="key('stroke-dash-style', $graph-style/@draw:stroke-dash)"/> + <xsl:variable name="stroke"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:stroke"> + <xsl:value-of select="$graph-style/@draw:stroke"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:stroke"> + <xsl:value-of select="$dash-style/@draw:stroke"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$stroke = 'solid' "> + <xsl:value-of select="$stroke"/> + </xsl:when> + <xsl:when test="$stroke = 'dash'"> + <xsl:variable name="dots1"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots1"> + <xsl:value-of select="$graph-style/@draw:dots1"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots1"> + <xsl:value-of select="$dash-style/@draw:dots1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dots2"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots1"> + <xsl:value-of select="$graph-style/@draw:dots2"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots1"> + <xsl:value-of select="$dash-style/@draw:dots2"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dots1-length"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots1-length"> + <xsl:value-of select="$graph-style/@draw:dots1-length"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots1-length"> + <xsl:value-of select="$dash-style/@draw:dots1-length"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dots2-length"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots2-length"> + <xsl:value-of select="$graph-style/@draw:dots2-length"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots2-length"> + <xsl:value-of select="$dash-style/@draw:dots2-length"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="distance"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:distance"> + <xsl:value-of select="$graph-style/@draw:distance"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:distance"> + <xsl:value-of select="$dash-style/@draw:distance"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dot1-step"> + <xsl:choose> + <xsl:when test="contains($dots1-length,'%')"> + <xsl:variable name="dots-percent"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="$dots1-length"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round($dots-percent)"/> + </xsl:when> + <xsl:when test="contains($dots1-length , 'in' ) and $stroke-width > 0"> + <xsl:value-of select="round( number(substring-before($dots1-length,'in' )) div $stroke-width )"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dot2-step"> + <xsl:choose> + <xsl:when test="contains($dots2-length,'%')"> + <xsl:variable name="dots-percent"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="$dots2-length"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round($dots-percent)"/> + </xsl:when> + <xsl:when test="contains($dots2-length,'in') and $stroke-width > 0"> + <xsl:value-of select="round(number(substring-before($dots2-length,'in')) div $stroke-width)"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="distance-step"> + <xsl:choose> + <xsl:when test="contains($distance,'%')"> + <xsl:variable name="dots-percent"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="$distance"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round($dots-percent)"/> + </xsl:when> + <xsl:when test="contains($distance,'in') and $stroke-width > 0"> + <xsl:value-of select="round(number(substring-before($distance,'in')) div $stroke-width)"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dashstyle"> + <xsl:choose> + <xsl:when test="$dots1 = 1 and $dots2 = 1 and $dot1-step = 0 and $dot2-step = 0 and $distance-step = 0"> + <xsl:value-of select="'ShortDot'"/> + </xsl:when> + <xsl:when test="$dots2 = 0 and $dot1-step = 0 and $dot2-step = 0 and $distance-step > 0"> + <xsl:value-of select="concat('0 ', $distance-step)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create_dashstyle"> + <xsl:with-param name="dot-count" select="$dots1"/> + <xsl:with-param name="dot-step" select="$dot1-step"/> + <xsl:with-param name="distance-step" select="$distance-step"/> + </xsl:call-template> + <xsl:value-of select="' '"/> + <xsl:call-template name="create_dashstyle"> + <xsl:with-param name="dot-count" select="$dots2"/> + <xsl:with-param name="dot-step" select="$dot2-step"/> + <xsl:with-param name="distance-step" select="$distance-step"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$dashstyle"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="create_dashstyle"> + <xsl:param name="dot-count"/> + <xsl:param name="dot-step"/> + <xsl:param name="distance-step"/> + <xsl:if test="$dot-count > 0"> + <xsl:value-of select="concat($dot-step, ' ' , $distance-step )"/> + <xsl:if test="$dot-count - 1 > 0"> + <xsl:value-of select="' '"/> + <xsl:call-template name="create_dashstyle"> + <xsl:with-param name="dot-count" select="$dot-count - 1"/> + <xsl:with-param name="dot-step" select="$dot-step"/> + <xsl:with-param name="distance-step" select="$distance-step"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:template> + <xsl:template name="get_borderstyle"> + <xsl:param name="border"/> + <xsl:param name="border-line-width"/> + <xsl:choose> + <xsl:when test="contains($border,'solid')"> + <xsl:variable name="strokeweight"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before($border, ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat ( 'strokeweight:', $strokeweight)"/> + </xsl:when> + <xsl:when test="contains($border,'double')"> + <xsl:variable name="outside"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-after(substring-after($border-line-width, ' ') , ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="inside"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before($border-line-width, ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="space"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before(substring-after($border-line-width, ' ') , ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="linestyle"> + <xsl:choose> + <xsl:when test="$outside = $inside"> + <xsl:value-of select="'thinThin'"/> + </xsl:when> + <xsl:when test="$outside > $inside"> + <xsl:value-of select="'thickThin'"/> + </xsl:when> + <xsl:when test="$outside < $inside"> + <xsl:value-of select="'thinThick'"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="strokeweight" select="$inside + $outside + $space"/> + <xsl:value-of select="concat( 'linestyle:' , $linestyle , ';' , 'strokeweight:' , $strokeweight )"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="DrawElements"> + <xsl:param name="TargetMeasure" select="pt"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:param name="force-draw" select="'false'"/> + <xsl:param name="shape-type"/> + <xsl:variable name="MeasureMark"> + <xsl:choose> + <xsl:when test="$TargetMeasure = 'twip'"/> + <xsl:otherwise> + <xsl:value-of select="$TargetMeasure"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="drawtextstyle" select="@draw:text-style-name"/> + <xsl:variable name="org-z-index"> + <xsl:choose> + <xsl:when test="@draw:z-index"> + <xsl:value-of select="number(concat('0',@draw:z-index))"/> + </xsl:when> + <xsl:when test="parent::draw:frame/@draw:z-index"> + <xsl:value-of select="number(concat('0',parent::draw:frame/@draw:z-index))"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="run-though" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:run-through"/> + <xsl:variable name="org-wrap" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:wrap"/> + <xsl:variable name="draw-name"> + <xsl:choose> + <xsl:when test="string-length(@draw:name) = 0"> + <xsl:value-of select="translate(ancestor::draw:frame[1]/@draw:name, ':/', '__')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate(@draw:name, ':/', '__')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style_name2key"> + <xsl:choose> + <xsl:when test="@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:if test="ancestor::draw:frame/@draw:style-name"> + <xsl:value-of select="ancestor::draw:frame/@draw:style-name"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="draw-fill-type" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill"/> + <xsl:variable name="draw-gradient-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-gradient-name"/> + <xsl:variable name="horizontal-pos" select="key('graphics-style', $style_name2key)/style:graphic-properties/@style:horizontal-pos"/> + <!--horizontal-pos attribute is for the placement of all the drawing elements--> + <xsl:variable name="fill-image-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-image-name"/> + <xsl:if test="$draw-fill-type = 'bitmap' "> + <xsl:element name="w:binData"> + <xsl:attribute name="w:name"> + <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/> + </xsl:attribute> + <xsl:value-of select="translate(key('fill-image',$fill-image-name)/office:binary-data/text(),'	  ','' ) "/> + <!-- xsl:value-of select="office:binary-data/text()"/ --> + </xsl:element> + </xsl:if> + <xsl:variable name="z-index"> + <xsl:choose> + <xsl:when test="$run-though='foreground'"> + <!-- make sure z-index >=0 --> + <xsl:choose> + <xsl:when test="$org-z-index < 0">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-z-index"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$run-though='background'"> + <!-- make sure z-index < 0 --> + <xsl:choose> + <xsl:when test="$org-z-index < 0"> + <xsl:value-of select="$org-z-index"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-z-index - 10"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="wrap"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char' ">none</xsl:when> + <xsl:when test="$org-wrap='dynamic'">tight</xsl:when> + <xsl:when test="$org-wrap='parallel'">square</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="ooshapename" select="substring-after(name(),':')"/> + <xsl:variable name="element-name"> + <xsl:choose> + <xsl:when test="$ooshapename='rect'">v:rect</xsl:when> + <xsl:when test="$ooshapename='ellipse' and not(string-length(@draw:kind) > 0)">v:oval</xsl:when> + <xsl:when test="$ooshapename='ellipse' and string-length(@draw:kind) > 0">v:arc</xsl:when> + <xsl:when test="$ooshapename='circle' and string-length(@draw:kind) > 0">v:arc</xsl:when> + <xsl:when test="$ooshapename='line'">v:line</xsl:when> + <xsl:when test="$ooshapename='polyline'">v:polyline</xsl:when> + <xsl:when test="$ooshapename='polygon'">v:polyline</xsl:when> + <xsl:when test="$ooshapename='text-box'">v:shape</xsl:when> + <xsl:when test="$ooshapename='image'">v:shape</xsl:when> + <xsl:when test="$ooshapename='frame'">v:shape</xsl:when> + <xsl:when test="$ooshapename='path'">v:shape</xsl:when> + <!-- This caption is not the "Caption", it's GUI name is Callouts--> + <xsl:when test="$ooshapename='caption'">v:shape</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive' ">v:shape</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'round-rectangle' ">v:roundrect</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'rectangle' ">v:rect</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'ellipse' ">v:oval</xsl:when> + <xsl:when test="$ooshapename='custom-shape'">v:shape</xsl:when> + <!-- some wild guess --> + <xsl:otherwise>v:shape</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="ms-shape-type"> + <xsl:choose> + <xsl:when test="string-length($shape-type) > 0"> + <xsl:value-of select="$shape-type"/> + </xsl:when> + <xsl:when test="$ooshapename='custom-shape' "> + <xsl:call-template name="ooo_custom_draw2ms_word_draw_map"> + <xsl:with-param name="ooo_predefined_type" select="draw:enhanced-geometry[1]/@draw:predefined-type"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="real-x-adjust"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat($x-adjust,'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="real-y-adjust"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat($y-adjust,'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:x"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-y"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:y"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pagemaster" select="key('master-page','Standard')/@style:page-layout-name"/> + <xsl:variable name="leftmargin-pt"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="topmargin-pt"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-top"/> + </xsl:call-template> + </xsl:variable> + <!-- adjust the x and y values of the page archored objects--> + <xsl:variable name="x"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-x + $real-x-adjust - $leftmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-x + $real-x-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-y + $real-y-adjust - $topmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-y + $real-y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="width"> + <xsl:variable name="width-tmp"> + <xsl:choose> + <xsl:when test="@svg:width"> + <xsl:value-of select="@svg:width"/> + </xsl:when> + <xsl:when test="not(string-length(parent::draw:frame/@svg:width) = 0)"> + <xsl:value-of select="parent::draw:frame/@svg:width"/> + </xsl:when> + <xsl:when test="string-length(@svg:width) = 0 and ancestor::draw:frame"> + <xsl:value-of select="ancestor::draw:frame/@svg:width"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@svg:width"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="$width-tmp"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height"> + <xsl:choose> + <xsl:when test="@svg:height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:height"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not(string-length(parent::draw:frame/@svg:height) = 0)"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="parent::draw:frame/@svg:height"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@fo:min-height and string-length(text:p/text()) = 0 and not(text:p/draw:*)"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@fo:min-height"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="borderstyle"> + <xsl:call-template name="get_borderstyle"> + <xsl:with-param name="border" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border"/> + <xsl:with-param name="border-line-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:border-line-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="stroke-weight-in-inch" select="number(concat('0',translate(key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width ,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))"/> + <xsl:variable name="stroke-weight"> + <xsl:choose> + <xsl:when test="contains($borderstyle , 'strokeweight')"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat( substring-after($borderstyle, 'strokeweight:') , 'pt')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="linestyle"> + <xsl:if test="contains($borderstyle , 'strokeweight')"> + <xsl:value-of select="substring-before( substring-after($borderstyle, 'linestyle:') , ';strokeweight')"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="stroked"> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:stroke = 'none'"> + <xsl:value-of select="'f'"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="dashstyle"> + <xsl:call-template name="get_dashstyle"> + <xsl:with-param name="stroke-width" select="$stroke-weight-in-inch"/> + <xsl:with-param name="style-name" select="@draw:style-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="start-arrow"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> + <xsl:call-template name="MapArrowStyle"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-arrow"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> + <xsl:call-template name="MapArrowStyle"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="start-arrow-length"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> + <xsl:call-template name="GetArrowLength"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="start-arrow-width"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> + <xsl:call-template name="GetArrowWidth"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-arrow-length"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> + <xsl:call-template name="GetArrowLength"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-arrow-width"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> + <xsl:call-template name="GetArrowWidth"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="stroke-color"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"> + <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"/> + </xsl:when> + <xsl:when test="contains(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#')"> + <xsl:value-of select="concat('#', substring-after(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#') )"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="stroke-opacity"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-opacity"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="fill-color"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"> + <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"/> + </xsl:when> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style">black</xsl:when> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill = 'none'"/> + <xsl:when test="$draw-fill-type = 'gradient' "> + <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:end-color "/> + </xsl:when> + <!-- for these need fill, set the default color we used in oo--> + <xsl:when test="name()='draw:polygon' or name()='draw:custom-shape' or name() = 'draw:rect' or (name() = 'draw:ellipse' and not( @draw:kind='arc') )">#00B8FF</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="position"> + <xsl:value-of select="concat('left:', $x ,$MeasureMark , ';top:' , $y ,$MeasureMark , ';width:', $width ,$MeasureMark )"/> + <xsl:if test="not($height = 0)"> + <xsl:value-of select="concat(';height:', $height ,$MeasureMark )"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="flip"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char' and $ooshapename='line'"/> + <xsl:when test="$ooshapename='image'"/> + <xsl:when test="$ooshapename='path'"/> + <xsl:when test="$ooshapename='caption'"/> + <xsl:when test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"/> + <xsl:when test="$ooshapename='custom-shape'"/> + <xsl:otherwise>flip:x</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="absolute"> + <xsl:choose> + <xsl:when test="ancestor::draw:a"/> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/> + <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'"/> + <xsl:otherwise>position:absolute</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="anchorlock"> + <xsl:choose> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">has</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <!-- start line special --> + <xsl:variable name="org-x1"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:x1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-y1"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:y1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-x2"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:x2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-y2"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:y2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x1"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-x1 + $real-x-adjust - $leftmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-x1 + $real-x-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y1"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-y1 + $real-y-adjust - $topmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-y1 + $real-y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="x2"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-x2 + $real-x-adjust - $leftmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-x2 + $real-x-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y2"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-y2 + $real-y-adjust - $topmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-y2 + $real-y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- end line special --> + <xsl:variable name="relative"> + <xsl:choose> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when> + <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style"> + <xsl:choose> + <xsl:when test="$wrap='none'"/> + <xsl:otherwise> + <xsl:if test="string-length($absolute) > 0"> + <xsl:value-of select="concat($absolute, ';')"/> + </xsl:if> + <xsl:value-of select="concat('z-index:', $z-index, ';')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="string-length($flip) > 0"> + <xsl:value-of select="concat($flip,';')"/> + </xsl:if> + <xsl:if test="not($ooshapename = 'line')"> + <xsl:value-of select="concat($position,';')"/> + </xsl:if> + <xsl:if test="ancestor::draw:frame and name()='draw:text-box'"> + <xsl:if test="string-length($horizontal-pos) > 0"> + <xsl:value-of select="concat('mso-position-horizontal:',$horizontal-pos,';')"/> + </xsl:if> + </xsl:if> + <xsl:if test="string-length($relative) > 0"> + <xsl:value-of select="concat($relative,';')"/> + </xsl:if> + </xsl:variable> + <!-- image special: convert oo base64 binary data (77char/line) to word base64 binary data(73char/line) , a workthrough is removing all line breaks --> + <xsl:if test="$ooshapename = 'image'"> + <xsl:element name="w:binData"> + <xsl:attribute name="w:name"> + <xsl:value-of select="concat( 'wordml://', $draw-name )"/> + </xsl:attribute> + <xsl:value-of select="translate(office:binary-data/text(),'	  ','' ) "/> + <!-- xsl:value-of select="office:binary-data/text()"/ --> + </xsl:element> + </xsl:if> + <!-- all element goes here --> + <xsl:variable name="id"> + <xsl:choose> + <xsl:when test="$ooshapename='line'"> + <xsl:value-of select="concat('_x',$x1 , '_' ,$y1, '_' , $x2, '_' ,$y2 )"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('_x',$x , '_' ,$y, '_' , $width, '_' ,$height )"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="{$element-name}"> + <xsl:attribute name="id"> + <xsl:value-of select="$id"/> + </xsl:attribute> + <xsl:if test="string-length($ms-shape-type) > 0"> + <xsl:attribute name="type"> + <xsl:value-of select="$ms-shape-type"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="style"> + <xsl:value-of select="$style"/> + </xsl:attribute> + <xsl:if test="$stroke-weight > 0"> + <xsl:attribute name="strokeweight"> + <xsl:value-of select="concat($stroke-weight,$MeasureMark)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($stroked) > 0"> + <xsl:attribute name="stroked"> + <xsl:value-of select="$stroked"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($stroke-color) > 0"> + <xsl:attribute name="strokecolor"> + <xsl:value-of select="$stroke-color"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($fill-color) > 0"> + <xsl:attribute name="fillcolor"> + <xsl:value-of select="$fill-color"/> + </xsl:attribute> + <xsl:attribute name="filled">true</xsl:attribute> + </xsl:if> + <xsl:if test="parent::draw:frame/draw:object-ole[1]"> + <xsl:attribute name="filled">true</xsl:attribute> + </xsl:if> + <xsl:if test="string-length($stroke-opacity) > 0"> + <xsl:attribute name="opacity"> + <xsl:value-of select="$stroke-opacity"/> + </xsl:attribute> + </xsl:if> + <!-- arc special attribute --> + <xsl:if test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"> + <xsl:choose> + <xsl:when test="@draw:start-angle > @draw:end-angle"> + <xsl:attribute name="startangle"> + <xsl:value-of select="round( 450 - (@draw:end-angle + 360) )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="startangle"> + <xsl:value-of select="round( 450 - @draw:end-angle )"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="endangle"> + <xsl:value-of select="round(450 - @draw:start-angle)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@draw:kind = 'cut'"> + <xsl:attribute name="fill"> + <xsl:value-of select="'true'"/> + </xsl:attribute> + </xsl:if> + <!-- end arc special attribute --> + <!-- line special attribute--> + <xsl:if test="$ooshapename='line'"> + <xsl:attribute name="from"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char'">0,0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($x1,$MeasureMark, ',',$y2,$MeasureMark )"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="to"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char'"> + <xsl:value-of select="concat($x2,$MeasureMark ,',',$y2,$MeasureMark )"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($x2,$MeasureMark ,',' ,$y1,$MeasureMark)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <!-- end line special attribute--> + <!-- polyline and polygon special attribute--> + <xsl:if test="$ooshapename='polyline' or $ooshapename='polygon' "> + <!-- translate ' ' to in ' translate ',' to 'in,' --> + <xsl:variable name="points"> + <xsl:call-template name="points2points"> + <xsl:with-param name="input_x" select="$x"/> + <xsl:with-param name="input_y" select="$y"/> + <xsl:with-param name="input_width" select="$width"/> + <xsl:with-param name="input_height" select="$height"/> + <xsl:with-param name="input_boxwidth" select="substring-before(substring-after(@svg:viewBox,'0 0 '),' ')"/> + <xsl:with-param name="input_boxheight" select="substring-after(substring-after(@svg:viewBox,'0 0 '),' ')"/> + <xsl:with-param name="input_points" select="concat(@draw:points,' ')"/> + <!-- add a space to the end of input_points --> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="points"> + <xsl:value-of select="$points"/> + </xsl:attribute> + </xsl:if> + <!-- end polyline and polygon special attribute--> + <!-- callouts special attribute--> + <xsl:if test="$ooshapename='caption'"> + <xsl:variable name="caption-point-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="value" select="@draw:caption-point-x"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="caption-point-y"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="value" select="@draw:caption-point-y"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="type"> + <!-- map to word line label 3--> + <xsl:value-of select="'#_x0000_t48'"/> + </xsl:attribute> + <xsl:attribute name="adj"> + <xsl:value-of select=" concat($caption-point-x * 20 , ',' , $caption-point-y * 20 , ',' , $caption-point-x * 10 , ',,,,' , $caption-point-x * 20, ',' , $caption-point-y * 20) "/> + </xsl:attribute> + </xsl:if> + <!-- end callouts special attribute--> + <!-- path special attribute--> + <xsl:if test="$ooshapename='path' or string-length(@svg:d) > 0 or ( $ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive') "> + <xsl:variable name="path"> + <xsl:choose> + <xsl:when test="$ooshapename='path' or string-length(@svg:d) > 0 "> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="@svg:d"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="draw:enhanced-geometry[1]/@draw:enhanced-path"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="coordorigin"> + <xsl:value-of select=" '0 0' "/> + </xsl:attribute> + <xsl:attribute name="coordsize"> + <xsl:choose> + <xsl:when test="string-length(@svg:viewBox) > 0 "> + <xsl:value-of select="substring-after(@svg:viewBox,'0 0 ')"/> + </xsl:when> + <xsl:when test="string-length(draw:enhanced-geometry[1]/@svg:viewBox) > 0 "> + <xsl:value-of select="substring-after(draw:enhanced-geometry[1]/@svg:viewBox,'0 0 ')"/> + </xsl:when> + <!-- for custom shape use a default viewbox. right? --> + <xsl:otherwise> + <xsl:value-of select=" '21600 21600' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="path"> + <xsl:value-of select="$path"/> + </xsl:attribute> + </xsl:if> + <!-- end path special attribute--> + <!-- image special element --> + <xsl:if test="$ooshapename='image'"> + <xsl:element name="v:imagedata"> + <xsl:attribute name="src"> + <xsl:value-of select="concat('wordml://', $draw-name)"/> + </xsl:attribute> + <xsl:attribute name="o:title"> + <xsl:value-of select="$draw-name"/> + </xsl:attribute> + </xsl:element> + </xsl:if> + <!-- end image special element --> + <!-- start dash style , line style and arrow style--> + <xsl:if test="string-length($dashstyle) > 0 or string-length($linestyle) > 0 or string-length($start-arrow) > 0 or string-length($end-arrow) > 0 "> + <xsl:element name="v:stroke"> + <xsl:if test="string-length($dashstyle) > 0"> + <xsl:attribute name="dashstyle"> + <xsl:value-of select="$dashstyle"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($linestyle) > 0"> + <xsl:attribute name="linestyle"> + <xsl:value-of select="$linestyle"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($start-arrow) > 0 "> + <xsl:attribute name="startarrow"> + <xsl:value-of select="$start-arrow"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($end-arrow) > 0 "> + <xsl:attribute name="endarrow"> + <xsl:value-of select="$end-arrow"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($start-arrow-length) > 0 "> + <xsl:attribute name="startarrowlength"> + <xsl:value-of select="$start-arrow-length"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($start-arrow-width) > 0 "> + <xsl:attribute name="startarrowwidth"> + <xsl:value-of select="$start-arrow-width"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($end-arrow-length) > 0 "> + <xsl:attribute name="endarrowlength"> + <xsl:value-of select="$end-arrow-length"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($end-arrow-width) > 0 "> + <xsl:attribute name="endarrowwidth"> + <xsl:value-of select="$end-arrow-width"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <!-- end dash style , line style and arrow style --> + <!-- start wrap type --> + <xsl:if test="string-length($wrap) > 0"> + <xsl:element name="w10:wrap"> + <xsl:attribute name="type"> + <xsl:value-of select="$wrap"/> + </xsl:attribute> + </xsl:element> + </xsl:if> + <!-- end wrap type --> + <!-- start anchor to char specific element --> + <xsl:if test="string-length($anchorlock) > 0"> + <xsl:element name="w10:anchorlock"/> + </xsl:if> + <!-- end wrap type --> + <!-- start fill image --> + <xsl:if test="string-length($draw-fill-type ) > 0"> + <xsl:element name="v:fill"> + <xsl:choose> + <xsl:when test="$draw-fill-type = 'bitmap'"> + <xsl:attribute name="src"> + <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/> + </xsl:attribute> + <xsl:attribute name="o:title"> + <xsl:value-of select="$fill-image-name"/> + </xsl:attribute> + <xsl:attribute name="recolor"> + <xsl:value-of select=" 'true' "/> + </xsl:attribute> + <xsl:attribute name="rotate"> + <xsl:value-of select=" 'true' "/> + </xsl:attribute> + <xsl:attribute name="type"> + <xsl:value-of select=" 'frame' "/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$draw-fill-type = 'gradient'"> + <xsl:attribute name="type"> + <xsl:value-of select=" 'gradient' "/> + </xsl:attribute> + <xsl:attribute name="color2"> + <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:start-color "/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <!-- end fill image --> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style"> + <xsl:call-template name="FontWork"/> + </xsl:if> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:shadow = 'visible'"> + <xsl:call-template name="Shadow"/> + </xsl:if> + <!-- only draw:g can have child graphic --> + <xsl:choose> + <xsl:when test="name() = 'draw:g'"> + <xsl:apply-templates select="draw:*"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="text:*/* | text:*/text()"> + <xsl:element name="v:textbox"> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:writing-mode = 'tb-rl'"> + <xsl:attribute name="style"> + <xsl:value-of select="'layout-flow:vertical'"/> + </xsl:attribute> + </xsl:if> + <w:txbxContent> + <xsl:apply-templates select="text() | text:*"/> + </w:txbxContent> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:apply-templates select="parent::draw:frame/draw:object-ole" mode="output"> + <xsl:with-param name="ShapeID" select="$id"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template name="Shadow"> + <xsl:element name="v:shadow"> + <xsl:variable name="key-node" select="key('graphics-style', @draw:style-name)/style:graphic-properties"/> + <xsl:attribute name="on">true</xsl:attribute> + <xsl:attribute name="offset"> + <xsl:value-of select="concat($key-node/@draw:shadow-offset-x,',' , $key-node/@draw:shadow-offset-y)"/> + </xsl:attribute> + <xsl:attribute name="color"> + <xsl:value-of select="$key-node/@draw:shadow-color"/> + </xsl:attribute> + <xsl:attribute name="opacity"> + <xsl:value-of select="$key-node/@draw:shadow-opacity"/> + </xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="FontWork"> + <xsl:element name="v:path"> + <xsl:attribute name="textpathok">true</xsl:attribute> + </xsl:element> + <xsl:if test="not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow) or not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow = 'normal')"> + <xsl:element name="v:shadow"> + <xsl:attribute name="on">true</xsl:attribute> + <xsl:attribute name="type">perspective</xsl:attribute> + <xsl:attribute name="color"> + <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-color"/> + </xsl:attribute> + <xsl:variable name="offset-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-x"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="offset-y" select="substring-before(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-y, 'in')"/> + <xsl:attribute name="matrix"> + <xsl:value-of select="concat(',,,' , round($offset-y div 0.000693) div 100, ',,')"/> + </xsl:attribute> + <xsl:attribute name="origin">-30%, -30%</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="v:textpath"> + <xsl:attribute name="on">true</xsl:attribute> + <xsl:attribute name="fitpath">true</xsl:attribute> + <xsl:attribute name="fitshape">true</xsl:attribute> + <xsl:attribute name="style"> + <xsl:choose> + <xsl:when test="key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family"> + <xsl:value-of select="concat('font-family:"' , key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family , '"') "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="default-graphics-properties" select="/office:document/office:styles/style:default-style[@style:family = 'graphics']/style:graphic-properties"/> + <xsl:value-of select="concat('font-family:"' , $default-graphics-properties/@style:font-name , '"') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="string"> + <xsl:value-of select="text:p"/> + </xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="MapArrowStyle"> + <xsl:param name="arrow-name"/> + <xsl:choose> + <xsl:when test="$arrow-name = 'Arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Square' ">Diamond</xsl:when> + <xsl:when test="$arrow-name = 'Small arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Dimension lines' ">Diamond</xsl:when> + <xsl:when test="$arrow-name = 'Double Arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Rounded short arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Symmetric arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Line Arrow' ">Open</xsl:when> + <xsl:when test="$arrow-name = 'Rounded large arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Circle' ">Oval</xsl:when> + <xsl:when test="$arrow-name = 'Square 45' ">Diamond</xsl:when> + <xsl:when test="$arrow-name = 'Arrow concave' ">Classic</xsl:when> + <xsl:otherwise>Block</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetArrowLength"> + <xsl:param name="arrow-name"/> + <xsl:param name="arrow-width"/> + <xsl:variable name="arrow-size"> + <xsl:choose> + <xsl:when test="$arrow-width"> + <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/> + </xsl:when> + <xsl:otherwise>3</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$arrow-size > 2">Long</xsl:when> + <xsl:when test="$arrow-size > 1">Medium</xsl:when> + <xsl:when test="$arrow-size > 0">Short</xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="GetArrowWidth"> + <xsl:param name="arrow-name"/> + <xsl:param name="arrow-width"/> + <xsl:variable name="arrow-size"> + <xsl:choose> + <xsl:when test="$arrow-width"> + <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/> + </xsl:when> + <xsl:otherwise>3</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$arrow-size > 2">Wide</xsl:when> + <xsl:when test="$arrow-size > 1">Medium</xsl:when> + <xsl:when test="$arrow-size > 0">Narrow</xsl:when> + </xsl:choose> + </xsl:template> + + <xsl:template name="export-oledata"> + <xsl:if test="//draw:object-ole[1]"> + <xsl:apply-templates select="//draw:object-ole" mode="oledata.mso"/> + <w:docOleData> + <w:binData w:name="oledata.mso"> + <xsl:if test="function-available('ole:getByName')"> + <xsl:value-of select="translate(ole:getByName('oledata.mso'),'  ','')"/> + </xsl:if> + </w:binData> + </w:docOleData> + </xsl:if> + </xsl:template> + <xsl:template match="draw:object-ole" mode="oledata.mso"> + <xsl:variable name="stream-name"> + <xsl:apply-templates select="." mode="get-number"/> + </xsl:variable> + <xsl:variable name="tmp" select="ole:insertByName($stream-name, translate(office:binary-data/text(),'  ','' ) )"/> + </xsl:template> + <xsl:template match="draw:object-ole" mode="output"> + <xsl:param name="ShapeID"/> + <xsl:variable name="stream-name"> + <xsl:apply-templates select="." mode="get-number"/> + </xsl:variable> + <o:OLEObject Type="Embed" DrawAspect="Content" ObjectID="{$stream-name}" ShapeID="{$ShapeID}" ProgID=""/> + </xsl:template> + <xsl:template match="draw:object-ole" mode="get-number"> + <xsl:number from="/office:document" level="any" count="draw:object-ole" format="1"/> + </xsl:template> + <xsl:template match="draw:object-ole"/> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_field.xsl b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl new file mode 100644 index 000000000..349a07e0e --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl @@ -0,0 +1,726 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <!-- the following are common used fields --> + <xsl:template match="text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date + | text:time | text:page-variable-get | text:author-name | text:author-initials | text:file-name | text:sender-company + | text:sender-initials | text:sender-phone-work | text:word-count | text:paragraph-count | text:character-count + | text:description | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration + | text:keywords | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:variable-get | text:user-field-get | text:sequence | text:database-name "> + <w:fldSimple> + <xsl:variable name="attribute_value1"> + <xsl:choose> + <xsl:when test="name() = 'text:page-number' or name() = 'text:page-variable-get' "> + <xsl:text> PAGE </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:page-count' "> + <xsl:text> NUMPAGES </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:subject' "> + <xsl:text> SUBJECT </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:initial-creator' "> + <xsl:text> AUTHOR </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:title' "> + <xsl:text> TITLE </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:date' "> + <xsl:text> DATE </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:time' "> + <xsl:text> TIME </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'text:author-name' "> + <xsl:text> AUTHOR </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:author-initials' "> + <xsl:text> USERINITIALS </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:file-name' "> + <xsl:choose> + <xsl:when test="@text:display='name-and-extension' or @text:display='name' "> + <xsl:text> FILENAME </xsl:text> + </xsl:when> + <xsl:when test=" @text:display='full' or @text:display='path' "> + <xsl:text>FILENAME \p </xsl:text> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test=" name() = 'text:sender-company' "> + <xsl:text> DOCPROPERTY Company </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:sender-initials' "> + <xsl:text> USERINITIALS </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:sender-phone-work' "> + <xsl:text> DOCPROPERTY "Telephone number" </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:word-count' "> + <xsl:text> DOCPROPERTY Words </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:paragraph-count' "> + <xsl:text> DOCPROPERTY Paragraphs </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:character-count' "> + <xsl:text> DOCPROPERTY CharactersWithSpaces </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:description' "> + <xsl:text> COMMENTS </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:creation-time' "> + <xsl:text> DOCPROPERTY CreateTime </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name()= 'text:creation-date' "> + <xsl:text> CREATEDATE </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:editing-cycles' "> + <xsl:text> REVNUM \* Arabic </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:editing-duration' "> + <xsl:text> EDITTIME </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:keywords' "> + <xsl:text> KEYWORDS </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:print-time' "> + <xsl:text>DOCPROPERTY LastPrinted </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:print-date' "> + <xsl:text>DOCPROPERTY LastPrinted </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:creator' "> + <xsl:text> LASTSAVEDBY </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:modification-time' "> + <xsl:text> DOCPROPERTY LastSavedTime </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:modification-date' "> + <xsl:text> SAVEDATE </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:user-defined' "> + <xsl:text> DOCPROPERTY </xsl:text> + <xsl:text>"</xsl:text> + <xsl:value-of select="translate(string(@text:name), ' ', '')"/> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:variable-get' or name() = 'text:user-field-get' "> + <xsl:value-of select="concat ('DOCVARIABLE ', @text:name)"/> + </xsl:when> + <xsl:when test=" name() = 'text:sequence' "> + <xsl:value-of select="concat(' SEQ "',@text:name, '"') "/> + </xsl:when> + <xsl:when test="name() = 'text:database-name' "> + <xsl:value-of select="concat (' DATABASE ', @text:database-name, '.' , @text:table-name)"/> + </xsl:when> + </xsl:choose> + <!-- Get number style format for number fields --> + <xsl:if test="@style:num-format"> + <xsl:call-template name="field_get_number_format"> + <xsl:with-param name="field_number_format_style" select="@style:num-format"/> + </xsl:call-template> + </xsl:if> + <xsl:text> \* MERGEFORMAT </xsl:text> + </xsl:variable> + <xsl:attribute name="w:instr"> + <xsl:value-of select="$attribute_value1"/> + </xsl:attribute> + <w:r> + <w:rPr> + <xsl:choose> + <xsl:when test="@style:num-format = '가, 나, 다, ...' or @style:num-format ='일, 이, 삼, ...' or @style:num-format ='ㄱ, ㄴ, ㄷ, ...' "> + <w:rFonts w:fareast="Batang" w:hint="fareast"/> + <!--wx:font wx:val="Batang"/ --> + <w:lang w:fareast="KO"/> + </xsl:when> + <xsl:when test="@style:num-format = 'ア, イ, ウ, ...' or @style:num-format = 'ア, イ, ウ, ...' or @style:num-format = 'イ, ロ, ハ, ...' or @style:num-format = 'イ, ロ, ハ, ...' or @style:num-format ='壱, 弐, 参, ...' "> + <w:rFonts w:fareast="MS Mincho" w:hint="fareast"/> + <!--wx:font wx:val="MS Mincho"/ --> + <w:lang w:fareast="JA"/> + </xsl:when> + <xsl:when test=" @style:num-format ='壹, 貳, 參, ...' or @style:num-format ='壹, 貳, 參, ...' or @style:num-format ='壹, 贰, 叁, ...'or @style:num-format = '一, 二, 三, ...' "> + <w:rFonts w:hint="fareast"/> + <!--wx:font wx:val="宋体"/ --> + </xsl:when> + </xsl:choose> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </w:fldSimple> + </xsl:template> + <xsl:template name="field_get_number_format"> + <!-- this template get the various of number formats for number type field--> + <xsl:param name="field_number_format_style"/> + <xsl:choose> + <xsl:when test=" $field_number_format_style = '1, 2, 3, ...' or $field_number_format_style = '1' "> + <xsl:text> \* Arabic </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '①, ②, ③, ...' "> + <xsl:text> \* CircleNum </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'i' "> + <xsl:text> \* roman </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'I' "> + <xsl:text> \* ROMAN </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '一, 二, 三, ...'"> + <xsl:text> \* CHINESENUM3 </xsl:text> + </xsl:when> + <xsl:when test=" $field_number_format_style ='壹, 貳, 參, ...' or $field_number_format_style ='壹, 貳, 參, ...' or $field_number_format_style ='壹, 贰, 叁, ...' "> + <xsl:text> \* CHINESENUM2 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '壱, 弐, 参, ...' "> + <xsl:text> \* DBNUM3 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '子, 丑, 寅, ...' "> + <xsl:text> \* ZODIAC2 </xsl:text> + </xsl:when> + <xsl:when test=" $field_number_format_style ='甲, 乙, 丙, ...' "> + <xsl:text> \* ZODIAC1 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'イ, ロ, ハ, ...' or $field_number_format_style = 'イ, ロ, ハ, ...' "> + <xsl:text> \* Iroha </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='ア, イ, ウ, ...' or $field_number_format_style ='ア, イ, ウ, ...' "> + <xsl:text> \* Aiueo </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '일, 이, 삼, ...' "> + <xsl:text> \* DBNUM1 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='ㄱ, ㄴ, ㄷ, ...' or $field_number_format_style = '㉠, ㉡, ㉢, ...' "> + <xsl:text> \* Chosung </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '가, 나, 다, ...' or $field_number_format_style = '㉮, ㉯, ㉰, ...' "> + <xsl:text> \* Ganada </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'ア, イ, ウ, ...' or $field_number_format_style = 'ア, イ, ウ, ...' "> + <xsl:text> \* Aiueo </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='a' "> + <xsl:text> \* alphabetic </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='A' "> + <xsl:text> \* ALPHABETIC </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'א, י, ק, ...' "> + <xsl:text> \* hebrew1 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'א, ב, ג, ...' "> + <xsl:text> \* hebrew2 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'أ, ب, ت, ...' "> + <xsl:text> \* ArabicAlpha </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'ก, ข, ฃ, ...' "> + <xsl:text> \* ThaiLetter </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="field_get_date_format"> + <xsl:param name="field_date_stylename"/> + <xsl:param name="field_date_value"/> + <!-- this template return null date format ATM--> + <xsl:text/> + </xsl:template> + <xsl:template name="field_get_time_format"> + <xsl:param name="field_time_stylename"/> + <xsl:param name="field_time_value"/> + <!-- this template return null date format ATM--> + <xsl:text/> + </xsl:template> + <xsl:template match="text:template-name"> + <xsl:choose> + <xsl:when test="@text:display='title' or @text:display= 'area' "> + <!-- directly export the content --> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </xsl:when> + <xsl:otherwise> + <w:fldSimple> + <xsl:variable name="template_attribute_value"> + <xsl:choose> + <xsl:when test="@text:display='name-and-extension' or @text:display= 'name' "> + <xsl:text> TEMPLATE </xsl:text> + </xsl:when> + <xsl:when test=" @text:display='full' or @text:display='path' "> + <xsl:text>TEMPLATE \p </xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text>\* MERGEFORMAT </xsl:text> + </xsl:variable> + <xsl:attribute name="w:instr"> + <xsl:value-of select="$template_attribute_value"/> + </xsl:attribute> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </w:fldSimple> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="text:text-input | text:variable-input | text:user-field-input"> + <w:fldSimple> + <xsl:variable name="text-input-attribute"> + <xsl:text>FILLIN </xsl:text> + <xsl:if test="@text:description"> + <xsl:value-of select="@text:description"/> + </xsl:if> + <xsl:text> \* MERGEFORMAT</xsl:text> + </xsl:variable> + <xsl:attribute name="w:instr"> + <xsl:value-of select="$text-input-attribute"/> + </xsl:attribute> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <xsl:call-template name="field_convert_linebreak"> + <xsl:with-param name="field_input_text" select="text()"/> + </xsl:call-template> + </w:r> + </w:fldSimple> + </xsl:template> + <xsl:template name="field_convert_linebreak"> + <!-- this template convert the linebreak (
 and 
) in continuous text to Ms word element<w:br/> --> + <xsl:param name="field_input_text"/> + <xsl:if test="not (contains($field_input_text,'
'))"> + <w:t> + <xsl:value-of select="$field_input_text"/> + </w:t> + </xsl:if> + <xsl:if test="contains($field_input_text,'
')"> + <w:t> + <xsl:value-of select="translate(substring-before($field_input_text,'
'),'
','')"/> + </w:t> + <w:br/> + <xsl:call-template name="field_convert_linebreak"> + <xsl:with-param name="field_input_text" select="substring-after($field_input_text,'
')"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="field_declare"> + <!-- this template export the field declaration to w:docpr --> + <xsl:param name="simple_field_variable_declares"/> + <xsl:param name="user_field_variable_declares"/> + <xsl:param name="field_sequence_declares"/> + <w:docVars> + <xsl:if test="$simple_field_variable_declares/text:variable-decl"> + <xsl:for-each select="$simple_field_variable_declares/text:variable-decl"> + <w:docVar w:name="{@text:name}" w:val="default value"/> + </xsl:for-each> + </xsl:if> + <xsl:if test="$user_field_variable_declares/text:user-field-decl"> + <xsl:for-each select="$user_field_variable_declares/text:user-field-decl"> + <w:docVar w:name="{@text:name}" w:val="{@text:string-value}"/> + </xsl:for-each> + </xsl:if> + <xsl:if test="$field_sequence_declares/text:sequence-decl"> + <!-- do nothing for sequence declares when exporting to MS word--> + </xsl:if> + </w:docVars> + </xsl:template> + <xsl:template match="text:reference-ref | text:bookmark-ref | text:footnote-ref + | text:endnote-ref "> + <!-- this template is for reference fields --> + <w:r> + <w:fldChar w:fldCharType="begin"/> + </w:r> + <xsl:variable name="complicate_field_instruction"> + <xsl:choose> + <xsl:when test=" name() = 'text:reference-ref' "> + <xsl:choose> + <xsl:when test=" string(@text:reference-format) = 'page' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'chapter' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'text' "> + <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'direction' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name() = 'text:footnote-ref' or name() = 'text:endnote-ref' "> + <xsl:choose> + <xsl:when test=" string(@text:reference-format) = 'page' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'chapter' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'text' "> + <xsl:value-of select="concat ( ' NOTEREF ' , @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'direction' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \p \h' ) "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name() = 'text:bookmark-ref' "> + <xsl:choose> + <xsl:when test=" string(@text:reference-format) = 'page' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'chapter' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'text' "> + <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'direction' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:variable> + <!--start to combine the complicate field instruction --> + <w:r> + <w:instrText> + <xsl:value-of select="$complicate_field_instruction"/> + </w:instrText> + </w:r> + <w:r> + <w:fldChar w:fldCharType="separate"/> + </w:r> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + <w:r> + <w:fldChar w:fldCharType="end"/> + </w:r> + </xsl:template> + <xsl:template match="text:chapter | text:sender-firstname | text:sender-lastname + | text:sender-street | text:sender-country | text:sender-postal-code + | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:table-count | text:image-count + | text:object-count | text:printed-by | text:hidden-paragraph + | text:placeholder | text:drop-down | text:conditional-text + | text:variable-set | text:table-formula | text:database-display + | text:database-next | text:database-select | text:database-row-number + | text:sequence-ref | text:expression | text:sheet-name | text:dde-connection"> + <!-- this template just export content of staroffice fields that do not have the corresponding fields in MS word ATM --> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </xsl:template> + <xsl:template match="text:execute-macro | text:variable-decls | text:variable-decl | text:user-field-decls | text:variable-decl | text:sequence-decls | text:sequence-decl | text:page-variable-set | text:bibliography-mark | text:script | text:page-continuation "> + <!-- this template is to ignore matched elements when exporting writer to word --> + </xsl:template> + <xsl:template match="text:a "> + <xsl:call-template name="export_hyoerlink"/> + </xsl:template> + <xsl:template name="export_hyoerlink"> + <!-- all params are used by draw --> + <xsl:param name="TargetMeasure"/> + <xsl:param name="x-adjust"/> + <xsl:param name="y-adjust"/> + <xsl:param name="force-draw"/> + <!-- this template processes the hyperlink in writer --> + <xsl:variable name="hyperlink_filename"> + <xsl:choose> + <xsl:when test="contains(@xlink:href, '#')"> + <xsl:value-of select="substring-before(@xlink:href, '#')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@xlink:href"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="hyperlink_bookmark"> + <xsl:if test="contains(@xlink:href, '#')"> + <xsl:choose> + <xsl:when test="contains(@xlink:href, '%7C')"> + <xsl:call-template name="translate_string"> + <xsl:with-param name="t_input_string" select="substring-before( substring-after(@xlink:href, '#'), '%7C')"/> + <xsl:with-param name="t_pattern_string" select=" '%20' "/> + <xsl:with-param name="t_substitute_string" select=" ' ' "/> + <xsl:with-param name="t_output_string" select=" '' "/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="translate_string"> + <xsl:with-param name="t_input_string" select="substring-after(@xlink:href, '#')"/> + <xsl:with-param name="t_pattern_string" select=" '%20' "/> + <xsl:with-param name="t_substitute_string" select=" ' ' "/> + <xsl:with-param name="t_output_string" select=" '' "/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:variable> + <w:hlink> + <xsl:if test="@xlink:href"> + <xsl:attribute name="w:dest"> + <xsl:value-of select="$hyperlink_filename"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="contains(@xlink:href, '#')"> + <xsl:attribute name="w:bookmark"> + <xsl:value-of select="$hyperlink_bookmark"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@office:target-frame-name"> + <xsl:attribute name="w:target"> + <xsl:value-of select="@office:target-frame-name"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@office:name"> + <xsl:attribute name="w:screenTip"> + <xsl:value-of select="@office:name"/> + </xsl:attribute> + </xsl:if> + <w:r> + <w:rPr> + <w:rStyle w:val="Hyperlink"/> + </w:rPr> + <!--apply inline-text-elements, many many many ... --> + <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text + | text:line-break | text:tab-stop | text:s | text:page-number | text:page-count | text:subject + | text:initial-creator | text:title | text:date | text:time | text:author-name + | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title + | text:sender-position | text:sender-phone-private | text:sender-phone-work + | text:sender-email | text:sender-fax | text:sender-state-or-province | text:word-count + | text:paragraph-count | text:character-count | text:table-count | text:image-count + | text:object-count | text:template-name | text:description | text:creation-time + | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time + | text:modification-date | text:user-defined | text:printed-by | text:hidden-paragraph + | text:placeholder | text:drop-down | text:conditional-text | text:text-input + | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence + | text:page-variable-set | text:page-variable-get | text:table-formula + | text:database-display | text:database-next| text:database-select + | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref + | text:expression | text:measure | text:dde-connection | text:sheet-name + | text:bibliography-mark | text:script | text:page-continuation | office:annotation + | draw:*"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </w:r> + </w:hlink> + </xsl:template> + <xsl:template name="translate_string"> + <!-- this template is to replace the substring matched t_pattern_string in t_t_input_string with t_substitute_string G.Y.--> + <xsl:param name="t_input_string"/> + <xsl:param name="t_pattern_string"/> + <xsl:param name="t_substitute_string"/> + <xsl:param name="t_output_string"/> + <xsl:variable name="t_temp_output_string"> + <xsl:if test="contains($t_input_string, $t_pattern_string) "> + <xsl:value-of select="concat($t_output_string, substring-before($t_input_string,$t_pattern_string), $t_substitute_string) "/> + </xsl:if> + <xsl:if test="not (contains($t_input_string, $t_pattern_string)) "> + <xsl:value-of select="$t_output_string"/> + </xsl:if> + </xsl:variable> + <xsl:if test="contains($t_input_string, $t_pattern_string) "> + <xsl:call-template name="translate_string"> + <xsl:with-param name="t_input_string" select="substring-after($t_input_string,$t_pattern_string)"/> + <xsl:with-param name="t_pattern_string" select="$t_pattern_string"/> + <xsl:with-param name="t_substitute_string" select="$t_substitute_string"/> + <xsl:with-param name="t_output_string" select="$t_temp_output_string"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not (contains($t_input_string, $t_pattern_string))"> + <xsl:value-of select="concat($t_temp_output_string, $t_input_string)"/> + </xsl:if> + </xsl:template> + <xsl:template name="add_hyperlink_style"> + <!--this template is to add the hyperlink related style --> + <w:style w:type="character" w:styleId="Hyperlink"> + <w:name w:val="Hyperlink"/> + <w:rsid w:val="006A55B0"/> + <w:rPr> + <w:color w:val="000080"/> + <w:u w:val="single"/> + </w:rPr> + </w:style> + <w:style w:type="character" w:styleId="FollowedHyperlink"> + <w:name w:val="FollowedHyperlink"/> + <w:rsid w:val="006A55B0"/> + <w:rPr> + <w:color w:val="800000"/> + <w:u w:val="single"/> + </w:rPr> + </w:style> + </xsl:template> + <xsl:template match="office:annotation"> + <!-- this template export writer note to word comments --> + <xsl:variable name="comments_aml_id"> + <xsl:call-template name="unique_amlid_generator"/> + </xsl:variable> + <aml:annotation w:type="Word.Comment.Start"> + <xsl:attribute name="aml:id"> + <xsl:value-of select="$comments_aml_id"/> + </xsl:attribute> + </aml:annotation> + <aml:annotation w:type="Word.Comment.End"> + <xsl:attribute name="aml:id"> + <xsl:value-of select="$comments_aml_id"/> + </xsl:attribute> + </aml:annotation> + <!-- export aml:annotation content--> + <w:r> + <w:rPr> + <w:rStyle w:val="CommentReference"/> + </w:rPr> + <aml:annotation aml:author="{@office:author}" aml:createdate="{@office:create-date}" w:type="Word.Comment" w:initials="{@office:author}"> + <xsl:attribute name="aml:id"> + <xsl:value-of select="$comments_aml_id"/> + </xsl:attribute> + <aml:content> + <xsl:apply-templates select="text:p"/> + </aml:content> + </aml:annotation> + </w:r> + <!-- end of export aml:annotation content--> + </xsl:template> + <xsl:template name="unique_amlid_generator"> + <!-- this template generate unique id for aml:id, ATM it only counts the office:annotation, some other elements might be added later --> + <xsl:number count="office:annotation" from="/office:document/office:body" level="any" format="1"/> + </xsl:template> + <xsl:template name="add_comments_style"> + <w:style w:type="character" w:styleId="CommentReference"> + <w:name w:val="annotation reference"/> + <w:basedOn w:val="DefaultParagraphFont"/> + <w:semiHidden/> + <w:rsid w:val="007770B7"/> + <w:rPr> + <w:sz w:val="16"/> + <w:sz-cs w:val="16"/> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="CommentText"> + <w:name w:val="annotation text"/> + <w:basedOn w:val="Normal"/> + <w:semiHidden/> + <w:rsid w:val="007770B7"/> + <w:pPr> + <w:pStyle w:val="CommentText"/> + </w:pPr> + <w:rPr> + <w:sz w:val="20"/> + <w:sz-cs w:val="20"/> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="CommentSubject"> + <w:name w:val="annotation subject"/> + <w:basedOn w:val="CommentText"/> + <w:next w:val="CommentText"/> + <w:semiHidden/> + <w:rsid w:val="007770B7"/> + <w:pPr> + <w:pStyle w:val="CommentSubject"/> + </w:pPr> + <w:rPr> + <w:b/> + <w:b-cs/> + </w:rPr> + </w:style> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_list.xsl b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl new file mode 100644 index 000000000..5ebf0e6ac --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl @@ -0,0 +1,349 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template name="ListStyles"> + <w:lists> + <xsl:if test="descendant::text:list-level-style-image"> + <xsl:call-template name="PicLists"/> + </xsl:if> + <xsl:apply-templates select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style" mode="style"/> + <xsl:for-each select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style"> + <w:list w:ilfo="{position()}"> + <w:ilst w:val="{position()-1}"/> + </w:list> + </xsl:for-each> + </w:lists> + </xsl:template> + <xsl:template match="text:list-style | text:outline-style" mode="style"> + <w:listDef w:listDefId="{position()-1}"> + <xsl:if test="name(..)='office:styles' and name()!='text:outline-style'"> + <w:styleLink w:val="{@style:name}"/> + </xsl:if> + <xsl:for-each select="text:list-level-style-number | text:list-level-style-bullet | text:list-level-style-image | text:outline-level-style"> + <xsl:if test="@text:level < 10"> + <w:lvl w:ilvl="{ @text:level - 1 }"> + <xsl:if test="name()='text:outline-level-style'"> + <xsl:variable name="headinglevel"> + <xsl:value-of select="@text:level"/> + </xsl:variable> + <xsl:if test="/office:document/office:body//text:h[@text:level=$headinglevel and @text:style-name]"> + <xsl:element name="w:pStyle"> + <xsl:attribute name="w:val"><xsl:value-of select="/office:document/office:body//text:h[@text:level=$headinglevel]/@text:style-name"/></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:if> + <xsl:choose> + <xsl:when test="@text:start-value"> + <w:start w:val="{@text:start-value}"/> + </xsl:when> + <xsl:otherwise> + <w:start w:val="1"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@text:bullet-char"> + <w:nfc w:val="23"/> + </xsl:when> + <xsl:when test="@style:num-format"> + <xsl:call-template name="convert_list_number"> + <xsl:with-param name="number-format" select="@style:num-format"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="name()='text:list-level-style-image'"> + <w:lvlText w:val="."/> + <w:lvlPicBulletId> + <xsl:attribute name="w:val"><xsl:value-of select="count(preceding::text:list-level-style-image)"/></xsl:attribute> + </w:lvlPicBulletId> + </xsl:when> + <xsl:when test="@text:bullet-char"> + <w:lvlText w:val="{@text:bullet-char}"/> + </xsl:when> + <xsl:when test="@text:display-levels and not(../@text:consecutive-numbering='true')"> + <xsl:variable name="levelText"> + <xsl:call-template name="displaylevel"> + <xsl:with-param name="number" select="@text:display-levels"/> + <xsl:with-param name="textlevel" select="@text:level"/> + </xsl:call-template> + </xsl:variable> + <w:lvlText w:val="{concat(@style:num-prefix, substring-after($levelText, '.'), @style:num-suffix)}"/> + </xsl:when> + <xsl:otherwise> + <w:lvlText w:val="{concat(@style:num-prefix, '%', @text:level, @style:num-suffix)}"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="style:list-level-properties/@fo:text-align = 'end'"> + <w:lvlJc w:val="right"/> + </xsl:when> + <xsl:when test="style:list-level-properties/@fo:text-align = 'center'"> + <w:lvlJc w:val="center"/> + </xsl:when> + <xsl:otherwise> + <w:lvlJc w:val="left"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:space-before | style:list-level-properties/@text:min-label-width | style:list-level-properties/@text:min-label-distance"> + <xsl:call-template name="list_position"/> + </xsl:when> + <xsl:otherwise> + <w:suff w:val="Nothing"/> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="key('text-style',@text:style-name)/style:text-properties" mode="character"/> + <xsl:apply-templates select="style:text-properties" mode="character"/> + </w:lvl> + </xsl:if> + </xsl:for-each> + </w:listDef> + </xsl:template> + <xsl:template match="text:list-style" mode="count"> + <xsl:value-of select="count(preceding::text:list-style | preceding::text:outline-style)+1"/> + </xsl:template> + <xsl:template match="text:unordered-list | text:ordered-list | text:list"> + <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list-item | text:list-header | text:list"/> + </xsl:template> + <xsl:template match="text:list-item | text:list-header"> + <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list | text:p | text:h"/> + </xsl:template> + <xsl:template name="displaylevel"> + <xsl:param name="number"/> + <xsl:param name="textlevel"/> + <xsl:if test="$number > 1"> + <xsl:call-template name="displaylevel"> + <xsl:with-param name="number" select="$number -1"/> + <xsl:with-param name="textlevel" select="number($textlevel)-1"/> + </xsl:call-template> + </xsl:if> + <xsl:value-of select="concat('.','%',$textlevel)"/> + </xsl:template> + <xsl:template name="list_position"> + <xsl:variable name="spacebefore"> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:space-before"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:list-level-properties/@text:space-before"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="space2text"> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:min-label-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-width"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="spacedistance"> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:min-label-distance"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-distance"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$spacedistance='0' and $space2text='0'"> + <w:suff w:val="Nothing"/> + </xsl:if> + <w:pPr> + <xsl:if test="$spacedistance!='0' or $space2text!='0'"> + <w:tabs> + <w:tab> + <xsl:attribute name="w:val">list</xsl:attribute> + <xsl:attribute name="w:pos"><xsl:choose><xsl:when test="number($spacedistance) > number($space2text)"><xsl:value-of select="number($spacebefore)+number($spacedistance)+150"/></xsl:when><xsl:otherwise><xsl:value-of select="number($spacebefore)+number($space2text)+150"/></xsl:otherwise></xsl:choose></xsl:attribute> + <!-- Since SO MinSpaceDistance is width after number or bullet, MS TabSpaceAfter include the number or bullet width. So +150 --> + </w:tab> + </w:tabs> + </xsl:if> + <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/> + <!-- w:pos(MS TabSpaceAfter) = text:space-before + MAX(text:min-label-distance,text:min-label-width) + ( Symbol width ); w:left(MS IndentAt)= text:space-before + text:min-label-width; w:hanging(MS IndentAt - MS AlignedAt)=text:min-label-width --> + </w:pPr> + </xsl:template> + <xsl:template name="PicLists"> + <xsl:for-each select="descendant::text:list-level-style-image"> + <w:listPicBullet w:listPicBulletId="{position()-1}"> + <w:pict> + <v:shape> + <xsl:variable name="Picwidth"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="style:list-level-properties/@fo:width"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="Picheight"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="style:list-level-properties/@fo:height"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style"><xsl:value-of select="concat('width:', number($Picwidth*1), 'pt;height:', number($Picheight*1), 'pt')"/></xsl:attribute> + <xsl:attribute name="o:bullet">t</xsl:attribute> + <v:stroke joinstyle="miter"/> + <w:binData w:name="{concat('wordml://SOpicbullet', position(), '.gif')}"> + <xsl:value-of select="office:binary-data"/> + </w:binData> + <v:imagedata src="{concat('wordml://SOpicbullet', position(), '.gif')}" o:title="{concat('SOpicbullet', position())}"/> + </v:shape> + </w:pict> + </w:listPicBullet> + </xsl:for-each> + </xsl:template> + <xsl:template name="convert_list_number"> + <xsl:param name="number-format"/> + <xsl:choose> + <xsl:when test="$number-format = 'a'"> + <!-- nfcLCLetter: Lowercase alpha --> + <w:nfc w:val="4"/> + </xsl:when> + <xsl:when test="$number-format = 'A'"> + <!-- nfcUCLetter: Uppercase alpha --> + <w:nfc w:val="3"/> + </xsl:when> + <xsl:when test="$number-format = 'i'"> + <!-- nfcLCRoman: Lowercase roman --> + <w:nfc w:val="2"/> + </xsl:when> + <xsl:when test="$number-format = 'I'"> + <!-- nfcUCRoman: Uppercase roman --> + <w:nfc w:val="1"/> + </xsl:when> + <xsl:when test="$number-format = '1st'"> + <!-- nfcUCOrdinal: Ordinal indicator --> + <w:nfc w:val="5"/> + </xsl:when> + <xsl:when test="$number-format = 'One'"> + <!-- nfcCardText: Cardinal --> + <w:nfc w:val="6"/> + </xsl:when> + <xsl:when test="$number-format = 'First'"> + <!-- nfcOrdText: Ordinal --> + <w:nfc w:val="7"/> + </xsl:when> + <xsl:when test="$number-format = '1, 2, 3, ...'"> + <!-- '1, 2, 3, ...' also seems: decimal-full-width2 --> + <w:nfc w:val="14"/> + </xsl:when> + <xsl:when test="$number-format = '①, ②, ③, ...'"> + <w:nfc w:val="18"/> + </xsl:when> + <xsl:when test="$number-format = '一, 二, 三, ...'"> + <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand, + taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 --> + <w:nfc w:val="10"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 贰, 叁, ...'"> + <w:nfc w:val="38"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 貳, 參, ...'"> + <w:nfc w:val="34"/> + </xsl:when> + <xsl:when test="$number-format = '甲, 乙, 丙, ...'"> + <w:nfc w:val="30"/> + </xsl:when> + <xsl:when test="$number-format = '子, 丑, 寅, ...'"> + <w:nfc w:val="31"/> + </xsl:when> + <xsl:when test="$number-format = '壱, 弐, 参, ...'"> + <w:nfc w:val="16"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:nfc w:val="12"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:nfc w:val="20"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:nfc w:val="13"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:nfc w:val="21"/> + </xsl:when> + <xsl:when test="$number-format = '일, 이, 삼, ...'"> + <w:nfc w:val="42"/> + </xsl:when> + <xsl:when test="$number-format = '하나, 둘, 셋, ...'"> + <w:nfc w:val="43"/> + </xsl:when> + <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'"> + <!-- mapping circled to uncircled --> + <w:nfc w:val="25"/> + </xsl:when> + <xsl:when test='$number-format = "가, 나, 다, ..." or $number-format = "㉮, ㉯, ㉰, ..."'> + <!-- mapping circled to uncircled --> + <w:nfc w:val="24"/> + </xsl:when> + <xsl:when test="$number-format ='أ, ب, ت, ...'"> + <!-- 46. arabic-alpha--> + <w:nfc w:val="46"/> + </xsl:when> + <xsl:when test="$number-format = 'ก, ข, ฃ, ...'"> + <!--53. thai-letters not match well !--> + <w:nfc w:val="53"/> + </xsl:when> + <xsl:when test="$number-format='א, י, ק, ...'"> + <!--45. hebrew-1--> + <w:nfc w:val="45"/> + </xsl:when> + <xsl:when test="$number-format='א, ב, ג, ...'"> + <!--47. hebrew-2--> + <w:nfc w:val="47"/> + </xsl:when> + <xsl:when test="string-length($number-format)=0"> + <w:nfc w:val="255"/> + </xsl:when> + <xsl:when test="$number-format = 'Native Numbering'"> + <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/> + <xsl:choose> + <xsl:when test="starts-with($locale, 'th-')"> + <!-- for Thai, mapping thai-numbers, thai-counting to thai-numbers --> + <w:nfc w:val="54"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'hi-')"> + <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers --> + <w:nfc w:val="51"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ar-')"> + <!-- for Arabic, mapping arabic-abjad to arabic-alpha --> + <w:nfc w:val="45"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'he-')"> + <!-- for Hebrew, mapping hebrew-2 to --> + <w:nfc w:val="46"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ru-')"> + <!-- for Russian, mapping russian-upper to russian-lower --> + <w:nfc w:val="58"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'vi-')"> + <!-- for Vietnamese --> + <w:nfc w:val="56"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <!-- unsupported: hex, chicago, bullet, ideograph-zodiac-traditional, + chinese-not-impl, korean-legal, none --> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_page.xsl b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl new file mode 100644 index 000000000..d32874e23 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl @@ -0,0 +1,392 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template name="page-background"> + <xsl:choose> + <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) > 0]"> + <w:bgPict> + <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) > 0]" mode="bgPict"/> + </w:bgPict> + </xsl:when> + <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) > 0]"> + <w:bgPict> + <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) > 0]" mode="bgPict"/> + </w:bgPict> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="style:background-image" mode="bgPict"> + <xsl:variable name="binName" select="concat('wordml://',generate-id(.))"/> + <w:binData w:name="{$binName}"> + <xsl:value-of select="translate(office:binary-data/text(),'	  ','' ) "/> + </w:binData> + <w:background w:bgcolor="{parent::style:page-layout-properties/@fo:background-color}" w:background="{$binName}"/> + </xsl:template> + <xsl:template match="style:page-layout-properties" mode="bgPict"> + <w:background w:bgcolor="{@fo:background-color}"/> + </xsl:template> + <xsl:template match="style:master-page"> + <xsl:apply-templates select="key( 'page-layout', @style:page-layout-name)"/> + <xsl:if test="style:header"> + <w:hdr w:type="odd"> + <xsl:apply-templates select="style:header/text:p | style:header/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:hdr> + </xsl:if> + <xsl:if test="style:header-left"> + <w:hdr w:type="even"> + <xsl:apply-templates select="style:header-left/text:p | style:header-left/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:hdr> + </xsl:if> + <xsl:if test="style:footer"> + <w:ftr w:type="odd"> + <xsl:apply-templates select="style:footer/text:p | style:footer/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:ftr> + </xsl:if> + <xsl:if test="style:footer-left"> + <w:ftr w:type="even"> + <xsl:apply-templates select="style:footer-left/text:p | style:footer-left/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:ftr> + </xsl:if> + </xsl:template> + <xsl:template match="style:page-layout"> + <xsl:choose> + <xsl:when test="@style:page-usage = 'left'"> + <w:type w:val="even-page"/> + </xsl:when> + <xsl:when test="@style:page-usage = 'right'"> + <w:type w:val="odd-page"/> + </xsl:when> + <xsl:when test="@style:page-usage = 'all'"> + <w:type w:val="next-page"/> + </xsl:when> + <!-- for mirrored, and default --> + <xsl:otherwise> + <w:type w:val="next-page"/> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="page-width"> + <xsl:if test="style:page-layout-properties/@fo:page-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-width"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="margin-left"> + <xsl:if test="style:page-layout-properties/@fo:margin-left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-left"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="margin-right"> + <xsl:if test="style:page-layout-properties/@fo:margin-right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-right"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <w:pgSz> + <xsl:if test="style:page-layout-properties/@fo:page-width"> + <xsl:attribute name="w:w"> + <xsl:value-of select="$page-width"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:page-height"> + <xsl:attribute name="w:h"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-height"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:print-orientation"> + <xsl:attribute name="w:orient"> + <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/> + </xsl:attribute> + </xsl:if> + </w:pgSz> + <w:pgMar> + <xsl:if test="style:page-layout-properties/@fo:margin-top"> + <xsl:variable name="top-margin"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:top"> + <xsl:value-of select="$top-margin"/> + </xsl:attribute> + <xsl:if test="style:header-style/style:page-layout-properties/@fo:min-height"> + <xsl:variable name="header-height"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:header-style/style:page-layout-properties/@fo:min-height"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:header"> + <xsl:value-of select="$top-margin - $header-height"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:margin-bottom"> + <xsl:variable name="bottom-margin"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-bottom"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:bottom"> + <xsl:value-of select="$bottom-margin"/> + </xsl:attribute> + <xsl:if test="style:footer-style/style:page-layout-properties/@fo:min-height"> + <xsl:variable name="footer-height"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:footer-style/style:page-layout-properties/@fo:min-height"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:footer"> + <xsl:value-of select="$bottom-margin - $footer-height"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:margin-left"> + <xsl:attribute name="w:left"> + <xsl:value-of select="$margin-left"/> + </xsl:attribute> + <xsl:attribute name="w:gutter"> + <xsl:value-of select="'0'"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:margin-right"> + <xsl:attribute name="w:right"> + <xsl:value-of select="$margin-right"/> + </xsl:attribute> + </xsl:if> + </w:pgMar> + <xsl:variable name="border-top" select="style:page-layout-properties/@fo:border-top | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-bottom" select="style:page-layout-properties/@fo:border-bottom | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-left" select="style:page-layout-properties/@fo:border-left | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-right" select="style:page-layout-properties/@fo:border-right | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-line-width-top" select="style:page-layout-properties/@style:border-line-width-top | style:page-layout-properties/@style:border-line-width "/> + <xsl:variable name="border-line-width-bottom" select="style:page-layout-properties/@style:border-line-width-bottom | style:page-layout-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-left" select="style:page-layout-properties/@style:border-line-width-left | style:page-layout-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-right" select="style:page-layout-properties/@style:border-line-width-right | style:page-layout-properties/@style:border-line-width"/> + <xsl:variable name="padding-top" select="style:page-layout-properties/@fo:padding-top | style:page-layout-properties/@fo:padding"/> + <xsl:variable name="padding-bottom" select="style:page-layout-properties/@fo:padding-bottom | style:page-layout-properties/@fo:padding"/> + <xsl:variable name="padding-left" select="style:page-layout-properties/@fo:padding-left | style:page-layout-properties/@fo:padding"/> + <xsl:variable name="padding-right" select="style:page-layout-properties/@fo:padding-right | style:page-layout-properties/@fo:padding"/> + <w:pgBorders w:offset-from="text"> + <xsl:if test="$border-top"> + <xsl:element name="w:top"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-top"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/> + <xsl:with-param name="so-border-position" select=" 'top' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-top"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-bottom"> + <xsl:element name="w:bottom"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-bottom"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/> + <xsl:with-param name="so-border-position" select=" 'bottom' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-bottom"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-left"> + <xsl:element name="w:left"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-left"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/> + <xsl:with-param name="so-border-position" select=" 'left' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-right"> + <xsl:element name="w:right"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-right"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/> + <xsl:with-param name="so-border-position" select=" 'right' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-right"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </w:pgBorders> + <xsl:variable name="valid-width"> + <xsl:value-of select="$page-width - $margin-left - $margin-right"/> + </xsl:variable> + <xsl:apply-templates select="style:page-layout-properties/style:columns"> + <xsl:with-param name="page-width" select="$valid-width"/> + </xsl:apply-templates> + <xsl:apply-templates select="/office:document/office:styles/text:linenumbering-configuration"/> + </xsl:template> + <xsl:template match="text:linenumbering-configuration"> + <xsl:if test="not(@text:number-lines = 'false')"> + <xsl:element name="w:lnNumType"> + <xsl:if test="@text:increment"> + <xsl:attribute name="w:count-by"> + <xsl:value-of select="@text:increment"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@text:offset"> + <xsl:attribute name="w:distance"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@text:offset"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="w:restart">continuous</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="style:style" mode="section"> + <xsl:param name="master-page"/> + <xsl:variable name="page-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:page-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="margin-left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="margin-right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-right"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="valid-width"> + <xsl:value-of select="$page-width - $margin-left - $margin-right"/> + </xsl:variable> + <w:type w:val="continuous"/> + <xsl:apply-templates select="style:section-properties/style:columns"> + <xsl:with-param name="page-width" select="$valid-width"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="style:columns"> + <xsl:param name="page-width"/> + <w:cols w:num="{@fo:column-count}"> + <xsl:if test="@fo:column-gap"> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:column-gap"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:column-sep"> + <xsl:attribute name="w:sep">on</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="not(style:column)"> + <xsl:attribute name="w:equalWidth">on</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:equalWidth">off</xsl:attribute> + <xsl:variable name="column-relative-width"> + <xsl:call-template name="get-sum-column-width"> + <xsl:with-param name="current-column" select="style:column[1]"/> + <xsl:with-param name="current-width" select="'0'"/> + </xsl:call-template> + </xsl:variable> + <xsl:for-each select="style:column"> + <xsl:element name="w:col"> + <xsl:attribute name="w:w"> + <xsl:value-of select="floor(substring-before(@style:rel-width,'*') * $page-width div $column-relative-width)"/> + </xsl:attribute> + <xsl:if test="@fo:margin-right"> + <xsl:variable name="margin-right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-right"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="following-sibling::style:column"> + <xsl:variable name="margin-left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:space"> + <xsl:value-of select="$margin-right + $margin-left"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:space"> + <xsl:value-of select="$margin-right"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </w:cols> + </xsl:template> + <xsl:template name="get-sum-column-width"> + <xsl:param name="current-column"/> + <xsl:param name="current-width"/> + <xsl:variable name="new-width" select="$current-width + substring-before($current-column/@style:rel-width,'*')"/> + <xsl:choose> + <xsl:when test="$current-column/following-sibling::style:column"> + <xsl:call-template name="get-sum-column-width"> + <xsl:with-param name="current-column" select="$current-column/following-sibling::style:column[1]"/> + <xsl:with-param name="current-width" select="$new-width"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$new-width"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_path.xsl b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl new file mode 100644 index 000000000..5eafe99ae --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl @@ -0,0 +1,849 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:include href="../../common/math.xsl"/> + <xsl:template name="test-arc"> + <xsl:call-template name="svg-arc2vml-arc"> + <!-- M 125,75 a100,50 0 ?,? 100,50 --> + <xsl:with-param name="x0" select="125"/> + <xsl:with-param name="y0" select="75"/> + <xsl:with-param name="rx" select="100"/> + <xsl:with-param name="ry" select="50"/> + <xsl:with-param name="x-axis-rotation" select="0"/> + <xsl:with-param name="large-arc-flag" select="0"/> + <xsl:with-param name="sweep-flag" select="0"/> + <xsl:with-param name="x" select="225"/> + <xsl:with-param name="y" select="125"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="test"> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="'M 36.0 162.0 C 38.0 168.0 39.0-172.0 40.0 176.0 S 42.0 184.0 144.0 188.0'"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="svgpath2vmlpath"> + <xsl:param name="svg-path"/> + <xsl:param name="vml-path" select="''"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command" select="'M'"/> + <xsl:param name="current-x" select="'0'"/> + <xsl:param name="current-y" select="'0'"/> + <xsl:variable name="command-and-newpos"> + <xsl:call-template name="get-path-command"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/> + <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/> + <xsl:choose> + <xsl:when test="$command = 'M' "> + <!-- absolute moveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' m ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="'L'"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'm' "> + <!-- relative moveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' t ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="'l'"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'L' "> + <!-- absolute lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'l' "> + <!-- relative lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' r ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'H' "> + <!-- absolute horizontal lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'h' "> + <!-- relative horizontal lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'V' "> + <!-- absolute vertical lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x"/> + <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'v' "> + <!-- relative horizontal lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x"/> + <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'C' "> + <!-- absolute curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'c' "> + <!-- relative curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'S' "> + <!-- absolute shorthand/smooth curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control-1"> + <xsl:choose> + <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 "> + <xsl:variable name="previous-control-2"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="count" select="2"/> + <xsl:with-param name="skipcount" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring-before($previous-control-2 , ':') "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($control-and-pos, ':') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 's' "> + <!-- absolute shorthand/smooth curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control-1"> + <xsl:choose> + <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 "> + <xsl:variable name="previous-control-2"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="count" select="2"/> + <xsl:with-param name="skipcount" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring-before($previous-control-2 , ':') "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($control-and-pos, ':') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'Q' "> + <!-- absolute quadratic bézier curves --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'q' "> + <!-- relative quadratic bézier curves --> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/> + <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ' , $absolute-number , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'Z' or $command = 'z' "> + <!-- closepath --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' x ' ) "/> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$vml-path"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-before"> + <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newposition + skip $skipcount of numbers + --> + <xsl:param name="svg-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="count" select="1"/> + <xsl:param name="skipcount" select="0"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$count = 0"> + <xsl:value-of select=" concat($number , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-pos"> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="direction" select="-1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="previous-num-and-pos"> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$num-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$skipcount > 0"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count"/> + <xsl:with-param name="skipcount" select="$skipcount - 1"/> + <xsl:with-param name="number" select="$number"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$skipcount = 0"> + <xsl:variable name="new-number"> + <xsl:if test="not($count = 1)"> + <xsl:value-of select="' '"/> + </xsl:if> + <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/> + </xsl:variable> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count - 1"/> + <xsl:with-param name="skipcount" select="0"/> + <xsl:with-param name="number" select="$new-number"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-after"> + <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newposition + skip $skipcount of numbers + --> + <xsl:param name="svg-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="count" select="1"/> + <xsl:param name="skipcount" select="0"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$count = 0"> + <xsl:value-of select=" concat($number , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-pos"> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="direction" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="next-num-and-pos"> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$num-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$skipcount > 0"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count"/> + <xsl:with-param name="skipcount" select="$skipcount - 1"/> + <xsl:with-param name="number" select="$number"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$skipcount = 0"> + <xsl:variable name="new-number"> + <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/> + <xsl:if test="not($count = 1)"> + <xsl:value-of select="' '"/> + </xsl:if> + </xsl:variable> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count - 1"/> + <xsl:with-param name="skipcount" select="0"/> + <xsl:with-param name="number" select="$new-number"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-position"> + <!-- get the next number start position, direction should be 1 or -1--> + <xsl:param name="svg-path"/> + <xsl:param name="position"/> + <xsl:param name="direction" select="1"/> + <xsl:choose> + <xsl:when test="$direction = 1 and $position > string-length($svg-path) ">0</xsl:when> + <xsl:when test="$direction = -1 and not($position > 0)">0</xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char"> + <xsl:if test="$direction = 1"> + <xsl:value-of select="substring($svg-path, $position , 1)"/> + </xsl:if> + <xsl:if test="$direction = -1"> + <xsl:value-of select="substring($svg-path, $position -1 , 1)"/> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '+-.0123456789' ,'')) = 0 "> + <!-- number start--> + <xsl:value-of select="$position"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position + $direction"/> + <xsl:with-param name="direction" select="$direction"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-next-number"> + <!-- get the next number from current position--> + <xsl:param name="svg-path"/> + <xsl:param name="position"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$position > string-length($svg-path) "> + <xsl:value-of select=" concat(round($number) , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 "> + <!-- is number --> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="number" select="concat( $number, $curr-char) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0"> + <!-- is number --> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="number" select="concat( $number, $curr-char) "/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat( round($number) , ':' , $position)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-previous-number"> + <!-- get the previous number from current position--> + <xsl:param name="svg-path"/> + <xsl:param name="position"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="not($position > 0)"> + <xsl:value-of select="concat( round($number ), ':0')"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($svg-path, $position -1 , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 "> + <!-- is number --> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position -1"/> + <xsl:with-param name="number" select="concat($curr-char , $number) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0"> + <!-- skip it --> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position -1"/> + <xsl:with-param name="number" select="$number "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) > 0"> + <!-- finish it with +/- --> + <xsl:value-of select="concat( round( concat( $curr-char, $number)) , ':' , $position)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat( round($number) , ':' , $position)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-path-command"> + <xsl:param name="svg-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command"/> + <xsl:choose> + <xsl:when test="$position > string-length($svg-path) "/> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , 'MmZzLlHhVvCcSsQqTtAa' ,'')) = 0 "> + <!-- "MmZzLlHhVvCcSsQqTtAa" are all possible command chars --> + <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-.0123456789' ,'')) = 0 "> + <!-- number start, use last command --> + <xsl:if test="string-length($last-command) = 0"> + <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message> + </xsl:if> + <xsl:value-of select="concat( $last-command , ':' , $position )"/> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , ',	  ' ,'')) = 0 "> + <!-- space or ',' should be skip --> + <xsl:call-template name="get-path-command"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="svg-arc2vml-arc"> + <xsl:param name="x0"/> + <xsl:param name="y0"/> + <xsl:param name="rx"/> + <xsl:param name="ry"/> + <xsl:param name="x-axis-rotation" select="0"/> + <xsl:param name="large-arc-flag" select="0"/> + <xsl:param name="sweep-flag" select="0"/> + <xsl:param name="x"/> + <xsl:param name="y"/> + <!-- Compute 1/2 distance between current and final point --> + <xsl:variable name="dx2" select="($x0 - $x) div 2"/> + <xsl:variable name="dy2" select="($y0 - $y) div 2"/> + <!-- Convert from degrees to radians --> + <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/> + <!-- Compute (x1, y1). What are x1,y1?--> + <xsl:variable name="cos-rotation"> + <xsl:call-template name="cos"> + <xsl:with-param name="x" select="$rotation-radian"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="sin-rotation"> + <xsl:call-template name="sin"> + <xsl:with-param name="x" select="$rotation-radian"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/> + <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/> + <!-- Make sure radii are large enough --> + <xsl:variable name="rx-abs"> + <xsl:call-template name="abs"> + <xsl:with-param name="x" select="$rx"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="ry-abs"> + <xsl:call-template name="abs"> + <xsl:with-param name="x" select="$ry"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/> + <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/> + <xsl:variable name="x1-sq" select="$x1 * $x1"/> + <xsl:variable name="y1-sq" select="$y1 * $y1"/> + <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/> + <xsl:variable name="radius-check-sqrt"> + <xsl:call-template name="sqrt"> + <xsl:with-param name="x" select="$radius-check"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="new-rx"> + <xsl:choose> + <xsl:when test="$radius-check > 1"> + <xsl:value-of select="$rx-abs * $radius-check-sqrt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$rx-abs"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="new-ry"> + <xsl:choose> + <xsl:when test="$radius-check > 1"> + <xsl:value-of select="$ry-abs * $radius-check-sqrt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$ry-abs"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="new-ry-sq"> + <xsl:choose> + <xsl:when test="$radius-check > 1"> + <xsl:value-of select="$new-ry * $new-ry"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$ry-sq"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="new-rx-sq"> + <xsl:choose> + <xsl:when test="$radius-check > 1"> + <xsl:value-of select="$new-rx * $new-rx"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$rx-sq"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- Step 2: Compute (cx1, cy1) --> + <xsl:variable name="sign"> + <xsl:choose> + <xsl:when test="$large-arc-flag = $sweep-flag">-1</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="unchecked-sq" select=" (($new-rx-sq * $new-ry-sq) - ($new-rx-sq * $y1-sq) - ($new-ry-sq * $x1-sq)) div (($new-rx-sq * $y1-sq) + ($new-ry-sq * $x1-sq)) "/> + <xsl:variable name="sq"> + <xsl:choose> + <xsl:when test=" $unchecked-sq < 0">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$unchecked-sq"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="sq-sqrt"> + <xsl:call-template name="sqrt"> + <xsl:with-param name="x" select="$sq"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="coef" select="$sign * $sq-sqrt "/> + <xsl:variable name="cx1" select="$coef * $new-rx * $y1 div $new-ry"/> + <xsl:variable name="cy1" select=" -1 * $coef * $new-ry * $x1 div $new-rx"/> + <!-- Step 3: Compute (cx, cy) from (cx1, cy1) --> + <xsl:variable name="sx2" select="($x0 +$x) div 2 "/> + <xsl:variable name="sy2" select="($y0 +$y) div 2 "/> + <xsl:variable name="tmp1" select="$cos-rotation * $cx1 "/> + <xsl:variable name="tmp2" select="$cos-rotation * $cx1 "/> + <xsl:variable name="cx" select=" $sx2 + ( $cos-rotation * $cx1 - $sin-rotation * $cy1 ) "/> + <xsl:variable name="cy" select=" $sy2 + ( $sin-rotation * $cx1 + $cos-rotation * $cy1 ) "/> + <!-- Step 4: Compute angle start and angle extent --> + <xsl:variable name="ux" select="( $x1 - $cx1) div $new-rx"/> + <xsl:variable name="uy" select="( $y1 - $cy1) div $new-ry"/> + <xsl:variable name="vx" select="( - 1 * $x1 - $cx1) div $new-rx"/> + <xsl:variable name="vy" select="(- 1 * $y1 - $cy1) div $new-ry"/> + <xsl:variable name="n"> + <xsl:call-template name="sqrt"> + <xsl:with-param name="x" select=" ($ux * $ux) + ($uy * $uy) "/> + </xsl:call-template> + </xsl:variable> + <!-- 1 * ux + 0 * uy --> + <xsl:variable name="p" select="$ux"/> + <xsl:variable name="uy-sign"> + <xsl:choose> + <xsl:when test=" $uy < 0 ">-1</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="acos-pn"> + <xsl:call-template name="acos"> + <xsl:with-param name="x" select="$p div $n"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="theta" select="( $uy-sign * $acos-pn * 180 div $pi ) mod 360 "/> + <xsl:variable name="n-delta"> + <xsl:call-template name="sqrt"> + <xsl:with-param name="x" select="($ux * $ux + $uy * $uy) * ($vx * $vx + $vy * $vy)"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="p-delta" select="$ux * $vx + $uy * $vy"/> + <xsl:variable name="vy-sign"> + <xsl:choose> + <xsl:when test="($ux * $vy - $uy * $vx) < 0 ">-1</xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="acos-pn-delta"> + <xsl:call-template name="acos"> + <xsl:with-param name="x" select="$p-delta div $n-delta"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="unchecked-delta" select="$vy-sign * $acos-pn-delta * 180 div $pi "/> + <xsl:variable name="delta"> + <xsl:choose> + <xsl:when test=" $sweep-flag = 0 and $unchecked-delta > 0 "> + <xsl:value-of select=" ($unchecked-delta - 360) mod 360 "/> + </xsl:when> + <xsl:when test=" $sweep-flag = 1 and $unchecked-delta < 0 "> + <xsl:value-of select=" ($unchecked-delta + 360) mod 360 "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" $unchecked-delta mod 360 "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat ($cx, ' ' , $cy, ' ' , $rx, ' ' , $ry, ' ' , $theta, ' ' , $delta, ' ' , $x-axis-rotation) "/> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl new file mode 100644 index 000000000..2130db508 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template match="office:settings"> + <w:docPr> + <w:displayBackgroundShape/> + <xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/> + <xsl:choose> + <xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'"> + <w:view w:val="outline"/> + </xsl:when> + <xsl:otherwise> + <w:view w:val="print"/> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/> + <w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}"> + <xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/> + <xsl:choose> + <xsl:when test="$zoom-type = '3'"> + <xsl:attribute name="w:val">best-fit</xsl:attribute> + </xsl:when> + <xsl:when test="$zoom-type = '2'"> + <xsl:attribute name="w:val">full-page</xsl:attribute> + </xsl:when> + <xsl:when test="$zoom-type = '1'"> + <xsl:attribute name="w:val">text-fit</xsl:attribute> + </xsl:when> + </xsl:choose> + </w:zoom> + <w:defaultTabStop> + <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute> + </w:defaultTabStop> + <xsl:if test="../office:master-styles/style:master-page/style:header-left"> + <w:evenAndOddHeaders/> + </xsl:if> + <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/> + <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/> + <!-- add the variables declaration in w:docpr G.Y. Begin--> + <xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls "> + <xsl:call-template name="field_declare"> + <xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/> + <xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/> + <xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/> + </xsl:call-template> + </xsl:if> + <!--add the variables declaration in w:docpr G.Y. End--> + </w:docPr> + </xsl:template> + <xsl:template match="text:footnotes-configuration"> + <xsl:param name="within-section"/> + <w:footnotePr> + <xsl:choose> + <xsl:when test="@text:footnotes-position = 'document'"> + <w:pos w:val="beneath-text"/> + </xsl:when> + <xsl:otherwise> + <w:pos w:val="page-bottom"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@text:start-value"> + <w:numStart w:val="{@text:start-value + 1}"/> + </xsl:if> + <xsl:if test="@style:num-format"> + <xsl:call-template name="convert-number-format"> + <xsl:with-param name="number-format" select="@style:num-format"/> + <xsl:with-param name="number-prefix" select="@style:num-prefix"/> + <xsl:with-param name="number-suffix" select="@style:num-suffix"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="@text:start-numbering-at"> + <xsl:choose> + <xsl:when test="@text:start-numbering-at = 'document'"> + <w:numRestart w:val="continuous"/> + </xsl:when> + <xsl:when test="@text:start-numbering-at = 'page'"> + <w:numRestart w:val="each-page"/> + </xsl:when> + <!-- convert "chapter" to "section" --> + <xsl:otherwise> + <w:numRestart w:val="each-sect"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$within-section != 'yes'"> + <!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator + is defined solely in docPr, so not trouble to find the proper footnote-sep definition. --> + <w:footnote w:type="separator"> + <w:p> + <w:r> + <w:separator/> + </w:r> + </w:p> + </w:footnote> + <w:footnote w:type="continuation-separator"> + <w:p> + <w:r> + <w:continuationSeparator/> + <xsl:if test="text:footnote-continuation-notice-backward"> + <w:t> + <xsl:value-of select="text:footnote-continuation-notice-backward"/> + </w:t> + </xsl:if> + </w:r> + </w:p> + </w:footnote> + <xsl:if test="text:footnote-continuation-notice-forward"> + <w:footnote w:type="continuation-notice"> + <w:p> + <w:r> + <w:t> + <xsl:value-of select="text:footnote-continuation-notice-forward"/> + </w:t> + </w:r> + </w:p> + </w:footnote> + </xsl:if> + </xsl:if> + </w:footnotePr> + </xsl:template> + <xsl:template match="text:endnotes-configuration"> + <xsl:param name="within-section"/> + <w:endnotePr> + <w:pos w:val="sect-end"/> + <xsl:if test="@text:start-value"> + <w:numStart w:val="{@text:start-value + 1}"/> + </xsl:if> + <xsl:if test="@style:num-format"> + <xsl:call-template name="convert-number-format"> + <xsl:with-param name="number-format" select="@style:num-format"/> + <xsl:with-param name="number-prefix" select="@style:num-prefix"/> + <xsl:with-param name="number-suffix" select="@style:num-suffix"/> + </xsl:call-template> + </xsl:if> + <w:numRestart w:val="each-sect"/> + <xsl:if test="$within-section != 'yes'"> + <w:endnote w:type="separator"> + <w:p> + <w:r> + <w:separator/> + </w:r> + </w:p> + </w:endnote> + <w:endnote w:type="continuation-separator"> + <w:p> + <w:r> + <w:continuationSeparator/> + </w:r> + </w:p> + </w:endnote> + </xsl:if> + </w:endnotePr> + </xsl:template> + <xsl:template name="convert-number-format"> + <xsl:param name="number-format"/> + <xsl:param name="number-prefix"/> + <xsl:param name="number-suffix"/> + <xsl:choose> + <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'"> + <w:numFmt w:val="decimal-zero"/> + </xsl:when> + <xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'"> + <w:numFmt w:val="decimal-enclosed-fullstop"/> + </xsl:when> + <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'"> + <w:numFmt w:val="decimal-enclosed-paren"/> + </xsl:when> + <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'"> + <w:numFmt w:val="number-in-dash"/> + </xsl:when> + <xsl:when test="$number-format = '1'"> + <!-- '1' also seems: decimal-half-width --> + <w:numFmt w:val="decimal"/> + </xsl:when> + <xsl:when test="$number-format = 'a'"> + <w:numFmt w:val="lower-letter"/> + </xsl:when> + <xsl:when test="$number-format = 'A'"> + <w:numFmt w:val="upper-letter"/> + </xsl:when> + <xsl:when test="$number-format = 'i'"> + <w:numFmt w:val="lower-roman"/> + </xsl:when> + <xsl:when test="$number-format = 'I'"> + <w:numFmt w:val="upper-roman"/> + </xsl:when> + <xsl:when test="$number-format = '1, 2, 3, ...'"> + <!-- '1, 2, 3, ...' also seems: decimal-full-width2 --> + <w:numFmt w:val="decimal-full-width"/> + </xsl:when> + <xsl:when test="$number-format = '①, ②, ③, ...'"> + <!-- decimal-enclosed-circle seems same --> + <w:numFmt w:val="decimal-enclosed-circle-chinese"/> + </xsl:when> + <xsl:when test="$number-format = '一, 二, 三, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'"> + <w:numFmt w:val="ideograph-enclosed-circle"/> + </xsl:when> + <xsl:when test="$number-format = '一, 二, 三, ...'"> + <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand, + taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 --> + <w:numFmt w:val="chinese-counting-thousand"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 贰, 叁, ...'"> + <w:numFmt w:val="chinese-legal-simplified"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 貳, 參, ...'"> + <w:numFmt w:val="ideograph-legal-traditional"/> + </xsl:when> + <xsl:when test="$number-format = '甲, 乙, 丙, ...'"> + <w:numFmt w:val="ideograph-traditional"/> + </xsl:when> + <xsl:when test="$number-format = '子, 丑, 寅, ...'"> + <w:numFmt w:val="ideograph-zodiac"/> + </xsl:when> + <xsl:when test="$number-format = '壱, 弐, 参, ...'"> + <w:numFmt w:val="japanese-legal"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:numFmt w:val="aiueo-full-width"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:numFmt w:val="aiueo"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:numFmt w:val="iroha-full-width"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:numFmt w:val="iroha"/> + </xsl:when> + <xsl:when test="$number-format = '일, 이, 삼, ...'"> + <w:numFmt w:val="korean-counting"/> + </xsl:when> + <xsl:when test="$number-format = '하나, 둘, 셋, ...'"> + <w:numFmt w:val="korean-legal"/> + </xsl:when> + <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'"> + <!-- mapping circled to uncircled --> + <w:numFmt w:val="chosung"/> + </xsl:when> + <xsl:when test="$number-format = '가, 나, 다, ...' or $number-format = '㉮, ㉯, ㉰, ...'"> + <!-- mapping circled to uncircled --> + <w:numFmt w:val="ganada"/> + </xsl:when> + <xsl:when test="$number-format = 'أ, ب, ت, ...'"> + <w:numFmt w:val="arabic-alpha"/> + </xsl:when> + <xsl:when test="$number-format = 'ก, ข, ฃ, ...'"> + <w:numFmt w:val="thai-letters"/> + </xsl:when> + <xsl:when test="$number-format = 'א, י, ק, ...'"> + <w:numFmt w:val="hebrew-1"/> + </xsl:when> + <xsl:when test="$number-format = 'א, ב, ג, ...'"> + <w:numFmt w:val="hebrew-2"/> + </xsl:when> + <xsl:when test="$number-format = 'Native Numbering'"> + <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/> + <xsl:choose> + <xsl:when test="starts-with($locale, 'th-')"> + <!-- for Thai, mapping thai-numbers, thai-counting to thai-letters --> + <w:numFmt w:val="thai-letters"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'hi-')"> + <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers --> + <w:numFmt w:val="hindi-numbers"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ar-')"> + <!-- for Arabic, mapping arabic-abjad to arabic-alpha --> + <w:numFmt w:val="arabic-alpha"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'he-')"> + <!-- for Hebrew, mapping hebrew-2 to --> + <w:numFmt w:val="hebrew-1"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ru-')"> + <!-- for Russian, mapping russian-upper to russian-lower --> + <w:numFmt w:val="russian-lower"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'vi-')"> + <!-- for Vietnamese --> + <w:numFmt w:val="vietnamese-counting"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional, + chinese-not-impl --> + <xsl:otherwise> + <w:numFmt w:val="decimal"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_table.xsl b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl new file mode 100644 index 000000000..6812b8dee --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl @@ -0,0 +1,407 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:key name="table-style" match="style:style[@style:family='table']" use="@style:name"/> + <xsl:key name="table-column-style" match="style:style[@style:family='table-column']" use="@style:name"/> + <xsl:key name="table-row-style" match="style:style[@style:family='table-row']" use="@style:name"/> + <xsl:key name="table-cell-style" match="style:style[@style:family='table-cell']" use="@style:name"/> + <xsl:template match="style:table-properties" mode="table"> + <xsl:param name="within-body"/> + <xsl:if test="$within-body = 'yes'"> + <w:tblW> + <xsl:choose> + <xsl:when test="@style:rel-width"> + <xsl:attribute name="w:w"><xsl:value-of select="substring-before(@style:rel-width, '%') * 50"/></xsl:attribute> + <xsl:attribute name="w:type">pct</xsl:attribute> + </xsl:when> + <xsl:when test="@style:width"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@style:width"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="w:type">dxa</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:w">0</xsl:attribute> + <xsl:attribute name="w:type">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:tblW> + </xsl:if> + <w:tblInd> + <xsl:choose> + <xsl:when test="@fo:margin-left"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@fo:margin-left"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="w:type">dxa</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:w">0</xsl:attribute> + <xsl:attribute name="w:type">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:tblInd> + <xsl:if test="@table:align"> + <w:jc> + <xsl:choose> + <xsl:when test="@table:align = 'left' or @table:align= 'center' or @table:align = 'right'"> + <xsl:attribute name="w:val"><xsl:value-of select="@table:align"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val">left</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:jc> + </xsl:if> + </xsl:template> + <xsl:template match="table:table"> + <!--fix for issue i32030 pagebreak before--> + <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"> + <xsl:variable name="table-break-before" select="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"/> + <xsl:choose> + <xsl:when test="$table-break-before = 'page' "> + <w:p> + <w:r> + <w:br w:type="page"/> + </w:r> + </w:p> + </xsl:when> + <xsl:when test="$table-break-before = 'column' "> + <w:p> + <w:r> + <w:br w:type="column"/> + </w:r> + </w:p> + </xsl:when> + </xsl:choose> + </xsl:if> + <w:tbl> + <w:tblPr> + <xsl:if test="not (@table:is-sub-table) or (@table:is-sub-table = 'false' )"> + <w:tblStyle w:val="{@table:style-name}"/> + <xsl:apply-templates select="key('table-style', @table:style-name)/style:table-properties" mode="table"> + <xsl:with-param name="within-body" select="'yes'"/> + </xsl:apply-templates> + </xsl:if> + <xsl:if test="@table:is-sub-table ='true' "> + <w:tblW w:type="dxa"> + <xsl:variable name="sub-table-width"> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="table:table-column[1]"/> + <xsl:with-param name="total-sub-table-width" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:w"><xsl:value-of select="$sub-table-width"/></xsl:attribute> + </w:tblW> + <!--w:tblLayout w:type="Fixed"/--> + </xsl:if> + </w:tblPr> + <w:tblGrid> + <xsl:apply-templates select="table:table-column"/> + </w:tblGrid> + <xsl:apply-templates select="table:table-header-rows/table:table-row | table:table-row"/> + </w:tbl> + <!--fix for issue i32030 pagebreak after--> + <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-after"> + <xsl:variable name="table-break-after" select=" key('table-style', @table:style-name)/style:table-properties/@fo:break-after"/> + <xsl:choose> + <xsl:when test="$table-break-after = 'page' "> + <w:p> + <w:r> + <w:br w:type="page"/> + </w:r> + </w:p> + </xsl:when> + <xsl:when test="$table-break-after = 'column' "> + <w:p> + <w:r> + <w:br w:type="column"/> + </w:r> + </w:p> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="name(..)= 'table:table-cell' "> + <w:p/> + </xsl:if> + </xsl:template> + <xsl:template name="calculate-sub-table-width"> + <xsl:param name="sub-table-column-node"/> + <xsl:param name="total-sub-table-width"/> + <xsl:variable name="column-width" select="key('table-column-style', $sub-table-column-node/@table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="column-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$column-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$sub-table-column-node/following-sibling::table:table-column"> + <xsl:choose> + <xsl:when test="$sub-table-column-node/@table:number-columns-repeated"> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[ 1]"/> + <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[1]"/> + <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip "/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$sub-table-column-node/@table:number-columns-repeated"> + <xsl:value-of select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$total-sub-table-width + $column-width-in-twip "/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="table:table-column"> + <xsl:variable name="column-width" select="key('table-column-style', @table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="column-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$column-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <!-- if table:table-column has attribute table:number-columns-repeated, then call the recursion + temple repeat-gridcol to produce multiple w:gridCol in MS word. Gary.Yang --> + <xsl:when test="@table:number-columns-repeated"> + <xsl:call-template name="repeat-gridcol"> + <xsl:with-param name="grid-repeat-count" select="@table:number-columns-repeated"/> + <xsl:with-param name="column-width" select="$column-width-in-twip"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <w:gridCol w:w="{$column-width-in-twip}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--recursion template for produce multiple w:gridCol Gary.Yang--> + <xsl:template name="repeat-gridcol"> + <xsl:param name="grid-repeat-count"/> + <xsl:param name="column-width"/> + <xsl:if test="$grid-repeat-count > 0"> + <w:gridCol w:w="{$column-width}"/> + <xsl:call-template name="repeat-gridcol"> + <xsl:with-param name="grid-repeat-count" select="$grid-repeat-count - 1"/> + <xsl:with-param name="column-width" select="$column-width"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template match="table:table-row"> + <xsl:element name="w:tr"> + <xsl:element name="w:trPr"> + <xsl:if test="parent::table:table-header-rows"> + <!-- fix for Issue 32034--> + <w:tblHeader>on</w:tblHeader> + </xsl:if> + <xsl:variable name="row-height" select="key('table-row-style', @table:style-name)/style:table-row-properties/@style:row-height"/> + <xsl:if test="$row-height"> + <w:trHeight> + <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$row-height"/></xsl:call-template></xsl:attribute> + </w:trHeight> + </xsl:if> + </xsl:element> + <!--end of w:trPr--> + <xsl:apply-templates select="table:table-cell "/> + </xsl:element> + </xsl:template> + <xsl:template match="table:table-cell "> + <xsl:element name="w:tc"> + <xsl:element name="w:tcPr"> + <!-- to calculate the table-cell width Gary.Yang --> + <xsl:choose> + <!--when the table-cell contains the sub-table --> + <xsl:when test="table:table/@table:is-sub-table= 'true' "> + <xsl:variable name="table-cell-width"> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="table:table/table:table-column[1]"/> + <xsl:with-param name="total-sub-table-width" select="0"/> + </xsl:call-template> + </xsl:variable> + <w:tcW w:type="dxa"> + <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute> + </w:tcW> + </xsl:when> + <xsl:otherwise> + <!-- when the table-cell doesn't contain the sub-table --> + <xsl:variable name="table-cell-width"> + <xsl:call-template name="calculate-table-cell-width"> + <xsl:with-param name="table-cell-position" select="position()"/> + <xsl:with-param name="table-column" select="ancestor::table:table[1]/table:table-column[1]"/> + </xsl:call-template> + </xsl:variable> + <w:tcW w:type="dxa"> + <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute> + </w:tcW> + <!-- for performance issue, we can set w:type to auto that makes the cell width auto fit the content. --> + <!--w:tcW w:w="0" w:type="auto"/--> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@table:number-columns-spanned"> + <w:gridSpan w:val="{@table:number-columns-spanned}"/> + </xsl:if> + <xsl:variable name="cell-style-properties" select="key('table-cell-style', @table:style-name)/style:table-cell-properties"/> + <xsl:if test="$cell-style-properties/@fo:background-color"> + <w:shd w:val="solid" w:color="{substring-after($cell-style-properties/@fo:background-color,'#')}"/> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:vertical-align"> + <xsl:choose> + <xsl:when test="$cell-style-properties/@fo:vertical-align = 'middle'"> + <w:vAlign w:val="center"/> + </xsl:when> + <xsl:when test="$cell-style-properties/@fo:vertical-align = 'Automatic'"> + <w:vAlign w:val="both"/> + </xsl:when> + <xsl:otherwise> + <w:vAlign w:val="{$cell-style-properties/@fo:vertical-align}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <w:tcMar> + <xsl:if test="$cell-style-properties/@fo:padding-top"> + <w:top w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-top"/></xsl:call-template></xsl:attribute> + </w:top> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:padding-bottom"> + <w:bottom w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-bottom"/></xsl:call-template></xsl:attribute> + </w:bottom> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:padding-left"> + <w:left w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-left"/></xsl:call-template></xsl:attribute> + </w:left> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:padding-right"> + <w:right w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-right"/></xsl:call-template></xsl:attribute> + </w:right> + </xsl:if> + </w:tcMar> + <!-- the following code is to get the cell borders if they exist --> + <xsl:variable name="border-top" select="$cell-style-properties/@fo:border-top | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-bottom" select="$cell-style-properties/@fo:border-bottom | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-left" select="$cell-style-properties/@fo:border-left | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-right" select="$cell-style-properties/@fo:border-right | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-line-width-top" select="$cell-style-properties/@style:border-line-width-top | $cell-style-properties/@style:border-line-width "/> + <xsl:variable name="border-line-width-bottom" select="$cell-style-properties/@style:border-line-width-bottom | $cell-style-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-left" select="$cell-style-properties/@style:border-line-width-left | $cell-style-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-right" select="$cell-style-properties/@style:border-line-width-right | $cell-style-properties/@style:border-line-width"/> + <xsl:element name="w:tcBorders"> + <xsl:if test="$border-top"> + <xsl:element name="w:top"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-top"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/> + <xsl:with-param name="so-border-position" select=" 'top' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$border-bottom"> + <xsl:element name="w:bottom"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-bottom"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/> + <xsl:with-param name="so-border-position" select=" 'bottom' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$border-left"> + <xsl:element name="w:left"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-left"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/> + <xsl:with-param name="so-border-position" select=" 'left' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$border-right"> + <xsl:element name="w:right"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-right"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/> + <xsl:with-param name="so-border-position" select=" 'right' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:element> + <xsl:if test="not (*) "> + <w:p/> + </xsl:if> + <xsl:apply-templates select=" text:p | table:table | text:h | office:annotation"/> + </xsl:element> + </xsl:template> + <xsl:template name="calculate-table-cell-width"> + <xsl:param name="table-cell-position"/> + <xsl:param name="table-column"/> + <xsl:choose> + <xsl:when test="$table-column/@table:number-columns-repeated"> + <xsl:choose> + <xsl:when test="($table-cell-position - $table-column/@table:number-columns-repeated) <= 0"> + <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="table-cell-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$table-cell-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$table-cell-width-in-twip"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="calculate-table-cell-width"> + <xsl:with-param name="table-cell-position" select="$table-cell-position - $table-column/@table:number-columns-repeated"/> + <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- if the $table-column doesn't contain the table:number-columns-repeated attribute --> + <xsl:choose> + <xsl:when test="($table-cell-position - 1) = 0"> + <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="table-cell-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$table-cell-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$table-cell-width-in-twip"/> + </xsl:when> + <xsl:when test="($table-cell-position - 1) > 0"> + <xsl:call-template name="calculate-table-cell-width"> + <xsl:with-param name="table-cell-position" select=" $table-cell-position - 1 "/> + <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:value-of select=" 'calculate table cell width wrong ' "/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_text.xsl b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl new file mode 100644 index 000000000..406c8cb91 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl @@ -0,0 +1,1270 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template match="style:paragraph-properties" mode="paragraph"> + <w:pPr> + <w:adjustRightInd w:val="off"/> + <xsl:if test="@fo:break-before = 'page'"> + <w:pageBreakBefore w:val="on"/> + </xsl:if> + <xsl:if test="contains(@style:writing-mode, 'rl')"> + <w:bidi/> + </xsl:if> + <xsl:choose> + <xsl:when test="@fo:text-align-last = 'start'"> + <xsl:choose> + <xsl:when test="contains(@style:writing-mode, 'rl')"> + <w:jc w:val="right"/> + </xsl:when> + <xsl:otherwise> + <w:jc w:val="left"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@fo:text-align-last = 'justify'"> + <w:jc w:val="distribute"/> + </xsl:when> + <xsl:when test="@fo:text-align-last = 'center'"> + <w:jc w:val="center"/> + </xsl:when> + <xsl:when test="@fo:text-align = 'start'"> + <xsl:choose> + <xsl:when test="contains(@style:writing-mode, 'rl')"> + <w:jc w:val="right"/> + </xsl:when> + <xsl:otherwise> + <w:jc w:val="left"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@fo:text-align = 'end'"> + <xsl:choose> + <xsl:when test="contains(@style:writing-mode, 'rl')"> + <w:jc w:val="left"/> + </xsl:when> + <xsl:otherwise> + <w:jc w:val="right"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@fo:text-align = 'justify'"> + <w:jc w:val="distribute"/> + </xsl:when> + <xsl:when test="@fo:text-align = 'center'"> + <w:jc w:val="center"/> + </xsl:when> + </xsl:choose> + <w:spacing> + <xsl:choose> + <xsl:when test="@fo:line-height"> + <xsl:choose> + <xsl:when test="contains(@fo:line-height, '%')"> + <xsl:attribute name="w:line-rule">auto</xsl:attribute> + <xsl:attribute name="w:line"> + <xsl:value-of select="round(substring-before(@fo:line-height, '%') div 100 * 240)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:line-rule">exact</xsl:attribute> + <xsl:attribute name="w:line"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:line-height"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:line-height-at-least"> + <xsl:attribute name="w:line-rule">at-least</xsl:attribute> + <xsl:attribute name="w:line"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@style:line-height-at-least"/> + </xsl:call-template> + </xsl:attribute> + </xsl:when> + <xsl:when test="@style:line-spacing"> + <xsl:attribute name="w:line-rule">auto</xsl:attribute> + <xsl:variable name="spacing"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@style:line-spacing"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:line"> + <xsl:value-of select="round($spacing div 0.567)"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="@fo:margin-top"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-top, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-top"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:before"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-top, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:before"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-top"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:margin-bottom"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-bottom, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-bottom"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:after"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-bottom, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:after"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-bottom"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </w:spacing> + <w:ind> + <xsl:if test="@fo:margin-left"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-left, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-left"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:left"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-left, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-left"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:margin-right"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-right, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-right"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:right"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-right, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-right"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:text-indent"> + <xsl:choose> + <!-- When @style:auto-text-indent='true' @fo:text-indent ignored, use 283 for all font size --> + <xsl:when test="@style:auto-text-indent='true'"> + <xsl:attribute name="w:first-line">283</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@fo:text-indent, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:text-indent"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$w-number < 0"> + <xsl:attribute name="w:hanging"> + <xsl:value-of select="round($w-number div -100 * substring-before(@fo:text-indent, '%'))"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:first-line"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:text-indent, '%'))"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="starts-with(@fo:text-indent,'-')"> + <xsl:attribute name="w:hanging"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="substring-after(@fo:text-indent,'-')"/> + </xsl:call-template> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:first-line"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:text-indent"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </w:ind> + <xsl:if test="contains(@fo:background-color, '#')"> + <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/> + </xsl:if> + <xsl:if test="@fo:keep-with-next='true'"> + <w:keepNext/> + </xsl:if> + <xsl:choose> + <xsl:when test="@fo:widows | @fo:orphans"> + <w:widowControl w:val="on"/> + </xsl:when> + <xsl:otherwise> + <w:widowControl w:val="off"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@style:break-inside = 'avoid'"> + <w:keepLines/> + </xsl:if> + <xsl:if test="@fo:hyphenate = 'false'"> + <w:suppressAutoHyphens/> + </xsl:if> + <xsl:if test="@style:snap-to-layout-grid='false'"> + <w:snapToGrid w:val="off"/> + </xsl:if> + <xsl:if test="style:tab-stops"> + <w:tabs> + <xsl:for-each select="style:tab-stops/style:tab-stop"> + <w:tab> + <xsl:choose> + <xsl:when test="@style:type='char'"> + <xsl:attribute name="w:val">decimal</xsl:attribute> + </xsl:when> + <xsl:when test="@style:type"> + <xsl:attribute name="w:val"> + <xsl:value-of select="@style:type"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val">left</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@style:leader-char"> + <xsl:choose> + <xsl:when test="@style:leader-char='-'"> + <xsl:attribute name="w:leader">hyphen</xsl:attribute> + </xsl:when> + <xsl:when test="@style:leader-char='_'"> + <xsl:attribute name="w:leader">underscore</xsl:attribute> + </xsl:when> + <xsl:when test="@style:leader-char='.'"> + <xsl:attribute name="w:leader">dot</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:leader">dot</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@style:position"> + <xsl:attribute name="w:pos"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@style:position"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </w:tab> + </xsl:for-each> + </w:tabs> + </xsl:if> + <xsl:if test="@style:line-break='normal'"> + <w:kinsoku w:val="off"/> + </xsl:if> + <xsl:if test="@style:punctuation-wrap='simple'"> + <w:overflowPunct w:val="off"/> + </xsl:if> + <xsl:if test="@style:text-autospace='none'"> + <w:autoSpaceDE w:val="off"/> + <w:autoSpaceDN w:val="off"/> + </xsl:if> + <xsl:if test="@style:vertical-align"> + <xsl:element name="w:textAlignment"> + <xsl:choose> + <xsl:when test="@style:vertical-align='middle'"> + <xsl:attribute name="w:val">center</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val"> + <xsl:value-of select="@style:vertical-align"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="@text:number-lines='false'"> + <w:suppressLineNumbers/> + </xsl:if> + <xsl:variable name="border-top" select="@fo:border-top | @fo:border"/> + <xsl:variable name="border-bottom" select="@fo:border-bottom | @fo:border"/> + <xsl:variable name="border-left" select="@fo:border-left | @fo:border"/> + <xsl:variable name="border-right" select="@fo:border-right | @fo:border"/> + <xsl:variable name="border-line-width-top" select="@style:border-line-width-top | @style:border-line-width "/> + <xsl:variable name="border-line-width-bottom" select="@style:border-line-width-bottom | @style:border-line-width"/> + <xsl:variable name="border-line-width-left" select="@style:border-line-width-left | @style:border-line-width"/> + <xsl:variable name="border-line-width-right" select="@style:border-line-width-right | @style:border-line-width"/> + <xsl:variable name="padding-top" select="@fo:padding-top | @fo:padding"/> + <xsl:variable name="padding-bottom" select="@fo:padding-bottom | @fo:padding"/> + <xsl:variable name="padding-left" select="@fo:padding-left | @fo:padding"/> + <xsl:variable name="padding-right" select="@fo:padding-right | @fo:padding"/> + <w:pBdr> + <xsl:if test="$border-top"> + <xsl:element name="w:top"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-top"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/> + <xsl:with-param name="so-border-position" select=" 'top' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-top"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-bottom"> + <xsl:element name="w:bottom"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-bottom"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/> + <xsl:with-param name="so-border-position" select=" 'bottom' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-bottom"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-left"> + <xsl:element name="w:left"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-left"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/> + <xsl:with-param name="so-border-position" select=" 'left' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-right"> + <xsl:element name="w:right"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-right"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/> + <xsl:with-param name="so-border-position" select=" 'right' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-right"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="@style:shadow!='none' and not(@fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right | @fo:border)"> + <xsl:element name="w:right"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + <xsl:attribute name="w:val">single</xsl:attribute> + <xsl:variable name="shadow-size"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:sz"> + <xsl:choose> + <xsl:when test="$shadow-size <= 0.08">12</xsl:when> + <xsl:when test="$shadow-size <= 0.14">18</xsl:when> + <xsl:when test="$shadow-size <= 0.20">24</xsl:when> + <xsl:when test="$shadow-size <= 0.25">36</xsl:when> + <xsl:otherwise>48</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:element> + <xsl:element name="w:bottom"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + <xsl:attribute name="w:val">single</xsl:attribute> + <xsl:variable name="shadow-size"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:sz"> + <xsl:choose> + <xsl:when test="$shadow-size <= 0.08">12</xsl:when> + <xsl:when test="$shadow-size <= 0.14">18</xsl:when> + <xsl:when test="$shadow-size <= 0.20">24</xsl:when> + <xsl:when test="$shadow-size <= 0.25">36</xsl:when> + <xsl:otherwise>48</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:element> + </xsl:if> + </w:pBdr> + <w:ind> + <xsl:if test="$padding-left!=''"> + <xsl:attribute name="w:left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$padding-left"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="$padding-right!='' "> + <xsl:attribute name="w:right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$padding-right"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </w:ind> + <xsl:variable name="stylename"> + <xsl:value-of select="../@style:name"/> + </xsl:variable> + <xsl:if test="/office:document/office:body//text:h[@text:style-name = $stylename]"> + <xsl:variable name="headinglevel"> + <xsl:value-of select="/office:document/office:body//text:h[@text:style-name = $stylename]/@text:level"/> + </xsl:variable> + <xsl:if test="/office:document/office:styles/text:outline-style/text:outline-level-style[@text:level = $headinglevel]"> + <w:listPr> + <w:ilvl w:val="{$headinglevel -1}"/> + <w:ilfo w:val="1"/> + </w:listPr> + </xsl:if> + </xsl:if> + </w:pPr> + </xsl:template> + <xsl:template match="style:text-properties" mode="character"> + <w:rPr> + <xsl:if test="@svg:font-family | @style:font-name | @style:font-name-asian | @style:font-name-complex"> + <w:rFonts> + <xsl:variable name="fontname"> + <xsl:choose> + <xsl:when test='starts-with(@svg:font-family,"'")'> + <xsl:value-of select='substring-before(substring-after(@svg:font-family,"'"),"'")'/> + </xsl:when> + <xsl:when test="@svg:font-family"> + <xsl:value-of select="@svg:font-family"/> + </xsl:when> + <xsl:when test="@style:font-name"> + <xsl:value-of select="@style:font-name"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:if test="string-length($fontname)!=0"> + <xsl:attribute name="w:ascii"> + <xsl:value-of select="$fontname"/> + </xsl:attribute> + <xsl:attribute name="w:h-ansi"> + <xsl:value-of select="$fontname"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@style:font-name-asian"> + <xsl:attribute name="w:fareast"> + <xsl:value-of select="@style:font-name-asian"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@style:font-name-complex"> + <xsl:attribute name="w:cs"> + <xsl:value-of select="@style:font-name-complex"/> + </xsl:attribute> + </xsl:if> + </w:rFonts> + </xsl:if> + <!-- relative font sizes not supported yet. --> + <xsl:if test="contains(@fo:font-size, 'pt')"> + <w:sz w:val="{substring-before(@fo:font-size,'pt') * 2}"/> + </xsl:if> + <xsl:if test="contains(@fo:font-size-complex, 'pt')"> + <w:sz-cs w:val="{substring-before(@fo:font-size-complex, 'pt') * 2}"/> + </xsl:if> + <xsl:if test="@fo:font-style = 'italic' or @fo:font-style-asian = 'italic'"> + <w:i/> + </xsl:if> + <xsl:if test="@fo:font-style-complex = 'italic'"> + <w:i-cs/> + </xsl:if> + <xsl:if test="@fo:font-weight = 'bold' or @fo:font-weight-asian = 'bold'"> + <w:b/> + </xsl:if> + <xsl:if test="@fo:font-weight-complex = 'bold'"> + <w:b-cs/> + </xsl:if> + <xsl:if test="@style:text-underline-style"> + <w:u> + <xsl:variable name="w-u"> + <xsl:choose> + <xsl:when test="@style:text-underline-style = 'solid'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">thick</xsl:when> + <xsl:otherwise>single</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dotted'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dotted-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dotted-heavy</xsl:when> + <xsl:otherwise>dotted</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dashed-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dashed-heavy</xsl:when> + <xsl:otherwise>dash</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'long-dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dash-long-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dash-long-heavy</xsl:when> + <xsl:otherwise>dash-long</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dot-dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dot-dash-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-heavy</xsl:when> + <xsl:otherwise>dot-dash</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dot-dot-dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dot-dot-dash-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-dot-heavy</xsl:when> + <xsl:otherwise>dot-dot-dash</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'wave'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">wavy-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">wavy-heavy</xsl:when> + <xsl:otherwise>wave</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style:text-underline-style"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="w:val"> + <xsl:value-of select="$w-u"/> + </xsl:attribute> + <xsl:if test="contains(@style:text-underline-color,'#')"> + <xsl:attribute name="w:color"> + <xsl:value-of select="substring-after(@style:text-underline-color,'#')"/> + </xsl:attribute> + </xsl:if> + </w:u> + </xsl:if> + <xsl:if test="@style:text-shadow | @fo:text-shadow"> + <w:shadow/> + </xsl:if> + <xsl:if test="string-length(@style:text-line-through-style) > 0"> + <xsl:choose> + <xsl:when test="@style:text-line-through-type = 'double'"> + <w:dstrike/> + </xsl:when> + <xsl:when test="@style:text-line-through-style = 'solid'"> + <w:strike/> + </xsl:when> + <xsl:otherwise> + <w:strike/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:color"> + <w:color> + <xsl:choose> + <xsl:when test="@fo:color != '#000000'"> + <xsl:attribute name="w:val"> + <xsl:value-of select="substring-after(@fo:color,'#')"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:color> + </xsl:if> + <xsl:if test="@fo:font-variant = 'small-caps'"> + <w:smallCaps/> + </xsl:if> + <xsl:if test="@fo:text-transform = 'uppercase'"> + <w:caps/> + </xsl:if> + <xsl:if test="@style:font-relief = 'engraved'"> + <w:imprint/> + </xsl:if> + <xsl:if test="@style:font-relief = 'embossed'"> + <w:emboss/> + </xsl:if> + <xsl:if test="@style:text-outline = 'true'"> + <w:outline/> + </xsl:if> + <xsl:if test="contains(@style:text-scale,'%')"> + <w:w w:val="{substring-before(@style:text-scale,'%')}"/> + </xsl:if> + <xsl:if test="@style:text-emphasize"> + <w:em> + <xsl:choose> + <xsl:when test="contains(@style:text-emphasize, 'accent')"> + <xsl:attribute name="w:val">comma</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'disc')"> + <xsl:attribute name="w:val">under-dot</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'none')"> + <xsl:attribute name="w:val">none</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'dot below')"> + <xsl:attribute name="w:val">under-dot</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'dot above')"> + <xsl:attribute name="w:val">dot</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'circle')"> + <xsl:attribute name="w:val">dot</xsl:attribute> + </xsl:when> + </xsl:choose> + </w:em> + </xsl:if> + <xsl:if test="@fo:letter-spacing != 'normal'"> + <w:spacing> + <xsl:attribute name="w:val"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:letter-spacing"/> + </xsl:call-template> + </xsl:attribute> + </w:spacing> + </xsl:if> + <xsl:if test="@style:text-blinking = 'true'"> + <w:effect w:val="blink-background"/> + </xsl:if> + <xsl:if test="@fo:language | @fo:language-asian | @fo:language-complex"> + <w:lang> + <xsl:if test="@fo:language and @fo:country"> + <xsl:attribute name="w:val"> + <xsl:value-of select="concat(@fo:language, '-', @fo:country)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@fo:language-asian and @fo:country-asian"> + <xsl:attribute name="w:fareast"> + <xsl:value-of select="concat(@fo:language-asian, '-', @fo:country-asian)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@fo:language-complex and @fo:language-complex"> + <xsl:attribute name="w:bidi"> + <xsl:value-of select="concat(@fo:language-complex, '-', @fo:language-complex)"/> + </xsl:attribute> + </xsl:if> + </w:lang> + </xsl:if> + <xsl:if test="@style:text-position"> + <xsl:variable name="position"> + <xsl:choose> + <xsl:when test="starts-with(@style:text-position, 'super')">superscript_0</xsl:when> + <xsl:when test="starts-with(@style:text-position, 'sub')">subscript_0</xsl:when> + <xsl:when test="starts-with(@style:text-position, '-')"> + <xsl:value-of select="concat('subscript_', substring-before(@style:text-position,'%'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('superscript_', substring-before(@style:text-position,'%'))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:vertAlign> + <xsl:attribute name="w:val"> + <xsl:value-of select="substring-before($position,'_')"/> + </xsl:attribute> + </w:vertAlign> + <!-- Raised/Lowed position is difficult to map to MSWord w:position, Writer use %, but Word use half-point(not relative position). Since it's difficult to get font-size, use 12pt as default font-size --> + <w:position> + <xsl:attribute name="w:val"> + <xsl:choose> + <xsl:when test="substring-after($position, '_') = 0">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="round(substring-after($position, '_') div 6)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </w:position> + </xsl:if> + <xsl:if test="@text:display = 'true'"> + <w:vanish/> + </xsl:if> + <xsl:if test="contains(@fo:background-color, '#')"> + <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/> + </xsl:if> + </w:rPr> + </xsl:template> + <xsl:template match="text:p | text:h"> + <w:p> + <w:pPr> + <xsl:if test="@text:style-name"> + <w:pStyle w:val="{@text:style-name}"/> + </xsl:if> + <xsl:if test="@text:level"> + <w:outlineLvl w:val="{@text:level - 1}"/> + </xsl:if> + <xsl:variable name="following-paragraph-heading-table" select="following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table')]"/> + <xsl:variable name="following-section" select="following::text:section[1]"/> + <xsl:variable name="ancestor-section" select="ancestor::text:section"/> + <!-- if the following neighbour paragraph/heading are slave of one master style, or new section starts, + then a new page will start --> + <xsl:variable name="next-is-new-page" select="boolean(key( 'slave-style', $following-paragraph-heading-table[1]/@*[name()='text:style-name' or name()='table:style-name']))"/> + <xsl:variable name="next-is-new-section"> + <xsl:if test="$following-section and generate-id($following-section/descendant::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])"> + <xsl:value-of select="'yes'"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="next-is-section-end"> + <xsl:if test="$ancestor-section and generate-id($ancestor-section[1]/following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])"> + <xsl:value-of select="'yes'"/> + </xsl:if> + </xsl:variable> + <xsl:if test="ancestor::office:body and not(ancestor::text:footnote or ancestor::text:endnote) and ($next-is-new-page or $next-is-new-section = 'yes' or $next-is-section-end = 'yes')"> + <w:sectPr> + <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:choose> + <xsl:when test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])"> + <xsl:apply-templates select="key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/> + <xsl:if test="$ancestor-section"> + <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section"> + <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/> + </xsl:apply-templates> + </xsl:if> + <xsl:if test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"> + <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page --> + <xsl:variable name="pagenumber_start"> + <xsl:value-of select=" key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/> + </xsl:variable> + <xsl:if test=" number($pagenumber_start) > 0 "> + <w:pgNumType w:start="{$pagenumber_start}"/> + </xsl:if> + <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 --> + <!--w:pgNumType w:start="{key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/ --> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="preceding-style" select="preceding::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/> + <xsl:choose> + <xsl:when test="$preceding-style"> + <xsl:apply-templates select="key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$ancestor-section"> + <xsl:choose> + <xsl:when test="$preceding-style"> + <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section"> + <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section"> + <xsl:with-param name="master-page" select="/office:document/office:automatic-styles/style:page-layout[1]"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </w:sectPr> + </xsl:if> + <!-- add for office:annotation style G.Y. --> + <xsl:if test="name(..)= 'office:annotation' "> + <w:pStyle w:val="CommentText"/> + </xsl:if> + <!-- add by wym for listPr --> + <xsl:if test="ancestor::text:ordered-list | ancestor::text:unordered-list | ancestor::text:list"> + <xsl:variable name="listname"> + <xsl:value-of select="ancestor::text:ordered-list/@text:style-name | ancestor::text:unordered-list/@text:style-name | ancestor::text:list/@text:style-name"/> + </xsl:variable> + <xsl:variable name="currlevel"> + <xsl:value-of select="count(ancestor::text:list-item|ancestor::text:list-header)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($listname)!=0 and $currlevel < 10"> + <xsl:variable name="currlist"> + <xsl:apply-templates select="key('list-style', $listname)" mode="count"/> + </xsl:variable> + <w:listPr> + <w:ilvl w:val="{number($currlevel)-1}"/> + <w:ilfo w:val="{$currlist}"/> + </w:listPr> + </xsl:when> + <xsl:when test="string-length($listname)!=0"> + <xsl:for-each select="key('list-style', $listname)"> + <xsl:variable name="spacebefore"> + <xsl:choose> + <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="space2text"> + <xsl:choose> + <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <w:listPr> + <w:ilvl w:val="{number($currlevel)-1}"/> + <w:ilfo w:val="1"/> + </w:listPr> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!-- end of listPr --> + </w:pPr> + <!-- get break column from style --> + <xsl:variable name="style" select="key('paragraph-style', @text:style-name)/style:paragraph-properties"/> + <xsl:if test="$style/@fo:break-before = 'column'"> + <w:r> + <w:br w:type="column"/> + </w:r> + </xsl:if> + <xsl:if test="parent::office:text and not(preceding-sibling::text:p)"> + <xsl:call-template name="PageLevelGraphic"/> + </xsl:if> + <xsl:if test="parent::text:footnote-body and not(preceding-sibling::*)"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-style-name}"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:footnote-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:footnote-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:footnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <xsl:if test="parent::text:endnote-body and not(preceding-sibling::*)"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-style-name}"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:endnote-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:endnote-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:endnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <!-- newly added the endnote , footnote templates --> + <xsl:if test="../../@text:note-class='endnote' and not(preceding-sibling::*)"> + <xsl:message> + <xsl:value-of select=" 'enter into ext:note-class= endnote' "/> + </xsl:message> + <w:r> + <w:rPr> + <w:rStyle w:val="Endnote_20_Symbol"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:note-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:note-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:footnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <xsl:if test="../../@text:note-class='footnote' and not(preceding-sibling::*)"> + <xsl:message> + <xsl:value-of select=" 'enter into ext:note-class= footnote' "/> + </xsl:message> + <w:r> + <w:rPr> + <w:rStyle w:val="Footnote_20_Symbol"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:note-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:note-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:footnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <!-- apply inline-text-elements, many many many ... :( glu --> + <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop + | text:s | text:note | draw:* + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark + "/> + <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format --> + <!--xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop + | text:s | text:footnote | text:endnote | draw:* + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark + "/--> + <xsl:if test="$style/@fo:break-after"> + <w:r> + <w:br w:type="{$style/@fo:break-after}"/> + </w:r> + </xsl:if> + </w:p> + </xsl:template> + <xsl:template match="text:span"> + <!-- apply inline-text-elements, many many many ... :( glu --> + <xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s + | text:note + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark +"/> + <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format --> + <!-- xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s + | text:footnote | text:endnote + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark +"/--> + </xsl:template> + <xsl:template match="text()"> + <xsl:if test="string-length(normalize-space(.)) > 0"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </xsl:if> + </xsl:template> + <xsl:template match="text:hidden-text"> + <w:r> + <w:rPr> + <xsl:if test="parent::text:span"> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </xsl:if> + <w:vanish/> + </w:rPr> + <w:t> + <xsl:value-of select="@text:string-value"/> + </w:t> + </w:r> + </xsl:template> + <xsl:template match="text:line-break"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:br w:type="text-wrapping" w:clear="all"/> + </w:r> + </xsl:template> + <xsl:template match="text:tab-stop"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:tab/> + </w:r> + </xsl:template> + <xsl:template match="text:s"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:t> + <xsl:if test="@text:c"> + <xsl:call-template name="add-space"> + <xsl:with-param name="number" select="@text:c"/> + </xsl:call-template> + </xsl:if> + <xsl:text> </xsl:text> + </w:t> + </w:r> + </xsl:template> + <xsl:template name="add-space"> + <xsl:param name="number"/> + <xsl:if test="$number > 1"> + <xsl:call-template name="add-space"> + <xsl:with-param name="number" select="$number - 1"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:template> + <xsl:template match="text:footnote"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-body-style-name}"/> + </w:rPr> + <xsl:apply-templates select="text:footnote-body"/> + </w:r> + </xsl:template> + <xsl:template match="text:footnote-body"> + <w:footnote> + <xsl:if test="../text:footnote-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:footnote> + </xsl:template> + <xsl:template match="text:endnote"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-body-style-name}"/> + </w:rPr> + <xsl:apply-templates select="text:endnote-body"/> + </w:r> + </xsl:template> + <xsl:template match="text:endnote-body"> + <w:endnote> + <xsl:if test="../text:endnote-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:endnote> + </xsl:template> + <xsl:template match="text:bookmark-start"> + <xsl:variable name="bookmark-id"> + <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/> + </xsl:variable> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/> + </xsl:template> + <xsl:template match="text:bookmark-end"> + <xsl:variable name="bookmark-id"> + <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/> + </xsl:variable> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/> + </xsl:template> + <xsl:template match="text:bookmark"> + <xsl:variable name="bookmark-id"> + <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/> + </xsl:variable> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/> + </xsl:template> + <!-- newly added the endnote , footnote templates --> + <xsl:template match="text:note"> + <xsl:choose> + <xsl:when test="@text:note-class = 'endnote' "> + <w:r> + <w:rPr> + <w:rStyle w:val="Endnote"/> + </w:rPr> + <xsl:apply-templates select="text:note-body"/> + </w:r> + </xsl:when> + <xsl:when test="@text:note-class = 'footnote' "> + <w:r> + <w:rPr> + <w:rStyle w:val="Footnote"/> + </w:rPr> + <xsl:apply-templates select="text:note-body"/> + </w:r> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="text:note-body"> + <xsl:choose> + <xsl:when test="../@text:note-class='endnote' "> + <w:endnote> + <xsl:if test="../text:note-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:endnote> + </xsl:when> + <xsl:when test="../@text:note-class='footnote' "> + <w:footnote> + <xsl:if test="../text:note-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:footnote> + </xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> |