[ Index ] |
|
Code source de Horde 3.1.3 |
1 <!-- 2 3 The Contents of this file are made available subject to the terms of 4 either of the following licenses 5 6 - GNU Lesser General Public License Version 2.1 7 - Sun Industry Standards Source License Version 1.1 8 9 Sun Microsystems Inc., October, 2000 10 11 GNU Lesser General Public License Version 2.1 12 ============================================= 13 Copyright 2000 by Sun Microsystems, Inc. 14 901 San Antonio Road, Palo Alto, CA 94303, USA 15 16 This library is free software; you can redistribute it and/or 17 modify it under the terms of the GNU Lesser General Public 18 License version 2.1, as published by the Free Software Foundation. 19 20 This library is distributed in the hope that it will be useful, 21 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 Lesser General Public License for more details. 24 25 You should have received a copy of the GNU Lesser General Public 26 License along with this library; if not, write to the Free Software 27 Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 MA 02111-1307 USA 29 30 31 Sun Industry Standards Source License Version 1.1 32 ================================================= 33 The contents of this file are subject to the Sun Industry Standards 34 Source License Version 1.1 (the "License"); You may not use this file 35 except in compliance with the License. You may obtain a copy of the 36 License at http://www.openoffice.org/license.html. 37 38 Software provided under this License is provided on an "AS IS" basis, 39 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, 40 WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, 41 MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. 42 See the License for the specific provisions governing your rights and 43 obligations concerning the Software. 44 45 The Initial Developer of the Original Code is: Sun Microsystems, Inc. 46 47 Copyright © 2002 by Sun Microsystems, Inc. 48 49 All Rights Reserved. 50 51 Contributor(s): _______________________________________ 52 53 --> 54 <xsl:stylesheet version="1.0" 55 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 56 xmlns:office="http://openoffice.org/2000/office" 57 xmlns:style="http://openoffice.org/2000/style" 58 xmlns:text="http://openoffice.org/2000/text" 59 xmlns:table="http://openoffice.org/2000/table" 60 xmlns:draw="http://openoffice.org/2000/drawing" 61 xmlns:fo="http://www.w3.org/1999/XSL/Format" 62 xmlns:xlink="http://www.w3.org/1999/xlink" 63 xmlns:number="http://openoffice.org/2000/datastyle" 64 xmlns:svg="http://www.w3.org/2000/svg" 65 xmlns:chart="http://openoffice.org/2000/chart" 66 xmlns:dr3d="http://openoffice.org/2000/dr3d" 67 xmlns:math="http://www.w3.org/1998/Math/MathML" 68 xmlns:form="http://openoffice.org/2000/form" 69 xmlns:script="http://openoffice.org/2000/script" 70 office:class="text" 71 office:version="1.0" 72 xmlns:dc="http://purl.org/dc/elements/1.1/" 73 xmlns:meta="http://openoffice.org/2000/meta" 74 xmlns:config="http://openoffice.org/2001/config" 75 xmlns:help="http://openoffice.org/2000/help" 76 xmlns:xt="http://www.jclark.com/xt" 77 xmlns:system="http://www.jclark.com/xt/java/java.lang.System" 78 xmlns:xalan="http://xml.apache.org/xalan" 79 xmlns:java="http://xml.apache.org/xslt/java" 80 exclude-result-prefixes="java"> 81 82 83 <!-- *********************************** --> 84 <!-- *** write repeating table cells *** --> 85 <!-- *********************************** --> 86 87 88 <!-- matching cells to give out -> covered table cells are not written out --> 89 <xsl:template match="table:table-cell"> 90 <xsl:param name="collectedGlobalData"/> 91 <!-- position of the current input cell to get the correct colum style (hidden are also counted)--> 92 <xsl:param name="allColumnStyleEntries"/> 93 <xsl:param name="maxRowLength"/> 94 95 <xsl:if test="$isDebugMode"> 96 <xsl:message> 97 --------------> table:table-cell has been entered with node value: <xsl:value-of select="."/></xsl:message> 98 <xsl:message>table:number-columns-repeated: -<xsl:value-of select="@table:number-columns-repeated"/>-</xsl:message> 99 </xsl:if> 100 101 <xsl:call-template name="create-column-position-variable"> 102 <!-- position of the current input cell to get the correct colum style (hidden are also counted)--> 103 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 104 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 105 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 106 </xsl:call-template> 107 108 </xsl:template> 109 110 111 112 <xsl:template name="create-column-position-variable"> 113 <!-- position of the current input cell to get the correct colum style (hidden are also counted)--> 114 <xsl:param name="allColumnStyleEntries"/> 115 <xsl:param name="collectedGlobalData"/> 116 <xsl:param name="maxRowLength"/> 117 118 <!-- column position needed for styles, esp. for column-hidden-flag --> 119 <xsl:variable name="preceding-columns"> 120 <xsl:for-each select="preceding-sibling::*"> 121 <xsl:element name="quantity"> 122 <xsl:choose> 123 <xsl:when test="string-length(@table:number-columns-repeated) = 0">1</xsl:when> 124 <xsl:otherwise><xsl:value-of select="@table:number-columns-repeated"/></xsl:otherwise> 125 </xsl:choose> 126 </xsl:element> 127 </xsl:for-each> 128 </xsl:variable> 129 130 <xsl:choose> 131 <xsl:when test="function-available('xt:node-set')"> 132 <xsl:call-template name="create-table-cell"> 133 <!-- position of the current input cell to get the correct colum style (hidden are also counted)--> 134 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 135 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 136 <xsl:with-param name="column-position" select="sum(xt:node-set($preceding-columns)/quantity) + 1"/> 137 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 138 </xsl:call-template> 139 </xsl:when> 140 <xsl:when test="function-available('xalan:nodeset')"> 141 <xsl:call-template name="create-table-cell"> 142 <!-- position of the current input cell to get the correct colum style (hidden are also counted)--> 143 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 144 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 145 <xsl:with-param name="column-position" select="sum(xalan:nodeset($preceding-columns)/quantity) + 1"/> 146 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 147 </xsl:call-template> 148 </xsl:when> 149 <xsl:otherwise> 150 <xsl:element name="NodeSetFunctionNotAvailable"/> 151 <xsl:call-template name="create-table-cell"/> 152 </xsl:otherwise> 153 </xsl:choose> 154 </xsl:template> 155 156 157 158 <xsl:template name="create-table-cell"> 159 <!-- position of the current input cell to get the correct colum style (hidden are also counted)--> 160 <xsl:param name="allColumnStyleEntries"/> 161 <xsl:param name="collectedGlobalData"/> 162 <xsl:param name="maxRowLength"/> 163 <xsl:param name="column-position"/> 164 165 166 <xsl:if test="$isDebugMode"> 167 <xsl:message>NEW VALUE: column-position: -<xsl:value-of select="$column-position"/>-</xsl:message> 168 </xsl:if> 169 170 171 <!-- a hidden column will give out nothing --> 172 <xsl:if test="not($allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag)"> 173 <xsl:choose> 174 <!-- when the columns are not repeated the next column-positions raises up to 1, otherwise up to the amount of repeated columns --> 175 <xsl:when test="@table:number-columns-repeated"> 176 <!-- writes multiple entries of a cell --> 177 <xsl:call-template name="repeat-write-cell"> 178 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 179 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 180 <xsl:with-param name="column-position" select="$column-position"/> 181 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 182 <xsl:with-param name="number-columns-repeated" select="@table:number-columns-repeated"/> 183 </xsl:call-template> 184 </xsl:when> 185 <xsl:otherwise> 186 <!-- writes an entry of a cell --> 187 <xsl:call-template name="write-cell"> 188 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 189 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 190 <xsl:with-param name="column-position" select="$column-position"/> 191 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 192 </xsl:call-template> 193 </xsl:otherwise> 194 </xsl:choose> 195 </xsl:if> 196 197 </xsl:template> 198 199 200 201 <xsl:template name="repeat-write-cell"> 202 <xsl:param name="collectedGlobalData"/> 203 <xsl:param name="allColumnStyleEntries"/> 204 <xsl:param name="column-position"/> 205 <xsl:param name="maxRowLength"/> 206 <xsl:param name="number-columns-repeated"/> 207 208 <xsl:choose> 209 <!-- 2DO: This is the current workaround against the background simulation by an 'endless' repeating cell --> 210 <xsl:when test="$number-columns-repeated > 1 and $maxRowLength > $column-position"> 211 212 <xsl:if test="$isDebugMode"> 213 <xsl:message>+++++++++ starting cell writing +++++++++</xsl:message> 214 <xsl:message>number-columns-repeated: -<xsl:value-of select="$number-columns-repeated"/>-</xsl:message> 215 <xsl:message>maxRowLength: -<xsl:value-of select="$maxRowLength"/>-</xsl:message> 216 <xsl:message>column-position: -<xsl:value-of select="$column-position"/>-</xsl:message> 217 </xsl:if> 218 219 <!-- writes an entry of a cell --> 220 <xsl:call-template name="write-cell"> 221 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 222 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 223 <xsl:with-param name="column-position" select="$column-position"/> 224 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 225 </xsl:call-template> 226 <!-- repeat calling this method until all elements written out --> 227 <xsl:if test="$isDebugMode"> 228 <xsl:message>+++++++++ cell repetition +++++++++</xsl:message> 229 </xsl:if> 230 <xsl:call-template name="repeat-write-cell"> 231 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 232 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 233 <xsl:with-param name="column-position" select="$column-position + 1"/> 234 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 235 <xsl:with-param name="number-columns-repeated" select="$number-columns-repeated - 1"/> 236 </xsl:call-template> 237 </xsl:when> 238 <xsl:otherwise> 239 <!-- 2DO: This is the current workaround against the background simulation by an 'endless' repeating cell --> 240 <!-- When the maxRowLength is reached a last entry of a cell is written --> 241 <xsl:call-template name="write-cell"> 242 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 243 <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/> 244 <xsl:with-param name="column-position" select="$column-position"/> 245 <xsl:with-param name="maxRowLength" select="$maxRowLength"/> 246 </xsl:call-template> 247 </xsl:otherwise> 248 </xsl:choose> 249 </xsl:template> 250 251 252 253 <xsl:template name="write-cell"> 254 <xsl:param name="collectedGlobalData"/> 255 <xsl:param name="allColumnStyleEntries"/> 256 <xsl:param name="column-position"/> 257 <xsl:param name="maxRowLength"/> 258 259 260 <xsl:if test="$isDebugMode"> 261 <xsl:message>WriteTest -> If nothing between '-' write cell -<xsl:value-of select="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag"/>-</xsl:message> 262 </xsl:if> 263 264 <xsl:if test="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag"> 265 <xsl:if test="$isDebugMode"> 266 <xsl:message>TABLE COLUMN is hidden!</xsl:message> 267 </xsl:if> 268 </xsl:if> 269 270 <xsl:choose> 271 <!-- a hidden column will give out nothing --> 272 <xsl:when test="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag"> 273 <xsl:if test="$isDebugMode"> 274 <xsl:message>TABLE COLUMN is hidden!</xsl:message> 275 </xsl:if> 276 </xsl:when> 277 278 <!-- NOT a hidden column --> 279 <xsl:otherwise> 280 281 <!-- a table is a table header, when it has a "table:table-header-rows" ancestor --> 282 <xsl:variable name="tableDataType"> 283 <xsl:choose> 284 <xsl:when test="ancestor::table:table-header-rows"> 285 <xsl:text>th</xsl:text> 286 </xsl:when> 287 <xsl:otherwise> 288 <xsl:text>td</xsl:text> 289 </xsl:otherwise> 290 </xsl:choose> 291 </xsl:variable> 292 293 <xsl:choose> 294 <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++--> 295 <xsl:when test="$outputType = 'CSS_HEADER'"> 296 <xsl:element name="{$tableDataType}"> 297 298 <xsl:if test="$isDebugMode"> 299 <xsl:message> 300 *****************************************'<xsl:value-of select="$tableDataType"/>' element has been added!</xsl:message> 301 </xsl:if> 302 303 <xsl:if test="@table:number-columns-spanned"> 304 <xsl:attribute name="colspan"> 305 <xsl:value-of select="@table:number-columns-spanned"/> 306 </xsl:attribute> 307 </xsl:if> 308 <xsl:if test="@table:number-rows-spanned"> 309 <xsl:attribute name="rowspan"> 310 <xsl:value-of select="@table:number-rows-spanned"/> 311 </xsl:attribute> 312 </xsl:if> 313 314 315 316 <!-- *** the cell-style *** --> 317 <!-- The cell style has no conclusion with the column style, so we switch the order/priorities due to browser issues 318 319 The cell-style depends on two attributes: 320 321 1) table:style-name - the style properties of cell. When they exist, a default alignement (cp. below) will be added for the 322 case of no alignment in the style exist. 323 324 2) table:value-type - the value type of the table-cell giving the default alignments. 325 By default a string value is left aligned, all other are aligned:right. 326 --> 327 <xsl:choose> 328 <xsl:when test="@table:style-name"> 329 <xsl:attribute name="style"> 330 331 <!-- CELL-STYLE: alignment by table:value-type (without existing table:style-name)--> 332 <xsl:variable name="cellStyle" select="$collectedGlobalData/allstyles/*[name()=current()/@table:style-name]"/> 333 <xsl:choose> 334 <xsl:when test="string-length($cellStyle) > 0 and not(contains($cellStyle, 'text-align'))"> 335 <!-- CELL-STYLE: alignment by table:value-type --> 336 <!-- no alignment in the cell style, the alignment based on the table:value-type will be added --> 337 <xsl:choose> 338 <xsl:when test="@table:value-type and not(@table:value-type = 'string')"> 339 <xsl:value-of select="concat($collectedGlobalData/allstyles/*[name()=current()/@table:style-name], 'text-align:right; ')"/> 340 </xsl:when> 341 <xsl:otherwise> 342 <xsl:value-of select="concat($collectedGlobalData/allstyles/*[name()=current()/@table:style-name], 'text-align:left; ')"/> 343 </xsl:otherwise> 344 </xsl:choose> 345 </xsl:when> 346 <xsl:otherwise> 347 <!-- CELL-STYLE: alignment by table:value-type --> 348 <!-- no CSS style properties exist, only alignment from the table:value-type will be used --> 349 <xsl:choose> 350 <xsl:when test="@table:value-type and not(@table:value-type = 'string')">text-align:right; </xsl:when> 351 <xsl:otherwise>text-align:left; </xsl:otherwise> 352 </xsl:choose> 353 </xsl:otherwise> 354 </xsl:choose> 355 356 <!-- column-style (disjunct of cell style --> 357 <!-- 2DO: only absolut styles are supported, relative styles (i.e. 'style:rel-column-width' e.g. with value "8933*" are ignored. 358 Issue: browsers (not sure if CSS) does not support the '*' relationship, only the '%', where the sum is always '100'! 359 For this, it is easier to work on with the absolute values, instead of calculating the values for 100% --> 360 <xsl:value-of select="$allColumnStyleEntries/column-style-entry[position()=$column-position]"/> 361 </xsl:attribute> 362 <!-- CELL-STYLE: table:style-name --> 363 <xsl:attribute name="class"> 364 <xsl:value-of select="translate(@table:style-name, '. %()/\', '')"/> 365 </xsl:attribute> 366 </xsl:when> 367 <xsl:otherwise> 368 <xsl:attribute name="style"> 369 <!-- CELL-STYLE: alignment by table:value-type (without existing table:style-name)--> 370 <!-- no table:style-name exist, only alignment from the table:value-type will be used --> 371 <xsl:choose> 372 <xsl:when test="@table:value-type and not(@table:value-type = 'string')"> 373 text-align:right; 374 </xsl:when> 375 <xsl:otherwise> 376 text-align:left; 377 </xsl:otherwise> 378 </xsl:choose> 379 </xsl:attribute> 380 </xsl:otherwise> 381 </xsl:choose> 382 383 <xsl:choose> 384 <!-- In case of no cell content a non-breakable space will be inserted 385 to make the browser show the table-cell grid --> 386 <xsl:when test="not(child::text()) and not(child::*)"> 387 <xsl:text>  </xsl:text> 388 </xsl:when> 389 <xsl:otherwise> 390 <!-- *** the column-style *** --> 391 <!-- the column style has no conclusion with the cell style, so we switch the order/priorities due to browser issues--> 392 <xsl:element name="span"> 393 <xsl:attribute name="class"> 394 <xsl:value-of select="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@style-name"/> 395 </xsl:attribute> 396 <xsl:apply-templates> 397 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 398 </xsl:apply-templates> 399 </xsl:element> 400 </xsl:otherwise> 401 </xsl:choose> 402 </xsl:element> 403 </xsl:when> 404 405 <!--+++++ HTML 4.0 INLINED WAY +++++--> 406 <xsl:when test="$outputType = 'CSS_INLINED'"> 407 <xsl:element name="{$tableDataType}"> 408 409 <xsl:if test="@table:number-columns-spanned"> 410 <xsl:attribute name="colspan"> 411 <xsl:value-of select="@table:number-columns-spanned"/> 412 </xsl:attribute> 413 </xsl:if> 414 <xsl:if test="@table:number-rows-spanned"> 415 <xsl:attribute name="rowspan"> 416 <xsl:value-of select="@table:number-rows-spanned"/> 417 </xsl:attribute> 418 </xsl:if> 419 420 <xsl:attribute name="style"> 421 <!-- cell-style --> 422 <xsl:value-of select="$collectedGlobalData/allstyles/*[name()=current()/@table:style-name]"/> 423 <!-- column-style --> 424 <xsl:value-of select="$allColumnStyleEntries/column-style-entry[position()=$column-position]"/> 425 <!-- TABLE:VALUE-TYPE - the value of a table-cell will be aligned left by default only exlicit non-string is aligned:right--> 426 <xsl:choose> 427 <xsl:when test="@table:value-type and not(@table:value-type = 'string')"> 428 <xsl:text>text-align:right;</xsl:text> 429 </xsl:when> 430 <xsl:otherwise> 431 <xsl:text>text-align:left;</xsl:text> 432 </xsl:otherwise> 433 </xsl:choose> 434 </xsl:attribute> 435 436 <!--   is a non-breakable space, necessary to make to the browser show the table-cell grid --> 437 <xsl:if test="not(child::text()) and not(child::*)">  </xsl:if> 438 <xsl:apply-templates> 439 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 440 </xsl:apply-templates> 441 </xsl:element> 442 </xsl:when> 443 <!--+++++ PALM INLINED WAY +++++--> 444 <xsl:when test="$outputType = 'PALM'"> 445 <xsl:element name="{$tableDataType}"> 446 <xsl:if test="@table:number-columns-spanned"> 447 <xsl:attribute name="colspan"> 448 <xsl:value-of select="@table:number-columns-spanned"/> 449 </xsl:attribute> 450 </xsl:if> 451 452 <xsl:if test="@table:number-rows-spanned"> 453 <xsl:attribute name="rowspan"> 454 <xsl:value-of select="@table:number-rows-spanned"/> 455 </xsl:attribute> 456 </xsl:if> 457 <xsl:apply-templates> 458 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 459 </xsl:apply-templates> 460 </xsl:element> 461 </xsl:when> 462 <!--+++++ WML WAY +++++--> 463 <xsl:when test="$outputType = 'WML'"> 464 <xsl:choose> 465 <xsl:when test="not($allColumnStyleEntries/column-style-entry[last() = $column-position])"> 466 <xsl:apply-templates> 467 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 468 </xsl:apply-templates> 469 <xsl:text>, </xsl:text> 470 </xsl:when> 471 <xsl:otherwise> 472 <xsl:apply-templates> 473 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 474 </xsl:apply-templates> 475 <xsl:text>; </xsl:text> 476 <xsl:element name="br"/> 477 </xsl:otherwise> 478 </xsl:choose> 479 </xsl:when> 480 </xsl:choose> 481 </xsl:otherwise> 482 </xsl:choose> 483 </xsl:template> 484 </xsl:stylesheet>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |