Skip to content

Commit

Permalink
Merge pull request #144 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Dec 21, 2024
2 parents ca8de2c + f30573c commit 72ffb04
Showing 1 changed file with 24 additions and 31 deletions.
55 changes: 24 additions & 31 deletions lib/isodoc/plateau/plateau.international-standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -8789,16 +8789,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 @@ -8846,14 +8859,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 @@ -8874,16 +8881,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 @@ -14609,14 +14608,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 72ffb04

Please sign in to comment.