metanorma-ieee 1.2.9 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da0b63456a3133578ac23979a31bc0df0b36ec0091125884276328599b235bc9
4
- data.tar.gz: aecaa47b5c24f97bc93cc28f6fc814502ecc4df7d071c9f9abc540883c9ece03
3
+ metadata.gz: f2cb2ea85f9094f39b8ed51d803e2072d1bdf8bfc871f4e9ca191b5cd945ecd7
4
+ data.tar.gz: 1272a88d0397ca6f8dc944e73766f4a8ca098be3541a6c5b2d823063ad4ac086
5
5
  SHA512:
6
- metadata.gz: d0f89ae0fd2f6c28c1a43afc6d638ea3bff252086db99a971e339dae1900514d542be5e1a3030684d7f15c52d0c4e8a6a386bf345db823e7bc6e8949f7659c6a
7
- data.tar.gz: 1f2795dda6e9d52c45d3a830abfba9fd8c1cf450c39d3f6e491de95a4feb691083e808419590b3a29a16b1e9939d428ec0d6a3d5a7279e5e805b820948702354
6
+ metadata.gz: 8e76448907cc07d651f9b8c046570475bfd12315aba626a007fefce15be274742c444e5b7120654c6598f3166f3ee4f2debfc6b3c1b72cfcb2ee1ed26a7cd80a
7
+ data.tar.gz: d443d478fb70eefd820d0361e5dffc0ec83bcb48eaf78b142a709d1a9c64be8270c5322a6511c42054031ec96633296c27f91cc234f4971c6eaf41059f9ea996
@@ -7,9 +7,6 @@
7
7
 
8
8
  <!-- mandatory variable -->
9
9
 
10
- <!-- mandatory variable -->
11
- <xsl:variable name="namespace_full">https://www.metanorma.org/ns/ieee</xsl:variable>
12
-
13
10
  <!-- mandatory variable -->
14
11
  <xsl:variable name="debug">false</xsl:variable>
15
12
 
@@ -2657,9 +2654,10 @@
2657
2654
  </xsl:choose>
2658
2655
  </xsl:variable> -->
2659
2656
  <xsl:element name="{$element-name}">
2660
- <xsl:call-template name="setTextAlignment">
2661
- <xsl:with-param name="default">justify</xsl:with-param>
2657
+ <xsl:call-template name="setBlockAttributes">
2658
+ <xsl:with-param name="text_align_default">justify</xsl:with-param>
2662
2659
  </xsl:call-template>
2660
+
2663
2661
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute><!-- 8pt -->
2664
2662
  <xsl:if test="($current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report') and (ancestor::ieee:sections or ancestor::ieee:annex)">
2665
2663
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -3800,7 +3798,7 @@
3800
3798
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="ieee:xref"/>
3801
3799
 
3802
3800
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
3803
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
3801
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
3804
3802
 
3805
3803
  <!-- external parameters -->
3806
3804
 
@@ -5550,7 +5548,7 @@
5550
5548
 
5551
5549
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
5552
5550
 
5553
- <xsl:variable name="updated_xml_step_move_pagebreak_">
5551
+ <xsl:variable name="updated_xml_step_move_pagebreak">
5554
5552
 
5555
5553
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
5556
5554
 
@@ -5568,17 +5566,32 @@
5568
5566
  </xsl:variable>
5569
5567
 
5570
5568
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
5571
-
5569
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
5570
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
5572
5571
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
5573
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
5572
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
5574
5573
  </redirect:write>
5574
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
5575
5575
 
5576
5576
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5577
5577
 
5578
+ <!-- TODO: instead of
5579
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
5580
+ in each template, add removing empty page_sequence here
5581
+ -->
5582
+
5583
+ <xsl:if test="$debug = 'true'">
5584
+ <redirect:write file="page_sequence_preface.xml">
5585
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5586
+ </redirect:write>
5587
+ </xsl:if>
5588
+
5589
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
5578
5590
  <xsl:call-template name="deleteFile">
5579
5591
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
5580
5592
  </xsl:call-template>
