Skip to content

Commit

Permalink
xslt update based on metanorma/mn-native-pdf@0de45d5
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 authored Aug 23, 2024
1 parent 030a9ef commit 6104a74
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 10 deletions.
40 changes: 35 additions & 5 deletions lib/isodoc/ieee/ieee.amendment.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10576,7 +10576,16 @@
</xsl:variable>
<xsl:variable name="img_src">
<xsl:choose>
<xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></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="@src"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($basepath, @src)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
Expand All @@ -10589,7 +10598,7 @@
<!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
<xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
<xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
<xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
<xsl:value-of select="$scale"/>
</xsl:template>

Expand All @@ -10608,7 +10617,14 @@
<xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
</xsl:when>
<xsl:when test="not(starts-with(@src, 'data:'))">
<xsl:value-of select="concat('url(file:///',$basepath, @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:when>
<xsl:otherwise>
<xsl:value-of select="@src"/>
Expand All @@ -10630,7 +10646,14 @@
</xsl:when>
<xsl:when test="not(starts-with(@src, 'data:'))">
<xsl:variable name="src">
<xsl:value-of select="concat('url(file:///',$basepath, @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="file" select="java:java.io.File.new(@src)"/>
<xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
Expand Down Expand Up @@ -15961,7 +15984,14 @@
<xsl:value-of select="$src"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('url(file:///',$basepath, $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:otherwise>
</xsl:choose>
</xsl:template>
Expand Down
40 changes: 35 additions & 5 deletions lib/isodoc/ieee/ieee.standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10576,7 +10576,16 @@
</xsl:variable>
<xsl:variable name="img_src">
<xsl:choose>
<xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></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="@src"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($basepath, @src)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
Expand All @@ -10589,7 +10598,7 @@
<!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
<xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
<xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
<xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
<xsl:value-of select="$scale"/>
</xsl:template>

Expand All @@ -10608,7 +10617,14 @@
<xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
</xsl:when>
<xsl:when test="not(starts-with(@src, 'data:'))">
<xsl:value-of select="concat('url(file:///',$basepath, @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:when>
<xsl:otherwise>
<xsl:value-of select="@src"/>
Expand All @@ -10630,7 +10646,14 @@
</xsl:when>
<xsl:when test="not(starts-with(@src, 'data:'))">
<xsl:variable name="src">
<xsl:value-of select="concat('url(file:///',$basepath, @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="file" select="java:java.io.File.new(@src)"/>
<xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
Expand Down Expand Up @@ -15961,7 +15984,14 @@
<xsl:value-of select="$src"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('url(file:///',$basepath, $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:otherwise>
</xsl:choose>
</xsl:template>
Expand Down

0 comments on commit 6104a74

Please sign in to comment.