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>
This commit is contained in:
Samuel Mehrbrodt 2017-11-30 15:37:02 +01:00
parent f20ba8466b
commit 9e827c4ead

View file

@ -1483,27 +1483,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>
<!-- 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:element>
</xsl:otherwise>
</xsl:choose>
</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">