metanorma-iec 2.4.8 → 2.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaad692849076b30bf4f35aff005e033f79ee8d35a668b18887d920bd6796c06
4
- data.tar.gz: 9a3e00ba543921aaf3d1c3b84ccdc1b096d9b097a0db4cf44da4c454622f4d19
3
+ metadata.gz: c6da81a2407437f4f91346cac1fbefa2dd4d8e7b5c8c5a39eeb7f294d3bf35dc
4
+ data.tar.gz: 7ac3e6b8427a96f339dada10e85340a9f08d352b95a0333885d1c240212c7016
5
5
  SHA512:
6
- metadata.gz: 237e8ed10fadb3ed8523a2382777a8ea1306facfd88bbb7eaa5b02d93e3d941d94d562ff647efda4678543115601342cd80de30bb5cb8d76c53442eff3b00a63
7
- data.tar.gz: d28bf383e648494a53281b76b70e3987a50e81ebd33c1ebf0809bc0ea460ab449d72b7f38b71f565473071f861189fb92e1f2cb809c0cc4d73c25ede575f1f40
6
+ metadata.gz: 68413aabf16df2e73d0062ac2711ce61291a378ec069ef457fdaf1bde343c9dedb6070f2bdaefae6e015f2adcc9b8af888a6c68e08cdac465f05329195de6c62
7
+ data.tar.gz: 6760dd302e44cbfae801f18f220cb767102fb9c7363c0ab2ee2aefcf3e5e67f50ba1935812a43d1b078de888374e2a6db5e2f04ecc4b193d6323bd37a8d81e08
@@ -1824,16 +1824,11 @@
1824
1824
  <xsl:choose>
1825
1825
  <xsl:when test="$element-name = 'fo:block'">
1826
1826
  <xsl:element name="{$element-name}">
1827
- <xsl:attribute name="text-align">
1828
- <xsl:choose>
1829
- <xsl:when test="@align = 'justified'">justify</xsl:when>
1830
- <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
1831
- <xsl:otherwise>justify</xsl:otherwise>
1832
- </xsl:choose>
1833
- </xsl:attribute>
1834
- <xsl:if test="@align = 'indent'">
1835
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
1836
- </xsl:if>
1827
+
1828
+ <xsl:call-template name="setBlockAttributes">
1829
+ <xsl:with-param name="text_align_default">justify</xsl:with-param>
1830
+ </xsl:call-template>
1831
+
1837
1832
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
1838
1833
  <xsl:if test="ancestor::iec:definition">
1839
1834
  <xsl:attribute name="margin-top">1pt</xsl:attribute>
@@ -2112,7 +2107,7 @@
2112
2107
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="iec:xref"/>
2113
2108
 
2114
2109
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
2115
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
2110
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
2116
2111
 
2117
2112
  <!-- external parameters -->
2118
2113
 
@@ -3865,7 +3860,7 @@
3865
3860
 
3866
3861
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
3867
3862
 
3868
- <xsl:variable name="updated_xml_step_move_pagebreak_">
3863
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3869
3864
 
3870
3865
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3871
3866
 
@@ -3883,17 +3878,32 @@
3883
3878
  </xsl:variable>
3884
3879
 
3885
3880
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3886
-
3881
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
3882
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3887
3883
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3888
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3884
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3889
3885
  </redirect:write>
3886
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3890
3887
 
3891
3888
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3892
3889
 
3890
+ <!-- TODO: instead of
3891
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
3892
+ in each template, add removing empty page_sequence here
3893
+ -->
3894
+
3895
+ <xsl:if test="$debug = 'true'">
3896
+ <redirect:write file="page_sequence_preface.xml">
3897
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3898
+ </redirect:write>
3899
+ </xsl:if>
3900
+
3901
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3893
3902
  <xsl:call-template name="deleteFile">
3894
3903
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3895
3904
  </xsl:call-template>
3896
- </xsl:template>
3905
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3906
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
3897
3907
 
3898
3908
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
3899
3909
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -3918,37 +3928,7 @@
3918
3928
  </xsl:for-each>
3919
3929
  </xsl:template><!-- END: processMainSectionsDefault -->
3920
3930
 
