|
8789 | 8789 | <xsl:template name="getImageSrc">
|
8790 | 8790 | <xsl:choose>
|
8791 | 8791 | <xsl:when test="not(starts-with(@src, 'data:'))">
|
| 8792 | + <xsl:call-template name="getImageSrcExternal"/> |
| 8793 | + </xsl:when> |
| 8794 | + <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise> |
| 8795 | + </xsl:choose> |
| 8796 | + </xsl:template> |
| 8797 | + |
| 8798 | + <xsl:template name="getImageSrcExternal"> |
| 8799 | + <xsl:choose> |
| 8800 | + <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 --> |
| 8801 | + <xsl:value-of select="@src"/> |
| 8802 | + </xsl:when> |
| 8803 | + <xsl:otherwise> |
| 8804 | + <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/> |
| 8805 | + <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/> |
8792 | 8806 | <xsl:choose>
|
8793 |
| - <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 --> |
8794 |
| - <xsl:value-of select="@src"/> |
| 8807 | + <xsl:when test="$file_exists = 'true'"> |
| 8808 | + <xsl:value-of select="$src_with_basepath"/> |
8795 | 8809 | </xsl:when>
|
8796 | 8810 | <xsl:otherwise>
|
8797 |
| - <xsl:value-of select="concat($basepath, @src)"/> |
| 8811 | + <xsl:value-of select="@src"/> |
8798 | 8812 | </xsl:otherwise>
|
8799 | 8813 | </xsl:choose>
|
8800 |
| - </xsl:when> |
8801 |
| - <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise> |
| 8814 | + </xsl:otherwise> |
8802 | 8815 | </xsl:choose>
|
8803 | 8816 | </xsl:template>
|
8804 | 8817 |
|
|
8846 | 8859 | <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
|
8847 | 8860 | </xsl:when>
|
8848 | 8861 | <xsl:when test="not(starts-with(@src, 'data:'))">
|
8849 |
| - <xsl:choose> |
8850 |
| - <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 --> |
8851 |
| - <xsl:value-of select="concat('url(file:///', @src, ')')"/> |
8852 |
| - </xsl:when> |
8853 |
| - <xsl:otherwise> |
8854 |
| - <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/> |
8855 |
| - </xsl:otherwise> |
8856 |
| - </xsl:choose> |
| 8862 | + <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable> |
| 8863 | + <xsl:value-of select="concat('url(file:///', $src_external, ')')"/> |
8857 | 8864 | </xsl:when>
|
8858 | 8865 | <xsl:otherwise>
|
8859 | 8866 | <xsl:value-of select="@src"/>
|
|
8874 | 8881 | </svg>
|
8875 | 8882 | </xsl:when>
|
8876 | 8883 | <xsl:when test="not(starts-with(@src, 'data:'))">
|
8877 |
| - <xsl:variable name="src"> |
8878 |
| - <xsl:choose> |
8879 |
| - <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 --> |
8880 |
| - <xsl:value-of select="concat('url(file:///', @src, ')')"/> |
8881 |
| - </xsl:when> |
8882 |
| - <xsl:otherwise> |
8883 |
| - <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/> |
8884 |
| - </xsl:otherwise> |
8885 |
| - </xsl:choose> |
8886 |
| - </xsl:variable> |
| 8884 | + <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable> |
| 8885 | + <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/> |
8887 | 8886 | <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
|
8888 | 8887 | <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
|
8889 | 8888 | <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
|
|
14609 | 14608 | <xsl:value-of select="$src"/>
|
14610 | 14609 | </xsl:when>
|
14611 | 14610 | <xsl:otherwise>
|
14612 |
| - <xsl:choose> |
14613 |
| - <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 --> |
14614 |
| - <xsl:value-of select="concat('url(file:///', @src, ')')"/> |
14615 |
| - </xsl:when> |
14616 |
| - <xsl:otherwise> |
14617 |
| - <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/> |
14618 |
| - </xsl:otherwise> |
14619 |
| - </xsl:choose> |
| 14611 | + <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable> |
| 14612 | + <xsl:value-of select="concat('url(file:///', $src_external, ')')"/> |
14620 | 14613 | </xsl:otherwise>
|
14621 | 14614 | </xsl:choose>
|
14622 | 14615 | </xsl:template>
|
|
0 commit comments