[ 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:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder" 79 xmlns:xalan="http://xml.apache.org/xalan" 80 xmlns:java="http://xml.apache.org/xslt/java" 81 exclude-result-prefixes="java"> 82 83 <xsl:output method ="xml" 84 encoding ="UTF-8" 85 indent ="yes"/> 86 87 88 89 <!--+++++ INCLUDED XSL MODULES +++++--> 90 <!-- inherited style properties will be collected and written in a CSS header (CSS) --> 91 <xsl:include href="style_header.xsl"/> 92 93 <!-- inherited style properties will be collected and written as html properties in a temporary variable (HTML4, PALM) --> 94 <xsl:include href="style_inlined.xsl"/> 95 96 <!-- our xml style properties will be mapped to CSS and HTML4.x properties --> 97 <xsl:include href="style_mapping.xsl"/> 98 99 <!-- common element handling --> 100 <xsl:include href="common.xsl"/> 101 102 <!-- table handling --> 103 <xsl:include href="table.xsl"/> 104 105 <!-- palm handling --> 106 <xsl:include href="palm.xsl"/> 107 108 <!-- global document handling --> 109 <xsl:include href="global_document.xsl"/> 110 111 112 113 114 115 116 117 <!--+++++ PARAMETER FROM THE APPLICATION AND GLOBAL VARIABLES +++++--> 118 119 <!-- MANDATORY: URL of meta stream --> 120 <xsl:param name="metaFileURL"/> 121 122 <!-- MANDATORY: URL of styles stream --> 123 <xsl:param name="stylesFileURL"/> 124 125 <!-- MANDATORY: for resolving relative links 126 For resolving realtive links to the packed SO document, i.e. the path/URL of the jared sxw file (e.g. meta.xml, styles.xml, links to graphics in a relative directory) --> 127 <xsl:param name="absoluteSourceDirRef"/> 128 129 <!-- OPTIONAL (mandatory, when when source is compressed): Necessary for the in the packed OO document embedded files (mostly graphics from the compressed /Picture dir). 130 When the OpenOffice (OO) file has been unpacked the absoluteSoureDirRef can be taken, 131 Otherwise, a JAR URL could be choosen or when working with OpenOffice a so called Package-URL encoded over HTTP can be used to 132 access the jared contents of the the jared document. . --> 133 <xsl:param name="jaredRootURL" select="$absoluteSourceDirRef"/> 134 135 <!-- OPTIONAL (mandatory, when used in session based environment) 136 Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL). 137 This URL session is used when creating links to graphics by XSLT. Otherwise the user havt to log again in for every graphic he would like to see. --> 138 <xsl:param name="optionalURLSuffix"/> 139 140 <!-- OPTIONAL: DPI (dots per inch) the standard solution of given pictures (necessary for the conversion of 'cm' into 'pixel')--> 141 <!-- Although many pictures have the 96 dpi resolution, a higher resoltion give better results for common browsers --> 142 <xsl:param name="dpi" select="96"/> 143 144 <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality 145 (i.e. debugging time and encoding chapter names for the content-table as href and anchors ) --> 146 <xsl:param name="disableJava" select="false"/> 147 <xsl:param name="isJavaDisabled" select="boolean($disableJava)"/> 148 149 <!-- OPTIONAL: user-agent will be differntiated by this parameter given by application (e.g. java servlet)--> 150 <xsl:param name="outputType" select="'CSS_HEADER'"/> 151 <!-- set of possible deviceTyps (WML is set in its own startfile main_wml.xsl): 152 <xsl:param name="outputType" select="'CSS_HEADER'"/> 153 <xsl:param name="outputType" select="'CSS_INLINED'"/> 154 <xsl:param name="outputType" select="'PALM'"/> --> 155 156 <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside --> 157 <xsl:param name="debug" select="false"/> 158 <xsl:param name="isDebugMode" select="boolean($debug)"/> 159 160 <!-- ************************************************************************* 161 OPTIONAL: NEEDED IN CONNECTION WITH A GLOBAL DOCUMENT --> 162 163 <!--SUMMARY: 164 following parameter triggers a (quite time consuming) enabling of bookmarks in the table-of-content. 165 IN DETAIL: 166 Currently some links used in the Office XML (e.g. in the content table as '#7.Some%20Example%20Headline%7Outline') 167 is not a valid URL (cmp. bug id# 102311). No file destination is specified nor exist any anchor element for these 168 links in the Office XML. 169 A workaround for this transformation therefore had to be made. This time-consuming mechanism is disabled by default and 170 can be activated by a parameter (i.e. 'disableLinkedTableOfContent'). A creation of an anchor is made for each header element. 171 All header titles gonna be encoding to be usable in a relative URL. --> 172 <xsl:param name="disableLinkedTableOfContent" select="false()"/> 173 174 <!-- The chapter numbers of the current document (as a sequence of a global document) is dependent of the number 175 of chapter of the same level in preceding documents. --> 176 <xsl:param name="precedingChapterLevel1" select="0"/> 177 <xsl:param name="precedingChapterLevel2" select="0"/> 178 <xsl:param name="precedingChapterLevel3" select="0"/> 179 <xsl:param name="precedingChapterLevel4" select="0"/> 180 <xsl:param name="precedingChapterLevel5" select="0"/> 181 <xsl:param name="precedingChapterLevel6" select="0"/> 182 <xsl:param name="precedingChapterLevel7" select="0"/> 183 <xsl:param name="precedingChapterLevel8" select="0"/> 184 <xsl:param name="precedingChapterLevel9" select="0"/> 185 <xsl:param name="precedingChapterLevel10" select="0"/> 186 187 <!-- XML documents containing a table of contents, 188 gonna link for usability reason above each chapter to the preceding and following document and the content table --> 189 <xsl:param name="contentTableURL"/> 190 191 <!-- Needed for the bug workaround of missing content table links 192 by this ambigous HTML references from the content table can be evoided--> 193 <xsl:param name="globalDocumentRefToCurrentFile"/> 194 195 <!-- Needed for the bug workaround of missing content table links 196 by this node-set the relation between content-table link and children document header can be unambigous established --> 197 <xsl:param name="contentTableHeadings"/> 198 199 200 <!-- END OF GLOBAL DOCUMENT SECTION 201 *************************************************************************--> 202 203 204 205 <!-- works for normal separated zipped xml files as for flat filter single xml file format as well --> 206 <xsl:variable name="office:meta-file" select="document($metaFileURL)"/> 207 <xsl:variable name="office:styles-file" select="document($stylesFileURL)"/> 208 <xsl:variable name="office:font-decls" select="$office:styles-file/*/office:font-decls"/> 209 <xsl:variable name="office:styles" select="$office:styles-file/*/office:styles"/> 210 <!-- office:automatic-styles may occure in two different files (i.d. content.xml and styles.xml). Furthermore the top level tag is different in a flat xml file --> 211 <xsl:variable name="office:automatic-styles" select="/*/office:automatic-styles"/> 212 213 <!-- simple declaration of WML used to avoid parser errors --> 214 <xsl:variable name="wap-paragraph-elements-without-table-row"/> 215 <xsl:variable name="wap-paragraph-elements"/> 216 <xsl:template name="wml-repeat-write-row"/> 217 218 219 <!-- ************************************* --> 220 <!-- *** build the propriate HTML file *** --> 221 <!-- ************************************* --> 222 223 <xsl:template match="/"> 224 225 <!--<xsl:message> 226 227 228 Entered the styleSheets, transformation begins... </xsl:message>--> 229 230 <xsl:choose> 231 <xsl:when test="$isDebugMode"> 232 <xsl:call-template name="check-parameter"/> 233 234 <xsl:if test="not($isJavaDisabled)"> 235 <xsl:call-template name="debug-style-collecting-time"/> 236 </xsl:if> 237 </xsl:when> 238 <xsl:otherwise> 239 <!-- to access the variable like a node-set it is necessary to convert it 240 from a result-tree-fragment (RTF) to a node set using the James Clark extension --> 241 <xsl:variable name="collectedGlobalData-RTF"> 242 <xsl:call-template name='create-all-inline-styles'/> 243 </xsl:variable> 244 245 <xsl:choose> 246 <xsl:when test="function-available('xt:node-set')"> 247 <xsl:call-template name="start"> 248 <xsl:with-param name="collectedGlobalData" select="xt:node-set($collectedGlobalData-RTF)"/> 249 </xsl:call-template> 250 </xsl:when> 251 <xsl:when test="function-available('xalan:nodeset')"> 252 <xsl:call-template name="start"> 253 <xsl:with-param name="collectedGlobalData" select="xalan:nodeset($collectedGlobalData-RTF)"/> 254 </xsl:call-template> 255 </xsl:when> 256 <xsl:otherwise> 257 <xsl:element name="NodeSetFunctionNotAvailable"/> 258 <xsl:call-template name="start"/> 259 </xsl:otherwise> 260 </xsl:choose> 261 </xsl:otherwise> 262 </xsl:choose> 263 </xsl:template> 264 265 <xsl:template name="start"> 266 <xsl:param name="collectedGlobalData"/> 267 268 <xsl:choose> 269 <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++--> 270 <xsl:when test="$outputType = 'CSS_HEADER'"> 271 <xsl:element name="html"> 272 <xsl:element name="head"> 273 <xsl:if test="$isDebugMode"><xsl:message>CSS helper variable will be created....</xsl:message></xsl:if> 274 <xsl:call-template name='common-header-properties'/> 275 <xsl:if test="$isDebugMode"><xsl:message>CSS variable ready, header will be created....</xsl:message></xsl:if> 276 <!-- constructing the css header simulating inheritance of style-families by style order --> 277 <xsl:call-template name='create-css-styleheader'/> 278 <xsl:if test="$isDebugMode"><xsl:message>CSS header creation finished!</xsl:message></xsl:if> 279 </xsl:element> 280 281 282 283 <xsl:variable name="backgroundImageURL" select="$office:automatic-styles/style:page-master/style:properties/style:background-image/@xlink:href"/> 284 <xsl:element name="body"> 285 <!-- background image --> 286 <xsl:if test="$backgroundImageURL"> 287 <xsl:attribute name="background"> 288 <xsl:choose> 289 <!-- for images jared in open office document --> 290 <xsl:when test="contains($backgroundImageURL, '#Pictures/')"> 291 <!-- creating an absolute http URL to the contained/packed image file --> 292 <xsl:value-of select="concat($jaredRootURL, '/Pictures/', substring-after($backgroundImageURL, '#Pictures/'), $optionalURLSuffix)"/> 293 </xsl:when> 294 <xsl:otherwise> 295 <xsl:attribute name="src"><xsl:value-of select="$backgroundImageURL"/></xsl:attribute> 296 </xsl:otherwise> 297 </xsl:choose> 298 </xsl:attribute> 299 </xsl:if> 300 301 <!-- processing the content of the xml file --> 302 <xsl:apply-templates select="/*/office:body"> 303 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 304 </xsl:apply-templates> 305 </xsl:element> 306 307 </xsl:element> 308 </xsl:when> 309 310 <!--+++++ HTML 4.0 INLINING +++++--> 311 <xsl:when test="$outputType = 'CSS_INLINED'"> 312 <xsl:element name="html"> 313 <xsl:element name="head"> 314 <xsl:call-template name='common-header-properties'/> 315 </xsl:element> 316 317 <xsl:variable name="backgroundImageURL" select="$office:automatic-styles/style:page-master/style:properties/style:background-image/@xlink:href"/> 318 <xsl:element name="body"> 319 <!-- background image --> 320 <xsl:if test="$backgroundImageURL"> 321 <xsl:attribute name="background"> 322 <xsl:choose> 323 <!-- for images jared in open office document --> 324 <xsl:when test="contains($backgroundImageURL, '#Pictures/')"> 325 <!-- creating an absolute http URL to the contained/packed image file --> 326 <xsl:value-of select="concat($jaredRootURL, '/Pictures/', substring-after($backgroundImageURL, '#Pictures/'), $optionalURLSuffix)"/> 327 </xsl:when> 328 <xsl:otherwise> 329 <xsl:attribute name="src"><xsl:value-of select="$backgroundImageURL"/></xsl:attribute> 330 </xsl:otherwise> 331 </xsl:choose> 332 </xsl:attribute> 333 </xsl:if> 334 <xsl:apply-templates select="/*/office:body"> 335 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 336 </xsl:apply-templates> 337 </xsl:element> 338 </xsl:element> 339 </xsl:when> 340 341 <!--+++++ PALM-VII (3.2 HTML SUBSET) +++++--> 342 <xsl:when test="$outputType = 'PALM'"> 343 <!-- the proxy will convert the html file later to PQA --> 344 <xsl:element name="html"> 345 <xsl:element name="head"> 346 <xsl:call-template name='palm-header-properties'/> 347 </xsl:element> 348 349 <xsl:element name="body"> 350 <!-- processing the content of the xml file --> 351 <xsl:apply-templates select="/*/office:body"> 352 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 353 </xsl:apply-templates> 354 </xsl:element> 355 </xsl:element> 356 </xsl:when> 357 </xsl:choose> 358 </xsl:template> 359 360 361 362 <!-- ********************************************* --> 363 <!-- *** Header for CSS_INLINED and CSS_HEADER *** --> 364 <!-- ********************************************* --> 365 366 <xsl:template name='common-header-properties'> 367 <xsl:apply-templates select="$office:meta-file/*/office:meta/dc:title"/> 368 <xsl:apply-templates select="$office:meta-file/*/office:meta/dc:description"/> 369 <!--2DO add further header elements.. 370 <xsl:apply-templates select="$office:meta-file/*/office:meta/dc:subject"/> 371 <xsl:apply-templates select="$office:meta-file/*/office:meta/meta:keywords[postition()=1]"/>--> 372 </xsl:template> 373 374 <xsl:template match="dc:title"> 375 <xsl:element name="title"> 376 <xsl:value-of select="."/> 377 </xsl:element> 378 </xsl:template> 379 380 <xsl:template match="dc:description"> 381 <xsl:element name="meta"> 382 <xsl:attribute name="name"> 383 <xsl:text>description</xsl:text> 384 </xsl:attribute> 385 <xsl:attribute name="content"> 386 <xsl:value-of select="."/> 387 </xsl:attribute> 388 </xsl:element> 389 </xsl:template> 390 391 392 <!-- ********************************************* --> 393 <!-- *** Measuring the time for style creating *** --> 394 <!-- ********************************************* --> 395 396 397 <xsl:template name="debug-style-collecting-time"> 398 399 <xsl:variable name="startTime-RTF"> 400 <xsl:choose> 401 <xsl:when test="function-available('system:current-time-millis')"> 402 <xsl:value-of select="system:current-time-millis()"/> 403 </xsl:when> 404 <xsl:when test="function-available('java:java.lang.System.currentTimeMillis')"> 405 <xsl:value-of select="java:java.lang.System.currentTimeMillis()"/> 406 </xsl:when> 407 </xsl:choose> 408 </xsl:variable> 409 410 411 412 <xsl:variable name="collectedGlobalData-RTF"> 413 <xsl:call-template name='create-all-inline-styles'/> 414 </xsl:variable> 415 416 417 <xsl:choose> 418 <xsl:when test="function-available('xt:node-set')"> 419 <xsl:message>Creating the inline styles....</xsl:message> 420 <xsl:variable name="startTime" select="number(xt:node-set($startTime-RTF))"/> 421 <xsl:variable name="collectedGlobalData" select="xt:node-set($collectedGlobalData-RTF)"/> 422 <xsl:variable name="endTime" select="system:current-time-millis()"/> 423 424 <xsl:message>Time for instantiating style variable: <xsl:value-of select="($endTime - $startTime)"/> ms</xsl:message> 425 <xsl:call-template name="start"> 426 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 427 </xsl:call-template> 428 </xsl:when> 429 <xsl:when test="function-available('xalan:nodeset')"> 430 <xsl:message>Creating the inline styles....</xsl:message> 431 <xsl:variable name="startTime" select="number(xalan:nodeset($startTime-RTF))"/> 432 <xsl:variable name="endTime" select="java:java.lang.System.currentTimeMillis()"/> 433 <xsl:variable name="collectedGlobalData" select="xalan:nodeset($collectedGlobalData-RTF)"/> 434 435 <xsl:message>Time for instantiating style variable: <xsl:value-of select="($endTime - $startTime)"/> ms</xsl:message> 436 <xsl:call-template name="start"> 437 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/> 438 </xsl:call-template> 439 </xsl:when> 440 </xsl:choose> 441 442 </xsl:template> 443 444 <!-- DEBUG purpose only: checking the parameters of this template--> 445 <xsl:template name="check-parameter"> 446 <xsl:message>Parameter dpi: <xsl:value-of select="$dpi"/></xsl:message> 447 <xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL"/></xsl:message> 448 <xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL"/></xsl:message> 449 <xsl:message>Parameter absoluteSourceDirRef: <xsl:value-of select="$absoluteSourceDirRef"/></xsl:message> 450 <xsl:message>Parameter precedingChapterLevel1 : <xsl:value-of select="$precedingChapterLevel1"/></xsl:message> 451 <xsl:message>Parameter precedingChapterLevel2 : <xsl:value-of select="$precedingChapterLevel2"/></xsl:message> 452 <xsl:message>Parameter precedingChapterLevel3 : <xsl:value-of select="$precedingChapterLevel3"/></xsl:message> 453 <xsl:message>Parameter precedingChapterLevel4 : <xsl:value-of select="$precedingChapterLevel4"/></xsl:message> 454 <xsl:message>Parameter precedingChapterLevel5 : <xsl:value-of select="$precedingChapterLevel5"/></xsl:message> 455 <xsl:message>Parameter precedingChapterLevel6 : <xsl:value-of select="$precedingChapterLevel6"/></xsl:message> 456 <xsl:message>Parameter precedingChapterLevel7 : <xsl:value-of select="$precedingChapterLevel7"/></xsl:message> 457 <xsl:message>Parameter precedingChapterLevel8 : <xsl:value-of select="$precedingChapterLevel8"/></xsl:message> 458 <xsl:message>Parameter precedingChapterLevel9 : <xsl:value-of select="$precedingChapterLevel9"/></xsl:message> 459 <xsl:message>Parameter precedingChapterLevel10: <xsl:value-of select="$precedingChapterLevel10"/></xsl:message> 460 </xsl:template> 461 462 </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 |