This commit is contained in:
Jane
2024-07-16 15:55:31 +08:00
parent 8f4ec86367
commit 29bc31ade5
12411 changed files with 8139339 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
<xsl:template match="o:DocumentProperties">
<office:meta>
<meta:generator>Microsoft Word 2003</meta:generator>
<dc:title>
<xsl:value-of select="o:Title"/>
</dc:title>
<dc:description>
<xsl:value-of select="o:Description"/>
</dc:description>
<dc:subject>
<xsl:value-of select="o:Subject"/>
</dc:subject>
<meta:initial-creator>
<xsl:value-of select="o:Author"/>
</meta:initial-creator>
<meta:creation-date>
<xsl:value-of select="substring-before( o:Created, 'Z')"/>
</meta:creation-date>
<dc:creator>
<xsl:value-of select="o:LastAuthor"/>
</dc:creator>
<xsl:if test="string-length(substring-before( o:LastSaved, 'Z')) &gt; 0">
<dc:date>
<xsl:value-of select="substring-before( o:LastSaved, 'Z')"/>
</dc:date>
</xsl:if>
<!-- comment out the below line now because Oasis format doesn't allow the meta:print-by to be empty element -->
<!--meta:printed-by /-->
<xsl:if test="string-length(substring-before( o:LastPrinted, 'Z')) &gt; 0">
<!--
<meta:print-date>
<xsl:value-of select="substring-before( o:LastPrinted, 'Z')"/>
</meta:print-date>
-->
</xsl:if>
<meta:keyword>
<xsl:value-of select="o:Keywords"/>
</meta:keyword>
<meta:editing-cycles>
<xsl:value-of select="o:Revision"/>
</meta:editing-cycles>
<meta:editing-duration>
<xsl:if test="o:TotalTime">
<xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/>
</xsl:if>
</meta:editing-duration>
<meta:user-defined meta:name="Category" meta:value-type="string">
<xsl:value-of select="o:Category"/>
</meta:user-defined>
<meta:user-defined meta:name="Manager" meta:value-type="string">
<xsl:value-of select="o:Manager"/>
</meta:user-defined>
<meta:user-defined meta:name="Company" meta:value-type="string">
<xsl:value-of select="o:Company"/>
</meta:user-defined>
<meta:user-defined meta:name="Version" meta:value-type="string">
<xsl:value-of select="o:Version"/>
</meta:user-defined>
<meta:user-defined meta:name="HyperlinkBase" meta:value-type="string">
<xsl:value-of select="o:HyperlinkBase"/>
</meta:user-defined>
<xsl:apply-templates select="../o:CustomDocumentProperties"/>
<meta:document-statistic meta:page-count="{o:Pages}" meta:paragraph-count="{o:Paragraphs}" meta:word-count="{o:Words}" meta:character-count="{o:Characters}"/>
</office:meta>
</xsl:template>
<xsl:template match="o:CustomDocumentProperties">
<xsl:for-each select="node()[@dt:dt]">
<meta:user-defined meta:name="{local-name()}" meta:value-type="{@dt:dt}">
<xsl:value-of select="."/>
</meta:user-defined>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
xmlns:z="#RowsetSchema">
<xsl:output indent="no" version="1.0" encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<office:document office:mimetype="application/vnd.oasis.opendocument.spreadsheet" office:version="1.0">
<xsl:element name="office:body">
<xsl:element name="office:spreadsheet">
<!-- Just a single table (sheet) with default name -->
<xsl:element name="table:table">
<!-- declare columns -->
<xsl:for-each select="./xml/s:Schema/s:ElementType[@name='row']/s:AttributeType">
<xsl:element name="table:table-column"/>
</xsl:for-each>
<!-- header row from Schema -->
<xsl:element name="table:table-row">
<xsl:for-each select="./xml/s:Schema/s:ElementType[@name='row']/s:AttributeType">
<xsl:element name="table:table-cell">
<xsl:attribute name="office:value-type">string</xsl:attribute>
<xsl:attribute name="calcext:value-type">string</xsl:attribute>
<xsl:element name="text:p">
<!-- User-readable field name may be defined in optional @rs:name -->
<xsl:choose>
<xsl:when test="./@rs:name">
<xsl:value-of select="./@rs:name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
<!-- Now add data itself -->
<xsl:apply-templates select="./xml/rs:data"/>
</xsl:element>
<!-- Add autofilter to the whole range -->
<xsl:element name="table:database-ranges">
<xsl:element name="table:database-range">
<xsl:attribute name="table:target-range-address">
<xsl:call-template name="RangeName">
<xsl:with-param name="rowStartNum" select="1"/>
<xsl:with-param name="colStartNum" select="1"/>
<xsl:with-param name="rowEndNum" select="count(/xml/rs:data/row)+1"/>
<xsl:with-param name="colEndNum" select="count(/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType)"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="table:display-filter-buttons">true</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</office:document>
</xsl:template>
<xsl:template match="rs:data">
<xsl:apply-templates select="./row"/>
<xsl:apply-templates select="./z:row"/>
</xsl:template>
<xsl:template match="row|z:row">
<xsl:element name="table:table-row">
<!-- Store current row in a variable -->
<xsl:variable name="thisRow" select="."/>
<!-- Get column order from Schema -->
<xsl:for-each select="/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType">
<xsl:element name="table:table-cell">
<xsl:variable name="thisColName" select="./@name"/>
<xsl:variable name="thisCellValue">
<xsl:value-of select="$thisRow/@*[local-name()=$thisColName]"/>
</xsl:variable>
<xsl:if test="string-length($thisCellValue) &gt; 0">
<xsl:variable name="thisColType">
<xsl:call-template name="ValTypeFromAttributeType">
<xsl:with-param name="AttributeTypeNode" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="office:value-type"><xsl:value-of select="$thisColType"/></xsl:attribute>
<xsl:attribute name="calcext:value-type"><xsl:value-of select="$thisColType"/></xsl:attribute>
<xsl:choose>
<xsl:when test="$thisColType='float'">
<xsl:attribute name="office:value"><xsl:value-of select="$thisCellValue"/></xsl:attribute>
</xsl:when>
<xsl:when test="$thisColType='date'">
<!-- We need to convert '2017-04-06 00:40:40' to '2017-04-06T00:40:40', so replace space with 'T' -->
<xsl:attribute name="office:date-value"><xsl:value-of select="translate($thisCellValue,' ','T')"/></xsl:attribute>
</xsl:when>
<xsl:when test="$thisColType='time'">
<xsl:attribute name="office:time-value"><xsl:value-of select="$thisCellValue"/></xsl:attribute>
</xsl:when>
<xsl:when test="$thisColType='boolean'">
<xsl:attribute name="office:boolean-value">
<xsl:choose>
<xsl:when test="$thisCellValue=0">false</xsl:when>
<xsl:otherwise>true</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:element name="text:p">
<xsl:value-of select="$thisCellValue"/>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<!-- https://msdn.microsoft.com/en-us/library/ms675943 -->
<xsl:template name="ValTypeFromAttributeType">
<xsl:param name="AttributeTypeNode"/>
<xsl:variable name="thisDataType">
<xsl:choose>
<xsl:when test="$AttributeTypeNode/@dt:type"><xsl:value-of select="$AttributeTypeNode/@dt:type"/></xsl:when>
<xsl:when test="$AttributeTypeNode/s:datatype"><xsl:value-of select="$AttributeTypeNode/s:datatype/@dt:type"/></xsl:when>
<xsl:otherwise>string</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="XMLDataType2ValType">
<xsl:with-param name="XMLDataType" select="$thisDataType"/>
</xsl:call-template>
</xsl:template>
<!-- https://www.w3.org/TR/1998/NOTE-XML-data-0105/#API -->
<xsl:template name="XMLDataType2ValType">
<xsl:param name="XMLDataType"/>
<xsl:choose>
<xsl:when test="$XMLDataType='number'">float</xsl:when>
<xsl:when test="$XMLDataType='int'">float</xsl:when>
<xsl:when test="starts-with($XMLDataType, 'float')">float</xsl:when>
<xsl:when test="starts-with($XMLDataType, 'fixed')">float</xsl:when>
<xsl:when test="$XMLDataType='i1'">float</xsl:when>
<xsl:when test="$XMLDataType='i2'">float</xsl:when>
<xsl:when test="$XMLDataType='i4'">float</xsl:when>
<xsl:when test="$XMLDataType='i8'">float</xsl:when>
<xsl:when test="$XMLDataType='ui1'">float</xsl:when>
<xsl:when test="$XMLDataType='ui2'">float</xsl:when>
<xsl:when test="$XMLDataType='ui4'">float</xsl:when>
<xsl:when test="$XMLDataType='ui8'">float</xsl:when>
<xsl:when test="$XMLDataType='r4'">float</xsl:when>
<xsl:when test="$XMLDataType='r8'">float</xsl:when>
<xsl:when test="$XMLDataType='datetime'">date</xsl:when>
<xsl:when test="starts-with($XMLDataType, 'dateTime')">date</xsl:when>
<xsl:when test="starts-with($XMLDataType, 'date')">date</xsl:when>
<xsl:when test="starts-with($XMLDataType, 'time')">time</xsl:when>
<xsl:when test="$XMLDataType='boolean'">boolean</xsl:when>
<xsl:otherwise>string</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- A utility to convert a column number (e.g. 27; 1-based) to column name (like AA) -->
<xsl:template name="ColNum2Name">
<xsl:param name="num"/>
<xsl:if test="$num > 0">
<xsl:call-template name="ColNum2Name">
<xsl:with-param name="num" select="floor($num div 26)"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$num mod 26 = 1">A</xsl:when>
<xsl:when test="$num mod 26 = 2">B</xsl:when>
<xsl:when test="$num mod 26 = 3">C</xsl:when>
<xsl:when test="$num mod 26 = 4">D</xsl:when>
<xsl:when test="$num mod 26 = 5">E</xsl:when>
<xsl:when test="$num mod 26 = 6">F</xsl:when>
<xsl:when test="$num mod 26 = 7">G</xsl:when>
<xsl:when test="$num mod 26 = 8">H</xsl:when>
<xsl:when test="$num mod 26 = 9">I</xsl:when>
<xsl:when test="$num mod 26 = 10">J</xsl:when>
<xsl:when test="$num mod 26 = 11">K</xsl:when>
<xsl:when test="$num mod 26 = 12">L</xsl:when>
<xsl:when test="$num mod 26 = 13">M</xsl:when>
<xsl:when test="$num mod 26 = 14">N</xsl:when>
<xsl:when test="$num mod 26 = 15">O</xsl:when>
<xsl:when test="$num mod 26 = 16">P</xsl:when>
<xsl:when test="$num mod 26 = 17">Q</xsl:when>
<xsl:when test="$num mod 26 = 18">R</xsl:when>
<xsl:when test="$num mod 26 = 19">S</xsl:when>
<xsl:when test="$num mod 26 = 20">T</xsl:when>
<xsl:when test="$num mod 26 = 21">U</xsl:when>
<xsl:when test="$num mod 26 = 22">V</xsl:when>
<xsl:when test="$num mod 26 = 23">W</xsl:when>
<xsl:when test="$num mod 26 = 24">X</xsl:when>
<xsl:when test="$num mod 26 = 25">Y</xsl:when>
<xsl:otherwise>Z</xsl:otherwise><!-- 0 -->
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- A utility to convert a cell address (e.g. row 2, column 27) to cell name (like AA2) -->
<xsl:template name="CellName">
<xsl:param name="rowNum"/>
<xsl:param name="colNum"/>
<xsl:call-template name="ColNum2Name">
<xsl:with-param name="num" select="$colNum"/>
</xsl:call-template>
<xsl:value-of select="$rowNum"/>
</xsl:template>
<!-- A utility to convert a range given in terms of numbers (e.g. row 1, column 1 to row 2, column 27) to range name (like A1:AA2) -->
<xsl:template name="RangeName">
<xsl:param name="rowStartNum"/>
<xsl:param name="colStartNum"/>
<xsl:param name="rowEndNum"/>
<xsl:param name="colEndNum"/>
<xsl:call-template name="CellName">
<xsl:with-param name="rowNum" select="$rowStartNum"/>
<xsl:with-param name="colNum" select="$colStartNum"/>
</xsl:call-template>
<xsl:text>:</xsl:text>
<xsl:call-template name="CellName">
<xsl:with-param name="rowNum" select="$rowEndNum"/>
<xsl:with-param name="colNum" select="$colEndNum"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:fla="urn:experimental:fla">
<xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
<xsl:include href="../../common/measure_conversion.xsl"/>
<xsl:include href="../common/ms2ooo_docpr.xsl"/>
<xsl:include href="wordml2ooo_text.xsl"/>
<xsl:include href="wordml2ooo_settings.xsl"/>
<xsl:include href="wordml2ooo_table.xsl"/>
<xsl:include href="wordml2ooo_page.xsl"/>
<xsl:include href="wordml2ooo_list.xsl"/>
<xsl:include href="wordml2ooo_draw.xsl"/>
<xsl:include href="wordml2ooo_field.xsl"/>
<xsl:include href="wordml2ooo_props.xsl"/>
<xsl:key name="paragraph-style" match="w:style[@w:type = 'paragraph']" use="@w:styleId"/>
<xsl:key name="heading-style" match="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl]" use="@w:styleId"/>
<xsl:variable name="preserve-alien-markup">no</xsl:variable>
<xsl:variable name="native-namespace-prefixes">,w,o,v,wx,aml,w10,dt,</xsl:variable>
<xsl:variable name="to-dispatch-elements">,wx:sect,wx:sub-section,w:p,w:tbl,w:sectPr,w:r,w:fldSimple,w:hlink,w:t,w:pict,w:br,w:instrText,w:fldChar,w:tab,w:footnote,w:endnote,aml:annotation,w:hlink,w:footnote,w:endnote,w:tblGrid,w:tr,w:tc,wx:pBdrGroup,</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="w:wordDocument"/>
</xsl:template>
<xsl:template match="*" mode="dispatch">
<xsl:choose>
<xsl:when test="not(contains($native-namespace-prefixes, concat(',', substring-before(name(), ':'), ',')))">
<!-- if alien namespace dispatch -->
<xsl:choose>
<xsl:when test="$preserve-alien-markup = 'yes'">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="dispatch"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="dispatch"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="contains($to-dispatch-elements, concat(',',name(),','))">
<xsl:apply-templates select="current()"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="w:wordDocument">
<office:document office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.0">
<fla:fla.activate/>
<xsl:apply-templates select="o:DocumentProperties"/>
<xsl:apply-templates select="w:docOleData" mode="init"/>
<xsl:apply-templates select="w:docPr"/>
<xsl:apply-templates select="w:fonts"/>
<xsl:apply-templates select="w:styles"/>
<xsl:apply-templates select="w:body"/>
<xsl:apply-templates select="w:docOleData" mode="exit"/>
</office:document>
</xsl:template>
<xsl:template match="w:fonts">
<xsl:element name="office:font-face-decls">
<!-- MS Word's default font declaration, added for Writer automatically. glu -->
<style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
<style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
<xsl:if test="not(w:font[@w:name='StarSymbol'])">
<style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
</xsl:if>
<xsl:for-each select="w:font">
<xsl:element name="style:font-face">
<xsl:attribute name="style:name">
<xsl:value-of select="@w:name"/>
</xsl:attribute>
<xsl:attribute name="svg:font-family">
<xsl:value-of select="@w:name"/>
</xsl:attribute>
<!-- added by glu, for process special fonts e.g. Marlett, -->
<xsl:if test="w:charset/@w:val = '02'">
<xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
</xsl:if>
<xsl:if test="w:family">
<xsl:choose>
<xsl:when test="w:family/@w:val = 'Swiss'">
<xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
</xsl:when>
<xsl:when test="w:family/@w:val='Modern'">
<xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
</xsl:when>
<xsl:when test="w:family/@w:val='Roman'">
<xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
</xsl:when>
<xsl:when test="w:family/@w:val='Script'">
<xsl:attribute name="style:font-family-generic">script</xsl:attribute>
</xsl:when>
<xsl:when test="w:family/@w:val='Decorative'">
<xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
</xsl:when>
<xsl:when test="w:family/@w:val='System'">
<xsl:attribute name="style:font-family-generic">system</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="style:font-family-generic">system</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="w:pitch and string-length(w:pitch/@w:val) &gt; 0">
<xsl:attribute name="style:font-pitch">
<xsl:choose>
<xsl:when test="w:pitch/@w:val = 'default'">variable</xsl:when>
<xsl:otherwise>
<xsl:value-of select="w:pitch/@w:val"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="w:styles">
<office:styles>
<!--The next statement Added by wguo,collect the pict's dash and mark-style.The template is implemented in file wordml2ooo_draw.xsl-->
<xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style4dash_mark"/>
<xsl:apply-templates select="//v:fill" mode="office-style"/>
<xsl:call-template name="create-default-paragraph-styles"/>
<xsl:call-template name="create-default-text-styles"/>
<xsl:call-template name="create-default-frame-style"/>
<!-- StarWriter has no default style family 'list'. glu -->
<xsl:if test="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl and w:pPr/w:listPr]">
<xsl:call-template name="create-outline-style"/>
</xsl:if>
<xsl:apply-templates select="w:style[@w:type='table']" mode="table"/>
<xsl:apply-templates select="w:style[@w:type='list']" mode="list"/>
<xsl:apply-templates select="w:style[@w:type!='list']"/>
<xsl:apply-templates select="/w:wordDocument/w:docPr/w:footnotePr" mode="config"/>
<xsl:apply-templates select="/w:wordDocument/w:docPr/w:endnotePr" mode="config"/>
</office:styles>
<office:automatic-styles>
<xsl:apply-templates select="/w:wordDocument/w:body//w:p" mode="style"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:rPr[not(parent::w:pPr)]" mode="style"/>
<!--The next statement Added by wguo for the pict's draw-style.The template is implemented in file wordml2ooo_draw.xsl-->
<xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:tblPr" mode="style"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:gridCol" mode="style"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:trPr" mode="style"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:tcPr" mode="style"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:listPr" mode="style"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="page-layout"/>
<xsl:call-template name="default_date_style"/>
<!--add for generate the date , time style for date , time field G.Y.-->
<xsl:apply-templates select="/w:wordDocument/w:body//w:instrText | /w:wordDocument/w:body//w:fldSimple " mode="style"/>
</office:automatic-styles>
<office:master-styles>
<xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="master-page"/>
</office:master-styles>
</xsl:template>
<xsl:template match="w:style">
<style:style>
<xsl:attribute name="style:name">
<xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
</xsl:attribute>
<xsl:if test="w:basedOn">
<xsl:attribute name="style:parent-style-name">
<xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="w:next">
<xsl:attribute name="style:next-style-name">
<xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="@w:type = 'character'">
<xsl:attribute name="style:family">text</xsl:attribute>
</xsl:when>
<!-- table, paragraph are the same as in Writer . glu -->
<xsl:when test="@w:type">
<xsl:attribute name="style:family">
<xsl:value-of select="@w:type"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="style:family">text</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@w:type = 'table'">
<xsl:element name="style:table-properties">
<!-- xsl:apply-templates select="w:tblPr" mode="style"/ -->
</xsl:element>
</xsl:when>
<xsl:when test="@w:type = 'character' ">
<xsl:element name="style:text-properties">
<!--
<xsl:apply-templates select="w:pPr/w:rPr"/>
<xsl:apply-templates select="w:rPr"/>
-->
<xsl:for-each select="w:rPr">
<xsl:call-template name="text-properties"/>
</xsl:for-each>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="style:paragraph-properties">
<xsl:apply-templates select="w:pPr"/>
</xsl:element>
<xsl:element name="style:text-properties">
<xsl:apply-templates select="w:rPr"/>
<xsl:apply-templates select="w:pPr/w:rPr"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</style:style>
</xsl:template>
<xsl:template match="w:body">
<xsl:element name="office:body">
<xsl:element name="office:text">
<!-- to add the sequence variable declaration at the beginning of the office:body G.Y.-->
<text:sequence-decls>
<xsl:call-template name="default_sequence_declaration"/>
<xsl:apply-templates select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,3) = 'SEQ' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,3) = 'SEQ' ] " mode="sequence_declare"/>
</text:sequence-decls>
<!-- add the user field variables declare for Docproperty fields importing G.Y.-->
<text:user-field-decls>
<xsl:call-template name="user_fields_declare_docproperty"/>
</text:user-field-decls>
<xsl:apply-templates mode="dispatch"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="wx:sect">
<xsl:apply-templates mode="dispatch"/>
</xsl:template>
<xsl:template match="wx:sub-section">
<xsl:apply-templates mode="dispatch"/>
</xsl:template>
<xsl:template name="create-default-frame-style">
<!--add for default frame style -->
<style:style style:name="Frame" style:family="graphic">
<style:graphic-properties text:anchor-type="paragraph" svg:x="0in" svg:y="0in" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/>
</style:style>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
<xsl:template name="ms_word_draw_map2ooo_custom_draw">
<xsl:param name="ms_word_draw_type"/>
<!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
<xsl:choose>
<xsl:when test="$ms_word_draw_type = '#_x0000_t5' ">
<xsl:value-of select=" 'isosceles-triangle'"/>
</xsl:when>
<xsl:when test="$ms_word_draw_type ='#_x0000_t6' ">
<xsl:value-of select=" 'right-triangle' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t8' ">
<xsl:value-of select=" 'trapezoid' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t4' ">
<xsl:value-of select=" 'diamond' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t9' ">
<xsl:value-of select=" 'hexagon' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t7' ">
<xsl:value-of select="'parallelogram' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t56' ">
<xsl:value-of select=" 'pentagon' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t10' ">
<xsl:value-of select=" 'octagon' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t11' ">
<xsl:value-of select=" 'cross' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t23' ">
<xsl:value-of select=" 'ring' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t95' ">
<xsl:value-of select=" 'block-arc' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t22' ">
<xsl:value-of select=" 'can' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t16' ">
<xsl:value-of select=" 'cube' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t65' ">
<xsl:value-of select=" 'paper' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t96' ">
<xsl:value-of select=" 'smiley' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t183' ">
<xsl:value-of select=" 'sun' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t184' ">
<xsl:value-of select=" 'moon' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t74' ">
<xsl:value-of select=" 'heart' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t57' ">
<xsl:value-of select=" 'forbidden' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type ='#_x0000_t85' ">
<xsl:value-of select=" 'left-bracket' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t86' ">
<xsl:value-of select=" 'right-bracket' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t87' ">
<xsl:value-of select=" 'left-brace' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t88' ">
<xsl:value-of select=" 'right-brace' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t185' ">
<xsl:value-of select=" 'bracket-pair' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t186' ">
<xsl:value-of select=" 'brace-pair' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t189' ">
<xsl:value-of select=" 'quad-bevel' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t66' ">
<xsl:value-of select=" 'left-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t67' ">
<xsl:value-of select=" 'down-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t68' ">
<xsl:value-of select=" 'up-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t13' ">
<xsl:value-of select=" 'right-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t69' ">
<xsl:value-of select=" 'left-right-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t70' ">
<xsl:value-of select=" 'up-down-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t89' ">
<xsl:value-of select=" 'mso-spt89' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t76' ">
<xsl:value-of select=" 'quad-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t94' ">
<xsl:value-of select=" 'notched-right-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
<xsl:value-of select=" 'pentagon-right' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t55' ">
<xsl:value-of select=" 'chevron' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t79' ">
<xsl:value-of select=" 'up-arrow-callout' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t80' ">
<xsl:value-of select=" 'down-arrow-callout' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t82' ">
<xsl:value-of select=" 'up-down-arrow-callout' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t103' ">
<xsl:value-of select=" 'circular-arrow' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t109' ">
<xsl:value-of select=" 'flowchart-process' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
<xsl:value-of select=" 'flowchart-alternate-process' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t110' ">
<xsl:value-of select=" 'flowchart-decision' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t111' ">
<xsl:value-of select=" 'flowchart-data' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t112' ">
<xsl:value-of select=" 'flowchart-predefined-process' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t113' ">
<xsl:value-of select=" 'flowchart-internal-storage' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t114' ">
<xsl:value-of select=" 'flowchart-document' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t115' ">
<xsl:value-of select=" 'flowchart-multidocument' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
<xsl:value-of select=" 'flowchart-terminator' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t117' ">
<xsl:value-of select=" 'flowchart-preparation' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t118' ">
<xsl:value-of select=" 'flowchart-manual-input' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t119' ">
<xsl:value-of select=" 'flowchart-manual-operation' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t120' ">
<xsl:value-of select=" 'flowchart-connector' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
<xsl:value-of select=" 'flowchart-off-page-connector' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t121' ">
<xsl:value-of select=" 'flowchart-card' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t122' ">
<xsl:value-of select=" 'flowchart-punched-tape' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t123' ">
<xsl:value-of select=" 'flowchart-summing-junction' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t124' ">
<xsl:value-of select=" 'flowchart-or' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t125' ">
<xsl:value-of select=" 'flowchart-collate' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t126' ">
<xsl:value-of select=" 'flowchart-sort' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t127' ">
<xsl:value-of select=" 'flowchart-extract' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t128' ">
<xsl:value-of select=" 'flowchart-merge' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t130' ">
<xsl:value-of select=" 'flowchart-stored-data' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t135' ">
<xsl:value-of select=" 'flowchart-delay' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t131' ">
<xsl:value-of select=" 'flowchart-sequential-access' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t132' ">
<xsl:value-of select=" 'flowchart-magnetic-disk' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t133' ">
<xsl:value-of select=" 'flowchart-direct-access-storage' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t134' ">
<xsl:value-of select=" 'flowchart-display' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t61' ">
<xsl:value-of select=" 'rectangular-callout' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t62' ">
<xsl:value-of select=" 'round-rectangular-callout' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t63' ">
<xsl:value-of select=" 'round-callout' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t106' ">
<xsl:value-of select=" 'cloud-callout' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t50' ">
<xsl:value-of select=" 'line-callout-1' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t51' ">
<xsl:value-of select=" 'line-callout-2' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t47' ">
<xsl:value-of select=" 'line-callout-3' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t72' ">
<xsl:value-of select=" 'bang' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t187' ">
<xsl:value-of select=" 'star4' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t12' ">
<xsl:value-of select=" 'star5' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t58' ">
<xsl:value-of select=" 'star8' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t92' ">
<xsl:value-of select=" 'star24' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t97' ">
<xsl:value-of select=" 'vertical-scroll' "/>
</xsl:when>
<xsl:when test="$ms_word_draw_type = '#_x0000_t98' ">
<xsl:value-of select=" 'horizontal-scroll' "/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,648 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
<xsl:template match="w:listPr" mode="style">
<xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
<xsl:variable name="currlist" select="."/>
<xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
<xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
<xsl:if test="not(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[1]/w:ilfo/@w:val= $currlistid) and $rootlist/w:lvl ">
<xsl:element name="text:list-style">
<xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/>
</xsl:attribute>
<xsl:apply-templates select="$rootlist/w:lvl"/>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template match="w:lvl">
<xsl:variable name="listtype">
<xsl:choose>
<xsl:when test="w:nfc/@w:val">
<xsl:value-of select="w:nfc/@w:val"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$listtype =23 and w:lvlPicBulletId">
<!-- image characters. wym -->
<xsl:element name="text:list-level-style-image">
<xsl:call-template name="list-styles-image"/>
</xsl:element>
</xsl:when>
<xsl:when test="$listtype =23">
<!-- nfcBullet: Bullet character. glu -->
<xsl:element name="text:list-level-style-bullet">
<xsl:call-template name="list-styles-common">
<xsl:with-param name="listtype" select="$listtype"/>
<xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<!-- all kinds of numbering characters. glu :( -->
<xsl:element name="text:list-level-style-number">
<xsl:call-template name="list-styles-common">
<xsl:with-param name="listtype" select="$listtype"/>
<xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
</xsl:call-template>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="list-styles-common">
<xsl:param name="listtype"/>
<xsl:param name="currlevel"/>
<xsl:variable name="startval" select="w:start/@w:val"/>
<xsl:attribute name="text:level">
<xsl:value-of select="$currlevel"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="$listtype = 23">
<!-- bullet character. glu -->
<xsl:attribute name="text:style-name">Bullet_20_Symbols</xsl:attribute>
<xsl:if test="not (contains(w:lvlText/@w:val,'%'))">
<xsl:attribute name="text:bullet-char">
<xsl:value-of select="w:lvlText/@w:val"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="contains(w:lvlText/@w:val,'%')">
<xsl:attribute name="text:bullet-char">
<xsl:value-of select=" '·' "/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:when test="($listtype &gt;= 0) and ($listtype &lt; 60)">
<xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
<xsl:if test="$startval">
<xsl:choose>
<xsl:when test="$startval &gt; 0">
<xsl:attribute name="text:start-value">
<xsl:value-of select="$startval"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:start-value">
<xsl:value-of select=" '1' "/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<!--xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
</xsl:if>
<xsl:attribute name="text:display-levels">
<xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
</xsl:attribute>
<xsl:call-template name="nfc2numformat">
<xsl:with-param name="nfcvalue" select="$listtype"/>
<xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/>
<xsl:with-param name="suffix" select="substring-after(w:lvlText/@w:val, concat('%', $currlevel) )"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
<xsl:if test="$startval">
<xsl:choose>
<xsl:when test="$startval &gt; 0">
<xsl:attribute name="text:start-value">
<xsl:value-of select="$startval"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:start-value">
<xsl:value-of select=" '1' "/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<!-- xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
</xsl:if>
<xsl:attribute name="text:display-levels">
<xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
</xsl:attribute>
<!-- 'none' in Word 2003. wym -->
<xsl:attribute name="style:num-format"/>
<xsl:attribute name="style:num-prefix">
<xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/>
</xsl:attribute>
<xsl:attribute name="style:num-suffix">
<xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="style:list-level-properties">
<xsl:choose>
<xsl:when test="w:lvlJc/@w:val='right'">
<xsl:attribute name="fo:text-align">end</xsl:attribute>
</xsl:when>
<xsl:when test="w:lvlJc/@w:val='center'">
<xsl:attribute name="fo:text-align">center</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="fo:text-align">start</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="labelwidth">
<xsl:choose>
<xsl:when test="w:pPr/w:ind/@w:hanging">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="w:pPr/w:ind/@w:first-line">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="leftwidth">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="w:pPr/w:ind/@w:left">
<xsl:attribute name="text:space-before">
<xsl:choose>
<xsl:when test=" ( number($leftwidth)-number($labelwidth) ) &gt; 0">
<xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=" '0cm' "/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="text:min-label-width">
<xsl:choose>
<xsl:when test="$labelwidth &gt; 0">
<xsl:value-of select="concat($labelwidth,'cm')"/>
</xsl:when>
<xsl:otherwise>0cm</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<!-- In binary word translation, text:min-label-distance do not generate. So, the width of number-symbol will not effect the start position of text. But first line always start same position of second line, no indent. If text:min-label-distance generate, the look of list will change because of uncountable number-symbol's width, now use 0.25cm as default width-->
<xsl:choose>
<xsl:when test="w:suff/@w:val='Space'">
<xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
</xsl:when>
<xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
<xsl:variable name="tabpos">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
<xsl:variable name="min-label-distance">
<xsl:choose>
<xsl:when test="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25 &lt; 0">0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="text:min-label-distance">
<xsl:value-of select="concat($min-label-distance,'cm')"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
</xsl:choose>
<!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used
<xsl:variable name="currNode" select="/w:wordDocument/w:body//w:listPr[w:ilvl/@w:val = $currlevel][w:ilfo/@w:val = $currlist/w:ilfo/@w:val]"/>
<xsl:choose>
<xsl:when test="($currNode/wx:t/@wx:wTabBefore ) and ($currNode/wx:t/@wx:wTabAfter ) and (not($currNode/following-sibling::w:jc) or $currNode/following-sibling::w:jc/@w:val = 'left')">
<xsl:attribute name="text:space-before"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabBefore)div 1440) * 2.54"/>cm</xsl:attribute>
<xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabAfter)div 1440) * 2.54"/>cm</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:space-before"><xsl:value-of select="((number(w:pPr/w:ind/@w:left) div 1440) * 2.54) "/>cm</xsl:attribute>
<xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440) * 2.54"/>cm</xsl:attribute>
</xsl:otherwise>
</xsl:choose>-->
<xsl:if test="w:rPr/w:rFonts">
<xsl:if test="w:rPr/w:rFonts/@w:ascii">
<xsl:attribute name="style:font-name">
<xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/>
</xsl:attribute>
</xsl:if>
<!-- in Oasis format the style:font-name-asian is not allowed to appear here -->
<!--xsl:if test="w:rPr/w:rFonts/@w:fareast">
<xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute>
</xsl:if -->
<!--
<xsl:if test="w:rPr/w:rFonts/@w:cs">
<xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute>
</xsl:if>
-->
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template name="list-styles-image">
<xsl:variable name="currlevel" select="number(@w:ilvl)"/>
<xsl:attribute name="text:level">
<xsl:value-of select="$currlevel+1"/>
</xsl:attribute>
<xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/>
<office:binary-data>
<xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/>
</office:binary-data>
<xsl:element name="style:list-level-properties">
<xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
<xsl:attribute name="style:vertical-rel">line</xsl:attribute>
<xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/>
<xsl:attribute name="fo:text-align">left</xsl:attribute>
<xsl:attribute name="fo:width">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/>
</xsl:call-template>
<xsl:text>cm</xsl:text>
</xsl:attribute>
<xsl:attribute name="fo:height">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="substring-after($picsize,'height:')"/>
</xsl:call-template>
<xsl:text>cm</xsl:text>
</xsl:attribute>
<xsl:variable name="labelwidth">
<xsl:choose>
<xsl:when test="w:pPr/w:ind/@w:hanging">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="w:pPr/w:ind/@w:first-line">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="leftwidth">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="text:space-before">
<xsl:choose>
<xsl:when test="(number($leftwidth)-number($labelwidth)) &gt; 0 ">
<xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=" '0cm' "/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="text:min-label-width">
<xsl:choose>
<xsl:when test="$labelwidth &gt; 0">
<xsl:value-of select="concat($labelwidth,'cm')"/>
</xsl:when>
<xsl:otherwise>0cm</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:choose>
<xsl:when test="w:suff/@w:val='Space'">
<xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
</xsl:when>
<xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
<xsl:variable name="tabpos">
<xsl:call-template name="ConvertMeasure">
<xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
<xsl:attribute name="text:min-label-distance">
<xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:element>
</xsl:template>
<!-- avoid listPr in textbox. :( glu -->
<xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]">
<xsl:call-template name="genlist"/>
</xsl:template>
<xsl:template name="genlist">
<xsl:variable name="currlistid" select="w:pPr/w:listPr/w:ilfo/@w:val"/>
<xsl:variable name="currlistlvl" select="w:pPr/w:listPr/w:ilvl/@w:val"/>
<xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/>
<xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
<xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/>
<xsl:element name="text:list">
<xsl:attribute name="text:style-name">
<xsl:choose>
<xsl:when test="string-length($rootlistname) &gt; 0">
<xsl:value-of select="translate($rootlistname,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_')"/>
</xsl:when>
<xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:choose>
<xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val">
<xsl:attribute name="text:continue-numbering">true</xsl:attribute>
<xsl:element name="text:list-item">
<xsl:call-template name="levels">
<xsl:with-param name="level" select="$currlistlvl"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="text:list-item">
<xsl:call-template name="levels">
<xsl:with-param name="level" select="$currlistlvl"/>
</xsl:call-template>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<xsl:template name="levels">
<xsl:param name="level"/>
<xsl:choose>
<xsl:when test="$level = '0'">
<xsl:call-template name="process-common-paragraph"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="text:list">
<xsl:element name="text:list-item">
<xsl:call-template name="levels">
<xsl:with-param name="level" select="$level -1"/>
</xsl:call-template>
</xsl:element>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="w:style" mode="list">
<xsl:variable name="listname" select="@w:styleId"/>
<xsl:if test="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]">
<text:list-style style:name="{$listname}">
<xsl:apply-templates select="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]/w:lvl"/>
</text:list-style>
</xsl:if>
</xsl:template>
<!-- for create outline style in office:styles -->
<xsl:template name="create-outline-style">
<xsl:element name="text:outline-style">
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="1"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="2"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="3"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="4"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="5"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="6"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="7"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="8"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="9"/>
</xsl:call-template>
<xsl:call-template name="outline-level-style">
<xsl:with-param name="level" select="10"/>
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template name="outline-level-style">
<xsl:param name="level"/>
<xsl:element name="text:outline-level-style">
<xsl:choose>
<xsl:when test="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]">
<xsl:apply-templates select="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]" mode="outline">
<xsl:with-param name="outlinelevel" select="$level"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:level">
<xsl:value-of select="$level"/>
</xsl:attribute>
<xsl:attribute name="style:num-format"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<xsl:template match="w:listPr" mode="outline">
<xsl:param name="outlinelevel"/>
<xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
<xsl:variable name="currlistlevel">
<xsl:choose>
<xsl:when test="w:ilvl">
<xsl:value-of select="w:ilvl/@w:val"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
<xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
<xsl:if test="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
<xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
<xsl:call-template name="list-styles-common">
<xsl:with-param name="listtype">
<xsl:choose>
<xsl:when test="w:nfc/@w:val">
<xsl:value-of select="w:nfc/@w:val"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="currlevel" select="$outlinelevel"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:if test="not($rootlist/w:lvl[@w:ilvl=$currlistlevel])">
<xsl:attribute name="text:level">
<xsl:value-of select="'1'"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="nfc2numformat">
<xsl:param name="nfcvalue"/>
<xsl:param name="prefix"/>
<xsl:param name="suffix"/>
<xsl:choose>
<xsl:when test="$nfcvalue=0">
<xsl:attribute name="style:num-format">1</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=1">
<xsl:attribute name="style:num-format">I</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=2">
<xsl:attribute name="style:num-format">i</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=3">
<xsl:attribute name="style:num-format">A</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=4">
<xsl:attribute name="style:num-format">a</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="style:num-format">1</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$nfcvalue=26">
<xsl:attribute name="style:num-prefix">
<xsl:value-of select="$prefix"/>
</xsl:attribute>
<xsl:attribute name="style:num-suffix">
<xsl:value-of select="concat( '.' , $suffix )"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=27 or $nfcvalue=29">
<xsl:attribute name="style:num-prefix">
<xsl:value-of select="concat( $prefix, '(' )"/>
</xsl:attribute>
<xsl:attribute name="style:num-suffix">
<xsl:value-of select="concat( ')' , $suffix )"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=57">
<xsl:attribute name="style:num-prefix">
<xsl:value-of select="concat( $prefix, '- ' )"/>
</xsl:attribute>
<xsl:attribute name="style:num-suffix">
<xsl:value-of select="concat( ' -' , $suffix )"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="style:num-prefix">
<xsl:value-of select="$prefix"/>
</xsl:attribute>
<xsl:attribute name="style:num-suffix">
<xsl:value-of select="$suffix"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- xsl:template name="nfc2numformat">
<xsl:param name="nfcvalue"/>
<xsl:param name="prefix"/>
<xsl:param name="suffix"/>
<xsl:choose>
<xsl:when test="$nfcvalue=0">
<xsl:attribute name="style:num-format">1</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=1">
<xsl:attribute name="style:num-format">I</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=2">
<xsl:attribute name="style:num-format">i</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=3">
<xsl:attribute name="style:num-format">A</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=4">
<xsl:attribute name="style:num-format">a</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=10 or $nfcvalue=11 or $nfcvalue=17 or $nfcvalue=29 or $nfcvalue=33 or $nfcvalue=35 or $nfcvalue=36 or $nfcvalue=37 or $nfcvalue=39 or $nfcvalue=44">
<xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=12">
<xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=13">
<xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=14 or $nfcvalue=19">
<xsl:attribute name="style:num-format">, , , ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=16">
<xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=18 or $nfcvalue=28">
<xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=20">
<xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=21">
<xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=24">
<xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=25">
<xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=30">
<xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=31">
<xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=34">
<xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=38">
<xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=41 or $nfcvalue=42 or $nfcvalue=43">
<xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=45 or $nfcvalue=47">
<xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=46 or $nfcvalue=48">
<xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=53">
<xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue!=57 and $nfcvalue &gt; 48 and $nfcvalue &lt; 60">
<xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="style:num-format">1</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$nfcvalue=26">
<xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
<xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( '.' , $suffix )"/></xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=27 or $nfcvalue=29">
<xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '(' )"/></xsl:attribute>
<xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ')' , $suffix )"/></xsl:attribute>
</xsl:when>
<xsl:when test="$nfcvalue=57">
<xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '- ' )"/></xsl:attribute>
<xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ' -' , $suffix )"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
<xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:template -->
</xsl:stylesheet>

