Skip to content

Commit

Permalink
xslt update based on metanorma/mn-native-pdf@9264bb2
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 authored Dec 21, 2024
1 parent f2d8415 commit b8e8145
Showing 1 changed file with 24 additions and 31 deletions.
55 changes: 24 additions & 31 deletions lib/isodoc/cc/cc.standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7541,16 +7541,29 @@
<xsl:template name="getImageSrc">
<xsl:choose>
<xsl:when test="not(starts-with(@src, 'data:'))">
<xsl:call-template name="getImageSrcExternal"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="getImageSrcExternal">
<xsl:choose>
<xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
<xsl:value-of select="@src"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
<xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
<xsl:choose>
<xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
<xsl:value-of select="@src"/>
<xsl:when test="$file_exists = 'true'">
<xsl:value-of select="$src_with_basepath"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($basepath, @src)"/>
<xsl:value-of select="@src"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Expand Down Expand Up @@ -7598,14 +7611,8 @@
<xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
</xsl:when>
<xsl:when test="not(starts-with(@src, 'data:'))">
<xsl:choose>
<xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
<xsl:value-of select="concat('url(file:///', @src, ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
<xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@src"/>
Expand All @@ -7626,16 +7633,8 @@
</svg>
</xsl:when>
<xsl:when test="not(starts-with(@src, 'data:'))">
<xsl:variable name="src">
<xsl:choose>
<xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
<xsl:value-of select="concat('url(file:///', @src, ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
<xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
<xsl:variable name="file" select="java:java.io.File.new(@src)"/>
<xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
<xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
Expand Down Expand Up @@ -13258,14 +13257,8 @@
<xsl:value-of select="$src"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
<xsl:value-of select="concat('url(file:///', @src, ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
<xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Expand Down

0 comments on commit b8e8145

Please sign in to comment.