1<?xml version="1.0" encoding="UTF-8"?> 2<!--*********************************************************** 3 * 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * 21 ***********************************************************--> 22 23 24<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> 25 <xsl:template match="office:settings"> 26 <w:docPr> 27 <w:displayBackgroundShape/> 28 <xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/> 29 <xsl:choose> 30 <xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'"> 31 <w:view w:val="outline"/> 32 </xsl:when> 33 <xsl:otherwise> 34 <w:view w:val="print"/> 35 </xsl:otherwise> 36 </xsl:choose> 37 <xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/> 38 <w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}"> 39 <xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/> 40 <xsl:choose> 41 <xsl:when test="$zoom-type = '3'"> 42 <xsl:attribute name="w:val">best-fit</xsl:attribute> 43 </xsl:when> 44 <xsl:when test="$zoom-type = '2'"> 45 <xsl:attribute name="w:val">full-page</xsl:attribute> 46 </xsl:when> 47 <xsl:when test="$zoom-type = '1'"> 48 <xsl:attribute name="w:val">text-fit</xsl:attribute> 49 </xsl:when> 50 </xsl:choose> 51 </w:zoom> 52 <w:defaultTabStop> 53 <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute> 54 </w:defaultTabStop> 55 <xsl:if test="../office:master-styles/style:master-page/style:header-left"> 56 <w:evenAndOddHeaders/> 57 </xsl:if> 58 <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/> 59 <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/> 60 <!-- add the variables declaration in w:docpr G.Y. Begin--> 61 <xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls "> 62 <xsl:call-template name="field_declare"> 63 <xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/> 64 <xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/> 65 <xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/> 66 </xsl:call-template> 67 </xsl:if> 68 <!--add the variables declaration in w:docpr G.Y. End--> 69 </w:docPr> 70 </xsl:template> 71 <xsl:template match="text:footnotes-configuration"> 72 <xsl:param name="within-section"/> 73 <w:footnotePr> 74 <xsl:choose> 75 <xsl:when test="@text:footnotes-position = 'document'"> 76 <w:pos w:val="beneath-text"/> 77 </xsl:when> 78 <xsl:otherwise> 79 <w:pos w:val="page-bottom"/> 80 </xsl:otherwise> 81 </xsl:choose> 82 <xsl:if test="@text:start-value"> 83 <w:numStart w:val="{@text:start-value + 1}"/> 84 </xsl:if> 85 <xsl:if test="@style:num-format"> 86 <xsl:call-template name="convert-number-format"> 87 <xsl:with-param name="number-format" select="@style:num-format"/> 88 <xsl:with-param name="number-prefix" select="@style:num-prefix"/> 89 <xsl:with-param name="number-suffix" select="@style:num-suffix"/> 90 </xsl:call-template> 91 </xsl:if> 92 <xsl:if test="@text:start-numbering-at"> 93 <xsl:choose> 94 <xsl:when test="@text:start-numbering-at = 'document'"> 95 <w:numRestart w:val="continuous"/> 96 </xsl:when> 97 <xsl:when test="@text:start-numbering-at = 'page'"> 98 <w:numRestart w:val="each-page"/> 99 </xsl:when> 100 <!-- convert "chapter" to "section" --> 101 <xsl:otherwise> 102 <w:numRestart w:val="each-sect"/> 103 </xsl:otherwise> 104 </xsl:choose> 105 </xsl:if> 106 <xsl:if test="$within-section != 'yes'"> 107 <!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator 108 is defined solely in docPr, so not trouble to find the proper footnote-sep definition. --> 109 <w:footnote w:type="separator"> 110 <w:p> 111 <w:r> 112 <w:separator/> 113 </w:r> 114 </w:p> 115 </w:footnote> 116 <w:footnote w:type="continuation-separator"> 117 <w:p> 118 <w:r> 119 <w:continuationSeparator/> 120 <xsl:if test="text:footnote-continuation-notice-backward"> 121 <w:t> 122 <xsl:value-of select="text:footnote-continuation-notice-backward"/> 123 </w:t> 124 </xsl:if> 125 </w:r> 126 </w:p> 127 </w:footnote> 128 <xsl:if test="text:footnote-continuation-notice-forward"> 129 <w:footnote w:type="continuation-notice"> 130 <w:p> 131 <w:r> 132 <w:t> 133 <xsl:value-of select="text:footnote-continuation-notice-forward"/> 134 </w:t> 135 </w:r> 136 </w:p> 137 </w:footnote> 138 </xsl:if> 139 </xsl:if> 140 </w:footnotePr> 141 </xsl:template> 142 <xsl:template match="text:endnotes-configuration"> 143 <xsl:param name="within-section"/> 144 <w:endnotePr> 145 <w:pos w:val="sect-end"/> 146 <xsl:if test="@text:start-value"> 147 <w:numStart w:val="{@text:start-value + 1}"/> 148 </xsl:if> 149 <xsl:if test="@style:num-format"> 150 <xsl:call-template name="convert-number-format"> 151 <xsl:with-param name="number-format" select="@style:num-format"/> 152 <xsl:with-param name="number-prefix" select="@style:num-prefix"/> 153 <xsl:with-param name="number-suffix" select="@style:num-suffix"/> 154 </xsl:call-template> 155 </xsl:if> 156 <w:numRestart w:val="each-sect"/> 157 <xsl:if test="$within-section != 'yes'"> 158 <w:endnote w:type="separator"> 159 <w:p> 160 <w:r> 161 <w:separator/> 162 </w:r> 163 </w:p> 164 </w:endnote> 165 <w:endnote w:type="continuation-separator"> 166 <w:p> 167 <w:r> 168 <w:continuationSeparator/> 169 </w:r> 170 </w:p> 171 </w:endnote> 172 </xsl:if> 173 </w:endnotePr> 174 </xsl:template> 175 <xsl:template name="convert-number-format"> 176 <xsl:param name="number-format"/> 177 <xsl:param name="number-prefix"/> 178 <xsl:param name="number-suffix"/> 179 <xsl:choose> 180 <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'"> 181 <w:numFmt w:val="decimal-zero"/> 182 </xsl:when> 183 <xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'"> 184 <w:numFmt w:val="decimal-enclosed-fullstop"/> 185 </xsl:when> 186 <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'"> 187 <w:numFmt w:val="decimal-enclosed-paren"/> 188 </xsl:when> 189 <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'"> 190 <w:numFmt w:val="number-in-dash"/> 191 </xsl:when> 192 <xsl:when test="$number-format = '1'"> 193 <!-- '1' also seems: decimal-half-width --> 194 <w:numFmt w:val="decimal"/> 195 </xsl:when> 196 <xsl:when test="$number-format = 'a'"> 197 <w:numFmt w:val="lower-letter"/> 198 </xsl:when> 199 <xsl:when test="$number-format = 'A'"> 200 <w:numFmt w:val="upper-letter"/> 201 </xsl:when> 202 <xsl:when test="$number-format = 'i'"> 203 <w:numFmt w:val="lower-roman"/> 204 </xsl:when> 205 <xsl:when test="$number-format = 'I'"> 206 <w:numFmt w:val="upper-roman"/> 207 </xsl:when> 208 <xsl:when test="$number-format = '1, 2, 3, ...'"> 209 <!-- '1, 2, 3, ...' also seems: decimal-full-width2 --> 210 <w:numFmt w:val="decimal-full-width"/> 211 </xsl:when> 212 <xsl:when test="$number-format = '①, ②, ③, ...'"> 213 <!-- decimal-enclosed-circle seems same --> 214 <w:numFmt w:val="decimal-enclosed-circle-chinese"/> 215 </xsl:when> 216 <xsl:when test="$number-format = '一, 二, 三, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'"> 217 <w:numFmt w:val="ideograph-enclosed-circle"/> 218 </xsl:when> 219 <xsl:when test="$number-format = '一, 二, 三, ...'"> 220 <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand, 221 taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 --> 222 <w:numFmt w:val="chinese-counting-thousand"/> 223 </xsl:when> 224 <xsl:when test="$number-format = '壹, 贰, 叁, ...'"> 225 <w:numFmt w:val="chinese-legal-simplified"/> 226 </xsl:when> 227 <xsl:when test="$number-format = '壹, 貳, 參, ...'"> 228 <w:numFmt w:val="ideograph-legal-traditional"/> 229 </xsl:when> 230 <xsl:when test="$number-format = '甲, 乙, 丙, ...'"> 231 <w:numFmt w:val="ideograph-traditional"/> 232 </xsl:when> 233 <xsl:when test="$number-format = '子, 丑, 寅, ...'"> 234 <w:numFmt w:val="ideograph-zodiac"/> 235 </xsl:when> 236 <xsl:when test="$number-format = '壱, 弐, 参, ...'"> 237 <w:numFmt w:val="japanese-legal"/> 238 </xsl:when> 239 <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> 240 <w:numFmt w:val="aiueo-full-width"/> 241 </xsl:when> 242 <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> 243 <w:numFmt w:val="aiueo"/> 244 </xsl:when> 245 <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> 246 <w:numFmt w:val="iroha-full-width"/> 247 </xsl:when> 248 <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> 249 <w:numFmt w:val="iroha"/> 250 </xsl:when> 251 <xsl:when test="$number-format = '일, 이, 삼, ...'"> 252 <!-- '일, 이, 삼, ...' also seems: korean-counting --> 253 <w:numFmt w:val="korean-digital"/> 254 </xsl:when> 255 <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'"> 256 <!-- mapping circled to uncirled --> 257 <w:numFmt w:val="chosung"/> 258 </xsl:when> 259 <xsl:when test="$number-format = '가, 나, 다, ...' or $number-format = '㉮, ㉯, ㉰, ...'"> 260 <!-- mapping circled to uncirled --> 261 <w:numFmt w:val="ganada"/> 262 </xsl:when> 263 <xsl:when test="$number-format = 'أ, ب, ت, ...'"> 264 <w:numFmt w:val="arabic-alpha"/> 265 </xsl:when> 266 <xsl:when test="$number-format = 'ก, ข, ฃ, ...'"> 267 <w:numFmt w:val="thai-letters"/> 268 </xsl:when> 269 <xsl:when test="$number-format = 'א, ב, ג, ...'"> 270 <w:numFmt w:val="hebrew-1"/> 271 </xsl:when> 272 <xsl:when test="$number-format = 'Native Numbering'"> 273 <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/> 274 <xsl:choose> 275 <xsl:when test="starts-with($locale, 'th-')"> 276 <!-- for Thai, mapping thai-numbers, thai-counting to thai-letters --> 277 <w:numFmt w:val="thai-letters"/> 278 </xsl:when> 279 <xsl:when test="starts-with($locale, 'hi-')"> 280 <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers --> 281 <w:numFmt w:val="hindi-numbers"/> 282 </xsl:when> 283 <xsl:when test="starts-with($locale, 'ar-')"> 284 <!-- for Arabic, mapping arabic-abjad to arabic-alpha --> 285 <w:numFmt w:val="arabic-alpha"/> 286 </xsl:when> 287 <xsl:when test="starts-with($locale, 'he-')"> 288 <!-- for Hebrew, mapping hebrew-2 to --> 289 <w:numFmt w:val="hebrew-1"/> 290 </xsl:when> 291 <xsl:when test="starts-with($locale, 'ru-')"> 292 <!-- for Russian, mapping russian-upper to russian-lower --> 293 <w:numFmt w:val="russian-lower"/> 294 </xsl:when> 295 <xsl:when test="starts-with($locale, 'vi-')"> 296 <!-- for Vietnamese --> 297 <w:numFmt w:val="vietnamese-counting"/> 298 </xsl:when> 299 </xsl:choose> 300 </xsl:when> 301 <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional, 302 chinese-not-impl, korean-legal --> 303 <xsl:otherwise> 304 <w:numFmt w:val="decimal"/> 305 </xsl:otherwise> 306 </xsl:choose> 307 </xsl:template> 308</xsl:stylesheet> 309