5581
- </xsl:template>
5593
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
5594
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
5582
5595
 
5583
5596
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
5584
5597
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -5603,37 +5616,7 @@
5603
5616
  </xsl:for-each>
5604
5617
  </xsl:template><!-- END: processMainSectionsDefault -->
5605
5618
 
5606
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
5607
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5608
- <xsl:sort select="@displayorder" data-type="number"/>
5609
- <xsl:variable name="flatxml">
5610
- <xsl:apply-templates select="." mode="flatxml"/>
5611
- </xsl:variable>
5612
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5613
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5614
-
5615
- </xsl:for-each>
5616
-
5617
- <xsl:for-each select="/*/*[local-name()='annex']">
5618
- <xsl:sort select="@displayorder" data-type="number"/>
5619
- <xsl:variable name="flatxml">
5620
- <xsl:apply-templates select="." mode="flatxml"/>
5621
- </xsl:variable>
5622
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5623
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5624
- </xsl:for-each>
5625
-
5626
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5627
- <xsl:sort select="@displayorder" data-type="number"/>
5628
- <xsl:variable name="flatxml">
5629
- <xsl:apply-templates select="." mode="flatxml"/>
5630
- </xsl:variable>
5631
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5632
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5633
- </xsl:for-each>
5634
- </xsl:template>
5635
-
5636
- <!-- Example:
5619
+ <!-- Example:
5637
5620
  <iso-standard>
5638
5621
  <sections>
5639
5622
  <page_sequence>
@@ -5653,7 +5636,7 @@
5653
5636
  -->
5654
5637
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
5655
5638
 
5656
- <xsl:variable name="updated_xml_step_move_pagebreak_">
5639
+ <xsl:variable name="updated_xml_step_move_pagebreak">
5657
5640
 
5658
5641
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
5659
5642
 
@@ -5690,11 +5673,17 @@
5690
5673
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
5691
5674
 
5692
5675
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
5693
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
5676
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
5694
5677
  </redirect:write>
5695
5678
 
5696
5679
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5697
5680
 
5681
+ <xsl:if test="$debug = 'true'">
5682
+ <redirect:write file="page_sequence_main.xml">
5683
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5684
+ </redirect:write>
5685
+ </xsl:if>
5686
+
5698
5687
  <xsl:call-template name="deleteFile">
5699
5688
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
5700
5689
  </xsl:call-template>
@@ -5707,6 +5696,14 @@
5707
5696
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
5708
5697
  </xsl:template>
5709
5698
 
5699
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
5700
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
5701
+ <xsl:choose>
5702
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
5703
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
5704
+ </xsl:choose>
5705
+ </xsl:template>
5706
+
5710
5707
  <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>
5711
5708
  <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>
5712
5709
  <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>
@@ -6044,7 +6041,9 @@
6044
6041
 
6045
6042
  <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']"/>
6046
6043
  <xsl:if test="$isNoteOrFnExist = 'true'">
6047
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
6044
+
6045
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
6046
+
6048
6047
  </xsl:if>
6049
6048
 
6050
6049
  <xsl:choose>
@@ -6101,13 +6100,14 @@
6101
6100
  </fo:table>
6102
6101
 
6103
6102
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
6104
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
6105
- <xsl:call-template name="insertTableFooterInSeparateTable">
6106
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
6107
- <xsl:with-param name="colwidths" select="$colwidths"/>
6108
- <xsl:with-param name="colgroup" select="$colgroup"/>
6109
- </xsl:call-template>
6110
- </xsl:for-each>
6103
+
6104
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
6105
+ <xsl:call-template name="insertTableFooterInSeparateTable">
6106
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
6107
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6108
+ <xsl:with-param name="colgroup" select="$colgroup"/>
6109
+ </xsl:call-template>
6110
+ </xsl:for-each>
6111
6111
 
6112
6112
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
6113
6113
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -6461,8 +6461,10 @@
6461
6461
  <width_min><xsl:value-of select="@width_min"/></width_min>
6462
6462
  <e><xsl:value-of select="$d * $W div $D"/></e>
