filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl   |   71 
++++++++--
 filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl |   17 
+-
 filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl             |    5 
 3 files changed, 78 insertions(+), 15 deletions(-)

New commits:
commit 8295682360042fd75c89066bb5d90ed58869c9e0
Author:     Svante Schubert <svante.schub...@gmail.com>
AuthorDate: Mon Jul 10 22:33:13 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jul 12 10:57:42 2023 +0200

    tdf#156093 filter: XHTML export: Enabling previous test files ...
    
    ... again and neglecting @draw:fill-color in base style to avoid
    duplication of fo:background
    
    Change-Id: I4905a7f8371d422944172140ab04c6bad6e7bd77
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154296
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 0ee798d3a4cc90629e96f0f6c780c2887ae521d0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154310

diff --git 
a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl 
b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
index a120ab68052c..bdad6da4bf45 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -576,7 +576,7 @@
 
            <!--All current attributes will override already inserted 
attributes of the same name
                XSLT Spec: "Adding an attribute to an element replaces any 
existing attribute of that element with the same expanded-name." -->
-            <xsl:for-each select="*/@*[name() != 'style:font-size-rel'][name() 
!= 'fo:border']">
+            <xsl:for-each select="*/@*[name() != 'style:font-size-rel'][name() 
!= 'fo:border'][name() != 'draw:fill-color']">
                 <xsl:copy-of select="." />
             </xsl:for-each>
 
commit e4fd1eb62005eece26f712204b3ed8c28b9d4da4
Author:     Svante Schubert <svante.schub...@gmail.com>
AuthorDate: Mon Jul 10 20:31:32 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jul 12 10:57:34 2023 +0200

    tdf#156093 filter: XHTML export: Enabled all three different ...
    
    ... influences for CSS background-color: fo:background-color,
    draw:fill-color and draw:fill='none' the latter is the value
    'transparent'
    
    Change-Id: I8891bbaca224ad5f4340cded93182523e396223f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154295
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit e2735d07e4bd9af0edfa561112393b9ae92ff923)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154269

diff --git 
a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl 
b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
index bac0c5963ccd..a120ab68052c 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -504,6 +504,8 @@
     </xsl:template>
 
 
+    <!-- Context is <style:style> with all style properties elements 
containing attributes, accessed by */@prop 
+        overwriting the ODF style properties that are being inherited from the 
'inheritedStyleProperties' parameter! -->
     <xsl:template name="create-inherited-style-properties">
         <xsl:param name="inheritedStyleProperties" />
 
@@ -511,9 +513,59 @@
            <!-- Writing all inherited style properties -->
             <xsl:for-each select="$inheritedStyleProperties/@*">
                 <xsl:sort select="name()" />
-                <xsl:copy-of select="." />
+
+                <!-- Normalization three ODF attributes to one ODF attribute 
fo:background color (only temporary not ODF conform but eases mapping to ODF)
+                There are two different background color: 
+                    1) fo:background-color
+                    2) draw:fill-color
+                    mapped to one in CSS.
+                    In addition if there is the attribute @draw:fill="none" 
the background is 'transparent' -->
+                <xsl:choose>
+                    <xsl:when test="name() = 'draw:fill-color' or name() = 
'fo:background-color' or name() = 'draw:fill'">
+                        <xsl:choose>
+                            <xsl:when 
test="$inheritedStyleProperties/@draw:fill='none'">
+                                <xsl:attribute 
name="fo:background-color">transparent</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:choose>
+                                    <xsl:when test="name()!='draw:fill'">
+                                        <xsl:attribute 
name="fo:background-color"><xsl:value-of select="."/></xsl:attribute>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:attribute 
name="fo:background-color">transparent</xsl:attribute>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:copy-of select="." />
+                    </xsl:otherwise>
+                </xsl:choose>
             </xsl:for-each>
 