View File

@@ -0,0 +1,402 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
<xsl:template match="w:footnotePr" mode="config">
<text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol">
<xsl:if test="w:pos">
<xsl:choose>
<xsl:when test="w:pos/@w:val = 'beneath-text'">
<xsl:attribute name="text:footnotes-position">document</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:footnotes-position">page</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="w:numStart">
<xsl:choose>
<xsl:when test="w:numStart/@w:val - 1 &gt; 0">
<xsl:attribute name="text:start-value">
<xsl:value-of select="w:numStart/@w:val - 1"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:start-value">
<xsl:value-of select=" '1' "/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute-->
</xsl:if>
<xsl:if test="w:numFmt">
<xsl:call-template name="convert-number-format">
<xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="w:numRestart">
<xsl:choose>
<xsl:when test="w:numRestart/@w:val = 'continuous'">
<xsl:attribute name="text:start-numbering-at">document</xsl:attribute>
</xsl:when>
<xsl:when test="w:numRestart/@w:val = 'each-sect'">
<xsl:attribute name="text:start-numbering-at">chapter</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:start-numbering-at">page</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!--
<xsl:if test="w:footnote[@w:type = 'continuation-separator']">
<text:footnote-continuation-notice-backward>
<xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-separator'])"/>
</text:footnote-continuation-notice-backward>
</xsl:if>
<xsl:if test="w:footnote[@w:type = 'continuation-notice']">
<text:footnote-continuation-notice-forward>
<xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-notice'])"/>
</text:footnote-continuation-notice-forward>
</xsl:if>
-->
</text:notes-configuration>
</xsl:template>
<xsl:template match="w:endnotePr" mode="config">
<text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol">
<xsl:if test="w:numStart">
<xsl:choose>
<xsl:when test="(w:numStart/@w:val - 1) &gt; 0">
<xsl:attribute name="text:start-value">
<xsl:value-of select="w:numStart/@w:val - 1"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:start-value">
<xsl:value-of select=" '1' "/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute -->
</xsl:if>
<xsl:if test="w:numFmt">
<xsl:call-template name="convert-number-format">
<xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
</xsl:call-template>
</xsl:if>
</text:notes-configuration>
</xsl:template>
<xsl:template name="convert-number-format">
<xsl:param name="number-format"/>
<xsl:choose>
<xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-zero'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">0</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">.</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-enclosed-paren'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">(</xsl:attribute>
<xsl:attribute name="style:num-suffix">)</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'number-in-dash'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">-</xsl:attribute>
<xsl:attribute name="style:num-suffix">-</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'upper-letter'">
<xsl:attribute name="style:num-format">A</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'lower-letter'">
<xsl:attribute name="style:num-format">a</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'upper-roman'">
<xsl:attribute name="style:num-format">I</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'lower-roman'">
<xsl:attribute name="style:num-format">i</xsl:attribute>
</xsl:when>
<!-- ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting -->
<xsl:otherwise>
<xsl:attribute name="style:num-format">1</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="w:bgPict">
<xsl:if test="w:background/@w:bgcolor">
<xsl:attribute name="fo:background-color">
<xsl:call-template name="MapConstColor">
<xsl:with-param name="color" select="w:background/@w:bgcolor"/>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:if test="w:background/@w:background">
<style:background-image>
<office:binary-data>
<xsl:variable name="the-image" select="key('imagedata',w:background/@w:background)"/>
<xsl:value-of select="translate($the-image/text(),'&#9;&#10;&#13;&#32;','' ) "/>
</office:binary-data>
</style:background-image>
</xsl:if>
</xsl:template>
<xsl:template match="w:sectPr" mode="page-layout">
<style:page-layout>
<xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr" format="1"/>
</xsl:attribute>
<style:page-layout-properties>
<xsl:call-template name="page-layout-properties"/>
<xsl:apply-templates select="/w:wordDocument/w:bgPict"/>
</style:page-layout-properties>
<style:header-style>
<style:header-footer-properties style:dynamic-spacing="true" fo:margin-bottom="0">
<xsl:variable name="header-margin">
<xsl:choose>
<xsl:when test="w:pgMar/@w:header">
<xsl:value-of select="w:pgMar/@w:header"/>
</xsl:when>
<xsl:otherwise>720</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="header-margin-diff">
<xsl:value-of select="w:pgMar/@w:top - $header-margin"/>
</xsl:variable>
<xsl:variable name="min-height">
<xsl:choose>
<xsl:when test="$header-margin-diff &gt; 0">
<xsl:value-of select="$header-margin-diff div 567.0"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="fo:min-height">
<xsl:value-of select="concat($min-height, 'cm')"/>
</xsl:attribute>
</style:header-footer-properties>
</style:header-style>
</style:page-layout>
</xsl:template>
<xsl:template match="w:sectPr" mode="master-page">
<!-- style:page-layout style:style-->
<xsl:variable name="master-page-number">
<xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any" format="1"/>
</xsl:variable>
<xsl:if test="$master-page-number = '1'">
<style:master-page style:next-style-name="Standard-1" style:page-layout-name="pm1" style:display-name="First Page" style:name="First_20_Page">
<style:header>
<xsl:apply-templates select="w:hdr[@w:type='first']/child::*" mode="dispatch"/>
</style:header>
<style:footer>
<xsl:apply-templates select="w:ftr[@w:type='first']/child::*" mode="dispatch"/>
</style:footer>
</style:master-page>
</xsl:if>
<xsl:element name="style:master-page">
<xsl:attribute name="style:name">Standard-<xsl:value-of select="$master-page-number"/>
</xsl:attribute>
<xsl:attribute name="style:page-layout-name">
<xsl:value-of select="concat('pm', $master-page-number)"/>
</xsl:attribute>
<style:header>
<xsl:apply-templates select="w:hdr[@w:type='odd']/child::*" mode="dispatch"/>
</style:header>
<style:header-left>
<xsl:apply-templates select="w:hdr[@w:type='even']/child::*" mode="dispatch"/>
</style:header-left>
<style:footer>
<xsl:apply-templates select="w:ftr[@w:type='odd']/child::*" mode="dispatch"/>
</style:footer>
<style:footer-left>
<xsl:apply-templates select="w:ftr[@w:type='even']/child::*" mode="dispatch"/>
</style:footer-left>
<!-- Headers and footers-->
<!--
<style:header-style>
<style:header-footer-properties>
<xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:header,'twip')"/></xsl:call-template>cm</xsl:attribute>
<xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute>
<xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
</style:header-footer-properties>
</style:header-style>
<style:footer-style>
<style:header-footer-properties>
<xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'twip')"/></xsl:call-template>cm</xsl:attribute>
<xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute>
<xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
</style:header-footer-properties>
</style:footer-style>
-->
<!-- any examples for w:titlePg usage? -->
<xsl:if test="not(w:titlePg)">
<xsl:apply-templates select="w:hdr[@w:type='odd']"/>
<xsl:apply-templates select="w:hdr[@w:type='even']"/>
<xsl:apply-templates select="w:ftr[@w:type='odd']"/>
<xsl:apply-templates select="w:ftr[@w:type='even']"/>
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="w:hdr">
<!--
<xsl:choose>
<xsl:when test="@w:type = 'odd'">
<style:header>
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
</style:header>
</xsl:when>
<xsl:when test="@w:type = 'even'">
<style:header>
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
</style:header>
</xsl:when>
</xsl:choose>
-->
</xsl:template>
<xsl:template match="w:ftr">
<!--
<xsl:choose>
<xsl:when test="@w:type = 'odd'">
<style:footer>
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
</style:footer>
</xsl:when>
<xsl:when test="@w:type = 'even'">
<style:footer-left>
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
</style:footer-left>
</xsl:when>
</xsl:choose>
-->
</xsl:template>
<xsl:template match="wx:pBdrGroup">
<xsl:apply-templates mode="dispatch"/>
</xsl:template>
<!-- xsl:template name="convert-number-format">
<xsl:param name="number-format"/>
<xsl:choose>
<xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-zero'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">0</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">.</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-enclosed-paren'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">(</xsl:attribute>
<xsl:attribute name="style:num-suffix">)</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'number-in-dash'">
<xsl:attribute name="style:num-format">1</xsl:attribute>
<xsl:attribute name="style:num-prefix">-</xsl:attribute>
<xsl:attribute name="style:num-suffix">-</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'upper-letter'">
<xsl:attribute name="style:num-format">A</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'lower-letter'">
<xsl:attribute name="style:num-format">a</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'upper-roman'">
<xsl:attribute name="style:num-format">I</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'lower-roman'">
<xsl:attribute name="style:num-format">i</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-full-width' or $number-format = 'decimal-full-width2'">
<xsl:attribute name="style:num-format">, , , ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'decimal-enclosed-circle-chinese' or $number-format = 'decimal-enclosed-circle'">
<xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'ideograph-enclosed-circle'">
<xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
<xsl:attribute name="style:num-prefix">(</xsl:attribute>
<xsl:attribute name="style:num-suffix">)</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'chinese-counting-thousand' or $number-format = 'ideograph-digital' or $number-format = 'japanese-counting' or $number-format = 'japanese-digital-ten-thousand' or $number-format = 'taiwanese-counting-thousand' or $number-format = 'taiwanese-counting' or $number-format = 'taiwanese-digital' or $number-format = 'chinese-counting' or $number-format = 'korean-digital2' or $number-format = 'chinese-not-impl'">
<xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'chinese-legal-simplified'">
<xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'ideograph-legal-traditional'">
<xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'ideograph-traditional'">
<xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'ideograph-zodiac'">
<xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'japanese-legal'">
<xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'aiueo-full-width'">
<xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'aiueo'">
<xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'iroha-full-width'">
<xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'iroha'">
<xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'korean-digital' or $number-format = 'korean-counting' or $number-format = 'korean-legal'">
<xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'chosung'">
<xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'ganada'">
<xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'arabic-alpha' or $number-format = 'arabic-abjad'">
<xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'thai-letters' or $number-format = 'thai-numbers' or $number-format = 'thai-counting'">
<xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'hebrew-1'">
<xsl:attribute name="style:num-format">א, י, ק, ...</xsl:attribute>
</xsl:when>
<xsl:when test="$number-format = 'hebrew-2'">
<xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
</xsl:when>
< ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting >
<xsl:otherwise>
<xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:template -->
</xsl:stylesheet>