6463
6463
  <!-- set the column's width to the minimum width plus d times W over D. -->
6464
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
6465
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
6464
6466
  <column divider="100">
6465
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
6467
+ <xsl:value-of select="$column_width"/>
6466
6468
  </column>
6467
6469
  </xsl:for-each>
6468
6470
 
@@ -6923,6 +6925,22 @@
6923
6925
 
6924
6926
  <xsl:call-template name="refine_table-header-cell-style"/>
6925
6927
 
6928
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
6929
+ <!-- <xsl:choose>
6930
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
6931
+ <fo:block-container reference-orientation="270">
6932
+ <fo:block role="SKIP" text-align="start">
6933
+ <xsl:apply-templates />
6934
+ </fo:block>
6935
+ </fo:block-container>
6936
+ </xsl:when>
6937
+ <xsl:otherwise>
6938
+ <fo:block role="SKIP">
6939
+ <xsl:apply-templates />
6940
+ </fo:block>
6941
+ </xsl:otherwise>
6942
+ </xsl:choose> -->
6943
+
6926
6944
  <fo:block role="SKIP">
6927
6945
  <xsl:apply-templates/>
6928
6946
  </fo:block>
@@ -10418,6 +10436,15 @@
10418
10436
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
10419
10437
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
10420
10438
  </xsl:when>
10439
+ <!-- in WebP format, then convert image into PNG -->
10440
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
10441
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
10442
+ <xsl:value-of select="$src_png"/>
10443
+ </xsl:when>
10444
+ <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'))">
10445
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
10446
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
10447
+ </xsl:when>
10421
10448
  <xsl:when test="not(starts-with(@src, 'data:'))">
10422
10449
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
10423
10450
  </xsl:when>
@@ -14141,6 +14168,75 @@
14141
14168
  <!-- ===================================== -->
14142
14169
  <!-- Update xml -->
14143
14170
  <!-- ===================================== -->
14171
+
14172
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
14173
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
14174
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
14175
+
14176
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
14177
+ <xsl:variable name="updated_xml_step1">
14178
+ <xsl:if test="$table_if = 'false'">
14179
+ <xsl:apply-templates mode="update_xml_step1"/>
14180
+ </xsl:if>
14181
+ </xsl:variable>
14182
+
14183
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
14184
+ <xsl:if test="$debug = 'true'">
14185
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
14186
+ <xsl:message>END updated_xml_step1</xsl:message>
14187
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
14188
+ <xsl:copy-of select="$updated_xml_step1"/>
14189
+ </redirect:write> -->
14190
+ </xsl:if>
14191
+
14192
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
14193
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
14194
+
14195
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
14196
+ <xsl:variable name="updated_xml_step2">
14197
+
14198
+ <xsl:if test="$table_if = 'false'">
14199
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step1)" mode="update_xml_step2"/>
14200
+ </xsl:if>
14201
+
14202
+ </xsl:variable>
14203
+
14204
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
14205
+ <xsl:if test="$debug = 'true'">
14206
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
14207
+ <xsl:message>END updated_xml_step2</xsl:message>
14208
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
14209
+ <xsl:copy-of select="$updated_xml_step2"/>
14210
+ </redirect:write> -->
14211
+ </xsl:if>
14212
+
14213
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
14214
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
14215
+
14216
+ <xsl:variable name="updated_xml_step3">
14217
+ <xsl:choose>
14218
+ <xsl:when test="$table_if = 'false'">
14219
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
14220
+ </xsl:when>
14221
+ <xsl:otherwise>
14222
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
14223
+ </xsl:otherwise>
14224
+ </xsl:choose>
14225
+ </xsl:variable>
14226
+
14227
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
14228
+ <xsl:if test="$debug = 'true'">
14229
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
14230
+ <xsl:message>END updated_xml_step3</xsl:message>
14231
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
14232
+ <xsl:copy-of select="$updated_xml_step3"/>
14233
+ </redirect:write> -->
14234
+ </xsl:if>
14235
+
14236
+ <xsl:copy-of select="$updated_xml_step3"/>
14237
+
14238
+ </xsl:template>
14239
+
14144
14240
  <!-- =========================================================================== -->
