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="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xalan="http://xml.apache.org/xalan" xmlns:oleextracter="MyOleExtracter" xmlns:ole="java:com.sun.star.comp.xsltfilter.XSLTFilterOLEExtracter" xmlns:java="http://saxon.sf.net/java-type" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw xalan ole oleextracter java" extension-element-prefixes="oleextracter"> 25 <xsl:include href="ooo2wordml_custom_draw.xsl"/> 26 <xsl:param name="oleExtractor" as="java:com.sun.star.comp.xsltfilter.XSLTFilterOLEExtracter" select="ole:new()"/> 27 <xsl:param name="XMultiServiceFactory" as="java:com.sun.star.lang.XMultiServiceFactory" select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/> 28 29 <xsl:key name="stroke-dash-style" match="draw:stroke-dash" use="@draw:name"/> 30 <xsl:key name="fill-image" match="draw:fill-image" use="@draw:name"/> 31 <xsl:key name="draw-gradient" match="draw:gradient " use="@draw:name"/> 32 <xsl:template name="PageLevelGraphic"> 33 <xsl:for-each select="//draw:*[@text:anchor-type='page']"> 34 <xsl:apply-templates select="."/> 35 </xsl:for-each> 36 </xsl:template> 37 <xsl:template match="draw:*"> 38 <xsl:param name="TargetMeasure" select="'pt'"/> 39 <xsl:param name="x-adjust" select="0"/> 40 <xsl:param name="y-adjust" select="0"/> 41 <xsl:param name="force-draw" select="'false'"/> 42 <xsl:variable name="MeasureMark"> 43 <xsl:choose> 44 <xsl:when test="$TargetMeasure = 'twip'"/> 45 <xsl:otherwise> 46 <xsl:value-of select="$TargetMeasure"/> 47 </xsl:otherwise> 48 </xsl:choose> 49 </xsl:variable> 50 <xsl:choose> 51 <!-- 52 deal with captions and frames first. draw:text-box is a powerfull element in OOo, its GUI name is frame. And OOo use it to contain Captions 53 Since there is not a corresponding object in word, so we draw the text-box itself and its children separately. If it look like a Caption only frame 54 we'll adjust the text-box position to make it look pretty 55 --> 56 <!-- skip all not force draw children , must be first case --> 57 <xsl:when test="ancestor::draw:text-box and $force-draw='false' "/> 58 <xsl:when test="name() = 'draw:text-box'"> 59 <!-- draw the text-box itself --> 60 <w:r> 61 <w:pict> 62 <xsl:variable name="text-y-adjust"> 63 <xsl:choose> 64 <xsl:when test="count(text:p/draw:*) = 1 and (string-length(text:p/draw:*[position()=1]/@svg:x) =0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0) and (string-length(text:p/draw:*[position()=1]/@svg:y)=0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0 ) "> 65 <xsl:variable name="pic-height"> 66 <xsl:choose> 67 <xsl:when test="name(text:p/draw:*[position()=1]) = 'draw:g' or name(text:p/draw:*[position()=1]) = 'draw:a'"> 68 <xsl:variable name="BigestWindow"> 69 <xsl:call-template name="GetWindowSize"> 70 <xsl:with-param name="nodeSet" select="text:p/draw:*[position()=1]/draw:*"/> 71 <xsl:with-param name="x-adjust" select="$x-adjust"/> 72 <xsl:with-param name="y-adjust" select="$y-adjust"/> 73 </xsl:call-template> 74 </xsl:variable> 75 <xsl:value-of select="number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')) + number(concat('0',translate($y-adjust,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','')))"/> 76 </xsl:when> 77 <xsl:when test="text:p/draw:*[position()=1]/@svg:height"> 78 <xsl:call-template name="Add-With-Measure"> 79 <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@svg:height"/> 80 <xsl:with-param name="value2" select="$y-adjust"/> 81 </xsl:call-template> 82 </xsl:when> 83 <xsl:when test="text:p/draw:*[position()=1]/@fo:min-height"> 84 <xsl:call-template name="Add-With-Measure"> 85 <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@fo:min-height"/> 86 <xsl:with-param name="value2" select="$y-adjust"/> 87 </xsl:call-template> 88 </xsl:when> 89 <xsl:when test="ancestor::draw:frame"> 90 <xsl:call-template name="Add-With-Measure"> 91 <xsl:with-param name="value1" select="ancestor::draw:frame/@svg:height"/> 92 <xsl:with-param name="value2" select="$y-adjust"/> 93 </xsl:call-template> 94 </xsl:when> 95 </xsl:choose> 96 </xsl:variable> 97 <xsl:variable name="min-height"> 98 <xsl:call-template name="ConvertMeasure"> 99 <xsl:with-param name="TargetMeasure" select="'in'"/> 100 <xsl:with-param name="value" select="@fo:min-height"/> 101 </xsl:call-template> 102 </xsl:variable> 103 <xsl:choose> 104 <xsl:when test="$min-height - $pic-height < 0.001"> 105 <!-- If control goes here, it much like that this text-box is used for containt graphic caption only --> 106 <xsl:value-of select="$pic-height - 0.1"/> 107 </xsl:when> 108 <xsl:otherwise> 109 <xsl:value-of select="$y-adjust"/> 110 </xsl:otherwise> 111 </xsl:choose> 112 </xsl:when> 113 <xsl:otherwise> 114 <xsl:value-of select="$y-adjust"/> 115 </xsl:otherwise> 116 </xsl:choose> 117 </xsl:variable> 118 <xsl:variable name="shape-type"> 119 <xsl:choose> 120 <xsl:when test="$text-y-adjust = $y-adjust"> 121 <xsl:value-of select="'#_x0000_t202'"/> 122 </xsl:when> 123 </xsl:choose> 124 </xsl:variable> 125 <xsl:call-template name="DrawElements"> 126 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 127 <xsl:with-param name="x-adjust" select="$x-adjust"/> 128 <xsl:with-param name="y-adjust" select="$text-y-adjust"/> 129 <xsl:with-param name="force-draw" select="'true'"/> 130 <xsl:with-param name="shape-type" select="$shape-type"/> 131 </xsl:call-template> 132 </w:pict> 133 </w:r> 134 <!-- draw the real object first --> 135 <xsl:if test="./text:p/draw:*"> 136 <xsl:apply-templates select="./text:p/draw:*"> 137 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 138 <xsl:with-param name="x-adjust"> 139 <xsl:call-template name="Add-With-Measure"> 140 <xsl:with-param name="value1" select="@svg:x"/> 141 <xsl:with-param name="value2" select="$x-adjust"/> 142 </xsl:call-template> 143 </xsl:with-param> 144 <xsl:with-param name="y-adjust"> 145 <xsl:call-template name="Add-With-Measure"> 146 <xsl:with-param name="value1" select="@svg:y"/> 147 <xsl:with-param name="value2" select="$y-adjust"/> 148 </xsl:call-template> 149 </xsl:with-param> 150 <xsl:with-param name="force-draw" select="'true'"/> 151 </xsl:apply-templates> 152 </xsl:if> 153 </xsl:when> 154 <!-- end deal with captions and frames --> 155 <xsl:when test=" name() = 'draw:frame' "> 156 <xsl:variable name="BigestWindow"> 157 <xsl:call-template name="GetWindowSize"> 158 <xsl:with-param name="nodeSet" select="."/> 159 <xsl:with-param name="x-adjust" select="$x-adjust"/> 160 <xsl:with-param name="y-adjust" select="$y-adjust"/> 161 </xsl:call-template> 162 </xsl:variable> 163 <xsl:apply-templates select="draw:* "> 164 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 165 <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> 166 <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> 167 <xsl:with-param name="force-draw" select="$force-draw"/> 168 </xsl:apply-templates> 169 </xsl:when> 170 <xsl:when test="name() = 'draw:g'"> 171 <w:r> 172 <w:pict> 173 <xsl:element name="v:group"> 174 <xsl:variable name="BigestWindow"> 175 <xsl:choose> 176 <xsl:when test="name() = 'draw:g'"> 177 <xsl:call-template name="GetWindowSize"> 178 <xsl:with-param name="nodeSet" select="draw:*"/> 179 <xsl:with-param name="x-adjust" select="$x-adjust"/> 180 <xsl:with-param name="y-adjust" select="$y-adjust"/> 181 </xsl:call-template> 182 </xsl:when> 183 <xsl:when test="name() = 'draw:frame'"> 184 <xsl:call-template name="GetWindowSize"> 185 <xsl:with-param name="nodeSet" select="."/> 186 <xsl:with-param name="x-adjust" select="$x-adjust"/> 187 <xsl:with-param name="y-adjust" select="$y-adjust"/> 188 </xsl:call-template> 189 </xsl:when> 190 </xsl:choose> 191 </xsl:variable> 192 <xsl:variable name="x"> 193 <xsl:call-template name="ConvertMeasure"> 194 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 195 <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> 196 </xsl:call-template> 197 </xsl:variable> 198 <xsl:variable name="y"> 199 <xsl:call-template name="ConvertMeasure"> 200 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 201 <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> 202 </xsl:call-template> 203 </xsl:variable> 204 <xsl:variable name="width"> 205 <xsl:call-template name="ConvertMeasure"> 206 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 207 <xsl:with-param name="value" select="concat(number(substring-after(substring-before($BigestWindow,';y2'), 'x2:')) - number(substring-after(substring-before($BigestWindow,';y1'), 'x1:')) , 'in')"/> 208 </xsl:call-template> 209 </xsl:variable> 210 <xsl:variable name="height"> 211 <xsl:call-template name="ConvertMeasure"> 212 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 213 <xsl:with-param name="value" select="concat(number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')), 'in')"/> 214 </xsl:call-template> 215 </xsl:variable> 216 <xsl:attribute name="id"> 217 <xsl:value-of select="generate-id()"/> 218 </xsl:attribute> 219 <xsl:variable name="absolute"> 220 <xsl:choose> 221 <xsl:when test="ancestor::draw:a"/> 222 <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/> 223 <xsl:otherwise>position:absolute</xsl:otherwise> 224 </xsl:choose> 225 </xsl:variable> 226 <xsl:if test="$TargetMeasure= 'pt'"> 227 <xsl:attribute name="style"> 228 <xsl:if test="string-length($absolute) > 0"> 229 <xsl:value-of select="concat($absolute, ';')"/> 230 </xsl:if> 231 <xsl:value-of select="concat('margin-left:',$x ,$MeasureMark,';margin-top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/> 232 </xsl:attribute> 233 <xsl:attribute name="coordorigin"> 234 <xsl:choose> 235 <!-- if we are in a text-box then oo will use comparative positions on us--> 236 <xsl:when test="name() = 'draw:frame' "> 237 <xsl:value-of select=" '0 0' "/> 238 </xsl:when> 239 <xsl:otherwise> 240 <xsl:value-of select="concat(round($x * 20), ',' , round($y * 20))"/> 241 </xsl:otherwise> 242 </xsl:choose> 243 </xsl:attribute> 244 <xsl:attribute name="coordsize"> 245 <xsl:value-of select="concat(round($width * 20),',', round($height * 20) )"/> 246 </xsl:attribute> 247 </xsl:if> 248 <xsl:if test="$TargetMeasure= 'twip' "> 249 <xsl:attribute name="style"> 250 <xsl:if test="string-length($absolute) > 0"> 251 <xsl:value-of select="concat($absolute, ';')"/> 252 </xsl:if> 253 <xsl:value-of select="concat('left:',$x ,$MeasureMark,';top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/> 254 </xsl:attribute> 255 <xsl:attribute name="coordorigin"> 256 <xsl:choose> 257 <!-- if we are in a text-box then oo will use comparative positions on us--> 258 <xsl:when test="name() = 'draw:frame' "> 259 <xsl:value-of select=" '0 0' "/> 260 </xsl:when> 261 <xsl:otherwise> 262 <xsl:value-of select="concat($x , ',' , $y)"/> 263 </xsl:otherwise> 264 </xsl:choose> 265 </xsl:attribute> 266 <xsl:attribute name="coordsize"> 267 <xsl:value-of select="concat($width,',', $height )"/> 268 </xsl:attribute> 269 </xsl:if> 270 <xsl:choose> 271 <!-- if we are in a text-box then oo will use comparative positions on us--> 272 <xsl:when test="ancestor::draw:text-box"> 273 <xsl:apply-templates select="draw:*"> 274 <xsl:with-param name="TargetMeasure" select="'twip'"/> 275 <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> 276 <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> 277 <xsl:with-param name="force-draw" select="$force-draw"/> 278 </xsl:apply-templates> 279 </xsl:when> 280 <xsl:otherwise> 281 <xsl:apply-templates select="draw:*"> 282 <xsl:with-param name="TargetMeasure" select="'twip'"/> 283 <xsl:with-param name="force-draw" select="$force-draw"/> 284 </xsl:apply-templates> 285 </xsl:otherwise> 286 </xsl:choose> 287 </xsl:element> 288 </w:pict> 289 </w:r> 290 </xsl:when> 291 <xsl:otherwise> 292 <xsl:choose> 293 <xsl:when test="name() = 'draw:a'"> 294 <xsl:call-template name="export_hyoerlink"> 295 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 296 <xsl:with-param name="x-adjust" select="$x-adjust"/> 297 <xsl:with-param name="y-adjust" select="$y-adjust"/> 298 <xsl:with-param name="force-draw" select="$force-draw"/> 299 </xsl:call-template> 300 </xsl:when> 301 <xsl:otherwise> 302 <w:r> 303 <w:pict> 304 <xsl:call-template name="DrawElements"> 305 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 306 <xsl:with-param name="x-adjust" select="$x-adjust"/> 307 <xsl:with-param name="y-adjust" select="$y-adjust"/> 308 <xsl:with-param name="force-draw" select="$force-draw"/> 309 </xsl:call-template> 310 </w:pict> 311 </w:r> 312 </xsl:otherwise> 313 </xsl:choose> 314 </xsl:otherwise> 315 </xsl:choose> 316 </xsl:template> 317 <xsl:template name="GetWindowSize"> 318 <xsl:param name="CurrPos" select="1"/> 319 <xsl:param name="nodeSet"/> 320 <xsl:param name="x-adjust" select="0"/> 321 <xsl:param name="y-adjust" select="0"/> 322 <xsl:variable name="CurrNodeWindow"> 323 <xsl:call-template name="GetNodeWindow"> 324 <xsl:with-param name="CurrNode" select=" $nodeSet[ $CurrPos ]"/> 325 <xsl:with-param name="x-adjust" select="$x-adjust"/> 326 <xsl:with-param name="y-adjust" select="$y-adjust"/> 327 </xsl:call-template> 328 </xsl:variable> 329 <xsl:choose> 330 <!-- if we got to the last node, return it directly, or return the max window of current one and follwing ones --> 331 <xsl:when test="$CurrPos = count($nodeSet)"> 332 <xsl:value-of select="$CurrNodeWindow"/> 333 </xsl:when> 334 <xsl:otherwise> 335 <xsl:variable name="CurrentWindow"> 336 <xsl:variable name="FollowingWindow"> 337 <xsl:call-template name="GetWindowSize"> 338 <xsl:with-param name="nodeSet" select="$nodeSet"/> 339 <xsl:with-param name="CurrPos" select="$CurrPos + 1"/> 340 <xsl:with-param name="x-adjust" select="$x-adjust"/> 341 <xsl:with-param name="y-adjust" select="$y-adjust"/> 342 </xsl:call-template> 343 </xsl:variable> 344 <xsl:call-template name="GetBigestWindows"> 345 <xsl:with-param name="Window1" select="$CurrNodeWindow"/> 346 <xsl:with-param name="Window2" select="$FollowingWindow"/> 347 </xsl:call-template> 348 </xsl:variable> 349 <xsl:value-of select="$CurrentWindow"/> 350 </xsl:otherwise> 351 </xsl:choose> 352 </xsl:template> 353 <xsl:template name="GetNodeWindow"> 354 <xsl:param name="CurrNode"/> 355 <xsl:param name="x-adjust" select="0"/> 356 <xsl:param name="y-adjust" select="0"/> 357 <xsl:choose> 358 <xsl:when test="name($CurrNode)='draw:g'"> 359 <xsl:call-template name="GetWindowSize"> 360 <xsl:with-param name="nodeSet" select="$CurrNode/draw:*"/> 361 <xsl:with-param name="x-adjust" select="$x-adjust"/> 362 <xsl:with-param name="y-adjust" select="$y-adjust"/> 363 </xsl:call-template> 364 </xsl:when> 365 <xsl:otherwise> 366 <xsl:variable name="x"> 367 <xsl:call-template name="Add-With-Measure"> 368 <xsl:with-param name="value1" select="$CurrNode/@svg:x"/> 369 <xsl:with-param name="value2" select="$x-adjust"/> 370 </xsl:call-template> 371 </xsl:variable> 372 <xsl:variable name="y"> 373 <xsl:call-template name="Add-With-Measure"> 374 <xsl:with-param name="value1" select="$CurrNode/@svg:y"/> 375 <xsl:with-param name="value2" select="$y-adjust"/> 376 </xsl:call-template> 377 </xsl:variable> 378 <xsl:variable name="width"> 379 <xsl:call-template name="ConvertMeasure"> 380 <xsl:with-param name="value" select="$CurrNode/@svg:width"/> 381 <xsl:with-param name="TargetMeasure" select="'in'"/> 382 </xsl:call-template> 383 </xsl:variable> 384 <xsl:variable name="height"> 385 <xsl:choose> 386 <xsl:when test="$CurrNode/@svg:height"> 387 <xsl:call-template name="ConvertMeasure"> 388 <xsl:with-param name="value" select="$CurrNode/@svg:height"/> 389 <xsl:with-param name="TargetMeasure" select="'in'"/> 390 </xsl:call-template> 391 </xsl:when> 392 <xsl:when test="$CurrNode/@fo:min-height"> 393 <xsl:call-template name="ConvertMeasure"> 394 <xsl:with-param name="value" select="$CurrNode/@fo:min-height"/> 395 <xsl:with-param name="TargetMeasure" select="'in'"/> 396 </xsl:call-template> 397 </xsl:when> 398 <xsl:otherwise>0</xsl:otherwise> 399 </xsl:choose> 400 </xsl:variable> 401 <xsl:value-of select="concat('x1:' , $x, ';y1:' , $y, ';x2:' , string($x + $width), ';y2:', string($y + $height) ) "/> 402 </xsl:otherwise> 403 </xsl:choose> 404 </xsl:template> 405 <xsl:template name="GetBigestWindows"> 406 <xsl:param name="Window1"/> 407 <xsl:param name="Window2"/> 408 <xsl:variable name="w1x1" select="substring-after( substring-before($Window1,';y1'),'x1:') "/> 409 <xsl:variable name="w2x1" select="substring-after( substring-before($Window2,';y1'),'x1:') "/> 410 <xsl:variable name="w1y1" select="substring-after( substring-before($Window1,';x2'),'y1:') "/> 411 <xsl:variable name="w2y1" select="substring-after( substring-before($Window2,';x2'),'y1:') "/> 412 <xsl:variable name="w1x2" select="substring-after( substring-before($Window1,';y2'),'x2:') "/> 413 <xsl:variable name="w2x2" select="substring-after( substring-before($Window2,';y2'),'x2:') "/> 414 <xsl:variable name="w1y2" select="substring-after( $Window1,';y2:') "/> 415 <xsl:variable name="w2y2" select="substring-after( $Window2,';y2:') "/> 416 <xsl:variable name="x1"> 417 <xsl:choose> 418 <xsl:when test="$w1x1 > $w2x1"> 419 <xsl:value-of select="$w2x1"/> 420 </xsl:when> 421 <xsl:otherwise> 422 <xsl:value-of select="$w1x1"/> 423 </xsl:otherwise> 424 </xsl:choose> 425 </xsl:variable> 426 <xsl:variable name="y1"> 427 <xsl:choose> 428 <xsl:when test="$w1y1 > $w2y1"> 429 <xsl:value-of select="$w2y1"/> 430 </xsl:when> 431 <xsl:otherwise> 432 <xsl:value-of select="$w1y1"/> 433 </xsl:otherwise> 434 </xsl:choose> 435 </xsl:variable> 436 <xsl:variable name="x2"> 437 <xsl:choose> 438 <xsl:when test="$w1x2 > $w2x2"> 439 <xsl:value-of select="$w1x2"/> 440 </xsl:when> 441 <xsl:otherwise> 442 <xsl:value-of select="$w2x2"/> 443 </xsl:otherwise> 444 </xsl:choose> 445 </xsl:variable> 446 <xsl:variable name="y2"> 447 <xsl:choose> 448 <xsl:when test="$w1y2 > $w2y2"> 449 <xsl:value-of select="$w1y2"/> 450 </xsl:when> 451 <xsl:otherwise> 452 <xsl:value-of select="$w2y2"/> 453 </xsl:otherwise> 454 </xsl:choose> 455 </xsl:variable> 456 <xsl:value-of select="concat('x1:' , $x1 , ';y1:' , $y1 , ';x2:' , $x2, ';y2:' , $y2)"/> 457 </xsl:template> 458 <!-- convert percent value to x% numeric x/100 --> 459 <xsl:template name="ValueOfPercent"> 460 <xsl:param name="value"/> 461 <xsl:choose> 462 <xsl:when test="contains($value, '%')"> 463 <xsl:value-of select="substring-before($value, '%') div 100"/> 464 </xsl:when> 465 </xsl:choose> 466 </xsl:template> 467 <xsl:template name="points2points"> 468 <xsl:param name="input_points"/> 469 <xsl:param name="input_x"/> 470 <xsl:param name="input_y"/> 471 <xsl:param name="input_width"/> 472 <xsl:param name="input_height"/> 473 <xsl:param name="input_boxwidth"/> 474 <xsl:param name="input_boxheight"/> 475 <xsl:variable name="onepoint" select="substring($input_points,1,string-length($input_points) - string-length(substring-after($input_points,' ')) )"/> 476 <xsl:if test="substring-before($input_points,' ')"> 477 <xsl:value-of select="round($input_x + (($input_boxwidth - number(substring-before($onepoint,','))) ) * $input_width div $input_boxwidth)"/> 478 <xsl:value-of select="'pt,'"/> 479 <xsl:value-of select="round($input_y + ((number(substring-after($onepoint,',')) ) ) * $input_height div $input_boxheight)"/> 480 <xsl:value-of select="'pt'"/> 481 </xsl:if> 482 <xsl:if test="string-length(substring($input_points,string-length($onepoint) + 1)) > 0"> 483 <xsl:value-of select="','"/> 484 <xsl:call-template name="points2points"> 485 <xsl:with-param name="input_points" select="substring($input_points,string-length($onepoint) + 1)"/> 486 <xsl:with-param name="input_x" select="$input_x"/> 487 <xsl:with-param name="input_y" select="$input_y"/> 488 <xsl:with-param name="input_width" select="$input_width"/> 489 <xsl:with-param name="input_height" select="$input_height"/> 490 <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/> 491 <xsl:with-param name="input_boxheight" select="$input_boxheight"/> 492 </xsl:call-template> 493 </xsl:if> 494 </xsl:template> 495 <xsl:template name="path2path"> 496 <xsl:param name="input_points"/> 497 <xsl:param name="x_or_y" select="'x'"/> 498 <xsl:param name="input_x"/> 499 <xsl:param name="input_y"/> 500 <xsl:param name="input_width"/> 501 <xsl:param name="input_height"/> 502 <xsl:param name="input_boxwidth"/> 503 <xsl:param name="input_boxheight"/> 504 <xsl:variable name="space-pos" select="string-length($input_points) - string-length(substring-after($input_points,' '))"/> 505 <xsl:variable name="minus-pos" select="string-length($input_points) - string-length(substring-after($input_points,'-'))"/> 506 <xsl:variable name="m-pos" select="string-length($input_points) - string-length(substring-after($input_points,'m'))"/> 507 <xsl:variable name="c-pos" select="string-length($input_points) - string-length(substring-after($input_points,'c'))"/> 508 <xsl:variable name="e-pos" select="string-length($input_points) - string-length(substring-after($input_points,'e'))"/> 509 <xsl:variable name="min1"> 510 <xsl:choose> 511 <xsl:when test="$space-pos < $minus-pos"> 512 <xsl:value-of select="$space-pos"/> 513 </xsl:when> 514 <xsl:otherwise> 515 <xsl:value-of select="$minus-pos"/> 516 </xsl:otherwise> 517 </xsl:choose> 518 </xsl:variable> 519 <xsl:variable name="min2"> 520 <xsl:choose> 521 <xsl:when test="$m-pos < $min1"> 522 <xsl:value-of select="$m-pos"/> 523 </xsl:when> 524 <xsl:otherwise> 525 <xsl:value-of select="$min1"/> 526 </xsl:otherwise> 527 </xsl:choose> 528 </xsl:variable> 529 <xsl:variable name="min3"> 530 <xsl:choose> 531 <xsl:when test="$c-pos < $min2"> 532 <xsl:value-of select="$c-pos"/> 533 </xsl:when> 534 <xsl:otherwise> 535 <xsl:value-of select="$min2"/> 536 </xsl:otherwise> 537 </xsl:choose> 538 </xsl:variable> 539 <xsl:variable name="min4"> 540 <xsl:choose> 541 <xsl:when test="$e-pos < $min3"> 542 <xsl:value-of select="$e-pos"/> 543 </xsl:when> 544 <xsl:otherwise> 545 <xsl:value-of select="$min3"/> 546 </xsl:otherwise> 547 </xsl:choose> 548 </xsl:variable> 549 <xsl:variable name="min-special-char-pos" select="$min4"/> 550 <xsl:variable name="special-char" select="substring($input_points,$min-special-char-pos,1)"/> 551 <xsl:variable name="one-value" select="substring($input_points,1,$min-special-char-pos - 1)"/> 552 <xsl:variable name="left-points" select="substring($input_points,$min-special-char-pos + 1)"/> 553 <xsl:if test="not($special-char = 'm')"> 554 <xsl:if test="$x_or_y = 'x'"> 555 <xsl:value-of select="round($input_x + $one-value * $input_width div $input_boxwidth)"/> 556 </xsl:if> 557 <xsl:if test="$x_or_y = 'y'"> 558 <xsl:value-of select="round($input_y + $one-value * $input_height div $input_boxheight)"/> 559 </xsl:if> 560 </xsl:if> 561 <!-- output the separator--> 562 <xsl:choose> 563 <xsl:when test="$special-char = '-' or $special-char = ' ' "> 564 <xsl:value-of select="','"/> 565 </xsl:when> 566 <xsl:otherwise> 567 <xsl:value-of select="$special-char"/> 568 </xsl:otherwise> 569 </xsl:choose> 570 <xsl:variable name="next-xy"> 571 <xsl:if test="$x_or_y = 'x'"> 572 <xsl:value-of select="'y'"/> 573 </xsl:if> 574 <xsl:if test="$x_or_y = 'y'"> 575 <xsl:value-of select="'x'"/> 576 </xsl:if> 577 </xsl:variable> 578 <xsl:if test="string-length($left-points) > 0"> 579 <xsl:call-template name="path2path"> 580 <xsl:with-param name="input_points" select="$left-points"/> 581 <xsl:with-param name="x_or_y" select="$next-xy"/> 582 <xsl:with-param name="input_x" select="$input_x"/> 583 <xsl:with-param name="input_y" select="$input_y"/> 584 <xsl:with-param name="input_width" select="$input_width"/> 585 <xsl:with-param name="input_height" select="$input_height"/> 586 <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/> 587 <xsl:with-param name="input_boxheight" select="$input_boxheight"/> 588 </xsl:call-template> 589 </xsl:if> 590 </xsl:template> 591 <xsl:template name="get_dashstyle"> 592 <xsl:param name="stroke-width" select="0.1"/> 593 <xsl:param name="style-name" select="@draw:style-name"/> 594 <xsl:variable name="graph-style" select="key('graphics-style', $style-name)/style:graphic-properties"/> 595 <xsl:variable name="dash-style" select="key('stroke-dash-style', $graph-style/@draw:stroke-dash)"/> 596 <xsl:variable name="stroke"> 597 <xsl:choose> 598 <xsl:when test="$graph-style/@draw:stroke"> 599 <xsl:value-of select="$graph-style/@draw:stroke"/> 600 </xsl:when> 601 <xsl:when test="$dash-style/@draw:stroke"> 602 <xsl:value-of select="$dash-style/@draw:stroke"/> 603 </xsl:when> 604 </xsl:choose> 605 </xsl:variable> 606 <xsl:choose> 607 <xsl:when test="$stroke = 'solid' "> 608 <xsl:value-of select="$stroke"/> 609 </xsl:when> 610 <xsl:when test="$stroke = 'dash'"> 611 <xsl:variable name="dots1"> 612 <xsl:choose> 613 <xsl:when test="$graph-style/@draw:dots1"> 614 <xsl:value-of select="$graph-style/@draw:dots1"/> 615 </xsl:when> 616 <xsl:when test="$dash-style/@draw:dots1"> 617 <xsl:value-of select="$dash-style/@draw:dots1"/> 618 </xsl:when> 619 <xsl:otherwise>0</xsl:otherwise> 620 </xsl:choose> 621 </xsl:variable> 622 <xsl:variable name="dots2"> 623 <xsl:choose> 624 <xsl:when test="$graph-style/@draw:dots1"> 625 <xsl:value-of select="$graph-style/@draw:dots2"/> 626 </xsl:when> 627 <xsl:when test="$dash-style/@draw:dots1"> 628 <xsl:value-of select="$dash-style/@draw:dots2"/> 629 </xsl:when> 630 <xsl:otherwise>0</xsl:otherwise> 631 </xsl:choose> 632 </xsl:variable> 633 <xsl:variable name="dots1-length"> 634 <xsl:choose> 635 <xsl:when test="$graph-style/@draw:dots1-length"> 636 <xsl:value-of select="$graph-style/@draw:dots1-length"/> 637 </xsl:when> 638 <xsl:when test="$dash-style/@draw:dots1-length"> 639 <xsl:value-of select="$dash-style/@draw:dots1-length"/> 640 </xsl:when> 641 <xsl:otherwise>0</xsl:otherwise> 642 </xsl:choose> 643 </xsl:variable> 644 <xsl:variable name="dots2-length"> 645 <xsl:choose> 646 <xsl:when test="$graph-style/@draw:dots2-length"> 647 <xsl:value-of select="$graph-style/@draw:dots2-length"/> 648 </xsl:when> 649 <xsl:when test="$dash-style/@draw:dots2-length"> 650 <xsl:value-of select="$dash-style/@draw:dots2-length"/> 651 </xsl:when> 652 <xsl:otherwise>0</xsl:otherwise> 653 </xsl:choose> 654 </xsl:variable> 655 <xsl:variable name="distance"> 656 <xsl:choose> 657 <xsl:when test="$graph-style/@draw:distance"> 658 <xsl:value-of select="$graph-style/@draw:distance"/> 659 </xsl:when> 660 <xsl:when test="$dash-style/@draw:distance"> 661 <xsl:value-of select="$dash-style/@draw:distance"/> 662 </xsl:when> 663 <xsl:otherwise>0</xsl:otherwise> 664 </xsl:choose> 665 </xsl:variable> 666 <xsl:variable name="dot1-step"> 667 <xsl:choose> 668 <xsl:when test="contains($dots1-length,'%')"> 669 <xsl:variable name="dots-percent"> 670 <xsl:call-template name="ValueOfPercent"> 671 <xsl:with-param name="value" select="$dots1-length"/> 672 </xsl:call-template> 673 </xsl:variable> 674 <xsl:value-of select="round($dots-percent)"/> 675 </xsl:when> 676 <xsl:when test="contains($dots1-length , 'in' ) and $stroke-width > 0"> 677 <xsl:value-of select="round( number(substring-before($dots1-length,'in' )) div $stroke-width )"/> 678 </xsl:when> 679 <xsl:otherwise>0</xsl:otherwise> 680 </xsl:choose> 681 </xsl:variable> 682 <xsl:variable name="dot2-step"> 683 <xsl:choose> 684 <xsl:when test="contains($dots2-length,'%')"> 685 <xsl:variable name="dots-percent"> 686 <xsl:call-template name="ValueOfPercent"> 687 <xsl:with-param name="value" select="$dots2-length"/> 688 </xsl:call-template> 689 </xsl:variable> 690 <xsl:value-of select="round($dots-percent)"/> 691 </xsl:when> 692 <xsl:when test="contains($dots2-length,'in') and $stroke-width > 0"> 693 <xsl:value-of select="round(number(substring-before($dots2-length,'in')) div $stroke-width)"/> 694 </xsl:when> 695 <xsl:otherwise>0</xsl:otherwise> 696 </xsl:choose> 697 </xsl:variable> 698 <xsl:variable name="distance-step"> 699 <xsl:choose> 700 <xsl:when test="contains($distance,'%')"> 701 <xsl:variable name="dots-percent"> 702 <xsl:call-template name="ValueOfPercent"> 703 <xsl:with-param name="value" select="$distance"/> 704 </xsl:call-template> 705 </xsl:variable> 706 <xsl:value-of select="round($dots-percent)"/> 707 </xsl:when> 708 <xsl:when test="contains($distance,'in') and $stroke-width > 0"> 709 <xsl:value-of select="round(number(substring-before($distance,'in')) div $stroke-width)"/> 710 </xsl:when> 711 <xsl:otherwise>1</xsl:otherwise> 712 </xsl:choose> 713 </xsl:variable> 714 <xsl:variable name="dashstyle"> 715 <xsl:choose> 716 <xsl:when test="$dots1 = 1 and $dots2 = 1 and $dot1-step = 0 and $dot2-step = 0 and $distance-step = 0"> 717 <xsl:value-of select="'ShortDot'"/> 718 </xsl:when> 719 <xsl:when test="$dots2 = 0 and $dot1-step = 0 and $dot2-step = 0 and $distance-step > 0"> 720 <xsl:value-of select="concat('0 ', $distance-step)"/> 721 </xsl:when> 722 <xsl:otherwise> 723 <xsl:call-template name="create_dashstyle"> 724 <xsl:with-param name="dot-count" select="$dots1"/> 725 <xsl:with-param name="dot-step" select="$dot1-step"/> 726 <xsl:with-param name="distance-step" select="$distance-step"/> 727 </xsl:call-template> 728 <xsl:value-of select="' '"/> 729 <xsl:call-template name="create_dashstyle"> 730 <xsl:with-param name="dot-count" select="$dots2"/> 731 <xsl:with-param name="dot-step" select="$dot2-step"/> 732 <xsl:with-param name="distance-step" select="$distance-step"/> 733 </xsl:call-template> 734 </xsl:otherwise> 735 </xsl:choose> 736 </xsl:variable> 737 <xsl:value-of select="$dashstyle"/> 738 </xsl:when> 739 </xsl:choose> 740 </xsl:template> 741 <xsl:template name="create_dashstyle"> 742 <xsl:param name="dot-count"/> 743 <xsl:param name="dot-step"/> 744 <xsl:param name="distance-step"/> 745 <xsl:if test="$dot-count > 0"> 746 <xsl:value-of select="concat($dot-step, ' ' , $distance-step )"/> 747 <xsl:if test="$dot-count - 1 > 0"> 748 <xsl:value-of select="' '"/> 749 <xsl:call-template name="create_dashstyle"> 750 <xsl:with-param name="dot-count" select="$dot-count - 1"/> 751 <xsl:with-param name="dot-step" select="$dot-step"/> 752 <xsl:with-param name="distance-step" select="$distance-step"/> 753 </xsl:call-template> 754 </xsl:if> 755 </xsl:if> 756 </xsl:template> 757 <xsl:template name="get_borderstyle"> 758 <xsl:param name="border"/> 759 <xsl:param name="border-line-width"/> 760 <xsl:choose> 761 <xsl:when test="contains($border,'solid')"> 762 <xsl:variable name="strokeweight"> 763 <xsl:call-template name="ConvertMeasure"> 764 <xsl:with-param name="value" select="substring-before($border, ' ')"/> 765 <xsl:with-param name="TargetMeasure" select="'pt'"/> 766 </xsl:call-template> 767 </xsl:variable> 768 <xsl:value-of select="concat ( 'strokeweight:', $strokeweight)"/> 769 </xsl:when> 770 <xsl:when test="contains($border,'double')"> 771 <xsl:variable name="outside"> 772 <xsl:call-template name="ConvertMeasure"> 773 <xsl:with-param name="value" select="substring-after(substring-after($border-line-width, ' ') , ' ')"/> 774 <xsl:with-param name="TargetMeasure" select="'pt'"/> 775 </xsl:call-template> 776 </xsl:variable> 777 <xsl:variable name="inside"> 778 <xsl:call-template name="ConvertMeasure"> 779 <xsl:with-param name="value" select="substring-before($border-line-width, ' ')"/> 780 <xsl:with-param name="TargetMeasure" select="'pt'"/> 781 </xsl:call-template> 782 </xsl:variable> 783 <xsl:variable name="space"> 784 <xsl:call-template name="ConvertMeasure"> 785 <xsl:with-param name="value" select="substring-before(substring-after($border-line-width, ' ') , ' ')"/> 786 <xsl:with-param name="TargetMeasure" select="'pt'"/> 787 </xsl:call-template> 788 </xsl:variable> 789 <xsl:variable name="linestyle"> 790 <xsl:choose> 791 <xsl:when test="$outside = $inside"> 792 <xsl:value-of select="'thinThin'"/> 793 </xsl:when> 794 <xsl:when test="$outside > $inside"> 795 <xsl:value-of select="'thickThin'"/> 796 </xsl:when> 797 <xsl:when test="$outside < $inside"> 798 <xsl:value-of select="'thinThick'"/> 799 </xsl:when> 800 </xsl:choose> 801 </xsl:variable> 802 <xsl:variable name="strokeweight" select="$inside + $outside + $space"/> 803 <xsl:value-of select="concat( 'linestyle:' , $linestyle , ';' , 'strokeweight:' , $strokeweight )"/> 804 </xsl:when> 805 </xsl:choose> 806 </xsl:template> 807 <xsl:template name="DrawElements"> 808 <xsl:param name="TargetMeasure" select="pt"/> 809 <xsl:param name="x-adjust" select="0"/> 810 <xsl:param name="y-adjust" select="0"/> 811 <xsl:param name="force-draw" select="'false'"/> 812 <xsl:param name="shape-type"/> 813 <xsl:variable name="MeasureMark"> 814 <xsl:choose> 815 <xsl:when test="$TargetMeasure = 'twip'"/> 816 <xsl:otherwise> 817 <xsl:value-of select="$TargetMeasure"/> 818 </xsl:otherwise> 819 </xsl:choose> 820 </xsl:variable> 821 <xsl:variable name="drawtextstyle" select="@draw:text-style-name"/> 822 <xsl:variable name="org-z-index"> 823 <xsl:choose> 824 <xsl:when test="@draw:z-index"> 825 <xsl:value-of select="number(concat('0',@draw:z-index))"/> 826 </xsl:when> 827 <xsl:when test="parent::draw:frame/@draw:z-index"> 828 <xsl:value-of select="number(concat('0',parent::draw:frame/@draw:z-index))"/> 829 </xsl:when> 830 <xsl:otherwise>0</xsl:otherwise> 831 </xsl:choose> 832 </xsl:variable> 833 <xsl:variable name="run-though" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:run-through"/> 834 <xsl:variable name="org-wrap" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:wrap"/> 835 <xsl:variable name="draw-name"> 836 <xsl:choose> 837 <xsl:when test="string-length(@draw:name) = 0"> 838 <xsl:value-of select="translate(ancestor::draw:frame[1]/@draw:name, ':/', '__')"/> 839 </xsl:when> 840 <xsl:otherwise> 841 <xsl:value-of select="translate(@draw:name, ':/', '__')"/> 842 </xsl:otherwise> 843 </xsl:choose> 844 </xsl:variable> 845 <xsl:variable name="style_name2key"> 846 <xsl:choose> 847 <xsl:when test="@draw:style-name"> 848 <xsl:value-of select="@draw:style-name"/> 849 </xsl:when> 850 <xsl:otherwise> 851 <xsl:if test="ancestor::draw:frame/@draw:style-name"> 852 <xsl:value-of select="ancestor::draw:frame/@draw:style-name"/> 853 </xsl:if> 854 </xsl:otherwise> 855 </xsl:choose> 856 </xsl:variable> 857 <xsl:variable name="draw-fill-type" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill"/> 858 <xsl:variable name="draw-gradient-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-gradient-name"/> 859 <xsl:variable name="horizontal-pos" select="key('graphics-style', $style_name2key)/style:graphic-properties/@style:horizontal-pos"/> 860 <!--horizontal-pos attribute is for the placement of all the drawing elements--> 861 <xsl:variable name="fill-image-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-image-name"/> 862 <xsl:if test="$draw-fill-type = 'bitmap' "> 863 <xsl:element name="w:binData"> 864 <xsl:attribute name="w:name"> 865 <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/> 866 </xsl:attribute> 867 <xsl:value-of select="translate(key('fill-image',$fill-image-name)/office:binary-data/text(),'	  ','' ) "/> 868 <!-- xsl:value-of select="office:binary-data/text()"/ --> 869 </xsl:element> 870 </xsl:if> 871 <xsl:variable name="z-index"> 872 <xsl:choose> 873 <xsl:when test="$run-though='foreground'"> 874 <!-- make sure z-index >=0 --> 875 <xsl:choose> 876 <xsl:when test="$org-z-index < 0">0</xsl:when> 877 <xsl:otherwise> 878 <xsl:value-of select="$org-z-index"/> 879 </xsl:otherwise> 880 </xsl:choose> 881 </xsl:when> 882 <xsl:when test="$run-though='background'"> 883 <!-- make sure z-index < 0 --> 884 <xsl:choose> 885 <xsl:when test="$org-z-index < 0"> 886 <xsl:value-of select="$org-z-index"/> 887 </xsl:when> 888 <xsl:otherwise> 889 <xsl:value-of select="$org-z-index - 10"/> 890 </xsl:otherwise> 891 </xsl:choose> 892 </xsl:when> 893 <xsl:otherwise>0</xsl:otherwise> 894 </xsl:choose> 895 </xsl:variable> 896 <xsl:variable name="wrap"> 897 <xsl:choose> 898 <xsl:when test="@text:anchor-type='as-char' ">none</xsl:when> 899 <xsl:when test="$org-wrap='dynamic'">tight</xsl:when> 900 <xsl:when test="$org-wrap='parallel'">square</xsl:when> 901 </xsl:choose> 902 </xsl:variable> 903 <xsl:variable name="ooshapename" select="substring-after(name(),':')"/> 904 <xsl:variable name="element-name"> 905 <xsl:choose> 906 <xsl:when test="$ooshapename='rect'">v:rect</xsl:when> 907 <xsl:when test="$ooshapename='ellipse' and not(string-length(@draw:kind) > 0)">v:oval</xsl:when> 908 <xsl:when test="$ooshapename='ellipse' and string-length(@draw:kind) > 0">v:arc</xsl:when> 909 <xsl:when test="$ooshapename='circle' and string-length(@draw:kind) > 0">v:arc</xsl:when> 910 <xsl:when test="$ooshapename='line'">v:line</xsl:when> 911 <xsl:when test="$ooshapename='polyline'">v:polyline</xsl:when> 912 <xsl:when test="$ooshapename='polygon'">v:polyline</xsl:when> 913 <xsl:when test="$ooshapename='text-box'">v:shape</xsl:when> 914 <xsl:when test="$ooshapename='image'">v:shape</xsl:when> 915 <xsl:when test="$ooshapename='frame'">v:shape</xsl:when> 916 <xsl:when test="$ooshapename='path'">v:shape</xsl:when> 917 <!-- This caption is not the "Caption", it's GUI name is Callouts--> 918 <xsl:when test="$ooshapename='caption'">v:shape</xsl:when> 919 <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive' ">v:shape</xsl:when> 920 <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'round-rectangle' ">v:roundrect</xsl:when> 921 <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'rectangle' ">v:rect</xsl:when> 922 <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'ellipse' ">v:oval</xsl:when> 923 <xsl:when test="$ooshapename='custom-shape'">v:shape</xsl:when> 924 <!-- some wild guess --> 925 <xsl:otherwise>v:shape</xsl:otherwise> 926 </xsl:choose> 927 </xsl:variable> 928 <xsl:variable name="ms-shape-type"> 929 <xsl:choose> 930 <xsl:when test="string-length($shape-type) > 0"> 931 <xsl:value-of select="$shape-type"/> 932 </xsl:when> 933 <xsl:when test="$ooshapename='custom-shape' "> 934 <xsl:call-template name="ooo_custom_draw2ms_word_draw_map"> 935 <xsl:with-param name="ooo_predefined_type" select="draw:enhanced-geometry[1]/@draw:predefined-type"/> 936 </xsl:call-template> 937 </xsl:when> 938 </xsl:choose> 939 </xsl:variable> 940 <xsl:variable name="real-x-adjust"> 941 <xsl:call-template name="ConvertMeasure"> 942 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 943 <xsl:with-param name="value" select="concat($x-adjust,'in')"/> 944 </xsl:call-template> 945 </xsl:variable> 946 <xsl:variable name="real-y-adjust"> 947 <xsl:call-template name="ConvertMeasure"> 948 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 949 <xsl:with-param name="value" select="concat($y-adjust,'in')"/> 950 </xsl:call-template> 951 </xsl:variable> 952 <xsl:variable name="org-x"> 953 <xsl:call-template name="ConvertMeasure"> 954 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 955 <xsl:with-param name="value" select="@svg:x"/> 956 </xsl:call-template> 957 </xsl:variable> 958 <xsl:variable name="org-y"> 959 <xsl:call-template name="ConvertMeasure"> 960 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 961 <xsl:with-param name="value" select="@svg:y"/> 962 </xsl:call-template> 963 </xsl:variable> 964 <xsl:variable name="pagemaster" select="key('master-page','Standard')/@style:page-layout-name"/> 965 <xsl:variable name="leftmargin-pt"> 966 <xsl:call-template name="ConvertMeasure"> 967 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 968 <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-left"/> 969 </xsl:call-template> 970 </xsl:variable> 971 <xsl:variable name="topmargin-pt"> 972 <xsl:call-template name="ConvertMeasure"> 973 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 974 <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-top"/> 975 </xsl:call-template> 976 </xsl:variable> 977 <!-- addjust the x and y values of the page archored objects--> 978 <xsl:variable name="x"> 979 <xsl:choose> 980 <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> 981 <xsl:value-of select="$org-x + $real-x-adjust - $leftmargin-pt"/> 982 </xsl:when> 983 <xsl:otherwise> 984 <xsl:value-of select="$org-x + $real-x-adjust"/> 985 </xsl:otherwise> 986 </xsl:choose> 987 </xsl:variable> 988 <xsl:variable name="y"> 989 <xsl:choose> 990 <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> 991 <xsl:value-of select="$org-y + $real-y-adjust - $topmargin-pt"/> 992 </xsl:when> 993 <xsl:otherwise> 994 <xsl:value-of select="$org-y + $real-y-adjust"/> 995 </xsl:otherwise> 996 </xsl:choose> 997 </xsl:variable> 998 <xsl:variable name="width"> 999 <xsl:variable name="width-tmp"> 1000 <xsl:choose> 1001 <xsl:when test="@svg:width"> 1002 <xsl:value-of select="@svg:width"/> 1003 </xsl:when> 1004 <xsl:when test="not(string-length(parent::draw:frame/@svg:width) = 0)"> 1005 <xsl:value-of select="parent::draw:frame/@svg:width"/> 1006 </xsl:when> 1007 <xsl:when test="string-length(@svg:width) = 0 and ancestor::draw:frame"> 1008 <xsl:value-of select="ancestor::draw:frame/@svg:width"/> 1009 </xsl:when> 1010 <xsl:otherwise> 1011 <xsl:value-of select="@svg:width"/> 1012 </xsl:otherwise> 1013 </xsl:choose> 1014 </xsl:variable> 1015 <xsl:call-template name="ConvertMeasure"> 1016 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1017 <xsl:with-param name="value" select="$width-tmp"/> 1018 </xsl:call-template> 1019 </xsl:variable> 1020 <xsl:variable name="height"> 1021 <xsl:choose> 1022 <xsl:when test="@svg:height"> 1023 <xsl:call-template name="ConvertMeasure"> 1024 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1025 <xsl:with-param name="value" select="@svg:height"/> 1026 </xsl:call-template> 1027 </xsl:when> 1028 <xsl:when test="not(string-length(parent::draw:frame/@svg:height) = 0)"> 1029 <xsl:call-template name="ConvertMeasure"> 1030 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1031 <xsl:with-param name="value" select="parent::draw:frame/@svg:height"/> 1032 </xsl:call-template> 1033 </xsl:when> 1034 <xsl:when test="@fo:min-height and string-length(text:p/text()) = 0 and not(text:p/draw:*)"> 1035 <xsl:call-template name="ConvertMeasure"> 1036 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1037 <xsl:with-param name="value" select="@fo:min-height"/> 1038 </xsl:call-template> 1039 </xsl:when> 1040 <xsl:otherwise>0</xsl:otherwise> 1041 </xsl:choose> 1042 </xsl:variable> 1043 <xsl:variable name="borderstyle"> 1044 <xsl:call-template name="get_borderstyle"> 1045 <xsl:with-param name="border" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border"/> 1046 <xsl:with-param name="border-line-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:border-line-width"/> 1047 </xsl:call-template> 1048 </xsl:variable> 1049 <xsl:variable name="stroke-weight-in-inch" select="number(concat('0',translate(key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width ,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))"/> 1050 <xsl:variable name="stroke-weight"> 1051 <xsl:choose> 1052 <xsl:when test="contains($borderstyle , 'strokeweight')"> 1053 <xsl:call-template name="ConvertMeasure"> 1054 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1055 <xsl:with-param name="value" select="concat( substring-after($borderstyle, 'strokeweight:') , 'pt')"/> 1056 </xsl:call-template> 1057 </xsl:when> 1058 <xsl:otherwise> 1059 <xsl:call-template name="ConvertMeasure"> 1060 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1061 <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width"/> 1062 </xsl:call-template> 1063 </xsl:otherwise> 1064 </xsl:choose> 1065 </xsl:variable> 1066 <xsl:variable name="linestyle"> 1067 <xsl:if test="contains($borderstyle , 'strokeweight')"> 1068 <xsl:value-of select="substring-before( substring-after($borderstyle, 'linestyle:') , ';strokeweight')"/> 1069 </xsl:if> 1070 </xsl:variable> 1071 <xsl:variable name="stroked"> 1072 <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:stroke = 'none'"> 1073 <xsl:value-of select="'f'"/> 1074 </xsl:if> 1075 </xsl:variable> 1076 <xsl:variable name="dashstyle"> 1077 <xsl:call-template name="get_dashstyle"> 1078 <xsl:with-param name="stroke-width" select="$stroke-weight-in-inch"/> 1079 <xsl:with-param name="style-name" select="@draw:style-name"/> 1080 </xsl:call-template> 1081 </xsl:variable> 1082 <xsl:variable name="start-arrow"> 1083 <xsl:choose> 1084 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> 1085 <xsl:call-template name="MapArrowStyle"> 1086 <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> 1087 </xsl:call-template> 1088 </xsl:when> 1089 </xsl:choose> 1090 </xsl:variable> 1091 <xsl:variable name="end-arrow"> 1092 <xsl:choose> 1093 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> 1094 <xsl:call-template name="MapArrowStyle"> 1095 <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> 1096 </xsl:call-template> 1097 </xsl:when> 1098 </xsl:choose> 1099 </xsl:variable> 1100 <xsl:variable name="start-arrow-length"> 1101 <xsl:choose> 1102 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> 1103 <xsl:call-template name="GetArrowLength"> 1104 <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> 1105 <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/> 1106 </xsl:call-template> 1107 </xsl:when> 1108 </xsl:choose> 1109 </xsl:variable> 1110 <xsl:variable name="start-arrow-width"> 1111 <xsl:choose> 1112 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> 1113 <xsl:call-template name="GetArrowWidth"> 1114 <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> 1115 <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/> 1116 </xsl:call-template> 1117 </xsl:when> 1118 </xsl:choose> 1119 </xsl:variable> 1120 <xsl:variable name="end-arrow-length"> 1121 <xsl:choose> 1122 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> 1123 <xsl:call-template name="GetArrowLength"> 1124 <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> 1125 <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/> 1126 </xsl:call-template> 1127 </xsl:when> 1128 </xsl:choose> 1129 </xsl:variable> 1130 <xsl:variable name="end-arrow-width"> 1131 <xsl:choose> 1132 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> 1133 <xsl:call-template name="GetArrowWidth"> 1134 <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> 1135 <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/> 1136 </xsl:call-template> 1137 </xsl:when> 1138 </xsl:choose> 1139 </xsl:variable> 1140 <xsl:variable name="stroke-color"> 1141 <xsl:choose> 1142 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"> 1143 <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"/> 1144 </xsl:when> 1145 <xsl:when test="contains(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#')"> 1146 <xsl:value-of select="concat('#', substring-after(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#') )"/> 1147 </xsl:when> 1148 </xsl:choose> 1149 </xsl:variable> 1150 <xsl:variable name="stroke-opacity"> 1151 <xsl:call-template name="ValueOfPercent"> 1152 <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-opacity"/> 1153 </xsl:call-template> 1154 </xsl:variable> 1155 <xsl:variable name="fill-color"> 1156 <xsl:choose> 1157 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"> 1158 <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"/> 1159 </xsl:when> 1160 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style">black</xsl:when> 1161 <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill = 'none'"/> 1162 <xsl:when test="$draw-fill-type = 'gradient' "> 1163 <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:end-color "/> 1164 </xsl:when> 1165 <!-- for these need fill, set the default color we used in oo--> 1166 <xsl:when test="name()='draw:polygon' or name()='draw:custom-shape' or name() = 'draw:rect' or (name() = 'draw:ellipse' and not( @draw:kind='arc') )">#00B8FF</xsl:when> 1167 </xsl:choose> 1168 </xsl:variable> 1169 <xsl:variable name="position"> 1170 <xsl:value-of select="concat('left:', $x ,$MeasureMark , ';top:' , $y ,$MeasureMark , ';width:', $width ,$MeasureMark )"/> 1171 <xsl:if test="not($height = 0)"> 1172 <xsl:value-of select="concat(';height:', $height ,$MeasureMark )"/> 1173 </xsl:if> 1174 </xsl:variable> 1175 <xsl:variable name="flip"> 1176 <xsl:choose> 1177 <xsl:when test="@text:anchor-type='as-char' and $ooshapename='line'"/> 1178 <xsl:when test="$ooshapename='image'"/> 1179 <xsl:when test="$ooshapename='path'"/> 1180 <xsl:when test="$ooshapename='caption'"/> 1181 <xsl:when test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"/> 1182 <xsl:when test="$ooshapename='custom-shape'"/> 1183 <xsl:otherwise>flip:x</xsl:otherwise> 1184 </xsl:choose> 1185 </xsl:variable> 1186 <xsl:variable name="absolute"> 1187 <xsl:choose> 1188 <xsl:when test="ancestor::draw:a"/> 1189 <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/> 1190 <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'"/> 1191 <xsl:otherwise>position:absolute</xsl:otherwise> 1192 </xsl:choose> 1193 </xsl:variable> 1194 <xsl:variable name="anchorlock"> 1195 <xsl:choose> 1196 <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">has</xsl:when> 1197 <xsl:otherwise/> 1198 </xsl:choose> 1199 </xsl:variable> 1200 <!-- start line special --> 1201 <xsl:variable name="org-x1"> 1202 <xsl:call-template name="ConvertMeasure"> 1203 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1204 <xsl:with-param name="value" select="@svg:x1"/> 1205 </xsl:call-template> 1206 </xsl:variable> 1207 <xsl:variable name="org-y1"> 1208 <xsl:call-template name="ConvertMeasure"> 1209 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1210 <xsl:with-param name="value" select="@svg:y1"/> 1211 </xsl:call-template> 1212 </xsl:variable> 1213 <xsl:variable name="org-x2"> 1214 <xsl:call-template name="ConvertMeasure"> 1215 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1216 <xsl:with-param name="value" select="@svg:x2"/> 1217 </xsl:call-template> 1218 </xsl:variable> 1219 <xsl:variable name="org-y2"> 1220 <xsl:call-template name="ConvertMeasure"> 1221 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1222 <xsl:with-param name="value" select="@svg:y2"/> 1223 </xsl:call-template> 1224 </xsl:variable> 1225 <xsl:variable name="x1"> 1226 <xsl:choose> 1227 <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> 1228 <xsl:value-of select="$org-x1 + $real-x-adjust - $leftmargin-pt"/> 1229 </xsl:when> 1230 <xsl:otherwise> 1231 <xsl:value-of select="$org-x1 + $real-x-adjust"/> 1232 </xsl:otherwise> 1233 </xsl:choose> 1234 </xsl:variable> 1235 <xsl:variable name="y1"> 1236 <xsl:choose> 1237 <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> 1238 <xsl:value-of select="$org-y1 + $real-y-adjust - $topmargin-pt"/> 1239 </xsl:when> 1240 <xsl:otherwise> 1241 <xsl:value-of select="$org-y1 + $real-y-adjust"/> 1242 </xsl:otherwise> 1243 </xsl:choose> 1244 </xsl:variable> 1245 <xsl:variable name="x2"> 1246 <xsl:choose> 1247 <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> 1248 <xsl:value-of select="$org-x2 + $real-x-adjust - $leftmargin-pt"/> 1249 </xsl:when> 1250 <xsl:otherwise> 1251 <xsl:value-of select="$org-x2 + $real-x-adjust"/> 1252 </xsl:otherwise> 1253 </xsl:choose> 1254 </xsl:variable> 1255 <xsl:variable name="y2"> 1256 <xsl:choose> 1257 <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> 1258 <xsl:value-of select="$org-y2 + $real-y-adjust - $topmargin-pt"/> 1259 </xsl:when> 1260 <xsl:otherwise> 1261 <xsl:value-of select="$org-y2 + $real-y-adjust"/> 1262 </xsl:otherwise> 1263 </xsl:choose> 1264 </xsl:variable> 1265 <!-- end line special --> 1266 <xsl:variable name="relative"> 1267 <xsl:choose> 1268 <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when> 1269 <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when> 1270 <xsl:otherwise/> 1271 </xsl:choose> 1272 </xsl:variable> 1273 <xsl:variable name="style"> 1274 <xsl:choose> 1275 <xsl:when test="$wrap='none'"/> 1276 <xsl:otherwise> 1277 <xsl:if test="string-length($absolute) > 0"> 1278 <xsl:value-of select="concat($absolute, ';')"/> 1279 </xsl:if> 1280 <xsl:value-of select="concat('z-index:', $z-index, ';')"/> 1281 </xsl:otherwise> 1282 </xsl:choose> 1283 <xsl:if test="string-length($flip) > 0"> 1284 <xsl:value-of select="concat($flip,';')"/> 1285 </xsl:if> 1286 <xsl:if test="not($ooshapename = 'line')"> 1287 <xsl:value-of select="concat($position,';')"/> 1288 </xsl:if> 1289 <xsl:if test="ancestor::draw:frame and name()='draw:text-box'"> 1290 <xsl:if test="string-length($horizontal-pos) > 0"> 1291 <xsl:value-of select="concat('mso-position-horizontal:',$horizontal-pos,';')"/> 1292 </xsl:if> 1293 </xsl:if> 1294 <xsl:if test="string-length($relative) > 0"> 1295 <xsl:value-of select="concat($relative,';')"/> 1296 </xsl:if> 1297 </xsl:variable> 1298 <!-- image special: convert oo base64 binary data (77char/line) to word base64 binary data(73char/line) , a workthrough is removing all line breaks --> 1299 <xsl:if test="$ooshapename = 'image'"> 1300 <xsl:element name="w:binData"> 1301 <xsl:attribute name="w:name"> 1302 <xsl:value-of select="concat( 'wordml://', $draw-name )"/> 1303 </xsl:attribute> 1304 <xsl:value-of select="translate(office:binary-data/text(),'	  ','' ) "/> 1305 <!-- xsl:value-of select="office:binary-data/text()"/ --> 1306 </xsl:element> 1307 </xsl:if> 1308 <!-- all element goes here --> 1309 <xsl:variable name="id"> 1310 <xsl:choose> 1311 <xsl:when test="$ooshapename='line'"> 1312 <xsl:value-of select="concat('_x',$x1 , '_' ,$y1, '_' , $x2, '_' ,$y2 )"/> 1313 </xsl:when> 1314 <xsl:otherwise> 1315 <xsl:value-of select="concat('_x',$x , '_' ,$y, '_' , $width, '_' ,$height )"/> 1316 </xsl:otherwise> 1317 </xsl:choose> 1318 </xsl:variable> 1319 <xsl:element name="{$element-name}"> 1320 <xsl:attribute name="id"> 1321 <xsl:value-of select="$id"/> 1322 </xsl:attribute> 1323 <xsl:if test="string-length($ms-shape-type) > 0"> 1324 <xsl:attribute name="type"> 1325 <xsl:value-of select="$ms-shape-type"/> 1326 </xsl:attribute> 1327 </xsl:if> 1328 <xsl:attribute name="style"> 1329 <xsl:value-of select="$style"/> 1330 </xsl:attribute> 1331 <xsl:if test="$stroke-weight > 0"> 1332 <xsl:attribute name="strokeweight"> 1333 <xsl:value-of select="concat($stroke-weight,$MeasureMark)"/> 1334 </xsl:attribute> 1335 </xsl:if> 1336 <xsl:if test="string-length($stroked) > 0"> 1337 <xsl:attribute name="stroked"> 1338 <xsl:value-of select="$stroked"/> 1339 </xsl:attribute> 1340 </xsl:if> 1341 <xsl:if test="string-length($stroke-color) > 0"> 1342 <xsl:attribute name="strokecolor"> 1343 <xsl:value-of select="$stroke-color"/> 1344 </xsl:attribute> 1345 </xsl:if> 1346 <xsl:if test="string-length($fill-color) > 0"> 1347 <xsl:attribute name="fillcolor"> 1348 <xsl:value-of select="$fill-color"/> 1349 </xsl:attribute> 1350 <xsl:attribute name="filled">true</xsl:attribute> 1351 </xsl:if> 1352 <xsl:if test="parent::draw:frame/draw:object-ole[1]"> 1353 <xsl:attribute name="filled">true</xsl:attribute> 1354 </xsl:if> 1355 <xsl:if test="string-length($stroke-opacity) > 0"> 1356 <xsl:attribute name="opacity"> 1357 <xsl:value-of select="$stroke-opacity"/> 1358 </xsl:attribute> 1359 </xsl:if> 1360 <!-- arc special attribute --> 1361 <xsl:if test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"> 1362 <xsl:choose> 1363 <xsl:when test="@draw:start-angle > @draw:end-angle"> 1364 <xsl:attribute name="startangle"> 1365 <xsl:value-of select="round( 450 - (@draw:end-angle + 360) )"/> 1366 </xsl:attribute> 1367 </xsl:when> 1368 <xsl:otherwise> 1369 <xsl:attribute name="startangle"> 1370 <xsl:value-of select="round( 450 - @draw:end-angle )"/> 1371 </xsl:attribute> 1372 </xsl:otherwise> 1373 </xsl:choose> 1374 <xsl:attribute name="endangle"> 1375 <xsl:value-of select="round(450 - @draw:start-angle)"/> 1376 </xsl:attribute> 1377 </xsl:if> 1378 <xsl:if test="@draw:kind = 'cut'"> 1379 <xsl:attribute name="fill"> 1380 <xsl:value-of select="'true'"/> 1381 </xsl:attribute> 1382 </xsl:if> 1383 <!-- end arc special attribute --> 1384 <!-- line special attribute--> 1385 <xsl:if test="$ooshapename='line'"> 1386 <xsl:attribute name="from"> 1387 <xsl:choose> 1388 <xsl:when test="@text:anchor-type='as-char'">0,0</xsl:when> 1389 <xsl:otherwise> 1390 <xsl:value-of select="concat($x1,$MeasureMark, ',',$y2,$MeasureMark )"/> 1391 </xsl:otherwise> 1392 </xsl:choose> 1393 </xsl:attribute> 1394 <xsl:attribute name="to"> 1395 <xsl:choose> 1396 <xsl:when test="@text:anchor-type='as-char'"> 1397 <xsl:value-of select="concat($x2,$MeasureMark ,',',$y2,$MeasureMark )"/> 1398 </xsl:when> 1399 <xsl:otherwise> 1400 <xsl:value-of select="concat($x2,$MeasureMark ,',' ,$y1,$MeasureMark)"/> 1401 </xsl:otherwise> 1402 </xsl:choose> 1403 </xsl:attribute> 1404 </xsl:if> 1405 <!-- end line special attribute--> 1406 <!-- polyline and polygon special attribute--> 1407 <xsl:if test="$ooshapename='polyline' or $ooshapename='polygon' "> 1408 <!-- translate ' ' to in ' tranclate ',' to 'in,' --> 1409 <xsl:variable name="points"> 1410 <xsl:call-template name="points2points"> 1411 <xsl:with-param name="input_x" select="$x"/> 1412 <xsl:with-param name="input_y" select="$y"/> 1413 <xsl:with-param name="input_width" select="$width"/> 1414 <xsl:with-param name="input_height" select="$height"/> 1415 <xsl:with-param name="input_boxwidth" select="substring-before(substring-after(@svg:viewBox,'0 0 '),' ')"/> 1416 <xsl:with-param name="input_boxheight" select="substring-after(substring-after(@svg:viewBox,'0 0 '),' ')"/> 1417 <xsl:with-param name="input_points" select="concat(@draw:points,' ')"/> 1418 <!-- add a space to the end of input_points --> 1419 </xsl:call-template> 1420 </xsl:variable> 1421 <xsl:attribute name="points"> 1422 <xsl:value-of select="$points"/> 1423 </xsl:attribute> 1424 </xsl:if> 1425 <!-- end polyline and polygon special attribute--> 1426 <!-- callouts special attribute--> 1427 <xsl:if test="$ooshapename='caption'"> 1428 <xsl:variable name="caption-point-x"> 1429 <xsl:call-template name="ConvertMeasure"> 1430 <xsl:with-param name="TargetMeasure" select="'twip'"/> 1431 <xsl:with-param name="value" select="@draw:caption-point-x"/> 1432 </xsl:call-template> 1433 </xsl:variable> 1434 <xsl:variable name="caption-point-y"> 1435 <xsl:call-template name="ConvertMeasure"> 1436 <xsl:with-param name="TargetMeasure" select="'twip'"/> 1437 <xsl:with-param name="value" select="@draw:caption-point-y"/> 1438 </xsl:call-template> 1439 </xsl:variable> 1440 <xsl:attribute name="type"> 1441 <!-- map to word line label 3--> 1442 <xsl:value-of select="'#_x0000_t48'"/> 1443 </xsl:attribute> 1444 <xsl:attribute name="adj"> 1445 <xsl:value-of select=" concat($caption-point-x * 20 , ',' , $caption-point-y * 20 , ',' , $caption-point-x * 10 , ',,,,' , $caption-point-x * 20, ',' , $caption-point-y * 20) "/> 1446 </xsl:attribute> 1447 </xsl:if> 1448 <!-- end callouts special attribute--> 1449 <!-- path special attribute--> 1450 <xsl:if test="$ooshapename='path' or string-length(@svg:d) > 0 or ( $ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive') "> 1451 <xsl:variable name="path"> 1452 <xsl:choose> 1453 <xsl:when test="$ooshapename='path' or string-length(@svg:d) > 0 "> 1454 <xsl:call-template name="svgpath2vmlpath"> 1455 <xsl:with-param name="svg-path" select="@svg:d"/> 1456 </xsl:call-template> 1457 </xsl:when> 1458 <xsl:otherwise> 1459 <xsl:call-template name="svgpath2vmlpath"> 1460 <xsl:with-param name="svg-path" select="draw:enhanced-geometry[1]/@draw:enhanced-path"/> 1461 </xsl:call-template> 1462 </xsl:otherwise> 1463 </xsl:choose> 1464 </xsl:variable> 1465 <xsl:attribute name="coordorigin"> 1466 <xsl:value-of select=" '0 0' "/> 1467 </xsl:attribute> 1468 <xsl:attribute name="coordsize"> 1469 <xsl:choose> 1470 <xsl:when test="string-length(@svg:viewBox) > 0 "> 1471 <xsl:value-of select="substring-after(@svg:viewBox,'0 0 ')"/> 1472 </xsl:when> 1473 <xsl:when test="string-length(draw:enhanced-geometry[1]/@svg:viewBox) > 0 "> 1474 <xsl:value-of select="substring-after(draw:enhanced-geometry[1]/@svg:viewBox,'0 0 ')"/> 1475 </xsl:when> 1476 <!-- for custom shape use a default viewbox. right? --> 1477 <xsl:otherwise> 1478 <xsl:value-of select=" '21600 21600' "/> 1479 </xsl:otherwise> 1480 </xsl:choose> 1481 </xsl:attribute> 1482 <xsl:attribute name="path"> 1483 <xsl:value-of select="$path"/> 1484 </xsl:attribute> 1485 </xsl:if> 1486 <!-- end path special attribute--> 1487 <!-- image special element --> 1488 <xsl:if test="$ooshapename='image'"> 1489 <xsl:element name="v:imagedata"> 1490 <xsl:attribute name="src"> 1491 <xsl:value-of select="concat('wordml://', $draw-name)"/> 1492 </xsl:attribute> 1493 <xsl:attribute name="o:title"> 1494 <xsl:value-of select="$draw-name"/> 1495 </xsl:attribute> 1496 </xsl:element> 1497 </xsl:if> 1498 <!-- end image special element --> 1499 <!-- start dash style , line style and arrow style--> 1500 <xsl:if test="string-length($dashstyle) > 0 or string-length($linestyle) > 0 or string-length($start-arrow) > 0 or string-length($end-arrow) > 0 "> 1501 <xsl:element name="v:stroke"> 1502 <xsl:if test="string-length($dashstyle) > 0"> 1503 <xsl:attribute name="dashstyle"> 1504 <xsl:value-of select="$dashstyle"/> 1505 </xsl:attribute> 1506 </xsl:if> 1507 <xsl:if test="string-length($linestyle) > 0"> 1508 <xsl:attribute name="linestyle"> 1509 <xsl:value-of select="$linestyle"/> 1510 </xsl:attribute> 1511 </xsl:if> 1512 <xsl:if test="string-length($start-arrow) > 0 "> 1513 <xsl:attribute name="startarrow"> 1514 <xsl:value-of select="$start-arrow"/> 1515 </xsl:attribute> 1516 </xsl:if> 1517 <xsl:if test="string-length($end-arrow) > 0 "> 1518 <xsl:attribute name="endarrow"> 1519 <xsl:value-of select="$end-arrow"/> 1520 </xsl:attribute> 1521 </xsl:if> 1522 <xsl:if test="string-length($start-arrow-length) > 0 "> 1523 <xsl:attribute name="startarrowlength"> 1524 <xsl:value-of select="$start-arrow-length"/> 1525 </xsl:attribute> 1526 </xsl:if> 1527 <xsl:if test="string-length($start-arrow-width) > 0 "> 1528 <xsl:attribute name="startarrowwidth"> 1529 <xsl:value-of select="$start-arrow-width"/> 1530 </xsl:attribute> 1531 </xsl:if> 1532 <xsl:if test="string-length($end-arrow-length) > 0 "> 1533 <xsl:attribute name="endarrowlength"> 1534 <xsl:value-of select="$end-arrow-length"/> 1535 </xsl:attribute> 1536 </xsl:if> 1537 <xsl:if test="string-length($end-arrow-width) > 0 "> 1538 <xsl:attribute name="endarrowwidth"> 1539 <xsl:value-of select="$end-arrow-width"/> 1540 </xsl:attribute> 1541 </xsl:if> 1542 </xsl:element> 1543 </xsl:if> 1544 <!-- end dash style , line style and arrow style --> 1545 <!-- start wrap type --> 1546 <xsl:if test="string-length($wrap) > 0"> 1547 <xsl:element name="w10:wrap"> 1548 <xsl:attribute name="type"> 1549 <xsl:value-of select="$wrap"/> 1550 </xsl:attribute> 1551 </xsl:element> 1552 </xsl:if> 1553 <!-- end wrap type --> 1554 <!-- start anchor to char specific element --> 1555 <xsl:if test="string-length($anchorlock) > 0"> 1556 <xsl:element name="w10:anchorlock"/> 1557 </xsl:if> 1558 <!-- end wrap type --> 1559 <!-- start fill image --> 1560 <xsl:if test="string-length($draw-fill-type ) > 0"> 1561 <xsl:element name="v:fill"> 1562 <xsl:choose> 1563 <xsl:when test="$draw-fill-type = 'bitmap'"> 1564 <xsl:attribute name="src"> 1565 <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/> 1566 </xsl:attribute> 1567 <xsl:attribute name="o:titile"> 1568 <xsl:value-of select="$fill-image-name"/> 1569 </xsl:attribute> 1570 <xsl:attribute name="recolor"> 1571 <xsl:value-of select=" 'true' "/> 1572 </xsl:attribute> 1573 <xsl:attribute name="rotate"> 1574 <xsl:value-of select=" 'true' "/> 1575 </xsl:attribute> 1576 <xsl:attribute name="type"> 1577 <xsl:value-of select=" 'frame' "/> 1578 </xsl:attribute> 1579 </xsl:when> 1580 <xsl:when test="$draw-fill-type = 'gradient'"> 1581 <xsl:attribute name="type"> 1582 <xsl:value-of select=" 'gradient' "/> 1583 </xsl:attribute> 1584 <xsl:attribute name="color2"> 1585 <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:start-color "/> 1586 </xsl:attribute> 1587 </xsl:when> 1588 </xsl:choose> 1589 </xsl:element> 1590 </xsl:if> 1591 <!-- end fill image --> 1592 <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style"> 1593 <xsl:call-template name="FontWork"/> 1594 </xsl:if> 1595 <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:shadow = 'visible'"> 1596 <xsl:call-template name="Shadow"/> 1597 </xsl:if> 1598 <!-- only draw:g can have child graphic --> 1599 <xsl:choose> 1600 <xsl:when test="name() = 'draw:g'"> 1601 <xsl:apply-templates select="draw:*"> 1602 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1603 <xsl:with-param name="x-adjust" select="$x-adjust"/> 1604 <xsl:with-param name="y-adjust" select="$y-adjust"/> 1605 <xsl:with-param name="force-draw" select="$force-draw"/> 1606 </xsl:apply-templates> 1607 </xsl:when> 1608 <xsl:when test="text:*/* | text:*/text()"> 1609 <xsl:element name="v:textbox"> 1610 <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:writing-mode = 'tb-rl'"> 1611 <xsl:attribute name="style"> 1612 <xsl:value-of select="'layout-flow:vertical'"/> 1613 </xsl:attribute> 1614 </xsl:if> 1615 <w:txbxContent> 1616 <xsl:apply-templates select="text() | text:*"/> 1617 </w:txbxContent> 1618 </xsl:element> 1619 </xsl:when> 1620 </xsl:choose> 1621 </xsl:element> 1622 <xsl:apply-templates select="parent::draw:frame/draw:object-ole" mode="output"> 1623 <xsl:with-param name="ShapeID" select="$id"/> 1624 </xsl:apply-templates> 1625 </xsl:template> 1626 <xsl:template name="Shadow"> 1627 <xsl:element name="v:shadow"> 1628 <xsl:variable name="key-node" select="key('graphics-style', @draw:style-name)/style:graphic-properties"/> 1629 <xsl:attribute name="on">true</xsl:attribute> 1630 <xsl:attribute name="offset"> 1631 <xsl:value-of select="concat($key-node/@draw:shadow-offset-x,',' , $key-node/@draw:shadow-offset-y)"/> 1632 </xsl:attribute> 1633 <xsl:attribute name="color"> 1634 <xsl:value-of select="$key-node/@draw:shadow-color"/> 1635 </xsl:attribute> 1636 <xsl:attribute name="opacity"> 1637 <xsl:value-of select="$key-node/@draw:shadow-opacity"/> 1638 </xsl:attribute> 1639 </xsl:element> 1640 </xsl:template> 1641 <xsl:template name="FontWork"> 1642 <xsl:element name="v:path"> 1643 <xsl:attribute name="textpathok">true</xsl:attribute> 1644 </xsl:element> 1645 <xsl:if test="not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow) or not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow = 'normal')"> 1646 <xsl:element name="v:shadow"> 1647 <xsl:attribute name="on">true</xsl:attribute> 1648 <xsl:attribute name="type">perspective</xsl:attribute> 1649 <xsl:attribute name="color"> 1650 <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-color"/> 1651 </xsl:attribute> 1652 <xsl:variable name="offset-x"> 1653 <xsl:call-template name="ConvertMeasure"> 1654 <xsl:with-param name="TargetMeasure" select="'twip'"/> 1655 <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-x"/> 1656 </xsl:call-template> 1657 </xsl:variable> 1658 <xsl:variable name="offset-y" select="substring-before(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-y, 'in')"/> 1659 <xsl:attribute name="matrix"> 1660 <xsl:value-of select="concat(',,,' , round($offset-y div 0.000693) div 100, ',,')"/> 1661 </xsl:attribute> 1662 <xsl:attribute name="origin">-30%, -30%</xsl:attribute> 1663 </xsl:element> 1664 </xsl:if> 1665 <xsl:element name="v:textpath"> 1666 <xsl:attribute name="on">true</xsl:attribute> 1667 <xsl:attribute name="fitpath">true</xsl:attribute> 1668 <xsl:attribute name="fitshape">true</xsl:attribute> 1669 <xsl:attribute name="style"> 1670 <xsl:choose> 1671 <xsl:when test="key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family"> 1672 <xsl:value-of select="concat('font-family:"' , key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family , '"') "/> 1673 </xsl:when> 1674 <xsl:otherwise> 1675 <xsl:variable name="default-graphics-properties" select="/office:document/office:styles/style:default-style[@style:family = 'graphics']/style:graphic-properties"/> 1676 <xsl:value-of select="concat('font-family:"' , $default-graphics-properties/@style:font-name , '"') "/> 1677 </xsl:otherwise> 1678 </xsl:choose> 1679 </xsl:attribute> 1680 <xsl:attribute name="string"> 1681 <xsl:value-of select="text:p"/> 1682 </xsl:attribute> 1683 </xsl:element> 1684 </xsl:template> 1685 <xsl:template name="MapArrowStyle"> 1686 <xsl:param name="arrow-name"/> 1687 <xsl:choose> 1688 <xsl:when test="$arrow-name = 'Arrow' ">Block</xsl:when> 1689 <xsl:when test="$arrow-name = 'Square' ">Diamond</xsl:when> 1690 <xsl:when test="$arrow-name = 'Small arrow' ">Block</xsl:when> 1691 <xsl:when test="$arrow-name = 'Dimension lines' ">Diamond</xsl:when> 1692 <xsl:when test="$arrow-name = 'Double Arrow' ">Block</xsl:when> 1693 <xsl:when test="$arrow-name = 'Rounded short arrow' ">Block</xsl:when> 1694 <xsl:when test="$arrow-name = 'Symmetric arrow' ">Block</xsl:when> 1695 <xsl:when test="$arrow-name = 'Line Arrow' ">Open</xsl:when> 1696 <xsl:when test="$arrow-name = 'Rounded large arrow' ">Block</xsl:when> 1697 <xsl:when test="$arrow-name = 'Circle' ">Oval</xsl:when> 1698 <xsl:when test="$arrow-name = 'Square 45' ">Diamond</xsl:when> 1699 <xsl:when test="$arrow-name = 'Arrow concave' ">Classic</xsl:when> 1700 <xsl:otherwise>Block</xsl:otherwise> 1701 </xsl:choose> 1702 </xsl:template> 1703 <xsl:template name="GetArrowLength"> 1704 <xsl:param name="arrow-name"/> 1705 <xsl:param name="arrow-width"/> 1706 <xsl:variable name="arrow-size"> 1707 <xsl:choose> 1708 <xsl:when test="$arrow-width"> 1709 <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/> 1710 </xsl:when> 1711 <xsl:otherwise>3</xsl:otherwise> 1712 </xsl:choose> 1713 </xsl:variable> 1714 <xsl:choose> 1715 <xsl:when test="$arrow-size > 2">Long</xsl:when> 1716 <xsl:when test="$arrow-size > 1">Medium</xsl:when> 1717 <xsl:when test="$arrow-size > 0">Short</xsl:when> 1718 </xsl:choose> 1719 </xsl:template> 1720 <xsl:template name="GetArrowWidth"> 1721 <xsl:param name="arrow-name"/> 1722 <xsl:param name="arrow-width"/> 1723 <xsl:variable name="arrow-size"> 1724 <xsl:choose> 1725 <xsl:when test="$arrow-width"> 1726 <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/> 1727 </xsl:when> 1728 <xsl:otherwise>3</xsl:otherwise> 1729 </xsl:choose> 1730 </xsl:variable> 1731 <xsl:choose> 1732 <xsl:when test="$arrow-size > 2">Wide</xsl:when> 1733 <xsl:when test="$arrow-size > 1">Medium</xsl:when> 1734 <xsl:when test="$arrow-size > 0">Narrow</xsl:when> 1735 </xsl:choose> 1736 </xsl:template> 1737 <xsl:template name="ConvertMeasure"> 1738 <xsl:param name="TargetMeasure" select="'cm'"/> 1739 <xsl:param name="TargetTruncate" select=" 'all' "/> 1740 <xsl:param name="value"/> 1741 <!-- When TargetTruncate ='all' it returns the number whichsoever the return value is negative or positive 1742 When TargetTruncate ='nonNegative' it only returns nonNegative number, all negative number to be returned as 0 1743 When TargetTruncate ='positive" it only returns positive number, all nonPositive number to be returned as 1 --> 1744 <xsl:variable name="return_value"> 1745 <xsl:choose> 1746 <!-- remove the measure mark, if the value is null, the result should be 0. Must be the first case --> 1747 <xsl:when test="string-length(translate(string($value),'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ','')) = 0">0</xsl:when> 1748 <xsl:when test="string-length(translate(string($value),'- .0123456789','')) = 0"> 1749 <xsl:value-of select="$value"/> 1750 </xsl:when> 1751 <xsl:when test="$TargetMeasure = 'cm'"> 1752 <xsl:call-template name="convert2cm"> 1753 <xsl:with-param name="value" select="$value"/> 1754 </xsl:call-template> 1755 </xsl:when> 1756 <xsl:when test="$TargetMeasure = 'pt'"> 1757 <xsl:call-template name="convert2pt"> 1758 <xsl:with-param name="value" select="$value"/> 1759 </xsl:call-template> 1760 </xsl:when> 1761 <xsl:when test="$TargetMeasure = 'twip'"> 1762 <xsl:call-template name="convert2twip"> 1763 <xsl:with-param name="value" select="$value"/> 1764 </xsl:call-template> 1765 </xsl:when> 1766 <xsl:when test="$TargetMeasure = 'in'"> 1767 <xsl:call-template name="convert2in"> 1768 <xsl:with-param name="value" select="$value"/> 1769 </xsl:call-template> 1770 </xsl:when> 1771 </xsl:choose> 1772 </xsl:variable> 1773 <xsl:choose> 1774 <xsl:when test="$TargetTruncate = 'all' "> 1775 <xsl:choose> 1776 <xsl:when test="string(number($TargetMeasure)) = 'NaN' "> 1777 <xsl:value-of select=" '0' "/> 1778 </xsl:when> 1779 <xsl:otherwise> 1780 <xsl:value-of select="$return_value"/> 1781 </xsl:otherwise> 1782 </xsl:choose> 1783 </xsl:when> 1784 <xsl:when test="$TargetTruncate = 'nonNegative' "> 1785 <xsl:choose> 1786 <xsl:when test="string(number($TargetMeasure)) = 'NaN' "> 1787 <xsl:value-of select=" '0' "/> 1788 </xsl:when> 1789 <xsl:otherwise> 1790 <xsl:choose> 1791 <xsl:when test=" $return_value < 0 "> 1792 <xsl:value-of select=" '0' "/> 1793 </xsl:when> 1794 <xsl:otherwise> 1795 <xsl:value-of select="$return_value"/> 1796 </xsl:otherwise> 1797 </xsl:choose> 1798 </xsl:otherwise> 1799 </xsl:choose> 1800 </xsl:when> 1801 <xsl:when test="$TargetTruncate = 'positive' "> 1802 <xsl:choose> 1803 <xsl:when test="string(number($TargetMeasure)) = 'NaN' "> 1804 <xsl:value-of select=" '1' "/> 1805 </xsl:when> 1806 <xsl:otherwise> 1807 <xsl:choose> 1808 <xsl:when test=" $return_value <= 0 "> 1809 <xsl:value-of select=" '1' "/> 1810 </xsl:when> 1811 <xsl:otherwise> 1812 <xsl:value-of select="$return_value"/> 1813 </xsl:otherwise> 1814 </xsl:choose> 1815 </xsl:otherwise> 1816 </xsl:choose> 1817 </xsl:when> 1818 </xsl:choose> 1819 </xsl:template> 1820 <xsl:template name="Add-With-Measure"> 1821 <xsl:param name="value1"/> 1822 <xsl:param name="value2"/> 1823 <xsl:param name="TargetMeasure" select="'in'"/> 1824 <xsl:variable name="number-value1"> 1825 <xsl:call-template name="ConvertMeasure"> 1826 <xsl:with-param name="value" select="$value1"/> 1827 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1828 </xsl:call-template> 1829 </xsl:variable> 1830 <xsl:variable name="number-value2"> 1831 <xsl:call-template name="ConvertMeasure"> 1832 <xsl:with-param name="value" select="$value2"/> 1833 <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> 1834 </xsl:call-template> 1835 </xsl:variable> 1836 <xsl:value-of select="$number-value1 + $number-value2"/> 1837 </xsl:template> 1838 <xsl:template name="export-oledata"> 1839 <xsl:if test="//draw:object-ole[1]"> 1840 <xsl:choose> 1841 <xsl:when test="element-available('oleextracter:init')"> 1842 <oleextracter:init UNOURL="uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"/> 1843 </xsl:when> 1844 <xsl:otherwise> 1845 <xsl:value-of select="ole:init($XMultiServiceFactory, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/> 1846 </xsl:otherwise> 1847 </xsl:choose> 1848 <xsl:apply-templates select="//draw:object-ole" mode="oledata.mso"/> 1849 <w:docOleData> 1850 <w:binData w:name="oledata.mso"> 1851 <xsl:if test="function-available('ole:getByName')"> 1852 <xsl:value-of select="translate(ole:getByName($oleExtractor, 'oledata.mso'),'  ','')"/> 1853 </xsl:if> 1854 </w:binData> 1855 </w:docOleData> 1856 <xsl:if test="function-available('ole:exit')"> 1857 <xsl:value-of select="ole:exit($oleExtractor)"/> 1858 </xsl:if> 1859 </xsl:if> 1860 </xsl:template> 1861 <xsl:template match="draw:object-ole" mode="oledata.mso"> 1862 <xsl:variable name="stream-name"> 1863 <xsl:apply-templates select="." mode="get-number"/> 1864 </xsl:variable> 1865 <xsl:variable name="tmp" select="ole:insertByName($oleExtractor, $stream-name, translate(office:binary-data/text(),'  ','' ) )"/> 1866 </xsl:template> 1867 <xsl:template match="draw:object-ole" mode="output"> 1868 <xsl:param name="ShapeID"/> 1869 <xsl:variable name="stream-name"> 1870 <xsl:apply-templates select="." mode="get-number"/> 1871 </xsl:variable> 1872 <o:OLEObject Type="Embed" DrawAspect="Content" ObjectID="{$stream-name}" ShapeID="{$ShapeID}" ProgID=""/> 1873 </xsl:template> 1874 <xsl:template match="draw:object-ole" mode="get-number"> 1875 <xsl:number from="/office:document" level="any" count="draw:object-ole" format="1"/> 1876 </xsl:template> 1877 <xsl:template match="draw:object-ole"/> 1878 <xalan:component prefix="oleextracter" elements="init exit" functions="getByName insertByName"> 1879 <xalan:script lang="javaclass" src="xalan://com.sun.star.comp.xsltfilter.XSLTFilterOLEExtracter"/> 1880 </xalan:component> 1881</xsl:stylesheet> 1882