3921
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
3922
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3923
- <xsl:sort select="@displayorder" data-type="number"/>
3924
- <xsl:variable name="flatxml">
3925
- <xsl:apply-templates select="." mode="flatxml"/>
3926
- </xsl:variable>
3927
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3928
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3929
-
3930
- </xsl:for-each>
3931
-
3932
- <xsl:for-each select="/*/*[local-name()='annex']">
3933
- <xsl:sort select="@displayorder" data-type="number"/>
3934
- <xsl:variable name="flatxml">
3935
- <xsl:apply-templates select="." mode="flatxml"/>
3936
- </xsl:variable>
3937
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3938
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3939
- </xsl:for-each>
3940
-
3941
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3942
- <xsl:sort select="@displayorder" data-type="number"/>
3943
- <xsl:variable name="flatxml">
3944
- <xsl:apply-templates select="." mode="flatxml"/>
3945
- </xsl:variable>
3946
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3947
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3948
- </xsl:for-each>
3949
- </xsl:template>
3950
-
3951
- <!-- Example:
3931
+ <!-- Example:
3952
3932
  <iso-standard>
3953
3933
  <sections>
3954
3934
  <page_sequence>
@@ -3968,7 +3948,7 @@
3968
3948
  -->
3969
3949
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
3970
3950
 
3971
- <xsl:variable name="updated_xml_step_move_pagebreak_">
3951
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3972
3952
 
3973
3953
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3974
3954
 
@@ -4005,11 +3985,17 @@
4005
3985
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
4006
3986
 
4007
3987
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
4008
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3988
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
4009
3989
  </redirect:write>
4010
3990
 
4011
3991
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
4012
3992
 
3993
+ <xsl:if test="$debug = 'true'">
3994
+ <redirect:write file="page_sequence_main.xml">
3995
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3996
+ </redirect:write>
3997
+ </xsl:if>
3998
+
4013
3999
  <xsl:call-template name="deleteFile">
4014
4000
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
4015
4001
  </xsl:call-template>
@@ -4022,6 +4008,14 @@
4022
4008
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
4023
4009
  </xsl:template>
4024
4010
 
4011
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
4012
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
4013
+ <xsl:choose>
4014
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
4015
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
4016
+ </xsl:choose>
4017
+ </xsl:template>
4018
+
4025
4019
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
4026
4020
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
4027
4021
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -4357,7 +4351,9 @@
4357
4351
 
4358
4352
  <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4359
4353
  <xsl:if test="$isNoteOrFnExist = 'true'">
4360
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4354
+
4355
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4356
+
4361
4357
  </xsl:if>
4362
4358
 
4363
4359
  <xsl:choose>
@@ -4414,13 +4410,14 @@
4414
4410
  </fo:table>
4415
4411
 
4416
4412
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4417
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4418
- <xsl:call-template name="insertTableFooterInSeparateTable">
4419
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
4420
- <xsl:with-param name="colwidths" select="$colwidths"/>
4421
- <xsl:with-param name="colgroup" select="$colgroup"/>
4422
- </xsl:call-template>
4423
- </xsl:for-each>
4413
+
4414
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4415
+ <xsl:call-template name="insertTableFooterInSeparateTable">
4416
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
4417
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4418
+ <xsl:with-param name="colgroup" select="$colgroup"/>
4419
+ </xsl:call-template>
4420
+ </xsl:for-each>
4424
4421
 
4425
4422
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
4426
4423
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -4825,8 +4822,10 @@
4825
4822
  <width_min><xsl:value-of select="@width_min"/></width_min>
4826
4823
  <e><xsl:value-of select="$d * $W div $D"/></e>
4827
4824
  <!-- set the column's width to the minimum width plus d times W over D. -->
4825
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4826
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
4828
4827
  <column divider="100">
4829
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4828
+ <xsl:value-of select="$column_width"/>
4830
4829
  </column>
4831
4830
  </xsl:for-each>
4832
4831
 
@@ -5292,6 +5291,22 @@
5292
5291
 
5293
5292
  <xsl:call-template name="refine_table-header-cell-style"/>
5294
5293
 
5294
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
5295
+ <!-- <xsl:choose>
5296
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
5297
+ <fo:block-container reference-orientation="270">
5298
+ <fo:block role="SKIP" text-align="start">
5299
+ <xsl:apply-templates />
5300
+ </fo:block>
5301
+ </fo:block-container>
5302
+ </xsl:when>
5303
+ <xsl:otherwise>
5304
+ <fo:block role="SKIP">
5305
+ <xsl:apply-templates />
5306
+ </fo:block>
5307
+ </xsl:otherwise>
5308
+ </xsl:choose> -->
5309
+
5295
5310
  <fo:block role="SKIP">