14145
14241
  <!-- STEP1: -->
14146
14242
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -14340,7 +14436,7 @@
14340
14436
 
14341
14437
  <!-- determine pagebreak is last element before </fo:flow> or not -->
14342
14438
  <xsl:variable name="isLast">
14343
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14439
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14344
14440
  <xsl:if test="following-sibling::*">false</xsl:if>
14345
14441
  </xsl:for-each>
14346
14442
  </xsl:variable>
@@ -14362,7 +14458,7 @@
14362
14458
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
14363
14459
 
14364
14460
  <!-- create a new page_sequence (opening elements) -->
14365
- <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>
14461
+ <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>
14366
14462
 
14367
14463
  <xsl:call-template name="insertOpeningElements">
14368
14464
  <xsl:with-param name="tree" select="$tree"/>
@@ -14372,7 +14468,7 @@
14372
14468
  </xsl:template>
14373
14469
 
14374
14470
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
14375
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14471
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14376
14472
  <element pos="{position()}">
14377
14473
  <xsl:copy-of select="@*[local-name() != 'id']"/>
14378
14474
  <xsl:value-of select="name()"/>
@@ -14657,7 +14753,7 @@
14657
14753
  <xsl:value-of select="substring-before($text, $tag_open)"/>
14658
14754
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
14659
14755
 
14660
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
14756
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
14661
14757
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
14662
14758
  </xsl:element>
14663
14759
 
@@ -15477,7 +15573,10 @@
15477
15573
  <xsl:call-template name="setTextAlignment">
15478
15574
  <xsl:with-param name="default" select="$text_align_default"/>
15479
15575
  </xsl:call-template>
15576
+ <xsl:call-template name="setKeepAttributes"/>
15577
+ </xsl:template>
15480
15578
 
15579
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
15481
15580
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
15482
15581
  <!-- Example: keep-lines-together="true" -->
15483
15582
  <xsl:if test="@keep-lines-together = 'true'">
@@ -15489,6 +15588,72 @@
15489
15588
  </xsl:if>
15490
15589
  </xsl:template>
15491
15590
 
15591
+ <!-- insert cover page image -->
15592
+ <!-- background cover image -->
15593
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
15594
+ <xsl:param name="number">1</xsl:param>
15595
+ <xsl:param name="name">coverpage-image</xsl:param>
15596
+ <xsl:variable name="num" select="number($number)"/>
15597
+ <!-- background image -->
15598
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
15599
+ <fo:block>
15600
+ <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]">
15601
+ <xsl:choose>
15602
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
15603
+ <fo:instream-foreign-object fox:alt-text="Image Front">
15604
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
15605
+ <xsl:call-template name="getSVG"/>
15606
+ </fo:instream-foreign-object>
15607
+ </xsl:when>
15608
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
15609
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
15610
+ </xsl:when>
15611
+ <xsl:otherwise> <!-- bitmap image -->
15612
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
15613
+ <xsl:if test="$coverimage_src != ''">
15614
+ <xsl:variable name="coverpage">
15615
+ <xsl:call-template name="getImageURL">
15616
+ <xsl:with-param name="src" select="$coverimage_src"/>
15617
+ </xsl:call-template>
15618
+ </xsl:variable>
15619
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
15620
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
15621
+ </xsl:if>
15622
+ </xsl:otherwise>
15623
+ </xsl:choose>
15624
+ </xsl:for-each>
15625
+ </fo:block>
15626
+ </fo:block-container>
15627
+ </xsl:template>
15628
+
15629
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
15630
+ <xsl:param name="src"/>
15631
+ <xsl:choose>
15632
+ <xsl:when test="starts-with($src, 'data:image')">
15633
+ <xsl:value-of select="$src"/>
15634
+ </xsl:when>
15635
+ <xsl:otherwise>
15636
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
15637
+ </xsl:otherwise>
15638
+ </xsl:choose>
15639
+ </xsl:template>
15640
+
15641
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
15642
+ <xsl:choose>
15643
+ <xsl:when test="*[local-name() = 'svg']">
15644
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
15645
+ </xsl:when>
15646
+ <xsl:otherwise>
15647
+ <xsl:variable name="svg_content" select="document(@src)"/>
15648
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
15649
+ <xsl:apply-templates select="." mode="svg_update"/>
15650
+ </xsl:for-each>
15651
+ </xsl:otherwise>
15652
+ </xsl:choose>
15653
+ </xsl:template>
15654
+
15655
+ <!-- END: insert cover page image -->
15656
+
15492
15657
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
15493
15658
  <xsl:param name="number"/>