View File

@@ -0,0 +1,268 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:an="urn:flr:annotate">
<an:page-layout-properties
context-node-input="w:sectPr"
context-node-output="style:page-layout-properties">
<an:so-supported select="w:pgMar/@w:gutter"/>
<an:so-supported select="w:pgSz/@w:code"/>
</an:page-layout-properties>
<xsl:template name="page-layout-properties">
<!-- NOTE: "div 567.0" converts from twips to cm -->
<xsl:attribute name="fo:margin-top">
<xsl:variable name="header-margin">
<xsl:choose>
<xsl:when test="w:pgMar/@w:header">
<xsl:value-of select="w:pgMar/@w:header"/>
</xsl:when>
<xsl:otherwise>720</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="margin-top">
<xsl:choose>
<xsl:when test="w:hdr">
<xsl:choose>
<xsl:when test="w:pgMar/@w:top &gt;= $header-margin">
<xsl:value-of select="$header-margin"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="w:pgMar/@w:top"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="w:pgMar/@w:top"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($margin-top div 567.0, 'cm')"/>
</xsl:attribute>
<xsl:attribute name="fo:margin-bottom">
<xsl:variable name="footer-margin">
<xsl:choose>
<xsl:when test="w:pgMar/@w:footer">
<xsl:value-of select="w:pgMar/@w:footer"/>
</xsl:when>
<xsl:otherwise>720</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="margin-bottom">
<xsl:choose>
<xsl:when test="w:ftr">
<xsl:value-of select="$footer-margin"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="w:pgMar/@w:bottom"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($margin-bottom div 567.0, 'cm')"/>
</xsl:attribute>
<xsl:attribute name="fo:margin-left">
<xsl:value-of select="concat(w:pgMar/@w:left div 567.0, 'cm')"/>
</xsl:attribute>
<xsl:attribute name="fo:margin-right">
<xsl:value-of select="concat(w:pgMar/@w:right div 567.0, 'cm')"/>
</xsl:attribute>
<xsl:attribute name="fo:page-width">
<xsl:value-of select="concat(w:pgSz/@w:w div 567.0, 'cm')"/>
</xsl:attribute>
<xsl:attribute name="fo:page-height">
<xsl:value-of select="concat(w:pgSz/@w:h div 567.0, 'cm')"/>
</xsl:attribute>
<xsl:attribute name="style:footnote-max-height">
<xsl:value-of select="'0cm'"/>
</xsl:attribute>
<xsl:attribute name="style:print-orientation">
<xsl:choose>
<xsl:when test="w:pgSz/@w:orient">
<xsl:value-of select="w:pgSz/@w:orient"/>
</xsl:when>
<xsl:otherwise>portrait</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="//w:bgPict"/>
<xsl:call-template name="column-properties"/>
</xsl:template>
<an:column-properties
context-node-input="w:sectPr"
context-node-output="style:page-layout-properties">
<an:so-supported select="w:cols/@w:sep"/>
</an:column-properties>
<xsl:template name="column-properties">
<style:columns>
<xsl:attribute name="fo:column-count">
<xsl:choose>
<xsl:when test="w:cols/@w:num">
<xsl:value-of select="w:cols/@w:num"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="not(w:cols/w:col)">
<!-- bug in the OASIS spec resp. bug in xmloff -->
<xsl:attribute name="fo:column-gap">
<xsl:value-of select="concat(w:cols/@w:space div 567.0, 'cm')"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="w:cols/w:col">
<style:column>
<xsl:attribute name="style:rel-width">
<xsl:value-of select="concat(@w:w, '*')"/>
</xsl:attribute>
<xsl:attribute name="fo:start-indent">
<xsl:value-of select="'0cm'"/>
</xsl:attribute>
<xsl:attribute name="fo:end-indent">
<xsl:choose>
<xsl:when test="@w:space">
<xsl:value-of select="concat(@w:space div 567.0, 'cm')"/>
</xsl:when>
<xsl:otherwise>0cm</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</style:column>
</xsl:for-each>
</style:columns>
</xsl:template>
<an:text-properties
context-node-input="w:rPr"
context-node-output="style:text-properties">
</an:text-properties >
<xsl:template name="text-properties">
<xsl:variable name="b-value">
<xsl:choose>
<xsl:when test="w:b/@val">
<xsl:value-of select="w:b/@val"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(w:b)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- could be simplified: is "b" actually a valid value of w:b/@val ? -->
<xsl:variable name="font-weight">
<xsl:choose>
<xsl:when test="$b-value = 'on'">bold</xsl:when>
<xsl:when test="$b-value = 'off'">normal</xsl:when>
<xsl:when test="$b-value = 'b'">bold</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="fo:font-weight">
<xsl:value-of select="$font-weight"/>
</xsl:attribute>
<xsl:attribute name="style:font-weight-asian">
<xsl:value-of select="$font-weight"/>
</xsl:attribute>
<xsl:attribute name="style:font-weight-complex">
<xsl:variable name="b-cs-value">
<xsl:choose>
<xsl:when test="w:b-cs/@val">
<xsl:value-of select="w:b-cs/@val"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(w:b-cs)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- could be simplified: is "b-cs" actually a valid value of w:b-cs/@val -->
<xsl:choose>
<xsl:when test="$b-cs-value = 'on'">bold</xsl:when>
<xsl:when test="$b-cs-value = 'off'">normal</xsl:when>
<xsl:when test="$b-cs-value = 'b-cs'">bold</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:variable name="i-value">
<xsl:choose>
<xsl:when test="w:i/@val">
<xsl:value-of select="w:i/@val"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(w:i)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- could be simplified: is "i" actually a valid value of w:i/@val ? -->
<xsl:variable name="font-style">
<xsl:choose>
<xsl:when test="$i-value = 'on'">italic</xsl:when>
<xsl:when test="$i-value = 'off'">normal</xsl:when>
<xsl:when test="$i-value = 'i'">italic</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="fo:font-style">
<xsl:value-of select="$font-style"/>
</xsl:attribute>
<xsl:attribute name="style:font-style-asian">
<xsl:value-of select="$font-style"/>
</xsl:attribute>
<xsl:attribute name="style:font-style-complex">
<xsl:variable name="i-cs-value">
<xsl:choose>
<xsl:when test="w:i-cs/@val">
<xsl:value-of select="w:i-cs/@val"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(w:i-cs)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- could be simplified: is "i-cs" actually a valid value of w:i-cs/@val -->
<xsl:choose>
<xsl:when test="$i-cs-value = 'on'">italic</xsl:when>
<xsl:when test="$i-cs-value = 'off'">normal</xsl:when>
<xsl:when test="$i-cs-value = 'i-cs'">italic</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="fo:text-transform">
<xsl:variable name="caps-value">
<xsl:choose>
<xsl:when test="w:caps/@val">
<xsl:value-of select="w:caps/@val"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(w:caps)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- could be simplified: is "caps" actually a valid value of w:caps/@val -->
<xsl:choose>
<xsl:when test="$caps-value = 'on'">uppercase</xsl:when>
<xsl:when test="$caps-value = 'off'">normal</xsl:when>
<xsl:when test="$caps-value = 'caps'">uppercase</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="fo:font-variant">
<xsl:variable name="small-caps-value">
<xsl:choose>
<xsl:when test="w:smallCaps/@val">
<xsl:value-of select="w:smallCaps/@val"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(w:smallCaps)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- could be simplified: is "smallCaps" actually a valid value of w:smallCaps/@val -->
<xsl:choose>
<xsl:when test="$small-caps-value = 'on'">small-caps</xsl:when>
<xsl:when test="$small-caps-value = 'off'">normal</xsl:when>
<xsl:when test="$small-caps-value = 'smallCaps'">small-caps</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
<xsl:template match="w:docPr">
<office:settings>
<config:config-item-set config:name="view-settings">
<config:config-item config:name="InBrowseMode" config:type="boolean">
<xsl:choose>
<xsl:when test="w:view/@w:val = 'outline'">true</xsl:when>
<xsl:when test="w:view/@w:val = 'print'">false</xsl:when>
<!-- others: web, reading, normal, master-pages, none. glu -->
<xsl:otherwise>true</xsl:otherwise>
</xsl:choose>
</config:config-item>
<config:config-item-map-indexed config:name="Views">
<config:config-item-map-entry>
<xsl:if test="w:zoom">
<!-- VisibleRight and VisibleBottom are arbitrary positive numbers. ;) glu -->
<config:config-item config:name="VisibleRight" config:type="int">1</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item>
<xsl:choose>
<xsl:when test="w:zoom/@w:val = 'best-fit'">
<config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
</xsl:when>
<xsl:when test="w:zoom/@w:val = 'full-page'">
<config:config-item config:name="ZoomType" config:type="short">2</config:config-item>
</xsl:when>
<xsl:when test="w:zoom/@w:val = 'text-fit'">
<config:config-item config:name="ZoomType" config:type="short">1</config:config-item>
</xsl:when>
<xsl:otherwise>
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
</xsl:otherwise>
</xsl:choose>
<config:config-item config:name="ZoomFactor" config:type="short">
<xsl:value-of select="w:zoom/@w:percent"/>
</config:config-item>
</xsl:if>
</config:config-item-map-entry>
</config:config-item-map-indexed>
</config:config-item-set>
</office:settings>
</xsl:template>
</xsl:stylesheet>