home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 June / maximum-cd-2011-06.iso / DiscContents / LibO_3.3.1_Win_x86_install_multi.exe / libreoffice1.cab / measure_conversion.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2010-12-01  |  19.6 KB  |  388 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5.   
  6.   Copyright 2000, 2010 Oracle and/or its affiliates.
  7.  
  8.   OpenOffice.org - a multi-platform office productivity suite
  9.  
  10.   This file is part of OpenOffice.org.
  11.  
  12.   OpenOffice.org is free software: you can redistribute it and/or modify
  13.   it under the terms of the GNU Lesser General Public License version 3
  14.   only, as published by the Free Software Foundation.
  15.  
  16.   OpenOffice.org is distributed in the hope that it will be useful,
  17.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.   GNU Lesser General Public License version 3 for more details
  20.   (a copy is included in the LICENSE file that accompanied this code).
  21.  
  22.   You should have received a copy of the GNU Lesser General Public License
  23.   version 3 along with OpenOffice.org.  If not, see
  24.   <http://www.openoffice.org/license.html>
  25.   for a copy of the LGPLv3 License.
  26.  
  27. -->
  28. <!--
  29.     For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
  30. -->
  31. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  32.     <!-- DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')
  33.          Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
  34.     <xsl:param name="dpi" select="111"/>
  35.     <xsl:param name="centimeter-in-mm" select="10"/>
  36.     <xsl:param name="inch-in-mm" select="25.4"/>
  37.     <xsl:param name="didot-point-in-mm" select="0.376065"/>
  38.     <xsl:param name="pica-in-mm" select="4.2333333"/>
  39.     <xsl:param name="point-in-mm" select="0.3527778"/>
  40.     <xsl:param name="twip-in-mm" select="0.017636684"/>
  41.     <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
  42.     <!-- ***** MEASUREMENT CONVERSIONS *****
  43.       PARAM 'value'
  44.         The measure to be converted.
  45.         The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
  46.         directly added to the number.
  47.  
  48.       PARAM 'rounding-factor'
  49.         Is used for the rounding of decimal places.
  50.         The parameter number is the product of 1 and some '10', where
  51.         every zero represents a decimal place.
  52.  
  53.         For example, providing as parameter:
  54.             <xsl:param name="rounding-factor" select="10000" />
  55.         Gives by default four decimal places.
  56.  
  57.         To round two decimal places, basically the following is done:
  58.             <xsl:value-of select="round(100 * value) div 100"/>
  59.  
  60.       RETURN    The converted number, by default rounded to four decimal places.
  61.                 In case the input measure could not be matched the same value is
  62.                 returned and a warning message is written out.
  63.  
  64.  
  65.  
  66.      MEASURE LIST:
  67.      * 1 milimeter (mm), the basic measure
  68.  
  69.      * 1 centimeter (cm) = 10 mm
  70.  
  71.      * 1 inch (in) = 25.4 mm
  72.         While the English have already seen the light (read: the metric system), the US
  73.         remains loyal to this medieval system.
  74.  
  75.      * 1 point (pt) = 0.35277777.. mm
  76.         Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
  77.         There are exactly 72 PostScript points in 1 inch.
  78.  
  79.      * 1 twip = twentieth of a (PostScript) point
  80.         A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
  81.  
  82.      * 1 didot point (dpt) = 0.376065 mm
  83.         Didot point after the French typographer Firmin Didot (1764-1836).
  84.  
  85.         More details under
  86.         http://www.unc.edu/~rowlett/units/dictP.html:
  87.         "A unit of length used by typographers and printers. When printing was done
  88.         from hand-set metal type, one point represented the smallest element of type
  89.         that could be handled, roughly 1/64 inch. Eventually, the point was standardized
  90.         in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
  91.         about 0.35 mm (351.46 micrometers). In continental Europe, typographers
  92.         traditionally used a slightly larger point of 0.014 83 inch (about
  93.         1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
  94.         after the French typographer Firmin Didot (1764-1836). In the U.S.,
  95.         Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
  96.         or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
  97.         of 0.351 459 8035 mm. The German standards agency DIN has proposed that
  98.         all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
  99.  
  100.      * 1 pica = 4.233333 mm
  101.         1/6 inch or 12 points
  102.  
  103.      * 1 pixel (px) = 0.26458333.. mm   (relative to 'DPI', here: 96 dpi)
  104.         Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
  105.  
  106.  
  107.     -->
  108.     <!-- changing measure to mm -->
  109.     <xsl:template name="convert2mm">
  110.         <xsl:param name="value"/>
  111.         <xsl:param name="rounding-factor" select="10000"/>
  112.         <xsl:choose>
  113.             <xsl:when test="contains($value, 'mm')">
  114.                 <xsl:value-of select="substring-before($value, 'mm')"/>
  115.             </xsl:when>
  116.             <xsl:when test="contains($value, 'cm')">
  117.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
  118.             </xsl:when>
  119.             <xsl:when test="contains($value, 'in')">
  120.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
  121.             </xsl:when>
  122.             <xsl:when test="contains($value, 'pt')">
  123.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
  124.             </xsl:when>
  125.             <xsl:when test="contains($value, 'twip')">
  126.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
  127.             </xsl:when>
  128.             <xsl:when test="contains($value, 'dpt')">
  129.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
  130.             </xsl:when>
  131.             <xsl:when test="contains($value, 'pica')">
  132.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
  133.             </xsl:when>
  134.             <xsl:when test="contains($value, 'px')">
  135.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
  136.             </xsl:when>
  137.             <xsl:otherwise>
  138.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
  139.                 <xsl:value-of select="$value"/>
  140.             </xsl:otherwise>
  141.         </xsl:choose>
  142.     </xsl:template>
  143.     <!-- changing measure to cm -->
  144.     <xsl:template name="convert2cm">
  145.         <xsl:param name="value"/>
  146.         <xsl:param name="rounding-factor" select="10000"/>
  147.         <xsl:choose>
  148.             <xsl:when test="contains($value, 'mm')">
  149.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
  150.             </xsl:when>
  151.             <xsl:when test="contains($value, 'cm')">
  152.                 <xsl:value-of select="substring-before($value, 'cm')"/>
  153.             </xsl:when>
  154.             <xsl:when test="contains($value, 'in')">
  155.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
  156.             </xsl:when>
  157.             <xsl:when test="contains($value, 'pt')">
  158.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
  159.             </xsl:when>
  160.             <xsl:when test="contains($value, 'dpt')">
  161.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  162.             </xsl:when>
  163.             <xsl:when test="contains($value, 'pica')">
  164.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
  165.             </xsl:when>
  166.             <xsl:when test="contains($value, 'twip')">
  167.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
  168.             </xsl:when>
  169.             <xsl:when test="contains($value, 'px')">
  170.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  171.             </xsl:when>
  172.             <xsl:otherwise>
  173.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
  174.                 <xsl:value-of select="$value"/>
  175.             </xsl:otherwise>
  176.         </xsl:choose>
  177.     </xsl:template>
  178.     <!-- changing measure to inch (cp. section comment) -->
  179.     <xsl:template name="convert2in">
  180.         <xsl:param name="value"/>
  181.         <xsl:param name="rounding-factor" select="10000"/>
  182.         <xsl:choose>
  183.             <xsl:when test="contains($value, 'mm')">
  184.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
  185.             </xsl:when>
  186.             <xsl:when test="contains($value, 'cm')">
  187.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  188.             </xsl:when>
  189.             <xsl:when test="contains($value, 'in')">
  190.                 <xsl:value-of select="substring-before($value, 'in')"/>
  191.             </xsl:when>
  192.             <xsl:when test="contains($value, 'pt')">
  193.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
  194.             </xsl:when>
  195.             <xsl:when test="contains($value, 'dpt')">
  196.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  197.             </xsl:when>
  198.             <xsl:when test="contains($value, 'pica')">
  199.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
  200.             </xsl:when>
  201.             <xsl:when test="contains($value, 'twip')">
  202.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
  203.             </xsl:when>
  204.             <xsl:when test="contains($value, 'px')">
  205.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  206.             </xsl:when>
  207.             <xsl:otherwise>
  208.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
  209.                 <xsl:value-of select="$value"/>
  210.             </xsl:otherwise>
  211.         </xsl:choose>
  212.     </xsl:template>
  213.     <!-- changing measure to dpt (cp. section comment) -->
  214.     <xsl:template name="convert2dpt">
  215.         <xsl:param name="value"/>
  216.         <xsl:param name="rounding-factor" select="10000"/>
  217.         <xsl:choose>
  218.             <xsl:when test="contains($value, 'mm')">
  219.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
  220.             </xsl:when>
  221.             <xsl:when test="contains($value, 'cm')">
  222.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  223.             </xsl:when>
  224.             <xsl:when test="contains($value, 'in')">
  225.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
  226.             </xsl:when>
  227.             <xsl:when test="contains($value, 'pt')">
  228.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
  229.             </xsl:when>
  230.             <xsl:when test="contains($value, 'dpt')">
  231.                 <xsl:value-of select="substring-before($value, 'dpt')"/>
  232.             </xsl:when>
  233.             <xsl:when test="contains($value, 'pica')">
  234.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
  235.             </xsl:when>
  236.             <xsl:when test="contains($value, 'twip')">
  237.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
  238.             </xsl:when>
  239.             <xsl:when test="contains($value, 'px')">
  240.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  241.             </xsl:when>
  242.             <xsl:otherwise>
  243.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
  244.                 <xsl:value-of select="$value"/>
  245.             </xsl:otherwise>
  246.         </xsl:choose>
  247.     </xsl:template>
  248.     <!-- changing measure to pica (cp. section comment) -->
  249.     <xsl:template name="convert2pica">
  250.         <xsl:param name="value"/>
  251.         <xsl:param name="rounding-factor" select="10000"/>
  252.         <xsl:choose>
  253.             <xsl:when test="contains($value, 'mm')">
  254.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
  255.             </xsl:when>
  256.             <xsl:when test="contains($value, 'cm')">
  257.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  258.             </xsl:when>
  259.             <xsl:when test="contains($value, 'in')">
  260.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
  261.             </xsl:when>
  262.             <xsl:when test="contains($value, 'pt')">
  263.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
  264.             </xsl:when>
  265.             <xsl:when test="contains($value, 'dpt')">
  266.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  267.             </xsl:when>
  268.             <xsl:when test="contains($value, 'pica')">
  269.                 <xsl:value-of select="substring-before($value, 'pica')"/>
  270.             </xsl:when>
  271.             <xsl:when test="contains($value, 'twip')">
  272.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
  273.             </xsl:when>
  274.             <xsl:when test="contains($value, 'px')">
  275.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  276.             </xsl:when>
  277.             <xsl:otherwise>
  278.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
  279.                 <xsl:value-of select="$value"/>
  280.             </xsl:otherwise>
  281.         </xsl:choose>
  282.     </xsl:template>
  283.     <!-- changing measure to pt (cp. section comment) -->
  284.     <xsl:template name="convert2pt">
  285.         <xsl:param name="value"/>
  286.         <xsl:param name="rounding-factor" select="10000"/>
  287.         <xsl:choose>
  288.             <xsl:when test="contains($value, 'mm')">
  289.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
  290.             </xsl:when>
  291.             <xsl:when test="contains($value, 'cm')">
  292.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  293.             </xsl:when>
  294.             <xsl:when test="contains($value, 'in')">
  295.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
  296.             </xsl:when>
  297.             <xsl:when test="contains($value, 'pt')">
  298.                 <xsl:value-of select="substring-before($value, 'pt')"/>
  299.             </xsl:when>
  300.             <xsl:when test="contains($value, 'dpt')">
  301.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  302.             </xsl:when>
  303.             <xsl:when test="contains($value, 'pica')">
  304.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
  305.             </xsl:when>
  306.             <xsl:when test="contains($value, 'twip')">
  307.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
  308.             </xsl:when>
  309.             <xsl:when test="contains($value, 'px')">
  310.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  311.             </xsl:when>
  312.             <xsl:otherwise>
  313.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
  314.                 <xsl:value-of select="$value"/>
  315.             </xsl:otherwise>
  316.         </xsl:choose>
  317.     </xsl:template>
  318.     <!-- changing measure to twip (cp. section comment) -->
  319.     <xsl:template name="convert2twip">
  320.         <xsl:param name="value"/>
  321.         <xsl:param name="rounding-factor" select="10000"/>
  322.         <xsl:choose>
  323.             <xsl:when test="contains($value, 'mm')">
  324.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
  325.             </xsl:when>
  326.             <xsl:when test="contains($value, 'cm')">
  327.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  328.             </xsl:when>
  329.             <xsl:when test="contains($value, 'in')">
  330.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
  331.             </xsl:when>
  332.             <xsl:when test="contains($value, 'pt')">
  333.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
  334.             </xsl:when>
  335.             <xsl:when test="contains($value, 'dpt')">
  336.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  337.             </xsl:when>
  338.             <xsl:when test="contains($value, 'pica')">
  339.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
  340.             </xsl:when>
  341.             <xsl:when test="contains($value, 'twip')">
  342.                 <xsl:value-of select="substring-before($value, 'twip')"/>
  343.             </xsl:when>
  344.             <xsl:when test="contains($value, 'px')">
  345.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  346.             </xsl:when>
  347.             <xsl:otherwise>
  348.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
  349.                 <xsl:value-of select="$value"/>
  350.             </xsl:otherwise>
  351.         </xsl:choose>
  352.     </xsl:template>
  353.     <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
  354.     <xsl:template name="convert2px">
  355.         <xsl:param name="value"/>
  356.         <xsl:choose>
  357.             <xsl:when test="contains($value, 'mm')">
  358.                 <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
  359.             </xsl:when>
  360.             <xsl:when test="contains($value, 'cm')">
  361.                 <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
  362.             </xsl:when>
  363.             <xsl:when test="contains($value, 'in')">
  364.                 <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
  365.             </xsl:when>
  366.             <xsl:when test="contains($value, 'pt')">
  367.                 <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
  368.             </xsl:when>
  369.             <xsl:when test="contains($value, 'dpt')">
  370.                 <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
  371.             </xsl:when>
  372.             <xsl:when test="contains($value, 'pica')">
  373.                 <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
  374.             </xsl:when>
  375.             <xsl:when test="contains($value, 'twip')">
  376.                 <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
  377.             </xsl:when>
  378.             <xsl:when test="contains($value, 'px')">
  379.                 <xsl:value-of select="$value"/>
  380.             </xsl:when>
  381.             <xsl:otherwise>
  382.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
  383.                 <xsl:value-of select="$value"/>
  384.             </xsl:otherwise>
  385.         </xsl:choose>
  386.     </xsl:template>
  387. </xsl:stylesheet>
  388.