15494
15659
  <xsl:param name="first"/>
@@ -7,9 +7,6 @@
7
7
 
8
8
  <!-- mandatory variable -->
9
9
 
10
- <!-- mandatory variable -->
11
- <xsl:variable name="namespace_full">https://www.metanorma.org/ns/ieee</xsl:variable>
12
-
13
10
  <!-- mandatory variable -->
14
11
  <xsl:variable name="debug">false</xsl:variable>
15
12
 
@@ -2657,9 +2654,10 @@
2657
2654
  </xsl:choose>
2658
2655
  </xsl:variable> -->
2659
2656
  <xsl:element name="{$element-name}">
2660
- <xsl:call-template name="setTextAlignment">
2661
- <xsl:with-param name="default">justify</xsl:with-param>
2657
+ <xsl:call-template name="setBlockAttributes">
2658
+ <xsl:with-param name="text_align_default">justify</xsl:with-param>
2662
2659
  </xsl:call-template>
2660
+
2663
2661
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute><!-- 8pt -->
2664
2662
  <xsl:if test="($current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report') and (ancestor::ieee:sections or ancestor::ieee:annex)">
2665
2663
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -3800,7 +3798,7 @@
3800
3798
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="ieee:xref"/>
3801
3799
 
3802
3800
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
3803
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
3801
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
3804
3802
 
3805
3803
  <!-- external parameters -->
3806
3804
 
@@ -5550,7 +5548,7 @@
5550
5548
 
5551
5549
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
5552
5550
 
5553
- <xsl:variable name="updated_xml_step_move_pagebreak_">
5551
+ <xsl:variable name="updated_xml_step_move_pagebreak">
5554
5552
 
5555
5553
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
5556
5554
 
@@ -5568,17 +5566,32 @@
5568
5566
  </xsl:variable>
5569
5567
 
5570
5568
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
5571
-
5569
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
5570
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
5572
5571
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
5573
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
5572
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
5574
5573
  </redirect:write>
5574
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
5575
5575
 
5576
5576
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5577
5577
 
5578
+ <!-- TODO: instead of
5579
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
5580
+ in each template, add removing empty page_sequence here
5581
+ -->
5582
+
5583
+ <xsl:if test="$debug = 'true'">
5584
+ <redirect:write file="page_sequence_preface.xml">
5585
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5586
+ </redirect:write>
5587
+ </xsl:if>
5588
+
5589
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
5578
5590
  <xsl:call-template name="deleteFile">
5579
5591
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
5580
5592
  </xsl:call-template>
5581
- </xsl:template>
5593
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
5594
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
5582
5595
 
5583
5596
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
5584
5597
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -5603,37 +5616,7 @@
5603
5616
  </xsl:for-each>
5604
5617
  </xsl:template><!-- END: processMainSectionsDefault -->
5605
5618
 
