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 fo v"> 25 <!--Generally, The MS fields can be represented in two forms, simple field w:fldsimple or complicated field 26 w:fldChar, so when importing we have to take care of two possible forms of the same type field --> 27 <xsl:template match="w:instrText"> 28 <!-- ===this template is to process the w:fldChar fields ====== --> 29 <xsl:choose> 30 <xsl:when test="substring(normalize-space(.),1,7) = 'PAGEREF' "> 31 <xsl:variable name="bookmarkname"> 32 <xsl:value-of select="normalize-space(substring-before (substring-after( . , 'PAGEREF' ), '\*')) "/> 33 </xsl:variable> 34 <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}"> 35 <xsl:call-template name="get-fldchar-content"> 36 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 37 <xsl:with-param name="sibling_number" select=" 1"/> 38 </xsl:call-template> 39 </text:bookmark-ref> 40 </xsl:when> 41 <xsl:when test="substring( normalize-space(.),1,9) = 'HYPERLINK' "> 42 <xsl:variable name="hyper-str" select="normalize-space(.)"/> 43 <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '"')"/> 44 <xsl:variable name="hyper-bookmark"> 45 <xsl:if test="contains( $hyper-str, ' \l ')"> 46 <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '"'), '"') )"/> 47 </xsl:if> 48 </xsl:variable> 49 <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}"> 50 <xsl:call-template name="get-fldchar-content"> 51 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 52 <xsl:with-param name="sibling_number" select=" 1"/> 53 </xsl:call-template> 54 </text:a> 55 </xsl:when> 56 <xsl:when test="substring( normalize-space(.),1,3) = 'REF' "> 57 <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(text(), 'REF') , '\') )}"> 58 59 </text:bookmark-ref> 60 </xsl:when> 61 <xsl:when test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' "> 62 <text:date> 63 <xsl:choose> 64 <xsl:when test="contains(text(), '\@')"> 65 <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 66 </xsl:when> 67 <xsl:otherwise> 68 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 69 </xsl:otherwise> 70 </xsl:choose> 71 </text:date> 72 </xsl:when> 73 <xsl:when test="substring(normalize-space(.),1,9) = 'PRINTDATE' "> 74 <text:print-date> 75 <xsl:choose> 76 <xsl:when test="contains(text(), '\@')"> 77 <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 78 </xsl:when> 79 <xsl:otherwise> 80 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 81 </xsl:otherwise> 82 </xsl:choose> 83 </text:print-date> 84 </xsl:when> 85 <xsl:when test="substring(normalize-space(.),1,10) = 'CREATEDATE' "> 86 <text:creation-date> 87 <xsl:choose> 88 <xsl:when test="contains(text(), '\@')"> 89 <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 90 </xsl:when> 91 <xsl:otherwise> 92 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 93 </xsl:otherwise> 94 </xsl:choose> 95 </text:creation-date> 96 </xsl:when> 97 <xsl:when test="substring(normalize-space(.),1,8) = 'SAVEDATE' "> 98 <text:modification-date> 99 <xsl:choose> 100 <xsl:when test="contains(text(), '\@')"> 101 <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 102 </xsl:when> 103 <xsl:otherwise> 104 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 105 </xsl:otherwise> 106 </xsl:choose> 107 </text:modification-date> 108 </xsl:when> 109 <xsl:when test="substring(normalize-space(.),1,4) = 'PAGE' "> 110 <text:page-number text:select-page="current"> 111 <xsl:variable name="num-format"> 112 <xsl:call-template name="get_field_num_format"> 113 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> 114 </xsl:call-template> 115 </xsl:variable> 116 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 117 </text:page-number> 118 </xsl:when> 119 <xsl:when test="substring(normalize-space(.),1,8) = 'NUMPAGES' "> 120 <text:page-count> 121 <xsl:variable name="num-format"> 122 <xsl:call-template name="get_field_num_format"> 123 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> 124 </xsl:call-template> 125 </xsl:variable> 126 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 127 </text:page-count> 128 </xsl:when> 129 <xsl:when test="substring(normalize-space(.),1,8) = 'NUMWORDS' "> 130 <text:word-count> 131 <xsl:variable name="num-format"> 132 <xsl:call-template name="get_field_num_format"> 133 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> 134 </xsl:call-template> 135 </xsl:variable> 136 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 137 </text:word-count> 138 </xsl:when> 139 <xsl:when test="substring(normalize-space(.),1,8) = 'NUMCHARS' "> 140 <text:character-count> 141 <xsl:variable name="num-format"> 142 <xsl:call-template name="get_field_num_format"> 143 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> 144 </xsl:call-template> 145 </xsl:variable> 146 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 147 </text:character-count> 148 </xsl:when> 149 <xsl:when test="substring(normalize-space(.),1,6) = 'REVNUM' "> 150 <text:editing-cycles> 151 <xsl:value-of select="w:r"/> 152 </text:editing-cycles> 153 </xsl:when> 154 <xsl:when test="substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' "> 155 <text:sequence> 156 <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 157 <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute> 158 <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute> 159 <xsl:variable name="num-format"> 160 <xsl:call-template name="get_field_num_format"> 161 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> 162 </xsl:call-template> 163 </xsl:variable> 164 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 165 </text:sequence> 166 </xsl:when> 167 <xsl:when test="substring(normalize-space(.),1,3) = 'SEQ' "> 168 <text:sequence> 169 <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 170 <xsl:variable name="seq_text_name"> 171 <xsl:call-template name="get_seq_name"> 172 <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(text(), 'SEQ'))"/> 173 </xsl:call-template> 174 </xsl:variable> 175 <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name"/></xsl:attribute> 176 <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute> 177 <xsl:variable name="num-format"> 178 <xsl:call-template name="get_field_num_format"> 179 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/> 180 </xsl:call-template> 181 </xsl:variable> 182 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 183 </text:sequence> 184 </xsl:when> 185 <xsl:when test="substring(normalize-space(.),1,6) = 'AUTHOR' "> 186 <text:initial-creator> 187 <xsl:call-template name="get-fldchar-content"> 188 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 189 <xsl:with-param name="sibling_number" select=" 1"/> 190 </xsl:call-template> 191 </text:initial-creator> 192 </xsl:when> 193 <xsl:when test="substring(normalize-space(.),1,5) = 'TITLE' "> 194 <text:title> 195 <xsl:call-template name="get-fldchar-content"> 196 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 197 <xsl:with-param name="sibling_number" select=" 1"/> 198 </xsl:call-template> 199 </text:title> 200 </xsl:when> 201 <xsl:when test="substring(normalize-space(.),1,7) = 'SUBJECT' "> 202 <text:subject> 203 <xsl:call-template name="get-fldchar-content"> 204 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 205 <xsl:with-param name="sibling_number" select=" 1"/> 206 </xsl:call-template> 207 </text:subject> 208 </xsl:when> 209 <xsl:when test="substring(normalize-space(.),1,8) = 'KEYWORDS' "> 210 <text:keywords> 211 <xsl:call-template name="get-fldchar-content"> 212 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 213 <xsl:with-param name="sibling_number" select=" 1"/> 214 </xsl:call-template> 215 </text:keywords> 216 </xsl:when> 217 <xsl:when test="substring(normalize-space(.),1,6) = 'FILLIN' "> 218 <text:text-input> 219 <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(text(), 'FILLIN'), '\*')"/></xsl:attribute> 220 <xsl:call-template name="get-fldchar-content"> 221 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 222 <xsl:with-param name="sibling_number" select=" 1"/> 223 </xsl:call-template> 224 </text:text-input> 225 </xsl:when> 226 <xsl:when test="substring(normalize-space(.),1,11) = 'DOCPROPERTY' "> 227 <xsl:variable name="instr_command"> 228 <xsl:value-of select="normalize-space (substring-after(text(), 'DOCPROPERTY' ))"/> 229 </xsl:variable> 230 <xsl:choose> 231 <xsl:when test="contains($instr_command, 'Author' ) "> 232 <text:user-field-get text:name="Author"> 233 </text:user-field-get> 234 </xsl:when> 235 <xsl:when test="contains($instr_command, 'Bytes' ) "> 236 <text:user-field-get text:name="Bytes"> 237 </text:user-field-get> 238 </xsl:when> 239 <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) "> 240 <text:user-field-get text:name="CharactersWithSpaces"> 241 </text:user-field-get> 242 </xsl:when> 243 <xsl:when test="contains($instr_command, 'Category' ) "> 244 <text:user-field-get text:name="Category"> 245 </text:user-field-get> 246 </xsl:when> 247 <xsl:when test="contains($instr_command, 'Characters' ) "> 248 <text:user-field-get text:name="Characters"> 249 </text:user-field-get> 250 </xsl:when> 251 <xsl:when test="contains($instr_command, 'Comments' ) "> 252 <text:user-field-get text:name="Comments"> 253 </text:user-field-get> 254 </xsl:when> 255 <xsl:when test="contains($instr_command, 'Company' ) "> 256 <text:user-field-get text:name="Company"> 257 </text:user-field-get> 258 </xsl:when> 259 <xsl:when test="contains($instr_command, 'CreateTime' ) "> 260 <text:user-field-get text:name="CreateTime"> 261 </text:user-field-get> 262 </xsl:when> 263 <xsl:when test="contains($instr_command, 'HyperlinkBase' ) "> 264 <text:user-field-get text:name="HyperlinkBase"> 265 </text:user-field-get> 266 </xsl:when> 267 <xsl:when test="contains($instr_command, 'Keywords' ) "> 268 <text:user-field-get text:name="Keywords"> 269 </text:user-field-get> 270 </xsl:when> 271 <xsl:when test="contains($instr_command, 'LastPrinted' ) "> 272 <text:user-field-get text:name="LastPrinted"> 273 </text:user-field-get> 274 </xsl:when> 275 <xsl:when test="contains($instr_command, 'LastSavedBy' ) "> 276 <text:user-field-get text:name="LastSavedBy"> 277 </text:user-field-get> 278 </xsl:when> 279 <xsl:when test="contains($instr_command, 'LastSavedTime' ) "> 280 <text:user-field-get text:name="LastSavedTime"> 281 </text:user-field-get> 282 </xsl:when> 283 <xsl:when test="contains($instr_command, 'Lines' ) "> 284 <text:user-field-get text:name="Lines"> 285 </text:user-field-get> 286 </xsl:when> 287 <xsl:when test="contains($instr_command, 'Manager' ) "> 288 <text:user-field-get text:name="Manager"> 289 </text:user-field-get> 290 </xsl:when> 291 <xsl:when test="contains($instr_command, 'NameofApplication' ) "> 292 <text:user-field-get text:name="NameofApplication"> 293 </text:user-field-get> 294 </xsl:when> 295 <xsl:when test="contains($instr_command, 'ODMADocId' ) "> 296 <text:user-field-get text:name="ODMADocId"> 297 </text:user-field-get> 298 </xsl:when> 299 <xsl:when test="contains($instr_command, 'Pages' ) "> 300 <text:user-field-get text:name="Pages"> 301 </text:user-field-get> 302 </xsl:when> 303 <xsl:when test="contains($instr_command, 'Paragraphs' ) "> 304 <text:user-field-get text:name="Paragraphs"> 305 </text:user-field-get> 306 </xsl:when> 307 <xsl:when test="contains($instr_command, 'RevisionNumber' ) "> 308 <text:user-field-get text:name="RevisionNumber"> 309 </text:user-field-get> 310 </xsl:when> 311 <xsl:when test="contains($instr_command, 'Security' ) "> 312 <text:user-field-get text:name="Security"> 313 </text:user-field-get> 314 </xsl:when> 315 <xsl:when test="contains($instr_command, 'Subject' ) "> 316 <text:user-field-get text:name="Subject"> 317 </text:user-field-get> 318 </xsl:when> 319 <xsl:when test="contains($instr_command, 'Template' ) "> 320 <text:user-field-get text:name="Template"> 321 </text:user-field-get> 322 </xsl:when> 323 <xsl:when test="contains($instr_command, 'Title' ) "> 324 <text:user-field-get text:name="Title"> 325 </text:user-field-get> 326 </xsl:when> 327 <xsl:when test="contains($instr_command, 'TotalEditingTime' ) "> 328 <text:user-field-get text:name="TotalEditingTime"> 329 </text:user-field-get> 330 </xsl:when> 331 <xsl:when test="contains($instr_command, 'Words' ) "> 332 <text:user-field-get text:name="Words"> 333 </text:user-field-get> 334 </xsl:when> 335 </xsl:choose> 336 </xsl:when> 337 <xsl:when test="substring(normalize-space(.),1,10) = 'MERGEFIELD' "> 338 <text:database-display text:database-name="" text:table-name="" text:table-type="table"> 339 <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute> 340 <xsl:call-template name="get-fldchar-content"> 341 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 342 <xsl:with-param name="sibling_number" select=" 1"/> 343 </xsl:call-template> 344 </text:database-display> 345 </xsl:when> 346 <xsl:when test="substring(normalize-space(.),1,8) = 'MERGEREC' "> 347 <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0"> 348 <xsl:call-template name="get-fldchar-content"> 349 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 350 <xsl:with-param name="sibling_number" select=" 1"/> 351 </xsl:call-template> 352 </text:database-row-number> 353 </xsl:when> 354 <xsl:when test="substring(normalize-space(.),1,4) = 'NEXT' "> 355 <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition=""> 356 </text:database-next> 357 </xsl:when> 358 </xsl:choose> 359 </xsl:template> 360 <xsl:template match="w:fldChar"> 361 <!-- for complicated field w:fldChar, we only process the w:instrText, please see the template processing w:instrText --> 362 </xsl:template> 363 <xsl:template name="get-fldchar-content"> 364 <!-- this template is to get the content of fldchar in-between w:instrText and w:fldChar/@w:fldCharType ='end' --> 365 <xsl:param name="next_node"/> 366 <xsl:param name="sibling_number"/> 367 <xsl:if test="not ($next_node/w:fldChar/@w:fldCharType ='end' ) and $next_node "> 368 <xsl:if test="$next_node/w:br"> 369 <xsl:text>
</xsl:text> 370 </xsl:if> 371 <xsl:value-of select="$next_node//w:t"/> 372 <xsl:call-template name="get-fldchar-content"> 373 <xsl:with-param name="next_node" select="../following-sibling::w:r[$sibling_number + 1]"/> 374 <xsl:with-param name="sibling_number" select="$sibling_number + 1"/> 375 </xsl:call-template> 376 </xsl:if> 377 </xsl:template> 378 <!-- ====== this template is to process the w:fldsimple fields ======= --> 379 <xsl:template match="w:fldSimple"> 380 <xsl:choose> 381 <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'PAGEREF' "> 382 <xsl:variable name="bookmarkname"> 383 <xsl:value-of select="normalize-space(substring-before (substring-after( @w:instr , 'PAGEREF' ), '\*')) "/> 384 </xsl:variable> 385 <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}"> 386 <xsl:value-of select=" .//w:t"/> 387 </text:bookmark-ref> 388 </xsl:when> 389 <xsl:when test="substring( normalize-space(@w:instr),1,9) = 'HYPERLINK' "> 390 <xsl:variable name="hyper-str" select="normalize-space(@w:instr)"/> 391 <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '"')"/> 392 <xsl:variable name="hyper-bookmark"> 393 <xsl:if test="contains( $hyper-str, ' \l ')"> 394 <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '"'), '"') )"/> 395 </xsl:if> 396 </xsl:variable> 397 <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}"> 398 <xsl:value-of select=" .//w:t"/> 399 </text:a> 400 </xsl:when> 401 <xsl:when test="substring( normalize-space(@w:instr),1,3) = 'REF' "> 402 <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(@w:instr, 'REF') , '\') )}"> 403 404 </text:bookmark-ref> 405 </xsl:when> 406 <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' "> 407 <text:date> 408 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 409 <xsl:value-of select=".//w:t"/> 410 </text:date> 411 </xsl:when> 412 <xsl:when test="substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' "> 413 <text:print-date> 414 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 415 <xsl:value-of select=".//w:t"/> 416 </text:print-date> 417 </xsl:when> 418 <xsl:when test=" substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' "> 419 <text:creation-date> 420 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 421 <xsl:value-of select=".//w:t"/> 422 </text:creation-date> 423 </xsl:when> 424 <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' "> 425 <text:modification-date> 426 <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute> 427 <xsl:value-of select=".//w:t"/> 428 </text:modification-date> 429 </xsl:when> 430 <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'PAGE' "> 431 <text:page-number text:select-page="current"> 432 <xsl:variable name="num-format"> 433 <xsl:call-template name="get_field_num_format"> 434 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> 435 </xsl:call-template> 436 </xsl:variable> 437 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 438 </text:page-number> 439 </xsl:when> 440 <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMPAGES' "> 441 <text:page-count> 442 <xsl:variable name="num-format"> 443 <xsl:call-template name="get_field_num_format"> 444 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> 445 </xsl:call-template> 446 </xsl:variable> 447 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 448 </text:page-count> 449 </xsl:when> 450 <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMWORDS' "> 451 <text:word-count> 452 <xsl:variable name="num-format"> 453 <xsl:call-template name="get_field_num_format"> 454 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> 455 </xsl:call-template> 456 </xsl:variable> 457 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 458 </text:word-count> 459 </xsl:when> 460 <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMCHARS' "> 461 <text:character-count> 462 <xsl:variable name="num-format"> 463 <xsl:call-template name="get_field_num_format"> 464 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> 465 </xsl:call-template> 466 </xsl:variable> 467 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 468 </text:character-count> 469 </xsl:when> 470 <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'REVNUM' "> 471 <text:editing-cycles> 472 <xsl:value-of select="w:r"/> 473 </text:editing-cycles> 474 </xsl:when> 475 <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'AUTONUM' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMLGL' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMOUT' "> 476 <text:sequence> 477 <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 478 <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute> 479 <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute> 480 <xsl:variable name="num-format"> 481 <xsl:call-template name="get_field_num_format"> 482 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> 483 </xsl:call-template> 484 </xsl:variable> 485 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 486 </text:sequence> 487 </xsl:when> 488 <xsl:when test="substring(normalize-space(@w:instr),1,3) = 'SEQ' "> 489 <text:sequence> 490 <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 491 <xsl:variable name="seq_text_name"> 492 <xsl:call-template name="get_seq_name"> 493 <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(@w:instr, 'SEQ'))"/> 494 </xsl:call-template> 495 </xsl:variable> 496 <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name "/></xsl:attribute> 497 <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute> 498 <xsl:variable name="num-format"> 499 <xsl:call-template name="get_field_num_format"> 500 <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/> 501 </xsl:call-template> 502 </xsl:variable> 503 <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute> 504 </text:sequence> 505 </xsl:when> 506 <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'AUTHOR' "> 507 <text:initial-creator> 508 <xsl:value-of select=" .//w:t"/> 509 </text:initial-creator> 510 </xsl:when> 511 <xsl:when test="substring(normalize-space(@w:instr),1,5) = 'TITLE' "> 512 <text:title> 513 <xsl:value-of select=" .//w:t"/> 514 </text:title> 515 </xsl:when> 516 <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'SUBJECT' "> 517 <text:subject> 518 <xsl:value-of select=" .//w:t"/> 519 </text:subject> 520 </xsl:when> 521 <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'KEYWORDS' "> 522 <text:keywords> 523 <xsl:value-of select=" .//w:t"/> 524 </text:keywords> 525 </xsl:when> 526 <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'FILLIN' "> 527 <text:text-input> 528 <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(@w:instr, '"'), '"')"/></xsl:attribute> 529 <xsl:value-of select=" .//w:t"/> 530 </text:text-input> 531 </xsl:when> 532 <xsl:when test="substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' "> 533 <xsl:variable name="instr_command"> 534 <xsl:value-of select="normalize-space (substring-after(@w:instr, 'DOCPROPERTY' ))"/> 535 </xsl:variable> 536 <xsl:choose> 537 <xsl:when test="contains($instr_command, 'Author' ) "> 538 <text:user-field-get text:name="Author"> 539 </text:user-field-get> 540 </xsl:when> 541 <xsl:when test="contains($instr_command, 'Bytes' ) "> 542 <text:user-field-get text:name="Bytes"> 543 </text:user-field-get> 544 </xsl:when> 545 <xsl:when test="contains($instr_command, 'Category' ) "> 546 <text:user-field-get text:name="Category"> 547 </text:user-field-get> 548 </xsl:when> 549 <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) "> 550 <text:user-field-get text:name="CharactersWithSpaces"> 551 </text:user-field-get> 552 </xsl:when> 553 <xsl:when test="contains($instr_command, 'Characters' ) "> 554 <text:user-field-get text:name="Characters"> 555 </text:user-field-get> 556 </xsl:when> 557 <xsl:when test="contains($instr_command, 'Comments' ) "> 558 <text:user-field-get text:name="Comments"> 559 </text:user-field-get> 560 </xsl:when> 561 <xsl:when test="contains($instr_command, 'Company' ) "> 562 <text:user-field-get text:name="Company"> 563 </text:user-field-get> 564 </xsl:when> 565 <xsl:when test="contains($instr_command, 'CreateTime' ) "> 566 <text:user-field-get text:name="CreateTime"> 567 </text:user-field-get> 568 </xsl:when> 569 <xsl:when test="contains($instr_command, 'HyperlinkBase' ) "> 570 <text:user-field-get text:name="HyperlinkBase"> 571 </text:user-field-get> 572 </xsl:when> 573 <xsl:when test="contains($instr_command, 'Keywords' ) "> 574 <text:user-field-get text:name="Keywords"> 575 </text:user-field-get> 576 </xsl:when> 577 <xsl:when test="contains($instr_command, 'LastPrinted' ) "> 578 <text:user-field-get text:name="LastPrinted"> 579 </text:user-field-get> 580 </xsl:when> 581 <xsl:when test="contains($instr_command, 'LastSavedBy' ) "> 582 <text:user-field-get text:name="LastSavedBy"> 583 </text:user-field-get> 584 </xsl:when> 585 <xsl:when test="contains($instr_command, 'LastSavedTime' ) "> 586 <text:user-field-get text:name="LastSavedTime"> 587 </text:user-field-get> 588 </xsl:when> 589 <xsl:when test="contains($instr_command, 'Lines' ) "> 590 <text:user-field-get text:name="Lines"> 591 </text:user-field-get> 592 </xsl:when> 593 <xsl:when test="contains($instr_command, 'Manager' ) "> 594 <text:user-field-get text:name="Manager"> 595 </text:user-field-get> 596 </xsl:when> 597 <xsl:when test="contains($instr_command, 'NameofApplication' ) "> 598 <text:user-field-get text:name="NameofApplication"> 599 </text:user-field-get> 600 </xsl:when> 601 <xsl:when test="contains($instr_command, 'ODMADocId' ) "> 602 <text:user-field-get text:name="ODMADocId"> 603 </text:user-field-get> 604 </xsl:when> 605 <xsl:when test="contains($instr_command, 'Pages' ) "> 606 <text:user-field-get text:name="Pages"> 607 </text:user-field-get> 608 </xsl:when> 609 <xsl:when test="contains($instr_command, 'Paragraphs' ) "> 610 <text:user-field-get text:name="Paragraphs"> 611 </text:user-field-get> 612 </xsl:when> 613 <xsl:when test="contains($instr_command, 'RevisionNumber' ) "> 614 <text:user-field-get text:name="RevisionNumber"> 615 </text:user-field-get> 616 </xsl:when> 617 <xsl:when test="contains($instr_command, 'Security' ) "> 618 <text:user-field-get text:name="Security"> 619 </text:user-field-get> 620 </xsl:when> 621 <xsl:when test="contains($instr_command, 'Subject' ) "> 622 <text:user-field-get text:name="Subject"> 623 </text:user-field-get> 624 </xsl:when> 625 <xsl:when test="contains($instr_command, 'Template' ) "> 626 <text:user-field-get text:name="Template"> 627 </text:user-field-get> 628 </xsl:when> 629 <xsl:when test="contains($instr_command, 'Title' ) "> 630 <text:user-field-get text:name="Title"> 631 </text:user-field-get> 632 </xsl:when> 633 <xsl:when test="contains($instr_command, 'TotalEditingTime' ) "> 634 <text:user-field-get text:name="TotalEditingTime"> 635 </text:user-field-get> 636 </xsl:when> 637 <xsl:when test="contains($instr_command, 'Words' ) "> 638 <text:user-field-get text:name="Words"> 639 </text:user-field-get> 640 </xsl:when> 641 </xsl:choose> 642 </xsl:when> 643 <xsl:when test="substring(normalize-space(@w:instr),1,10) = 'MERGEFIELD' "> 644 <text:database-display text:database-name="" text:table-name="" text:table-type="table"> 645 <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute> 646 <xsl:value-of select=" .//w:t"/> 647 </text:database-display> 648 </xsl:when> 649 <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'MERGEREC' "> 650 <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0"> 651 <xsl:value-of select=" .//w:t"/> 652 </text:database-row-number> 653 </xsl:when> 654 <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'NEXT' "> 655 <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition=""> 656 <xsl:value-of select=" .//w:t"/> 657 </text:database-next> 658 </xsl:when> 659 <xsl:otherwise> 660 <!-- for MS simple fields that can not map to OOo writer fields, we just import the content of these fields --> 661 <xsl:value-of select="w:r"/> 662 </xsl:otherwise> 663 </xsl:choose> 664 </xsl:template> 665 <xsl:template name="get_seq_name"> 666 <!-- this template is to get the identifier from the input MS seq string --> 667 <xsl:param name="input_seq_string"/> 668 <xsl:choose> 669 <xsl:when test="contains( $input_seq_string, ' ' )"> 670 <xsl:value-of select="substring-before($input_seq_string, ' ' )"/> 671 </xsl:when> 672 <xsl:otherwise> 673 <xsl:value-of select="$input_seq_string"/> 674 </xsl:otherwise> 675 </xsl:choose> 676 </xsl:template> 677 <xsl:template name="default_seqence_declaration"> 678 <text:sequence-decl text:display-outline-level="0" text:name="Illustration"> 679 </text:sequence-decl> 680 <text:sequence-decl text:display-outline-level="0" text:name="Table"> 681 </text:sequence-decl> 682 <text:sequence-decl text:display-outline-level="0" text:name="Text"> 683 </text:sequence-decl> 684 <text:sequence-decl text:display-outline-level="0" text:name="Drawing"> 685 </text:sequence-decl> 686 <text:sequence-decl text:display-outline-level="0" text:name="AutoNr"> 687 </text:sequence-decl> 688 </xsl:template> 689 <xsl:template match="w:instrText | w:fldSimple" mode="sequence_declare"> 690 <text:sequence-decl text:display-outline-level="0"> 691 <xsl:variable name="seq_variable_name"> 692 <xsl:choose> 693 <xsl:when test=" name() = 'w:instrText' "> 694 <xsl:if test="substring(normalize-space(text()),1,3) = 'SEQ' "> 695 <xsl:call-template name="get_seq_name"> 696 <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(text(), 'SEQ' ))"/> 697 </xsl:call-template> 698 </xsl:if> 699 </xsl:when> 700 <xsl:when test=" name() = 'w:fldSimple' "> 701 <xsl:if test="substring(normalize-space(@w:instr),1,3) = 'SEQ' "> 702 <xsl:call-template name="get_seq_name"> 703 <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(@w:instr, 'SEQ' ))"/> 704 </xsl:call-template> 705 </xsl:if> 706 </xsl:when> 707 </xsl:choose> 708 </xsl:variable> 709 <xsl:attribute name="text:name"><xsl:value-of select="$seq_variable_name"/></xsl:attribute> 710 </text:sequence-decl> 711 </xsl:template> 712 <!-- ===== the following templates are to generate the user fields declarations for MS word DocProperty field importing == --> 713 <xsl:template name="user_fields_declare_docproperty"> 714 <xsl:variable name="document-field-root" select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,11) = 'DOCPROPERTY' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ] "/> 715 <xsl:variable name="field_Author_nodeset" select="$document-field-root[contains(text(), 'Author')] | $document-field-root[contains(@w:instr, 'Author')]"/> 716 <xsl:variable name="field_Bytes_nodeset" select="$document-field-root[contains(text(), 'Bytes')] | $document-field-root[contains(@w:instr, 'Bytes')]"/> 717 <xsl:variable name="field_Category_nodeset" select="$document-field-root[contains(text(), 'Category')] | $document-field-root[contains(@w:instr, 'Category')]"/> 718 <xsl:variable name="field_Characters_nodeset" select="$document-field-root[contains(text(), 'Characters')] | $document-field-root[contains(@w:instr, 'Characters')]"/> 719 <xsl:variable name="field_CharactersWithSpaces_nodeset" select="$document-field-root[contains(text(), 'CharactersWithSpaces')] | $document-field-root[contains(@w:instr, 'CharactersWithSpaces')]"/> 720 <xsl:variable name="field_Comments_nodeset" select="$document-field-root[contains(text(), 'Comments')] | $document-field-root[contains(@w:instr, 'Comments')]"/> 721 <xsl:variable name="field_Company_nodeset" select="$document-field-root[contains(text(), 'Company')] | $document-field-root[contains(@w:instr, 'Company')]"/> 722 <xsl:variable name="field_CreateTime_nodeset" select="$document-field-root[contains(text(), 'CreateTime')] | $document-field-root[contains(@w:instr, 'CreateTime')]"/> 723 <xsl:variable name="field_HyperlinkBase_nodeset" select="$document-field-root[contains(text(), 'HyperlinkBase')] | $document-field-root[contains(@w:instr, 'HyperlinkBase')]"/> 724 <xsl:variable name="field_Keywords_nodeset" select="$document-field-root[contains(text(), 'Keywords')] | $document-field-root[contains(@w:instr, 'Keywords')]"/> 725 <xsl:variable name="field_LastPrinted_nodeset" select="$document-field-root[contains(text(), 'LastPrinted')] | $document-field-root[contains(@w:instr, 'LastPrinted')]"/> 726 <xsl:variable name="field_LastSavedBy_nodeset" select="$document-field-root[contains(text(), 'LastSavedBy')] | $document-field-root[contains(@w:instr, 'LastSavedBy')]"/> 727 <xsl:variable name="field_LastSavedTime_nodeset" select="$document-field-root[contains(text(), 'LastSavedTime')] | $document-field-root[contains(@w:instr, 'LastSavedTime')]"/> 728 <xsl:variable name="field_Lines_nodeset" select="$document-field-root[contains(text(), 'Lines')] | $document-field-root[contains(@w:instr, 'Lines')]"/> 729 <xsl:variable name="field_Manager_nodeset" select="$document-field-root[contains(text(), 'Manager')] | $document-field-root[contains(@w:instr, 'Manager')]"/> 730 <xsl:variable name="field_NameofApplication_nodeset" select="$document-field-root[contains(text(), 'NameofApplication')] | $document-field-root[contains(@w:instr, 'NameofApplication')]"/> 731 <xsl:variable name="field_ODMADocId_nodeset" select="$document-field-root[contains(text(), 'ODMADocId')] | $document-field-root[contains(@w:instr, 'ODMADocId')]"/> 732 <xsl:variable name="field_Pages_nodeset" select="$document-field-root[contains(text(), 'Pages')] | $document-field-root[contains(@w:instr, 'Pages')]"/> 733 <xsl:variable name="field_Paragraphs_nodeset" select="$document-field-root[contains(text(), 'Paragraphs')] | $document-field-root[contains(@w:instr, 'Paragraphs')]"/> 734 <xsl:variable name="field_RevisionNumber_nodeset" select="$document-field-root[contains(text(), 'RevisionNumber')] | $document-field-root[contains(@w:instr, 'RevisionNumber')]"/> 735 <xsl:variable name="field_Security_nodeset" select="$document-field-root[contains(text(), 'Security')] | $document-field-root[contains(@w:instr, 'Security')]"/> 736 <xsl:variable name="field_Subject_nodeset" select="$document-field-root[contains(text(), 'Subject')] | $document-field-root[contains(@w:instr, 'Subject')]"/> 737 <xsl:variable name="field_Template_nodeset" select="$document-field-root[contains(text(), 'Template')] | $document-field-root[contains(@w:instr, 'Template')]"/> 738 <xsl:variable name="field_Title_nodeset" select="$document-field-root[contains(text(), 'Title')] | $document-field-root[contains(@w:instr, 'Title')]"/> 739 <xsl:variable name="field_TotalEditingTime_nodeset" select="$document-field-root[contains(text(), 'TotalEditingTime')] | $document-field-root[contains(@w:instr, 'TotalEditingTime')]"/> 740 <xsl:variable name="field_Words_nodeset" select="$document-field-root[contains(text(), 'Words')] | $document-field-root[contains(@w:instr, 'Words')]"/> 741 <xsl:apply-templates select="$field_Author_nodeset[1]" mode="user_field_Author_declare"/> 742 <xsl:apply-templates select="$field_Bytes_nodeset[1]" mode="user_field_Bytes_declare"/> 743 <xsl:apply-templates select="$field_Category_nodeset[1]" mode="user_field_Category_declare"/> 744 <xsl:apply-templates select="$field_Characters_nodeset[1]" mode="user_field_Characters_declare"/> 745 <xsl:apply-templates select="$field_CharactersWithSpaces_nodeset[1]" mode="user_field_CharactersWithSpaces_declare"/> 746 <xsl:apply-templates select="$field_Comments_nodeset[1]" mode="user_field_Comments_declare"/> 747 <xsl:apply-templates select="$field_Company_nodeset[1]" mode="user_field_Company_declare"/> 748 <xsl:apply-templates select="$field_CreateTime_nodeset[1]" mode="user_field_CreateTime_declare"/> 749 <xsl:apply-templates select="$field_HyperlinkBase_nodeset[1]" mode="user_field_HyperlinkBase_declare"/> 750 <xsl:apply-templates select="$field_Keywords_nodeset[1]" mode="user_field_Keywords_declare"/> 751 <xsl:apply-templates select="$field_LastPrinted_nodeset[1]" mode="user_field_LastPrinted_declare"/> 752 <xsl:apply-templates select="$field_LastSavedBy_nodeset[1]" mode="user_field_LastSavedBy_declare"/> 753 <xsl:apply-templates select="$field_LastSavedTime_nodeset[1]" mode="user_field_LastSavedTime_declare"/> 754 <xsl:apply-templates select="$field_Lines_nodeset[1]" mode="user_field_Lines_declare"/> 755 <xsl:apply-templates select="$field_Manager_nodeset[1]" mode="user_field_Manager_declare"/> 756 <xsl:apply-templates select="$field_NameofApplication_nodeset[1]" mode="user_field_NameofApplication_declare"/> 757 <xsl:apply-templates select="$field_ODMADocId_nodeset[1]" mode="user_field_ODMADocId_declare"/> 758 <xsl:apply-templates select="$field_Pages_nodeset[1]" mode="user_field_Pages_declare"/> 759 <xsl:apply-templates select="$field_Paragraphs_nodeset[1]" mode="user_field_Paragraphs_declare"/> 760 <xsl:apply-templates select="$field_RevisionNumber_nodeset[1]" mode="user_field_RevisionNumber_declare"/> 761 <xsl:apply-templates select="$field_Security_nodeset[1]" mode="user_field_Security_declare"/> 762 <xsl:apply-templates select="$field_Subject_nodeset[1]" mode="user_field_Subject_declare"/> 763 <xsl:apply-templates select="$field_Template_nodeset[1]" mode="user_field_Template_declare"/> 764 <xsl:apply-templates select="$field_Title_nodeset[1]" mode="user_field_Title_declare"/> 765 <xsl:apply-templates select="$field_TotalEditingTime_nodeset[1]" mode="user_field_TotalEditingTime_declare"/> 766 <xsl:apply-templates select="$field_Words_nodeset[1]" mode="user_field_Words_declare"/> 767 </xsl:template> 768 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Author_declare"> 769 <text:user-field-decl office:value-type="string" text:name="Author"> 770 <xsl:variable name="field_content"> 771 <xsl:choose> 772 <xsl:when test="name() = 'w:instrText' "> 773 <xsl:call-template name="get-fldchar-content"> 774 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 775 <xsl:with-param name="sibling_number" select=" 1"/> 776 </xsl:call-template> 777 </xsl:when> 778 <xsl:when test="name() = 'w:fldSimple' "> 779 <xsl:value-of select=".//w:t"/> 780 </xsl:when> 781 </xsl:choose> 782 </xsl:variable> 783 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 784 </text:user-field-decl> 785 </xsl:template> 786 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Bytes_declare"> 787 <text:user-field-decl office:value-type="string" text:name="Bytes"> 788 <xsl:variable name="field_content"> 789 <xsl:choose> 790 <xsl:when test="name() = 'w:instrText' "> 791 <xsl:call-template name="get-fldchar-content"> 792 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 793 <xsl:with-param name="sibling_number" select=" 1"/> 794 </xsl:call-template> 795 </xsl:when> 796 <xsl:when test="name() = 'w:fldSimple' "> 797 <xsl:value-of select=".//w:t"/> 798 </xsl:when> 799 </xsl:choose> 800 </xsl:variable> 801 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 802 </text:user-field-decl> 803 </xsl:template> 804 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Category_declare"> 805 <text:user-field-decl office:value-type="string" text:name="Category"> 806 <xsl:variable name="field_content"> 807 <xsl:choose> 808 <xsl:when test="name() = 'w:instrText' "> 809 <xsl:call-template name="get-fldchar-content"> 810 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 811 <xsl:with-param name="sibling_number" select=" 1"/> 812 </xsl:call-template> 813 </xsl:when> 814 <xsl:when test="name() = 'w:fldSimple' "> 815 <xsl:value-of select=".//w:t"/> 816 </xsl:when> 817 </xsl:choose> 818 </xsl:variable> 819 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 820 </text:user-field-decl> 821 </xsl:template> 822 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Characters_declare"> 823 <text:user-field-decl office:value-type="string" text:name="Characters"> 824 <xsl:variable name="field_content"> 825 <xsl:choose> 826 <xsl:when test="name() = 'w:instrText' "> 827 <xsl:call-template name="get-fldchar-content"> 828 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 829 <xsl:with-param name="sibling_number" select=" 1"/> 830 </xsl:call-template> 831 </xsl:when> 832 <xsl:when test="name() = 'w:fldSimple' "> 833 <xsl:value-of select=".//w:t"/> 834 </xsl:when> 835 </xsl:choose> 836 </xsl:variable> 837 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 838 </text:user-field-decl> 839 </xsl:template> 840 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CharactersWithSpaces_declare"> 841 <text:user-field-decl office:value-type="string" text:name="CharactersWithSpaces"> 842 <xsl:variable name="field_content"> 843 <xsl:choose> 844 <xsl:when test="name() = 'w:instrText' "> 845 <xsl:call-template name="get-fldchar-content"> 846 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 847 <xsl:with-param name="sibling_number" select=" 1"/> 848 </xsl:call-template> 849 </xsl:when> 850 <xsl:when test="name() = 'w:fldSimple' "> 851 <xsl:value-of select=".//w:t"/> 852 </xsl:when> 853 </xsl:choose> 854 </xsl:variable> 855 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 856 </text:user-field-decl> 857 </xsl:template> 858 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Comments_declare"> 859 <text:user-field-decl office:value-type="string" text:name="Comments"> 860 <xsl:variable name="field_content"> 861 <xsl:choose> 862 <xsl:when test="name() = 'w:instrText' "> 863 <xsl:call-template name="get-fldchar-content"> 864 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 865 <xsl:with-param name="sibling_number" select=" 1"/> 866 </xsl:call-template> 867 </xsl:when> 868 <xsl:when test="name() = 'w:fldSimple' "> 869 <xsl:value-of select=".//w:t"/> 870 </xsl:when> 871 </xsl:choose> 872 </xsl:variable> 873 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 874 </text:user-field-decl> 875 </xsl:template> 876 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Company_declare"> 877 <text:user-field-decl office:value-type="string" text:name="Company"> 878 <xsl:variable name="field_content"> 879 <xsl:choose> 880 <xsl:when test="name() = 'w:instrText' "> 881 <xsl:call-template name="get-fldchar-content"> 882 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 883 <xsl:with-param name="sibling_number" select=" 1"/> 884 </xsl:call-template> 885 </xsl:when> 886 <xsl:when test="name() = 'w:fldSimple' "> 887 <xsl:value-of select=".//w:t"/> 888 </xsl:when> 889 </xsl:choose> 890 </xsl:variable> 891 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 892 </text:user-field-decl> 893 </xsl:template> 894 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CreateTime_declare"> 895 <text:user-field-decl office:value-type="string" text:name="CreateTime"> 896 <xsl:variable name="field_content"> 897 <xsl:choose> 898 <xsl:when test="name() = 'w:instrText' "> 899 <xsl:call-template name="get-fldchar-content"> 900 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 901 <xsl:with-param name="sibling_number" select=" 1"/> 902 </xsl:call-template> 903 </xsl:when> 904 <xsl:when test="name() = 'w:fldSimple' "> 905 <xsl:value-of select=".//w:t"/> 906 </xsl:when> 907 </xsl:choose> 908 </xsl:variable> 909 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 910 </text:user-field-decl> 911 </xsl:template> 912 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_HyperlinkBase_declare"> 913 <text:user-field-decl office:value-type="string" text:name="HyperlinkBase"> 914 <xsl:variable name="field_content"> 915 <xsl:choose> 916 <xsl:when test="name() = 'w:instrText' "> 917 <xsl:call-template name="get-fldchar-content"> 918 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 919 <xsl:with-param name="sibling_number" select=" 1"/> 920 </xsl:call-template> 921 </xsl:when> 922 <xsl:when test="name() = 'w:fldSimple' "> 923 <xsl:value-of select=".//w:t"/> 924 </xsl:when> 925 </xsl:choose> 926 </xsl:variable> 927 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 928 </text:user-field-decl> 929 </xsl:template> 930 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Keywords_declare"> 931 <text:user-field-decl office:value-type="string" text:name="Keywords"> 932 <xsl:variable name="field_content"> 933 <xsl:choose> 934 <xsl:when test="name() = 'w:instrText' "> 935 <xsl:call-template name="get-fldchar-content"> 936 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 937 <xsl:with-param name="sibling_number" select=" 1"/> 938 </xsl:call-template> 939 </xsl:when> 940 <xsl:when test="name() = 'w:fldSimple' "> 941 <xsl:value-of select=".//w:t"/> 942 </xsl:when> 943 </xsl:choose> 944 </xsl:variable> 945 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 946 </text:user-field-decl> 947 </xsl:template> 948 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastPrinted_declare"> 949 <text:user-field-decl office:value-type="string" text:name="LastPrinted"> 950 <xsl:variable name="field_content"> 951 <xsl:choose> 952 <xsl:when test="name() = 'w:instrText' "> 953 <xsl:call-template name="get-fldchar-content"> 954 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 955 <xsl:with-param name="sibling_number" select=" 1"/> 956 </xsl:call-template> 957 </xsl:when> 958 <xsl:when test="name() = 'w:fldSimple' "> 959 <xsl:value-of select=".//w:t"/> 960 </xsl:when> 961 </xsl:choose> 962 </xsl:variable> 963 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 964 </text:user-field-decl> 965 </xsl:template> 966 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedBy_declare"> 967 <text:user-field-decl office:value-type="string" text:name="LastSavedBy"> 968 <xsl:variable name="field_content"> 969 <xsl:choose> 970 <xsl:when test="name() = 'w:instrText' "> 971 <xsl:call-template name="get-fldchar-content"> 972 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 973 <xsl:with-param name="sibling_number" select=" 1"/> 974 </xsl:call-template> 975 </xsl:when> 976 <xsl:when test="name() = 'w:fldSimple' "> 977 <xsl:value-of select=".//w:t"/> 978 </xsl:when> 979 </xsl:choose> 980 </xsl:variable> 981 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 982 </text:user-field-decl> 983 </xsl:template> 984 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedTime_declare"> 985 <text:user-field-decl office:value-type="string" text:name="LastSavedTime"> 986 <xsl:variable name="field_content"> 987 <xsl:choose> 988 <xsl:when test="name() = 'w:instrText' "> 989 <xsl:call-template name="get-fldchar-content"> 990 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 991 <xsl:with-param name="sibling_number" select=" 1"/> 992 </xsl:call-template> 993 </xsl:when> 994 <xsl:when test="name() = 'w:fldSimple' "> 995 <xsl:value-of select=".//w:t"/> 996 </xsl:when> 997 </xsl:choose> 998 </xsl:variable> 999 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1000 </text:user-field-decl> 1001 </xsl:template> 1002 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Lines_declare"> 1003 <text:user-field-decl office:value-type="string" text:name="Lines"> 1004 <xsl:variable name="field_content"> 1005 <xsl:choose> 1006 <xsl:when test="name() = 'w:instrText' "> 1007 <xsl:call-template name="get-fldchar-content"> 1008 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1009 <xsl:with-param name="sibling_number" select=" 1"/> 1010 </xsl:call-template> 1011 </xsl:when> 1012 <xsl:when test="name() = 'w:fldSimple' "> 1013 <xsl:value-of select=".//w:t"/> 1014 </xsl:when> 1015 </xsl:choose> 1016 </xsl:variable> 1017 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1018 </text:user-field-decl> 1019 </xsl:template> 1020 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Manager_declare"> 1021 <text:user-field-decl office:value-type="string" text:name="Manager"> 1022 <xsl:variable name="field_content"> 1023 <xsl:choose> 1024 <xsl:when test="name() = 'w:instrText' "> 1025 <xsl:call-template name="get-fldchar-content"> 1026 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1027 <xsl:with-param name="sibling_number" select=" 1"/> 1028 </xsl:call-template> 1029 </xsl:when> 1030 <xsl:when test="name() = 'w:fldSimple' "> 1031 <xsl:value-of select=".//w:t"/> 1032 </xsl:when> 1033 </xsl:choose> 1034 </xsl:variable> 1035 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1036 </text:user-field-decl> 1037 </xsl:template> 1038 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_NameofApplication_declare"> 1039 <text:user-field-decl office:value-type="string" text:name="NameofApplication"> 1040 <xsl:variable name="field_content"> 1041 <xsl:choose> 1042 <xsl:when test="name() = 'w:instrText' "> 1043 <xsl:call-template name="get-fldchar-content"> 1044 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1045 <xsl:with-param name="sibling_number" select=" 1"/> 1046 </xsl:call-template> 1047 </xsl:when> 1048 <xsl:when test="name() = 'w:fldSimple' "> 1049 <xsl:value-of select=".//w:t"/> 1050 </xsl:when> 1051 </xsl:choose> 1052 </xsl:variable> 1053 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1054 </text:user-field-decl> 1055 </xsl:template> 1056 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_ODMADocId_declare"> 1057 <text:user-field-decl office:value-type="string" text:name="ODMADocId"> 1058 <xsl:variable name="field_content"> 1059 <xsl:choose> 1060 <xsl:when test="name() = 'w:instrText' "> 1061 <xsl:call-template name="get-fldchar-content"> 1062 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1063 <xsl:with-param name="sibling_number" select=" 1"/> 1064 </xsl:call-template> 1065 </xsl:when> 1066 <xsl:when test="name() = 'w:fldSimple' "> 1067 <xsl:value-of select=".//w:t"/> 1068 </xsl:when> 1069 </xsl:choose> 1070 </xsl:variable> 1071 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1072 </text:user-field-decl> 1073 </xsl:template> 1074 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Pages_declare"> 1075 <text:user-field-decl office:value-type="string" text:name="Pages"> 1076 <xsl:variable name="field_content"> 1077 <xsl:choose> 1078 <xsl:when test="name() = 'w:instrText' "> 1079 <xsl:call-template name="get-fldchar-content"> 1080 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1081 <xsl:with-param name="sibling_number" select=" 1"/> 1082 </xsl:call-template> 1083 </xsl:when> 1084 <xsl:when test="name() = 'w:fldSimple' "> 1085 <xsl:value-of select=".//w:t"/> 1086 </xsl:when> 1087 </xsl:choose> 1088 </xsl:variable> 1089 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1090 </text:user-field-decl> 1091 </xsl:template> 1092 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Paragraphs_declare"> 1093 <text:user-field-decl office:value-type="string" text:name="Paragraphs"> 1094 <xsl:variable name="field_content"> 1095 <xsl:choose> 1096 <xsl:when test="name() = 'w:instrText' "> 1097 <xsl:call-template name="get-fldchar-content"> 1098 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1099 <xsl:with-param name="sibling_number" select=" 1"/> 1100 </xsl:call-template> 1101 </xsl:when> 1102 <xsl:when test="name() = 'w:fldSimple' "> 1103 <xsl:value-of select=".//w:t"/> 1104 </xsl:when> 1105 </xsl:choose> 1106 </xsl:variable> 1107 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1108 </text:user-field-decl> 1109 </xsl:template> 1110 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_RevisionNumber_declare"> 1111 <text:user-field-decl office:value-type="string" text:name="RevisionNumber"> 1112 <xsl:variable name="field_content"> 1113 <xsl:choose> 1114 <xsl:when test="name() = 'w:instrText' "> 1115 <xsl:call-template name="get-fldchar-content"> 1116 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1117 <xsl:with-param name="sibling_number" select=" 1"/> 1118 </xsl:call-template> 1119 </xsl:when> 1120 <xsl:when test="name() = 'w:fldSimple' "> 1121 <xsl:value-of select=".//w:t"/> 1122 </xsl:when> 1123 </xsl:choose> 1124 </xsl:variable> 1125 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1126 </text:user-field-decl> 1127 </xsl:template> 1128 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Security_declare"> 1129 <text:user-field-decl office:value-type="string" text:name="Security"> 1130 <xsl:variable name="field_content"> 1131 <xsl:choose> 1132 <xsl:when test="name() = 'w:instrText' "> 1133 <xsl:call-template name="get-fldchar-content"> 1134 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1135 <xsl:with-param name="sibling_number" select=" 1"/> 1136 </xsl:call-template> 1137 </xsl:when> 1138 <xsl:when test="name() = 'w:fldSimple' "> 1139 <xsl:value-of select=".//w:t"/> 1140 </xsl:when> 1141 </xsl:choose> 1142 </xsl:variable> 1143 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1144 </text:user-field-decl> 1145 </xsl:template> 1146 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Subject_declare"> 1147 <text:user-field-decl office:value-type="string" text:name="Subject"> 1148 <xsl:variable name="field_content"> 1149 <xsl:choose> 1150 <xsl:when test="name() = 'w:instrText' "> 1151 <xsl:call-template name="get-fldchar-content"> 1152 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1153 <xsl:with-param name="sibling_number" select=" 1"/> 1154 </xsl:call-template> 1155 </xsl:when> 1156 <xsl:when test="name() = 'w:fldSimple' "> 1157 <xsl:value-of select=".//w:t"/> 1158 </xsl:when> 1159 </xsl:choose> 1160 </xsl:variable> 1161 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1162 </text:user-field-decl> 1163 </xsl:template> 1164 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Template_declare"> 1165 <text:user-field-decl office:value-type="string" text:name="Template"> 1166 <xsl:variable name="field_content"> 1167 <xsl:choose> 1168 <xsl:when test="name() = 'w:instrText' "> 1169 <xsl:call-template name="get-fldchar-content"> 1170 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1171 <xsl:with-param name="sibling_number" select=" 1"/> 1172 </xsl:call-template> 1173 </xsl:when> 1174 <xsl:when test="name() = 'w:fldSimple' "> 1175 <xsl:value-of select=".//w:t"/> 1176 </xsl:when> 1177 </xsl:choose> 1178 </xsl:variable> 1179 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1180 </text:user-field-decl> 1181 </xsl:template> 1182 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Title_declare"> 1183 <text:user-field-decl office:value-type="string" text:name="Title"> 1184 <xsl:variable name="field_content"> 1185 <xsl:choose> 1186 <xsl:when test="name() = 'w:instrText' "> 1187 <xsl:call-template name="get-fldchar-content"> 1188 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1189 <xsl:with-param name="sibling_number" select=" 1"/> 1190 </xsl:call-template> 1191 </xsl:when> 1192 <xsl:when test="name() = 'w:fldSimple' "> 1193 <xsl:value-of select=".//w:t"/> 1194 </xsl:when> 1195 </xsl:choose> 1196 </xsl:variable> 1197 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1198 </text:user-field-decl> 1199 </xsl:template> 1200 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_TotalEditingTime_declare"> 1201 <text:user-field-decl office:value-type="string" text:name="TotalEditingTime"> 1202 <xsl:variable name="field_content"> 1203 <xsl:choose> 1204 <xsl:when test="name() = 'w:instrText' "> 1205 <xsl:call-template name="get-fldchar-content"> 1206 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1207 <xsl:with-param name="sibling_number" select=" 1"/> 1208 </xsl:call-template> 1209 </xsl:when> 1210 <xsl:when test="name() = 'w:fldSimple' "> 1211 <xsl:value-of select=".//w:t"/> 1212 </xsl:when> 1213 </xsl:choose> 1214 </xsl:variable> 1215 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1216 </text:user-field-decl> 1217 </xsl:template> 1218 <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Words_declare"> 1219 <text:user-field-decl office:value-type="string" text:name="Words"> 1220 <xsl:variable name="field_content"> 1221 <xsl:choose> 1222 <xsl:when test="name() = 'w:instrText' "> 1223 <xsl:call-template name="get-fldchar-content"> 1224 <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/> 1225 <xsl:with-param name="sibling_number" select=" 1"/> 1226 </xsl:call-template> 1227 </xsl:when> 1228 <xsl:when test="name() = 'w:fldSimple' "> 1229 <xsl:value-of select=".//w:t"/> 1230 </xsl:when> 1231 </xsl:choose> 1232 </xsl:variable> 1233 <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute> 1234 </text:user-field-decl> 1235 </xsl:template> 1236 <!-- =========this following template to convert the ms number format to OOo wirter format === --> 1237 <xsl:template name="get_field_num_format"> 1238 <xsl:param name="input_MS_num_format"/> 1239 <xsl:choose> 1240 <xsl:when test="contains($input_MS_num_format, 'Arabic' ) "> 1241 <xsl:text>1</xsl:text> 1242 </xsl:when> 1243 <xsl:when test="contains($input_MS_num_format, 'roman' ) "> 1244 <xsl:text>i</xsl:text> 1245 </xsl:when> 1246 <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) "> 1247 <xsl:text>I</xsl:text> 1248 </xsl:when> 1249 <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) "> 1250 <xsl:text>a</xsl:text> 1251 </xsl:when> 1252 <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) "> 1253 <xsl:text>A</xsl:text> 1254 </xsl:when> 1255 <xsl:otherwise> 1256 <xsl:text>1</xsl:text> 1257 </xsl:otherwise> 1258 </xsl:choose> 1259 </xsl:template> 1260 <!--xsl:template name="get_field_num_format"> 1261 <xsl:param name="input_MS_num_format"/> 1262 <xsl:choose> 1263 <xsl:when test="contains($input_MS_num_format, 'Arabic' ) "> 1264 <xsl:text>1</xsl:text> 1265 </xsl:when> 1266 <xsl:when test="contains ($input_MS_num_format, 'CircleNum' )"> 1267 <xsl:text>①, ②, ③, ...</xsl:text> 1268 </xsl:when> 1269 <xsl:when test="contains($input_MS_num_format, 'roman' ) "> 1270 <xsl:text>i</xsl:text> 1271 </xsl:when> 1272 <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) "> 1273 <xsl:text>I</xsl:text> 1274 </xsl:when> 1275 <xsl:when test="contains($input_MS_num_format, 'CHINESENUM3' )"> 1276 <xsl:text>一, 二, 三, ...</xsl:text> 1277 </xsl:when> 1278 <xsl:when test="contains($input_MS_num_format, 'CHINESENUM2' )"> 1279 <xsl:text>壹, 貳, 參, ...</xsl:text> 1280 </xsl:when> 1281 <xsl:when test="contains($input_MS_num_format, 'DBNUM3' ) "> 1282 <xsl:text>壱, 弐, 参, ...</xsl:text> 1283 </xsl:when> 1284 <xsl:when test="contains($input_MS_num_format, 'ZODIAC2' ) "> 1285 <xsl:text>子, 丑, 寅, ...</xsl:text> 1286 </xsl:when> 1287 <xsl:when test="contains($input_MS_num_format, 'ZODIAC1' ) "> 1288 <xsl:text>甲, 乙, 丙, ...</xsl:text> 1289 </xsl:when> 1290 <xsl:when test="contains($input_MS_num_format, 'Iroha' ) "> 1291 <xsl:text>イ, ロ, ハ, ...</xsl:text> 1292 </xsl:when> 1293 <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) "> 1294 <xsl:text>ア, イ, ウ, ...</xsl:text> 1295 </xsl:when> 1296 <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) "> 1297 <xsl:text>a</xsl:text> 1298 </xsl:when> 1299 <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) "> 1300 <xsl:text>A</xsl:text> 1301 </xsl:when> 1302 <xsl:when test="contains($input_MS_num_format, 'hebrew2' ) "> 1303 <xsl:text>א, ב, ג, ...</xsl:text> 1304 </xsl:when> 1305 <xsl:when test="contains($input_MS_num_format, 'ArabicAlpha' ) "> 1306 <xsl:text>أ, ب, ت, ...</xsl:text> 1307 </xsl:when> 1308 <xsl:when test="contains($input_MS_num_format, 'ThaiLetter' ) "> 1309 <xsl:text>ก, ข, ฃ, ...</xsl:text> 1310 </xsl:when> 1311 <xsl:when test="contains($input_MS_num_format, 'Chosung' ) "> 1312 <xsl:text>ㄱ, ㄴ, ㄷ, ...</xsl:text> 1313 </xsl:when> 1314 <xsl:when test="contains($input_MS_num_format, 'Ganada' ) "> 1315 <xsl:text>가, 나, 다, ...</xsl:text> 1316 </xsl:when> 1317 <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) "> 1318 <xsl:text>ア, イ, ウ, ...</xsl:text> 1319 </xsl:when> 1320 <xsl:otherwise> 1321 <xsl:text>1</xsl:text> 1322 </xsl:otherwise> 1323 </xsl:choose> 1324 </xsl:template --> 1325 <!-- ========= the following code is to generate the date styles for date/time fields ============ --> 1326 <!--the default date styel content --> 1327 <xsl:template name="default_date_style_content"> 1328 <number:year number:style="long"> 1329 </number:year> 1330 <number:text>/</number:text> 1331 <number:month> 1332 </number:month> 1333 <number:text>/</number:text> 1334 <number:day> 1335 </number:day> 1336 <number:text> </number:text> 1337 <number:hours> 1338 </number:hours> 1339 <number:text>:</number:text> 1340 <number:minutes number:style="long"> 1341 </number:minutes> 1342 <number:text>:</number:text> 1343 <number:seconds number:style="long"> 1344 </number:seconds> 1345 <number:am-pm> 1346 </number:am-pm> 1347 </xsl:template> 1348 <!--the default date styel --> 1349 <xsl:template name="default_date_style"> 1350 <number:date-style style:name="NDF1"> 1351 <xsl:call-template name="default_date_style_content"/> 1352 </number:date-style> 1353 </xsl:template> 1354 <xsl:template match="w:instrText | w:fldSimple" mode="style"> 1355 <!-- this template is to generate the date, time styles according to the content of DateFormatString ( the string after \@ ) in w:instrText | w:fldSimple/@w:instr --> 1356 <xsl:choose> 1357 <xsl:when test=" name() = 'w:instrText' "> 1358 <xsl:if test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' "> 1359 <number:date-style> 1360 <xsl:attribute name="style:name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute> 1361 <xsl:choose> 1362 <xsl:when test="contains(text(), '\@' )"> 1363 <!-- if has the date format string then call the template parse_field_date_format to produce the style--> 1364 <xsl:variable name="MS_date_format"> 1365 <xsl:value-of select="normalize-space(substring-before(substring-after(normalize-space(substring-after(text(), '\@')), '"'), '"'))"/> 1366 </xsl:variable> 1367 <xsl:if test="string-length($MS_date_format) >=1"> 1368 <xsl:call-template name="parse_field_date_format"> 1369 <xsl:with-param name="input_MS_date_format" select="$MS_date_format"/> 1370 </xsl:call-template> 1371 </xsl:if> 1372 <xsl:if test="string-length($MS_date_format) <1"> 1373 <xsl:call-template name="default_date_style_content"/> 1374 </xsl:if> 1375 </xsl:when> 1376 <xsl:otherwise> 1377 <!-- if doesn't have date format string so we use the following default format --> 1378 <xsl:call-template name="default_date_style_content"/> 1379 </xsl:otherwise> 1380 </xsl:choose> 1381 </number:date-style> 1382 </xsl:if> 1383 </xsl:when> 1384 <xsl:when test="name() = 'w:fldSimple' "> 1385 <xsl:if test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' or substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' or substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' or substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' "> 1386 <!-- we use the default date/time style for w:fldsimple --> 1387 <number:date-style> 1388 <xsl:attribute name="style:name">NDF1</xsl:attribute> 1389 <xsl:call-template name="default_date_style_content"/> 1390 </number:date-style> 1391 </xsl:if> 1392 </xsl:when> 1393 </xsl:choose> 1394 </xsl:template> 1395 <xsl:template name="parse_field_date_format"> 1396 <!--this template is to parse and generate the content of the date-time style base on the content of input_MS_date_format --> 1397 <xsl:param name="input_MS_date_format"/> 1398 <xsl:if test="string-length($input_MS_date_format) >= 1"> 1399 <xsl:variable name="date_token_start_position"> 1400 <!-- to find the start position of the token ' d, M, yy, YY,m etc. --> 1401 <xsl:call-template name="find_token_startposition"> 1402 <xsl:with-param name="input_string" select="$input_MS_date_format"/> 1403 <xsl:with-param name="token_start_position" select="1"/> 1404 </xsl:call-template> 1405 </xsl:variable> 1406 <xsl:variable name="date_token"> 1407 <!-- get the matched the token such as MM, YYYY, yy,MMMM etc. --> 1408 <xsl:call-template name="get_date_token"> 1409 <xsl:with-param name="input_string2" select="substring($input_MS_date_format,$date_token_start_position)"/> 1410 </xsl:call-template> 1411 </xsl:variable> 1412 <xsl:if test="number($date_token_start_position) > 1"> 1413 <!-- print the text between the tokens --> 1414 <number:text> 1415 <xsl:value-of select="substring($input_MS_date_format,1, number($date_token_start_position - 1) )"/> 1416 </number:text> 1417 </xsl:if> 1418 <xsl:call-template name="map_date_format_pattern"> 1419 <xsl:with-param name="input_date_format_pattern" select="$date_token"/> 1420 </xsl:call-template> 1421 <xsl:variable name="unparsed_string"> 1422 <xsl:value-of select="substring($input_MS_date_format,$date_token_start_position + string-length($date_token))"/> 1423 </xsl:variable> 1424 <xsl:call-template name="parse_field_date_format"> 1425 <xsl:with-param name="input_MS_date_format" select="$unparsed_string"/> 1426 </xsl:call-template> 1427 </xsl:if> 1428 </xsl:template> 1429 <xsl:template name="find_token_startposition"> 1430 <xsl:param name="input_string"/> 1431 <xsl:param name="token_start_position"/> 1432 <xsl:choose> 1433 <xsl:when test="starts-with( $input_string,'yy') or starts-with($input_string,'YY') or starts-with($input_string,'HH') or starts-with($input_string,'hh') or starts-with($input_string,'ss') or starts-with($input_string,'SS')"> 1434 <xsl:value-of select="$token_start_position"/> 1435 </xsl:when> 1436 <xsl:when test="starts-with($input_string, 'M') or starts-with($input_string,'d') or starts-with($input_string, 'm') or starts-with($input_string,'D') or starts-with($input_string,'h') or starts-with($input_string,'H') or starts-with($input_string,'s') or starts-with($input_string,'S')"> 1437 <xsl:value-of select="$token_start_position"/> 1438 </xsl:when> 1439 <xsl:when test="starts-with($input_string, 'am/pm') or starts-with($input_string, 'AM/PM') "> 1440 <xsl:value-of select="$token_start_position"/> 1441 </xsl:when> 1442 <xsl:otherwise> 1443 <xsl:variable name="new_string"> 1444 <xsl:value-of select="substring($input_string, 2)"/> 1445 </xsl:variable> 1446 <xsl:call-template name="find_token_startposition"> 1447 <xsl:with-param name="input_string" select="$new_string"/> 1448 <xsl:with-param name="token_start_position" select="$token_start_position +1"/> 1449 </xsl:call-template> 1450 </xsl:otherwise> 1451 </xsl:choose> 1452 </xsl:template> 1453 <xsl:template name="get_date_token"> 1454 <xsl:param name="input_string2"/> 1455 <xsl:choose> 1456 <xsl:when test="starts-with($input_string2, 'am/pm') or starts-with($input_string2, 'AM/PM') "> 1457 <xsl:value-of select=" 'am/pm' "/> 1458 </xsl:when> 1459 <xsl:when test="starts-with($input_string2, 'yyyy') or starts-with($input_string2, 'YYYY')"> 1460 <xsl:value-of select=" 'yyyy' "/> 1461 </xsl:when> 1462 <xsl:when test="starts-with($input_string2, 'yy') or starts-with($input_string2, 'YY')"> 1463 <xsl:value-of select=" 'yy' "/> 1464 </xsl:when> 1465 <xsl:when test="starts-with($input_string2, 'MMMM') "> 1466 <xsl:value-of select=" 'MMMM' "/> 1467 </xsl:when> 1468 <xsl:when test="starts-with($input_string2, 'MMM')"> 1469 <xsl:value-of select=" 'MMM' "/> 1470 </xsl:when> 1471 <xsl:when test="starts-with($input_string2, 'MM')"> 1472 <xsl:value-of select=" 'MM' "/> 1473 </xsl:when> 1474 <xsl:when test="starts-with($input_string2, 'M') "> 1475 <xsl:value-of select=" 'M' "/> 1476 </xsl:when> 1477 <xsl:when test="starts-with($input_string2, 'dddd') or starts-with($input_string2, 'DDDD')"> 1478 <xsl:value-of select=" 'dddd' "/> 1479 </xsl:when> 1480 <xsl:when test="starts-with($input_string2, 'ddd') or starts-with($input_string2, 'DDD')"> 1481 <xsl:value-of select=" 'ddd' "/> 1482 </xsl:when> 1483 <xsl:when test="starts-with($input_string2, 'dd') or starts-with($input_string2, 'dd')"> 1484 <xsl:value-of select=" 'dd' "/> 1485 </xsl:when> 1486 <xsl:when test="starts-with($input_string2, 'd') or starts-with($input_string2, 'D')"> 1487 <xsl:value-of select=" 'd' "/> 1488 </xsl:when> 1489 <xsl:when test="starts-with($input_string2, 'mm')"> 1490 <xsl:value-of select=" 'mm' "/> 1491 </xsl:when> 1492 <xsl:when test="starts-with($input_string2, 'm')"> 1493 <xsl:value-of select=" 'm' "/> 1494 </xsl:when> 1495 <xsl:when test="starts-with($input_string2, 'hh') or starts-with($input_string2, 'HH')"> 1496 <xsl:value-of select=" 'hh' "/> 1497 </xsl:when> 1498 <xsl:when test="starts-with($input_string2, 'h') or starts-with($input_string2, 'H')"> 1499 <xsl:value-of select=" 'h' "/> 1500 </xsl:when> 1501 <xsl:when test="starts-with($input_string2, 'ss') or starts-with($input_string2, 'SS')"> 1502 <xsl:value-of select=" 'ss' "/> 1503 </xsl:when> 1504 <xsl:when test="starts-with($input_string2, 's') or starts-with($input_string2, 'S')"> 1505 <xsl:value-of select=" 's' "/> 1506 </xsl:when> 1507 </xsl:choose> 1508 </xsl:template> 1509 <xsl:template name="map_date_format_pattern"> 1510 <!-- this template map the MS date time format to OOo date time format --> 1511 <xsl:param name="input_date_format_pattern"/> 1512 <xsl:choose> 1513 <xsl:when test="$input_date_format_pattern = 'am/pm' "> 1514 <number:am-pm> 1515 </number:am-pm> 1516 </xsl:when> 1517 <xsl:when test="$input_date_format_pattern = 'yyyy' "> 1518 <number:year number:style="long"> 1519 </number:year> 1520 </xsl:when> 1521 <xsl:when test="$input_date_format_pattern = 'yy' "> 1522 <number:year> 1523 </number:year> 1524 </xsl:when> 1525 <xsl:when test="$input_date_format_pattern = 'MMMM' "> 1526 <number:month number:style="long" number:textual="true"> 1527 </number:month> 1528 </xsl:when> 1529 <xsl:when test="$input_date_format_pattern = 'MMM' "> 1530 <number:month number:textual="true"> 1531 </number:month> 1532 </xsl:when> 1533 <xsl:when test="$input_date_format_pattern = 'MM' "> 1534 <number:month number:style="long"> 1535 </number:month> 1536 </xsl:when> 1537 <xsl:when test="$input_date_format_pattern = 'M' "> 1538 <number:month> 1539 </number:month> 1540 </xsl:when> 1541 <xsl:when test="$input_date_format_pattern = 'dddd' "> 1542 <number:day-of-week number:style="long"> 1543 </number:day-of-week> 1544 </xsl:when> 1545 <xsl:when test="$input_date_format_pattern = 'ddd' "> 1546 <number:day-of-week> 1547 </number:day-of-week> 1548 </xsl:when> 1549 <xsl:when test="$input_date_format_pattern = 'dd' "> 1550 <number:day number:style="long"> 1551 </number:day> 1552 </xsl:when> 1553 <xsl:when test="$input_date_format_pattern = 'd' "> 1554 <number:day> 1555 </number:day> 1556 </xsl:when> 1557 <xsl:when test="$input_date_format_pattern = 'mm' "> 1558 <number:minutes number:style="long"> 1559 </number:minutes> 1560 </xsl:when> 1561 <xsl:when test="$input_date_format_pattern = 'm' "> 1562 <number:minutes> 1563 </number:minutes> 1564 </xsl:when> 1565 <xsl:when test="$input_date_format_pattern = 'hh' "> 1566 <number:hours number:style="long"> 1567 </number:hours> 1568 </xsl:when> 1569 <xsl:when test="$input_date_format_pattern = 'h' "> 1570 <number:hours> 1571 </number:hours> 1572 </xsl:when> 1573 <xsl:when test="$input_date_format_pattern = 'ss' "> 1574 <number:seconds number:style="long"> 1575 </number:seconds> 1576 </xsl:when> 1577 <xsl:when test="$input_date_format_pattern = 's' "> 1578 <number:seconds> 1579 </number:seconds> 1580 </xsl:when> 1581 </xsl:choose> 1582 </xsl:template> 1583</xsl:stylesheet> 1584