diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-12-01 09:35:41 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-12-01 16:10:14 +0100 |
commit | f717460c16cb558e8049f906771fe223b6eb69f9 (patch) | |
tree | d8d9250c515c4ddbe790dc8bc13b1dc14375bb73 /filter | |
parent | bdf1f65efad90a727b51ab3cb69d0af69d7eb1cb (diff) |
tdf#113696 XHTML Export: Prefer fallback graphic
Which is usually png and browsers can read that,
but they can't read our internal metafile format (svm)
Change-Id: Idfd82da630ead69f508b74285081e32315030825
Reviewed-on: https://gerrit.libreoffice.org/45590
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl index 8cce4595d3ea..f594ebcd29e5 100644 --- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl +++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl @@ -1487,27 +1487,32 @@ <xsl:template match="draw:image | draw:object-ole"> <xsl:param name="globalData"/> - <xsl:choose> - <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base"> - <!-- XHTML does not allow the mapped elements to contain paragraphs --> - <xsl:call-template name="create-image-element"> - <xsl:with-param name="globalData" select="$globalData"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself. - A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph --> - <xsl:element name="p"> - <xsl:apply-templates select="@draw:style-name"> - <xsl:with-param name="globalData" select="$globalData"/> - </xsl:apply-templates> - - <xsl:call-template name="create-image-element"> - <xsl:with-param name="globalData" select="$globalData"/> - </xsl:call-template> - </xsl:element> - </xsl:otherwise> - </xsl:choose> + <!-- If there is a replacement graphic, we take it. + It is a png which browsers are more likely able to render than the original graphic + which might have arbitrary formats. --> + <xsl:if test="not(following-sibling::draw:image)"> + <xsl:choose> + <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base"> + <!-- XHTML does not allow the mapped elements to contain paragraphs --> + <xsl:call-template name="create-image-element"> + <xsl:with-param name="globalData" select="$globalData"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself. + A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph --> + <xsl:element name="p"> + <xsl:apply-templates select="@draw:style-name"> + <xsl:with-param name="globalData" select="$globalData"/> + </xsl:apply-templates> + + <xsl:call-template name="create-image-element"> + <xsl:with-param name="globalData" select="$globalData"/> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:if> </xsl:template> <xsl:template name="create-image-element"> |