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:listPr" mode="style"> 26 <xsl:variable name="currlistid" select="w:ilfo/@w:val"/> 27 <xsl:variable name="currlist" select="."/> 28 <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> 29 <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/> 30 <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 "> 31 <xsl:element name="text:list-style"> 32 <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/> 33 </xsl:attribute> 34 <xsl:apply-templates select="$rootlist/w:lvl"/> 35 </xsl:element> 36 </xsl:if> 37 </xsl:template> 38 <xsl:template match="w:lvl"> 39 <xsl:variable name="listtype"> 40 <xsl:choose> 41 <xsl:when test="w:nfc/@w:val"> 42 <xsl:value-of select="w:nfc/@w:val"/> 43 </xsl:when> 44 <xsl:otherwise>0</xsl:otherwise> 45 </xsl:choose> 46 </xsl:variable> 47 <xsl:choose> 48 <xsl:when test="$listtype =23 and w:lvlPicBulletId"> 49 <!-- image characters. wym --> 50 <xsl:element name="text:list-level-style-image"> 51 <xsl:call-template name="list-styles-image"/> 52 </xsl:element> 53 </xsl:when> 54 <xsl:when test="$listtype =23"> 55 <!-- nfcBullet: Bullet character. glu --> 56 <xsl:element name="text:list-level-style-bullet"> 57 <xsl:call-template name="list-styles-common"> 58 <xsl:with-param name="listtype" select="$listtype"/> 59 <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/> 60 </xsl:call-template> 61 </xsl:element> 62 </xsl:when> 63 <xsl:otherwise> 64 <!-- all kinds of numbering characters. glu :( --> 65 <xsl:element name="text:list-level-style-number"> 66 <xsl:call-template name="list-styles-common"> 67 <xsl:with-param name="listtype" select="$listtype"/> 68 <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/> 69 </xsl:call-template> 70 </xsl:element> 71 </xsl:otherwise> 72 </xsl:choose> 73 </xsl:template> 74 <xsl:template name="list-styles-common"> 75 <xsl:param name="listtype"/> 76 <xsl:param name="currlevel"/> 77 <xsl:variable name="startval" select="w:start/@w:val"/> 78 <xsl:attribute name="text:level"> 79 <xsl:value-of select="$currlevel"/> 80 </xsl:attribute> 81 <xsl:choose> 82 <xsl:when test="$listtype = 23"> 83 <!-- bullet character. glu --> 84 <xsl:attribute name="text:style-name">Bullet_20_Symbols</xsl:attribute> 85 <xsl:if test="not (contains(w:lvlText/@w:val,'%'))"> 86 <xsl:attribute name="text:bullet-char"> 87 <xsl:value-of select="w:lvlText/@w:val"/> 88 </xsl:attribute> 89 </xsl:if> 90 <xsl:if test="contains(w:lvlText/@w:val,'%')"> 91 <xsl:attribute name="text:bullet-char"> 92 <xsl:value-of select=" '·' "/> 93 </xsl:attribute> 94 </xsl:if> 95 </xsl:when> 96 <xsl:when test="($listtype >= 0) and ($listtype < 60)"> 97 <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute> 98 <xsl:if test="$startval"> 99 <xsl:choose> 100 <xsl:when test="$startval > 0"> 101 <xsl:attribute name="text:start-value"> 102 <xsl:value-of select="$startval"/> 103 </xsl:attribute> 104 </xsl:when> 105 <xsl:otherwise> 106 <xsl:attribute name="text:start-value"> 107 <xsl:value-of select=" '1' "/> 108 </xsl:attribute> 109 </xsl:otherwise> 110 </xsl:choose> 111 <!--xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute --> 112 </xsl:if> 113 <xsl:attribute name="text:display-levels"> 114 <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/> 115 </xsl:attribute> 116 <xsl:call-template name="nfc2numformat"> 117 <xsl:with-param name="nfcvalue" select="$listtype"/> 118 <xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/> 119 <xsl:with-param name="suffix" select="substring-after(w:lvlText/@w:val, concat('%', $currlevel) )"/> 120 </xsl:call-template> 121 </xsl:when> 122 <xsl:otherwise> 123 <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute> 124 <xsl:if test="$startval"> 125 <xsl:choose> 126 <xsl:when test="$startval > 0"> 127 <xsl:attribute name="text:start-value"> 128 <xsl:value-of select="$startval"/> 129 </xsl:attribute> 130 </xsl:when> 131 <xsl:otherwise> 132 <xsl:attribute name="text:start-value"> 133 <xsl:value-of select=" '1' "/> 134 </xsl:attribute> 135 </xsl:otherwise> 136 </xsl:choose> 137 <!-- xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute --> 138 </xsl:if> 139 <xsl:attribute name="text:display-levels"> 140 <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/> 141 </xsl:attribute> 142 <!-- 'none' in Word 2003. wym --> 143 <xsl:attribute name="style:num-format"/> 144 <xsl:attribute name="style:num-prefix"> 145 <xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/> 146 </xsl:attribute> 147 <xsl:attribute name="style:num-suffix"> 148 <xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/> 149 </xsl:attribute> 150 </xsl:otherwise> 151 </xsl:choose> 152 <xsl:element name="style:list-level-properties"> 153 <xsl:choose> 154 <xsl:when test="w:lvlJc/@w:val='right'"> 155 <xsl:attribute name="fo:text-align">end</xsl:attribute> 156 </xsl:when> 157 <xsl:when test="w:lvlJc/@w:val='center'"> 158 <xsl:attribute name="fo:text-align">center</xsl:attribute> 159 </xsl:when> 160 <xsl:otherwise> 161 <xsl:attribute name="fo:text-align">start</xsl:attribute> 162 </xsl:otherwise> 163 </xsl:choose> 164 <xsl:variable name="labelwidth"> 165 <xsl:choose> 166 <xsl:when test="w:pPr/w:ind/@w:hanging"> 167 <xsl:call-template name="ConvertMeasure"> 168 <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/> 169 </xsl:call-template> 170 </xsl:when> 171 <xsl:when test="w:pPr/w:ind/@w:first-line"> 172 <xsl:call-template name="ConvertMeasure"> 173 <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/> 174 </xsl:call-template> 175 </xsl:when> 176 <xsl:otherwise>0</xsl:otherwise> 177 </xsl:choose> 178 </xsl:variable> 179 <xsl:variable name="leftwidth"> 180 <xsl:call-template name="ConvertMeasure"> 181 <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/> 182 </xsl:call-template> 183 </xsl:variable> 184 <xsl:if test="w:pPr/w:ind/@w:left"> 185 <xsl:attribute name="text:space-before"> 186 <xsl:choose> 187 <xsl:when test=" ( number($leftwidth)-number($labelwidth) ) > 0"> 188 <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/> 189 </xsl:when> 190 <xsl:otherwise> 191 <xsl:value-of select=" '0cm' "/> 192 </xsl:otherwise> 193 </xsl:choose> 194 </xsl:attribute> 195 </xsl:if> 196 <xsl:attribute name="text:min-label-width"> 197 <xsl:choose> 198 <xsl:when test="$labelwidth > 0"> 199 <xsl:value-of select="concat($labelwidth,'cm')"/> 200 </xsl:when> 201 <xsl:otherwise>0cm</xsl:otherwise> 202 </xsl:choose> 203 </xsl:attribute> 204 <!-- 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--> 205 <xsl:choose> 206 <xsl:when test="w:suff/@w:val='Space'"> 207 <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute> 208 </xsl:when> 209 <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos"> 210 <xsl:variable name="tabpos"> 211 <xsl:call-template name="ConvertMeasure"> 212 <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/> 213 </xsl:call-template> 214 </xsl:variable> 215 <xsl:if test="number($tabpos) > (number($leftwidth)-number($labelwidth))"> 216 <xsl:variable name="min-label-distance"> 217 <xsl:choose> 218 <xsl:when test="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25 < 0">0</xsl:when> 219 <xsl:otherwise> 220 <xsl:value-of select="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25"/> 221 </xsl:otherwise> 222 </xsl:choose> 223 </xsl:variable> 224 <xsl:attribute name="text:min-label-distance"> 225 <xsl:value-of select="concat($min-label-distance,'cm')"/> 226 </xsl:attribute> 227 </xsl:if> 228 </xsl:when> 229 </xsl:choose> 230 <!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used 231 <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]"/> 232 <xsl:choose> 233 <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')"> 234 <xsl:attribute name="text:space-before"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabBefore)div 1440) * 2.54"/>cm</xsl:attribute> 235 <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabAfter)div 1440) * 2.54"/>cm</xsl:attribute> 236 </xsl:when> 237 <xsl:otherwise> 238 <xsl:attribute name="text:space-before"><xsl:value-of select="((number(w:pPr/w:ind/@w:left) div 1440) * 2.54) "/>cm</xsl:attribute> 239 <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440) * 2.54"/>cm</xsl:attribute> 240 </xsl:otherwise> 241 </xsl:choose>--> 242 <xsl:if test="w:rPr/w:rFonts"> 243 <xsl:if test="w:rPr/w:rFonts/@w:ascii"> 244 <xsl:attribute name="style:font-name"> 245 <xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/> 246 </xsl:attribute> 247 </xsl:if> 248 <!-- in Oasis format the style:font-name-asian is not allowed to appear here --> 249 <!--xsl:if test="w:rPr/w:rFonts/@w:fareast"> 250 <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute> 251 </xsl:if --> 252 <!-- 253 <xsl:if test="w:rPr/w:rFonts/@w:cs"> 254 <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute> 255 </xsl:if> 256 --> 257 </xsl:if> 258 </xsl:element> 259 </xsl:template> 260 <xsl:template name="list-styles-image"> 261 <xsl:variable name="currlevel" select="number(@w:ilvl)"/> 262 <xsl:attribute name="text:level"> 263 <xsl:value-of select="$currlevel+1"/> 264 </xsl:attribute> 265 <xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/> 266 <office:binary-data> 267 <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/> 268 </office:binary-data> 269 <xsl:element name="style:list-level-properties"> 270 <xsl:attribute name="style:vertical-pos">middle</xsl:attribute> 271 <xsl:attribute name="style:vertical-rel">line</xsl:attribute> 272 <xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/> 273 <xsl:attribute name="fo:text-align">left</xsl:attribute> 274 <xsl:attribute name="fo:width"> 275 <xsl:call-template name="ConvertMeasure"> 276 <xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/> 277 </xsl:call-template> 278 <xsl:text>cm</xsl:text> 279 </xsl:attribute> 280 <xsl:attribute name="fo:height"> 281 <xsl:call-template name="ConvertMeasure"> 282 <xsl:with-param name="value" select="substring-after($picsize,'height:')"/> 283 </xsl:call-template> 284 <xsl:text>cm</xsl:text> 285 </xsl:attribute> 286 <xsl:variable name="labelwidth"> 287 <xsl:choose> 288 <xsl:when test="w:pPr/w:ind/@w:hanging"> 289 <xsl:call-template name="ConvertMeasure"> 290 <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/> 291 </xsl:call-template> 292 </xsl:when> 293 <xsl:when test="w:pPr/w:ind/@w:first-line"> 294 <xsl:call-template name="ConvertMeasure"> 295 <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/> 296 </xsl:call-template> 297 </xsl:when> 298 <xsl:otherwise>0</xsl:otherwise> 299 </xsl:choose> 300 </xsl:variable> 301 <xsl:variable name="leftwidth"> 302 <xsl:call-template name="ConvertMeasure"> 303 <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/> 304 </xsl:call-template> 305 </xsl:variable> 306 <xsl:attribute name="text:space-before"> 307 <xsl:choose> 308 <xsl:when test="(number($leftwidth)-number($labelwidth)) > 0 "> 309 <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/> 310 </xsl:when> 311 <xsl:otherwise> 312 <xsl:value-of select=" '0cm' "/> 313 </xsl:otherwise> 314 </xsl:choose> 315 </xsl:attribute> 316 <xsl:attribute name="text:min-label-width"> 317 <xsl:choose> 318 <xsl:when test="$labelwidth > 0"> 319 <xsl:value-of select="concat($labelwidth,'cm')"/> 320 </xsl:when> 321 <xsl:otherwise>0cm</xsl:otherwise> 322 </xsl:choose> 323 </xsl:attribute> 324 <xsl:choose> 325 <xsl:when test="w:suff/@w:val='Space'"> 326 <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute> 327 </xsl:when> 328 <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos"> 329 <xsl:variable name="tabpos"> 330 <xsl:call-template name="ConvertMeasure"> 331 <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/> 332 </xsl:call-template> 333 </xsl:variable> 334 <xsl:if test="number($tabpos) > (number($leftwidth)-number($labelwidth))"> 335 <xsl:attribute name="text:min-label-distance"> 336 <xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/> 337 </xsl:attribute> 338 </xsl:if> 339 </xsl:when> 340 </xsl:choose> 341 </xsl:element> 342 </xsl:template> 343 <!-- avoid listPr in textbox. :( glu --> 344 <xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]"> 345 <xsl:call-template name="genlist"/> 346 </xsl:template> 347 <xsl:template name="genlist"> 348 <xsl:variable name="currlistid" select="w:pPr/w:listPr/w:ilfo/@w:val"/> 349 <xsl:variable name="currlistlvl" select="w:pPr/w:listPr/w:ilvl/@w:val"/> 350 <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/> 351 <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> 352 <xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/> 353 <xsl:element name="text:list"> 354 <xsl:attribute name="text:style-name"> 355 <xsl:choose> 356 <xsl:when test="string-length($rootlistname) > 0"> 357 <xsl:value-of select="translate($rootlistname,' ~`!@#$%^*(&)+/,;?<>{}[]:','_')"/> 358 </xsl:when> 359 <xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/> 360 </xsl:otherwise> 361 </xsl:choose> 362 </xsl:attribute> 363 <xsl:choose> 364 <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val"> 365 <xsl:attribute name="text:continue-numbering">true</xsl:attribute> 366 <xsl:element name="text:list-item"> 367 <xsl:call-template name="levels"> 368 <xsl:with-param name="level" select="$currlistlvl"/> 369 </xsl:call-template> 370 </xsl:element> 371 </xsl:when> 372 <xsl:otherwise> 373 <xsl:element name="text:list-item"> 374 <xsl:call-template name="levels"> 375 <xsl:with-param name="level" select="$currlistlvl"/> 376 </xsl:call-template> 377 </xsl:element> 378 </xsl:otherwise> 379 </xsl:choose> 380 </xsl:element> 381 </xsl:template> 382 <xsl:template name="levels"> 383 <xsl:param name="level"/> 384 <xsl:choose> 385 <xsl:when test="$level = '0'"> 386 <xsl:call-template name="process-common-paragraph"/> 387 </xsl:when> 388 <xsl:otherwise> 389 <xsl:element name="text:list"> 390 <xsl:element name="text:list-item"> 391 <xsl:call-template name="levels"> 392 <xsl:with-param name="level" select="$level -1"/> 393 </xsl:call-template> 394 </xsl:element> 395 </xsl:element> 396 </xsl:otherwise> 397 </xsl:choose> 398 </xsl:template> 399 <xsl:template match="w:style" mode="list"> 400 <xsl:variable name="listname" select="@w:styleId"/> 401 <xsl:if test="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]"> 402 <text:list-style style:name="{$listname}"> 403 <xsl:apply-templates select="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]/w:lvl"/> 404 </text:list-style> 405 </xsl:if> 406 </xsl:template> 407 <!-- for create outline style in office:styles --> 408 <xsl:template name="create-outline-style"> 409 <xsl:element name="text:outline-style"> 410 <xsl:call-template name="outline-level-style"> 411 <xsl:with-param name="level" select="1"/> 412 </xsl:call-template> 413 <xsl:call-template name="outline-level-style"> 414 <xsl:with-param name="level" select="2"/> 415 </xsl:call-template> 416 <xsl:call-template name="outline-level-style"> 417 <xsl:with-param name="level" select="3"/> 418 </xsl:call-template> 419 <xsl:call-template name="outline-level-style"> 420 <xsl:with-param name="level" select="4"/> 421 </xsl:call-template> 422 <xsl:call-template name="outline-level-style"> 423 <xsl:with-param name="level" select="5"/> 424 </xsl:call-template> 425 <xsl:call-template name="outline-level-style"> 426 <xsl:with-param name="level" select="6"/> 427 </xsl:call-template> 428 <xsl:call-template name="outline-level-style"> 429 <xsl:with-param name="level" select="7"/> 430 </xsl:call-template> 431 <xsl:call-template name="outline-level-style"> 432 <xsl:with-param name="level" select="8"/> 433 </xsl:call-template> 434 <xsl:call-template name="outline-level-style"> 435 <xsl:with-param name="level" select="9"/> 436 </xsl:call-template> 437 <xsl:call-template name="outline-level-style"> 438 <xsl:with-param name="level" select="10"/> 439 </xsl:call-template> 440 </xsl:element> 441 </xsl:template> 442 <xsl:template name="outline-level-style"> 443 <xsl:param name="level"/> 444 <xsl:element name="text:outline-level-style"> 445 <xsl:choose> 446 <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]"> 447 <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"> 448 <xsl:with-param name="outlinelevel" select="$level"/> 449 </xsl:apply-templates> 450 </xsl:when> 451 <xsl:otherwise> 452 <xsl:attribute name="text:level"> 453 <xsl:value-of select="$level"/> 454 </xsl:attribute> 455 <xsl:attribute name="style:num-format"/> 456 </xsl:otherwise> 457 </xsl:choose> 458 </xsl:element> 459 </xsl:template> 460 <xsl:template match="w:listPr" mode="outline"> 461 <xsl:param name="outlinelevel"/> 462 <xsl:variable name="currlistid" select="w:ilfo/@w:val"/> 463 <xsl:variable name="currlistlevel"> 464 <xsl:choose> 465 <xsl:when test="w:ilvl"> 466 <xsl:value-of select="w:ilvl/@w:val"/> 467 </xsl:when> 468 <xsl:otherwise>0</xsl:otherwise> 469 </xsl:choose> 470 </xsl:variable> 471 <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/> 472 <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/> 473 <xsl:if test="$rootlist/w:lvl[@w:ilvl=$currlistlevel]"> 474 <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]"> 475 <xsl:call-template name="list-styles-common"> 476 <xsl:with-param name="listtype"> 477 <xsl:choose> 478 <xsl:when test="w:nfc/@w:val"> 479 <xsl:value-of select="w:nfc/@w:val"/> 480 </xsl:when> 481 <xsl:otherwise>0</xsl:otherwise> 482 </xsl:choose> 483 </xsl:with-param> 484 <xsl:with-param name="currlevel" select="$outlinelevel"/> 485 </xsl:call-template> 486 </xsl:for-each> 487 </xsl:if> 488 <xsl:if test="not($rootlist/w:lvl[@w:ilvl=$currlistlevel])"> 489 <xsl:attribute name="text:level"> 490 <xsl:value-of select="'1'"/> 491 </xsl:attribute> 492 </xsl:if> 493 </xsl:template> 494 <xsl:template name="nfc2numformat"> 495 <xsl:param name="nfcvalue"/> 496 <xsl:param name="prefix"/> 497 <xsl:param name="suffix"/> 498 <xsl:choose> 499 <xsl:when test="$nfcvalue=0"> 500 <xsl:attribute name="style:num-format">1</xsl:attribute> 501 </xsl:when> 502 <xsl:when test="$nfcvalue=1"> 503 <xsl:attribute name="style:num-format">I</xsl:attribute> 504 </xsl:when> 505 <xsl:when test="$nfcvalue=2"> 506 <xsl:attribute name="style:num-format">i</xsl:attribute> 507 </xsl:when> 508 <xsl:when test="$nfcvalue=3"> 509 <xsl:attribute name="style:num-format">A</xsl:attribute> 510 </xsl:when> 511 <xsl:when test="$nfcvalue=4"> 512 <xsl:attribute name="style:num-format">a</xsl:attribute> 513 </xsl:when> 514 <xsl:otherwise> 515 <xsl:attribute name="style:num-format">1</xsl:attribute> 516 </xsl:otherwise> 517 </xsl:choose> 518 <xsl:choose> 519 <xsl:when test="$nfcvalue=26"> 520 <xsl:attribute name="style:num-prefix"> 521 <xsl:value-of select="$prefix"/> 522 </xsl:attribute> 523 <xsl:attribute name="style:num-suffix"> 524 <xsl:value-of select="concat( '.' , $suffix )"/> 525 </xsl:attribute> 526 </xsl:when> 527 <xsl:when test="$nfcvalue=27 or $nfcvalue=29"> 528 <xsl:attribute name="style:num-prefix"> 529 <xsl:value-of select="concat( $prefix, '(' )"/> 530 </xsl:attribute> 531 <xsl:attribute name="style:num-suffix"> 532 <xsl:value-of select="concat( ')' , $suffix )"/> 533 </xsl:attribute> 534 </xsl:when> 535 <xsl:when test="$nfcvalue=57"> 536 <xsl:attribute name="style:num-prefix"> 537 <xsl:value-of select="concat( $prefix, '- ' )"/> 538 </xsl:attribute> 539 <xsl:attribute name="style:num-suffix"> 540 <xsl:value-of select="concat( ' -' , $suffix )"/> 541 </xsl:attribute> 542 </xsl:when> 543 <xsl:otherwise> 544 <xsl:attribute name="style:num-prefix"> 545 <xsl:value-of select="$prefix"/> 546 </xsl:attribute> 547 <xsl:attribute name="style:num-suffix"> 548 <xsl:value-of select="$suffix"/> 549 </xsl:attribute> 550 </xsl:otherwise> 551 </xsl:choose> 552 </xsl:template> 553 <!-- xsl:template name="nfc2numformat"> 554 <xsl:param name="nfcvalue"/> 555 <xsl:param name="prefix"/> 556 <xsl:param name="suffix"/> 557 <xsl:choose> 558 <xsl:when test="$nfcvalue=0"> 559 <xsl:attribute name="style:num-format">1</xsl:attribute> 560 </xsl:when> 561 <xsl:when test="$nfcvalue=1"> 562 <xsl:attribute name="style:num-format">I</xsl:attribute> 563 </xsl:when> 564 <xsl:when test="$nfcvalue=2"> 565 <xsl:attribute name="style:num-format">i</xsl:attribute> 566 </xsl:when> 567 <xsl:when test="$nfcvalue=3"> 568 <xsl:attribute name="style:num-format">A</xsl:attribute> 569 </xsl:when> 570 <xsl:when test="$nfcvalue=4"> 571 <xsl:attribute name="style:num-format">a</xsl:attribute> 572 </xsl:when> 573 <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"> 574 <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute> 575 </xsl:when> 576 <xsl:when test="$nfcvalue=12"> 577 <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> 578 </xsl:when> 579 <xsl:when test="$nfcvalue=13"> 580 <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> 581 </xsl:when> 582 <xsl:when test="$nfcvalue=14 or $nfcvalue=19"> 583 <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute> 584 </xsl:when> 585 <xsl:when test="$nfcvalue=16"> 586 <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute> 587 </xsl:when> 588 <xsl:when test="$nfcvalue=18 or $nfcvalue=28"> 589 <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute> 590 </xsl:when> 591 <xsl:when test="$nfcvalue=20"> 592 <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute> 593 </xsl:when> 594 <xsl:when test="$nfcvalue=21"> 595 <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute> 596 </xsl:when> 597 <xsl:when test="$nfcvalue=24"> 598 <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute> 599 </xsl:when> 600 <xsl:when test="$nfcvalue=25"> 601 <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute> 602 </xsl:when> 603 <xsl:when test="$nfcvalue=30"> 604 <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute> 605 </xsl:when> 606 <xsl:when test="$nfcvalue=31"> 607 <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute> 608 </xsl:when> 609 <xsl:when test="$nfcvalue=34"> 610 <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute> 611 </xsl:when> 612 <xsl:when test="$nfcvalue=38"> 613 <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute> 614 </xsl:when> 615 <xsl:when test="$nfcvalue=41 or $nfcvalue=42 or $nfcvalue=43"> 616 <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute> 617 </xsl:when> 618 <xsl:when test="$nfcvalue=45 or $nfcvalue=47"> 619 <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute> 620 </xsl:when> 621 <xsl:when test="$nfcvalue=46 or $nfcvalue=48"> 622 <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute> 623 </xsl:when> 624 <xsl:when test="$nfcvalue=53"> 625 <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute> 626 </xsl:when> 627 <xsl:when test="$nfcvalue!=57 and $nfcvalue > 48 and $nfcvalue < 60"> 628 <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute> 629 </xsl:when> 630 <xsl:otherwise> 631 <xsl:attribute name="style:num-format">1</xsl:attribute> 632 </xsl:otherwise> 633 </xsl:choose> 634 <xsl:choose> 635 <xsl:when test="$nfcvalue=26"> 636 <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute> 637 <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( '.' , $suffix )"/></xsl:attribute> 638 </xsl:when> 639 <xsl:when test="$nfcvalue=27 or $nfcvalue=29"> 640 <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '(' )"/></xsl:attribute> 641 <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ')' , $suffix )"/></xsl:attribute> 642 </xsl:when> 643 <xsl:when test="$nfcvalue=57"> 644 <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '- ' )"/></xsl:attribute> 645 <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ' -' , $suffix )"/></xsl:attribute> 646 </xsl:when> 647 <xsl:otherwise> 648 <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute> 649 <xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute> 650 </xsl:otherwise> 651 </xsl:choose> 652 </xsl:template --> 653</xsl:stylesheet> 654