Skip to content

Commit 267479f

Browse files
xslt update based on metanorma/mn-native-pdf@c4eb6f2
1 parent e1085df commit 267479f

9 files changed

+324
-54
lines changed

lib/isodoc/itu/itu.implementers-guide.xsl

+36-6
Original file line numberDiff line numberDiff line change
@@ -9284,16 +9284,44 @@
92849284
</xsl:choose>
92859285

92869286
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9287-
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9288-
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9287+
<xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
9288+
<xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
9289+
<xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
9290+
<xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
9291+
9292+
<!-- Example: -->
92899293
<!-- effective height 297 - 27.4 - 13 = 256.6 -->
92909294
<!-- effective width 210 - 12.5 - 25 = 172.5 -->
92919295
<!-- effective height / width = 1.48, 1.4 - with title -->
9292-
<xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9296+
9297+
<xsl:variable name="scale_x">
9298+
<xsl:choose>
9299+
<xsl:when test="$svg_width &gt; $width_effective_px">
9300+
<xsl:value-of select="$width_effective_px div $svg_width"/>
9301+
</xsl:when>
9302+
<xsl:otherwise>1</xsl:otherwise>
9303+
</xsl:choose>
9304+
</xsl:variable>
9305+
<xsl:variable name="scale_y">
9306+
<xsl:choose>
9307+
<xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
9308+
<xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
9309+
</xsl:when>
9310+
<xsl:otherwise>1</xsl:otherwise>
9311+
</xsl:choose>
9312+
</xsl:variable>
9313+
9314+
<!-- for images with big height -->
9315+
<!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
92939316
<xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
92949317
<xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9295-
</xsl:if>
9318+
</xsl:if> -->
92969319
<xsl:attribute name="scaling">uniform</xsl:attribute>
9320+
9321+
<xsl:if test="$scale_y != 1">
9322+
<xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
9323+
</xsl:if>
9324+
92979325
<xsl:copy-of select="$svg_content"/>
92989326
</fo:instream-foreign-object>
92999327
<!-- </fo:block> -->
@@ -11452,7 +11480,9 @@
1145211480
</xsl:template> <!-- sections_element_style -->
1145311481

1145411482
<xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
11455-
<fo:block break-after="page"/>
11483+
11484+
<fo:block break-after="page"/>
11485+
1145611486
<fo:block>
1145711487
<xsl:call-template name="setId"/>
1145811488
<xsl:apply-templates/>
@@ -11523,7 +11553,7 @@
1152311553
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
1152411554
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152511555
</xsl:when>
11526-
<xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11556+
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
1152711557
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152811558
</xsl:when>
1152911559
</xsl:choose>

lib/isodoc/itu/itu.in-force.xsl

+36-6
Original file line numberDiff line numberDiff line change
@@ -9284,16 +9284,44 @@
92849284
</xsl:choose>
92859285

92869286
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9287-
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9288-
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9287+
<xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
9288+
<xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
9289+
<xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
9290+
<xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
9291+
9292+
<!-- Example: -->
92899293
<!-- effective height 297 - 27.4 - 13 = 256.6 -->
92909294
<!-- effective width 210 - 12.5 - 25 = 172.5 -->
92919295
<!-- effective height / width = 1.48, 1.4 - with title -->
9292-
<xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9296+
9297+
<xsl:variable name="scale_x">
9298+
<xsl:choose>
9299+
<xsl:when test="$svg_width &gt; $width_effective_px">
9300+
<xsl:value-of select="$width_effective_px div $svg_width"/>
9301+
</xsl:when>
9302+
<xsl:otherwise>1</xsl:otherwise>
9303+
</xsl:choose>
9304+
</xsl:variable>
9305+
<xsl:variable name="scale_y">
9306+
<xsl:choose>
9307+
<xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
9308+
<xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
9309+
</xsl:when>
9310+
<xsl:otherwise>1</xsl:otherwise>
9311+
</xsl:choose>
9312+
</xsl:variable>
9313+
9314+
<!-- for images with big height -->
9315+
<!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
92939316
<xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
92949317
<xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9295-
</xsl:if>
9318+
</xsl:if> -->
92969319
<xsl:attribute name="scaling">uniform</xsl:attribute>
9320+
9321+
<xsl:if test="$scale_y != 1">
9322+
<xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
9323+
</xsl:if>
9324+
92979325
<xsl:copy-of select="$svg_content"/>
92989326
</fo:instream-foreign-object>
92999327
<!-- </fo:block> -->
@@ -11452,7 +11480,9 @@
1145211480
</xsl:template> <!-- sections_element_style -->
1145311481

