Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xslt update based on metanorma/mn-native-pdf@9264bb2712ba3e76c7c436fc3d4afda7508691d4 #263

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 24 additions & 31 deletions lib/isodoc/csa/csa.standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7553,16 +7553,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 @@ -7610,14 +7623,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 @@ -7638,16 +7645,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 @@ -13238,14 +13237,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
Loading