This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new b7dab39063 pre-commit(mixed-line-ending): autofix xsl files (#305)
b7dab39063 is described below
commit b7dab39063197aa5cd5955694aac5f87230c7736
Author: John Bampton <[email protected]>
AuthorDate: Sat Mar 1 04:04:15 2025 +1000
pre-commit(mixed-line-ending): autofix xsl files (#305)
---
.pre-commit-config.yaml | 2 +-
.../source/xslt/odf2xhtml/export/common/body.xsl | 836 ++++++++++-----------
.../export/common/styles/style_mapping_css.xsl | 660 ++++++++--------
3 files changed, 749 insertions(+), 749 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 08d675fc1b..d8fecc4426 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -35,7 +35,7 @@ repos:
- id: end-of-file-fixer
files:
(m|M)akefile$|\.(bat|c|dxp|h|hrc|hxx|idl|in|ini|java|md|mk|pl|pm|py|rc|sh|xcs|xdl|xhp|xmi|xsd|ya?ml)$|^ext_libraries/.*$|^test/.*$
- id: mixed-line-ending
- files:
^main/.*\.(c|h)xx$|^main/.*\.mk$|^main/.*\.java$|^main/accessibility/.*$|^main/afms/.*$
+ files:
^main/.*\.(c|h)xx$|^main/.*\.mk$|^main/.*\.java$|^main/.*\.xslt?|^main/.*\.ya?ml$|^main/accessibility/.*$|^main/afms/.*$|^main/animations/.*$
- id: trailing-whitespace
files: \.(pl|sh|ya?ml)$
- repo: https://github.com/codespell-project/codespell
diff --git a/main/filter/source/xslt/odf2xhtml/export/common/body.xsl
b/main/filter/source/xslt/odf2xhtml/export/common/body.xsl
index 7e52b03053..74f1c675e1 100644
--- a/main/filter/source/xslt/odf2xhtml/export/common/body.xsl
+++ b/main/filter/source/xslt/odf2xhtml/export/common/body.xsl
@@ -1,418 +1,418 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************
- *
- * 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
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- ***********************************************************-->
-
-
-<!--
- For further documentation and updates visit
https://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" xml [...]
-
-
- <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">
- <xsl:param name="globalData"/>
- <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: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:choose>
- <!-- internal AOO URL used in content tables -->
- <xsl:when test="contains($href, '%7Coutline')">
- <!-- the simple workaround for content tables
in a single document is to create create an anchor from every heading element
- work-around 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:text>data:image/*;base64,</xsl:text><xsl:value-of
select="office:binary-data"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <!-- in case of packed OpenOffice
document -->
- <xsl:when
test="starts-with($sourceBaseURL, 'jar:') or $isPackageFormat">
- <xsl:choose>
- <!-- for images
relative to OpenOffice 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 OpenOffice 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: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>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ***********************************************************-->
+
+
+<!--
+ For further documentation and updates visit
https://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" xml [...]
+
+
+ <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">
+ <xsl:param name="globalData"/>
+ <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: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:choose>
+ <!-- internal AOO URL used in content tables -->
+ <xsl:when test="contains($href, '%7Coutline')">
+ <!-- the simple workaround for content tables
in a single document is to create create an anchor from every heading element
+ work-around 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:text>data:image/*;base64,</xsl:text><xsl:value-of
select="office:binary-data"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <!-- in case of packed OpenOffice
document -->
+ <xsl:when
test="starts-with($sourceBaseURL, 'jar:') or $isPackageFormat">
+ <xsl:choose>
+ <!-- for images
relative to OpenOffice 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 OpenOffice 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: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>
diff --git
a/main/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
b/main/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
index a91ab9a9a9..81c3570b9e 100644
---
a/main/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
+++
b/main/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,332 +20,332 @@
*
***********************************************************-->
-
-<!--
- 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" xml [...]
-
-
- <!-- *** 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:value-of select="$borderWidthFixed"/>
- <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">
- <xsl:value-of select="substring-after(name(), ':')"/>
- <xsl:text>:</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>; </xsl:text>
- </xsl:template>
-
- <!-- 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="substring-after(name(), ':')"/>
- <xsl:text>:</xsl:text>
- <!-- Map once erroneusly 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:left ! important;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>text-align:right ! 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:value-of select="."/>
- <xsl:text>; </xsl:text>
- </xsl:template>
- <!-- *** Properties with a no 'fo:' or 'style:' prefix *** -->
- <xsl:template match="@table:align">
- <xsl:choose>
- <xsl:when test=".='left'">
- <!-- Note: problems with meeting minutes example
- <xsl:text>float:right; </xsl:text>
--></xsl:when>
- <xsl:when test=".='right'">
- <!-- Note: problems with meeting minutes example
- <xsl:text>float:left; </xsl:text> --></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: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="$minimalBorderWidth"/>
- <xsl:text>cm</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="$borderWidthByCentimeter"/>
- <xsl:text>cm</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-</xsl:stylesheet>
-
+
+<!--
+ 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" xml [...]
+
+
+ <!-- *** 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:value-of select="$borderWidthFixed"/>
+ <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">
+ <xsl:value-of select="substring-after(name(), ':')"/>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <!-- 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="substring-after(name(), ':')"/>
+ <xsl:text>:</xsl:text>
+ <!-- Map once erroneusly 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:left ! important;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:right ! 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:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+ <!-- *** Properties with a no 'fo:' or 'style:' prefix *** -->
+ <xsl:template match="@table:align">
+ <xsl:choose>
+ <xsl:when test=".='left'">
+ <!-- Note: problems with meeting minutes example
+ <xsl:text>float:right; </xsl:text>
--></xsl:when>
+ <xsl:when test=".='right'">
+ <!-- Note: problems with meeting minutes example
+ <xsl:text>float:left; </xsl:text> --></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: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="$minimalBorderWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="$borderWidthByCentimeter"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
+