+            <xsl:if test="*/@draw:fill-color or */@fo:background-color or 
*/@draw:fill">                
+                <xsl:choose>
+                    <xsl:when test="*/@draw:fill='none'">
+                        <xsl:attribute 
name="fo:background-color">transparent</xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:choose>
+                            <xsl:when test="*/@draw:fill-color">
+                                <xsl:attribute 
name="fo:background-color"><xsl:value-of 
select="*/@draw:fill-color"/></xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="*/@fo:background-color">
+                                <xsl:attribute 
name="fo:background-color"><xsl:value-of 
select="*/@fo:background-color"/></xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute 
name="fo:background-color">transparent</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:if>
+
+
             <!-- split border into border parts for better activation-check on 
style:joint-border feature -->
             <xsl:if test="*/@fo:border">
                 <xsl:attribute name="fo:border-top"><xsl:value-of 
select="*/@fo:border"/></xsl:attribute>
@@ -568,21 +620,20 @@
     <xsl:template name="write-collected-styles">
         <xsl:param name="globalData" />
 
-        <xsl:message>&lt;all-doc-styles&gt;</xsl:message>
+        <xsl:message>all-doc-styles:start</xsl:message>
         <xsl:for-each select="$globalData/all-doc-styles/style">
-            <xsl:message>&lt;style</xsl:message>
-            <xsl:message>style:family="<xsl:value-of 
select="current()/@style:family" />"&gt;</xsl:message>
-            <xsl:message>style:name="<xsl:value-of 
select="current()/@style:name" />" </xsl:message>
-            <xsl:message>   &lt;*</xsl:message>
+            <xsl:message>***style:start</xsl:message>
+            <xsl:message>style:family="<xsl:value-of 
select="current()/@style:family" />"</xsl:message>
+            <xsl:message>style:name="<xsl:value-of 
select="current()/@style:name" />"</xsl:message>
+            <xsl:message>   with properties:</xsl:message>
             <xsl:for-each select="*/@*">
                 <xsl:message>
                     <xsl:text></xsl:text>
                     <xsl:value-of select="name()" />="<xsl:value-of select="." 
/>"</xsl:message>
             </xsl:for-each>
-            <xsl:message>/&gt;</xsl:message>
-            <xsl:message>&lt;/style&gt;</xsl:message>
+            <xsl:message>***style:end</xsl:message>
         </xsl:for-each>
-        <xsl:message>&lt;/all-doc-styles&gt;</xsl:message>
+        <xsl:message>all-doc-styles:end</xsl:message>
     </xsl:template>
 
     <xsl:template name="map-odf-style-properties">
diff --git 
a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl 
b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
index 06e22d7e2fed..56b17331a0b9 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
@@ -22,11 +22,18 @@
 <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:s
 tyle="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 | @draw:fill-color">
-        <xsl:text>background-color:</xsl:text>
-        <xsl:value-of select="."/>
-        <xsl:text>; </xsl:text>
+    <!-- *** Background color handling *** -->
+    <xsl:template match="@fo:background-color | @draw:fill-color | @draw:fill">
+        <xsl:choose>
+            <xsl:when test="@draw:fill='none'">
+                <xsl:text>background-color:transparent; </xsl:text>
+            </xsl:when>
+            <xsl:when test="name()!='draw:fill'">
+                <xsl:text>background-color:</xsl:text>
+                <xsl:value-of select="."/>
+                <xsl:text>; </xsl:text>
+            </xsl:when>
+        </xsl:choose>
     </xsl:template>
 
     <xsl:template match="@fo:border | @fo:border-top | @fo:border-bottom | 
@fo:border-left | @fo:border-right">
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
index d65831a8338c..b320f9c22979 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
@@ -145,6 +145,11 @@
     <xsl:template name="start-main">
         <xsl:param name="globalData" />
 
+    <!-- disable style collection debug 
+        <xsl:call-template name="write-collected-styles">
+            <xsl:with-param name="globalData" select="$globalData" />
+        </xsl:call-template> -->
+
         <xsl:variable name="lang">
              <xsl:choose>
                  <xsl:when 
test="$globalData/meta-file/*/office:meta/dc:language">

Reply via email to