5606
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
5607
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5608
- <xsl:sort select="@displayorder" data-type="number"/>
5609
- <xsl:variable name="flatxml">
5610
- <xsl:apply-templates select="." mode="flatxml"/>
5611
- </xsl:variable>
5612
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5613
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5614
-
5615
- </xsl:for-each>
5616
-
5617
- <xsl:for-each select="/*/*[local-name()='annex']">
5618
- <xsl:sort select="@displayorder" data-type="number"/>
5619
- <xsl:variable name="flatxml">
5620
- <xsl:apply-templates select="." mode="flatxml"/>
5621
- </xsl:variable>
5622
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5623
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5624
- </xsl:for-each>
5625
-
5626
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5627
- <xsl:sort select="@displayorder" data-type="number"/>
5628
- <xsl:variable name="flatxml">
5629
- <xsl:apply-templates select="." mode="flatxml"/>
5630
- </xsl:variable>
5631
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5632
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5633
- </xsl:for-each>
5634
- </xsl:template>
5635
-
5636
- <!-- Example:
5619
+ <!-- Example:
5637
5620
  <iso-standard>
5638
5621
  <sections>
5639
5622
  <page_sequence>
@@ -5653,7 +5636,7 @@
5653
5636
  -->
5654
5637
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
5655
5638
 
5656
- <xsl:variable name="updated_xml_step_move_pagebreak_">
5639
+ <xsl:variable name="updated_xml_step_move_pagebreak">
5657
5640
 
5658
5641
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
5659
5642
 
@@ -5690,11 +5673,17 @@
5690
5673
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
5691
5674
 
5692
5675
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
5693
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
5676
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
5694
5677
  </redirect:write>
5695
5678
 
5696
5679
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5697
5680
 
5681
+ <xsl:if test="$debug = 'true'">
5682
+ <redirect:write file="page_sequence_main.xml">
5683
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
5684
+ </redirect:write>
5685
+ </xsl:if>
5686
+
5698
5687
  <xsl:call-template name="deleteFile">
5699
5688
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
5700
5689
  </xsl:call-template>
@@ -5707,6 +5696,14 @@
5707
5696
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
5708
5697
  </xsl:template>
5709
5698
 
5699
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
5700
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
5701
+ <xsl:choose>
5702
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
5703
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
5704
+ </xsl:choose>
5705
+ </xsl:template>
5706
+
5710
5707
  <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>
5711
5708
  <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>
5712
5709
  <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>
@@ -6044,7 +6041,9 @@
6044
6041
 
6045
6042
  <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']"/>
6046
6043
  <xsl:if test="$isNoteOrFnExist = 'true'">
6047
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
6044
+
6045
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
6046
+
6048
6047
  </xsl:if>
6049
6048
 
6050
6049
  <xsl:choose>
@@ -6101,13 +6100,14 @@
6101
6100
  </fo:table>
6102
6101
 
6103
6102
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
6104
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
6105
- <xsl:call-template name="insertTableFooterInSeparateTable">
6106
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
6107
- <xsl:with-param name="colwidths" select="$colwidths"/>
6108
- <xsl:with-param name="colgroup" select="$colgroup"/>
6109
- </xsl:call-template>
6110
- </xsl:for-each>
6103
+
6104
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
6105
+ <xsl:call-template name="insertTableFooterInSeparateTable">
6106
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
6107
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6108
+ <xsl:with-param name="colgroup" select="$colgroup"/>
6109
+ </xsl:call-template>
6110
+ </xsl:for-each>
6111
6111
 
6112
6112
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
6113
6113
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -6461,8 +6461,10 @@
6461
6461
  <width_min><xsl:value-of select="@width_min"/></width_min>
6462
6462
  <e><xsl:value-of select="$d * $W div $D"/></e>
6463
6463
  <!-- set the column's width to the minimum width plus d times W over D. -->
6464
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
6465
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
6464
6466
  <column divider="100">
6465
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
6467
+ <xsl:value-of select="$column_width"/>
6466
6468
  </column>
6467
6469
  </xsl:for-each>
6468
6470
 
@@ -6923,6 +6925,22 @@
6923
6925
 
6924
6926
  <xsl:call-template name="refine_table-header-cell-style"/>
6925
6927
 
6928
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
6929
+ <!-- <xsl:choose>
6930
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
6931
+ <fo:block-container reference-orientation="270">
6932
+ <fo:block role="SKIP" text-align="start">
6933
+ <xsl:apply-templates />
6934
+ </fo:block>
6935
+ </fo:block-container>
6936
+ </xsl:when>
6937
+ <xsl:otherwise>
6938
+ <fo:block role="SKIP">
6939
+ <xsl:apply-templates />
6940
+ </fo:block>
6941
+ </xsl:otherwise>
6942
+ </xsl:choose> -->
6943
+
6926
6944
  <fo:block role="SKIP">
