Displaying SVG using XSLFO

有些话、适合烂在心里 提交于 2019-12-03 13:27:39

Actually, instream-foreign-object didn't seem to be able to scale the SVG at all, not even with the proper canvas set. By setting the correct canvas on the SVG, fo:external-graphic did the trick ;-)

Thanks you guys for giving me your tips :-) Here is what worked:

    <fo:external-graphic content-width="25cm" content-height="16cm">
        <xsl:if test="@src">
            <xsl:attribute name="src">
                <xsl:choose>
                    <xsl:when test="starts-with(@src, 'http://')">
                        <xsl:value-of select="concat('url(',@src,')')"/>
                    </xsl:when>
                    <xsl:when test="starts-with(@src, 'https://')">
                        <xsl:value-of select="concat('url(',@src,')')"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="concat('url(',$baseurl, @src,')') + ')'"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
        </xsl:if>
    </fo:external-graphic>

It is large because the fo:instream-foreign-object has a large width and height; if you are a beginner in XSL-FO you should try the Ecrion Designer - you can edit XSLFO visually and resize using the mouse. Cheers!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!