1145411482
<xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
11455-
<fo:block break-after="page"/>
11483+
11484+
<fo:block break-after="page"/>
11485+
1145611486
<fo:block>
1145711487
<xsl:call-template name="setId"/>
1145811488
<xsl:apply-templates/>
@@ -11523,7 +11553,7 @@
1152311553
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
1152411554
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152511555
</xsl:when>
11526-
<xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11556+
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
1152711557
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152811558
</xsl:when>
1152911559
</xsl:choose>

lib/isodoc/itu/itu.recommendation-annex.xsl

+36-6
Original file line numberDiff line numberDiff line change
@@ -9284,16 +9284,44 @@
92849284
</xsl:choose>
92859285

92869286
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9287-
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9288-
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9287+
<xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
9288+
<xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
9289+
<xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
9290+
<xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
9291+
9292+
<!-- Example: -->
92899293
<!-- effective height 297 - 27.4 - 13 = 256.6 -->
92909294
<!-- effective width 210 - 12.5 - 25 = 172.5 -->
92919295
<!-- effective height / width = 1.48, 1.4 - with title -->
9292-
<xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9296+
9297+
<xsl:variable name="scale_x">
9298+
<xsl:choose>
9299+
<xsl:when test="$svg_width &gt; $width_effective_px">
9300+
<xsl:value-of select="$width_effective_px div $svg_width"/>
9301+
</xsl:when>
9302+
<xsl:otherwise>1</xsl:otherwise>
9303+
</xsl:choose>
9304+
</xsl:variable>
9305+
<xsl:variable name="scale_y">
9306+
<xsl:choose>
9307+
<xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
9308+
<xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
9309+
</xsl:when>
9310+
<xsl:otherwise>1</xsl:otherwise>
9311+
</xsl:choose>
9312+
</xsl:variable>
9313+
9314+
<!-- for images with big height -->
9315+
<!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
92939316
<xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
92949317
<xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9295-
</xsl:if>
9318+
</xsl:if> -->
92969319
<xsl:attribute name="scaling">uniform</xsl:attribute>
9320+
9321+
<xsl:if test="$scale_y != 1">
9322+
<xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
9323+
</xsl:if>
9324+
92979325
<xsl:copy-of select="$svg_content"/>
92989326
</fo:instream-foreign-object>
92999327
<!-- </fo:block> -->
@@ -11452,7 +11480,9 @@
1145211480
</xsl:template> <!-- sections_element_style -->
1145311481

1145411482
<xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
11455-
<fo:block break-after="page"/>
11483+
11484+
<fo:block break-after="page"/>
11485+
1145611486
<fo:block>
1145711487
<xsl:call-template name="setId"/>
1145811488
<xsl:apply-templates/>
@@ -11523,7 +11553,7 @@
1152311553
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
1152411554
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152511555
</xsl:when>
11526-
<xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11556+
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
1152711557
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152811558
</xsl:when>
1152911559
</xsl:choose>

lib/isodoc/itu/itu.recommendation-supplement.xsl

+36-6
Original file line numberDiff line numberDiff line change
@@ -9284,16 +9284,44 @@
92849284
</xsl:choose>
92859285

92869286
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9287-
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9288-
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9287+
<xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
9288+
<xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
9289+
<xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
9290+
<xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
9291+
9292+
<!-- Example: -->
92899293
<!-- effective height 297 - 27.4 - 13 = 256.6 -->
92909294
<!-- effective width 210 - 12.5 - 25 = 172.5 -->
92919295
<!-- effective height / width = 1.48, 1.4 - with title -->
9292-
<xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9296+
9297+
<xsl:variable name="scale_x">
9298+
<xsl:choose>
9299+
<xsl:when test="$svg_width &gt; $width_effective_px">
9300+
<xsl:value-of select="$width_effective_px div $svg_width"/>
9301+
</xsl:when>
9302+
<xsl:otherwise>1</xsl:otherwise>
9303+
</xsl:choose>
9304+
</xsl:variable>
9305+
<xsl:variable name="scale_y">
9306+
<xsl:choose>
9307+
<xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
9308+
<xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
9309+
</xsl:when>
9310+
<xsl:otherwise>1</xsl:otherwise>
9311+
</xsl:choose>
9312+
</xsl:variable>
9313+
9314+
<!-- for images with big height -->
9315+
<!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
92939316
<xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
92949317
<xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9295-
</xsl:if>
9318+
</xsl:if> -->
92969319
<xsl:attribute name="scaling">uniform</xsl:attribute>
9320+
9321+
<xsl:if test="$scale_y != 1">
9322+
<xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
9323+
</xsl:if>
9324+
92979325
<xsl:copy-of select="$svg_content"/>
92989326
</fo:instream-foreign-object>
92999327
<!-- </fo:block> -->
@@ -11452,7 +11480,9 @@
1145211480
</xsl:template> <!-- sections_element_style -->
1145311481

1145411482
<xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
11455-
<fo:block break-after="page"/>
11483+
11484+
<fo:block break-after="page"/>
11485+
1145611486
<fo:block>
1145711487
<xsl:call-template name="setId"/>
1145811488
<xsl:apply-templates/>
@@ -11523,7 +11553,7 @@
1152311553
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
1152411554
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152511555
</xsl:when>
11526-
<xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11556+
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
1152711557
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152811558
</xsl:when>
1152911559
</xsl:choose>

lib/isodoc/itu/itu.recommendation.xsl

+36-6
Original file line numberDiff line numberDiff line change
@@ -9284,16 +9284,44 @@
92849284
</xsl:choose>
92859285

92869286
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9287-
<xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9288-
<xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9287+
<xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
9288+
<xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
9289+
<xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
9290+
<xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
9291+
9292+
<!-- Example: -->
92899293
<!-- effective height 297 - 27.4 - 13 = 256.6 -->
92909294
<!-- effective width 210 - 12.5 - 25 = 172.5 -->
92919295
<!-- effective height / width = 1.48, 1.4 - with title -->
9292-
<xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9296+
9297+
<xsl:variable name="scale_x">
9298+
<xsl:choose>
9299+
<xsl:when test="$svg_width &gt; $width_effective_px">
9300+
<xsl:value-of select="$width_effective_px div $svg_width"/>
9301+
</xsl:when>
9302+
<xsl:otherwise>1</xsl:otherwise>
9303+
</xsl:choose>
9304+
</xsl:variable>
9305+
<xsl:variable name="scale_y">
9306+
<xsl:choose>
9307+
<xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
9308+
<xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
9309+
</xsl:when>
9310+
<xsl:otherwise>1</xsl:otherwise>
9311+
</xsl:choose>
9312+
</xsl:variable>
9313+
9314+
<!-- for images with big height -->
9315+
<!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
92939316
<xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
92949317
<xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9295-
</xsl:if>
9318+
</xsl:if> -->
92969319
<xsl:attribute name="scaling">uniform</xsl:attribute>
9320+
9321+
<xsl:if test="$scale_y != 1">
9322+
<xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
9323+
</xsl:if>
9324+
92979325
<xsl:copy-of select="$svg_content"/>
92989326
</fo:instream-foreign-object>
92999327
<!-- </fo:block> -->
@@ -11452,7 +11480,9 @@
1145211480
</xsl:template> <!-- sections_element_style -->
1145311481

1145411482
<xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
11455-
<fo:block break-after="page"/>
11483+
11484+
<fo:block break-after="page"/>
11485+
1145611486
<fo:block>
1145711487
<xsl:call-template name="setId"/>
1145811488
<xsl:apply-templates/>
@@ -11523,7 +11553,7 @@
1152311553
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
1152411554
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152511555
</xsl:when>
11526-
<xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11556+
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
1152711557
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
1152811558
</xsl:when>
1152911559
</xsl:choose>

0 commit comments

Comments
 (0)