5296
5311
  <xsl:apply-templates/>
5297
5312
  </fo:block>
@@ -8870,6 +8885,15 @@
8870
8885
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
8871
8886
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
8872
8887
  </xsl:when>
8888
+ <!-- in WebP format, then convert image into PNG -->
8889
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
8890
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
8891
+ <xsl:value-of select="$src_png"/>
8892
+ </xsl:when>
8893
+ <xsl:when test="not(starts-with(@src, 'data:')) and (java:endsWith(java:java.lang.String.new(@src), '.webp') or java:endsWith(java:java.lang.String.new(@src), '.WEBP'))">
8894
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
8895
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8896
+ </xsl:when>
8873
8897
  <xsl:when test="not(starts-with(@src, 'data:'))">
8874
8898
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8875
8899
  </xsl:when>
@@ -12566,6 +12590,75 @@
12566
12590
  <!-- ===================================== -->
12567
12591
  <!-- Update xml -->
12568
12592
  <!-- ===================================== -->
12593
+
12594
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
12595
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
12596
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
12597
+
12598
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12599
+ <xsl:variable name="updated_xml_step1">
12600
+ <xsl:if test="$table_if = 'false'">
12601
+ <xsl:apply-templates mode="update_xml_step1"/>
12602
+ </xsl:if>
12603
+ </xsl:variable>
12604
+
12605
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
12606
+ <xsl:if test="$debug = 'true'">
12607
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
12608
+ <xsl:message>END updated_xml_step1</xsl:message>
12609
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
12610
+ <xsl:copy-of select="$updated_xml_step1"/>
12611
+ </redirect:write> -->
12612
+ </xsl:if>
12613
+
12614
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
12615
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
12616
+
12617
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12618
+ <xsl:variable name="updated_xml_step2">
12619
+
12620
+ <xsl:if test="$table_if = 'false'">
12621
+ <xsl:copy-of select="$updated_xml_step1"/>
12622
+ </xsl:if>
12623
+
12624
+ </xsl:variable>
12625
+
12626
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
12627
+ <xsl:if test="$debug = 'true'">
12628
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
12629
+ <xsl:message>END updated_xml_step2</xsl:message>
12630
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
12631
+ <xsl:copy-of select="$updated_xml_step2"/>
12632
+ </redirect:write> -->
12633
+ </xsl:if>
12634
+
12635
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
12636
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
12637
+
12638
+ <xsl:variable name="updated_xml_step3">
12639
+ <xsl:choose>
12640
+ <xsl:when test="$table_if = 'false'">
12641
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
12642
+ </xsl:when>
12643
+ <xsl:otherwise>
12644
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
12645
+ </xsl:otherwise>
12646
+ </xsl:choose>
12647
+ </xsl:variable>
12648
+
12649
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
12650
+ <xsl:if test="$debug = 'true'">
12651
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
12652
+ <xsl:message>END updated_xml_step3</xsl:message>
12653
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
12654
+ <xsl:copy-of select="$updated_xml_step3"/>
12655
+ </redirect:write> -->
12656
+ </xsl:if>
12657
+
12658
+ <xsl:copy-of select="$updated_xml_step3"/>
12659
+
12660
+ </xsl:template>
12661
+
12569
12662
  <!-- =========================================================================== -->
12570
12663
  <!-- STEP1: -->
12571
12664
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -12765,7 +12858,7 @@
12765
12858
 
12766
12859
  <!-- determine pagebreak is last element before </fo:flow> or not -->
12767
12860
  <xsl:variable name="isLast">
12768
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12861
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12769
12862
  <xsl:if test="following-sibling::*">false</xsl:if>
12770
12863
  </xsl:for-each>
12771
12864
  </xsl:variable>
@@ -12787,7 +12880,7 @@
12787
12880
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
12788
12881
 
12789
12882
  <!-- create a new page_sequence (opening elements) -->
12790
- <xsl:text disable-output-escaping="yes">&lt;page_sequence namespace="</xsl:text><xsl:value-of select="$namespace_full"/>"<xsl:if test="$orientation != ''"> orientation="<xsl:value-of select="$orientation"/>"</xsl:if><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
12883
+ <xsl:text disable-output-escaping="yes">&lt;page_sequence xmlns="</xsl:text><xsl:value-of select="$namespace_full"/>"<xsl:if test="$orientation != ''"> orientation="<xsl:value-of select="$orientation"/>"</xsl:if><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
12791
12884
 