6927
6945
  <xsl:apply-templates/>
6928
6946
  </fo:block>
@@ -10418,6 +10436,15 @@
10418
10436
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
10419
10437
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
10420
10438
  </xsl:when>
10439
+ <!-- in WebP format, then convert image into PNG -->
10440
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
10441
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
10442
+ <xsl:value-of select="$src_png"/>
10443
+ </xsl:when>
10444
+ <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'))">
10445
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
10446
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
10447
+ </xsl:when>
10421
10448
  <xsl:when test="not(starts-with(@src, 'data:'))">
10422
10449
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
10423
10450
  </xsl:when>
@@ -14141,6 +14168,75 @@
14141
14168
  <!-- ===================================== -->
14142
14169
  <!-- Update xml -->
14143
14170
  <!-- ===================================== -->
14171
+
14172
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
14173
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
14174
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
14175
+
14176
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
14177
+ <xsl:variable name="updated_xml_step1">
14178
+ <xsl:if test="$table_if = 'false'">
14179
+ <xsl:apply-templates mode="update_xml_step1"/>
14180
+ </xsl:if>
14181
+ </xsl:variable>
14182
+
14183
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
14184
+ <xsl:if test="$debug = 'true'">
14185
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
14186
+ <xsl:message>END updated_xml_step1</xsl:message>
14187
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
14188
+ <xsl:copy-of select="$updated_xml_step1"/>
14189
+ </redirect:write> -->
14190
+ </xsl:if>
14191
+
14192
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
14193
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
14194
+
14195
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
14196
+ <xsl:variable name="updated_xml_step2">
14197
+
14198
+ <xsl:if test="$table_if = 'false'">
14199
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step1)" mode="update_xml_step2"/>
14200
+ </xsl:if>
14201
+
14202
+ </xsl:variable>
14203
+
14204
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
14205
+ <xsl:if test="$debug = 'true'">
14206
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
14207
+ <xsl:message>END updated_xml_step2</xsl:message>
14208
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
14209
+ <xsl:copy-of select="$updated_xml_step2"/>
14210
+ </redirect:write> -->
14211
+ </xsl:if>
14212
+
14213
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
14214
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
14215
+
14216
+ <xsl:variable name="updated_xml_step3">
14217
+ <xsl:choose>
14218
+ <xsl:when test="$table_if = 'false'">
14219
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
14220
+ </xsl:when>
14221
+ <xsl:otherwise>
14222
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
14223
+ </xsl:otherwise>
14224
+ </xsl:choose>
14225
+ </xsl:variable>
14226
+
14227
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
14228
+ <xsl:if test="$debug = 'true'">
14229
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
14230
+ <xsl:message>END updated_xml_step3</xsl:message>
14231
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
14232
+ <xsl:copy-of select="$updated_xml_step3"/>
14233
+ </redirect:write> -->
14234
+ </xsl:if>
14235
+
14236
+ <xsl:copy-of select="$updated_xml_step3"/>
14237
+
14238
+ </xsl:template>
14239
+
14144
14240
  <!-- =========================================================================== -->
14145
14241
  <!-- STEP1: -->
14146
14242
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -14340,7 +14436,7 @@
14340
14436
 
14341
14437
  <!-- determine pagebreak is last element before </fo:flow> or not -->
14342
14438
  <xsl:variable name="isLast">
14343
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14439
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14344
14440
  <xsl:if test="following-sibling::*">false</xsl:if>
14345
14441
  </xsl:for-each>
14346
14442
  </xsl:variable>
@@ -14362,7 +14458,7 @@
14362
14458
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
14363
14459
 
14364
14460
  <!-- create a new page_sequence (opening elements) -->
14365
- <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>
14461
+ <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>
14366
14462
 
