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: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"> 25 <xsl:template match="w:footnotePr" mode="config"> 26 <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol"> 27 <xsl:if test="w:pos"> 28 <xsl:choose> 29 <xsl:when test="w:pos/@w:val = 'beneath-text'"> 30 <xsl:attribute name="text:footnotes-position">document</xsl:attribute> 31 </xsl:when> 32 <xsl:otherwise> 33 <xsl:attribute name="text:footnotes-position">page</xsl:attribute> 34 </xsl:otherwise> 35 </xsl:choose> 36 </xsl:if> 37 <xsl:if test="w:numStart"> 38 <xsl:choose> 39 <xsl:when test="w:numStart/@w:val - 1 > 0"> 40 <xsl:attribute name="text:start-value"> 41 <xsl:value-of select="w:numStart/@w:val - 1"/> 42 </xsl:attribute> 43 </xsl:when> 44 <xsl:otherwise> 45 <xsl:attribute name="text:start-value"> 46 <xsl:value-of select=" '1' "/> 47 </xsl:attribute> 48 </xsl:otherwise> 49 </xsl:choose> 50 <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute--> 51 </xsl:if> 52 <xsl:if test="w:numFmt"> 53 <xsl:call-template name="convert-number-format"> 54 <xsl:with-param name="number-format" select="w:numFmt/@w:val"/> 55 </xsl:call-template> 56 </xsl:if> 57 <xsl:if test="w:numRestart"> 58 <xsl:choose> 59 <xsl:when test="w:numRestart/@w:val = 'continuous'"> 60 <xsl:attribute name="text:start-numbering-at">document</xsl:attribute> 61 </xsl:when> 62 <xsl:when test="w:numRestart/@w:val = 'each-sect'"> 63 <xsl:attribute name="text:start-numbering-at">chapter</xsl:attribute> 64 </xsl:when> 65 <xsl:otherwise> 66 <xsl:attribute name="text:start-numbering-at">page</xsl:attribute> 67 </xsl:otherwise> 68 </xsl:choose> 69 </xsl:if> 70 <!-- 71 <xsl:if test="w:footnote[@w:type = 'continuation-separator']"> 72 <text:footnote-continuation-notice-backward> 73 <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-separator'])"/> 74 </text:footnote-continuation-notice-backward> 75 </xsl:if> 76 <xsl:if test="w:footnote[@w:type = 'continuation-notice']"> 77 <text:footnote-continuation-notice-forward> 78 <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-notice'])"/> 79 </text:footnote-continuation-notice-forward> 80 </xsl:if> 81 --> 82 </text:notes-configuration> 83 </xsl:template> 84 <xsl:template match="w:endnotePr" mode="config"> 85 <text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol"> 86 <xsl:if test="w:numStart"> 87 <xsl:choose> 88 <xsl:when test="(w:numStart/@w:val - 1) > 0"> 89 <xsl:attribute name="text:start-value"> 90 <xsl:value-of select="w:numStart/@w:val - 1"/> 91 </xsl:attribute> 92 </xsl:when> 93 <xsl:otherwise> 94 <xsl:attribute name="text:start-value"> 95 <xsl:value-of select=" '1' "/> 96 </xsl:attribute> 97 </xsl:otherwise> 98 </xsl:choose> 99 <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute --> 100 </xsl:if> 101 <xsl:if test="w:numFmt"> 102 <xsl:call-template name="convert-number-format"> 103 <xsl:with-param name="number-format" select="w:numFmt/@w:val"/> 104 </xsl:call-template> 105 </xsl:if> 106 </text:notes-configuration> 107 </xsl:template> 108 <xsl:template name="convert-number-format"> 109 <xsl:param name="number-format"/> 110 <xsl:choose> 111 <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'"> 112 <xsl:attribute name="style:num-format">1</xsl:attribute> 113 </xsl:when> 114 <xsl:when test="$number-format = 'decimal-zero'"> 115 <xsl:attribute name="style:num-format">1</xsl:attribute> 116 <xsl:attribute name="style:num-prefix">0</xsl:attribute> 117 </xsl:when> 118 <xsl:when test="$number-format = 'decimal-enclosed-fullstop'"> 119 <xsl:attribute name="style:num-format">1</xsl:attribute> 120 <xsl:attribute name="style:num-prefix">.</xsl:attribute> 121 </xsl:when> 122 <xsl:when test="$number-format = 'decimal-enclosed-paren'"> 123 <xsl:attribute name="style:num-format">1</xsl:attribute> 124 <xsl:attribute name="style:num-prefix">(</xsl:attribute> 125 <xsl:attribute name="style:num-suffix">)</xsl:attribute> 126 </xsl:when> 127 <xsl:when test="$number-format = 'number-in-dash'"> 128 <xsl:attribute name="style:num-format">1</xsl:attribute> 129 <xsl:attribute name="style:num-prefix">-</xsl:attribute> 130 <xsl:attribute name="style:num-suffix">-</xsl:attribute> 131 </xsl:when> 132 <xsl:when test="$number-format = 'upper-letter'"> 133 <xsl:attribute name="style:num-format">A</xsl:attribute> 134 </xsl:when> 135 <xsl:when test="$number-format = 'lower-letter'"> 136 <xsl:attribute name="style:num-format">a</xsl:attribute> 137 </xsl:when> 138 <xsl:when test="$number-format = 'upper-roman'"> 139 <xsl:attribute name="style:num-format">I</xsl:attribute> 140 </xsl:when> 141 <xsl:when test="$number-format = 'lower-roman'"> 142 <xsl:attribute name="style:num-format">i</xsl:attribute> 143 </xsl:when> 144 <!-- ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional, 145 vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting --> 146 <xsl:otherwise> 147 <xsl:attribute name="style:num-format">1</xsl:attribute> 148 </xsl:otherwise> 149 </xsl:choose> 150 </xsl:template> 151 <xsl:template match="w:bgPict"> 152 <xsl:if test="w:background/@w:bgcolor"> 153 <xsl:attribute name="fo:background-color"> 154 <xsl:call-template name="MapConstColor"> 155 <xsl:with-param name="color" select="w:background/@w:bgcolor"/> 156 </xsl:call-template> 157 </xsl:attribute> 158 </xsl:if> 159 <xsl:if test="w:background/@w:background"> 160 <style:background-image> 161 <office:binary-data> 162 <xsl:variable name="the-image" select="key('imagedata',w:background/@w:background)"/> 163 <xsl:value-of select="translate($the-image/text(),'	  ','' ) "/> 164 </office:binary-data> 165 </style:background-image> 166 </xsl:if> 167 </xsl:template> 168 <xsl:template match="w:sectPr" mode="page-layout"> 169 <style:page-layout> 170 <xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr" format="1"/> 171 </xsl:attribute> 172 <style:page-layout-properties> 173 <xsl:call-template name="page-layout-properties"/> 174 <xsl:apply-templates select="/w:wordDocument/w:bgPict"/> 175 </style:page-layout-properties> 176 <style:header-style> 177 <style:header-footer-properties style:dynamic-spacing="true" fo:margin-bottom="0"> 178 <xsl:variable name="header-margin"> 179 <xsl:choose> 180 <xsl:when test="w:pgMar/@w:header"> 181 <xsl:value-of select="w:pgMar/@w:header"/> 182 </xsl:when> 183 <xsl:otherwise>720</xsl:otherwise> 184 </xsl:choose> 185 </xsl:variable> 186 <xsl:variable name="header-margin-diff"> 187 <xsl:value-of select="w:pgMar/@w:top - $header-margin"/> 188 </xsl:variable> 189 <xsl:variable name="min-height"> 190 <xsl:choose> 191 <xsl:when test="$header-margin-diff > 0"> 192 <xsl:value-of select="$header-margin-diff div 567.0"/> 193 </xsl:when> 194 <xsl:otherwise>0</xsl:otherwise> 195 </xsl:choose> 196 </xsl:variable> 197 <xsl:attribute name="fo:min-height"> 198 <xsl:value-of select="concat($min-height, 'cm')"/> 199 </xsl:attribute> 200 </style:header-footer-properties> 201 </style:header-style> 202 </style:page-layout> 203 </xsl:template> 204 <xsl:template match="w:sectPr" mode="master-page"> 205 <!-- style:page-layout style:style--> 206 207 <xsl:variable name="master-page-number"> 208 <xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any" format="1"/> 209 </xsl:variable> 210 <xsl:if test="$master-page-number = '1'"> 211 <style:master-page style:next-style-name="Standard-1" style:page-layout-name="pm1" style:display-name="First Page" style:name="First_20_Page"> 212 <style:header> 213 <xsl:apply-templates select="w:hdr[@w:type='first']/child::*" mode="dispatch"/> 214 </style:header> 215 <style:footer> 216 <xsl:apply-templates select="w:ftr[@w:type='first']/child::*" mode="dispatch"/> 217 </style:footer> 218 </style:master-page> 219 </xsl:if> 220 <xsl:element name="style:master-page"> 221 <xsl:attribute name="style:name">Standard-<xsl:value-of select="$master-page-number"/> 222 </xsl:attribute> 223 <xsl:attribute name="style:page-layout-name"> 224 <xsl:value-of select="concat('pm', $master-page-number)"/> 225 </xsl:attribute> 226 227 <style:header> 228 <xsl:apply-templates select="w:hdr[@w:type='odd']/child::*" mode="dispatch"/> 229 </style:header> 230 <style:header-left> 231 <xsl:apply-templates select="w:hdr[@w:type='even']/child::*" mode="dispatch"/> 232 </style:header-left> 233 <style:footer> 234 <xsl:apply-templates select="w:ftr[@w:type='odd']/child::*" mode="dispatch"/> 235 </style:footer> 236 <style:footer-left> 237 <xsl:apply-templates select="w:ftr[@w:type='even']/child::*" mode="dispatch"/> 238 </style:footer-left> 239 240 <!-- Headers and footers--> 241 <!-- 242 <style:header-style> 243 <style:header-footer-properties> 244 <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> 245 <xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute> 246 <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute> 247 </style:header-footer-properties> 248 </style:header-style> 249 <style:footer-style> 250 <style:header-footer-properties> 251 <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> 252 <xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute> 253 <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute> 254 </style:header-footer-properties> 255 </style:footer-style> 256 --> 257 258 <!-- any examples for w:titlePg usage? --> 259 <xsl:if test="not(w:titlePg)"> 260 <xsl:apply-templates select="w:hdr[@w:type='odd']"/> 261 <xsl:apply-templates select="w:hdr[@w:type='even']"/> 262 <xsl:apply-templates select="w:ftr[@w:type='odd']"/> 263 <xsl:apply-templates select="w:ftr[@w:type='even']"/> 264 </xsl:if> 265 </xsl:element> 266 </xsl:template> 267 <xsl:template match="w:hdr"> 268 <!-- 269 <xsl:choose> 270 <xsl:when test="@w:type = 'odd'"> 271 <style:header> 272 <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> 273 </style:header> 274 </xsl:when> 275 <xsl:when test="@w:type = 'even'"> 276 <style:header> 277 <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> 278 </style:header> 279 </xsl:when> 280 </xsl:choose> 281 --> 282 </xsl:template> 283 <xsl:template match="w:ftr"> 284 <!-- 285 <xsl:choose> 286 <xsl:when test="@w:type = 'odd'"> 287 <style:footer> 288 <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> 289 </style:footer> 290 </xsl:when> 291 <xsl:when test="@w:type = 'even'"> 292 <style:footer-left> 293 <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/> 294 </style:footer-left> 295 </xsl:when> 296 </xsl:choose> 297 --> 298 </xsl:template> 299 <xsl:template match="wx:pBdrGroup"> 300 <xsl:apply-templates mode="dispatch"/> 301 </xsl:template> 302 <!-- xsl:template name="convert-number-format"> 303 <xsl:param name="number-format"/> 304 <xsl:choose> 305 <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'"> 306 <xsl:attribute name="style:num-format">1</xsl:attribute> 307 </xsl:when> 308 <xsl:when test="$number-format = 'decimal-zero'"> 309 <xsl:attribute name="style:num-format">1</xsl:attribute> 310 <xsl:attribute name="style:num-prefix">0</xsl:attribute> 311 </xsl:when> 312 <xsl:when test="$number-format = 'decimal-enclosed-fullstop'"> 313 <xsl:attribute name="style:num-format">1</xsl:attribute> 314 <xsl:attribute name="style:num-prefix">.</xsl:attribute> 315 </xsl:when> 316 <xsl:when test="$number-format = 'decimal-enclosed-paren'"> 317 <xsl:attribute name="style:num-format">1</xsl:attribute> 318 <xsl:attribute name="style:num-prefix">(</xsl:attribute> 319 <xsl:attribute name="style:num-suffix">)</xsl:attribute> 320 </xsl:when> 321 <xsl:when test="$number-format = 'number-in-dash'"> 322 <xsl:attribute name="style:num-format">1</xsl:attribute> 323 <xsl:attribute name="style:num-prefix">-</xsl:attribute> 324 <xsl:attribute name="style:num-suffix">-</xsl:attribute> 325 </xsl:when> 326 <xsl:when test="$number-format = 'upper-letter'"> 327 <xsl:attribute name="style:num-format">A</xsl:attribute> 328 </xsl:when> 329 <xsl:when test="$number-format = 'lower-letter'"> 330 <xsl:attribute name="style:num-format">a</xsl:attribute> 331 </xsl:when> 332 <xsl:when test="$number-format = 'upper-roman'"> 333 <xsl:attribute name="style:num-format">I</xsl:attribute> 334 </xsl:when> 335 <xsl:when test="$number-format = 'lower-roman'"> 336 <xsl:attribute name="style:num-format">i</xsl:attribute> 337 </xsl:when> 338 <xsl:when test="$number-format = 'decimal-full-width' or $number-format = 'decimal-full-width2'"> 339 <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute> 340 </xsl:when> 341 <xsl:when test="$number-format = 'decimal-enclosed-circle-chinese' or $number-format = 'decimal-enclosed-circle'"> 342 <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute> 343 </xsl:when> 344 <xsl:when test="$number-format = 'ideograph-enclosed-circle'"> 345 <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute> 346 <xsl:attribute name="style:num-prefix">(</xsl:attribute> 347 <xsl:attribute name="style:num-suffix">)</xsl:attribute> 348 </xsl:when> 349 <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'"> 350 <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute> 351 </xsl:when> 352 <xsl:when test="$number-format = 'chinese-legal-simplified'"> 353 <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute> 354 </xsl:when> 355 <xsl:when test="$number-format = 'ideograph-legal-traditional'"> 356 <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute> 357 </xsl:when> 358 <xsl:when test="$number-format = 'ideograph-traditional'"> 359 <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute> 360 </xsl:when> 361 <xsl:when test="$number-format = 'ideograph-zodiac'"> 362 <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute> 363 </xsl:when> 364 <xsl:when test="$number-format = 'japanese-legal'"> 365 <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute> 366 </xsl:when> 367 <xsl:when test="$number-format = 'aiueo-full-width'"> 368 <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> 369 </xsl:when> 370 <xsl:when test="$number-format = 'aiueo'"> 371 <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> 372 </xsl:when> 373 <xsl:when test="$number-format = 'iroha-full-width'"> 374 <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> 375 </xsl:when> 376 <xsl:when test="$number-format = 'iroha'"> 377 <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> 378 </xsl:when> 379 <xsl:when test="$number-format = 'korean-digital' or $number-format = 'korean-counting' or $number-format = 'korean-legal'"> 380 <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute> 381 </xsl:when> 382 <xsl:when test="$number-format = 'chosung'"> 383 <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute> 384 </xsl:when> 385 <xsl:when test="$number-format = 'ganada'"> 386 <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute> 387 </xsl:when> 388 <xsl:when test="$number-format = 'arabic-alpha' or $number-format = 'arabic-abjad'"> 389 <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute> 390 </xsl:when> 391 <xsl:when test="$number-format = 'thai-letters' or $number-format = 'thai-numbers' or $number-format = 'thai-counting'"> 392 <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute> 393 </xsl:when> 394 <xsl:when test="$number-format = 'hebrew-1' or $number-format = 'hebrew-2'"> 395 <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute> 396 </xsl:when> 397 < ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional, 398 vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting > 399 <xsl:otherwise> 400 <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute> 401 </xsl:otherwise> 402 </xsl:choose> 403 </xsl:template --> 404</xsl:stylesheet> 405