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:style[@w:type='table']" mode="table"> 26 <style:style style:family="table"> 27 <xsl:attribute name="style:name"> 28 <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> 29 </xsl:attribute> 30 <xsl:if test="w:basedOn"> 31 <xsl:attribute name="style:parent-style-name"> 32 <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> 33 </xsl:attribute> 34 </xsl:if> 35 <style:table-properties table:align="margins"/> 36 </style:style> 37 </xsl:template> 38 <xsl:template match="w:tblPr" mode="style"> 39 <xsl:variable name="table-number"> 40 <xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1" /> 41 </xsl:variable> 42 <xsl:element name="style:style"> 43 <xsl:attribute name="style:name"> 44 <xsl:text>Table</xsl:text> 45 <xsl:value-of select="$table-number"/> 46 </xsl:attribute> 47 <xsl:attribute name="style:family">table</xsl:attribute> 48 <xsl:if test="w:tblStyle"> 49 <xsl:attribute name="style:parent-style-name"> 50 <xsl:value-of select="concat('w',translate(w:tblStyle/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/> 51 </xsl:attribute> 52 </xsl:if> 53 <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/> 54 <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/> 55 <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/> 56 <xsl:variable name="last-next-p-tbl" select="$last-section-property[last()]/following::*[name()='w:p' or name()='w:tbl']"/> 57 <xsl:choose> 58 <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-next-p-tbl[1]) = generate-id(..) and not(ancestor::w:sectPr or ancestor::w:styles)"> 59 <xsl:attribute name="style:master-page-name"> 60 <xsl:text>Standard</xsl:text> 61 <xsl:value-of select="$section-property-number + 1" /> 62 </xsl:attribute> 63 </xsl:when> 64 <xsl:when test="$table-number = 1 and not(preceding::w:p[ancestor::w:body])"> 65 <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute> 66 </xsl:when> 67 </xsl:choose> 68 <xsl:element name="style:table-properties"> 69 <xsl:choose> 70 <xsl:when test="w:jc/@w:val = 'left' or w:jc/@w:val = 'center' or w:jc/@w:val = 'right'"> 71 <xsl:attribute name="table:align"> 72 <xsl:value-of select="w:jc/@w:val"/> 73 </xsl:attribute> 74 </xsl:when> 75 <xsl:otherwise> 76 <xsl:attribute name="table:align">margins</xsl:attribute> 77 </xsl:otherwise> 78 </xsl:choose> 79 <!-- adopt the width of table and column corresponding the width of page and margins. . --> 80 <xsl:variable name="sectPr" select="following::w:sectPr[1]"/> 81 <xsl:variable name="total-page-size" select="$sectPr/w:pgSz/@w:w"/> 82 <xsl:variable name="page-left-mar" select="$sectPr/w:pgMar/@w:left"/> 83 <xsl:variable name="page-right-mar" select="$sectPr/w:pgMar/@w:right"/> 84 <xsl:variable name="page-size-value" select="$total-page-size - $page-left-mar - $page-right-mar"/> 85 <xsl:variable name="page-size-inch"> 86 <xsl:call-template name="ConvertMeasure"> 87 <xsl:with-param name="TargetMeasure" select="'in'"/> 88 <xsl:with-param name="value" select="concat($page-size-value, 'twip') "/> 89 </xsl:call-template> 90 </xsl:variable> 91 <xsl:variable name="gridcols" select="../w:tblGrid/w:gridCol"/> 92 <xsl:variable name="tblsize" select="sum($gridcols/@w:w)"/> 93 <xsl:variable name="table_indent"> 94 <xsl:choose> 95 <xsl:when test="w:tblInd and w:tblInd/@w:w > 0 "> 96 <xsl:call-template name="ConvertMeasure"> 97 <xsl:with-param name="TargetMeasure" select="'in'"/> 98 <xsl:with-param name="value" select="concat(w:tblInd/@w:w, 'twip') "/> 99 </xsl:call-template> 100 </xsl:when> 101 <xsl:otherwise> 102 <xsl:value-of select="number( '0') "/> 103 </xsl:otherwise> 104 </xsl:choose> 105 </xsl:variable> 106 <xsl:variable name="rel-tblsize"> 107 <xsl:choose> 108 <xsl:when test="w:tblW/@w:type = 'pct'"> 109 <xsl:value-of select="(number(w:tblW/@w:w ) div 5000) * $page-size-inch"/> 110 </xsl:when> 111 <xsl:otherwise> 112 <xsl:call-template name="ConvertMeasure"> 113 <xsl:with-param name="TargetMeasure" select="'in'"/> 114 <xsl:with-param name="value" select="concat($tblsize, 'twip')"/> 115 </xsl:call-template> 116 </xsl:otherwise> 117 </xsl:choose> 118 </xsl:variable> 119 <xsl:attribute name="style:width"> 120 <xsl:value-of select="concat($rel-tblsize, 'in' )"/> 121 </xsl:attribute> 122 <xsl:variable name="tbl_margin_left"> 123 <xsl:choose> 124 <xsl:when test="not(w:tblpPr ) "> 125 <xsl:choose> 126 <xsl:when test="w:bidiVisual"> 127 <xsl:choose> 128 <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) > 0"> 129 <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/> 130 </xsl:when> 131 <xsl:otherwise> 132 <xsl:text>0</xsl:text> 133 </xsl:otherwise> 134 </xsl:choose> 135 </xsl:when> 136 <xsl:otherwise> 137 <xsl:value-of select="$table_indent"/> 138 </xsl:otherwise> 139 </xsl:choose> 140 </xsl:when> 141 <xsl:when test="w:tblpPr"> 142 <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 --> 143 <xsl:text>0</xsl:text> 144 </xsl:when> 145 </xsl:choose> 146 </xsl:variable> 147 <xsl:variable name="tbl_margin_right"> 148 <xsl:choose> 149 <xsl:when test="not(w:tblpPr ) "> 150 <xsl:choose> 151 <xsl:when test="w:bidiVisual"> 152 <xsl:value-of select="$table_indent"/> 153 </xsl:when> 154 <xsl:otherwise> 155 <xsl:choose> 156 <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) > 0"> 157 <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/> 158 </xsl:when> 159 <xsl:otherwise> 160 <xsl:text>0</xsl:text> 161 </xsl:otherwise> 162 </xsl:choose> 163 </xsl:otherwise> 164 </xsl:choose> 165 </xsl:when> 166 <xsl:when test="w:tblpPr"> 167 <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 --> 168 <xsl:text>0</xsl:text> 169 </xsl:when> 170 </xsl:choose> 171 </xsl:variable> 172 <xsl:attribute name="fo:margin-left"> 173 <xsl:value-of select="concat( $tbl_margin_left, 'in')"/> 174 </xsl:attribute> 175 <xsl:attribute name="fo:margin-right"> 176 <xsl:value-of select="concat($tbl_margin_right, 'in')"/> 177 </xsl:attribute> 178 <!-- If previous w:p has a page break, the table must have the page break attribute applied to it May need this for tables starting on new pages --> 179 <!-- <xsl:if test="parent::w:tbl/preceding-sibling::w:p[1][descendant::w:br/@w:type='page']"> 180 <xsl:attribute name="fo:break-before">page</xsl:attribute></xsl:if> --> 181 <!-- initial values for tables--> 182 </xsl:element> 183 </xsl:element> 184 <!-- the following style is for conveting Word table text wrapping to SO Writer. Since SO Writer has no table text wrapping feature, so we use the draw:text-box as a container and put the table in draw:text-box --> 185 <xsl:if test="w:tblpPr"> 186 <xsl:element name="style:style"> 187 <xsl:attribute name="style:name">TableFrame<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/> 188 </xsl:attribute> 189 <xsl:attribute name="style:family">graphic</xsl:attribute> 190 <xsl:attribute name="style:parent-style-name"> 191 <xsl:value-of select=" 'Frame' "/> 192 </xsl:attribute> 193 <xsl:element name="style:graphic-properties"> 194 <xsl:if test="w:tblpPr/@w:leftFromText"> 195 <xsl:variable name="left_margin_from_text"> 196 <xsl:call-template name="ConvertMeasure"> 197 <xsl:with-param name="TargetMeasure" select="'in'"/> 198 <xsl:with-param name="value" select="concat (w:tblpPr/@w:leftFromText, 'twip') "/> 199 </xsl:call-template> 200 </xsl:variable> 201 <xsl:attribute name="fo:margin-left"> 202 <xsl:value-of select="concat( $left_margin_from_text, 'in') "/> 203 </xsl:attribute> 204 </xsl:if> 205 <xsl:if test="w:tblpPr/@w:rightFromText"> 206 <xsl:variable name="right_margin_from_text"> 207 <xsl:call-template name="ConvertMeasure"> 208 <xsl:with-param name="TargetMeasure" select="'in'"/> 209 <xsl:with-param name="value" select="concat (w:tblpPr/@w:rightFromText, 'twip') "/> 210 </xsl:call-template> 211 </xsl:variable> 212 <xsl:attribute name="fo:margin-right"> 213 <xsl:value-of select="concat( $right_margin_from_text, 'in') "/> 214 </xsl:attribute> 215 </xsl:if> 216 <xsl:if test="w:tblpPr/@w:topFromText"> 217 <xsl:variable name="top_margin_from_text"> 218 <xsl:call-template name="ConvertMeasure"> 219 <xsl:with-param name="TargetMeasure" select="'in'"/> 220 <xsl:with-param name="value" select="concat (w:tblpPr/@w:topFromText, 'twip') "/> 221 </xsl:call-template> 222 </xsl:variable> 223 <xsl:attribute name="fo:margin-top"> 224 <xsl:value-of select="concat( $top_margin_from_text, 'in') "/> 225 </xsl:attribute> 226 </xsl:if> 227 <xsl:if test="w:tblpPr/@w:bottomFromText"> 228 <xsl:variable name="bottom_margin_from_text"> 229 <xsl:call-template name="ConvertMeasure"> 230 <xsl:with-param name="TargetMeasure" select="'in'"/> 231 <xsl:with-param name="value" select="concat (w:tblpPr/@w:bottomFromText, 'twip') "/> 232 </xsl:call-template> 233 </xsl:variable> 234 <xsl:attribute name="fo:margin-bottom"> 235 <xsl:value-of select="concat( $bottom_margin_from_text, 'in') "/> 236 </xsl:attribute> 237 </xsl:if> 238 <xsl:attribute name="style:number-wrapped-paragraphs"> 239 <xsl:text>no-limit</xsl:text> 240 </xsl:attribute> 241 <!--xsl:if test="w:tblpPr/@w:tblpYSpec" to get the vertical alignment--> 242 <xsl:variable name="vertical_alignment"> 243 <xsl:choose> 244 <xsl:when test="w:tblpPr/@w:tblpYSpec = 'top' "> 245 <xsl:text>top</xsl:text> 246 </xsl:when> 247 <xsl:when test="w:tblpPr/@w:tblpYSpec = 'center' "> 248 <xsl:text>middle</xsl:text> 249 </xsl:when> 250 <xsl:when test="w:tblpPr/@w:tblpYSpec= 'bottom' "> 251 <xsl:text>bottom</xsl:text> 252 </xsl:when> 253 <xsl:when test="w:tblpPr/@w:tblpYSpec = 'inside' "> 254 <xsl:text>from-top</xsl:text> 255 </xsl:when> 256 <xsl:when test="w:tblpPr/@w:tblpYSpec= 'outside' "> 257 <xsl:text>top</xsl:text> 258 </xsl:when> 259 <xsl:otherwise> 260 <xsl:text>from-top</xsl:text> 261 </xsl:otherwise> 262 </xsl:choose> 263 </xsl:variable> 264 <xsl:attribute name="style:vertical-pos"> 265 <xsl:value-of select="$vertical_alignment"/> 266 </xsl:attribute> 267 <!--/xsl:if--> 268 <!--xsl:if test="w:tblpPr/@w:vertAnchor" to get the vertical anchor related area type --> 269 <xsl:variable name="frame_v_anchor"> 270 <xsl:choose> 271 <xsl:when test="w:tblpPr/@w:vertAnchor = 'text' "> 272 <xsl:value-of select=" 'paragraph' "/> 273 </xsl:when> 274 <xsl:when test="w:tblpPr/@w:vertAnchor = 'margin' "> 275 <xsl:value-of select=" 'paragraph-content' "/> 276 </xsl:when> 277 <xsl:when test="w:tblpPr/@w:vertAnchor = 'page' "> 278 <xsl:value-of select="w:tblpPr/@w:vertAnchor"/> 279 </xsl:when> 280 <xsl:otherwise> 281 <xsl:value-of select=" 'page-content' "/> 282 </xsl:otherwise> 283 </xsl:choose> 284 </xsl:variable> 285 <xsl:attribute name="style:vertical-rel"> 286 <xsl:value-of select="$frame_v_anchor"/> 287 </xsl:attribute> 288 <!--/xsl:if--> 289 <!--xsl:if test="w:tblpPr/@w:tblpXSpec" to get the horizntal alignment--> 290 <xsl:variable name="horizental_alignment"> 291 <xsl:choose> 292 <xsl:when test="w:tblpPr/@w:tblpXSpec = 'left' "> 293 <xsl:text>left</xsl:text> 294 </xsl:when> 295 <xsl:when test="w:tblpPr/@w:tblpXSpec = 'center' "> 296 <xsl:text>center</xsl:text> 297 </xsl:when> 298 <xsl:when test="w:tblpPr/@w:tblpXSpec = 'right' "> 299 <xsl:text>right</xsl:text> 300 </xsl:when> 301 <xsl:when test="w:tblpPr/@w:tblpXSpec = 'inside' "> 302 <xsl:text>from-left</xsl:text> 303 </xsl:when> 304 <xsl:when test="w:tblpPr/@w:tblpXSpec = 'outside' "> 305 <xsl:text>outside</xsl:text> 306 </xsl:when> 307 <xsl:otherwise> 308 <xsl:text>left</xsl:text> 309 </xsl:otherwise> 310 </xsl:choose> 311 </xsl:variable> 312 <xsl:attribute name="style:horizontal-pos"> 313 <xsl:value-of select="$horizental_alignment"/> 314 </xsl:attribute> 315 <!--/xsl:if--> 316 <!--xsl:if test="w:tblpPr/@w:horzAnchor" to get the horizental anchor related area type--> 317 <xsl:variable name="frame_h_anchor"> 318 <xsl:choose> 319 <xsl:when test="w:tblpPr/@w:horzAnchor = 'text' "> 320 <xsl:value-of select=" 'paragraph' "/> 321 </xsl:when> 322 <xsl:when test="w:tblpPr/@w:horzAnchor = 'margin' "> 323 <xsl:value-of select=" 'page-content' "/> 324 </xsl:when> 325 <xsl:when test="w:tblpPr/@w:horzAnchor = 'page' "> 326 <xsl:value-of select="w:tblpPr/@w:horzAnchor"/> 327 </xsl:when> 328 <xsl:when test="w:tblpPr/@w:horzAnchor= 'inside' "> 329 <xsl:value-of select=" 'paragraph-start-margin' "/> 330 </xsl:when> 331 <xsl:when test="w:tblpPr/@w:horzAnchor= 'outside' "> 332 <xsl:value-of select=" 'paragraph-end-margin' "/> 333 </xsl:when> 334 <xsl:otherwise> 335 <xsl:value-of select=" 'paragraph-content' "/> 336 </xsl:otherwise> 337 </xsl:choose> 338 </xsl:variable> 339 <xsl:attribute name="style:horizontal-rel"> 340 <xsl:value-of select="$frame_h_anchor"/> 341 </xsl:attribute> 342 <!--/xsl:if--> 343 <xsl:attribute name="fo:background-color"> 344 <xsl:text>#ffffff</xsl:text> 345 </xsl:attribute> 346 <!-- xsl:attribute name="style:background-transparency"><xsl:text>100%</xsl:text></xsl:attribute --> 347 <xsl:attribute name="style:wrap"> 348 <xsl:text>parallel</xsl:text> 349 </xsl:attribute> 350 </xsl:element> 351 </xsl:element> 352 </xsl:if> 353 </xsl:template> 354 <xsl:template match="w:gridCol" mode="style"> 355 <xsl:element name="style:style"> 356 <xsl:attribute name="style:family">table-column</xsl:attribute> 357 <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/> 358 </xsl:attribute> 359 <xsl:element name="style:table-column-properties"> 360 <xsl:variable name="column_width"> 361 <xsl:call-template name="ConvertMeasure"> 362 <xsl:with-param name="TargetMeasure" select="'in'"/> 363 <xsl:with-param name="value" select="concat(@w:w, 'twip') "/> 364 </xsl:call-template> 365 </xsl:variable> 366 <xsl:attribute name="style:column-width"> 367 <xsl:value-of select="concat($column_width,'in') "/> 368 </xsl:attribute> 369 </xsl:element> 370 </xsl:element> 371 </xsl:template> 372 <xsl:template match="w:trPr" mode="style"> 373 <!-- to generate style:style of table-row height. --> 374 <xsl:element name="style:style"> 375 <xsl:attribute name="style:family">table-row</xsl:attribute> 376 <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/> 377 </xsl:attribute> 378 <xsl:element name="style:table-row-properties"> 379 <xsl:choose> 380 <xsl:when test="w:trHeight/@w:val"> 381 <xsl:variable name="tbl_row_height"> 382 <xsl:call-template name="ConvertMeasure"> 383 <xsl:with-param name="TargetMeasure" select="'in'"/> 384 <xsl:with-param name="value" select="concat(w:trHeight/@w:val, 'twip') "/> 385 </xsl:call-template> 386 </xsl:variable> 387 <xsl:attribute name="style:min-row-height"> 388 <xsl:value-of select="concat($tbl_row_height, 'in' )"/> 389 </xsl:attribute> 390 </xsl:when> 391 </xsl:choose> 392 </xsl:element> 393 </xsl:element> 394 </xsl:template> 395 <xsl:template match="w:tcPr" mode="style"> 396 <style:style> 397 <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/> 398 </xsl:attribute> 399 <xsl:attribute name="style:family">table-cell</xsl:attribute> 400 <xsl:variable name="rootStyle" select="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val"/> 401 <xsl:variable name="rootStyleNode" select="/w:wordDocument/w:styles/w:style[@w:styleId = $rootStyle]"/> 402 <xsl:element name="style:table-cell-properties"> 403 <!-- cell background color start --> 404 <xsl:variable name="tbl_cell_background_color"> 405 <xsl:choose> 406 <xsl:when test="w:shd/@w:fill"> 407 <xsl:value-of select="w:shd/@w:fill"/> 408 </xsl:when> 409 <xsl:when test="$rootStyleNode/w:tblpr/w:shd/@w:fill"> 410 <xsl:value-of select="$rootStyleNode/w:tblpr/w:shd/@w:fill"/> 411 </xsl:when> 412 </xsl:choose> 413 </xsl:variable> 414 <xsl:choose> 415 <xsl:when test=" string-length($tbl_cell_background_color) > 0 and not( $tbl_cell_background_color ='auto' )"> 416 <xsl:attribute name="fo:background-color"> 417 <xsl:value-of select="concat('#',$tbl_cell_background_color)"/> 418 </xsl:attribute> 419 </xsl:when> 420 </xsl:choose> 421 <!--cell background color end --> 422 <!-- table cell vertical alignment start --> 423 <xsl:if test="w:vAlign"> 424 <xsl:variable name="tbl_cell_alignment"> 425 <xsl:choose> 426 <xsl:when test="w:vAlign/@w:val = 'top' "> 427 <xsl:text>top</xsl:text> 428 </xsl:when> 429 <xsl:when test="w:vAlign/@w:val = 'center' "> 430 <xsl:text>middle</xsl:text> 431 </xsl:when> 432 <xsl:when test="w:vAlign/@w:val = 'bottom' "> 433 <xsl:text>bottom</xsl:text> 434 </xsl:when> 435 <xsl:otherwise> 436 <xsl:text>automatic</xsl:text> 437 </xsl:otherwise> 438 </xsl:choose> 439 </xsl:variable> 440 <xsl:attribute name="style:vertical-align"> 441 <xsl:value-of select="$tbl_cell_alignment"/> 442 </xsl:attribute> 443 </xsl:if> 444 <!--table cell alignment end --> 445 <!-- cell margin start --> 446 <xsl:variable name="tblcell_leftmargin"> 447 <xsl:choose> 448 <xsl:when test="w:tcMar/w:left"> 449 <xsl:call-template name="convert2in_special"> 450 <xsl:with-param name="original_value" select="concat(w:tcMar/w:left/@w:w , w:tcMar/w:left/@w:type) "/> 451 </xsl:call-template> 452 </xsl:when> 453 <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:left"> 454 <xsl:call-template name="convert2in_special"> 455 <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:type)"/> 456 </xsl:call-template> 457 </xsl:when> 458 <xsl:otherwise> 459 <xsl:text>0</xsl:text> 460 </xsl:otherwise> 461 </xsl:choose> 462 </xsl:variable> 463 <xsl:variable name="tblcell_rightmargin"> 464 <xsl:choose> 465 <xsl:when test="w:tcMar/w:right"> 466 <xsl:call-template name="convert2in_special"> 467 <xsl:with-param name="original_value" select="concat(w:tcMar/w:right/@w:w , w:tcMar/w:right/@w:type) "/> 468 </xsl:call-template> 469 </xsl:when> 470 <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:right"> 471 <xsl:call-template name="convert2in_special"> 472 <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:type)"/> 473 </xsl:call-template> 474 </xsl:when> 475 <xsl:otherwise> 476 <xsl:text>0</xsl:text> 477 </xsl:otherwise> 478 </xsl:choose> 479 </xsl:variable> 480 <xsl:variable name="tblcell_topmargin"> 481 <xsl:choose> 482 <xsl:when test="w:tcMar/w:top"> 483 <xsl:call-template name="convert2in_special"> 484 <xsl:with-param name="original_value" select="concat(w:tcMar/w:top/@w:w , w:tcMar/w:top/@w:type) "/> 485 </xsl:call-template> 486 </xsl:when> 487 <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:top"> 488 <xsl:call-template name="convert2in_special"> 489 <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:type)"/> 490 </xsl:call-template> 491 </xsl:when> 492 <xsl:otherwise> 493 <xsl:text>0</xsl:text> 494 </xsl:otherwise> 495 </xsl:choose> 496 </xsl:variable> 497 <xsl:variable name="tblcell_bottommargin"> 498 <xsl:choose> 499 <xsl:when test="w:tcMar/w:bottom"> 500 <xsl:call-template name="convert2in_special"> 501 <xsl:with-param name="original_value" select="concat(w:tcMar/w:bottom/@w:w , w:tcMar/w:bottom/@w:type) "/> 502 </xsl:call-template> 503 </xsl:when> 504 <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:bottom"> 505 <xsl:call-template name="convert2in_special"> 506 <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:type)"/> 507 </xsl:call-template> 508 </xsl:when> 509 <xsl:otherwise> 510 <xsl:text>0</xsl:text> 511 </xsl:otherwise> 512 </xsl:choose> 513 </xsl:variable> 514 <xsl:if test="string-length($tblcell_leftmargin) > 0 "> 515 <xsl:attribute name="fo:padding-left"> 516 <xsl:value-of select="concat($tblcell_leftmargin, 'in' )"/> 517 </xsl:attribute> 518 </xsl:if> 519 <xsl:if test="string-length($tblcell_rightmargin) > 0"> 520 <xsl:attribute name="fo:padding-right"> 521 <xsl:value-of select="concat($tblcell_rightmargin, 'in' )"/> 522 </xsl:attribute> 523 </xsl:if> 524 <xsl:if test="string-length($tblcell_topmargin) > 0 "> 525 <xsl:attribute name="fo:padding-top"> 526 <xsl:value-of select="concat($tblcell_topmargin, 'in' )"/> 527 </xsl:attribute> 528 </xsl:if> 529 <xsl:if test="string-length($tblcell_bottommargin) > 0"> 530 <xsl:attribute name="fo:padding-bottom"> 531 <xsl:value-of select="concat($tblcell_bottommargin, 'in' )"/> 532 </xsl:attribute> 533 </xsl:if> 534 <!-- cell margin end --> 535 <xsl:variable name="row-position"> 536 <xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/> 537 </xsl:variable> 538 <!-- cell borders should be carefully converted. a little complex. glu :( --> 539 <xsl:variable name="Borders" select="ancestor::w:tbl/w:tblPr/w:tblBorders"/> 540 <xsl:choose> 541 <xsl:when test="$row-position > 1"> 542 <xsl:call-template name="get-table-border"> 543 <xsl:with-param name="style-pos" select="'top'"/> 544 <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/> 545 <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/> 546 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/> 547 </xsl:call-template> 548 </xsl:when> 549 <xsl:otherwise> 550 <xsl:call-template name="get-table-border"> 551 <xsl:with-param name="style-pos" select="'top'"/> 552 <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/> 553 <xsl:with-param name="style-position-1" select="$Borders/w:top"/> 554 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:top"/> 555 </xsl:call-template> 556 </xsl:otherwise> 557 </xsl:choose> 558 <xsl:choose> 559 <xsl:when test="count(ancestor::w:tr/following-sibling::w:tr) > 0"> 560 <xsl:call-template name="get-table-border"> 561 <xsl:with-param name="style-pos" select="'bottom'"/> 562 <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/> 563 <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/> 564 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/> 565 </xsl:call-template> 566 </xsl:when> 567 <xsl:otherwise> 568 <xsl:call-template name="get-table-border"> 569 <xsl:with-param name="style-pos" select="'bottom'"/> 570 <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/> 571 <xsl:with-param name="style-position-1" select="$Borders/w:bottom"/> 572 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:bottom"/> 573 </xsl:call-template> 574 </xsl:otherwise> 575 </xsl:choose> 576 <xsl:choose> 577 <xsl:when test="count(ancestor::w:tc/preceding-sibling::w:tc) > 0"> 578 <xsl:call-template name="get-table-border"> 579 <xsl:with-param name="style-pos" select="'left'"/> 580 <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/> 581 <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/> 582 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/> 583 </xsl:call-template> 584 </xsl:when> 585 <xsl:otherwise> 586 <xsl:call-template name="get-table-border"> 587 <xsl:with-param name="style-pos" select="'left'"/> 588 <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/> 589 <xsl:with-param name="style-position-1" select="$Borders/w:left"/> 590 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:left"/> 591 </xsl:call-template> 592 </xsl:otherwise> 593 </xsl:choose> 594 <xsl:choose> 595 <xsl:when test="count(ancestor::w:tc/following-sibling::w:tc) > 0"> 596 <xsl:call-template name="get-table-border"> 597 <xsl:with-param name="style-pos" select="'right'"/> 598 <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/> 599 <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/> 600 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/> 601 </xsl:call-template> 602 </xsl:when> 603 <xsl:otherwise> 604 <xsl:call-template name="get-table-border"> 605 <xsl:with-param name="style-pos" select="'right'"/> 606 <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/> 607 <xsl:with-param name="style-position-1" select="$Borders/w:right"/> 608 <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:right"/> 609 </xsl:call-template> 610 </xsl:otherwise> 611 </xsl:choose> 612 </xsl:element> 613 </style:style> 614 </xsl:template> 615 <xsl:template name="get-table-border"> 616 <xsl:param name="style-pos"/> 617 <xsl:param name="style-position-0"/> 618 <xsl:param name="style-position-1"/> 619 <xsl:param name="style-position-2"/> 620 <xsl:variable name="size-style"> 621 <xsl:choose> 622 <xsl:when test="$style-position-0"> 623 <xsl:value-of select="$style-position-0/@w:sz"/> 624 </xsl:when> 625 <xsl:when test="$style-position-1"> 626 <xsl:value-of select="$style-position-1/@w:sz"/> 627 </xsl:when> 628 <xsl:when test="$style-position-2"> 629 <xsl:value-of select="$style-position-2/@w:sz"/> 630 </xsl:when> 631 <xsl:otherwise>2</xsl:otherwise> 632 </xsl:choose> 633 </xsl:variable> 634 <xsl:variable name="border-style"> 635 <xsl:choose> 636 <xsl:when test="$style-position-0"> 637 <xsl:value-of select="$style-position-0/@w:val"/> 638 </xsl:when> 639 <xsl:when test="$style-position-1"> 640 <xsl:value-of select="$style-position-1/@w:val"/> 641 </xsl:when> 642 <xsl:when test="$style-position-2"> 643 <xsl:value-of select="$style-position-2/@w:val"/> 644 </xsl:when> 645 <xsl:otherwise>single</xsl:otherwise> 646 </xsl:choose> 647 </xsl:variable> 648 <xsl:variable name="color-border"> 649 <xsl:choose> 650 <xsl:when test="$style-position-0 and string-length($style-position-0/@w:color) = 6"> 651 <xsl:value-of select="$style-position-0/@w:color"/> 652 </xsl:when> 653 <xsl:when test="$style-position-0 and $style-position-0/@w:color = 'auto' and contains($border-style, 'set')"> 654 <xsl:text>c0c0c0</xsl:text> 655 </xsl:when> 656 <xsl:when test="$style-position-1 and string-length($style-position-1/@w:color) = 6"> 657 <xsl:value-of select="$style-position-1/@w:color"/> 658 </xsl:when> 659 <xsl:when test="$style-position-1 and $style-position-1/@w:color = 'auto' and contains($border-style, 'set')"> 660 <xsl:text>c0c0c0</xsl:text> 661 </xsl:when> 662 <xsl:when test="$style-position-2 and string-length($style-position-2/@w:color) = 6"> 663 <xsl:value-of select="$style-position-2/@w:color"/> 664 </xsl:when> 665 <xsl:when test="$style-position-2 and $style-position-2/@w:color = 'auto' and contains($border-style, 'set')"> 666 <xsl:text>c0c0c0</xsl:text> 667 </xsl:when> 668 <xsl:otherwise>000000</xsl:otherwise> 669 </xsl:choose> 670 </xsl:variable> 671 <!-- mapping border line widths. glu --> 672 <xsl:choose> 673 <xsl:when test="$border-style = 'nil' or $border-style = 'none'"> 674 <xsl:attribute name="{concat('fo:border-', $style-pos)}">hidden</xsl:attribute> 675 </xsl:when> 676 <xsl:when test="$border-style = 'single'"> 677 <xsl:choose> 678 <xsl:when test="$size-style < 7"> 679 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 680 <xsl:value-of select="concat('0.002cm solid #', $color-border)"/> 681 </xsl:attribute> 682 </xsl:when> 683 <xsl:when test="$size-style < 20"> 684 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 685 <xsl:value-of select="concat('0.035cm solid #', $color-border)"/> 686 </xsl:attribute> 687 </xsl:when> 688 <xsl:when test="$size-style < 30"> 689 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 690 <xsl:value-of select="concat('0.088cm solid #', $color-border)"/> 691 </xsl:attribute> 692 </xsl:when> 693 <xsl:when test="$size-style < 40"> 694 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 695 <xsl:value-of select="concat('0.141cm solid #', $color-border)"/> 696 </xsl:attribute> 697 </xsl:when> 698 <xsl:otherwise> 699 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 700 <xsl:value-of select="concat('0.176cm solid #', $color-border)"/> 701 </xsl:attribute> 702 </xsl:otherwise> 703 </xsl:choose> 704 </xsl:when> 705 <xsl:when test="$border-style = 'double'"> 706 <xsl:choose> 707 <xsl:when test="$size-style < 10"> 708 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 709 <xsl:value-of select="concat('0.039cm double #', $color-border)"/> 710 </xsl:attribute> 711 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> 712 </xsl:when> 713 <xsl:when test="$size-style < 15"> 714 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 715 <xsl:value-of select="concat('0.092cm double #', $color-border)"/> 716 </xsl:attribute> 717 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> 718 </xsl:when> 719 <xsl:when test="$size-style < 20"> 720 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 721 <xsl:value-of select="concat('0.106cm double #', $color-border)"/> 722 </xsl:attribute> 723 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> 724 </xsl:when> 725 <xsl:otherwise> 726 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 727 <xsl:value-of select="concat('0.265cm double #', $color-border)"/> 728 </xsl:attribute> 729 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute> 730 </xsl:otherwise> 731 </xsl:choose> 732 </xsl:when> 733 <xsl:when test="$border-style = 'triple'"> 734 <xsl:choose> 735 <xsl:when test="$size-style < 5"> 736 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 737 <xsl:value-of select="concat('0.039cm double #', $color-border)"/> 738 </xsl:attribute> 739 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> 740 </xsl:when> 741 <xsl:when test="$size-style < 10"> 742 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 743 <xsl:value-of select="concat('0.092cm double #', $color-border)"/> 744 </xsl:attribute> 745 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">.002cm 0.088cm 0.002cm</xsl:attribute> 746 </xsl:when> 747 <xsl:when test="$size-style < 15"> 748 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 749 <xsl:value-of select="concat('0.106cm double #', $color-border)"/> 750 </xsl:attribute> 751 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> 752 </xsl:when> 753 <xsl:otherwise> 754 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 755 <xsl:value-of select="concat('0.265cm double #', $color-border)"/> 756 </xsl:attribute> 757 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute> 758 </xsl:otherwise> 759 </xsl:choose> 760 </xsl:when> 761 <xsl:when test="$border-style = 'thin-thick-small-gap' or $border-style = 'thick-thin-small-gap'"> 762 <xsl:choose> 763 <xsl:when test="($border-style = 'thin-thick-small-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-small-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 764 <xsl:choose> 765 <xsl:when test="$size-style < 20"> 766 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 767 <xsl:value-of select="concat('0.125cm double #', $color-border)"/> 768 </xsl:attribute> 769 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> 770 </xsl:when> 771 <xsl:when test="$size-style < 30"> 772 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 773 <xsl:value-of select="concat('0.178cm double #', $color-border)"/> 774 </xsl:attribute> 775 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> 776 </xsl:when> 777 <xsl:otherwise> 778 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 779 <xsl:value-of select="concat('0.231cm double #', $color-border)"/> 780 </xsl:attribute> 781 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> 782 </xsl:otherwise> 783 </xsl:choose> 784 </xsl:when> 785 <xsl:otherwise> 786 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 787 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 788 </xsl:attribute> 789 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 790 </xsl:otherwise> 791 </xsl:choose> 792 </xsl:when> 793 <xsl:when test="$border-style = 'thin-thick-thin-small-gap'"> 794 <xsl:choose> 795 <xsl:when test="$size-style < 20"> 796 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 797 <xsl:value-of select="concat('0.178cm double #', $color-border)"/> 798 </xsl:attribute> 799 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> 800 </xsl:when> 801 <xsl:when test="$size-style < 40"> 802 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 803 <xsl:value-of select="concat('0.231cm double #', $color-border)"/> 804 </xsl:attribute> 805 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> 806 </xsl:when> 807 <xsl:otherwise> 808 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 809 <xsl:value-of select="concat('0.318cm double #', $color-border)"/> 810 </xsl:attribute> 811 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> 812 </xsl:otherwise> 813 </xsl:choose> 814 </xsl:when> 815 <xsl:when test="$border-style = 'thin-thick-medium-gap' or $border-style = 'thick-thin-medium-gap'"> 816 <xsl:choose> 817 <xsl:when test="$size-style < 10"> 818 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 819 <xsl:value-of select="concat('0.039cm double #', $color-border)"/> 820 </xsl:attribute> 821 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> 822 </xsl:when> 823 <xsl:when test="$size-style < 15"> 824 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 825 <xsl:value-of select="concat('0.106cm double #', $color-border)"/> 826 </xsl:attribute> 827 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> 828 </xsl:when> 829 <xsl:when test="$size-style < 30"> 830 <xsl:choose> 831 <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 832 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 833 <xsl:value-of select="concat('0.212cm double #', $color-border)"/> 834 </xsl:attribute> 835 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute> 836 </xsl:when> 837 <xsl:otherwise> 838 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 839 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 840 </xsl:attribute> 841 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 842 </xsl:otherwise> 843 </xsl:choose> 844 </xsl:when> 845 <xsl:otherwise> 846 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 847 <xsl:value-of select="concat('0.318cm double #', $color-border)"/> 848 </xsl:attribute> 849 <xsl:choose> 850 <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 851 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> 852 </xsl:when> 853 <xsl:otherwise> 854 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> 855 </xsl:otherwise> 856 </xsl:choose> 857 </xsl:otherwise> 858 </xsl:choose> 859 </xsl:when> 860 <xsl:when test="$border-style = 'thin-thick-thin-medium-gap'"> 861 <xsl:choose> 862 <xsl:when test="$size-style < 10"> 863 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 864 <xsl:value-of select="concat('0.039cm double #', $color-border)"/> 865 </xsl:attribute> 866 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute> 867 </xsl:when> 868 <xsl:when test="$size-style < 15"> 869 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 870 <xsl:value-of select="concat('0.106cm double #', $color-border)"/> 871 </xsl:attribute> 872 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> 873 </xsl:when> 874 <xsl:when test="$size-style < 30"> 875 <xsl:choose> 876 <xsl:when test="$style-pos = 'left' or $style-pos = 'top'"> 877 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 878 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 879 </xsl:attribute> 880 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 881 </xsl:when> 882 <xsl:otherwise> 883 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 884 <xsl:value-of select="concat('0.212cm double #', $color-border)"/> 885 </xsl:attribute> 886 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute> 887 </xsl:otherwise> 888 </xsl:choose> 889 </xsl:when> 890 <xsl:otherwise> 891 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 892 <xsl:value-of select="concat('0.318cm double #', $color-border)"/> 893 </xsl:attribute> 894 <xsl:choose> 895 <xsl:when test="$style-pos = 'left' or $style-pos = 'top'"> 896 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> 897 </xsl:when> 898 <xsl:otherwise> 899 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> 900 </xsl:otherwise> 901 </xsl:choose> 902 </xsl:otherwise> 903 </xsl:choose> 904 </xsl:when> 905 <xsl:when test="$border-style = 'thin-thick-large-gap' or $border-style = 'thick-thin-large-gap'"> 906 <xsl:choose> 907 <xsl:when test="$size-style < 7"> 908 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 909 <xsl:value-of select="concat('0.092cm double #', $color-border)"/> 910 </xsl:attribute> 911 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> 912 </xsl:when> 913 <xsl:when test="$size-style < 10"> 914 <xsl:choose> 915 <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 916 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 917 <xsl:value-of select="concat('0.125cm double #', $color-border)"/> 918 </xsl:attribute> 919 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> 920 </xsl:when> 921 <xsl:otherwise> 922 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 923 <xsl:value-of select="concat('0.092cm double #', $color-border)"/> 924 </xsl:attribute> 925 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> 926 </xsl:otherwise> 927 </xsl:choose> 928 </xsl:when> 929 <xsl:when test="$size-style < 15"> 930 <xsl:choose> 931 <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 932 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 933 <xsl:value-of select="concat('0.125cm double #', $color-border)"/> 934 </xsl:attribute> 935 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> 936 </xsl:when> 937 <xsl:otherwise> 938 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 939 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 940 </xsl:attribute> 941 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 942 </xsl:otherwise> 943 </xsl:choose> 944 </xsl:when> 945 <xsl:when test="$size-style < 30"> 946 <xsl:choose> 947 <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 948 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 949 <xsl:value-of select="concat('0.178cm double #', $color-border)"/> 950 </xsl:attribute> 951 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> 952 </xsl:when> 953 <xsl:otherwise> 954 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 955 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 956 </xsl:attribute> 957 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 958 </xsl:otherwise> 959 </xsl:choose> 960 </xsl:when> 961 <xsl:when test="$size-style < 40"> 962 <xsl:choose> 963 <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 964 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 965 <xsl:value-of select="concat('0.231cm double #', $color-border)"/> 966 </xsl:attribute> 967 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> 968 </xsl:when> 969 <xsl:otherwise> 970 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 971 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 972 </xsl:attribute> 973 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 974 </xsl:otherwise> 975 </xsl:choose> 976 </xsl:when> 977 <xsl:otherwise> 978 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 979 <xsl:value-of select="concat('0.318cm double #', $color-border)"/> 980 </xsl:attribute> 981 <xsl:choose> 982 <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 983 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> 984 </xsl:when> 985 <xsl:otherwise> 986 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> 987 </xsl:otherwise> 988 </xsl:choose> 989 </xsl:otherwise> 990 </xsl:choose> 991 </xsl:when> 992 <xsl:when test="$border-style = 'thin-thick-thin-large-gap'"> 993 <xsl:choose> 994 <xsl:when test="$size-style < 5"> 995 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 996 <xsl:value-of select="concat('0.125cm double #', $color-border)"/> 997 </xsl:attribute> 998 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> 999 </xsl:when> 1000 <xsl:when test="$size-style < 10"> 1001 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1002 <xsl:value-of select="concat('0.178cm double #', $color-border)"/> 1003 </xsl:attribute> 1004 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> 1005 </xsl:when> 1006 <xsl:when test="$size-style < 20"> 1007 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1008 <xsl:value-of select="concat('0.231cm double #', $color-border)"/> 1009 </xsl:attribute> 1010 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> 1011 </xsl:when> 1012 <xsl:otherwise> 1013 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1014 <xsl:value-of select="concat('0.318cm double #', $color-border)"/> 1015 </xsl:attribute> 1016 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> 1017 </xsl:otherwise> 1018 </xsl:choose> 1019 </xsl:when> 1020 <xsl:when test="contains( $border-style, 'wave') or $border-style = 'dash-dot-stroked'"> 1021 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1022 <xsl:value-of select="concat('0.106cm double #', $color-border)"/> 1023 </xsl:attribute> 1024 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute> 1025 </xsl:when> 1026 <xsl:when test="contains( $border-style, 'three-d')"> 1027 <xsl:choose> 1028 <xsl:when test="$size-style < 10"> 1029 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1030 <xsl:value-of select="concat('0.035cm solid #', $color-border)"/> 1031 </xsl:attribute> 1032 </xsl:when> 1033 <xsl:when test="$size-style < 20"> 1034 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1035 <xsl:value-of select="concat('0.088cm solid #', $color-border)"/> 1036 </xsl:attribute> 1037 </xsl:when> 1038 <xsl:when test="$size-style < 30"> 1039 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1040 <xsl:value-of select="concat('0.176cm solid #', $color-border)"/> 1041 </xsl:attribute> 1042 </xsl:when> 1043 <xsl:when test="$size-style < 40"> 1044 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1045 <xsl:value-of select="concat('0.265cm double #', $color-border)"/> 1046 </xsl:attribute> 1047 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute> 1048 </xsl:when> 1049 <xsl:otherwise> 1050 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1051 <xsl:value-of select="concat('0.318cm double #', $color-border)"/> 1052 </xsl:attribute> 1053 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> 1054 </xsl:otherwise> 1055 </xsl:choose> 1056 </xsl:when> 1057 <xsl:when test="contains( $border-style, 'set')"> 1058 <xsl:choose> 1059 <xsl:when test="$size-style < 7"> 1060 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1061 <xsl:value-of select="concat('0.092cm double #', $color-border)"/> 1062 </xsl:attribute> 1063 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> 1064 </xsl:when> 1065 <xsl:when test="$size-style < 10"> 1066 <xsl:choose> 1067 <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 1068 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1069 <xsl:value-of select="concat('0.092cm double #', $color-border)"/> 1070 </xsl:attribute> 1071 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute> 1072 </xsl:when> 1073 <xsl:otherwise> 1074 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1075 <xsl:value-of select="concat('0.125cm double #', $color-border)"/> 1076 </xsl:attribute> 1077 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> 1078 </xsl:otherwise> 1079 </xsl:choose> 1080 </xsl:when> 1081 <xsl:when test="$size-style < 15"> 1082 <xsl:choose> 1083 <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 1084 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1085 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 1086 </xsl:attribute> 1087 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 1088 </xsl:when> 1089 <xsl:otherwise> 1090 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1091 <xsl:value-of select="concat('0.125cm double #', $color-border)"/> 1092 </xsl:attribute> 1093 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute> 1094 </xsl:otherwise> 1095 </xsl:choose> 1096 </xsl:when> 1097 <xsl:when test="$size-style < 30"> 1098 <xsl:choose> 1099 <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 1100 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1101 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 1102 </xsl:attribute> 1103 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 1104 </xsl:when> 1105 <xsl:otherwise> 1106 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1107 <xsl:value-of select="concat('0.178cm double #', $color-border)"/> 1108 </xsl:attribute> 1109 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute> 1110 </xsl:otherwise> 1111 </xsl:choose> 1112 </xsl:when> 1113 <xsl:when test="$size-style < 40"> 1114 <xsl:choose> 1115 <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 1116 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1117 <xsl:value-of select="concat('0.159cm double #', $color-border)"/> 1118 </xsl:attribute> 1119 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute> 1120 </xsl:when> 1121 <xsl:otherwise> 1122 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1123 <xsl:value-of select="concat('0.231cm double #', $color-border)"/> 1124 </xsl:attribute> 1125 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute> 1126 </xsl:otherwise> 1127 </xsl:choose> 1128 </xsl:when> 1129 <xsl:otherwise> 1130 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1131 <xsl:value-of select="concat('0.318cm double #', $color-border)"/> 1132 </xsl:attribute> 1133 <xsl:choose> 1134 <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))"> 1135 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute> 1136 </xsl:when> 1137 <xsl:otherwise> 1138 <xsl:attribute name="{concat('fo:border-', $style-pos)}"> 1139 <xsl:value-of select="concat('0.231cm double #', $color-border)"/> 1140 </xsl:attribute> 1141 <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute> 1142 </xsl:otherwise> 1143 </xsl:choose> 1144 </xsl:otherwise> 1145 </xsl:choose> 1146 </xsl:when> 1147 <xsl:otherwise> 1148 <xsl:attribute name="{concat('fo:border-', $style-pos)}">0.002cm solid #000000</xsl:attribute> 1149 </xsl:otherwise> 1150 </xsl:choose> 1151 </xsl:template> 1152 <xsl:template match="w:tbl"> 1153 <xsl:choose> 1154 <xsl:when test="w:tblPr/w:tblpPr"> 1155 <!-- if the table is surrounded by text then put the table into a draw:text-box --> 1156 <xsl:element name="text:p"> 1157 <xsl:element name="draw:frame"> 1158 <xsl:attribute name="draw:style-name"> 1159 <xsl:text>TableFrame</xsl:text> 1160 <xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/> 1161 </xsl:attribute> 1162 <xsl:attribute name="draw:name">TableFr<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/> 1163 </xsl:attribute> 1164 <xsl:variable name="tbl_anchor_type"> 1165 <xsl:choose> 1166 <xsl:when test="name(..) = 'w:tc' "> 1167 <xsl:text>as-char</xsl:text> 1168 </xsl:when> 1169 <xsl:otherwise> 1170 <xsl:text>paragraph</xsl:text> 1171 </xsl:otherwise> 1172 </xsl:choose> 1173 </xsl:variable> 1174 <xsl:attribute name="text:anchor-type"> 1175 <xsl:value-of select="$tbl_anchor_type"/> 1176 </xsl:attribute> 1177 <xsl:variable name="tbl_draw_textbox_width"> 1178 <xsl:call-template name="ConvertMeasure"> 1179 <xsl:with-param name="TargetMeasure" select="'in'"/> 1180 <!-- adjust the width of draw:text-box containing a table with 20dxa + table-width --> 1181 <xsl:with-param name="value" select="concat(string(number(sum(w:tblGrid/w:gridCol/@w:w) +20)), 'twip' )"/> 1182 </xsl:call-template> 1183 </xsl:variable> 1184 <xsl:attribute name="svg:width"> 1185 <xsl:value-of select="concat ($tbl_draw_textbox_width, 'in') "/> 1186 </xsl:attribute> 1187 <xsl:if test="w:tblPr/w:tblpPr/@w:tblpX"> 1188 <xsl:variable name="x_distance_from_anchor"> 1189 <xsl:call-template name="ConvertMeasure"> 1190 <xsl:with-param name="TargetMeasure" select="'in'"/> 1191 <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpX, 'twip' ) "/> 1192 </xsl:call-template> 1193 </xsl:variable> 1194 <xsl:attribute name="svg:x"> 1195 <xsl:value-of select="concat ($x_distance_from_anchor, 'in' )"/> 1196 </xsl:attribute> 1197 </xsl:if> 1198 <xsl:if test="w:tblPr/w:tblpPr/@w:tblpY"> 1199 <xsl:variable name="y_distance_from_anchor"> 1200 <xsl:call-template name="ConvertMeasure"> 1201 <xsl:with-param name="TargetMeasure" select="'in'"/> 1202 <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpY, 'twip' ) "/> 1203 </xsl:call-template> 1204 </xsl:variable> 1205 <xsl:attribute name="svg:y"> 1206 <xsl:value-of select="concat ($y_distance_from_anchor, 'in' )"/> 1207 </xsl:attribute> 1208 </xsl:if> 1209 <!--create table in draw:text-box to produce table wrapping text effect--> 1210 <xsl:element name="draw:text-box"> 1211 <xsl:element name="table:table"> 1212 <xsl:if test="w:tblPr"> 1213 <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/> 1214 </xsl:attribute> 1215 </xsl:if> 1216 <xsl:apply-templates mode="dispatch"/> 1217 </xsl:element> 1218 </xsl:element> 1219 </xsl:element> 1220 <!--draw:text-box end --> 1221 </xsl:element> 1222 <!-- text:p end --> 1223 </xsl:when> 1224 <xsl:otherwise> 1225 <!-- if the table is not surrounded by text then put the table into a draw:text-box --> 1226 <xsl:element name="table:table"> 1227 <xsl:if test="w:tblPr"> 1228 <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/> 1229 </xsl:attribute> 1230 </xsl:if> 1231 <xsl:apply-templates mode="dispatch"/> 1232 </xsl:element> 1233 </xsl:otherwise> 1234 </xsl:choose> 1235 </xsl:template> 1236 <xsl:template match="w:tblGrid"> 1237 <xsl:apply-templates select="w:gridCol"/> 1238 </xsl:template> 1239 <xsl:template match="w:gridCol"> 1240 <xsl:element name="table:table-column"> 1241 <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/> 1242 </xsl:attribute> 1243 </xsl:element> 1244 </xsl:template> 1245 <xsl:template match="w:tr"> 1246 <xsl:element name="table:table-row"> 1247 <!-- generate row in table and add attribute of table:style-name if the style:style exists. cp tom chen. --> 1248 <xsl:if test="w:trPr/w:trHeight"> 1249 <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/> 1250 </xsl:attribute> 1251 </xsl:if> 1252 <xsl:apply-templates mode="dispatch"/> 1253 </xsl:element> 1254 </xsl:template> 1255 <xsl:template match="w:tc"> 1256 <xsl:element name="table:table-cell"> 1257 <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/> 1258 </xsl:attribute> 1259 <xsl:if test="w:tcPr/w:gridSpan and w:tcPr/w:gridSpan/@w:val > 0"> 1260 <xsl:attribute name="table:number-columns-spanned"> 1261 <xsl:value-of select="w:tcPr/w:gridSpan/@w:val"/> 1262 </xsl:attribute> 1263 </xsl:if> 1264 <xsl:apply-templates mode="dispatch"/> 1265 </xsl:element> 1266 </xsl:template> 1267 <xsl:template name="convert2in_special"> 1268 <!-- this template is specially to deal with w:type ='dxa' situation --> 1269 <xsl:param name="orignal_value"/> 1270 <xsl:choose> 1271 <xsl:when test="contains($orignal_value, 'dxa') "> 1272 <xsl:variable name="table_measurement_new_value"> 1273 <xsl:value-of select="concat( substring-before($orignal_value,'dxa'), 'twip')"/> 1274 </xsl:variable> 1275 <xsl:call-template name="ConvertMeasure"> 1276 <xsl:with-param name="TargetMeasure" select="'in'"/> 1277 <xsl:with-param name="value" select="$table_measurement_new_value"/> 1278 </xsl:call-template> 1279 </xsl:when> 1280 </xsl:choose> 1281 </xsl:template> 1282</xsl:stylesheet> 1283