14367
14463
  <xsl:call-template name="insertOpeningElements">
14368
14464
  <xsl:with-param name="tree" select="$tree"/>
@@ -14372,7 +14468,7 @@
14372
14468
  </xsl:template>
14373
14469
 
14374
14470
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
14375
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14471
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
14376
14472
  <element pos="{position()}">
14377
14473
  <xsl:copy-of select="@*[local-name() != 'id']"/>
14378
14474
  <xsl:value-of select="name()"/>
@@ -14657,7 +14753,7 @@
14657
14753
  <xsl:value-of select="substring-before($text, $tag_open)"/>
14658
14754
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
14659
14755
 
14660
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
14756
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
14661
14757
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
14662
14758
  </xsl:element>
14663
14759
 
@@ -15477,7 +15573,10 @@
15477
15573
  <xsl:call-template name="setTextAlignment">
15478
15574
  <xsl:with-param name="default" select="$text_align_default"/>
15479
15575
  </xsl:call-template>
15576
+ <xsl:call-template name="setKeepAttributes"/>
15577
+ </xsl:template>
15480
15578
 
15579
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
15481
15580
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
15482
15581
  <!-- Example: keep-lines-together="true" -->
15483
15582
  <xsl:if test="@keep-lines-together = 'true'">
@@ -15489,6 +15588,72 @@
15489
15588
  </xsl:if>
15490
15589
  </xsl:template>
15491
15590
 
15591
+ <!-- insert cover page image -->
15592
+ <!-- background cover image -->
15593
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
15594
+ <xsl:param name="number">1</xsl:param>
15595
+ <xsl:param name="name">coverpage-image</xsl:param>
15596
+ <xsl:variable name="num" select="number($number)"/>
15597
+ <!-- background image -->
15598
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
15599
+ <fo:block>
15600
+ <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]">
15601
+ <xsl:choose>
15602
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
15603
+ <fo:instream-foreign-object fox:alt-text="Image Front">
15604
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
15605
+ <xsl:call-template name="getSVG"/>
15606
+ </fo:instream-foreign-object>
15607
+ </xsl:when>
15608
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
15609
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
15610
+ </xsl:when>
15611
+ <xsl:otherwise> <!-- bitmap image -->
15612
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
15613
+ <xsl:if test="$coverimage_src != ''">
15614
+ <xsl:variable name="coverpage">
15615
+ <xsl:call-template name="getImageURL">
15616
+ <xsl:with-param name="src" select="$coverimage_src"/>
15617
+ </xsl:call-template>
15618
+ </xsl:variable>
15619
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
15620
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
15621
+ </xsl:if>
15622
+ </xsl:otherwise>
15623
+ </xsl:choose>
15624
+ </xsl:for-each>
15625
+ </fo:block>
15626
+ </fo:block-container>
15627
+ </xsl:template>
15628
+
15629
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
15630
+ <xsl:param name="src"/>
15631
+ <xsl:choose>
15632
+ <xsl:when test="starts-with($src, 'data:image')">
15633
+ <xsl:value-of select="$src"/>
15634
+ </xsl:when>
15635
+ <xsl:otherwise>
15636
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
15637
+ </xsl:otherwise>
15638
+ </xsl:choose>
15639
+ </xsl:template>
15640
+
15641
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
15642
+ <xsl:choose>
15643
+ <xsl:when test="*[local-name() = 'svg']">
15644
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
15645
+ </xsl:when>
15646
+ <xsl:otherwise>
15647
+ <xsl:variable name="svg_content" select="document(@src)"/>
15648
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
15649
+ <xsl:apply-templates select="." mode="svg_update"/>
15650
+ </xsl:for-each>
15651
+ </xsl:otherwise>
15652
+ </xsl:choose>
15653
+ </xsl:template>
15654
+
15655
+ <!-- END: insert cover page image -->
15656
+
15492
15657
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
15493
15658
  <xsl:param name="number"/>
15494
15659
  <xsl:param name="first"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.2.9".freeze
3
+ VERSION = "1.2.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
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-standoc