12792
12885
  <xsl:call-template name="insertOpeningElements">
12793
12886
  <xsl:with-param name="tree" select="$tree"/>
@@ -12797,7 +12890,7 @@
12797
12890
  </xsl:template>
12798
12891
 
12799
12892
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
12800
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12893
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12801
12894
  <element pos="{position()}">
12802
12895
  <xsl:copy-of select="@*[local-name() != 'id']"/>
12803
12896
  <xsl:value-of select="name()"/>
@@ -12978,7 +13071,7 @@
12978
13071
  <xsl:value-of select="substring-before($text, $tag_open)"/>
12979
13072
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
12980
13073
 
12981
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
13074
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
12982
13075
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
12983
13076
  </xsl:element>
12984
13077
 
@@ -13800,7 +13893,10 @@
13800
13893
  <xsl:call-template name="setTextAlignment">
13801
13894
  <xsl:with-param name="default" select="$text_align_default"/>
13802
13895
  </xsl:call-template>
13896
+ <xsl:call-template name="setKeepAttributes"/>
13897
+ </xsl:template>
13803
13898
 
13899
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
13804
13900
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
13805
13901
  <!-- Example: keep-lines-together="true" -->
13806
13902
  <xsl:if test="@keep-lines-together = 'true'">
@@ -13812,6 +13908,72 @@
13812
13908
  </xsl:if>
13813
13909
  </xsl:template>
13814
13910
 
13911
+ <!-- insert cover page image -->
13912
+ <!-- background cover image -->
13913
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
13914
+ <xsl:param name="number">1</xsl:param>
13915
+ <xsl:param name="name">coverpage-image</xsl:param>
13916
+ <xsl:variable name="num" select="number($number)"/>
13917
+ <!-- background image -->
13918
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
13919
+ <fo:block>
13920
+ <xsl:for-each select="/*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = $name][1]/*[local-name() = 'value']/*[local-name() = 'image'][$num]">
13921
+ <xsl:choose>
13922
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
13923
+ <fo:instream-foreign-object fox:alt-text="Image Front">
13924
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
13925
+ <xsl:call-template name="getSVG"/>
13926
+ </fo:instream-foreign-object>
13927
+ </xsl:when>
13928
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
13929
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
13930
+ </xsl:when>
13931
+ <xsl:otherwise> <!-- bitmap image -->
13932
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
13933
+ <xsl:if test="$coverimage_src != ''">
13934
+ <xsl:variable name="coverpage">
13935
+ <xsl:call-template name="getImageURL">
13936
+ <xsl:with-param name="src" select="$coverimage_src"/>
13937
+ </xsl:call-template>
13938
+ </xsl:variable>
13939
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
13940
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
13941
+ </xsl:if>
13942
+ </xsl:otherwise>
13943
+ </xsl:choose>
13944
+ </xsl:for-each>
13945
+ </fo:block>
13946
+ </fo:block-container>
13947
+ </xsl:template>
13948
+
13949
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
13950
+ <xsl:param name="src"/>
13951
+ <xsl:choose>
13952
+ <xsl:when test="starts-with($src, 'data:image')">
13953
+ <xsl:value-of select="$src"/>
13954
+ </xsl:when>
13955
+ <xsl:otherwise>
13956
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13957
+ </xsl:otherwise>
13958
+ </xsl:choose>
13959
+ </xsl:template>
13960
+
13961
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
13962
+ <xsl:choose>
13963
+ <xsl:when test="*[local-name() = 'svg']">
13964
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
13965
+ </xsl:when>
13966
+ <xsl:otherwise>
13967
+ <xsl:variable name="svg_content" select="document(@src)"/>
13968
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
13969
+ <xsl:apply-templates select="." mode="svg_update"/>
13970
+ </xsl:for-each>
13971
+ </xsl:otherwise>
13972
+ </xsl:choose>
13973
+ </xsl:template>
13974
+
13975
+ <!-- END: insert cover page image -->
13976
+
13815
13977
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
13816
13978
  <xsl:param name="number"/>
13817
13979
  <xsl:param name="first"/>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.4.8".freeze
3
+ VERSION = "2.4.9".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.8
4
+ version: 2.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-03 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso