[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/MIME/Viewer/ooo/ -> style_mapping.xsl (source)

   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      <xsl:template name="write-style-properties">
  84          <xsl:param name="styleAttributePath"/>
  85  
  86          <xsl:choose>
  87              <!--+++++ CSS PROPERTIES  +++++-->
  88              <xsl:when test="$outputType = 'CSS_HEADER' or $outputType = 'CSS_INLINED'">
  89  
  90                  <xsl:for-each select="$styleAttributePath">
  91                  <!-- isDebugModeMESSAGE:
  92                      <xsl:message> Name:<xsl:value-of select="name()"/> Value:<xsl:value-of select="."/></xsl:message>      -->
  93  
  94  
  95                      <!-- <!ATTLIST style:properties style:horizontal-pos (from-left|left|center|right|from-inside|inside|outside)#IMPLIED>-->
  96                      <!-- 2DO: is inside/from-inside also better showable ? -->
  97                      <!-- !!!! 2DO: Still there have to be placed a <br clear='all'/> to disable the flow!!!!-->
  98                      <!--           The OOo attribute 'style:number-wrapped-paragraphs' is currently ignored -->
  99                      <xsl:choose>
 100                          <xsl:when test='name(.)="style:wrap"'>
 101                              <xsl:choose>
 102                                  <xsl:when test='.="left"'>
 103                                      <xsl:text>float: right; </xsl:text>
 104                                  </xsl:when>
 105                                  <xsl:when test='.="right"'>
 106                                      <xsl:text>float: left; </xsl:text>
 107                                  </xsl:when>
 108                              </xsl:choose>
 109                          </xsl:when>
 110  
 111                          <xsl:when test='name(.) = "style:horizontal-pos"'>
 112                              <xsl:choose>
 113                                  <xsl:when test='.="left"'>
 114                                      <xsl:text>align: left; </xsl:text>
 115                                  </xsl:when>
 116                                  <xsl:when test='.="right"'>
 117                                      <xsl:text>align: right; </xsl:text>
 118                                  </xsl:when>
 119                                  <xsl:when test='.="center"'>
 120                                      <xsl:text>align: center; </xsl:text>
 121                                  </xsl:when>
 122                              </xsl:choose>
 123                          </xsl:when>
 124  <!-- results into a bad view (overlapped) in Mozilla 1.0
 125                          <xsl:when test='name(.) = "table:align"'>
 126                              <xsl:choose>
 127                                  <xsl:when test='.="left"'>
 128                                      <xsl:text>float: right; </xsl:text>
 129                                  </xsl:when>
 130                                  <xsl:when test='.="right"'>
 131                                      <xsl:text>float: left; </xsl:text>
 132                                  </xsl:when>
 133                              </xsl:choose>
 134                          </xsl:when>
 135  -->
 136  
 137                          <!-- PADDING for all variations: fo:padding, fo:padding-top, fo:padding-bottom, fo:padding-left, fo:padding-right -->
 138                          <xsl:when test='contains(name(.),"fo:padding")'>
 139                              <xsl:text>padding: </xsl:text>
 140                              <xsl:value-of select="."/>
 141                              <xsl:text>; </xsl:text>
 142                          </xsl:when>
 143                          <!--
 144                          fo:border
 145                          fo:border-top
 146                          fo:border-bottom
 147                          fo:border-left
 148                          fo:border-right
 149  
 150                              At present, all four borders must be set simultaneously by using either
 151                              the fo:border property or by attaching all four of the other border
 152                              properties to an item set element. In the latter case, if one or more
 153                              of the properties is missing their values are assumed to be none. The
 154                              only border styles supported are none or hidden, solid, and double. Any
 155                              other border style specified is displayed as solid. Transparent borders
 156                              are not supported and the border widths thin, medium, and thick are
 157                              mapped to lengths. In addition, only some distinct border widths are
 158                              supported. Unsupported widths are rounded up to the next supported
 159                              width.
 160                              If there are no padding properties specified within the same
 161                              item set element, a default padding is used for sides that have a
 162                              border. A value of 0cm is used for sides without a border.
 163                              (cp. wd-so-xml-text.sdw)
 164                          -->
 165  
 166  <!--2DO START: change measurement equally -->
 167                          <xsl:when test='name(.)="fo:border"'>
 168                              <xsl:choose>
 169                                  <!-- changing the distance measure: inch to in -->
 170                                  <xsl:when test="contains(., 'ch')">
 171                                      <xsl:text>border-width:</xsl:text><xsl:value-of select="substring-before(.,'ch ')"/><xsl:text>; </xsl:text>
 172                                      <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'ch '), ' ')"/><xsl:text>; </xsl:text>
 173                                      <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'ch '), ' ')"/><xsl:text>; </xsl:text>
 174                                  </xsl:when>
 175                                  <xsl:when test="contains(., 'cm')">
 176                                      <xsl:text>border-width:</xsl:text><xsl:value-of select="substring-before(.,' ')"/><xsl:text>; </xsl:text>
 177                                      <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'cm '), ' ')"/><xsl:text>; </xsl:text>
 178                                      <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'cm '), ' ')"/><xsl:text>; </xsl:text>
 179                                  </xsl:when>
 180                                  <xsl:when test="contains(., 'pt')">
 181                                      <xsl:text>border-width:</xsl:text><xsl:value-of select="substring-before(.,' ')"/><xsl:text>; </xsl:text>
 182                                      <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'pt '), ' ')"/><xsl:text>; </xsl:text>
 183                                      <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'pt '), ' ')"/><xsl:text>; </xsl:text>
 184                                  </xsl:when>
 185                              </xsl:choose>
 186                          </xsl:when>
 187                          <xsl:when test='name(.)="fo:border-top"'>
 188                              <xsl:text>border-top: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 189                          </xsl:when>
 190                          <xsl:when test='name(.)="fo:border-bottom"'>
 191                              <xsl:text>border-bottom: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 192                          </xsl:when>
 193                          <xsl:when test='name(.)="fo:border-left"'>
 194                              <xsl:text>border-left: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 195                          </xsl:when>
 196                          <xsl:when test='name(.)="fo:border-right"'>
 197                              <xsl:text>border-right: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 198                          </xsl:when>
 199                          <xsl:when test='name(.)="style:column-width"'>
 200                              <xsl:choose>
 201                                  <!-- changing the distance measure: inch to in -->
 202                                  <xsl:when test="contains(., 'ch')">
 203                                      <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>; </xsl:text>
 204                                  </xsl:when>
 205                                  <xsl:otherwise>
 206                                      <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 207                                  </xsl:otherwise>
 208                              </xsl:choose>
 209                          </xsl:when>
 210                          <xsl:when test='name(.)="style:row-height"'>
 211                              <xsl:choose>
 212                                  <!-- changing the distance measure: inch to in -->
 213                                  <xsl:when test="contains(., 'ch')">
 214                                      <xsl:text>height:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>; </xsl:text>
 215                                  </xsl:when>
 216                                  <xsl:otherwise>
 217                                      <xsl:text>height:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 218                                  </xsl:otherwise>
 219                              </xsl:choose>
 220                          </xsl:when>
 221                          <xsl:when test='name(.)="fo:width"'>
 222                              <xsl:choose>
 223                                  <!-- changing the distance measure: inch to in -->
 224                                  <xsl:when test="contains(., 'ch')">
 225                                      <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>; </xsl:text>
 226                                  </xsl:when>
 227                                  <xsl:otherwise>
 228                                      <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 229                                  </xsl:otherwise>
 230                              </xsl:choose>
 231                          </xsl:when>
 232  <!--2DO END: change measurement equally -->
 233                          <xsl:when test='name(.)="fo:font-style"'>
 234                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 235                          </xsl:when>
 236                          <xsl:when test='name(.)="style:font-name"'>
 237                              <xsl:text>font-family:</xsl:text>
 238                                  <xsl:variable name="content" select="."/>
 239                                  <xsl:value-of select="$office:font-decls/style:font-decl[@style:name=$content]/@fo:font-family"/>
 240                              <xsl:text>; </xsl:text>
 241                              <xsl:if test="contains($office:font-decls/style:font-decl[@style:name=$content]/@style:font-style-name, 'Italic')">
 242                                  <xsl:text>font-style:italic; </xsl:text>
 243                              </xsl:if>
 244                              <xsl:if test="contains($office:font-decls/style:font-decl[@style:name=$content]/@style:font-style-name, 'Bold')">
 245                                  <xsl:text>font-weight:bold; </xsl:text>
 246                              </xsl:if>
 247                          </xsl:when>
 248                          <xsl:when test='name(.)="fo:font-weight"'>
 249                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 250                          </xsl:when>
 251                          <xsl:when test='name(.)="fo:font-size"'>
 252                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 253                          </xsl:when>
 254                          <xsl:when test='name(.)="fo:font-family"'>
 255                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 256                          </xsl:when>
 257                          <xsl:when test='name(.)="fo:color"'>
 258                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 259                          </xsl:when>
 260                          <xsl:when test='name(.)="fo:margin-left"'>
 261                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 262                          </xsl:when>
 263                          <xsl:when test='name(.)="fo:margin-right"'>
 264                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 265                          </xsl:when>
 266                          <xsl:when test='name(.)="fo:margin-top"'>
 267                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 268                          </xsl:when>
 269                          <xsl:when test='name(.)="fo:margin-bottom"'>
 270                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 271                          </xsl:when>
 272                          <xsl:when test='name(.)="fo:line-height"'>
 273                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 274                          </xsl:when>
 275                          <xsl:when test='name(.)="fo:text-align"'>
 276                              <!-- IMPORTANT is necessary as table cell value alignment is decided by runtime over the valuetype
 277                                   Otherwise a table cell style-class will ALWAYS be overwritten by the run-time value -->
 278                               <xsl:choose>
 279                                  <xsl:when test="contains(., 'start')">
 280                                      <xsl:text>text-align:left ! important; </xsl:text>
 281                                  </xsl:when>
 282                                  <xsl:when test="contains(., 'end')">
 283                                      <xsl:text>text-align:right ! important; </xsl:text>
 284                                  </xsl:when>
 285                                  <xsl:otherwise>
 286                                      <xsl:text>text-align:</xsl:text><xsl:value-of select='.'/><xsl:text> ! important; </xsl:text>
 287                                  </xsl:otherwise>
 288                               </xsl:choose>
 289                          </xsl:when>
 290                          <xsl:when test='name(.)="fo:text-indent"'>
 291                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 292                          </xsl:when>
 293                          <xsl:when test='name(.)="style:text-background-color"'>
 294                              <xsl:text>background-color:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 295                          </xsl:when>
 296                          <xsl:when test='name(.)="fo:background-color"'>
 297                              <xsl:text>background-color:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 298                          </xsl:when>
 299                          <xsl:when test='name(.)="style:background-image"'>
 300                              <xsl:text>background-image:url(</xsl:text><xsl:value-of select="@xlink:href"/><xsl:text>); </xsl:text>
 301                              <xsl:choose>
 302                                  <xsl:when test="@style:repeat = 'repeat'">
 303                                      <xsl:text>background-repeat:repeat; </xsl:text>
 304                                  </xsl:when>
 305                                  <xsl:otherwise>
 306                                      <xsl:text>background-repeat:no-repeat; </xsl:text>
 307                                  </xsl:otherwise>
 308                              </xsl:choose>
 309                          </xsl:when>
 310                          <!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
 311                          <xsl:when test='name(.)="fo:text-shadow"'>
 312                              <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
 313                          </xsl:when>
 314                          <xsl:when test='name(.)="style:text-crossing-out"'>
 315                              <xsl:if test='not(.="none")'>
 316                                  <xsl:text>text-decoration:line-through; </xsl:text>
 317                              </xsl:if>
 318                          </xsl:when>
 319                          <xsl:when test='name(.)="style:text-underline"'>
 320                              <xsl:if test='not(.="none")'>
 321                                  <xsl:text>text-decoration:underline; </xsl:text>
 322                              </xsl:if>
 323                          </xsl:when>
 324                          <xsl:when test='name(.)="style:text-position"'>
 325                              <xsl:if test='contains(., "sub")'>
 326                                  <xsl:text>vertical-align:sub; </xsl:text>
 327                              </xsl:if>
 328                              <xsl:if test='contains(., "sup")'>
 329                                  <xsl:text>vertical-align:sup; </xsl:text>
 330                              </xsl:if>
 331                          </xsl:when>
 332                          <!-- isDebugModeMESSAGE:
 333                          <xsl:otherwise>
 334                                  <xsl:message>No transformation implemented for attribute-typ <xsl:value-of select="name(.)"/></xsl:message>
 335                          </xsl:otherwise>-->
 336                      </xsl:choose>
 337                  </xsl:for-each>
 338              </xsl:when>
 339              <!--+++++ PALM 3.2 SUBSET AND WAP PROPERTIES  +++++-->
 340              <xsl:otherwise>
 341                  <xsl:for-each select="$styleAttributePath">
 342                      <!-- isDebugModeMESSAGE:
 343                      <xsl:message> Name:<xsl:value-of select="name()"/> Value:<xsl:value-of select="."/></xsl:message>      -->
 344  
 345                      <!-- BUG WORK AROUND:
 346                      Due to a bug in the XT Processor, it is not possible to create serveral elements in variable and search over them,
 347                      after explicit conversion to nodeset
 348                      This generated sting identifier shall be later changed back to a set of elements
 349                      -->
 350                      <xsl:choose>
 351                          <!--*** FORMAT ATTRIBUTES ***-->
 352  
 353                          <!-- Italic -->
 354                          <xsl:when test='name(.)="fo:font-style"'>
 355                              <xsl:if test="contains(., 'italic') or contains(., 'oblique')">
 356                                  <xsl:text>italic, </xsl:text>
 357                              </xsl:if>
 358                          </xsl:when>
 359  
 360                          <!-- Boldface -->
 361                          <xsl:when test='name(.)="fo:font-weight"'>
 362                              <xsl:if test="contains(., 'bold') or contains(., 'bolder')">
 363                                  <xsl:text>bold, </xsl:text>
 364                              </xsl:if>
 365                          </xsl:when>
 366  
 367                          <!-- Underline -->
 368                          <xsl:when test='name(.)="style:text-underline"'>
 369                              <xsl:text>underline, </xsl:text>
 370                          </xsl:when>
 371  
 372                          <!-- Alignment -->
 373                          <xsl:when test='name(.)="fo:text-align"'>
 374                               <xsl:choose>
 375                                  <xsl:when test="contains(., 'start')">
 376                                      <xsl:text>align:left, </xsl:text>
 377                                  </xsl:when>
 378                                  <xsl:when test="contains(., 'end')">
 379                                      <xsl:text>align:right, </xsl:text>
 380                                  </xsl:when>
 381                                  <xsl:when test="contains(., 'center')">
 382                                      <xsl:text>align:center, </xsl:text>
 383                                  </xsl:when>
 384                               </xsl:choose>
 385                          </xsl:when>
 386  
 387                          <!-- strikethrough -->
 388                          <xsl:when test='name(.)="style:text-crossing-out"'>
 389                              <xsl:text>strike, </xsl:text>
 390                          </xsl:when>
 391  
 392                          <!-- Font - size (Palm: emulator transformed sizes to available set (e.g. 30 to (probably) 9)-->
 393                          <xsl:when test='name(.)="fo:font-size"'>
 394                              <xsl:text>size:</xsl:text><xsl:value-of select="."/><xsl:text>:size, </xsl:text>
 395                          </xsl:when>
 396  
 397                          <!-- Font - Color (PALM: but mostly only 2 available)
 398                              black (#000000)
 399                              gray (#808080)(rendered as dark gray)
 400                              silver (#C0C0C0)(rendered as light gray)
 401                              white (#FFFFFF)-->
 402                          <xsl:when test='name(.)="fo:color"'>
 403                              <xsl:choose>
 404                                  <xsl:when test="contains(. , '#FFFFFF') or contains(. , '#ffffff') or contains(. , 'white') or contains(. , 'WHITE')">
 405                                      <xsl:text>color:#FFFFFF, </xsl:text>
 406                                  </xsl:when>
 407                                  <xsl:otherwise>
 408                                      <xsl:text>color:#000000, </xsl:text>
 409                                  </xsl:otherwise>
 410                              </xsl:choose>
 411                          </xsl:when>
 412  
 413  
 414                          <!--*** TABLE ATTRIBUTES ***-->
 415                          <xsl:when test='name(.)="fo:font-size"'>
 416                              <xsl:text>size:</xsl:text><xsl:value-of select="."/><xsl:text>:size, </xsl:text>
 417                          </xsl:when>
 418                          <xsl:when test='name(.)="style:column-width"'>
 419                              <xsl:choose>
 420                                  <!-- changing the distance measure: inch to in -->
 421                                  <xsl:when test="contains(., 'ch')">
 422                                      <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>:width, </xsl:text>
 423                                  </xsl:when>
 424                                  <xsl:otherwise>
 425                                      <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>:width; </xsl:text>
 426                                  </xsl:otherwise>
 427                              </xsl:choose>
 428                          </xsl:when>
 429                          <xsl:when test='name(.)="style:row-height"'>
 430                              <xsl:choose>
 431                                  <!-- changing the distance measure: inch to in -->
 432                                  <xsl:when test="contains(., 'ch')">
 433                                      <xsl:text>height:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>:height; </xsl:text>
 434                                  </xsl:when>
 435                                  <xsl:otherwise>
 436                                      <xsl:text>height:</xsl:text><xsl:value-of select="."/><xsl:text>:height; </xsl:text>
 437                                  </xsl:otherwise>
 438                              </xsl:choose>
 439                          </xsl:when>
 440                          <xsl:when test='name(.)="style:width"'> <!--earlier fo:width-->
 441                              <xsl:choose>
 442                                  <!-- changing the distance measure: inch to in -->
 443                                  <xsl:when test="contains(., 'ch')">
 444                                      <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>:width; </xsl:text>
 445                                  </xsl:when>
 446                                  <xsl:otherwise>
 447                                      <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>:width; </xsl:text>
 448                                  </xsl:otherwise>
 449                              </xsl:choose>
 450                          </xsl:when>
 451                      </xsl:choose>
 452                  </xsl:for-each>
 453              </xsl:otherwise>
 454          </xsl:choose>
 455      </xsl:template>
 456  
 457  
 458  
 459  <!-- 2DO: NAMING CONVENTION variable are written with '-' instead of case-sensitive writing -->
 460  
 461  
 462  
 463      <!-- ***** MEASUREMENT CONVERSIONS *****
 464  
 465       * 1 centimeter = 10 mm
 466  
 467       * 1 inch = 25.4 mm
 468          While the English have already seen the light (read: the metric system), the US
 469          remains loyal to this medieval system.
 470  
 471       * 1 didot point = 0.376065 mm
 472              The didot system originated in France but was used in most of Europe
 473  
 474       * 1 pica point = 0.35146 mm
 475              The Pica points system was developed in England and is used in Great-Britain and the US.
 476  
 477       * 1 PostScript point = 0.35277138 mm
 478              When Adobe created PostScript, they added their own system of points.
 479              There are exactly 72 PostScript points in 1 inch.
 480  
 481       * 1 pixel = 0.26458333.. mm   (by 96 dpi)
 482              Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
 483      -->
 484  
 485  
 486      <!-- changing measure to mm -->
 487      <xsl:template name="convert2mm">
 488          <xsl:param name="value"/>
 489  
 490          <xsl:param name="centimeter-in-mm"          select="10"/>
 491          <xsl:param name="inch-in-mm"                select="25.4"/>
 492          <xsl:param name="didot-point-in-mm"         select="0.376065"/>
 493          <xsl:param name="pica-point-in-mm"          select="0.35146"/>
 494  
 495          <xsl:choose>
 496              <xsl:when test="contains($value, 'cm')">
 497                  <xsl:value-of select="round(number(substring-before($value,'cm' )) * $centimeter-in-mm)"/>
 498              </xsl:when>
 499              <xsl:when test="contains($value, 'in')">
 500                  <xsl:value-of select="round(number(substring-before($value,'in' )) * $inch-in-mm)"/>
 501              </xsl:when>
 502              <xsl:when test="contains($value, 'dpt')">
 503                  <xsl:value-of select="round(number(substring-before($value,'dpt')) * $didot-point-in-mm)"/>
 504              </xsl:when>
 505              <xsl:when test="contains($value, 'ppt')">
 506                  <xsl:value-of select="round(number(substring-before($value,'ppt')) * $pica-point-in-mm)"/>
 507              </xsl:when>
 508              <xsl:otherwise>
 509                  <xsl:value-of select="$value"/>
 510              </xsl:otherwise>
 511          </xsl:choose>
 512      </xsl:template>
 513  
 514  
 515      <!-- changing measure to cm -->
 516      <xsl:template name="convert2cm">
 517          <xsl:param name="value"/>
 518  
 519          <xsl:param name="centimeter-in-mm"          select="10"/>
 520          <xsl:param name="inch-in-mm"                select="25.4"/>
 521          <xsl:param name="didot-point-in-mm"         select="0.376065"/>
 522          <xsl:param name="pica-point-in-mm"          select="0.35146"/>
 523  
 524          <xsl:choose>
 525              <xsl:when test="contains($value, 'mm')">
 526                  <xsl:value-of select="round(number(substring-before($value, 'mm')) div $centimeter-in-mm)"/>
 527              </xsl:when>
 528              <xsl:when test="contains($value, 'in')">
 529                  <xsl:value-of select="round(number(substring-before($value, 'in')) div $centimeter-in-mm * $inch-in-mm)"/>
 530              </xsl:when>
 531              <xsl:when test="contains($value, 'dpt')">
 532                  <xsl:value-of select="round(number(substring-before($value,'dpt')) div $centimeter-in-mm * $didot-point-in-mm)"/>
 533              </xsl:when>
 534              <xsl:when test="contains($value, 'ppt')">
 535                  <xsl:value-of select="round(number(substring-before($value,'ppt')) div $centimeter-in-mm * $pica-point-in-mm)"/>
 536              </xsl:when>
 537              <xsl:otherwise>
 538                  <xsl:value-of select="$value"/>
 539              </xsl:otherwise>
 540          </xsl:choose>
 541      </xsl:template>
 542  
 543      <!-- changing measure to inch (cp. section comment) -->
 544      <xsl:template name="convert2inch">
 545          <xsl:param name="value"/>
 546  
 547          <xsl:param name="centimeter-in-mm"          select="10"/>
 548          <xsl:param name="inch-in-mm"                select="25.4"/>
 549          <xsl:param name="didot-point-in-mm"         select="0.376065"/>
 550          <xsl:param name="pica-point-in-mm"          select="0.35146"/>
 551  
 552          <xsl:choose>
 553              <xsl:when test="contains($value, 'mm')">
 554                  <xsl:value-of select="round(number(substring-before($value, 'mm')) div $inch-in-mm)"/>
 555              </xsl:when>
 556              <xsl:when test="contains($value, 'cm')">
 557                  <xsl:value-of select="round(number(substring-before($value, 'cm')) div $inch-in-mm * $centimeter-in-mm)"/>
 558              </xsl:when>
 559              <xsl:when test="contains($value, 'dpt')">
 560                  <xsl:value-of select="round(number(substring-before($value,'dpt')) div $inch-in-mm * $didot-point-in-mm)"/>
 561              </xsl:when>
 562              <xsl:when test="contains($value, 'ppt')">
 563                  <xsl:value-of select="round(number(substring-before($value,'ppt')) div $inch-in-mm * $pica-point-in-mm)"/>
 564              </xsl:when>
 565              <xsl:otherwise>
 566                  <xsl:value-of select="$value"/>
 567              </xsl:otherwise>
 568          </xsl:choose>
 569      </xsl:template>
 570  
 571  
 572      <!-- changing measure to dpt (cp. section comment) -->
 573      <xsl:template name="convert2dpt">
 574          <xsl:param name="value"/>
 575  
 576          <xsl:param name="centimeter-in-mm"          select="10"/>
 577          <xsl:param name="inch-in-mm"                select="25.4"/>
 578          <xsl:param name="didot-point-in-mm"         select="0.376065"/>
 579          <xsl:param name="pica-point-in-mm"          select="0.35146"/>
 580  
 581          <xsl:choose>
 582              <xsl:when test="contains($value, 'mm')">
 583                  <xsl:value-of select="round(number(substring-before($value, 'mm')) div $didot-point-in-mm)"/>
 584              </xsl:when>
 585              <xsl:when test="contains($value, 'cm')">
 586                  <xsl:value-of select="round(number(substring-before($value, 'cm')) div $didot-point-in-mm * $centimeter-in-mm)"/>
 587              </xsl:when>
 588              <xsl:when test="contains($value, 'in')">
 589                  <xsl:value-of select="round(number(substring-before($value, 'in')) div $didot-point-in-mm * $inch-in-mm)"/>
 590              </xsl:when>
 591              <xsl:when test="contains($value, 'ppt')">
 592                  <xsl:value-of select="round(number(substring-before($value,'ppt')) div $didot-point-in-mm * $pica-point-in-mm)"/>
 593              </xsl:when>
 594              <xsl:otherwise>
 595                  <xsl:value-of select="$value"/>
 596              </xsl:otherwise>
 597          </xsl:choose>
 598  
 599      </xsl:template>
 600  
 601  
 602      <!-- changing measure to ppt (cp. section comment) -->
 603      <xsl:template name="convert2ppt">
 604          <xsl:param name="value"/>
 605  
 606          <xsl:param name="centimeter-in-mm"          select="10"/>
 607          <xsl:param name="inch-in-mm"                select="25.4"/>
 608          <xsl:param name="didot-point-in-mm"         select="0.376065"/>
 609          <xsl:param name="pica-point-in-mm"          select="0.35146"/>
 610  
 611          <xsl:choose>
 612              <xsl:when test="contains($value, 'mm')">
 613                  <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pica-point-in-mm)"/>
 614              </xsl:when>
 615              <xsl:when test="contains($value, 'cm')">
 616                  <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pica-point-in-mm * $centimeter-in-mm)"/>
 617              </xsl:when>
 618              <xsl:when test="contains($value, 'in')">
 619                  <xsl:value-of select="round(number(substring-before($value, 'in')) div $pica-point-in-mm * $inch-in-mm)"/>
 620              </xsl:when>
 621              <xsl:when test="contains($value, 'dpt')">
 622                  <xsl:value-of select="round(number(substring-before($value,'dpt')) div $pica-point-in-mm * $didot-point-in-mm)"/>
 623              </xsl:when>
 624              <xsl:otherwise>
 625                  <xsl:value-of select="$value"/>
 626              </xsl:otherwise>
 627          </xsl:choose>
 628      </xsl:template>
 629  
 630  
 631      <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
 632      <xsl:template name="convert2pixel">
 633          <xsl:param name="value"/>
 634  
 635          <xsl:param name="centimeter-in-mm"          select="10"/>
 636          <xsl:param name="inch-in-mm"                select="25.4"/>
 637          <xsl:param name="didot-point-in-mm"         select="0.376065"/>
 638          <xsl:param name="pica-point-in-mm"          select="0.35146"/>
 639          <xsl:param name="pixel-in-mm"               select="$inch-in-mm div $dpi"/>
 640  
 641          <xsl:choose>
 642              <xsl:when test="contains($value, 'mm')">
 643                  <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
 644              </xsl:when>
 645              <xsl:when test="contains($value, 'cm')">
 646                  <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
 647              </xsl:when>
 648              <xsl:when test="contains($value, 'in')">
 649                  <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
 650              </xsl:when>
 651              <xsl:when test="contains($value, 'dpt')">
 652                  <xsl:value-of select="round(number(substring-before($value,'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
 653              </xsl:when>
 654              <xsl:otherwise>
 655                  <xsl:value-of select="$value"/>
 656              </xsl:otherwise>
 657          </xsl:choose>
 658      </xsl:template>
 659  
 660  </xsl:stylesheet>


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7