mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-06 08:17:33 +00:00
更新windows内置office目录名, 适配jodconverter
This commit is contained in:
26
server/libreoffice/share/xslt/common/copy.xsl
Normal file
26
server/libreoffice/share/xslt/common/copy.xsl
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="xml" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
580
server/libreoffice/share/xslt/common/math.xsl
Normal file
580
server/libreoffice/share/xslt/common/math.xsl
Normal file
File diff suppressed because it is too large
Load Diff
479
server/libreoffice/share/xslt/common/measure_conversion.xsl
Normal file
479
server/libreoffice/share/xslt/common/measure_conversion.xsl
Normal file
@@ -0,0 +1,479 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<!-- DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')
|
||||
Although many pictures have a 96 dpi resolution, a higher resolution give better results for common browsers -->
|
||||
<xsl:param name="dpi" select="111"/>
|
||||
<xsl:param name="centimeter-in-mm" select="10"/>
|
||||
<xsl:param name="inch-in-mm" select="25.4"/>
|
||||
<xsl:param name="didot-point-in-mm" select="0.376065"/>
|
||||
<xsl:param name="pica-in-mm" select="4.2333333"/>
|
||||
<xsl:param name="point-in-mm" select="0.3527778"/>
|
||||
<xsl:param name="twip-in-mm" select="0.017636684"/>
|
||||
<xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
|
||||
<!-- ***** MEASUREMENT CONVERSIONS *****
|
||||
PARAM 'value'
|
||||
The measure to be converted.
|
||||
The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
|
||||
directly added to the number.
|
||||
|
||||
PARAM 'rounding-factor'
|
||||
Is used for the rounding of decimal places.
|
||||
The parameter number is the product of 1 and some '10', where
|
||||
every zero represents a decimal place.
|
||||
|
||||
For example, providing as parameter:
|
||||
<xsl:param name="rounding-factor" select="10000" />
|
||||
Gives by default four decimal places.
|
||||
|
||||
To round two decimal places, basically the following is done:
|
||||
<xsl:value-of select="round(100 * value) div 100"/>
|
||||
|
||||
RETURN The converted number, by default rounded to four decimal places.
|
||||
In case the input measure could not be matched the same value is
|
||||
returned and a warning message is written out.
|
||||
|
||||
|
||||
|
||||
MEASURE LIST:
|
||||
* 1 millimeter (mm), the basic measure
|
||||
|
||||
* 1 centimeter (cm) = 10 mm
|
||||
|
||||
* 1 inch (in) = 25.4 mm
|
||||
While the English have already seen the light (read: the metric system), the US
|
||||
remains loyal to this medieval system.
|
||||
|
||||
* 1 point (pt) = 0.35277777.. mm
|
||||
Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
|
||||
There are exactly 72 PostScript points in 1 inch.
|
||||
|
||||
* 1 twip = twentieth of a (PostScript) point
|
||||
A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
|
||||
|
||||
* 1 didot point (dpt) = 0.376065 mm
|
||||
Didot point after the French typographer Firmin Didot (1764-1836).
|
||||
|
||||
More details under
|
||||
http://www.unc.edu/~rowlett/units/dictP.html:
|
||||
"A unit of length used by typographers and printers. When printing was done
|
||||
from hand-set metal type, one point represented the smallest element of type
|
||||
that could be handled, roughly 1/64 inch. Eventually, the point was standardized
|
||||
in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
|
||||
about 0.35 mm (351.46 micrometers). In continental Europe, typographers
|
||||
traditionally used a slightly larger point of 0.014 83 inch (about
|
||||
1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
|
||||
after the French typographer Firmin Didot (1764-1836). In the U.S.,
|
||||
Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
|
||||
or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
|
||||
of 0.351 459 8035 mm. The German standards agency DIN has proposed that
|
||||
all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
|
||||
|
||||
* 1 pica = 4.233333 mm
|
||||
1/6 inch or 12 points
|
||||
|
||||
* 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 96 dpi)
|
||||
Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
|
||||
|
||||
|
||||
-->
|
||||
<!-- changing measure to mm -->
|
||||
<xsl:template name="convert2mm">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:param name="rounding-factor" select="10000"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="substring-before($value, 'mm')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- changing measure to cm -->
|
||||
<xsl:template name="convert2cm">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:param name="rounding-factor" select="10000"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="substring-before($value, 'cm')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- changing measure to inch (cp. section comment) -->
|
||||
<xsl:template name="convert2in">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:param name="rounding-factor" select="10000"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="substring-before($value, 'in')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- changing measure to dpt (cp. section comment) -->
|
||||
<xsl:template name="convert2dpt">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:param name="rounding-factor" select="10000"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="substring-before($value, 'dpt')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- changing measure to pica (cp. section comment) -->
|
||||
<xsl:template name="convert2pica">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:param name="rounding-factor" select="10000"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="substring-before($value, 'pica')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- changing measure to pt (cp. section comment) -->
|
||||
<xsl:template name="convert2pt">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:param name="rounding-factor" select="10000"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="substring-before($value, 'pt')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- changing measure to twip (cp. section comment) -->
|
||||
<xsl:template name="convert2twip">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:param name="rounding-factor" select="10000"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="substring-before($value, 'twip')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
|
||||
<xsl:template name="convert2px">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value, 'mm')">
|
||||
<xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'cm')">
|
||||
<xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'in')">
|
||||
<xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pt')">
|
||||
<xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'dpt')">
|
||||
<xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'pica')">
|
||||
<xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'twip')">
|
||||
<xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($value, 'px')">
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template name="ConvertMeasure">
|
||||
<xsl:param name="TargetMeasure" select="'cm'"/>
|
||||
<xsl:param name="TargetTruncate" select=" 'all' "/>
|
||||
<xsl:param name="value"/>
|
||||
<!-- When TargetTruncate ='all' it returns the number whichsoever the return value is negative or positive
|
||||
When TargetTruncate ='nonNegative' it only returns nonNegative number, all negative number to be returned as 0
|
||||
When TargetTruncate ='positive" it only returns positive number, all nonPositive number to be returned as 1 -->
|
||||
<xsl:variable name="return_value">
|
||||
<xsl:choose>
|
||||
<!-- remove the measure mark, if the value is null, the result should be 0. Must be the first case -->
|
||||
<xsl:when test="string-length(translate(string($value),'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ','')) = 0">0</xsl:when>
|
||||
<xsl:when test="string-length(translate(string($value),'- .0123456789','')) = 0">
|
||||
<xsl:value-of select="$value"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$TargetMeasure = 'cm'">
|
||||
<xsl:call-template name="convert2cm">
|
||||
<xsl:with-param name="value" select="$value"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$TargetMeasure = 'pt'">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="$value"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$TargetMeasure = 'twip'">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$value"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$TargetMeasure = 'in'">
|
||||
<xsl:call-template name="convert2in">
|
||||
<xsl:with-param name="value" select="$value"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$TargetTruncate = 'all' ">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
|
||||
<xsl:value-of select=" '0' "/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$return_value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="$TargetTruncate = 'nonNegative' ">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
|
||||
<xsl:value-of select=" '0' "/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test=" $return_value < 0 ">
|
||||
<xsl:value-of select=" '0' "/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$return_value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="$TargetTruncate = 'positive' ">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
|
||||
<xsl:value-of select=" '1' "/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test=" $return_value <= 0 ">
|
||||
<xsl:value-of select=" '1' "/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$return_value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template name="Add-With-Measure">
|
||||
<xsl:param name="value1"/>
|
||||
<xsl:param name="value2"/>
|
||||
<xsl:param name="TargetMeasure" select="'in'"/>
|
||||
<xsl:variable name="number-value1">
|
||||
<xsl:call-template name="ConvertMeasure">
|
||||
<xsl:with-param name="value" select="$value1"/>
|
||||
<xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="number-value2">
|
||||
<xsl:call-template name="ConvertMeasure">
|
||||
<xsl:with-param name="value" select="$value2"/>
|
||||
<xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="$number-value1 + $number-value2"/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
BIN
server/libreoffice/share/xslt/docbook/DocBookTemplate.stw
Normal file
BIN
server/libreoffice/share/xslt/docbook/DocBookTemplate.stw
Normal file
Binary file not shown.
1416
server/libreoffice/share/xslt/docbook/docbooktosoffheadings.xsl
Normal file
1416
server/libreoffice/share/xslt/docbook/docbooktosoffheadings.xsl
Normal file
File diff suppressed because it is too large
Load Diff
1152
server/libreoffice/share/xslt/docbook/sofftodocbookheadings.xsl
Normal file
1152
server/libreoffice/share/xslt/docbook/sofftodocbookheadings.xsl
Normal file
File diff suppressed because it is too large
Load Diff
427
server/libreoffice/share/xslt/export/common/body.xsl
Normal file
427
server/libreoffice/share/xslt/export/common/body.xsl
Normal file
@@ -0,0 +1,427 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://xml.apache.org/xslt/java" xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi java urlencoder">
|
||||
|
||||
|
||||
<xsl:include href="table_of_content.xsl"/>
|
||||
|
||||
|
||||
<!-- ****************** -->
|
||||
<!-- *** Whitespace *** -->
|
||||
<!-- ****************** -->
|
||||
|
||||
<xsl:template match="text:s">
|
||||
<xsl:call-template name="write-breakable-whitespace">
|
||||
<xsl:with-param name="whitespaces" select="@text:c"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--write the number of 'whitespaces' -->
|
||||
<xsl:template name="write-breakable-whitespace">
|
||||
<xsl:param name="whitespaces"/>
|
||||
|
||||
<!--write two space chars as the normal white space character will be stripped
|
||||
and the other is able to break -->
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="$whitespaces >= 2">
|
||||
<xsl:call-template name="write-breakable-whitespace-2">
|
||||
<xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--write the number of 'whitespaces' -->
|
||||
<xsl:template name="write-breakable-whitespace-2">
|
||||
<xsl:param name="whitespaces"/>
|
||||
<!--write two space chars as the normal white space character will be stripped
|
||||
and the other is able to break -->
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="$whitespaces >= 2">
|
||||
<xsl:call-template name="write-breakable-whitespace">
|
||||
<xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- currentSolution: 8 non-breakable-spaces instead of a TAB is an approximation.
|
||||
Sometimes less spaces than 8 might be needed and the output might be more difficult to read-->
|
||||
<xsl:template match="text:tab">
|
||||
<xsl:param name="globalData"/>
|
||||
|
||||
<xsl:call-template name="write-breakable-whitespace">
|
||||
<xsl:with-param name="whitespaces" select="8"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- *************** -->
|
||||
<!-- *** Textbox *** -->
|
||||
<!-- *************** -->
|
||||
|
||||
<!-- ID / NAME of text-box -->
|
||||
<xsl:template match="@draw:name">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:choose>
|
||||
<xsl:when test="number(substring(.,1,1))">
|
||||
<!-- Heuristic: If the first character is a number a 'a_' will be set
|
||||
as prefix, as id have to be of type NMTOKEN -->
|
||||
<xsl:value-of select="concat('a_',translate(., '
&<>.,;: %()[]/\+', '___________________________'))"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="translate(., '
&<>.,;: %()[]/\+', '___________________________')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="text:line-break">
|
||||
<xsl:param name="listIndent"/>
|
||||
|
||||
<xsl:element namespace="{$namespace}" name="br"/>
|
||||
|
||||
<!-- line breaks in lists need an indent similar to the list label -->
|
||||
<xsl:if test="$listIndent">
|
||||
<xsl:element namespace="{$namespace}" name="span">
|
||||
<xsl:attribute name="style">margin-left:<xsl:value-of select="$listIndent"/>cm</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- currently there have to be an explicit call of the style attribute nodes, maybe the attributes nodes have no priority only order relevant-->
|
||||
<xsl:template name="apply-styles-and-content">
|
||||
<xsl:param name="globalData"/>
|
||||
<xsl:param name="footnotePrefix" />
|
||||
<xsl:apply-templates select="@*">
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
<!-- the footnote symbol is the prefix for a footnote in the footer -->
|
||||
<xsl:copy-of select="$footnotePrefix"/>
|
||||
<xsl:apply-templates select="node()">
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- ******************* -->
|
||||
<!-- *** References *** -->
|
||||
<!-- ******************* -->
|
||||
|
||||
<xsl:template match="text:reference-ref | text:sequence-ref | text:bookmark-ref">
|
||||
<xsl:param name="globalData"/>
|
||||
<xsl:if test="*|text()">
|
||||
<xsl:element namespace="{$namespace}" name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>#</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="number(substring(@text:ref-name,1,1))">
|
||||
<!-- Heuristic: If the first character is a number a 'a_' will be set
|
||||
as prefix, as id have to be of type NMTOKEN -->
|
||||
<xsl:value-of select="concat('a_',translate(@text:ref-name, '
&<>.,;: %()[]/\+', '___________________________'))"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="translate(@text:ref-name, '
&<>.,;: %()[]/\+', '___________________________')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:apply-templates select="@* | node()">
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@text:name">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:choose>
|
||||
<xsl:when test="number(substring(.,1,1))">
|
||||
<!-- Heuristic: If the first character is a number a 'a_' will be set
|
||||
as prefix, as id have to be of type NMTOKEN -->
|
||||
<xsl:value-of select="concat('a_',translate(., '
&<>.,;: %()[]/\+', '___________________________'))"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="translate(., '
&<>.,;: %()[]/\+', '___________________________')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:sequence">
|
||||
<xsl:param name="globalData"/>
|
||||
|
||||
<xsl:element namespace="{$namespace}" name="a">
|
||||
<xsl:apply-templates select="@*" />
|
||||
<xsl:attribute name="id">
|
||||
<xsl:choose>
|
||||
<xsl:when test="number(substring(@text:ref-name,1,1))">
|
||||
<!-- Heuristic: If the first character is a number a 'a_' will be set
|
||||
as prefix, as id have to be of type NMTOKEN -->
|
||||
<xsl:value-of select="concat('a_',translate(@text:ref-name, '
&<>.,;: %()[]/\+', '___________________________'))"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="translate(@text:ref-name, '
&<>.,;: %()[]/\+', '___________________________')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:reference-mark">
|
||||
<xsl:param name="globalData"/>
|
||||
|
||||
<xsl:element namespace="{$namespace}" name="a">
|
||||
<xsl:apply-templates select="@*" />
|
||||
<xsl:attribute name="id">
|
||||
<xsl:choose>
|
||||
<xsl:when test="number(substring(@text:name,1,1))">
|
||||
<!-- Heuristic: If the first character is a number a 'a_' will be set
|
||||
as prefix, as id have to be of type NMTOKEN -->
|
||||
<xsl:value-of select="concat('a_',translate(@text:name, '
&<>.,;: %()[]/\+', '___________________________'))"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="translate(@text:name, '
&<>.,;: %()[]/\+', '___________________________')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="text:reference-mark-start">
|
||||
<xsl:param name="globalData"/>
|
||||
|
||||
<xsl:element namespace="{$namespace}" name="a">
|
||||
<xsl:apply-templates select="@*" />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:bibliography-mark">
|
||||
<xsl:param name="globalData"/>
|
||||
|
||||
<xsl:element namespace="{$namespace}" name="a">
|
||||
<xsl:apply-templates select="@* | node()">
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!-- @text:title exist only in text:bibliography-mark -->
|
||||
<xsl:template match="@text:title">
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<!-- @text:url exist only in text:bibliography-mark -->
|
||||
<xsl:template match="@text:url">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:user-defined">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="office:annotation">
|
||||
<xsl:element name="span">
|
||||
<xsl:attribute name="title">annotation</xsl:attribute>
|
||||
<xsl:attribute name="class">annotation_style_by_filter</xsl:attribute>
|
||||
<xsl:apply-templates select="@*" />
|
||||
<br/>
|
||||
<xsl:text>[ANNOTATION:</xsl:text>
|
||||
<br/>
|
||||
<xsl:apply-templates select="*" mode="annotation"/>
|
||||
<xsl:text>]</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:p" mode="annotation">
|
||||
<br/>
|
||||
<xsl:element name="span">
|
||||
<xsl:text>NOTE: '</xsl:text>
|
||||
<xsl:apply-templates />
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dc:creator" mode="annotation">
|
||||
<br/>
|
||||
<xsl:element name="span">
|
||||
<xsl:attribute name="title">dc:creator</xsl:attribute>
|
||||
<xsl:text>BY '</xsl:text>
|
||||
<xsl:apply-templates />
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dc:date" mode="annotation">
|
||||
<br/>
|
||||
<xsl:element name="span">
|
||||
<xsl:attribute name="title">dc:date</xsl:attribute>
|
||||
<xsl:text>ON '</xsl:text>
|
||||
<xsl:apply-templates />
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="meta:date-string" mode="annotation">
|
||||
<br/>
|
||||
<xsl:element name="span">
|
||||
<xsl:attribute name="title">meta-date-string</xsl:attribute>
|
||||
<xsl:text>META DATE '</xsl:text>
|
||||
<xsl:apply-templates />
|
||||
<xsl:text>'</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- *************** -->
|
||||
<!-- *** HELPER *** -->
|
||||
<!-- *************** -->
|
||||
|
||||
|
||||
<xsl:template name="create-href">
|
||||
<xsl:param name="href"/>
|
||||
<xsl:param name="mimetype"/>
|
||||
|
||||
<xsl:choose>
|
||||
<!-- internal OOo URL used in content tables -->
|
||||
<xsl:when test="contains($href, '%7Coutline') or contains($href, '|outline')">
|
||||
<!-- the simplest workaround for content tables in a single document is to create an anchor from every heading element.
|
||||
Downside: multiple identical headings won't refer always to the first.
|
||||
-->
|
||||
<xsl:text>#</xsl:text>
|
||||
<xsl:variable name="title">
|
||||
<xsl:apply-templates mode="concatenate"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="concat('a_', translate(normalize-space($title), '.,;: %()[]/\+', '_____________'))"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="self::draw:image[office:binary-data]">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$mimetype">
|
||||
<xsl:text>data:</xsl:text><xsl:value-of select="$mimetype"/><xsl:text>;base64,</xsl:text><xsl:value-of select="office:binary-data"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>data:image/*;base64,</xsl:text><xsl:value-of select="office:binary-data"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<!-- in case of packed open office document -->
|
||||
<xsl:when test="starts-with($sourceBaseURL, 'jar:') or $isPackageFormat">
|
||||
<xsl:choose>
|
||||
<!-- for images relative to open office document -->
|
||||
<xsl:when test="starts-with($href, '../')">
|
||||
<!-- creating an absolute http URL to the packed image file (removing the '.')-->
|
||||
<xsl:value-of select="concat(substring-after(substring-before($sourceBaseURL, '!'), 'jar:'), '/', $href, $optionalURLSuffix)"/>
|
||||
</xsl:when>
|
||||
<!-- for absolute URLs & absolute paths -->
|
||||
<xsl:when test="contains($href, ':') or starts-with($href, '/')">
|
||||
<xsl:value-of select="concat($href, $optionalURLSuffix)"/>
|
||||
</xsl:when>
|
||||
<!-- for images jared in open office document -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<!-- for absolute URLs & Paths -->
|
||||
<xsl:when test="contains($href, ':') or starts-with($href, '/')">
|
||||
<xsl:value-of select="concat($href, $optionalURLSuffix)"/>
|
||||
</xsl:when>
|
||||
<!-- for relative URLs -->
|
||||
<xsl:when test="starts-with($href, '#')">
|
||||
<!-- intra document ref -->
|
||||
<xsl:value-of select="$href"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()" mode="concatenate">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
<xsl:template match="*" mode="concatenate">
|
||||
<xsl:apply-templates mode="concatenate"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- ******************** -->
|
||||
<!-- *** Common Rules *** -->
|
||||
<!-- ******************** -->
|
||||
|
||||
<!-- ignore / neglect the following elements -->
|
||||
<xsl:template match="draw:custom-shape | draw:g | office:forms | text:alphabetical-index-mark | text:alphabetical-index-mark-end | text:alphabetical-index-mark-start | text:bibliography-source | text:number | text:reference-mark-end | text:sequence-decls | text:soft-page-break | text:table-of-content-source | text:tracked-changes | text:user-field-decls"/>
|
||||
|
||||
<!-- default template used by purpose-->
|
||||
<xsl:template match="text:bibliography | text:change-end | text:change-start">
|
||||
<xsl:param name="globalData"/>
|
||||
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<!-- default template for not recognized elements -->
|
||||
<xsl:template match="*">
|
||||
<xsl:param name="globalData"/>
|
||||
<xsl:message>Using default element rule for ODF element '<xsl:value-of select="name()"/>'.</xsl:message>
|
||||
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="globalData" select="$globalData"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*"/>
|
||||
|
||||
<!-- allowing all matched text nodes -->
|
||||
<xsl:template match="text()">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
130
server/libreoffice/share/xslt/export/common/ooo2ms_docpr.xsl
Normal file
130
server/libreoffice/share/xslt/export/common/ooo2ms_docpr.xsl
Normal file
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<xsl:template match="office:meta">
|
||||
<o:DocumentProperties>
|
||||
<o:Title>
|
||||
<xsl:value-of select="dc:title"/>
|
||||
</o:Title>
|
||||
<o:Subject>
|
||||
<xsl:value-of select="dc:subject"/>
|
||||
</o:Subject>
|
||||
<o:Keywords>
|
||||
<xsl:for-each select="meta:keywords/meta:keyword">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:if test="position()!=last()">, </xsl:if>
|
||||
</xsl:for-each>
|
||||
</o:Keywords>
|
||||
<o:Description>
|
||||
<xsl:value-of select="dc:description"/>
|
||||
</o:Description>
|
||||
<o:Category>
|
||||
<xsl:value-of select="meta:user-defined[@meta:name = 'Category']"/>
|
||||
</o:Category>
|
||||
<o:Author>
|
||||
<xsl:value-of select="meta:initial-creator"/>
|
||||
</o:Author>
|
||||
<o:LastAuthor>
|
||||
<xsl:value-of select="dc:creator"/>
|
||||
</o:LastAuthor>
|
||||
<o:Manager>
|
||||
<xsl:value-of select="meta:user-defined[@meta:name = 'Manager']"/>
|
||||
</o:Manager>
|
||||
<o:Company>
|
||||
<xsl:value-of select="meta:user-defined[@meta:name = 'Company']"/>
|
||||
</o:Company>
|
||||
<o:HyperlinkBase>
|
||||
<xsl:value-of select="meta:user-defined[@meta:name = 'HyperlinkBase']"/>
|
||||
</o:HyperlinkBase>
|
||||
<o:Revision>
|
||||
<xsl:value-of select="meta:editing-cycles"/>
|
||||
</o:Revision>
|
||||
<!-- PresentationFormat, Guid, AppName, Version -->
|
||||
<o:TotalTime>
|
||||
<xsl:if test="meta:editing-duration">
|
||||
<xsl:variable name="hours">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(meta:editing-duration, 'H')">
|
||||
<xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'H')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="minutes">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(meta:editing-duration, 'M') and contains(meta:editing-duration, 'H')">
|
||||
<xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'H'), 'M')"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(meta:editing-duration, 'M')">
|
||||
<xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'M')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="$hours * 60 + $minutes"/>
|
||||
</xsl:if>
|
||||
</o:TotalTime>
|
||||
<o:LastPrinted>
|
||||
<xsl:if test="meta:print-date">
|
||||
<xsl:value-of select="concat( meta:print-date, 'Z')"/>
|
||||
</xsl:if>
|
||||
</o:LastPrinted>
|
||||
<o:Created>
|
||||
<xsl:if test="meta:creation-date">
|
||||
<xsl:value-of select="concat( meta:creation-date, 'Z')"/>
|
||||
</xsl:if>
|
||||
</o:Created>
|
||||
<o:LastSaved>
|
||||
<xsl:if test="dc:date">
|
||||
<xsl:value-of select="concat( dc:date, 'Z')"/>
|
||||
</xsl:if>
|
||||
</o:LastSaved>
|
||||
<o:Pages>
|
||||
<xsl:value-of select="meta:document-statistic/@meta:page-count"/>
|
||||
</o:Pages>
|
||||
<o:Words>
|
||||
<xsl:value-of select="meta:document-statistic/@meta:word-count"/>
|
||||
</o:Words>
|
||||
<o:Characters>
|
||||
<xsl:value-of select="meta:document-statistic/@meta:character-count"/>
|
||||
</o:Characters>
|
||||
<!-- CharactersWithSpaces, Bytes, Lines -->
|
||||
<o:Paragraphs>
|
||||
<xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
|
||||
</o:Paragraphs>
|
||||
</o:DocumentProperties>
|
||||
<o:CustomDocumentProperties>
|
||||
<o:Editor dt:dt="string">
|
||||
<xsl:value-of select="meta:generator"/>
|
||||
</o:Editor>
|
||||
<o:Language dt:dt="string">
|
||||
<xsl:value-of select="dc:language"/>
|
||||
</o:Language>
|
||||
<xsl:for-each select="meta:user-defined">
|
||||
<!-- transfer strings to XML QName, necessary to convert several characters -->
|
||||
<!-- {} -->
|
||||
<xsl:variable name="foo">.,| ~`!@#$%^*()&<>+=[];:"/\?{}'</xsl:variable>
|
||||
<xsl:element name="{concat( 'o:', translate(@meta:name,string($foo),'_'))}">
|
||||
<xsl:attribute name="dt:dt">string</xsl:attribute>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
</o:CustomDocumentProperties>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,373 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
|
||||
|
||||
|
||||
<!-- *** Properties with a 'fo:' prefix *** -->
|
||||
<xsl:template match="@fo:background-color">
|
||||
<xsl:text>background-color:</xsl:text>
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@fo:border | @fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right">
|
||||
<xsl:variable name="borderType" select="substring-after(name(), ':')"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test=". = 'none'">
|
||||
<xsl:value-of select="$borderType"/>
|
||||
<xsl:text>-style:none; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="borderWidth" select="substring-before(., ' ')"/>
|
||||
<xsl:variable name="borderStyle" select="substring-before(substring-after(., ' '), ' ')"/>
|
||||
<xsl:variable name="borderColor" select="substring-after(substring-after(., ' '), ' ')"/>
|
||||
|
||||
<!-- More information at template 'round-up-border-width' -->
|
||||
<xsl:variable name="borderWidthFixed">
|
||||
<xsl:call-template name="round-up-border-width">
|
||||
<xsl:with-param name="borderWidth" select="$borderWidth"/>
|
||||
<xsl:with-param name="multiplier">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$borderStyle = 'double'">3</xsl:when>
|
||||
<xsl:otherwise>1</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:value-of select="$borderType"/>
|
||||
<xsl:text>-width:</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$borderWidth = '0.05pt'">thin</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$borderWidthFixed"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>; </xsl:text>
|
||||
<xsl:value-of select="$borderType"/>
|
||||
<xsl:text>-style:</xsl:text>
|
||||
<xsl:value-of select="$borderStyle"/>
|
||||
<xsl:text>; </xsl:text>
|
||||
<xsl:value-of select="$borderType"/>
|
||||
<xsl:text>-color:</xsl:text>
|
||||
<xsl:value-of select="$borderColor"/>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- NOTE: Still there have to be placed a <br clear='all' /> to disable the flow!!!!-->
|
||||
<xsl:template match="@fo:clear">
|
||||
<xsl:text>clear:both; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
|
||||
<xsl:template match="@fo:color |@svg:font-family |@fo:font-size |@fo:font-style |@fo:font-weight |@fo:text-indent |@fo:text-shadow |@text:display">
|
||||
<xsl:value-of select="substring-after(name(), ':')"/>
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- workaround AOOO#119401 suspicious property fo:margin="100%" in paragraph style -->
|
||||
<xsl:template match="@fo:margin[string(.) = '100%']"/>
|
||||
|
||||
<!-- Maps fo:margin as well fo:margin-top, fo:margin-bottom, fo:padding-left, fo:margin-right -->
|
||||
<!-- Maps fo:padding as well fo:padding-top, fo:padding-bottom, fo:padding-left, fo:padding-right -->
|
||||
<xsl:template match="@fo:letter-spacing | @fo:line-height | @fo:width |@fo:margin | @fo:margin-top | @fo:margin-bottom | @fo:margin-left | @fo:margin-right | @fo:padding | @fo:padding-top | @fo:padding-bottom | @fo:padding-left | @fo:padding-right">
|
||||
<xsl:value-of select="local-name(.)"/>
|
||||
<xsl:text>:</xsl:text>
|
||||
<!-- Map once erroneously used inch shortage 'inch' to CSS shortage 'in' -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(., 'inch')">
|
||||
<xsl:value-of select="substring-before(.,'ch')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@fo:text-align">
|
||||
<!-- 'important' is necessary as table cell value alignment is decided by runtime over the valuetype
|
||||
Otherwise a table cell style-class would always be outnumbered by the run-time alignment value -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(., 'start')">
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::*/@style:writing-mode and contains(parent::*/@style:writing-mode, 'rl')">
|
||||
<xsl:text>text-align:right ! important; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>text-align:left ! important; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(., 'end')">
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::*/@style:writing-mode and contains(parent::*/@style:writing-mode, 'rl')">
|
||||
<xsl:text>text-align:right ! important;</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>text-align:left ! important; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>text-align:</xsl:text>
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text> ! important; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@style:vertical-align">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(., 'bottom')">
|
||||
<xsl:text>vertical-align:bottom; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(., 'middle')">
|
||||
<xsl:text>vertical-align:middle; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>vertical-align:top; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- *** Properties with a 'style:' prefix *** -->
|
||||
<!-- NOTE: Can 'inside' | 'from-inside' better be handled:
|
||||
<!ATTLIST * style:horizontal-pos (from-left|left|center|right|from-inside|inside|outside)#IMPLIED>-->
|
||||
<xsl:template match="@style:horizontal-pos">
|
||||
<xsl:choose>
|
||||
<xsl:when test=".='left'">
|
||||
<xsl:text>text-align:left; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test=". = 'right'">
|
||||
<xsl:text>text-align:right; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test=".='center'">
|
||||
<xsl:text>text-align:center; </xsl:text>
|
||||
</xsl:when>
|
||||
<!-- NOTE: currently other values are not used.
|
||||
If the property value is from-left or from-inside,
|
||||
the svg:x attribute associated with the frame element specifies
|
||||
the horizontal position of the frame.
|
||||
Otherwise the svg:x attribute is ignored for text documents.
|
||||
-->
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@style:column-width">
|
||||
<xsl:text>width:</xsl:text>
|
||||
<xsl:choose>
|
||||
<!-- changing the distance measure: inch to in -->
|
||||
<xsl:when test="contains(., 'inch')">
|
||||
<xsl:value-of select="substring-before(.,'ch')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@style:text-underline-style">
|
||||
<xsl:text>text-decoration:</xsl:text>
|
||||
<xsl:choose>
|
||||
<!-- changing the distance measure: inch to in -->
|
||||
<xsl:when test=".='none'">
|
||||
<xsl:text>none ! important</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>underline</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@style:font-name">
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<xsl:text>font-family:</xsl:text>
|
||||
<xsl:variable name="content" select="."/>
|
||||
<xsl:variable name="quote">'</xsl:variable>
|
||||
<xsl:variable name="fontName" select="$globalData/office:font-face-decls/style:font-face[@style:name=$content]/@svg:font-family" />
|
||||
<xsl:value-of select="translate($fontName, $quote, '')"/>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@style:row-height">
|
||||
<xsl:text>height:</xsl:text>
|
||||
<xsl:choose>
|
||||
<!-- changing the distance measure: inch to in -->
|
||||
<xsl:when test="contains(., 'inch')">
|
||||
<xsl:value-of select="substring-before(.,'ch')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@svg:strikethrough-position">
|
||||
<xsl:if test="not(.='none')">
|
||||
<xsl:text>text-decoration:line-through; </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="@style:text-position">
|
||||
<xsl:if test="contains(., 'sub')">
|
||||
<xsl:text>vertical-align:sub; </xsl:text>
|
||||
<xsl:if test="contains(., '%')">
|
||||
<xsl:text>font-size:</xsl:text>
|
||||
<xsl:value-of select="substring-after(., 'sub ')"/>
|
||||
<xsl:text>;</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:if test="contains(., 'super')">
|
||||
<xsl:text>vertical-align:super; </xsl:text>
|
||||
<xsl:if test="contains(., '%')">
|
||||
<xsl:text>font-size:</xsl:text>
|
||||
<xsl:value-of select="substring-after(., 'super ')"/>
|
||||
<xsl:text>;</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@style:vertical-pos">
|
||||
<xsl:choose>
|
||||
<xsl:when test=".='from-top'">
|
||||
<xsl:text>vertical-align:top; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>vertical-align:</xsl:text>
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@style:width">
|
||||
<xsl:text>width:</xsl:text>
|
||||
<xsl:choose>
|
||||
<!-- changing the distance measure: inch to in -->
|
||||
<xsl:when test="contains(., 'inch')">
|
||||
<xsl:value-of select="substring-before(.,'ch')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:template>
|
||||
<xsl:template match="@style:wrap">
|
||||
<xsl:choose>
|
||||
<xsl:when test=".='left'">
|
||||
<xsl:text>float:right; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test=".='right'">
|
||||
<xsl:text>float:left; </xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="@style:writing-mode">
|
||||
<xsl:text>writing-mode:</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test=".='rl-tb'">
|
||||
<xsl:text>horizontal-tb; direction:rtl; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test=".='lr-tb'">
|
||||
<xsl:text>horizontal-tb; direction:ltr; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test=".='tb-rl'">
|
||||
<xsl:text>vertical-rl; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test=".='tb-lr'">
|
||||
<xsl:text>vertical-lr; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>horizontal-tb; direction:ltr;</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- *** Properties with a no 'fo:' or 'style:' prefix *** -->
|
||||
<xsl:template match="@table:align">
|
||||
<xsl:choose>
|
||||
<xsl:when test=".='left'">
|
||||
<xsl:if test="not(../@fo:margin-left)">margin-left:0px; </xsl:if>
|
||||
<xsl:text>margin-right:auto;</xsl:text></xsl:when>
|
||||
<xsl:when test=".='right'">
|
||||
<xsl:text>margin-left:auto</xsl:text>
|
||||
<xsl:if test="not(../@fo:margin-right)">
|
||||
; margin-right: 0px;
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test=".='center'">
|
||||
margin-left:auto;margin-right:auto;
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>float:none; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="style:background-image">
|
||||
<xsl:text>background-image:url(</xsl:text>
|
||||
<xsl:value-of select="@xlink:href"/>
|
||||
<xsl:text>); </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@style:repeat = 'repeat'">
|
||||
<xsl:text>background-repeat:repeat; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>background-repeat:no-repeat; </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Changing border width measure to cm and enlarging border-width to the Mozilla browser(1.7)
|
||||
visible minimum width
|
||||
- 0.0133cm for solid style
|
||||
- 0.0399cm for double style
|
||||
as there are three border lines painted -->
|
||||
<xsl:decimal-format name = "unifiedFormat" decimal-separator = "." />
|
||||
<xsl:template name="round-up-border-width">
|
||||
<xsl:param name="borderWidth"/>
|
||||
<xsl:param name="multiplier"/>
|
||||
|
||||
<xsl:variable name="borderWidthByCentimeter">
|
||||
<xsl:call-template name="convert2cm">
|
||||
<xsl:with-param name="value" select="$borderWidth"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="minimalBorderWidth" select="0.0133 * $multiplier"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="number($borderWidthByCentimeter) < $minimalBorderWidth">
|
||||
<xsl:value-of select="format-number($minimalBorderWidth,'0.######','unifiedFormat')"/>
|
||||
<xsl:text>cm</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="format-number($borderWidthByCentimeter,'0.######','unifiedFormat')"/>
|
||||
<xsl:text>cm</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
155
server/libreoffice/share/xslt/export/common/table/table.xsl
Normal file
155
server/libreoffice/share/xslt/export/common/table/table.xsl
Normal file
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
|
||||
|
||||
|
||||
<!-- table row handling -->
|
||||
<xsl:include href="table_rows.xsl" />
|
||||
<!-- table column handling -->
|
||||
<xsl:include href="table_columns.xsl" />
|
||||
<!-- table cell handling -->
|
||||
<xsl:include href="table_cells.xsl" />
|
||||
|
||||
<xsl:param name="tableElement" select="'table'" />
|
||||
|
||||
<!-- ******************* -->
|
||||
<!-- *** main table *** -->
|
||||
<!-- ******************* -->
|
||||
|
||||
|
||||
<xsl:template match="table:table" name="table:table">
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<!-- The table will only be created if the table:scenario is active -->
|
||||
<xsl:if test="not(table:scenario) or table:scenario/@table:is-active">
|
||||
<xsl:call-template name="create-table">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template name="create-table">
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<!-- by default '1', for each new sub/inner/nested table the number counts one up -->
|
||||
<xsl:variable name="tableLevel" select="count(ancestor-or-self::table:table)" />
|
||||
<!-- collecting all visible "table:table-row" elements of the table -->
|
||||
<xsl:variable name="allVisibleTableRows" select="table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel] |
|
||||
table:table-header-rows/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel] |
|
||||
table:table-row-group/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel]" />
|
||||
<!-- As the alignment of a table is by 'align' attribute is deprecated and as the CSS 'float' attribute not well displayed,
|
||||
we do a trick by encapsulating the table with an aligned 'div' element-->
|
||||
<xsl:variable name="table-alignment" select="key('styles', @style:name = current()/@table:style-name)/*/@table:align" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($table-alignment) != 0">
|
||||
<xsl:element namespace="{$namespace}" name="div">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:choose>
|
||||
<xsl:when test='$table-alignment="left" or $table-alignment="margins"'>
|
||||
<xsl:text>text-align:left</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test='$table-alignment="right"'>
|
||||
<xsl:text>text-align:right</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test='$table-alignment="center"'>
|
||||
<xsl:text>text-align:center</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="create-table-element">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="create-table-element">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="create-table-element">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allVisibleTableRows" />
|
||||
|
||||
<xsl:element namespace="{$namespace}" name="{$tableElement}">
|
||||
<xsl:attribute name="border">0</xsl:attribute>
|
||||
<xsl:attribute name="cellspacing">0</xsl:attribute>
|
||||
<xsl:attribute name="cellpadding">0</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test='name()="table:table"'>
|
||||
<xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:rel-width" />
|
||||
<xsl:if test="$value">
|
||||
<xsl:attribute name="width">
|
||||
<xsl:value-of select="$value" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="width">100%</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:apply-templates select="@table:style-name">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
<xsl:call-template name="create-column-style-variable">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,270 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xt="http://www.jclark.com/xt"
|
||||
xmlns:common="http://exslt.org/common"
|
||||
xmlns:xalan="http://xml.apache.org/xalan"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
|
||||
|
||||
|
||||
<!-- *********************************** -->
|
||||
<!-- *** write repeating table cells *** -->
|
||||
<!-- *********************************** -->
|
||||
|
||||
|
||||
<!-- matching cells to give out -> covered table cells are not written out -->
|
||||
<xsl:template match="table:table-cell">
|
||||
<xsl:param name="globalData" />
|
||||
<!-- position of the current input cell to get the correct column style (hidden are also counted)-->
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="maxRowLength" />
|
||||
<xsl:param name="tableDataType" />
|
||||
|
||||
|
||||
<!-- The column position of the current cell has to be determined
|
||||
to get the adequate column styles during later cell creation,
|
||||
or hiding the cell when @table:visibility is not set to 'visible'.
|
||||
|
||||
The position is archived by adding up all table:number-columns-repeated of the preceding cells.
|
||||
Step1: creating '$precedingCells/quantity/@table:number-columns-repeated').
|
||||
Step2: sum(xxx:nodeset($precedingCells)/quantity) + 1 -->
|
||||
<xsl:variable name="precedingCells">
|
||||
<xsl:for-each select="preceding-sibling::*">
|
||||
<xsl:choose>
|
||||
<!-- maybe a parser is used, which reads the DTD files (e.g. Xerces),
|
||||
then '1' is the default for 'table:number-columns-repeated' -->
|
||||
<xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
|
||||
<xsl:element name="quantity" namespace="">
|
||||
<xsl:text>1</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:element name="quantity" namespace="">
|
||||
<xsl:value-of select="@table:number-columns-repeated" />
|
||||
</xsl:element>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
|
||||
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="function-available('common:node-set')">
|
||||
<xsl:call-template name="create-table-cell">
|
||||
<!-- position of the current input cell to get the correct column style (hidden are also counted)-->
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="precedingColumns" select="sum(common:node-set($precedingCells)/*)" />
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('xalan:nodeset')">
|
||||
<xsl:call-template name="create-table-cell">
|
||||
<!-- position of the current input cell to get the correct column style (hidden are also counted)-->
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="precedingColumns" select="sum(xalan:nodeset($precedingCells)/*)" />
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('xt:node-set')">
|
||||
<xsl:call-template name="create-table-cell">
|
||||
<!-- position of the current input cell to get the correct column style (hidden are also counted)-->
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="precedingColumns" select="sum(xt:node-set($precedingCells)/*)" />
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- current node is a table:table-cell -->
|
||||
<xsl:template name="create-table-cell">
|
||||
<!-- position of the current input cell to get the correct column style (hidden are also counted)-->
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="maxRowLength" />
|
||||
<xsl:param name="precedingColumns" select="0" />
|
||||
<xsl:param name="tableDataType" />
|
||||
|
||||
<xsl:variable name="columnPosition" select="$precedingColumns + 1" />
|
||||
|
||||
<xsl:if test="$debugEnabled">
|
||||
<xsl:message>
|
||||
<xsl:text>
|
||||
table:table-cell #</xsl:text>
|
||||
<xsl:value-of select="$columnPosition" />
|
||||
<xsl:text> has been entered with node value: </xsl:text>
|
||||
<xsl:value-of select="." />
|
||||
<xsl:text>
|
||||
table:number-columns-repeated: </xsl:text>
|
||||
<xsl:value-of select="@table:number-columns-repeated" />
|
||||
<xsl:text>
|
||||
maxRowLength: </xsl:text>
|
||||
<xsl:value-of select="$maxRowLength" />
|
||||
</xsl:message>
|
||||
</xsl:if>
|
||||
|
||||
<!-- only non hidden column will be given out -->
|
||||
<xsl:variable name="currentTableColumn" select="$allTableColumns/table:table-column[position() = $columnPosition]" />
|
||||
<xsl:if test="$currentTableColumn[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]">
|
||||
<xsl:choose>
|
||||
<!-- if parser reads DTD the default is set to '1' -->
|
||||
<xsl:when test="@table:number-columns-repeated > 1">
|
||||
<!-- writes multiple entries of a cell -->
|
||||
<xsl:call-template name="repeat-write-cell">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="columnPosition" select="$columnPosition" />
|
||||
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- writes an entry of a cell -->
|
||||
<xsl:call-template name="write-cell">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="columnPosition" select="$columnPosition" />
|
||||
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="repeat-write-cell">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="columnPosition" />
|
||||
<xsl:param name="currentTableColumn" />
|
||||
<xsl:param name="maxRowLength" />
|
||||
<xsl:param name="numberColumnsRepeated" />
|
||||
<xsl:param name="tableDataType" />
|
||||
|
||||
<xsl:choose>
|
||||
<!-- This is the current workaround for the flood of cells, simulation background by repeating cell -->
|
||||
<xsl:when test="$numberColumnsRepeated > 1 and $maxRowLength > $columnPosition">
|
||||
|
||||
<!-- writes an entry of a cell -->
|
||||
<xsl:call-template name="write-cell">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="columnPosition" select="$columnPosition" />
|
||||
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
<!-- repeat calling this method until all elements written out -->
|
||||
<xsl:if test="$debugEnabled">
|
||||
<xsl:message>+++++++++ cell repetition +++++++++</xsl:message>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="repeat-write-cell">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="columnPosition" select="$columnPosition + 1" />
|
||||
<xsl:with-param name="currentTableColumn" select="$allTableColumns/table:table-column[position() = ($columnPosition + 1)]" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- This is the current workaround for the flood of cells, simulation background by repeating cell -->
|
||||
<!-- When the maxRowLength is reached a last entry of a cell is written -->
|
||||
<xsl:call-template name="write-cell">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="columnPosition" select="$columnPosition" />
|
||||
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="write-cell">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="columnPosition" />
|
||||
<xsl:param name="currentTableColumn" />
|
||||
<xsl:param name="tableDataType" />
|
||||
|
||||
<!-- a non hidden column will be give out -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentTableColumn[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]">
|
||||
<xsl:call-template name="create-table-cell-content">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="columnPosition" select="$columnPosition" />
|
||||
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<!-- a hidden column -->
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="$debugEnabled">
|
||||
<xsl:message>table column is hidden!</xsl:message>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,232 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xt="http://www.jclark.com/xt"
|
||||
xmlns:common="http://exslt.org/common"
|
||||
xmlns:xalan="http://xml.apache.org/xalan"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
|
||||
|
||||
<xsl:param name="tableColumnElement" select="'col'" />
|
||||
|
||||
<!-- ******************************************** -->
|
||||
<!-- *** Create table columns style variable *** -->
|
||||
<!-- ******************************************** -->
|
||||
|
||||
<!-- current node is a table:table -->
|
||||
<xsl:template name="create-column-style-variable">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allVisibleTableRows" />
|
||||
|
||||
<!-- all columns of the table -->
|
||||
<xsl:variable name="allTableColumns" select="table:table-column |
|
||||
table:table-column-group/descendant::table:table-column |
|
||||
table:table-header-columns/descendant::table:table-column" />
|
||||
<!-- allTableColumns: Containing all columns of the table, hidden and viewed.
|
||||
- if a column is hidden, if table:visibility has the value 'collapse' or 'filter', otherwise the value is 'visible'
|
||||
- if a column is being repeated, each repeated column is explicitly written as entry in this variable.
|
||||
Later (during template "write-cell") the style of the column will be mixed with the cell-style by using
|
||||
the position() of the column entry and comparing it with the iterating cell number. -->
|
||||
<xsl:variable name="allTableColumns-RTF">
|
||||
<xsl:for-each select="$allTableColumns">
|
||||
<xsl:call-template name="adding-column-styles-entries">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="function-available('common:node-set')">
|
||||
<xsl:call-template name="create-table-children">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
<xsl:with-param name="allTableColumns" select="common:node-set($allTableColumns-RTF)" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('xalan:nodeset')">
|
||||
<xsl:call-template name="create-table-children">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
<xsl:with-param name="allTableColumns" select="xalan:nodeset($allTableColumns-RTF)" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('xt:node-set')">
|
||||
<xsl:call-template name="create-table-children">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
<xsl:with-param name="allTableColumns" select="xt:node-set($allTableColumns-RTF)" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- current node is a table:table -->
|
||||
<xsl:template name="create-table-children">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allVisibleTableRows" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
|
||||
|
||||
<xsl:for-each select="$allTableColumns/table:table-column">
|
||||
<xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
|
||||
|
||||
<xsl:call-template name="create-column-element">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
|
||||
<xsl:call-template name="create-table-rows">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- To be OVERWRITTEN -->
|
||||
<xsl:template name="create-column-element" />
|
||||
|
||||
<!-- current node is a table:table-column -->
|
||||
<xsl:template name="adding-column-styles-entries">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
|
||||
<xsl:choose>
|
||||
<!-- if parser reads DTD the default is set to '1' -->
|
||||
<xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
|
||||
<!-- writes an entry of a column in the columns-variable -->
|
||||
<xsl:copy-of select="." />
|
||||
</xsl:when>
|
||||
<!-- No higher repetition of cells greater than 99 for the last and second last column.
|
||||
This is a workaround for some sample document (Waehrungsumrechner.sxc),
|
||||
having 230 repeated columns in the second last column to emulate background -->
|
||||
<!-- NOTE: Testcase with a table containing table:table-column-group and/or table:table-header-columns -->
|
||||
<xsl:when test="(last() or (last() - 1)) and @table:number-columns-repeated > 99">
|
||||
<!-- writes an entry of a column in the columns-variable -->
|
||||
<xsl:call-template name="repeat-adding-table-column">
|
||||
<xsl:with-param name="numberColumnsRepeated" select="1" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- repeated columns will be written explicit several times in the variable-->
|
||||
<xsl:call-template name="repeat-adding-table-column">
|
||||
<xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- WRITES THE REPEATED COLUMN STYLE EXPLICIT AS AN ELEMENT IN THE COLUMNS-VARIABLE -->
|
||||
<!-- current node is a table:table-column -->
|
||||
<xsl:template name="repeat-adding-table-column">
|
||||
<xsl:param name="table:table-column" />
|
||||
<xsl:param name="numberColumnsRepeated" />
|
||||
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$numberColumnsRepeated > 1">
|
||||
<!-- writes an entry of a column in the columns-variable -->
|
||||
<xsl:copy-of select="." />
|
||||
<!-- repeat calling this method until all elements written out -->
|
||||
<xsl:call-template name="repeat-adding-table-column">
|
||||
<xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- writes an entry of a column in the columns-variable -->
|
||||
<xsl:copy-of select="." />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--debugEnabled-START-->
|
||||
<!-- giving out the 'allColumnStyle' variable:
|
||||
For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
|
||||
In case of 'column-hidden-flag' attribute the text 'Column is hidden is given out.-->
|
||||
<!-- current node is a table:table -->
|
||||
<xsl:template name="table-debug-allTableColumns">
|
||||
<xsl:param name="allTableColumns" />
|
||||
|
||||
<!-- debug output as table summary attribute in html -->
|
||||
<xsl:attribute name="summary">
|
||||
<xsl:call-template name="table-debug-column-out">
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<!-- debug output to console -->
|
||||
<xsl:message>
|
||||
<xsl:call-template name="table-debug-column-out">
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
</xsl:call-template>
|
||||
</xsl:message>
|
||||
</xsl:template>
|
||||
|
||||
<!-- current node is a table:table -->
|
||||
<xsl:template name="table-debug-column-out">
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:text>
|
||||
DebugInformation: For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
|
||||
In case of table:visibility attribute unequal 'visible' the 'column is hidden' no text is given out.
|
||||
</xsl:text>
|
||||
<xsl:for-each select="$allTableColumns/table:table-column">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@table:visibility = 'collapse' or @table:visibility = 'filter' ">
|
||||
<xsl:text> </xsl:text><xsl:value-of select="@table:style-name" /><xsl:text>column is hidden</xsl:text><xsl:text></xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text> </xsl:text><xsl:value-of select="@table:style-name" /><xsl:text> </xsl:text><xsl:value-of select="@table:default-cell-style-name" /><xsl:text></xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!--debugEnabled-END-->
|
||||
|
||||
</xsl:stylesheet>
|
||||
203
server/libreoffice/share/xslt/export/common/table/table_rows.xsl
Normal file
203
server/libreoffice/share/xslt/export/common/table/table_rows.xsl
Normal file
@@ -0,0 +1,203 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
|
||||
|
||||
|
||||
<xsl:param name="rowElement" select="'tr'" />
|
||||
|
||||
<!-- ********************************** -->
|
||||
<!-- *** write repeating table rows *** -->
|
||||
<!-- ********************************** -->
|
||||
|
||||
<!-- current node is a table:table -->
|
||||
<xsl:template name="create-table-rows">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allVisibleTableRows" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
|
||||
<!-- Some Office Calc documents simulate a background by repeating one of the later cells until end of used space
|
||||
(The value of "table:number-columns-repeated" is enormous). Writing out all these cells would be fatal in time
|
||||
and output size. Therefore, this global variable shows us the longest row with content. -->
|
||||
<xsl:variable name="maxRowLength" select="count($allTableColumns/table:table-column)" />
|
||||
<xsl:if test="$debugEnabled">
|
||||
<xsl:message>maxRowLength: <xsl:value-of select="$maxRowLength" /></xsl:message>
|
||||
<xsl:call-template name="table-debug-allTableColumns">
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
|
||||
<!-- a table is a table header, when it has a "table:table-header-rows" ancestor -->
|
||||
<xsl:variable name="tableDataType">
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::table:table-header-rows">
|
||||
<xsl:text>th</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>td</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- removes repetition of rows, most probably done for background emulating -->
|
||||
<xsl:for-each select="$allVisibleTableRows">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(last() or (last() - 1)) and @table:number-rows-repeated > 99">
|
||||
<xsl:call-template name="repeat-write-row">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="numberRowsRepeated" select="1" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="repeat-write-row">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="numberRowsRepeated" select="@table:number-rows-repeated" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="repeat-write-row">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="numberRowsRepeated" select="1" />
|
||||
<xsl:param name="maxRowLength" />
|
||||
<xsl:param name="tableDataType" />
|
||||
|
||||
<xsl:choose>
|
||||
<!-- write an entry of a row and repeat calling this method until all elements are written out -->
|
||||
<xsl:when test="$numberRowsRepeated > 1 and table:table-cell">
|
||||
<xsl:call-template name="write-row">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- NOTE: take variable from the output of repeated write-row and iterate giving out the variable -->
|
||||
<xsl:call-template name="repeat-write-row">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="numberRowsRepeated" select="$numberRowsRepeated - 1" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<!-- write a single entry of a row -->
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="write-row">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="add-table-row-attributes">
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<!-- writing the style of the row -->
|
||||
<xsl:if test="@table:style-name">
|
||||
<xsl:call-template name='add-style-properties'>
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="write-row">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="maxRowLength" />
|
||||
<xsl:param name="tableDataType" />
|
||||
|
||||
|
||||
<xsl:element namespace="{$namespace}" name="{$rowElement}">
|
||||
<xsl:call-template name='add-table-row-attributes'>
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:if test="$debugEnabled">
|
||||
<xsl:message>'tr' element has been added!</xsl:message>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:apply-templates select="table:table-cell">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
<xsl:with-param name="maxRowLength" select="$maxRowLength" />
|
||||
<xsl:with-param name="tableDataType" select="$tableDataType" />
|
||||
</xsl:apply-templates>
|
||||
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- **************************** -->
|
||||
<!-- *** HELPER: table styles *** -->
|
||||
<!-- **************************** -->
|
||||
|
||||
<xsl:template name="add-style-properties">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="node-position" />
|
||||
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="translate(@table:style-name, '. %()/\+', '')" />
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
579
server/libreoffice/share/xslt/export/common/table_of_content.xsl
Normal file
579
server/libreoffice/share/xslt/export/common/table_of_content.xsl
Normal file
File diff suppressed because it is too large
Load Diff
631
server/libreoffice/share/xslt/export/spreadsheetml/formular.xsl
Normal file
631
server/libreoffice/share/xslt/export/spreadsheetml/formular.xsl
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,408 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink">
|
||||
|
||||
|
||||
<!--+++++ INCLUDED XSL MODULES +++++-->
|
||||
|
||||
<!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
|
||||
<xsl:import href="../../common/measure_conversion.xsl" />
|
||||
|
||||
<!-- excel table handling -->
|
||||
<xsl:include href="table.xsl" />
|
||||
|
||||
<!-- mapping rules of office style properties to Excel style properties -->
|
||||
<xsl:include href="style_mapping.xsl" />
|
||||
|
||||
<!-- creating the Excel styles element -->
|
||||
<xsl:include href="styles.xsl" />
|
||||
|
||||
<!-- mapping formular Expressions -->
|
||||
<xsl:include href="formular.xsl" />
|
||||
|
||||
<xsl:output method = "xml"
|
||||
indent = "no"
|
||||
encoding = "UTF-8"
|
||||
omit-xml-declaration = "no" />
|
||||
|
||||
<xsl:strip-space elements="ss:Data html:Data" />
|
||||
|
||||
|
||||
<!-- common table handling -->
|
||||
<xsl:variable name="namespace" select="'urn:schemas-microsoft-com:office:spreadsheet'" />
|
||||
|
||||
<!--+++++ PARAMETER SECTION +++++-->
|
||||
|
||||
<!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a (relative) URL to the target directory.
|
||||
Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
|
||||
<xsl:param name="targetBaseURL" select="'./'" />
|
||||
|
||||
<!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
|
||||
To access contents of an office file (content like the meta.xml, styles.xml file or graphics) a URL could be chosen.
|
||||
This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
|
||||
"jar:file:/C:/temp/Test.sxw!/" for example.
|
||||
When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the jared document. -->
|
||||
<xsl:param name="sourceBaseURL" select="'./'" />
|
||||
|
||||
<!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
|
||||
Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is being used (the session is appended to the URL).
|
||||
This URL session is used for example when links to graphics are created by XSLT. Otherwise the user has to log again in for every graphic he likes to see. -->
|
||||
<xsl:param name="optionalURLSuffix" />
|
||||
|
||||
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
|
||||
<xsl:param name="metaFileURL" />
|
||||
|
||||
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
|
||||
<xsl:param name="stylesFileURL" />
|
||||
|
||||
<!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
|
||||
(e.g. encoding chapter names for the content-table as href and anchors ) -->
|
||||
<xsl:param name="java" select="true()" />
|
||||
<xsl:param name="javaEnabled" select="boolean($java)" />
|
||||
|
||||
<!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
|
||||
<xsl:param name="debug" select="false()" />
|
||||
<xsl:param name="debugEnabled" select="boolean($debug)" />
|
||||
|
||||
<!-- matching configuration entries -->
|
||||
<xsl:key name="config" use="@config:name"
|
||||
match="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item |
|
||||
/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry/config:config-item" />
|
||||
|
||||
<xsl:key name="colors" match="/*/office:styles//@*[name() = 'fo:background-color' or name() = 'fo:color'] |
|
||||
/*/office:automatic-styles//@*[name() = 'fo:background-color' or name() = 'fo:color']" use="/" />
|
||||
<xsl:key name="colorRGB" match="@fo:background-color | @fo:color" use="." />
|
||||
<!-- *************************** -->
|
||||
<!-- *** Built up Excel file *** -->
|
||||
<!-- *************************** -->
|
||||
<xsl:template match="/">
|
||||
<xsl:processing-instruction name="mso-application">progid="Excel.Sheet"</xsl:processing-instruction>
|
||||
<!-- Note: for debugging purpose include schema location
|
||||
<Workbook xsi:schemaLocation="urn:schemas-microsoft-com:office:spreadsheet <YOUR_SCHEMA_URL>/excelss.xsd"> -->
|
||||
<Workbook>
|
||||
<!-- adding some default settings -->
|
||||
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
|
||||
<Colors>
|
||||
<xsl:for-each select="key('colors', /)
|
||||
[generate-id(.) =
|
||||
generate-id(key('colorRGB', .)[1]) and starts-with(., '#')] ">
|
||||
<xsl:sort select="." />
|
||||
<Color>
|
||||
<Index><xsl:value-of select="position() + 2" /></Index>
|
||||
<RGB><xsl:value-of select="." /></RGB>
|
||||
</Color>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="key('config', 'TabColor')[not(.=preceding::config:config-item)]">
|
||||
<xsl:sort select="." />
|
||||
<Color>
|
||||
<Index><xsl:value-of select="56 - position()" /></Index>
|
||||
<RGB>
|
||||
<xsl:call-template name="colordecimal2rgb">
|
||||
<xsl:with-param name="colordecimal" select="."/>
|
||||
</xsl:call-template>
|
||||
</RGB>
|
||||
</Color>
|
||||
</xsl:for-each>
|
||||
</Colors>
|
||||
</OfficeDocumentSettings>
|
||||
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
|
||||
<xsl:if test="key('config', 'HasSheetTabs') = 'false'">
|
||||
<xsl:element name="HideWorkbookTabs" />
|
||||
</xsl:if>
|
||||
<WindowHeight>9000</WindowHeight>
|
||||
<WindowWidth>13860</WindowWidth>
|
||||
<WindowTopX>240</WindowTopX>
|
||||
<WindowTopY>75</WindowTopY>
|
||||
<ProtectStructure>False</ProtectStructure>
|
||||
<ProtectWindows>False</ProtectWindows>
|
||||
</ExcelWorkbook>
|
||||
<!-- Note: the following handling will exchange the default, later
|
||||
<x:ExcelWorkbook>
|
||||
<xsl:apply-templates select="table:calculation-settings" />
|
||||
</x:ExcelWorkbook>
|
||||
-->
|
||||
<xsl:element name="Styles">
|
||||
<!-- our application default will not be used for export to Excel
|
||||
<xsl:apply-templates select="/*/office:styles/style:default-style" mode="styles" />-->
|
||||
<xsl:apply-templates select="/*/office:styles/style:style" mode="styles" />
|
||||
<xsl:apply-templates select="/*/office:automatic-styles/style:style" mode="styles" >
|
||||
<xsl:with-param name="isAutomatic" select="true()" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:element>
|
||||
<xsl:apply-templates select="/*/office:body" />
|
||||
</Workbook>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="colordecimal2rgb">
|
||||
<xsl:param name="colordecimal"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$colordecimal <= 16777215 and $colordecimal >= 65536">
|
||||
<xsl:variable name="redValue" select="floor(($colordecimal) div 65536)"/>
|
||||
<xsl:variable name="greenValue" select="floor(($colordecimal - ($redValue*65536)) div 256)"/>
|
||||
<xsl:variable name="blueValue" select="$colordecimal - ($redValue*65536) - ($greenValue*256)"/>
|
||||
<xsl:call-template name="dec_rgb2Hex">
|
||||
<xsl:with-param name="decRedValue" select="$redValue"/>
|
||||
<xsl:with-param name="decGreenValue" select="$greenValue"/>
|
||||
<xsl:with-param name="decBlueValue" select="$blueValue"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$colordecimal <= 65535 and $colordecimal >= 256">
|
||||
<xsl:variable name="redValue" select="0"/>
|
||||
<xsl:variable name="greenValue" select="$colordecimal div 256"/>
|
||||
<xsl:variable name="blueValue" select="$colordecimal - ($greenValue*256)"/>
|
||||
<xsl:call-template name="dec_rgb2Hex">
|
||||
<xsl:with-param name="decRedValue" select="$redValue"/>
|
||||
<xsl:with-param name="decGreenValue" select="$greenValue"/>
|
||||
<xsl:with-param name="decBlueValue" select="$blueValue"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$colordecimal <= 255 and $colordecimal >= 0">
|
||||
<xsl:variable name="redValue" select="0"/>
|
||||
<xsl:variable name="greenValue" select="0"/>
|
||||
<xsl:variable name="blueValue" select="$colordecimal"/>
|
||||
<xsl:call-template name="dec_rgb2Hex">
|
||||
<xsl:with-param name="decRedValue" select="$redValue"/>
|
||||
<xsl:with-param name="decGreenValue" select="$greenValue"/>
|
||||
<xsl:with-param name="decBlueValue" select="$blueValue"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise/>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template name="dec_rgb2Hex">
|
||||
<xsl:param name="decRedValue"/>
|
||||
<xsl:param name="decGreenValue"/>
|
||||
<xsl:param name="decBlueValue"/>
|
||||
<xsl:variable name="hexRedValue">
|
||||
<xsl:variable name="tmpHexRedValue">
|
||||
<xsl:call-template name="decimal2hex">
|
||||
<xsl:with-param name="dec-number" select="$decRedValue"/>
|
||||
<xsl:with-param name="last-value" select="'H'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($tmpHexRedValue) = 1">
|
||||
<xsl:value-of select="concat('0',$tmpHexRedValue)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$tmpHexRedValue"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="hexGreenValue">
|
||||
<xsl:variable name="tmpHexGreenValue">
|
||||
<xsl:call-template name="decimal2hex">
|
||||
<xsl:with-param name="dec-number" select="$decGreenValue"/>
|
||||
<xsl:with-param name="last-value" select="'H'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($tmpHexGreenValue) = 1">
|
||||
<xsl:value-of select="concat('0',$tmpHexGreenValue)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$tmpHexGreenValue"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="hexBlueValue">
|
||||
<xsl:variable name="tmpHexBlueValue">
|
||||
<xsl:call-template name="decimal2hex">
|
||||
<xsl:with-param name="dec-number" select="$decBlueValue"/>
|
||||
<xsl:with-param name="last-value" select="'H'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($tmpHexBlueValue) = 1">
|
||||
<xsl:value-of select="concat('0',$tmpHexBlueValue)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$tmpHexBlueValue"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="concat('#',$hexRedValue,$hexGreenValue,$hexBlueValue)"/>
|
||||
</xsl:template>
|
||||
<xsl:template name="decimal2hex">
|
||||
<!-- transforms a decimal number to a hex number,only for two-bit hex(less than 256 in decimal) currently -->
|
||||
<xsl:param name="dec-number"/>
|
||||
<xsl:param name="last-value"/>
|
||||
<xsl:variable name="current-value">
|
||||
<xsl:call-template name="decNumber2hex">
|
||||
<xsl:with-param name="dec-value">
|
||||
<xsl:if test="$dec-number > 15">
|
||||
<xsl:value-of select="floor($dec-number div 16)"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$dec-number < 16">
|
||||
<xsl:value-of select="$dec-number"/>
|
||||
</xsl:if>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$dec-number > 15">
|
||||
<xsl:call-template name="decimal2hex">
|
||||
<xsl:with-param name="dec-number" select="$dec-number mod 16"/>
|
||||
<xsl:with-param name="last-value" select="concat($last-value,$current-value)"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<xsl:if test="$dec-number < 16">
|
||||
<xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="decNumber2hex">
|
||||
<!-- return a hex number for a decimal character -->
|
||||
<xsl:param name="dec-value"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dec-value = 10">
|
||||
<xsl:value-of select="'A'"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$dec-value = 11">
|
||||
<xsl:value-of select="'B'"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$dec-value = 12">
|
||||
<xsl:value-of select="'C'"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$dec-value = 13">
|
||||
<xsl:value-of select="'D'"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$dec-value = 14">
|
||||
<xsl:value-of select="'E'"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$dec-value = 15">
|
||||
<xsl:value-of select="'F'"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$dec-value"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template name="GetTabColorIndex">
|
||||
<xsl:param name="SheetColor"/>
|
||||
<xsl:for-each select="key('config', 'TabColor')[not(.=preceding::config:config-item)]">
|
||||
<xsl:sort select="." />
|
||||
<xsl:variable name="tmpColor" select="."/>
|
||||
<xsl:if test=". = $SheetColor" >
|
||||
<xsl:value-of select="56 - position()"/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<xsl:template match="office:body">
|
||||
<!-- office:body table:table children are spreadsheets -->
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="office:spreadsheet">
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
|
||||
<!-- office:body table:table children are spreadsheets -->
|
||||
<xsl:template match="office:spreadsheet/table:table">
|
||||
<xsl:element name="ss:Worksheet">
|
||||
<xsl:variable name="TableName">
|
||||
<xsl:value-of select="@table:name" />
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="ss:Name">
|
||||
<xsl:value-of select="$TableName" />
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="table:table" />
|
||||
<xsl:element name="x:WorksheetOptions">
|
||||
<xsl:if test="key('config', 'ShowGrid') = 'false'">
|
||||
<xsl:element name="x:DoNotDisplayGridlines" />
|
||||
</xsl:if>
|
||||
<xsl:if test="key('config', 'HasColumnRowHeaders') = 'false'">
|
||||
<xsl:element name="x:DoNotDisplayHeadings" />
|
||||
</xsl:if>
|
||||
<xsl:if test="key('config', 'IsOutlineSymbolsSet') = 'false'">
|
||||
<xsl:element name="x:DoNotDisplayOutline" />
|
||||
</xsl:if>
|
||||
<xsl:if test="key('config', 'ShowZeroValues') = 'false'">
|
||||
<xsl:element name="x:DoNotDisplayZeros" />
|
||||
</xsl:if>
|
||||
<xsl:if test="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry[@config:name=$TableName]/config:config-item[@config:name='TabColor']">
|
||||
<xsl:element name="x:TabColorIndex">
|
||||
<xsl:variable name="TabColorIndex">
|
||||
<xsl:call-template name="GetTabColorIndex">
|
||||
<xsl:with-param name="SheetColor" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry[@config:name=$TableName]/config:config-item[@config:name='TabColor']"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="$TabColorIndex"/>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table:decls" mode="ExcelWorkbook">
|
||||
<xsl:apply-templates mode="ExcelWorkbook" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table:calculation-settings" mode="ExcelWorkbook">
|
||||
<xsl:if test="table:precision-as-shown">
|
||||
<x:PrecisionAsDisplayed/>
|
||||
</xsl:if>
|
||||
<xsl:if test="table:null-date/@office:date-value='1904-01-01'">
|
||||
<x:Date1904/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="table:iteration" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table:iteration" mode="ExcelWorkbook">
|
||||
<xsl:element name="x:ExcelWorkbook">
|
||||
<xsl:if test="@table:status = 'enable'">
|
||||
<x:Iteration/>
|
||||
</xsl:if>
|
||||
<xsl:if test="@table:steps">
|
||||
<xsl:element name="x:MaxIterations">
|
||||
<xsl:value-of select="@table:steps" />
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="@table:maximum-difference">
|
||||
<xsl:element name="x:MaxChange">
|
||||
<xsl:value-of select="@table:maximum-difference" />
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,381 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xt="http://www.jclark.com/xt"
|
||||
xmlns:common="http://exslt.org/common"
|
||||
xmlns:xalan="http://xml.apache.org/xalan"
|
||||
xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
|
||||
|
||||
<xsl:variable name="namespace-html" select="'http://www.w3.org/TR/REC-html40'" />
|
||||
|
||||
<xsl:template match="@table:style-name | @table:default-cell-style-name">
|
||||
<xsl:if test="not(name() = 'Default')">
|
||||
<xsl:attribute name="ss:StyleID">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:key match="table:table-cell" name="getCellByStyle" use="@table:style-name"/>
|
||||
<xsl:template match="@table:style-name" mode="table-row">
|
||||
<!-- only row styles used by cells are exported,
|
||||
as usual row style properties are already written as row attributes -->
|
||||
<xsl:if test="key('getCellByStyle', '.')">
|
||||
<xsl:attribute name="ss:StyleID">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="style-and-contents">
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<!-- WorkAround of Excel2003 issue:
|
||||
Styles from the CellStyle will not be inherited to HTML content (e.g. Colour style).
|
||||
-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="@text:style-name">
|
||||
<xsl:variable name="styles">
|
||||
<xsl:copy-of select="key('styles', @text:style-name)/*" />
|
||||
<xsl:copy-of select="key('styles', $cellStyleName)/*" />
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="function-available('xalan:nodeset')">
|
||||
<xsl:call-template name="create-nested-format-tags">
|
||||
<xsl:with-param name="styles" select="xalan:nodeset($styles)" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('xt:node-set')">
|
||||
<xsl:call-template name="create-nested-format-tags">
|
||||
<xsl:with-param name="styles" select="xt:node-set($styles)" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('common:node-set')">
|
||||
<xsl:call-template name="create-nested-format-tags">
|
||||
<xsl:with-param name="styles" select="common:node-set($styles)" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="@table:style-name">
|
||||
<xsl:variable name="styles">
|
||||
<xsl:copy-of select="key('styles', @text:style-name)/*" />
|
||||
<xsl:copy-of select="key('styles', $cellStyleName)/*" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="function-available('xalan:nodeset')">
|
||||
<xsl:call-template name="create-nested-format-tags">
|
||||
<xsl:with-param name="styles" select="xalan:nodeset($styles)" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('xt:node-set')">
|
||||
<xsl:call-template name="create-nested-format-tags">
|
||||
<xsl:with-param name="styles" select="xt:node-set($styles)" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="function-available('common:node-set')">
|
||||
<xsl:call-template name="create-nested-format-tags">
|
||||
<xsl:with-param name="styles" select="common:node-set($styles)" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- *********************************** -->
|
||||
<!-- *** creating nested format tags *** -->
|
||||
<!-- *********************************** -->
|
||||
|
||||
<!-- Bold -->
|
||||
<xsl:template name="create-nested-format-tags">
|
||||
<xsl:param name="styles" />
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@fo:font-weight = 'bold' or $styles/*/@fo:font-weight = 'bolder'">
|
||||
<xsl:element namespace="{$namespace-html}" name="B">
|
||||
<xsl:call-template name="italic">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="italic">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Italic -->
|
||||
<xsl:template name="italic">
|
||||
<xsl:param name="styles" />
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@fo:font-style = 'italic' or $styles/*/@fo:font-style = 'oblique'">
|
||||
<xsl:element namespace="{$namespace-html}" name="I">
|
||||
<xsl:call-template name="underline">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="underline">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Underline -->
|
||||
<xsl:template name="underline">
|
||||
<xsl:param name="styles" />
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@style:text-underline-type and not($styles/*/@style:text-underline-type = 'none')">
|
||||
<xsl:element namespace="{$namespace-html}" name="U">
|
||||
<xsl:call-template name="strikethrough">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="strikethrough">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- strikethrough -->
|
||||
<xsl:template name="strikethrough">
|
||||
<xsl:param name="styles" />
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@style:text-line-through-style and not($styles/*/@style:text-line-through-style = 'none')">
|
||||
<xsl:element namespace="{$namespace-html}" name="S">
|
||||
<xsl:call-template name="super-subscript">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="super-subscript">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- superscript & subscript -->
|
||||
<xsl:template name="super-subscript">
|
||||
<xsl:param name="styles" />
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@style:text-position">
|
||||
<xsl:variable name="textPosition" select="number(substring-before($styles/*/@style:text-position, '% '))" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$textPosition > 0">
|
||||
<xsl:element namespace="{$namespace-html}" name="Sup">
|
||||
<xsl:call-template name="align">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:when test="$textPosition < 0">
|
||||
<xsl:element namespace="{$namespace-html}" name="Sub">
|
||||
<xsl:call-template name="align">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="align">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="align">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Alignment - normally called by strikethrough, but no DIV elements in HTML -->
|
||||
<xsl:template name="align">
|
||||
<xsl:param name="styles" />
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@fo:font-align">
|
||||
<xsl:element namespace="{$namespace-html}" name="DIV">
|
||||
<xsl:attribute name="html:style">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@fo:font-align = 'start'">
|
||||
<xsl:text>text-align:left;</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$styles/*/@fo:font-align = 'end'">
|
||||
<xsl:text>text-align:right;</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>text-align:center;</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="font">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="font">
|
||||
<xsl:with-param name="styles" select="$styles" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Font (size and color) -->
|
||||
<xsl:template name="font">
|
||||
<xsl:param name="styles" />
|
||||
<xsl:param name="cellStyleName" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$styles/*/@style:font-name or
|
||||
$styles/*/@fo:font-size or
|
||||
$styles/*/@fo:color">
|
||||
<xsl:element namespace="{$namespace-html}" name="Font">
|
||||
<xsl:if test="$styles/*/@style:font-name">
|
||||
<xsl:attribute name="html:Face">
|
||||
<xsl:value-of select="$styles/*/@style:font-name" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="$styles/*/@fo:color">
|
||||
<xsl:attribute name="html:Color">
|
||||
<xsl:value-of select="$styles/*/@fo:color" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="$styles/*/@fo:font-size">
|
||||
<!-- WORKAROUND TO EXCEL2003 issue where nested FONT elements with size attributes result in unloadable documents -->
|
||||
<!-- Only create size attribute if parent do not have already one -->
|
||||
|
||||
<!--<xsl:choose>
|
||||
<xsl:when test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)"> -->
|
||||
<xsl:if test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)">
|
||||
<xsl:attribute name="html:Size">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="$styles/*/@fo:font-size" />
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<!--</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>Due Excel issue we have to neglect size from @text:style-name '<xsl:value-of select="@text:style-name"/>'!</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>-->
|
||||
</xsl:if>
|
||||
<!-- get the embedded content -->
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- get the embedded content -->
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="cellStyleName" select="$cellStyleName" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
686
server/libreoffice/share/xslt/export/spreadsheetml/styles.xsl
Normal file
686
server/libreoffice/share/xslt/export/spreadsheetml/styles.xsl
Normal file
File diff suppressed because it is too large
Load Diff
928
server/libreoffice/share/xslt/export/spreadsheetml/table.xsl
Normal file
928
server/libreoffice/share/xslt/export/spreadsheetml/table.xsl
Normal file
File diff suppressed because it is too large
Load Diff
3392
server/libreoffice/share/xslt/export/uof/odf2uof_presentation.xsl
Normal file
3392
server/libreoffice/share/xslt/export/uof/odf2uof_presentation.xsl
Normal file
File diff suppressed because one or more lines are too long
6210
server/libreoffice/share/xslt/export/uof/odf2uof_spreadsheet.xsl
Normal file
6210
server/libreoffice/share/xslt/export/uof/odf2uof_spreadsheet.xsl
Normal file
File diff suppressed because it is too large
Load Diff
4456
server/libreoffice/share/xslt/export/uof/odf2uof_text.xsl
Normal file
4456
server/libreoffice/share/xslt/export/uof/odf2uof_text.xsl
Normal file
File diff suppressed because it is too large
Load Diff
209
server/libreoffice/share/xslt/export/wordml/ooo2wordml.xsl
Normal file
209
server/libreoffice/share/xslt/export/wordml/ooo2wordml.xsl
Normal file
@@ -0,0 +1,209 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="yes"/>
|
||||
<xsl:include href="../../common/measure_conversion.xsl"/>
|
||||
<xsl:include href="../common/ooo2ms_docpr.xsl"/>
|
||||
<xsl:include href="ooo2wordml_settings.xsl"/>
|
||||
<xsl:include href="ooo2wordml_border.xsl"/>
|
||||
<xsl:include href="ooo2wordml_page.xsl"/>
|
||||
<xsl:include href="ooo2wordml_text.xsl"/>
|
||||
<xsl:include href="ooo2wordml_list.xsl"/>
|
||||
<xsl:include href="ooo2wordml_field.xsl"/>
|
||||
<xsl:include href="ooo2wordml_table.xsl"/>
|
||||
<xsl:include href="ooo2wordml_draw.xsl"/>
|
||||
<xsl:include href="ooo2wordml_path.xsl"/>
|
||||
<xsl:key name="paragraph-style" match="style:style[@style:family='paragraph']" use="@style:name"/>
|
||||
<xsl:key name="text-style" match="style:style[@style:family='text']" use="@style:name"/>
|
||||
<xsl:key name="section-style" match="style:style[@style:family='section']" use="@style:name"/>
|
||||
<xsl:key name="master-page" match="style:master-page" use="@style:name"/>
|
||||
<xsl:key name="page-layout" match="style:page-layout" use="@style:name"/>
|
||||
<xsl:key name="slave-style" match="style:style[string-length(normalize-space(@style:master-page-name)) > 0]" use="@style:name"/>
|
||||
<xsl:key name="list-style" match="office:styles/text:list-style | office:automatic-styles/text:list-style" use="@style:name"/>
|
||||
<xsl:key name="graphics-style" match="style:style[@style:family='graphic']" use="@style:name"/>
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="office:document"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="office:document">
|
||||
<xsl:processing-instruction name="mso-application">progid="Word.Document"</xsl:processing-instruction>
|
||||
<xsl:variable name="embeddedObjPresent">
|
||||
<xsl:choose>
|
||||
<xsl:when test="//draw:object-ole[1]">yes</xsl:when>
|
||||
<xsl:otherwise>no</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<w:wordDocument xml:space="preserve" w:embeddedObjPresent="{$embeddedObjPresent}">
|
||||
<xsl:apply-templates select="office:meta"/>
|
||||
<xsl:apply-templates select="office:font-face-decls"/>
|
||||
<xsl:if test="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
|
||||
<xsl:call-template name="ListStyles"/>
|
||||
</xsl:if>
|
||||
<w:styles>
|
||||
<xsl:apply-templates select="office:styles"/>
|
||||
<xsl:apply-templates select="office:automatic-styles"/>
|
||||
<xsl:call-template name="add_hyperlink_style"/>
|
||||
<!--add for hyperlink character style G.Y.-->
|
||||
<xsl:call-template name="add_comments_style"/>
|
||||
<!--add for comments style G.Y.-->
|
||||
</w:styles>
|
||||
<xsl:call-template name="export-oledata"/>
|
||||
<xsl:apply-templates select="office:settings"/>
|
||||
<xsl:apply-templates select="office:body"/>
|
||||
</w:wordDocument>
|
||||
</xsl:template>
|
||||
<xsl:template match="office:body">
|
||||
<xsl:call-template name="page-background"/>
|
||||
<xsl:apply-templates select="office:text"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="office:font-face-decls">
|
||||
<!-- get default font from default paragraph properties -->
|
||||
<w:fonts>
|
||||
<xsl:variable name="default-paragraph-properties" select="/office:document/office:styles/style:default-style[@style:family = 'paragraph']/style:paragraph-properties"/>
|
||||
<w:defaultFonts w:ascii="{$default-paragraph-properties/@style:font-name}" w:h-ansi="{$default-paragraph-properties/@style:font-name}" w:fareast="{$default-paragraph-properties/@style:font-name-asian}" w:cs="{$default-paragraph-properties/@style:font-name-complex}"/>
|
||||
<xsl:for-each select="style:font-face">
|
||||
<w:font w:name="{@style:name}">
|
||||
<xsl:if test="@style:font-charset = 'x-symbol'">
|
||||
<w:charset w:val="02"/>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@style:font-family-generic = 'swiss'">
|
||||
<w:family w:val="Swiss"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:font-family-generic = 'modern'">
|
||||
<w:family w:val="Modern"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:font-family-generic = 'roman'">
|
||||
<w:family w:val="Roman"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:font-family-generic = 'script'">
|
||||
<w:family w:val="Script"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:font-family-generic = 'decorative'">
|
||||
<w:family w:val="Decorative"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:font-family-generic = 'system'">
|
||||
<w:family w:val="System"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:family w:val="System"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<w:pitch w:val="{@style:font-pitch}"/>
|
||||
</w:font>
|
||||
</xsl:for-each>
|
||||
</w:fonts>
|
||||
</xsl:template>
|
||||
<xsl:template match="office:styles | office:automatic-styles">
|
||||
<xsl:for-each select="*[(name()='style:style' or name()='style:default-style') and (@style:family= 'paragraph' or @style:family= 'text' or @style:family='table')]">
|
||||
<xsl:variable name="style-name">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name() = 'style:default-style'">
|
||||
<xsl:value-of select="concat('default-', @style:family, '-style')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@style:name"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<w:style w:styleId="{$style-name}">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@style:family = 'paragraph'">
|
||||
<xsl:attribute name="w:type">paragraph</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:family = 'text'">
|
||||
<xsl:attribute name="w:type">character</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:family = 'table'">
|
||||
<xsl:attribute name="w:type">table</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:if test="name() = 'style:default-style'">
|
||||
<xsl:attribute name="w:default">on</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@style:parent-style-name">
|
||||
<w:basedOn w:val="{@style:parent-style-name}"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="name() = 'style:style' and @style:family= 'paragraph'">
|
||||
<w:basedOn w:val="{concat('default-', @style:family, '-style')}"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<w:name w:val="{$style-name}"/>
|
||||
<xsl:if test="parent::office:automatic-styles">
|
||||
<w:hidden w:val="on"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="@style:next-style-name">
|
||||
<w:next w:val="{@style:next-style-name}"/>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@style:family = 'paragraph'">
|
||||
<xsl:apply-templates select="style:paragraph-properties" mode="paragraph"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:family = 'table'">
|
||||
<w:tblPr>
|
||||
<xsl:apply-templates select="style:table-properties" mode="table"/>
|
||||
</w:tblPr>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:apply-templates select="style:text-properties" mode="character"/>
|
||||
</w:style>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<xsl:template match="office:text">
|
||||
<w:body>
|
||||
<xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list |table:table"/>
|
||||
<xsl:variable name="paragraph-heading-table" select=".//*[name() = 'text:p' or name() = 'text:h' or name() = 'table:table']"/>
|
||||
<xsl:variable name="page" select="$paragraph-heading-table[key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/>
|
||||
<w:sectPr>
|
||||
<!--w:type w:val="continuous"/ -->
|
||||
<xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration">
|
||||
<xsl:with-param name="within-section" select="'yes'"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration">
|
||||
<xsl:with-param name="within-section" select="'yes'"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count($page) > 0">
|
||||
<xsl:apply-templates select="key('master-page', key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/@style:master-page-name)"/>
|
||||
<xsl:if test="key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number">
|
||||
<!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page -->
|
||||
<xsl:variable name="pagenumber_start">
|
||||
<xsl:value-of select=" key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test=" number($pagenumber_start) > 0 ">
|
||||
<w:pgNumType w:start="{$pagenumber_start}"/>
|
||||
</xsl:if>
|
||||
<!-- comment out the below line to enable the header and footer display normally when style:page-number =0 -->
|
||||
<!-- w:pgNumType w:start="{key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/-->
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="$paragraph-heading-table[last()]/ancestor::text:section">
|
||||
<xsl:apply-templates select="key('section-style',$paragraph-heading-table[last()]/ancestor::text:section[1]/@text:style-name)" mode="section"/>
|
||||
</xsl:if>
|
||||
</w:sectPr>
|
||||
</w:body>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:section">
|
||||
<xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list | table:table"/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<!-- multiple usage: get size, type, color of table-cell, paragraph, and page borders. -->
|
||||
<xsl:template name="get-border-size">
|
||||
<xsl:param name="border"/>
|
||||
<xsl:param name="border-line-width"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$border = 'none' or $border = 'hidden'">
|
||||
<xsl:text>none;0</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="border-value">
|
||||
<xsl:call-template name="convert2cm">
|
||||
<xsl:with-param name="value" select="$border"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="border-style">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($border,'solid')">solid</xsl:when>
|
||||
<xsl:when test="contains($border,'double')">double</xsl:when>
|
||||
<xsl:otherwise>none</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<!-- MS word and SO writer borders Mapping
|
||||
MS word Borders SO borders
|
||||
w:val="single" w:sz="0" 0.05pt(0.002cm);solid
|
||||
w:val="single" w:sz="12" 1.00pt(0.035cm);solid
|
||||
w:val="single" w:sz="18" 2.50pt(0.088cm);solid
|
||||
w:val="single" w:sz="36" 4.00pt(0.141cm);solid
|
||||
w:val="single" w:sz="48" 5.00pt(0.176cm);solid
|
||||
w:val="double" w:sz="2" 1.10pt(0.039cm);double
|
||||
w:val="double" w:sz="6" 2.60pt(0.092cm);double
|
||||
w:val="thin-thick-small-gap" w:sz="12" 3.00pt(0.105cm);double
|
||||
w:val="thin-thick-large-gap" w:sz="18" 3.55pt(0.125cm);double
|
||||
w:val="thick-thin-medium-gap" w:sz="24" 4.50pt(0.158cm);double
|
||||
w:val="thin-thick-medium-gap" w:sz="24" 5.05pt(0.178cm);double
|
||||
w:val="thin-thick-small-gap" w:sz="24" 6.00pt(0.211cm);double
|
||||
w:val="thin-thick-medium-gap" w:sz="36" 6.55pt(0.231cm);double
|
||||
w:val="double" w:sz="18" 7.50pt(0.264cm);double
|
||||
w:val="thin-thick-medium-gap" w:sz="48" 9.00pt(0.317cm);double;style:border-line-width="0.088cm 0.088cm 0.141cm"
|
||||
w:val="double" w:sz="24" 9.00pt(0.317cm);double;style:border-line-width="0.141cm 0.088cm 0.088cm"
|
||||
we adjust the criteria by adding about 1/2 range of this current criteria and next criteria. Gary. Yang -->
|
||||
<xsl:variable name="microsoft-border-style-size">
|
||||
<xsl:choose>
|
||||
<xsl:when test=" $border-style = 'solid'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$border-value <= 0.018">single;0</xsl:when>
|
||||
<xsl:when test="$border-value <= 0.055">single;12</xsl:when>
|
||||
<xsl:when test="$border-value <= 0.110">single;18</xsl:when>
|
||||
<xsl:when test="$border-value <= 0.155">single;36</xsl:when>
|
||||
<xsl:when test="$border-value <= 0.198">single;48</xsl:when>
|
||||
<xsl:otherwise>single;48</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="$border-style = 'double'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$border-value < 0.064">double;2</xsl:when>
|
||||
<xsl:when test="$border-value < 0.098">double;6</xsl:when>
|
||||
<xsl:when test="$border-value < 0.115">thin-thick-small-gap;12</xsl:when>
|
||||
<xsl:when test="$border-value < 0.135">thin-thick-large-gap;18</xsl:when>
|
||||
<xsl:when test="$border-value < 0.168">thick-thin-medium-gap;24</xsl:when>
|
||||
<xsl:when test="$border-value < 0.190">thin-thick-medium-gap;24</xsl:when>
|
||||
<xsl:when test="$border-value < 0.221">thin-thick-small-gap;24</xsl:when>
|
||||
<xsl:when test="$border-value < 0.241">thin-thick-medium-gap;36</xsl:when>
|
||||
<xsl:when test="$border-value < 0.300">double;18</xsl:when>
|
||||
<xsl:when test="$border-value < 0.430">
|
||||
<xsl:variable name="border-inner-line-value">
|
||||
<xsl:call-template name="convert2cm">
|
||||
<xsl:with-param name="value" select="$border-line-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$border-inner-line-value < 0.10">thin-thick-medium-gap;48</xsl:if>
|
||||
<xsl:if test="$border-inner-line-value > 0.10">double;24</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>double;24</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>none;0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="$microsoft-border-style-size"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- get bottom and right border style, size, color -->
|
||||
<xsl:template name="get-border">
|
||||
<xsl:param name="so-border"/>
|
||||
<xsl:param name="so-border-line-width"/>
|
||||
<xsl:param name="so-border-position"/>
|
||||
<xsl:variable name="ms-style-width">
|
||||
<xsl:call-template name="get-border-size">
|
||||
<xsl:with-param name="border" select="$so-border"/>
|
||||
<xsl:with-param name="border-line-width" select="$so-border-line-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$so-border-position = 'bottom' or $so-border-position = 'right'">
|
||||
<!-- if border style is bottom or right border we need to change the thin-thick to thick-thin; Vice Versa -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="substring-before($ms-style-width, '-')='thin'">
|
||||
<xsl:attribute name="w:val"><xsl:value-of select="concat( 'thick-thin', substring-after(substring-before($ms-style-width, ';'), 'k' ))"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="substring-before($ms-style-width, '-')='thick'">
|
||||
<xsl:attribute name="w:val"><xsl:value-of select="concat( 'thin-thick', substring-after(substring-before($ms-style-width, ';'), 'n' ))"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width, ';')"/></xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$so-border-position = 'top' or $so-border-position = 'left'">
|
||||
<xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width,';')"/></xsl:attribute>
|
||||
<xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<!--get border color -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($so-border,'#')">
|
||||
<xsl:attribute name="w:color"><xsl:value-of select="substring-after($so-border, '#')"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="w:color">auto</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,275 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<xsl:template name="ooo_custom_draw2ms_word_draw_map">
|
||||
<xsl:param name="ooo_predefined_type"/>
|
||||
<!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$ooo_predefined_type = 'isosceles-triangle' ">
|
||||
<xsl:value-of select=" '#_x0000_t5' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'right-triangle' ">
|
||||
<xsl:value-of select=" '#_x0000_t6' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'trapezoid' ">
|
||||
<xsl:value-of select=" '#_x0000_t8' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'diamond' ">
|
||||
<xsl:value-of select=" '#_x0000_t4' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'hexagon' ">
|
||||
<xsl:value-of select=" '#_x0000_t9' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'parallelogram' ">
|
||||
<xsl:value-of select=" '#_x0000_t7' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'pentagon' ">
|
||||
<xsl:value-of select=" '#_x0000_t56' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'octagon' ">
|
||||
<xsl:value-of select=" '#_x0000_t10' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'cross' ">
|
||||
<xsl:value-of select=" '#_x0000_t11' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'ring' ">
|
||||
<xsl:value-of select=" '#_x0000_t23' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'block-arc' ">
|
||||
<xsl:value-of select=" '#_x0000_t95' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'can' ">
|
||||
<xsl:value-of select=" '#_x0000_t22' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'cube' ">
|
||||
<xsl:value-of select=" '#_x0000_t16' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'paper' ">
|
||||
<xsl:value-of select=" '#_x0000_t65' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'smiley' ">
|
||||
<xsl:value-of select=" '#_x0000_t96' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'sun' ">
|
||||
<xsl:value-of select=" '#_x0000_t183' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'moon' ">
|
||||
<xsl:value-of select=" '#_x0000_t184' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'heart' ">
|
||||
<xsl:value-of select=" '#_x0000_t74' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'forbidden' ">
|
||||
<xsl:value-of select=" '#_x0000_t57' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'left-bracket' ">
|
||||
<xsl:value-of select=" '#_x0000_t85' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'right-bracket' ">
|
||||
<xsl:value-of select=" '#_x0000_t86' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'left-brace' ">
|
||||
<xsl:value-of select=" '#_x0000_t87' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'right-brace' ">
|
||||
<xsl:value-of select=" '#_x0000_t88' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'bracket-pair' ">
|
||||
<xsl:value-of select=" '#_x0000_t185' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'brace-pair' ">
|
||||
<xsl:value-of select=" '#_x0000_t186' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'quad-bevel' ">
|
||||
<xsl:value-of select=" '#_x0000_t189' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'left-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t66' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'down-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t67' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'up-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t68' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'right-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t13' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'left-right-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t69' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'up-down-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t70' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'mso-spt89' ">
|
||||
<xsl:value-of select=" '#_x0000_t89' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'quad-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t76' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'notched-right-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t94' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'pentagon-right' ">
|
||||
<xsl:value-of select=" '#_x0000_t177' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'chevron' ">
|
||||
<xsl:value-of select=" '#_x0000_t55' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'up-arrow-callout' ">
|
||||
<xsl:value-of select=" '#_x0000_t79' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'down-arrow-callout' ">
|
||||
<xsl:value-of select=" '#_x0000_t80' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'up-down-arrow-callout' ">
|
||||
<xsl:value-of select=" '#_x0000_t82' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'circular-arrow' ">
|
||||
<xsl:value-of select=" '#_x0000_t103' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-process' ">
|
||||
<xsl:value-of select=" '#_x0000_t109' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-alternate-process' ">
|
||||
<xsl:value-of select=" '#_x0000_t116' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-decision' ">
|
||||
<xsl:value-of select=" '#_x0000_t110' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-data' ">
|
||||
<xsl:value-of select=" '#_x0000_t111' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-predefined-process' ">
|
||||
<xsl:value-of select=" '#_x0000_t112' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-internal-storage' ">
|
||||
<xsl:value-of select=" '#_x0000_t113' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-document' ">
|
||||
<xsl:value-of select=" '#_x0000_t114' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-multidocument' ">
|
||||
<xsl:value-of select=" '#_x0000_t115' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-terminator' ">
|
||||
<xsl:value-of select=" '#_x0000_t116' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-preparation' ">
|
||||
<xsl:value-of select=" '#_x0000_t117' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-manual-input' ">
|
||||
<xsl:value-of select=" '#_x0000_t118' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-manual-operation' ">
|
||||
<xsl:value-of select=" '#_x0000_t119' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-connector' ">
|
||||
<xsl:value-of select=" '#_x0000_t120' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-off-page-connector' ">
|
||||
<xsl:value-of select=" '#_x0000_t177' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-card' ">
|
||||
<xsl:value-of select=" '#_x0000_t121' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-punched-tape' ">
|
||||
<xsl:value-of select=" '#_x0000_t122' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-summing-junction' ">
|
||||
<xsl:value-of select=" '#_x0000_t123' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-or' ">
|
||||
<xsl:value-of select=" '#_x0000_t124' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-collate' ">
|
||||
<xsl:value-of select=" '#_x0000_t125' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-sort' ">
|
||||
<xsl:value-of select=" '#_x0000_t126' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-extract' ">
|
||||
<xsl:value-of select=" '#_x0000_t127' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-merge' ">
|
||||
<xsl:value-of select=" '#_x0000_t128' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-stored-data' ">
|
||||
<xsl:value-of select=" '#_x0000_t130' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-delay' ">
|
||||
<xsl:value-of select=" '#_x0000_t135' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-sequential-access' ">
|
||||
<xsl:value-of select=" '#_x0000_t131' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-magnetic-disk' ">
|
||||
<xsl:value-of select=" '#_x0000_t132' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-direct-access-storage' ">
|
||||
<xsl:value-of select=" '#_x0000_t133' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'flowchart-display' ">
|
||||
<xsl:value-of select=" '#_x0000_t134' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'rectangular-callout' ">
|
||||
<xsl:value-of select=" '#_x0000_t61' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'round-rectangular-callout' ">
|
||||
<xsl:value-of select=" '#_x0000_t62' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'round-callout' ">
|
||||
<xsl:value-of select=" '#_x0000_t63' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'cloud-callout' ">
|
||||
<xsl:value-of select=" '#_x0000_t106' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'line-callout-1' ">
|
||||
<xsl:value-of select=" '#_x0000_t50' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'line-callout-2' ">
|
||||
<xsl:value-of select=" '#_x0000_t51' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'line-callout-3' ">
|
||||
<xsl:value-of select=" '#_x0000_t47' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'bang' ">
|
||||
<xsl:value-of select=" '#_x0000_t72' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'star4' ">
|
||||
<xsl:value-of select=" '#_x0000_t187' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'star5' ">
|
||||
<xsl:value-of select=" '#_x0000_t12' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'star8' ">
|
||||
<xsl:value-of select=" '#_x0000_t58' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'star24' ">
|
||||
<xsl:value-of select=" '#_x0000_t92' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'vertical-scroll' ">
|
||||
<xsl:value-of select=" '#_x0000_t97' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ooo_predefined_type = 'horizontal-scroll' ">
|
||||
<xsl:value-of select=" '#_x0000_t98' "/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
1760
server/libreoffice/share/xslt/export/wordml/ooo2wordml_draw.xsl
Normal file
1760
server/libreoffice/share/xslt/export/wordml/ooo2wordml_draw.xsl
Normal file
File diff suppressed because it is too large
Load Diff
726
server/libreoffice/share/xslt/export/wordml/ooo2wordml_field.xsl
Normal file
726
server/libreoffice/share/xslt/export/wordml/ooo2wordml_field.xsl
Normal file
File diff suppressed because it is too large
Load Diff
347
server/libreoffice/share/xslt/export/wordml/ooo2wordml_list.xsl
Normal file
347
server/libreoffice/share/xslt/export/wordml/ooo2wordml_list.xsl
Normal file
@@ -0,0 +1,347 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<xsl:template name="ListStyles">
|
||||
<w:lists>
|
||||
<xsl:if test="descendant::text:list-level-style-image">
|
||||
<xsl:call-template name="PicLists"/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style" mode="style"/>
|
||||
<xsl:for-each select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
|
||||
<w:list w:ilfo="{position()}">
|
||||
<w:ilst w:val="{position()-1}"/>
|
||||
</w:list>
|
||||
</xsl:for-each>
|
||||
</w:lists>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:list-style | text:outline-style" mode="style">
|
||||
<w:listDef w:listDefId="{position()-1}">
|
||||
<xsl:if test="name(..)='office:styles' and name()!='text:outline-style'">
|
||||
<w:styleLink w:val="{@style:name}"/>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="text:list-level-style-number | text:list-level-style-bullet | text:list-level-style-image | text:outline-level-style">
|
||||
<xsl:if test="@text:level < 10">
|
||||
<w:lvl w:ilvl="{ @text:level - 1 }">
|
||||
<xsl:if test="name()='text:outline-level-style'">
|
||||
<xsl:variable name="headinglevel">
|
||||
<xsl:value-of select="@text:level"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="/office:document/office:body//text:h[@text:level=$headinglevel and @text:style-name]">
|
||||
<xsl:element name="w:pStyle">
|
||||
<xsl:attribute name="w:val"><xsl:value-of select="/office:document/office:body//text:h[@text:level=$headinglevel]/@text:style-name"/></xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@text:start-value">
|
||||
<w:start w:val="{@text:start-value}"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:start w:val="1"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@text:bullet-char">
|
||||
<w:nfc w:val="23"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:num-format">
|
||||
<xsl:call-template name="convert_list_number">
|
||||
<xsl:with-param name="number-format" select="@style:num-format"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='text:list-level-style-image'">
|
||||
<w:lvlText w:val="."/>
|
||||
<w:lvlPicBulletId>
|
||||
<xsl:attribute name="w:val"><xsl:value-of select="count(preceding::text:list-level-style-image)"/></xsl:attribute>
|
||||
</w:lvlPicBulletId>
|
||||
</xsl:when>
|
||||
<xsl:when test="@text:bullet-char">
|
||||
<w:lvlText w:val="{@text:bullet-char}"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@text:display-levels and not(../@text:consecutive-numbering='true')">
|
||||
<xsl:variable name="levelText">
|
||||
<xsl:call-template name="displaylevel">
|
||||
<xsl:with-param name="number" select="@text:display-levels"/>
|
||||
<xsl:with-param name="textlevel" select="@text:level"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<w:lvlText w:val="{concat(@style:num-prefix, substring-after($levelText, '.'), @style:num-suffix)}"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:lvlText w:val="{concat(@style:num-prefix, '%', @text:level, @style:num-suffix)}"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="style:list-level-properties/@fo:text-align = 'end'">
|
||||
<w:lvlJc w:val="right"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="style:list-level-properties/@fo:text-align = 'center'">
|
||||
<w:lvlJc w:val="center"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:lvlJc w:val="left"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="style:list-level-properties/@text:space-before | style:list-level-properties/@text:min-label-width | style:list-level-properties/@text:min-label-distance">
|
||||
<xsl:call-template name="list_position"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:suff w:val="Nothing"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:apply-templates select="key('text-style',@text:style-name)/style:text-properties" mode="character"/>
|
||||
<xsl:apply-templates select="style:text-properties" mode="character"/>
|
||||
</w:lvl>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</w:listDef>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:list-style" mode="count">
|
||||
<xsl:value-of select="count(preceding::text:list-style | preceding::text:outline-style)+1"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:unordered-list | text:ordered-list | text:list">
|
||||
<xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list-item | text:list-header | text:list"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:list-item | text:list-header">
|
||||
<xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list | text:p | text:h"/>
|
||||
</xsl:template>
|
||||
<xsl:template name="displaylevel">
|
||||
<xsl:param name="number"/>
|
||||
<xsl:param name="textlevel"/>
|
||||
<xsl:if test="$number > 1">
|
||||
<xsl:call-template name="displaylevel">
|
||||
<xsl:with-param name="number" select="$number -1"/>
|
||||
<xsl:with-param name="textlevel" select="number($textlevel)-1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="concat('.','%',$textlevel)"/>
|
||||
</xsl:template>
|
||||
<xsl:template name="list_position">
|
||||
<xsl:variable name="spacebefore">
|
||||
<xsl:choose>
|
||||
<xsl:when test="style:list-level-properties/@text:space-before">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:list-level-properties/@text:space-before"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="space2text">
|
||||
<xsl:choose>
|
||||
<xsl:when test="style:list-level-properties/@text:min-label-width">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:list-level-properties/@text:min-label-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="spacedistance">
|
||||
<xsl:choose>
|
||||
<xsl:when test="style:list-level-properties/@text:min-label-distance">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:list-level-properties/@text:min-label-distance"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$spacedistance='0' and $space2text='0'">
|
||||
<w:suff w:val="Nothing"/>
|
||||
</xsl:if>
|
||||
<w:pPr>
|
||||
<xsl:if test="$spacedistance!='0' or $space2text!='0'">
|
||||
<w:tabs>
|
||||
<w:tab>
|
||||
<xsl:attribute name="w:val">list</xsl:attribute>
|
||||
<xsl:attribute name="w:pos"><xsl:choose><xsl:when test="number($spacedistance) > number($space2text)"><xsl:value-of select="number($spacebefore)+number($spacedistance)+150"/></xsl:when><xsl:otherwise><xsl:value-of select="number($spacebefore)+number($space2text)+150"/></xsl:otherwise></xsl:choose></xsl:attribute>
|
||||
<!-- Since SO MinSpaceDistance is width after number or bullet, MS TabSpaceAfter include the number or bullet width. So +150 -->
|
||||
</w:tab>
|
||||
</w:tabs>
|
||||
</xsl:if>
|
||||
<w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/>
|
||||
<!-- w:pos(MS TabSpaceAfter) = text:space-before + MAX(text:min-label-distance,text:min-label-width) + ( Symbol width ); w:left(MS IndentAt)= text:space-before + text:min-label-width; w:hanging(MS IndentAt - MS AlignedAt)=text:min-label-width -->
|
||||
</w:pPr>
|
||||
</xsl:template>
|
||||
<xsl:template name="PicLists">
|
||||
<xsl:for-each select="descendant::text:list-level-style-image">
|
||||
<w:listPicBullet w:listPicBulletId="{position()-1}">
|
||||
<w:pict>
|
||||
<v:shape>
|
||||
<xsl:variable name="Picwidth">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="style:list-level-properties/@fo:width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="Picheight">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="style:list-level-properties/@fo:height"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="style"><xsl:value-of select="concat('width:', number($Picwidth*1), 'pt;height:', number($Picheight*1), 'pt')"/></xsl:attribute>
|
||||
<xsl:attribute name="o:bullet">t</xsl:attribute>
|
||||
<v:stroke joinstyle="miter"/>
|
||||
<w:binData w:name="{concat('wordml://SOpicbullet', position(), '.gif')}">
|
||||
<xsl:value-of select="office:binary-data"/>
|
||||
</w:binData>
|
||||
<v:imagedata src="{concat('wordml://SOpicbullet', position(), '.gif')}" o:title="{concat('SOpicbullet', position())}"/>
|
||||
</v:shape>
|
||||
</w:pict>
|
||||
</w:listPicBullet>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<xsl:template name="convert_list_number">
|
||||
<xsl:param name="number-format"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$number-format = 'a'">
|
||||
<!-- nfcLCLetter: Lowercase alpha -->
|
||||
<w:nfc w:val="4"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'A'">
|
||||
<!-- nfcUCLetter: Uppercase alpha -->
|
||||
<w:nfc w:val="3"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'i'">
|
||||
<!-- nfcLCRoman: Lowercase roman -->
|
||||
<w:nfc w:val="2"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'I'">
|
||||
<!-- nfcUCRoman: Uppercase roman -->
|
||||
<w:nfc w:val="1"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '1st'">
|
||||
<!-- nfcUCOrdinal: Ordinal indicator -->
|
||||
<w:nfc w:val="5"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'One'">
|
||||
<!-- nfcCardText: Cardinal -->
|
||||
<w:nfc w:val="6"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'First'">
|
||||
<!-- nfcOrdText: Ordinal -->
|
||||
<w:nfc w:val="7"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '1, 2, 3, ...'">
|
||||
<!-- '1, 2, 3, ...' also seems: decimal-full-width2 -->
|
||||
<w:nfc w:val="14"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '①, ②, ③, ...'">
|
||||
<w:nfc w:val="18"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '一, 二, 三, ...'">
|
||||
<!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
|
||||
taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
|
||||
<w:nfc w:val="10"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '壹, 贰, 叁, ...'">
|
||||
<w:nfc w:val="38"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '壹, 貳, 參, ...'">
|
||||
<w:nfc w:val="34"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '甲, 乙, 丙, ...'">
|
||||
<w:nfc w:val="30"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '子, 丑, 寅, ...'">
|
||||
<w:nfc w:val="31"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '壱, 弐, 参, ...'">
|
||||
<w:nfc w:val="16"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
|
||||
<w:nfc w:val="12"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
|
||||
<w:nfc w:val="20"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
|
||||
<w:nfc w:val="13"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
|
||||
<w:nfc w:val="21"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '일, 이, 삼, ...'">
|
||||
<!-- '일, 이, 삼, ...' also seems: korean-counting -->
|
||||
<w:nfc w:val="41"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
|
||||
<!-- mapping circled to uncircled -->
|
||||
<w:nfc w:val="25"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$number-format = "가, 나, 다, ..." or $number-format = "㉮, ㉯, ㉰, ..."'>
|
||||
<!-- mapping circled to uncircled -->
|
||||
<w:nfc w:val="24"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format ='أ, ب, ت, ...'">
|
||||
<!-- 46. arabic-alpha-->
|
||||
<w:nfc w:val="46"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ก, ข, ฃ, ...'">
|
||||
<!--53. thai-letters not match well !-->
|
||||
<w:nfc w:val="53"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format='א, י, ק, ...'">
|
||||
<!--45. hebrew-1-->
|
||||
<w:nfc w:val="45"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format='א, ב, ג, ...'">
|
||||
<!--47. hebrew-2-->
|
||||
<w:nfc w:val="47"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length($number-format)=0">
|
||||
<w:nfc w:val="255"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'Native Numbering'">
|
||||
<xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($locale, 'th-')">
|
||||
<!-- for Thai, mapping thai-numbers, thai-counting to thai-numbers -->
|
||||
<w:nfc w:val="54"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'hi-')">
|
||||
<!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
|
||||
<w:nfc w:val="51"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'ar-')">
|
||||
<!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
|
||||
<w:nfc w:val="45"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'he-')">
|
||||
<!-- for Hebrew, mapping hebrew-2 to -->
|
||||
<w:nfc w:val="46"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'ru-')">
|
||||
<!-- for Russian, mapping russian-upper to russian-lower -->
|
||||
<w:nfc w:val="58"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'vi-')">
|
||||
<!-- for Vietnamese -->
|
||||
<w:nfc w:val="56"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- unsupported: hex, chicago, bullet, ideograph-zodiac-traditional,
|
||||
chinese-not-impl, korean-legal, none -->
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
392
server/libreoffice/share/xslt/export/wordml/ooo2wordml_page.xsl
Normal file
392
server/libreoffice/share/xslt/export/wordml/ooo2wordml_page.xsl
Normal file
@@ -0,0 +1,392 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<xsl:template name="page-background">
|
||||
<xsl:choose>
|
||||
<xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) > 0]">
|
||||
<w:bgPict>
|
||||
<xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) > 0]" mode="bgPict"/>
|
||||
</w:bgPict>
|
||||
</xsl:when>
|
||||
<xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) > 0]">
|
||||
<w:bgPict>
|
||||
<xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) > 0]" mode="bgPict"/>
|
||||
</w:bgPict>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="style:background-image" mode="bgPict">
|
||||
<xsl:variable name="binName" select="concat('wordml://',generate-id(.))"/>
|
||||
<w:binData w:name="{$binName}">
|
||||
<xsl:value-of select="translate(office:binary-data/text(),'	  ','' ) "/>
|
||||
</w:binData>
|
||||
<w:background w:bgcolor="{parent::style:page-layout-properties/@fo:background-color}" w:background="{$binName}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="style:page-layout-properties" mode="bgPict">
|
||||
<w:background w:bgcolor="{@fo:background-color}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="style:master-page">
|
||||
<xsl:apply-templates select="key( 'page-layout', @style:page-layout-name)"/>
|
||||
<xsl:if test="style:header">
|
||||
<w:hdr w:type="odd">
|
||||
<xsl:apply-templates select="style:header/text:p | style:header/table:table"/>
|
||||
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
|
||||
</w:hdr>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:header-left">
|
||||
<w:hdr w:type="even">
|
||||
<xsl:apply-templates select="style:header-left/text:p | style:header-left/table:table"/>
|
||||
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
|
||||
</w:hdr>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:footer">
|
||||
<w:ftr w:type="odd">
|
||||
<xsl:apply-templates select="style:footer/text:p | style:footer/table:table"/>
|
||||
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
|
||||
</w:ftr>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:footer-left">
|
||||
<w:ftr w:type="even">
|
||||
<xsl:apply-templates select="style:footer-left/text:p | style:footer-left/table:table"/>
|
||||
<!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
|
||||
</w:ftr>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="style:page-layout">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@style:page-usage = 'left'">
|
||||
<w:type w:val="even-page"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:page-usage = 'right'">
|
||||
<w:type w:val="odd-page"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:page-usage = 'all'">
|
||||
<w:type w:val="next-page"/>
|
||||
</xsl:when>
|
||||
<!-- for mirrored, and default -->
|
||||
<xsl:otherwise>
|
||||
<w:type w:val="next-page"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:variable name="page-width">
|
||||
<xsl:if test="style:page-layout-properties/@fo:page-width">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:page-layout-properties/@fo:page-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="margin-left">
|
||||
<xsl:if test="style:page-layout-properties/@fo:margin-left">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-left"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="margin-right">
|
||||
<xsl:if test="style:page-layout-properties/@fo:margin-right">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-right"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<w:pgSz>
|
||||
<xsl:if test="style:page-layout-properties/@fo:page-width">
|
||||
<xsl:attribute name="w:w">
|
||||
<xsl:value-of select="$page-width"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:page-layout-properties/@fo:page-height">
|
||||
<xsl:attribute name="w:h">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:page-layout-properties/@fo:page-height"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:page-layout-properties/@style:print-orientation">
|
||||
<xsl:attribute name="w:orient">
|
||||
<xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</w:pgSz>
|
||||
<w:pgMar>
|
||||
<xsl:if test="style:page-layout-properties/@fo:margin-top">
|
||||
<xsl:variable name="top-margin">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-top"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="w:top">
|
||||
<xsl:value-of select="$top-margin"/>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="style:header-style/style:page-layout-properties/@fo:min-height">
|
||||
<xsl:variable name="header-height">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:header-style/style:page-layout-properties/@fo:min-height"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="w:header">
|
||||
<xsl:value-of select="$top-margin - $header-height"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:page-layout-properties/@fo:margin-bottom">
|
||||
<xsl:variable name="bottom-margin">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-bottom"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="w:bottom">
|
||||
<xsl:value-of select="$bottom-margin"/>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="style:footer-style/style:page-layout-properties/@fo:min-height">
|
||||
<xsl:variable name="footer-height">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="style:footer-style/style:page-layout-properties/@fo:min-height"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="w:footer">
|
||||
<xsl:value-of select="$bottom-margin - $footer-height"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:page-layout-properties/@fo:margin-left">
|
||||
<xsl:attribute name="w:left">
|
||||
<xsl:value-of select="$margin-left"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="w:gutter">
|
||||
<xsl:value-of select="'0'"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:page-layout-properties/@fo:margin-right">
|
||||
<xsl:attribute name="w:right">
|
||||
<xsl:value-of select="$margin-right"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</w:pgMar>
|
||||
<xsl:variable name="border-top" select="style:page-layout-properties/@fo:border-top | style:page-layout-properties/@fo:border"/>
|
||||
<xsl:variable name="border-bottom" select="style:page-layout-properties/@fo:border-bottom | style:page-layout-properties/@fo:border"/>
|
||||
<xsl:variable name="border-left" select="style:page-layout-properties/@fo:border-left | style:page-layout-properties/@fo:border"/>
|
||||
<xsl:variable name="border-right" select="style:page-layout-properties/@fo:border-right | style:page-layout-properties/@fo:border"/>
|
||||
<xsl:variable name="border-line-width-top" select="style:page-layout-properties/@style:border-line-width-top | style:page-layout-properties/@style:border-line-width "/>
|
||||
<xsl:variable name="border-line-width-bottom" select="style:page-layout-properties/@style:border-line-width-bottom | style:page-layout-properties/@style:border-line-width"/>
|
||||
<xsl:variable name="border-line-width-left" select="style:page-layout-properties/@style:border-line-width-left | style:page-layout-properties/@style:border-line-width"/>
|
||||
<xsl:variable name="border-line-width-right" select="style:page-layout-properties/@style:border-line-width-right | style:page-layout-properties/@style:border-line-width"/>
|
||||
<xsl:variable name="padding-top" select="style:page-layout-properties/@fo:padding-top | style:page-layout-properties/@fo:padding"/>
|
||||
<xsl:variable name="padding-bottom" select="style:page-layout-properties/@fo:padding-bottom | style:page-layout-properties/@fo:padding"/>
|
||||
<xsl:variable name="padding-left" select="style:page-layout-properties/@fo:padding-left | style:page-layout-properties/@fo:padding"/>
|
||||
<xsl:variable name="padding-right" select="style:page-layout-properties/@fo:padding-right | style:page-layout-properties/@fo:padding"/>
|
||||
<w:pgBorders w:offset-from="text">
|
||||
<xsl:if test="$border-top">
|
||||
<xsl:element name="w:top">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-top"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'top' "/>
|
||||
</xsl:call-template>
|
||||
<xsl:attribute name="w:space">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="$padding-top"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
|
||||
<xsl:attribute name="w:shadow">on</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="$border-bottom">
|
||||
<xsl:element name="w:bottom">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-bottom"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'bottom' "/>
|
||||
</xsl:call-template>
|
||||
<xsl:attribute name="w:space">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="$padding-bottom"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
|
||||
<xsl:attribute name="w:shadow">on</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="$border-left">
|
||||
<xsl:element name="w:left">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-left"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'left' "/>
|
||||
</xsl:call-template>
|
||||
<xsl:attribute name="w:space">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="$padding-left"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
|
||||
<xsl:attribute name="w:shadow">on</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="$border-right">
|
||||
<xsl:element name="w:right">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-right"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'right' "/>
|
||||
</xsl:call-template>
|
||||
<xsl:attribute name="w:space">
|
||||
<xsl:call-template name="convert2pt">
|
||||
<xsl:with-param name="value" select="$padding-right"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="style:page-layout-properties/@style:shadow!='none'">
|
||||
<xsl:attribute name="w:shadow">on</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</w:pgBorders>
|
||||
<xsl:variable name="valid-width">
|
||||
<xsl:value-of select="$page-width - $margin-left - $margin-right"/>
|
||||
</xsl:variable>
|
||||
<xsl:apply-templates select="style:page-layout-properties/style:columns">
|
||||
<xsl:with-param name="page-width" select="$valid-width"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates select="/office:document/office:styles/text:linenumbering-configuration"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:linenumbering-configuration">
|
||||
<xsl:if test="not(@text:number-lines = 'false')">
|
||||
<xsl:element name="w:lnNumType">
|
||||
<xsl:if test="@text:increment">
|
||||
<xsl:attribute name="w:count-by">
|
||||
<xsl:value-of select="@text:increment"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="@text:offset">
|
||||
<xsl:attribute name="w:distance">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="@text:offset"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:attribute name="w:restart">continuous</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="style:style" mode="section">
|
||||
<xsl:param name="master-page"/>
|
||||
<xsl:variable name="page-width">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:page-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="margin-left">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-left"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="margin-right">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-right"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="valid-width">
|
||||
<xsl:value-of select="$page-width - $margin-left - $margin-right"/>
|
||||
</xsl:variable>
|
||||
<w:type w:val="continuous"/>
|
||||
<xsl:apply-templates select="style:section-properties/style:columns">
|
||||
<xsl:with-param name="page-width" select="$valid-width"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
<xsl:template match="style:columns">
|
||||
<xsl:param name="page-width"/>
|
||||
<w:cols w:num="{@fo:column-count}">
|
||||
<xsl:if test="@fo:column-gap">
|
||||
<xsl:attribute name="w:space">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="@fo:column-gap"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="style:column-sep">
|
||||
<xsl:attribute name="w:sep">on</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(style:column)">
|
||||
<xsl:attribute name="w:equalWidth">on</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="w:equalWidth">off</xsl:attribute>
|
||||
<xsl:variable name="column-relative-width">
|
||||
<xsl:call-template name="get-sum-column-width">
|
||||
<xsl:with-param name="current-column" select="style:column[1]"/>
|
||||
<xsl:with-param name="current-width" select="'0'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:for-each select="style:column">
|
||||
<xsl:element name="w:col">
|
||||
<xsl:attribute name="w:w">
|
||||
<xsl:value-of select="floor(substring-before(@style:rel-width,'*') * $page-width div $column-relative-width)"/>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="@fo:margin-right">
|
||||
<xsl:variable name="margin-right">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="@fo:margin-right"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="following-sibling::style:column">
|
||||
<xsl:variable name="margin-left">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="@fo:margin-left"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="w:space">
|
||||
<xsl:value-of select="$margin-right + $margin-left"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="w:space">
|
||||
<xsl:value-of select="$margin-right"/>
|
||||
</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</w:cols>
|
||||
</xsl:template>
|
||||
<xsl:template name="get-sum-column-width">
|
||||
<xsl:param name="current-column"/>
|
||||
<xsl:param name="current-width"/>
|
||||
<xsl:variable name="new-width" select="$current-width + substring-before($current-column/@style:rel-width,'*')"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$current-column/following-sibling::style:column">
|
||||
<xsl:call-template name="get-sum-column-width">
|
||||
<xsl:with-param name="current-column" select="$current-column/following-sibling::style:column[1]"/>
|
||||
<xsl:with-param name="current-width" select="$new-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$new-width"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
849
server/libreoffice/share/xslt/export/wordml/ooo2wordml_path.xsl
Normal file
849
server/libreoffice/share/xslt/export/wordml/ooo2wordml_path.xsl
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,306 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<xsl:template match="office:settings">
|
||||
<w:docPr>
|
||||
<w:displayBackgroundShape/>
|
||||
<xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'">
|
||||
<w:view w:val="outline"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:view w:val="print"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/>
|
||||
<w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}">
|
||||
<xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$zoom-type = '3'">
|
||||
<xsl:attribute name="w:val">best-fit</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$zoom-type = '2'">
|
||||
<xsl:attribute name="w:val">full-page</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$zoom-type = '1'">
|
||||
<xsl:attribute name="w:val">text-fit</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</w:zoom>
|
||||
<w:defaultTabStop>
|
||||
<xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute>
|
||||
</w:defaultTabStop>
|
||||
<xsl:if test="../office:master-styles/style:master-page/style:header-left">
|
||||
<w:evenAndOddHeaders/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/>
|
||||
<xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/>
|
||||
<!-- add the variables declaration in w:docpr G.Y. Begin-->
|
||||
<xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls ">
|
||||
<xsl:call-template name="field_declare">
|
||||
<xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/>
|
||||
<xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/>
|
||||
<xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<!--add the variables declaration in w:docpr G.Y. End-->
|
||||
</w:docPr>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:footnotes-configuration">
|
||||
<xsl:param name="within-section"/>
|
||||
<w:footnotePr>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@text:footnotes-position = 'document'">
|
||||
<w:pos w:val="beneath-text"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:pos w:val="page-bottom"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="@text:start-value">
|
||||
<w:numStart w:val="{@text:start-value + 1}"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="@style:num-format">
|
||||
<xsl:call-template name="convert-number-format">
|
||||
<xsl:with-param name="number-format" select="@style:num-format"/>
|
||||
<xsl:with-param name="number-prefix" select="@style:num-prefix"/>
|
||||
<xsl:with-param name="number-suffix" select="@style:num-suffix"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<xsl:if test="@text:start-numbering-at">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@text:start-numbering-at = 'document'">
|
||||
<w:numRestart w:val="continuous"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@text:start-numbering-at = 'page'">
|
||||
<w:numRestart w:val="each-page"/>
|
||||
</xsl:when>
|
||||
<!-- convert "chapter" to "section" -->
|
||||
<xsl:otherwise>
|
||||
<w:numRestart w:val="each-sect"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:if test="$within-section != 'yes'">
|
||||
<!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator
|
||||
is defined solely in docPr, so not trouble to find the proper footnote-sep definition. -->
|
||||
<w:footnote w:type="separator">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:separator/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:footnote>
|
||||
<w:footnote w:type="continuation-separator">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:continuationSeparator/>
|
||||
<xsl:if test="text:footnote-continuation-notice-backward">
|
||||
<w:t>
|
||||
<xsl:value-of select="text:footnote-continuation-notice-backward"/>
|
||||
</w:t>
|
||||
</xsl:if>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:footnote>
|
||||
<xsl:if test="text:footnote-continuation-notice-forward">
|
||||
<w:footnote w:type="continuation-notice">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:t>
|
||||
<xsl:value-of select="text:footnote-continuation-notice-forward"/>
|
||||
</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:footnote>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</w:footnotePr>
|
||||
</xsl:template>
|
||||
<xsl:template match="text:endnotes-configuration">
|
||||
<xsl:param name="within-section"/>
|
||||
<w:endnotePr>
|
||||
<w:pos w:val="sect-end"/>
|
||||
<xsl:if test="@text:start-value">
|
||||
<w:numStart w:val="{@text:start-value + 1}"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="@style:num-format">
|
||||
<xsl:call-template name="convert-number-format">
|
||||
<xsl:with-param name="number-format" select="@style:num-format"/>
|
||||
<xsl:with-param name="number-prefix" select="@style:num-prefix"/>
|
||||
<xsl:with-param name="number-suffix" select="@style:num-suffix"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<w:numRestart w:val="each-sect"/>
|
||||
<xsl:if test="$within-section != 'yes'">
|
||||
<w:endnote w:type="separator">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:separator/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:endnote>
|
||||
<w:endnote w:type="continuation-separator">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:continuationSeparator/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:endnote>
|
||||
</xsl:if>
|
||||
</w:endnotePr>
|
||||
</xsl:template>
|
||||
<xsl:template name="convert-number-format">
|
||||
<xsl:param name="number-format"/>
|
||||
<xsl:param name="number-prefix"/>
|
||||
<xsl:param name="number-suffix"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'">
|
||||
<w:numFmt w:val="decimal-zero"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'">
|
||||
<w:numFmt w:val="decimal-enclosed-fullstop"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'">
|
||||
<w:numFmt w:val="decimal-enclosed-paren"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'">
|
||||
<w:numFmt w:val="number-in-dash"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '1'">
|
||||
<!-- '1' also seems: decimal-half-width -->
|
||||
<w:numFmt w:val="decimal"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'a'">
|
||||
<w:numFmt w:val="lower-letter"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'A'">
|
||||
<w:numFmt w:val="upper-letter"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'i'">
|
||||
<w:numFmt w:val="lower-roman"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'I'">
|
||||
<w:numFmt w:val="upper-roman"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '1, 2, 3, ...'">
|
||||
<!-- '1, 2, 3, ...' also seems: decimal-full-width2 -->
|
||||
<w:numFmt w:val="decimal-full-width"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '①, ②, ③, ...'">
|
||||
<!-- decimal-enclosed-circle seems same -->
|
||||
<w:numFmt w:val="decimal-enclosed-circle-chinese"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '一, 二, 三, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'">
|
||||
<w:numFmt w:val="ideograph-enclosed-circle"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '一, 二, 三, ...'">
|
||||
<!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
|
||||
taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
|
||||
<w:numFmt w:val="chinese-counting-thousand"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '壹, 贰, 叁, ...'">
|
||||
<w:numFmt w:val="chinese-legal-simplified"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '壹, 貳, 參, ...'">
|
||||
<w:numFmt w:val="ideograph-legal-traditional"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '甲, 乙, 丙, ...'">
|
||||
<w:numFmt w:val="ideograph-traditional"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '子, 丑, 寅, ...'">
|
||||
<w:numFmt w:val="ideograph-zodiac"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '壱, 弐, 参, ...'">
|
||||
<w:numFmt w:val="japanese-legal"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
|
||||
<w:numFmt w:val="aiueo-full-width"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ア, イ, ウ, ...'">
|
||||
<w:numFmt w:val="aiueo"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
|
||||
<w:numFmt w:val="iroha-full-width"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
|
||||
<w:numFmt w:val="iroha"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '일, 이, 삼, ...'">
|
||||
<!-- '일, 이, 삼, ...' also seems: korean-counting -->
|
||||
<w:numFmt w:val="korean-digital"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
|
||||
<!-- mapping circled to uncircled -->
|
||||
<w:numFmt w:val="chosung"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = '가, 나, 다, ...' or $number-format = '㉮, ㉯, ㉰, ...'">
|
||||
<!-- mapping circled to uncircled -->
|
||||
<w:numFmt w:val="ganada"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'أ, ب, ت, ...'">
|
||||
<w:numFmt w:val="arabic-alpha"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ก, ข, ฃ, ...'">
|
||||
<w:numFmt w:val="thai-letters"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'א, י, ק, ...'">
|
||||
<w:numFmt w:val="hebrew-1"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'א, ב, ג, ...'">
|
||||
<w:numFmt w:val="hebrew-2"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'Native Numbering'">
|
||||
<xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($locale, 'th-')">
|
||||
<!-- for Thai, mapping thai-numbers, thai-counting to thai-letters -->
|
||||
<w:numFmt w:val="thai-letters"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'hi-')">
|
||||
<!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
|
||||
<w:numFmt w:val="hindi-numbers"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'ar-')">
|
||||
<!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
|
||||
<w:numFmt w:val="arabic-alpha"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'he-')">
|
||||
<!-- for Hebrew, mapping hebrew-2 to -->
|
||||
<w:numFmt w:val="hebrew-1"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'ru-')">
|
||||
<!-- for Russian, mapping russian-upper to russian-lower -->
|
||||
<w:numFmt w:val="russian-lower"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($locale, 'vi-')">
|
||||
<!-- for Vietnamese -->
|
||||
<w:numFmt w:val="vietnamese-counting"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
|
||||
chinese-not-impl, korean-legal -->
|
||||
<xsl:otherwise>
|
||||
<w:numFmt w:val="decimal"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
407
server/libreoffice/share/xslt/export/wordml/ooo2wordml_table.xsl
Normal file
407
server/libreoffice/share/xslt/export/wordml/ooo2wordml_table.xsl
Normal file
@@ -0,0 +1,407 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
|
||||
<xsl:key name="table-style" match="style:style[@style:family='table']" use="@style:name"/>
|
||||
<xsl:key name="table-column-style" match="style:style[@style:family='table-column']" use="@style:name"/>
|
||||
<xsl:key name="table-row-style" match="style:style[@style:family='table-row']" use="@style:name"/>
|
||||
<xsl:key name="table-cell-style" match="style:style[@style:family='table-cell']" use="@style:name"/>
|
||||
<xsl:template match="style:table-properties" mode="table">
|
||||
<xsl:param name="within-body"/>
|
||||
<xsl:if test="$within-body = 'yes'">
|
||||
<w:tblW>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@style:rel-width">
|
||||
<xsl:attribute name="w:w"><xsl:value-of select="substring-before(@style:rel-width, '%') * 50"/></xsl:attribute>
|
||||
<xsl:attribute name="w:type">pct</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="@style:width">
|
||||
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@style:width"/></xsl:call-template></xsl:attribute>
|
||||
<xsl:attribute name="w:type">dxa</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="w:w">0</xsl:attribute>
|
||||
<xsl:attribute name="w:type">auto</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</w:tblW>
|
||||
</xsl:if>
|
||||
<w:tblInd>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@fo:margin-left">
|
||||
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@fo:margin-left"/></xsl:call-template></xsl:attribute>
|
||||
<xsl:attribute name="w:type">dxa</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="w:w">0</xsl:attribute>
|
||||
<xsl:attribute name="w:type">auto</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</w:tblInd>
|
||||
<xsl:if test="@table:align">
|
||||
<w:jc>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@table:align = 'left' or @table:align= 'center' or @table:align = 'right'">
|
||||
<xsl:attribute name="w:val"><xsl:value-of select="@table:align"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="w:val">left</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</w:jc>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="table:table">
|
||||
<!--fix for issue i32030 pagebreak before-->
|
||||
<xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-before">
|
||||
<xsl:variable name="table-break-before" select="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$table-break-before = 'page' ">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:br w:type="page"/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</xsl:when>
|
||||
<xsl:when test="$table-break-before = 'column' ">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:br w:type="column"/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<w:tbl>
|
||||
<w:tblPr>
|
||||
<xsl:if test="not (@table:is-sub-table) or (@table:is-sub-table = 'false' )">
|
||||
<w:tblStyle w:val="{@table:style-name}"/>
|
||||
<xsl:apply-templates select="key('table-style', @table:style-name)/style:table-properties" mode="table">
|
||||
<xsl:with-param name="within-body" select="'yes'"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
<xsl:if test="@table:is-sub-table ='true' ">
|
||||
<w:tblW w:type="dxa">
|
||||
<xsl:variable name="sub-table-width">
|
||||
<xsl:call-template name="calculate-sub-table-width">
|
||||
<xsl:with-param name="sub-table-column-node" select="table:table-column[1]"/>
|
||||
<xsl:with-param name="total-sub-table-width" select="0"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="w:w"><xsl:value-of select="$sub-table-width"/></xsl:attribute>
|
||||
</w:tblW>
|
||||
<!--w:tblLayout w:type="Fixed"/-->
|
||||
</xsl:if>
|
||||
</w:tblPr>
|
||||
<w:tblGrid>
|
||||
<xsl:apply-templates select="table:table-column"/>
|
||||
</w:tblGrid>
|
||||
<xsl:apply-templates select="table:table-header-rows/table:table-row | table:table-row"/>
|
||||
</w:tbl>
|
||||
<!--fix for issue i32030 pagebreak after-->
|
||||
<xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-after">
|
||||
<xsl:variable name="table-break-after" select=" key('table-style', @table:style-name)/style:table-properties/@fo:break-after"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$table-break-after = 'page' ">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:br w:type="page"/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</xsl:when>
|
||||
<xsl:when test="$table-break-after = 'column' ">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:br w:type="column"/>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:if test="name(..)= 'table:table-cell' ">
|
||||
<w:p/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template name="calculate-sub-table-width">
|
||||
<xsl:param name="sub-table-column-node"/>
|
||||
<xsl:param name="total-sub-table-width"/>
|
||||
<xsl:variable name="column-width" select="key('table-column-style', $sub-table-column-node/@table:style-name)/style:table-column-properties/@style:column-width"/>
|
||||
<xsl:variable name="column-width-in-twip">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$column-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sub-table-column-node/following-sibling::table:table-column">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
|
||||
<xsl:call-template name="calculate-sub-table-width">
|
||||
<xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[ 1]"/>
|
||||
<xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="calculate-sub-table-width">
|
||||
<xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[1]"/>
|
||||
<xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip "/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
|
||||
<xsl:value-of select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$total-sub-table-width + $column-width-in-twip "/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="table:table-column">
|
||||
<xsl:variable name="column-width" select="key('table-column-style', @table:style-name)/style:table-column-properties/@style:column-width"/>
|
||||
<xsl:variable name="column-width-in-twip">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$column-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<!-- if table:table-column has attribute table:number-columns-repeated, then call the recursion
|
||||
temple repeat-gridcol to produce multiple w:gridCol in MS word. Gary.Yang -->
|
||||
<xsl:when test="@table:number-columns-repeated">
|
||||
<xsl:call-template name="repeat-gridcol">
|
||||
<xsl:with-param name="grid-repeat-count" select="@table:number-columns-repeated"/>
|
||||
<xsl:with-param name="column-width" select="$column-width-in-twip"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:gridCol w:w="{$column-width-in-twip}"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!--recursion template for produce multiple w:gridCol Gary.Yang-->
|
||||
<xsl:template name="repeat-gridcol">
|
||||
<xsl:param name="grid-repeat-count"/>
|
||||
<xsl:param name="column-width"/>
|
||||
<xsl:if test="$grid-repeat-count > 0">
|
||||
<w:gridCol w:w="{$column-width}"/>
|
||||
<xsl:call-template name="repeat-gridcol">
|
||||
<xsl:with-param name="grid-repeat-count" select="$grid-repeat-count - 1"/>
|
||||
<xsl:with-param name="column-width" select="$column-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="table:table-row">
|
||||
<xsl:element name="w:tr">
|
||||
<xsl:element name="w:trPr">
|
||||
<xsl:if test="parent::table:table-header-rows">
|
||||
<!-- fix for Issue 32034-->
|
||||
<w:tblHeader>on</w:tblHeader>
|
||||
</xsl:if>
|
||||
<xsl:variable name="row-height" select="key('table-row-style', @table:style-name)/style:table-row-properties/@style:row-height"/>
|
||||
<xsl:if test="$row-height">
|
||||
<w:trHeight>
|
||||
<xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$row-height"/></xsl:call-template></xsl:attribute>
|
||||
</w:trHeight>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
<!--end of w:trPr-->
|
||||
<xsl:apply-templates select="table:table-cell "/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
<xsl:template match="table:table-cell ">
|
||||
<xsl:element name="w:tc">
|
||||
<xsl:element name="w:tcPr">
|
||||
<!-- to calculate the table-cell width Gary.Yang -->
|
||||
<xsl:choose>
|
||||
<!--when the table-cell contains the sub-table -->
|
||||
<xsl:when test="table:table/@table:is-sub-table= 'true' ">
|
||||
<xsl:variable name="table-cell-width">
|
||||
<xsl:call-template name="calculate-sub-table-width">
|
||||
<xsl:with-param name="sub-table-column-node" select="table:table/table:table-column[1]"/>
|
||||
<xsl:with-param name="total-sub-table-width" select="0"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<w:tcW w:type="dxa">
|
||||
<xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
|
||||
</w:tcW>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- when the table-cell doesn't contain the sub-table -->
|
||||
<xsl:variable name="table-cell-width">
|
||||
<xsl:call-template name="calculate-table-cell-width">
|
||||
<xsl:with-param name="table-cell-position" select="position()"/>
|
||||
<xsl:with-param name="table-column" select="ancestor::table:table[1]/table:table-column[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<w:tcW w:type="dxa">
|
||||
<xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
|
||||
</w:tcW>
|
||||
<!-- for performance issue, we can set w:type to auto that makes the cell width auto fit the content. -->
|
||||
<!--w:tcW w:w="0" w:type="auto"/-->
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="@table:number-columns-spanned">
|
||||
<w:gridSpan w:val="{@table:number-columns-spanned}"/>
|
||||
</xsl:if>
|
||||
<xsl:variable name="cell-style-properties" select="key('table-cell-style', @table:style-name)/style:table-cell-properties"/>
|
||||
<xsl:if test="$cell-style-properties/@fo:background-color">
|
||||
<w:shd w:val="solid" w:color="{substring-after($cell-style-properties/@fo:background-color,'#')}"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$cell-style-properties/@fo:vertical-align">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$cell-style-properties/@fo:vertical-align = 'middle'">
|
||||
<w:vAlign w:val="center"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$cell-style-properties/@fo:vertical-align = 'Automatic'">
|
||||
<w:vAlign w:val="both"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<w:vAlign w:val="{$cell-style-properties/@fo:vertical-align}"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<w:tcMar>
|
||||
<xsl:if test="$cell-style-properties/@fo:padding-top">
|
||||
<w:top w:type="dxa">
|
||||
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-top"/></xsl:call-template></xsl:attribute>
|
||||
</w:top>
|
||||
</xsl:if>
|
||||
<xsl:if test="$cell-style-properties/@fo:padding-bottom">
|
||||
<w:bottom w:type="dxa">
|
||||
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-bottom"/></xsl:call-template></xsl:attribute>
|
||||
</w:bottom>
|
||||
</xsl:if>
|
||||
<xsl:if test="$cell-style-properties/@fo:padding-left">
|
||||
<w:left w:type="dxa">
|
||||
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-left"/></xsl:call-template></xsl:attribute>
|
||||
</w:left>
|
||||
</xsl:if>
|
||||
<xsl:if test="$cell-style-properties/@fo:padding-right">
|
||||
<w:right w:type="dxa">
|
||||
<xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-right"/></xsl:call-template></xsl:attribute>
|
||||
</w:right>
|
||||
</xsl:if>
|
||||
</w:tcMar>
|
||||
<!-- the following code is to get the cell borders if they exist -->
|
||||
<xsl:variable name="border-top" select="$cell-style-properties/@fo:border-top | $cell-style-properties/@fo:border"/>
|
||||
<xsl:variable name="border-bottom" select="$cell-style-properties/@fo:border-bottom | $cell-style-properties/@fo:border"/>
|
||||
<xsl:variable name="border-left" select="$cell-style-properties/@fo:border-left | $cell-style-properties/@fo:border"/>
|
||||
<xsl:variable name="border-right" select="$cell-style-properties/@fo:border-right | $cell-style-properties/@fo:border"/>
|
||||
<xsl:variable name="border-line-width-top" select="$cell-style-properties/@style:border-line-width-top | $cell-style-properties/@style:border-line-width "/>
|
||||
<xsl:variable name="border-line-width-bottom" select="$cell-style-properties/@style:border-line-width-bottom | $cell-style-properties/@style:border-line-width"/>
|
||||
<xsl:variable name="border-line-width-left" select="$cell-style-properties/@style:border-line-width-left | $cell-style-properties/@style:border-line-width"/>
|
||||
<xsl:variable name="border-line-width-right" select="$cell-style-properties/@style:border-line-width-right | $cell-style-properties/@style:border-line-width"/>
|
||||
<xsl:element name="w:tcBorders">
|
||||
<xsl:if test="$border-top">
|
||||
<xsl:element name="w:top">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-top"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'top' "/>
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="$border-bottom">
|
||||
<xsl:element name="w:bottom">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-bottom"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'bottom' "/>
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="$border-left">
|
||||
<xsl:element name="w:left">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-left"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'left' "/>
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="$border-right">
|
||||
<xsl:element name="w:right">
|
||||
<xsl:call-template name="get-border">
|
||||
<xsl:with-param name="so-border" select="$border-right"/>
|
||||
<xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
|
||||
<xsl:with-param name="so-border-position" select=" 'right' "/>
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
<xsl:if test="not (*) ">
|
||||
<w:p/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select=" text:p | table:table | text:h | office:annotation"/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
<xsl:template name="calculate-table-cell-width">
|
||||
<xsl:param name="table-cell-position"/>
|
||||
<xsl:param name="table-column"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$table-column/@table:number-columns-repeated">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($table-cell-position - $table-column/@table:number-columns-repeated) <= 0">
|
||||
<xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
|
||||
<xsl:variable name="table-cell-width-in-twip">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$table-cell-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="$table-cell-width-in-twip"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="calculate-table-cell-width">
|
||||
<xsl:with-param name="table-cell-position" select="$table-cell-position - $table-column/@table:number-columns-repeated"/>
|
||||
<xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- if the $table-column doesn't contain the table:number-columns-repeated attribute -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="($table-cell-position - 1) = 0">
|
||||
<xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
|
||||
<xsl:variable name="table-cell-width-in-twip">
|
||||
<xsl:call-template name="convert2twip">
|
||||
<xsl:with-param name="value" select="$table-cell-width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="$table-cell-width-in-twip"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="($table-cell-position - 1) > 0">
|
||||
<xsl:call-template name="calculate-table-cell-width">
|
||||
<xsl:with-param name="table-cell-position" select=" $table-cell-position - 1 "/>
|
||||
<xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message>
|
||||
<xsl:value-of select=" 'calculate table cell width wrong ' "/>
|
||||
</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
1270
server/libreoffice/share/xslt/export/wordml/ooo2wordml_text.xsl
Normal file
1270
server/libreoffice/share/xslt/export/wordml/ooo2wordml_text.xsl
Normal file
File diff suppressed because it is too large
Load Diff
3011
server/libreoffice/share/xslt/export/xhtml/body.xsl
Normal file
3011
server/libreoffice/share/xslt/export/xhtml/body.xsl
Normal file
File diff suppressed because it is too large
Load Diff
455
server/libreoffice/share/xslt/export/xhtml/header.xsl
Normal file
455
server/libreoffice/share/xslt/export/xhtml/header.xsl
Normal file
@@ -0,0 +1,455 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
|
||||
xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<!-- ************** -->
|
||||
<!-- *** header *** -->
|
||||
<!-- ************** -->
|
||||
|
||||
<xsl:template name="create-header">
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<xsl:element name="head">
|
||||
<xsl:attribute name="profile">http://dublincore.org/documents/dcmi-terms/</xsl:attribute>
|
||||
<xsl:if test="$debugEnabled"><xsl:message>CSS helper variable will be created...</xsl:message></xsl:if>
|
||||
<xsl:call-template name='xhtml-header-properties'>
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:if test="$debugEnabled"><xsl:message>CSS variable ready, header will be created...</xsl:message></xsl:if>
|
||||
<!-- constructing the css header simulating inheritance of style-families by style order -->
|
||||
<xsl:call-template name='create-css-styleheader'>
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
<xsl:if test="$debugEnabled"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
|
||||
</xsl:element>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Creating a CSS style header from the collected styles of the 'globalData' parameter -->
|
||||
<xsl:template name='create-css-styleheader'>
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<xsl:element name="style">
|
||||
<xsl:attribute name="type">text/css</xsl:attribute>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:call-template name='create-page-layout'>
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
<xsl:text>table { border-collapse:collapse; border-spacing:0; empty-cells:show }
|
||||
</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="/*/office:body/office:spreadsheet"><xsl:text>td, th { vertical-align:top; font-size:10pt;}
|
||||
</xsl:text></xsl:when>
|
||||
<xsl:otherwise><xsl:text>td, th { vertical-align:top; font-size:12pt;}
|
||||
</xsl:text></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>h1, h2, h3, h4, h5, h6 { clear:both;}
|
||||
</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="/*/office:body/office:spreadsheet">
|
||||
<xsl:text>p { white-space: nowrap; }
|
||||
</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:text>ol, ul { margin:0; padding:0;}
|
||||
</xsl:text>
|
||||
<xsl:text>li { list-style: none; margin:0; padding:0;}
|
||||
</xsl:text>
|
||||
<xsl:text>/* "li span.odfLiEnd" - IE 7 issue*/</xsl:text>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:text>li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
|
||||
</xsl:text>
|
||||
<xsl:text>span.footnodeNumber { padding-right:1em; }
|
||||
</xsl:text>
|
||||
<xsl:text>span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
|
||||
</xsl:text>
|
||||
<!-- Simulate tabs. They are around 0.64cm in LO, we convert that to 0.8rem. -->
|
||||
<xsl:text>span.heading_numbering { margin-right: 0.8rem; }</xsl:text>
|
||||
<xsl:text>* { margin:0;}
|
||||
</xsl:text>
|
||||
<xsl:call-template name="write-mapped-CSS-styles">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="write-mapped-CSS-styles">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="emptyStyles"/>
|
||||
|
||||
<xsl:for-each select="$globalData/all-styles/style">
|
||||
<xsl:if test="final-properties != ''">
|
||||
<!-- NOTE: easy process, as only the style family in conjunction with the style name, makes the style unambiguous -->
|
||||
<xsl:text>.</xsl:text><!--<xsl:value-of select="@style:family" /><xsl:text>:</xsl:text>--><xsl:value-of select="translate(@style:name, '.,;: %()[]/\+', '_____________')"/><xsl:text> { </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:for-each>
|
||||
<!-- Otherwise all styles have been processed and the empty styles have to be given out -->
|
||||
<xsl:text>/* ODF styles with no properties representable as CSS */</xsl:text><xsl:text>
|
||||
</xsl:text><xsl:for-each select="$globalData/all-styles/style[final-properties = '']"><xsl:value-of select="concat('.', @style:name, ' ')"/></xsl:for-each> { }
|
||||
</xsl:template>
|
||||
|
||||
<!-- Creating CSS page layout based on first office master style -->
|
||||
<xsl:template name='create-page-layout'>
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<!-- approximation to find the correct master page style (with page dimensions) -->
|
||||
<xsl:variable name="masterPageNames">
|
||||
<!-- set context to styles.xml -->
|
||||
<xsl:for-each select="$globalData/all-doc-styles/style">
|
||||
<!-- Loop over every style:style containing a @style:master-page-name attribute -->
|
||||
<xsl:for-each select="key('masterPage','count')">
|
||||
<!-- set context to styles.xml -->
|
||||
<xsl:for-each select="/*/office:body">
|
||||
<!-- Check if this style is being used in the body -->
|
||||
<xsl:if test="key('elementUsingStyle', ../@style:name)">
|
||||
<!-- Check every master-page-name if it is not empty and return as ';' separated list -->
|
||||
<xsl:if test="string-length(../@style:master-page-name) > 0"><xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
<!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
|
||||
<xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
|
||||
<!-- Find the according style:page-layout and store the properties in a variable -->
|
||||
<xsl:variable name="pageProperties" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
|
||||
|
||||
<xsl:text>@page { </xsl:text>
|
||||
|
||||
<xsl:call-template name="page-size">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="pageProperties" select="$pageProperties" />
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="page-margin">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="pageProperties" select="$pageProperties" />
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:text> }
|
||||
</xsl:text>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="page-size">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="pageProperties" />
|
||||
|
||||
<xsl:variable name="printOrientation" select="$pageProperties/@style:print-orientation" />
|
||||
<xsl:variable name="pageWidth" select="$pageProperties/@fo:page-width" />
|
||||
<xsl:variable name="pageHeight" select="$pageProperties/@fo:page-height" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$pageWidth and $pageHeight">
|
||||
<xsl:text>size: </xsl:text>
|
||||
<xsl:value-of select="$pageWidth" />
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$pageHeight" />
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$printOrientation">
|
||||
<xsl:text>size: </xsl:text>
|
||||
<xsl:value-of select="$printOrientation" />
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="page-margin">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="pageProperties" />
|
||||
|
||||
<xsl:variable name="marginTop" select="$pageProperties/@fo:margin-top" />
|
||||
<xsl:if test="$marginTop">
|
||||
<xsl:text>margin-top: </xsl:text>
|
||||
<xsl:value-of select="$marginTop" />
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:variable name="marginBottom" select="$pageProperties/@fo:margin-bottom" />
|
||||
<xsl:if test="$marginBottom">
|
||||
<xsl:text>margin-bottom: </xsl:text>
|
||||
<xsl:value-of select="$marginBottom" />
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:variable name="marginLeft" select="$pageProperties/@fo:margin-left" />
|
||||
<xsl:if test="$marginLeft">
|
||||
<xsl:text>margin-left: </xsl:text>
|
||||
<xsl:value-of select="$marginLeft" />
|
||||
<xsl:text>; </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:variable name="marginRight" select="$pageProperties/@fo:margin-right" />
|
||||
<xsl:if test="$marginRight">
|
||||
<xsl:text>margin-right: </xsl:text>
|
||||
<xsl:value-of select="$marginRight" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- *************************** -->
|
||||
<!-- *** Common XHTML header *** -->
|
||||
<!-- *************************** -->
|
||||
|
||||
<xsl:template name='xhtml-header-properties'>
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<xsl:variable name="netloc">
|
||||
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
|
||||
<xsl:if test="./@meta:name='ODF.base'">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
|
||||
<xsl:if test="./@meta:name='ODF.filename'">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="lang">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$globalData/meta-file/*/office:meta/dc:language">
|
||||
<xsl:value-of select="$globalData/meta-file/*/office:meta/dc:language" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>en-US</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="prov">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$globalData/meta-file/*/office:meta/meta:printed-by">
|
||||
<xsl:value-of select="concat('Printed by "',$globalData/meta-file/*/office:meta/meta:printed-by,'"[dc:publisher] on "',$globalData/meta-file/*/office:meta/meta:print-date,'"[dc:date] in "',$lang,'"[dc:language]')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise />
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="keywords">
|
||||
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:keyword">
|
||||
<xsl:value-of select="." />
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- explicit output content-type for low-tech browser (e.g. IE6) -->
|
||||
<xsl:element name="meta">
|
||||
<xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
|
||||
<xsl:attribute name="content">application/xhtml+xml; charset=utf-8</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
||||
<!-- title of document for browser frame title -->
|
||||
<xsl:element name="title">
|
||||
<xsl:attribute name="xml:lang">
|
||||
<xsl:value-of select="$lang" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$globalData/meta-file/*/office:meta/dc:title">
|
||||
<xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
|
||||
</xsl:when>
|
||||
<!-- providing the mandatory title is a workaround for an IE bug-->
|
||||
<xsl:otherwise>
|
||||
<xsl:text>- no title specified</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:element>
|
||||
|
||||
<!-- title, in DC syntax -->
|
||||
<xsl:element name="meta">
|
||||
<xsl:attribute name="name">DCTERMS.title</xsl:attribute>
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="xml:lang">
|
||||
<xsl:value-of select="$lang" />
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
||||
<!-- the identifier for source (identifier) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.identifier'" />
|
||||
<xsl:with-param name="meta-data" select="translate($netloc, ' ','')" />
|
||||
<xsl:with-param name="meta-enc" select="'DCTERMS.URI'" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- the language for source (language) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.language'" />
|
||||
<xsl:with-param name="meta-data" select="$lang" />
|
||||
<xsl:with-param name="meta-enc" select="'DCTERMS.RFC4646'" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- a bit commercial (generator) -->
|
||||
<xsl:element name="meta">
|
||||
<xsl:attribute name="name">DCTERMS.source</xsl:attribute>
|
||||
<xsl:attribute name="content">http://xml.openoffice.org/odf2xhtml</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
||||
<!-- the author of the input source (author) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.creator'" />
|
||||
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:initial-creator" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- creation-date of the input source (issued) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.issued'" />
|
||||
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:creation-date" />
|
||||
<xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- name of last changing person of the input source (changedby) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.contributor'" />
|
||||
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:creator" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- last changing date of the input source (changed) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.modified'" />
|
||||
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:date" />
|
||||
<xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- Last print, as provenance -->
|
||||
<xsl:if test="$prov">
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.provenance'" />
|
||||
<xsl:with-param name="meta-data" select="$prov" />
|
||||
<xsl:with-param name="meta-lang" select="$lang" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
|
||||
<!-- keywords about the input source (keywords) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.subject'" />
|
||||
<xsl:with-param name="meta-data" select="normalize-space(concat($globalData/meta-file/*/office:meta/dc:subject,', ',$keywords))" />
|
||||
<xsl:with-param name="meta-lang" select="$lang" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- detailed description about the input source (description) -->
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="'DCTERMS.description'" />
|
||||
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:description" />
|
||||
<xsl:with-param name="meta-lang" select="$lang" />
|
||||
</xsl:call-template>
|
||||
|
||||
|
||||
<!-- user defined use of DCTERM tags -->
|
||||
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DCTERMS.')][not(.='')]">
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="@meta:name" />
|
||||
<xsl:with-param name="meta-data" select="." />
|
||||
<!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
<!-- user defined use of DC tags (legacy) -->
|
||||
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DC.')][not(.='')]">
|
||||
<xsl:call-template name="add-meta-tag">
|
||||
<xsl:with-param name="meta-name" select="@meta:name" />
|
||||
<xsl:with-param name="meta-data" select="." />
|
||||
<!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
|
||||
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en" />
|
||||
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en" />
|
||||
<link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en" />
|
||||
<link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en" />
|
||||
<!-- W3C GRDDL Profile -->
|
||||
<!--
|
||||
<link rel="transformation" href="http://xml.openoffice.org/odf2xhtml/rdf-extract.xsl" />
|
||||
-->
|
||||
|
||||
<!-- base URL of document for resolving relative links
|
||||
NOTE: CHROME has a problem, with relative references as from content table, referencing to root directory instead of document
|
||||
<xsl:element name="base">
|
||||
<xsl:attribute name="href">-->
|
||||
<!-- earlier 'targetURL' was used for an absolute reference of base provided by the Office (file URL)
|
||||
<xsl:value-of select="$targetURL" />
|
||||
now '.' let relative links work, even if document has been moved -->
|
||||
<!--<xsl:text>.</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:element>-->
|
||||
</xsl:template>
|
||||
|
||||
<!-- generic template for adding common meta tags -->
|
||||
<xsl:template name="add-meta-tag">
|
||||
<xsl:param name="meta-name" />
|
||||
<xsl:param name="meta-data" />
|
||||
<xsl:param name="meta-enc" />
|
||||
<xsl:param name="meta-lang" />
|
||||
|
||||
<xsl:if test="$meta-data">
|
||||
<xsl:element name="meta">
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="$meta-name" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="$meta-data" />
|
||||
</xsl:attribute>
|
||||
<xsl:if test="$meta-enc">
|
||||
<xsl:attribute name="scheme">
|
||||
<xsl:value-of select="$meta-enc" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="$meta-lang">
|
||||
<xsl:attribute name="xml:lang">
|
||||
<xsl:value-of select="$meta-lang" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
174
server/libreoffice/share/xslt/export/xhtml/opendoc2xhtml.xsl
Normal file
174
server/libreoffice/share/xslt/export/xhtml/opendoc2xhtml.xsl
Normal file
@@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
|
||||
xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
|
||||
<!--+++++ INCLUDED XSL MODULES +++++-->
|
||||
|
||||
<!-- inheritance of office style properties is resolved into absolute styles. Office properties gathered as elements -->
|
||||
<xsl:include href="../common/styles/style_collector.xsl" />
|
||||
|
||||
<!-- mapping rules of office style properties to CSS/HTML properties -->
|
||||
<xsl:include href="../common/styles/style_mapping_css.xsl" />
|
||||
|
||||
<!-- office header element handling especially for XHTML -->
|
||||
<xsl:include href="header.xsl" />
|
||||
|
||||
<!-- office body element handling especially for XHTML -->
|
||||
<xsl:include href="body.xsl" />
|
||||
|
||||
|
||||
<xsl:output method = "xml"
|
||||
encoding = "UTF-8"
|
||||
media-type = "application/xhtml+xml"
|
||||
indent = "no"
|
||||
omit-xml-declaration = "no"
|
||||
doctype-public = "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
|
||||
doctype-system = "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" />
|
||||
|
||||
|
||||
|
||||
<xsl:variable name="namespace" select="'http://www.w3.org/1999/xhtml'" />
|
||||
|
||||
<!--+++++ PARAMETER SECTION +++++-->
|
||||
|
||||
<!-- OPTIONAL: if the document content is provided in a directory structure. Opposite to a single flat XML stream -->
|
||||
<xsl:param name="isPackageFormat" />
|
||||
|
||||
<!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is an absolute file URL to the target directory.
|
||||
Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
|
||||
<xsl:param name="targetBaseURL" select="'./'" />
|
||||
|
||||
<!-- OPTIONAL: (MANDATORY: for all input document with content table) : parameter is an absolute file URL to the target document.
|
||||
Relative links to this office document (e.g. to internal anchor) will get this parameter as a prefix -->
|
||||
<xsl:param name="targetURL" select="'./'" />
|
||||
|
||||
<!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
|
||||
To access contents of an office file (content like the meta.xml, styles.xml file or graphics) a URL could be chosen.
|
||||
This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
|
||||
"jar:file:/C:/temp/Test.sxw!/" for example.
|
||||
When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the jared document. -->
|
||||
<xsl:param name="sourceBaseURL" select="'./'" />
|
||||
|
||||
<!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
|
||||
Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is being used (the session is appended to the URL).
|
||||
This URL session is used for example when links to graphics are created by XSLT. Otherwise the user have to log again in for every graphic he likes to see. -->
|
||||
<xsl:param name="optionalURLSuffix" />
|
||||
|
||||
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
|
||||
<xsl:param name="metaFileURL" />
|
||||
|
||||
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
|
||||
<xsl:param name="stylesFileURL" />
|
||||
|
||||
<!-- OPTIONAL: DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
|
||||
<!-- Although many pictures have a 96 dpi resolution, a higher resolution give better results for common browsers -->
|
||||
<!-- Cp. measure_conversion.xsl:
|
||||
<xsl:param name="dpi" select="111" /> -->
|
||||
|
||||
|
||||
<!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
|
||||
(e.g. encoding chapter names for the content-table as href and anchors ) -->
|
||||
<xsl:param name="java" select="true()" />
|
||||
<xsl:param name="javaEnabled" select="boolean($java)" />
|
||||
|
||||
<!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
|
||||
<xsl:param name="debug" select="false()" />
|
||||
<xsl:param name="debugEnabled" select="boolean($debug)" />
|
||||
<xsl:param name="onlyStyleOutput" select="false()" />
|
||||
<xsl:param name="onlyStyleOutputEnabled" select="boolean($onlyStyleOutput)" />
|
||||
|
||||
<!-- *************************************** -->
|
||||
<!-- *** build the appropriate HTML file *** -->
|
||||
<!-- *************************************** -->
|
||||
<xsl:template match="/">
|
||||
<!-- debug output of parameter value set -->
|
||||
<xsl:if test="$debugEnabled">
|
||||
<xsl:call-template name="debug-check-parameter" />
|
||||
</xsl:if>
|
||||
<!-- gathers style properties and
|
||||
returns them as globalData parameter to the 'start-main' template -->
|
||||
<xsl:call-template name="collect-global-odf-properties" />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- *************************** -->
|
||||
<!-- *** Built up XHTML file *** -->
|
||||
<!-- *************************** -->
|
||||
<xsl:template name="start-main">
|
||||
<xsl:param name="globalData" />
|
||||
|
||||
<xsl:element name="html">
|
||||
<xsl:comment>This file was converted to xhtml by LibreOffice - see https://cgit.freedesktop.org/libreoffice/core/tree/filter/source/xslt for the code.</xsl:comment>
|
||||
<xsl:call-template name='create-header'>
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:call-template name='create-body'>
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- debug purpose only:
|
||||
verbose checking of the parameters of this template-->
|
||||
<xsl:template name="debug-check-parameter">
|
||||
<xsl:message>Parameter dpi: <xsl:value-of select="$dpi" /></xsl:message>
|
||||
<xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL" /></xsl:message>
|
||||
<xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL" /></xsl:message>
|
||||
<xsl:message>Parameter sourceBaseURL: <xsl:value-of select="$sourceBaseURL" /></xsl:message>
|
||||
<xsl:message>Parameter targetBaseURL: <xsl:value-of select="$targetBaseURL" /></xsl:message>
|
||||
<xsl:message>Parameter onlyStyleOutputEnabled: <xsl:value-of select="$onlyStyleOutputEnabled" /></xsl:message>
|
||||
<xsl:message>Parameter debugEnabled: <xsl:value-of select="$debugEnabled" /></xsl:message>
|
||||
<xsl:message>Parameter java: <xsl:value-of select="$java" /></xsl:message>
|
||||
<xsl:message>Parameter javaEnabled: <xsl:value-of select="$javaEnabled" /></xsl:message>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
213
server/libreoffice/share/xslt/export/xhtml/table.xsl
Normal file
213
server/libreoffice/share/xslt/export/xhtml/table.xsl
Normal file
@@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<!--
|
||||
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
|
||||
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:dom="http://www.w3.org/2001/xml-events"
|
||||
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
|
||||
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
|
||||
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
|
||||
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
|
||||
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:ooo="http://openoffice.org/2004/office"
|
||||
xmlns:oooc="http://openoffice.org/2004/calc"
|
||||
xmlns:ooow="http://openoffice.org/2004/writer"
|
||||
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi"
|
||||
xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
|
||||
|
||||
<!-- current node is a table:table -->
|
||||
<xsl:template name="create-table-children">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allVisibleTableRows" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
|
||||
<xsl:element name="colgroup">
|
||||
<xsl:for-each select="$allTableColumns/table:table-column">
|
||||
<xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
|
||||
<xsl:element name="col">
|
||||
<xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
|
||||
<xsl:if test="$value">
|
||||
<xsl:attribute name="width">
|
||||
<!-- using the absolute width, problems with the relative in browser (in OOo style:rel-column-width) -->
|
||||
<xsl:call-template name="convert2px">
|
||||
<xsl:with-param name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
<!-- *** the column-style ***
|
||||
<xsl:attribute name="width">
|
||||
<xsl:variable name="currentColumnStyleName" select="$allTableColumns/table:table-column[position() = $columnPosition]/@table:style-name" />
|
||||
<xsl:value-of select="$globalData/all-doc-styles/style[@style:name = $currentColumnStyleName]/*/@style:column-width" />
|
||||
</xsl:attribute>-->
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
|
||||
<xsl:call-template name="create-table-rows">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
|
||||
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- Creating the content of a table content using CSS styles -->
|
||||
<xsl:template name="create-table-cell-content">
|
||||
<xsl:param name="tableDataType" />
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="allTableColumns" />
|
||||
<xsl:param name="columnPosition" />
|
||||
<xsl:param name="currentTableColumn" />
|
||||
|
||||
<xsl:element name="{$tableDataType}">
|
||||
|
||||
<!-- if parser reads DTD the default is set to '1' -->
|
||||
<xsl:if test="@table:number-columns-spanned and @table:number-columns-spanned > 1">
|
||||
<xsl:attribute name="colspan">
|
||||
<xsl:value-of select="@table:number-columns-spanned" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<!-- if parser reads DTD the default is set to '1' -->
|
||||
<xsl:if test="@table:number-rows-spanned and @table:number-rows-spanned > 1">
|
||||
<xsl:attribute name="rowspan">
|
||||
<xsl:value-of select="@table:number-rows-spanned" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
|
||||
<!-- *** the cell-style *** -->
|
||||
<!-- The cell style has no conclusion with the column style, so we switch the order/priorities due to browser issues
|
||||
|
||||
The cell-style depends on two attributes:
|
||||
|
||||
1) table:style-name - the style properties of cell. When they exist, a default alignment (cp. below) will be added for the
|
||||
case of no alignment in the style exist.
|
||||
|
||||
2) office:value-type - the value type of the table-cell giving the default alignments.
|
||||
By default a string value is left aligned, all other are aligned:right.
|
||||
-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="@table:style-name">
|
||||
<xsl:call-template name="set-styles">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="styleName" select="@table:style-name" />
|
||||
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- Cells without a style use the 'table:default-cell-style-name'
|
||||
when there is no default cell style specified for the current column. -->
|
||||
<xsl:variable name="defaultCellStyleName" select="$currentTableColumn/@table:default-cell-style-name" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$defaultCellStyleName">
|
||||
<xsl:call-template name="set-styles">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
<xsl:with-param name="styleName" select="$defaultCellStyleName" />
|
||||
<xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- No cell style exists, nor a default table cell style for the column -->
|
||||
<xsl:attribute name="style">
|
||||
<!-- sets cell alignment dependent of cell value type -->
|
||||
<xsl:call-template name="set-cell-alignment" />
|
||||
</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:if test="$debugEnabled">
|
||||
<xsl:message>A table cell '<xsl:value-of select="$tableDataType" />' element has been added!</xsl:message>
|
||||
</xsl:if>
|
||||
|
||||
<!-- empty cell tags produce problems with width CSS style on itself other table cells as well
|
||||
therefore a non breakable space ( / ) have been inserted.-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="node()">
|
||||
<xsl:call-template name="apply-styles-and-content">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="apply-styles-and-content">
|
||||
<xsl:with-param name="globalData" select="$globalData" />
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Sets the cell alignment by the 'office:value-type' of the 'table:table-cell'.
|
||||
Strings have a left alignment, other values right -->
|
||||
<xsl:template name="set-cell-alignment">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@office:value-type and not(@office:value-type = 'string')">text-align:right; </xsl:when>
|
||||
<xsl:otherwise>text-align:left;</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- Sets styles of a cell -->
|
||||
<xsl:template name="set-styles">
|
||||
<xsl:param name="globalData" />
|
||||
<xsl:param name="styleName" />
|
||||
<xsl:param name="currentTableColumn" />
|
||||
|
||||
<xsl:attribute name="style">
|
||||
<!-- sets cell alignment dependent of cell value type -->
|
||||
<xsl:call-template name="set-cell-alignment" />
|
||||
|
||||
<!-- set column style (disjunct of cell style) -->
|
||||
<xsl:value-of select="$globalData/all-styles/style[@style:name = $currentTableColumn/@table:style-name]/final-properties" />
|
||||
|
||||
</xsl:attribute>
|
||||
|
||||
<!-- cell style header -->
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
92
server/libreoffice/share/xslt/import/common/ms2ooo_docpr.xsl
Normal file
92
server/libreoffice/share/xslt/import/common/ms2ooo_docpr.xsl
Normal file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
|
||||
<xsl:template match="o:DocumentProperties">
|
||||
<office:meta>
|
||||
<meta:generator>Microsoft Word 2003</meta:generator>
|
||||
<dc:title>
|
||||
<xsl:value-of select="o:Title"/>
|
||||
</dc:title>
|
||||
<dc:description>
|
||||
<xsl:value-of select="o:Description"/>
|
||||
</dc:description>
|
||||
<dc:subject>
|
||||
<xsl:value-of select="o:Subject"/>
|
||||
</dc:subject>
|
||||
<meta:initial-creator>
|
||||
<xsl:value-of select="o:Author"/>
|
||||
</meta:initial-creator>
|
||||
<meta:creation-date>
|
||||
<xsl:value-of select="substring-before( o:Created, 'Z')"/>
|
||||
</meta:creation-date>
|
||||
<dc:creator>
|
||||
<xsl:value-of select="o:LastAuthor"/>
|
||||
</dc:creator>
|
||||
<xsl:if test="string-length(substring-before( o:LastSaved, 'Z')) > 0">
|
||||
<dc:date>
|
||||
<xsl:value-of select="substring-before( o:LastSaved, 'Z')"/>
|
||||
</dc:date>
|
||||
</xsl:if>
|
||||
<!-- comment out the below line now because Oasis format doesn't allow the meta:print-by to be empty element -->
|
||||
<!--meta:printed-by /-->
|
||||
<xsl:if test="string-length(substring-before( o:LastPrinted, 'Z')) > 0">
|
||||
<!--
|
||||
<meta:print-date>
|
||||
<xsl:value-of select="substring-before( o:LastPrinted, 'Z')"/>
|
||||
</meta:print-date>
|
||||
-->
|
||||
</xsl:if>
|
||||
<meta:keyword>
|
||||
<xsl:value-of select="o:Keywords"/>
|
||||
</meta:keyword>
|
||||
<meta:editing-cycles>
|
||||
<xsl:value-of select="o:Revision"/>
|
||||
</meta:editing-cycles>
|
||||
<meta:editing-duration>
|
||||
<xsl:if test="o:TotalTime">
|
||||
<xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/>
|
||||
</xsl:if>
|
||||
</meta:editing-duration>
|
||||
<meta:user-defined meta:name="Category" meta:value-type="string">
|
||||
<xsl:value-of select="o:Category"/>
|
||||
</meta:user-defined>
|
||||
<meta:user-defined meta:name="Manager" meta:value-type="string">
|
||||
<xsl:value-of select="o:Manager"/>
|
||||
</meta:user-defined>
|
||||
<meta:user-defined meta:name="Company" meta:value-type="string">
|
||||
<xsl:value-of select="o:Company"/>
|
||||
</meta:user-defined>
|
||||
<meta:user-defined meta:name="Version" meta:value-type="string">
|
||||
<xsl:value-of select="o:Version"/>
|
||||
</meta:user-defined>
|
||||
<meta:user-defined meta:name="HyperlinkBase" meta:value-type="string">
|
||||
<xsl:value-of select="o:HyperlinkBase"/>
|
||||
</meta:user-defined>
|
||||
<xsl:apply-templates select="../o:CustomDocumentProperties"/>
|
||||
<meta:document-statistic meta:page-count="{o:Pages}" meta:paragraph-count="{o:Paragraphs}" meta:word-count="{o:Words}" meta:character-count="{o:Characters}"/>
|
||||
</office:meta>
|
||||
</xsl:template>
|
||||
<xsl:template match="o:CustomDocumentProperties">
|
||||
<xsl:for-each select="node()[@dt:dt]">
|
||||
<meta:user-defined meta:name="{local-name()}" meta:value-type="{@dt:dt}">
|
||||
<xsl:value-of select="."/>
|
||||
</meta:user-defined>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
|
||||
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
|
||||
xmlns:rs="urn:schemas-microsoft-com:rowset"
|
||||
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
|
||||
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
|
||||
xmlns:z="#RowsetSchema">
|
||||
<xsl:output indent="no" version="1.0" encoding="UTF-8" method="xml"/>
|
||||
<xsl:template match="/">
|
||||
<office:document office:mimetype="application/vnd.oasis.opendocument.spreadsheet" office:version="1.0">
|
||||
<xsl:element name="office:body">
|
||||
<xsl:element name="office:spreadsheet">
|
||||
<!-- Just a single table (sheet) with default name -->
|
||||
<xsl:element name="table:table">
|
||||
<!-- declare columns -->
|
||||
<xsl:for-each select="./xml/s:Schema/s:ElementType[@name='row']/s:AttributeType">
|
||||
<xsl:element name="table:table-column"/>
|
||||
</xsl:for-each>
|
||||
<!-- header row from Schema -->
|
||||
<xsl:element name="table:table-row">
|
||||
<xsl:for-each select="./xml/s:Schema/s:ElementType[@name='row']/s:AttributeType">
|
||||
<xsl:element name="table:table-cell">
|
||||
<xsl:attribute name="office:value-type">string</xsl:attribute>
|
||||
<xsl:attribute name="calcext:value-type">string</xsl:attribute>
|
||||
<xsl:element name="text:p">
|
||||
<!-- User-readable field name may be defined in optional @rs:name -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="./@rs:name">
|
||||
<xsl:value-of select="./@rs:name"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="./@name"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
<!-- Now add data itself -->
|
||||
<xsl:apply-templates select="./xml/rs:data"/>
|
||||
</xsl:element>
|
||||
<!-- Add autofilter to the whole range -->
|
||||
<xsl:element name="table:database-ranges">
|
||||
<xsl:element name="table:database-range">
|
||||
<xsl:attribute name="table:target-range-address">
|
||||
<xsl:call-template name="RangeName">
|
||||
<xsl:with-param name="rowStartNum" select="1"/>
|
||||
<xsl:with-param name="colStartNum" select="1"/>
|
||||
<xsl:with-param name="rowEndNum" select="count(/xml/rs:data/row)+1"/>
|
||||
<xsl:with-param name="colEndNum" select="count(/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType)"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="table:display-filter-buttons">true</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</office:document>
|
||||
</xsl:template>
|
||||
<xsl:template match="rs:data">
|
||||
<xsl:apply-templates select="./row"/>
|
||||
<xsl:apply-templates select="./z:row"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="row|z:row">
|
||||
<xsl:element name="table:table-row">
|
||||
<!-- Store current row in a variable -->
|
||||
<xsl:variable name="thisRow" select="."/>
|
||||
<!-- Get column order from Schema -->
|
||||
<xsl:for-each select="/xml/s:Schema/s:ElementType[@name='row']/s:AttributeType">
|
||||
<xsl:element name="table:table-cell">
|
||||
<xsl:variable name="thisColName" select="./@name"/>
|
||||
<xsl:variable name="thisCellValue">
|
||||
<xsl:value-of select="$thisRow/@*[local-name()=$thisColName]"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="string-length($thisCellValue) > 0">
|
||||
<xsl:variable name="thisColType">
|
||||
<xsl:call-template name="ValTypeFromAttributeType">
|
||||
<xsl:with-param name="AttributeTypeNode" select="."/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="office:value-type"><xsl:value-of select="$thisColType"/></xsl:attribute>
|
||||
<xsl:attribute name="calcext:value-type"><xsl:value-of select="$thisColType"/></xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$thisColType='float'">
|
||||
<xsl:attribute name="office:value"><xsl:value-of select="$thisCellValue"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$thisColType='date'">
|
||||
<!-- We need to convert '2017-04-06 00:40:40' to '2017-04-06T00:40:40', so replace space with 'T' -->
|
||||
<xsl:attribute name="office:date-value"><xsl:value-of select="translate($thisCellValue,' ','T')"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$thisColType='time'">
|
||||
<xsl:attribute name="office:time-value"><xsl:value-of select="$thisCellValue"/></xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$thisColType='boolean'">
|
||||
<xsl:attribute name="office:boolean-value">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$thisCellValue=0">false</xsl:when>
|
||||
<xsl:otherwise>true</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:element name="text:p">
|
||||
<xsl:value-of select="$thisCellValue"/>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
<!-- https://msdn.microsoft.com/en-us/library/ms675943 -->
|
||||
<xsl:template name="ValTypeFromAttributeType">
|
||||
<xsl:param name="AttributeTypeNode"/>
|
||||
<xsl:variable name="thisDataType">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$AttributeTypeNode/@dt:type"><xsl:value-of select="$AttributeTypeNode/@dt:type"/></xsl:when>
|
||||
<xsl:when test="$AttributeTypeNode/s:datatype"><xsl:value-of select="$AttributeTypeNode/s:datatype/@dt:type"/></xsl:when>
|
||||
<xsl:otherwise>string</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="XMLDataType2ValType">
|
||||
<xsl:with-param name="XMLDataType" select="$thisDataType"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
<!-- https://www.w3.org/TR/1998/NOTE-XML-data-0105/#API -->
|
||||
<xsl:template name="XMLDataType2ValType">
|
||||
<xsl:param name="XMLDataType"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$XMLDataType='number'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='int'">float</xsl:when>
|
||||
<xsl:when test="starts-with($XMLDataType, 'float')">float</xsl:when>
|
||||
<xsl:when test="starts-with($XMLDataType, 'fixed')">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='i1'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='i2'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='i4'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='i8'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='ui1'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='ui2'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='ui4'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='ui8'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='r4'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='r8'">float</xsl:when>
|
||||
<xsl:when test="$XMLDataType='datetime'">date</xsl:when>
|
||||
<xsl:when test="starts-with($XMLDataType, 'dateTime')">date</xsl:when>
|
||||
<xsl:when test="starts-with($XMLDataType, 'date')">date</xsl:when>
|
||||
<xsl:when test="starts-with($XMLDataType, 'time')">time</xsl:when>
|
||||
<xsl:when test="$XMLDataType='boolean'">boolean</xsl:when>
|
||||
<xsl:otherwise>string</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- A utility to convert a column number (e.g. 27; 1-based) to column name (like AA) -->
|
||||
<xsl:template name="ColNum2Name">
|
||||
<xsl:param name="num"/>
|
||||
<xsl:if test="$num > 0">
|
||||
<xsl:call-template name="ColNum2Name">
|
||||
<xsl:with-param name="num" select="floor($num div 26)"/>
|
||||
</xsl:call-template>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$num mod 26 = 1">A</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 2">B</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 3">C</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 4">D</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 5">E</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 6">F</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 7">G</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 8">H</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 9">I</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 10">J</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 11">K</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 12">L</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 13">M</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 14">N</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 15">O</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 16">P</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 17">Q</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 18">R</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 19">S</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 20">T</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 21">U</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 22">V</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 23">W</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 24">X</xsl:when>
|
||||
<xsl:when test="$num mod 26 = 25">Y</xsl:when>
|
||||
<xsl:otherwise>Z</xsl:otherwise><!-- 0 -->
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<!-- A utility to convert a cell address (e.g. row 2, column 27) to cell name (like AA2) -->
|
||||
<xsl:template name="CellName">
|
||||
<xsl:param name="rowNum"/>
|
||||
<xsl:param name="colNum"/>
|
||||
<xsl:call-template name="ColNum2Name">
|
||||
<xsl:with-param name="num" select="$colNum"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="$rowNum"/>
|
||||
</xsl:template>
|
||||
<!-- A utility to convert a range given in terms of numbers (e.g. row 1, column 1 to row 2, column 27) to range name (like A1:AA2) -->
|
||||
<xsl:template name="RangeName">
|
||||
<xsl:param name="rowStartNum"/>
|
||||
<xsl:param name="colStartNum"/>
|
||||
<xsl:param name="rowEndNum"/>
|
||||
<xsl:param name="colEndNum"/>
|
||||
<xsl:call-template name="CellName">
|
||||
<xsl:with-param name="rowNum" select="$rowStartNum"/>
|
||||
<xsl:with-param name="colNum" select="$colStartNum"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:call-template name="CellName">
|
||||
<xsl:with-param name="rowNum" select="$rowEndNum"/>
|
||||
<xsl:with-param name="colNum" select="$colEndNum"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
File diff suppressed because it is too large
Load Diff
3494
server/libreoffice/share/xslt/import/uof/uof2odf_presentation.xsl
Normal file
3494
server/libreoffice/share/xslt/import/uof/uof2odf_presentation.xsl
Normal file
File diff suppressed because it is too large
Load Diff
9071
server/libreoffice/share/xslt/import/uof/uof2odf_spreadsheet.xsl
Normal file
9071
server/libreoffice/share/xslt/import/uof/uof2odf_spreadsheet.xsl
Normal file
File diff suppressed because one or more lines are too long
4667
server/libreoffice/share/xslt/import/uof/uof2odf_text.xsl
Normal file
4667
server/libreoffice/share/xslt/import/uof/uof2odf_text.xsl
Normal file
File diff suppressed because it is too large
Load Diff
256
server/libreoffice/share/xslt/import/wordml/wordml2ooo.xsl
Normal file
256
server/libreoffice/share/xslt/import/wordml/wordml2ooo.xsl
Normal file
@@ -0,0 +1,256 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:fla="urn:experimental:fla">
|
||||
<xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
|
||||
<xsl:include href="../../common/measure_conversion.xsl"/>
|
||||
<xsl:include href="../common/ms2ooo_docpr.xsl"/>
|
||||
<xsl:include href="wordml2ooo_text.xsl"/>
|
||||
<xsl:include href="wordml2ooo_settings.xsl"/>
|
||||
<xsl:include href="wordml2ooo_table.xsl"/>
|
||||
<xsl:include href="wordml2ooo_page.xsl"/>
|
||||
<xsl:include href="wordml2ooo_list.xsl"/>
|
||||
<xsl:include href="wordml2ooo_draw.xsl"/>
|
||||
<xsl:include href="wordml2ooo_field.xsl"/>
|
||||
<xsl:include href="wordml2ooo_props.xsl"/>
|
||||
<xsl:key name="paragraph-style" match="w:style[@w:type = 'paragraph']" use="@w:styleId"/>
|
||||
<xsl:key name="heading-style" match="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl]" use="@w:styleId"/>
|
||||
<xsl:variable name="preserve-alien-markup">no</xsl:variable>
|
||||
<xsl:variable name="native-namespace-prefixes">,w,o,v,wx,aml,w10,dt,</xsl:variable>
|
||||
<xsl:variable name="to-dispatch-elements">,wx:sect,wx:sub-section,w:p,w:tbl,w:sectPr,w:r,w:fldSimple,w:hlink,w:t,w:pict,w:br,w:instrText,w:fldChar,w:tab,w:footnote,w:endnote,aml:annotation,w:hlink,w:footnote,w:endnote,w:tblGrid,w:tr,w:tc,wx:pBdrGroup,</xsl:variable>
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="w:wordDocument"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="*" mode="dispatch">
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(contains($native-namespace-prefixes, concat(',', substring-before(name(), ':'), ',')))">
|
||||
<!-- if alien namespace dispatch -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$preserve-alien-markup = 'yes'">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:apply-templates mode="dispatch"/>
|
||||
</xsl:copy>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates mode="dispatch"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($to-dispatch-elements, concat(',',name(),','))">
|
||||
<xsl:apply-templates select="current()"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:wordDocument">
|
||||
<office:document office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.0">
|
||||
<fla:fla.activate/>
|
||||
<xsl:apply-templates select="o:DocumentProperties"/>
|
||||
<xsl:apply-templates select="w:docOleData" mode="init"/>
|
||||
<xsl:apply-templates select="w:docPr"/>
|
||||
<xsl:apply-templates select="w:fonts"/>
|
||||
<xsl:apply-templates select="w:styles"/>
|
||||
<xsl:apply-templates select="w:body"/>
|
||||
<xsl:apply-templates select="w:docOleData" mode="exit"/>
|
||||
</office:document>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:fonts">
|
||||
<xsl:element name="office:font-face-decls">
|
||||
<!-- MS Word's default font declaration, added for Writer automatically. glu -->
|
||||
<style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
|
||||
<style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
|
||||
<style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
|
||||
<style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
|
||||
<xsl:if test="not(w:font[@w:name='StarSymbol'])">
|
||||
<style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="w:font">
|
||||
<xsl:element name="style:font-face">
|
||||
<xsl:attribute name="style:name">
|
||||
<xsl:value-of select="@w:name"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="svg:font-family">
|
||||
<xsl:value-of select="@w:name"/>
|
||||
</xsl:attribute>
|
||||
<!-- added by glu, for process special fonts e.g. Marlett, -->
|
||||
<xsl:if test="w:charset/@w:val = '02'">
|
||||
<xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="w:family">
|
||||
<xsl:choose>
|
||||
<xsl:when test="w:family/@w:val = 'Swiss'">
|
||||
<xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="w:family/@w:val='Modern'">
|
||||
<xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="w:family/@w:val='Roman'">
|
||||
<xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="w:family/@w:val='Script'">
|
||||
<xsl:attribute name="style:font-family-generic">script</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="w:family/@w:val='Decorative'">
|
||||
<xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="w:family/@w:val='System'">
|
||||
<xsl:attribute name="style:font-family-generic">system</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="style:font-family-generic">system</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:if test="w:pitch and string-length(w:pitch/@w:val) > 0">
|
||||
<xsl:attribute name="style:font-pitch">
|
||||
<xsl:choose>
|
||||
<xsl:when test="w:pitch/@w:val = 'default'">variable</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="w:pitch/@w:val"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:styles">
|
||||
<office:styles>
|
||||
<!--The next statement Added by wguo,collect the pict's dash and mark-style.The template is implemented in file wordml2ooo_draw.xsl-->
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style4dash_mark"/>
|
||||
<xsl:apply-templates select="//v:fill" mode="office-style"/>
|
||||
<xsl:call-template name="create-default-paragraph-styles"/>
|
||||
<xsl:call-template name="create-default-text-styles"/>
|
||||
<xsl:call-template name="create-default-frame-style"/>
|
||||
<!-- StarWriter has no default style family 'list'. glu -->
|
||||
<xsl:if test="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl and w:pPr/w:listPr]">
|
||||
<xsl:call-template name="create-outline-style"/>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="w:style[@w:type='table']" mode="table"/>
|
||||
<xsl:apply-templates select="w:style[@w:type='list']" mode="list"/>
|
||||
<xsl:apply-templates select="w:style[@w:type!='list']"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:docPr/w:footnotePr" mode="config"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:docPr/w:endnotePr" mode="config"/>
|
||||
</office:styles>
|
||||
<office:automatic-styles>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:p" mode="style"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:rPr[not(parent::w:pPr)]" mode="style"/>
|
||||
<!--The next statement Added by wguo for the pict's draw-style.The template is implemented in file wordml2ooo_draw.xsl-->
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:tblPr" mode="style"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:gridCol" mode="style"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:trPr" mode="style"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:tcPr" mode="style"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:listPr" mode="style"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="page-layout"/>
|
||||
<xsl:call-template name="default_date_style"/>
|
||||
<!--add for generate the date , time style for date , time field G.Y.-->
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:instrText | /w:wordDocument/w:body//w:fldSimple " mode="style"/>
|
||||
</office:automatic-styles>
|
||||
<office:master-styles>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="master-page"/>
|
||||
</office:master-styles>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:style">
|
||||
<style:style>
|
||||
<xsl:attribute name="style:name">
|
||||
<xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/>
|
||||
</xsl:attribute>
|
||||
<xsl:if test="w:basedOn">
|
||||
<xsl:attribute name="style:parent-style-name">
|
||||
<xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="w:next">
|
||||
<xsl:attribute name="style:next-style-name">
|
||||
<xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&)+/,;?<>{}[]:','_'))"/>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@w:type = 'character'">
|
||||
<xsl:attribute name="style:family">text</xsl:attribute>
|
||||
</xsl:when>
|
||||
<!-- table, paragraph are the same as in Writer . glu -->
|
||||
<xsl:when test="@w:type">
|
||||
<xsl:attribute name="style:family">
|
||||
<xsl:value-of select="@w:type"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="style:family">text</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@w:type = 'table'">
|
||||
<xsl:element name="style:table-properties">
|
||||
<!-- xsl:apply-templates select="w:tblPr" mode="style"/ -->
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:when test="@w:type = 'character' ">
|
||||
<xsl:element name="style:text-properties">
|
||||
<!--
|
||||
<xsl:apply-templates select="w:pPr/w:rPr"/>
|
||||
<xsl:apply-templates select="w:rPr"/>
|
||||
-->
|
||||
<xsl:for-each select="w:rPr">
|
||||
<xsl:call-template name="text-properties"/>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:element name="style:paragraph-properties">
|
||||
<xsl:apply-templates select="w:pPr"/>
|
||||
</xsl:element>
|
||||
<xsl:element name="style:text-properties">
|
||||
<xsl:apply-templates select="w:rPr"/>
|
||||
<xsl:apply-templates select="w:pPr/w:rPr"/>
|
||||
</xsl:element>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</style:style>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:body">
|
||||
<xsl:element name="office:body">
|
||||
<xsl:element name="office:text">
|
||||
<!-- to add the sequence variable declaration at the beginning of the office:body G.Y.-->
|
||||
<text:sequence-decls>
|
||||
<xsl:call-template name="default_sequence_declaration"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,3) = 'SEQ' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,3) = 'SEQ' ] " mode="sequence_declare"/>
|
||||
</text:sequence-decls>
|
||||
<!-- add the user field variables declare for Docproperty fields importing G.Y.-->
|
||||
<text:user-field-decls>
|
||||
<xsl:call-template name="user_fields_declare_docproperty"/>
|
||||
</text:user-field-decls>
|
||||
<xsl:apply-templates mode="dispatch"/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
<xsl:template match="wx:sect">
|
||||
<xsl:apply-templates mode="dispatch"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="wx:sub-section">
|
||||
<xsl:apply-templates mode="dispatch"/>
|
||||
</xsl:template>
|
||||
<xsl:template name="create-default-frame-style">
|
||||
<!--add for default frame style -->
|
||||
<style:style style:name="Frame" style:family="graphic">
|
||||
<style:graphic-properties text:anchor-type="paragraph" svg:x="0in" svg:y="0in" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/>
|
||||
</style:style>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,275 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
|
||||
<xsl:template name="ms_word_draw_map2ooo_custom_draw">
|
||||
<xsl:param name="ms_word_draw_type"/>
|
||||
<!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t5' ">
|
||||
<xsl:value-of select=" 'isosceles-triangle'"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type ='#_x0000_t6' ">
|
||||
<xsl:value-of select=" 'right-triangle' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t8' ">
|
||||
<xsl:value-of select=" 'trapezoid' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t4' ">
|
||||
<xsl:value-of select=" 'diamond' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t9' ">
|
||||
<xsl:value-of select=" 'hexagon' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t7' ">
|
||||
<xsl:value-of select="'parallelogram' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t56' ">
|
||||
<xsl:value-of select=" 'pentagon' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t10' ">
|
||||
<xsl:value-of select=" 'octagon' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t11' ">
|
||||
<xsl:value-of select=" 'cross' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t23' ">
|
||||
<xsl:value-of select=" 'ring' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t95' ">
|
||||
<xsl:value-of select=" 'block-arc' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t22' ">
|
||||
<xsl:value-of select=" 'can' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t16' ">
|
||||
<xsl:value-of select=" 'cube' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t65' ">
|
||||
<xsl:value-of select=" 'paper' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t96' ">
|
||||
<xsl:value-of select=" 'smiley' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t183' ">
|
||||
<xsl:value-of select=" 'sun' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t184' ">
|
||||
<xsl:value-of select=" 'moon' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t74' ">
|
||||
<xsl:value-of select=" 'heart' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t57' ">
|
||||
<xsl:value-of select=" 'forbidden' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type ='#_x0000_t85' ">
|
||||
<xsl:value-of select=" 'left-bracket' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t86' ">
|
||||
<xsl:value-of select=" 'right-bracket' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t87' ">
|
||||
<xsl:value-of select=" 'left-brace' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t88' ">
|
||||
<xsl:value-of select=" 'right-brace' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t185' ">
|
||||
<xsl:value-of select=" 'bracket-pair' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t186' ">
|
||||
<xsl:value-of select=" 'brace-pair' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t189' ">
|
||||
<xsl:value-of select=" 'quad-bevel' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t66' ">
|
||||
<xsl:value-of select=" 'left-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t67' ">
|
||||
<xsl:value-of select=" 'down-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t68' ">
|
||||
<xsl:value-of select=" 'up-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t13' ">
|
||||
<xsl:value-of select=" 'right-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t69' ">
|
||||
<xsl:value-of select=" 'left-right-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t70' ">
|
||||
<xsl:value-of select=" 'up-down-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t89' ">
|
||||
<xsl:value-of select=" 'mso-spt89' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t76' ">
|
||||
<xsl:value-of select=" 'quad-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t94' ">
|
||||
<xsl:value-of select=" 'notched-right-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
|
||||
<xsl:value-of select=" 'pentagon-right' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t55' ">
|
||||
<xsl:value-of select=" 'chevron' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t79' ">
|
||||
<xsl:value-of select=" 'up-arrow-callout' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t80' ">
|
||||
<xsl:value-of select=" 'down-arrow-callout' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t82' ">
|
||||
<xsl:value-of select=" 'up-down-arrow-callout' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t103' ">
|
||||
<xsl:value-of select=" 'circular-arrow' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t109' ">
|
||||
<xsl:value-of select=" 'flowchart-process' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
|
||||
<xsl:value-of select=" 'flowchart-alternate-process' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t110' ">
|
||||
<xsl:value-of select=" 'flowchart-decision' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t111' ">
|
||||
<xsl:value-of select=" 'flowchart-data' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t112' ">
|
||||
<xsl:value-of select=" 'flowchart-predefined-process' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t113' ">
|
||||
<xsl:value-of select=" 'flowchart-internal-storage' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t114' ">
|
||||
<xsl:value-of select=" 'flowchart-document' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t115' ">
|
||||
<xsl:value-of select=" 'flowchart-multidocument' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
|
||||
<xsl:value-of select=" 'flowchart-terminator' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t117' ">
|
||||
<xsl:value-of select=" 'flowchart-preparation' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t118' ">
|
||||
<xsl:value-of select=" 'flowchart-manual-input' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t119' ">
|
||||
<xsl:value-of select=" 'flowchart-manual-operation' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t120' ">
|
||||
<xsl:value-of select=" 'flowchart-connector' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
|
||||
<xsl:value-of select=" 'flowchart-off-page-connector' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t121' ">
|
||||
<xsl:value-of select=" 'flowchart-card' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t122' ">
|
||||
<xsl:value-of select=" 'flowchart-punched-tape' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t123' ">
|
||||
<xsl:value-of select=" 'flowchart-summing-junction' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t124' ">
|
||||
<xsl:value-of select=" 'flowchart-or' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t125' ">
|
||||
<xsl:value-of select=" 'flowchart-collate' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t126' ">
|
||||
<xsl:value-of select=" 'flowchart-sort' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t127' ">
|
||||
<xsl:value-of select=" 'flowchart-extract' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t128' ">
|
||||
<xsl:value-of select=" 'flowchart-merge' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t130' ">
|
||||
<xsl:value-of select=" 'flowchart-stored-data' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t135' ">
|
||||
<xsl:value-of select=" 'flowchart-delay' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t131' ">
|
||||
<xsl:value-of select=" 'flowchart-sequential-access' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t132' ">
|
||||
<xsl:value-of select=" 'flowchart-magnetic-disk' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t133' ">
|
||||
<xsl:value-of select=" 'flowchart-direct-access-storage' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t134' ">
|
||||
<xsl:value-of select=" 'flowchart-display' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t61' ">
|
||||
<xsl:value-of select=" 'rectangular-callout' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t62' ">
|
||||
<xsl:value-of select=" 'round-rectangular-callout' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t63' ">
|
||||
<xsl:value-of select=" 'round-callout' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t106' ">
|
||||
<xsl:value-of select=" 'cloud-callout' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t50' ">
|
||||
<xsl:value-of select=" 'line-callout-1' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t51' ">
|
||||
<xsl:value-of select=" 'line-callout-2' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t47' ">
|
||||
<xsl:value-of select=" 'line-callout-3' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t72' ">
|
||||
<xsl:value-of select=" 'bang' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t187' ">
|
||||
<xsl:value-of select=" 'star4' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t12' ">
|
||||
<xsl:value-of select=" 'star5' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t58' ">
|
||||
<xsl:value-of select=" 'star8' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t92' ">
|
||||
<xsl:value-of select=" 'star24' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t97' ">
|
||||
<xsl:value-of select=" 'vertical-scroll' "/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$ms_word_draw_type = '#_x0000_t98' ">
|
||||
<xsl:value-of select=" 'horizontal-scroll' "/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
2170
server/libreoffice/share/xslt/import/wordml/wordml2ooo_draw.xsl
Normal file
2170
server/libreoffice/share/xslt/import/wordml/wordml2ooo_draw.xsl
Normal file
File diff suppressed because it is too large
Load Diff
1581
server/libreoffice/share/xslt/import/wordml/wordml2ooo_field.xsl
Normal file
1581
server/libreoffice/share/xslt/import/wordml/wordml2ooo_field.xsl
Normal file
File diff suppressed because it is too large
Load Diff
648
server/libreoffice/share/xslt/import/wordml/wordml2ooo_list.xsl
Normal file
648
server/libreoffice/share/xslt/import/wordml/wordml2ooo_list.xsl
Normal file
File diff suppressed because it is too large
Load Diff
402
server/libreoffice/share/xslt/import/wordml/wordml2ooo_page.xsl
Normal file
402
server/libreoffice/share/xslt/import/wordml/wordml2ooo_page.xsl
Normal file
@@ -0,0 +1,402 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
|
||||
<xsl:template match="w:footnotePr" mode="config">
|
||||
<text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol">
|
||||
<xsl:if test="w:pos">
|
||||
<xsl:choose>
|
||||
<xsl:when test="w:pos/@w:val = 'beneath-text'">
|
||||
<xsl:attribute name="text:footnotes-position">document</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="text:footnotes-position">page</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:if test="w:numStart">
|
||||
<xsl:choose>
|
||||
<xsl:when test="w:numStart/@w:val - 1 > 0">
|
||||
<xsl:attribute name="text:start-value">
|
||||
<xsl:value-of select="w:numStart/@w:val - 1"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="text:start-value">
|
||||
<xsl:value-of select=" '1' "/>
|
||||
</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute-->
|
||||
</xsl:if>
|
||||
<xsl:if test="w:numFmt">
|
||||
<xsl:call-template name="convert-number-format">
|
||||
<xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<xsl:if test="w:numRestart">
|
||||
<xsl:choose>
|
||||
<xsl:when test="w:numRestart/@w:val = 'continuous'">
|
||||
<xsl:attribute name="text:start-numbering-at">document</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="w:numRestart/@w:val = 'each-sect'">
|
||||
<xsl:attribute name="text:start-numbering-at">chapter</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="text:start-numbering-at">page</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<!--
|
||||
<xsl:if test="w:footnote[@w:type = 'continuation-separator']">
|
||||
<text:footnote-continuation-notice-backward>
|
||||
<xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-separator'])"/>
|
||||
</text:footnote-continuation-notice-backward>
|
||||
</xsl:if>
|
||||
<xsl:if test="w:footnote[@w:type = 'continuation-notice']">
|
||||
<text:footnote-continuation-notice-forward>
|
||||
<xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-notice'])"/>
|
||||
</text:footnote-continuation-notice-forward>
|
||||
</xsl:if>
|
||||
-->
|
||||
</text:notes-configuration>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:endnotePr" mode="config">
|
||||
<text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol">
|
||||
<xsl:if test="w:numStart">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(w:numStart/@w:val - 1) > 0">
|
||||
<xsl:attribute name="text:start-value">
|
||||
<xsl:value-of select="w:numStart/@w:val - 1"/>
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="text:start-value">
|
||||
<xsl:value-of select=" '1' "/>
|
||||
</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute -->
|
||||
</xsl:if>
|
||||
<xsl:if test="w:numFmt">
|
||||
<xsl:call-template name="convert-number-format">
|
||||
<xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</text:notes-configuration>
|
||||
</xsl:template>
|
||||
<xsl:template name="convert-number-format">
|
||||
<xsl:param name="number-format"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-zero'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">0</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">.</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-enclosed-paren'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">(</xsl:attribute>
|
||||
<xsl:attribute name="style:num-suffix">)</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'number-in-dash'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">-</xsl:attribute>
|
||||
<xsl:attribute name="style:num-suffix">-</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'upper-letter'">
|
||||
<xsl:attribute name="style:num-format">A</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'lower-letter'">
|
||||
<xsl:attribute name="style:num-format">a</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'upper-roman'">
|
||||
<xsl:attribute name="style:num-format">I</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'lower-roman'">
|
||||
<xsl:attribute name="style:num-format">i</xsl:attribute>
|
||||
</xsl:when>
|
||||
<!-- ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
|
||||
vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting -->
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:bgPict">
|
||||
<xsl:if test="w:background/@w:bgcolor">
|
||||
<xsl:attribute name="fo:background-color">
|
||||
<xsl:call-template name="MapConstColor">
|
||||
<xsl:with-param name="color" select="w:background/@w:bgcolor"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="w:background/@w:background">
|
||||
<style:background-image>
|
||||
<office:binary-data>
|
||||
<xsl:variable name="the-image" select="key('imagedata',w:background/@w:background)"/>
|
||||
<xsl:value-of select="translate($the-image/text(),'	  ','' ) "/>
|
||||
</office:binary-data>
|
||||
</style:background-image>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:sectPr" mode="page-layout">
|
||||
<style:page-layout>
|
||||
<xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr" format="1"/>
|
||||
</xsl:attribute>
|
||||
<style:page-layout-properties>
|
||||
<xsl:call-template name="page-layout-properties"/>
|
||||
<xsl:apply-templates select="/w:wordDocument/w:bgPict"/>
|
||||
</style:page-layout-properties>
|
||||
<style:header-style>
|
||||
<style:header-footer-properties style:dynamic-spacing="true" fo:margin-bottom="0">
|
||||
<xsl:variable name="header-margin">
|
||||
<xsl:choose>
|
||||
<xsl:when test="w:pgMar/@w:header">
|
||||
<xsl:value-of select="w:pgMar/@w:header"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>720</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="header-margin-diff">
|
||||
<xsl:value-of select="w:pgMar/@w:top - $header-margin"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="min-height">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$header-margin-diff > 0">
|
||||
<xsl:value-of select="$header-margin-diff div 567.0"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:attribute name="fo:min-height">
|
||||
<xsl:value-of select="concat($min-height, 'cm')"/>
|
||||
</xsl:attribute>
|
||||
</style:header-footer-properties>
|
||||
</style:header-style>
|
||||
</style:page-layout>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:sectPr" mode="master-page">
|
||||
<!-- style:page-layout style:style-->
|
||||
|
||||
<xsl:variable name="master-page-number">
|
||||
<xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any" format="1"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$master-page-number = '1'">
|
||||
<style:master-page style:next-style-name="Standard-1" style:page-layout-name="pm1" style:display-name="First Page" style:name="First_20_Page">
|
||||
<style:header>
|
||||
<xsl:apply-templates select="w:hdr[@w:type='first']/child::*" mode="dispatch"/>
|
||||
</style:header>
|
||||
<style:footer>
|
||||
<xsl:apply-templates select="w:ftr[@w:type='first']/child::*" mode="dispatch"/>
|
||||
</style:footer>
|
||||
</style:master-page>
|
||||
</xsl:if>
|
||||
<xsl:element name="style:master-page">
|
||||
<xsl:attribute name="style:name">Standard-<xsl:value-of select="$master-page-number"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="style:page-layout-name">
|
||||
<xsl:value-of select="concat('pm', $master-page-number)"/>
|
||||
</xsl:attribute>
|
||||
|
||||
<style:header>
|
||||
<xsl:apply-templates select="w:hdr[@w:type='odd']/child::*" mode="dispatch"/>
|
||||
</style:header>
|
||||
<style:header-left>
|
||||
<xsl:apply-templates select="w:hdr[@w:type='even']/child::*" mode="dispatch"/>
|
||||
</style:header-left>
|
||||
<style:footer>
|
||||
<xsl:apply-templates select="w:ftr[@w:type='odd']/child::*" mode="dispatch"/>
|
||||
</style:footer>
|
||||
<style:footer-left>
|
||||
<xsl:apply-templates select="w:ftr[@w:type='even']/child::*" mode="dispatch"/>
|
||||
</style:footer-left>
|
||||
|
||||
<!-- Headers and footers-->
|
||||
<!--
|
||||
<style:header-style>
|
||||
<style:header-footer-properties>
|
||||
<xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:header,'twip')"/></xsl:call-template>cm</xsl:attribute>
|
||||
<xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute>
|
||||
<xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
|
||||
</style:header-footer-properties>
|
||||
</style:header-style>
|
||||
<style:footer-style>
|
||||
<style:header-footer-properties>
|
||||
<xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'twip')"/></xsl:call-template>cm</xsl:attribute>
|
||||
<xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute>
|
||||
<xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
|
||||
</style:header-footer-properties>
|
||||
</style:footer-style>
|
||||
-->
|
||||
|
||||
<!-- any examples for w:titlePg usage? -->
|
||||
<xsl:if test="not(w:titlePg)">
|
||||
<xsl:apply-templates select="w:hdr[@w:type='odd']"/>
|
||||
<xsl:apply-templates select="w:hdr[@w:type='even']"/>
|
||||
<xsl:apply-templates select="w:ftr[@w:type='odd']"/>
|
||||
<xsl:apply-templates select="w:ftr[@w:type='even']"/>
|
||||
</xsl:if>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
<xsl:template match="w:hdr">
|
||||
<!--
|
||||
<xsl:choose>
|
||||
<xsl:when test="@w:type = 'odd'">
|
||||
<style:header>
|
||||
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
|
||||
</style:header>
|
||||
</xsl:when>
|
||||
<xsl:when test="@w:type = 'even'">
|
||||
<style:header>
|
||||
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
|
||||
</style:header>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
-->
|
||||
</xsl:template>
|
||||
<xsl:template match="w:ftr">
|
||||
<!--
|
||||
<xsl:choose>
|
||||
<xsl:when test="@w:type = 'odd'">
|
||||
<style:footer>
|
||||
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
|
||||
</style:footer>
|
||||
</xsl:when>
|
||||
<xsl:when test="@w:type = 'even'">
|
||||
<style:footer-left>
|
||||
<xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
|
||||
</style:footer-left>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
-->
|
||||
</xsl:template>
|
||||
<xsl:template match="wx:pBdrGroup">
|
||||
<xsl:apply-templates mode="dispatch"/>
|
||||
</xsl:template>
|
||||
<!-- xsl:template name="convert-number-format">
|
||||
<xsl:param name="number-format"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-zero'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">0</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">.</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-enclosed-paren'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">(</xsl:attribute>
|
||||
<xsl:attribute name="style:num-suffix">)</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'number-in-dash'">
|
||||
<xsl:attribute name="style:num-format">1</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">-</xsl:attribute>
|
||||
<xsl:attribute name="style:num-suffix">-</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'upper-letter'">
|
||||
<xsl:attribute name="style:num-format">A</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'lower-letter'">
|
||||
<xsl:attribute name="style:num-format">a</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'upper-roman'">
|
||||
<xsl:attribute name="style:num-format">I</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'lower-roman'">
|
||||
<xsl:attribute name="style:num-format">i</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-full-width' or $number-format = 'decimal-full-width2'">
|
||||
<xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'decimal-enclosed-circle-chinese' or $number-format = 'decimal-enclosed-circle'">
|
||||
<xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ideograph-enclosed-circle'">
|
||||
<xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
|
||||
<xsl:attribute name="style:num-prefix">(</xsl:attribute>
|
||||
<xsl:attribute name="style:num-suffix">)</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'chinese-counting-thousand' or $number-format = 'ideograph-digital' or $number-format = 'japanese-counting' or $number-format = 'japanese-digital-ten-thousand' or $number-format = 'taiwanese-counting-thousand' or $number-format = 'taiwanese-counting' or $number-format = 'taiwanese-digital' or $number-format = 'chinese-counting' or $number-format = 'korean-digital2' or $number-format = 'chinese-not-impl'">
|
||||
<xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'chinese-legal-simplified'">
|
||||
<xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ideograph-legal-traditional'">
|
||||
<xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ideograph-traditional'">
|
||||
<xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ideograph-zodiac'">
|
||||
<xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'japanese-legal'">
|
||||
<xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'aiueo-full-width'">
|
||||
<xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'aiueo'">
|
||||
<xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'iroha-full-width'">
|
||||
<xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'iroha'">
|
||||
<xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'korean-digital' or $number-format = 'korean-counting' or $number-format = 'korean-legal'">
|
||||
<xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'chosung'">
|
||||
<xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'ganada'">
|
||||
<xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'arabic-alpha' or $number-format = 'arabic-abjad'">
|
||||
<xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'thai-letters' or $number-format = 'thai-numbers' or $number-format = 'thai-counting'">
|
||||
<xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'hebrew-1'">
|
||||
<xsl:attribute name="style:num-format">א, י, ק, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$number-format = 'hebrew-2'">
|
||||
<xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
|
||||
</xsl:when>
|
||||
< ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
|
||||
vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting >
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template -->
|
||||
</xsl:stylesheet>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user