metanorma-ogc 2.5.9 → 2.5.10

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: 697084875237cbadc678cc91aeceb102990c4f82b59447b9e8f7acbb37f80b03
4
- data.tar.gz: aec53f374388a4692d44526a4fcaab55408618a0d607afc6e7a02da4e60fca81
3
+ metadata.gz: 293e56616f190040c73828ec1363fa9fafb029cf486b871acb66d2cade57c66a
4
+ data.tar.gz: fb262d4965b0bd780ba0f728ac706aef318973c7b519aae31b2c341930ba61d8
5
5
  SHA512:
6
- metadata.gz: e6abc0aa95484027176e13e5a617551ee898a786133323082cdd82f0af76f35655c3f15ab2ed6185cc7417fb6a29bd080190376a7a003807d1566ac0bc8037ca
7
- data.tar.gz: 4b5e738eae892de427b998f6715297bb945637882e0bc6101b0687f3afb00441abdb4beb68cb212179bdd4cabe32d3ad162609a669b8b2bbf2d63bd68574864d
6
+ metadata.gz: b9e35f6ecb20df080cf6d8d70657883ac7ad6013fcdc67e1dfe469b05e3765f9c8bcead0321cd1ac871864908151d0c39d783b666b7ba8b459290fb3b121c208
7
+ data.tar.gz: 674ffa4c9dcdd122bff0a1767bab246bda09f6796cb45cc6971b00bbe8967b34bee3d7e19d81693c9555650b5e91c73a336bc32d139ec5a0ec9b7146cf744c8b
@@ -1125,13 +1125,9 @@
1125
1125
  <xsl:value-of select="@id"/>
1126
1126
  </xsl:attribute>
1127
1127
  </xsl:if>
1128
- <xsl:attribute name="text-align">
1129
- <xsl:choose>
1130
- <!-- <xsl:when test="ancestor::ogc:preface">justify</xsl:when> -->
1131
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1132
- <xsl:otherwise>left</xsl:otherwise><!-- justify -->
1133
- </xsl:choose>
1134
- </xsl:attribute>
1128
+
1129
+ <xsl:call-template name="setBlockAttributes"/>
1130
+
1135
1131
  <xsl:if test="not(ancestor::ogc:table)">
1136
1132
  <xsl:attribute name="line-height">124%</xsl:attribute>
1137
1133
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1329,6 +1325,10 @@
1329
1325
  </fo:block-container>
1330
1326
  </xsl:template>
1331
1327
 
1328
+ <xsl:template match="*[local-name() = 'pagebreak']" priority="2">
1329
+ <fo:block break-after="page"/>
1330
+ </xsl:template>
1331
+
1332
1332
  <xsl:template name="insertHeaderFooter">
1333
1333
  <xsl:param name="color" select="$color_blue"/>
1334
1334
  <fo:static-content flow-name="footer" role="artifact">
@@ -1634,7 +1634,7 @@
1634
1634
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="ogc:xref"/>
1635
1635
 
1636
1636
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1637
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
1637
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
1638
1638
 
1639
1639
  <!-- external parameters -->
1640
1640
 
@@ -3446,7 +3446,7 @@
3446
3446
 
3447
3447
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
3448
3448
 
3449
- <xsl:variable name="updated_xml_step_move_pagebreak_">
3449
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3450
3450
 
3451
3451
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3452
3452
 
@@ -3464,17 +3464,32 @@
3464
3464
  </xsl:variable>
3465
3465
 
3466
3466
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3467
-
3467
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
3468
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3468
3469
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3469
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3470
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3470
3471
  </redirect:write>
3472
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3471
3473
 
3472
3474
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3473
3475
 
3476
+ <!-- TODO: instead of
3477
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
3478
+ in each template, add removing empty page_sequence here
3479
+ -->
3480
+
3481
+ <xsl:if test="$debug = 'true'">
3482
+ <redirect:write file="page_sequence_preface.xml">
3483
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3484
+ </redirect:write>
3485
+ </xsl:if>
3486
+
3487
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3474
3488
  <xsl:call-template name="deleteFile">
3475
3489
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3476
3490
  </xsl:call-template>
3477
- </xsl:template>
3491
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3492
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
3478
3493
 
3479
3494
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
3480
3495
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -3499,37 +3514,7 @@
3499
3514
  </xsl:for-each>
3500
3515
  </xsl:template><!-- END: processMainSectionsDefault -->
3501
3516
 
3502
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
3503
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3504
- <xsl:sort select="@displayorder" data-type="number"/>
3505
- <xsl:variable name="flatxml">
3506
- <xsl:apply-templates select="." mode="flatxml"/>
3507
- </xsl:variable>
3508
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3509
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3510
-
3511
- </xsl:for-each>
3512
-
3513
- <xsl:for-each select="/*/*[local-name()='annex']">
3514
- <xsl:sort select="@displayorder" data-type="number"/>
3515
- <xsl:variable name="flatxml">
3516
- <xsl:apply-templates select="." mode="flatxml"/>
3517
- </xsl:variable>
3518
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3519
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3520
- </xsl:for-each>
3521
-
3522
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3523
- <xsl:sort select="@displayorder" data-type="number"/>
3524
- <xsl:variable name="flatxml">
3525
- <xsl:apply-templates select="." mode="flatxml"/>
3526
- </xsl:variable>
3527
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3528
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3529
- </xsl:for-each>
3530
- </xsl:template>
3531
-
3532
- <!-- Example:
3517
+ <!-- Example:
3533
3518
  <iso-standard>
3534
3519
  <sections>
3535
3520
  <page_sequence>
@@ -3549,7 +3534,7 @@
3549
3534
  -->
3550
3535
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
3551
3536
 
3552
- <xsl:variable name="updated_xml_step_move_pagebreak_">
3537
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3553
3538
 
3554
3539
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3555
3540
 
@@ -3586,11 +3571,17 @@
3586
3571
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3587
3572
 
3588
3573
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3589
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3574
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3590
3575
  </redirect:write>
3591
3576
 
3592
3577
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3593
3578
 
3579
+ <xsl:if test="$debug = 'true'">
3580
+ <redirect:write file="page_sequence_main.xml">
3581
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3582
+ </redirect:write>
3583
+ </xsl:if>
3584
+
3594
3585
  <xsl:call-template name="deleteFile">
3595
3586
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3596
3587
  </xsl:call-template>
@@ -3603,6 +3594,14 @@
3603
3594
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
3604
3595
  </xsl:template>
3605
3596
 
3597
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
3598
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
3599
+ <xsl:choose>
3600
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
3601
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
3602
+ </xsl:choose>
3603
+ </xsl:template>
3604
+
3606
3605
  <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>
3607
3606
  <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>
3608
3607
  <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>
@@ -3958,7 +3957,9 @@
3958
3957
 
3959
3958
  <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']"/>
3960
3959
  <xsl:if test="$isNoteOrFnExist = 'true'">
3961
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3960
+
3961
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3962
+
3962
3963
  </xsl:if>
3963
3964
 
3964
3965
  <xsl:choose>
@@ -4015,13 +4016,14 @@
4015
4016
  </fo:table>
4016
4017
 
4017
4018
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4018
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4019
- <xsl:call-template name="insertTableFooterInSeparateTable">
4020
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
4021
- <xsl:with-param name="colwidths" select="$colwidths"/>
4022
- <xsl:with-param name="colgroup" select="$colgroup"/>
4023
- </xsl:call-template>
4024
- </xsl:for-each>
4019
+
4020
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4021
+ <xsl:call-template name="insertTableFooterInSeparateTable">
4022
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
4023
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4024
+ <xsl:with-param name="colgroup" select="$colgroup"/>
4025
+ </xsl:call-template>
4026
+ </xsl:for-each>
4025
4027
 
4026
4028
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
4027
4029
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -4407,8 +4409,10 @@
4407
4409
  <width_min><xsl:value-of select="@width_min"/></width_min>
4408
4410
  <e><xsl:value-of select="$d * $W div $D"/></e>
4409
4411
  <!-- set the column's width to the minimum width plus d times W over D. -->
4412
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4413
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
4410
4414
  <column divider="100">
4411
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4415
+ <xsl:value-of select="$column_width"/>
4412
4416
  </column>
4413
4417
  </xsl:for-each>
4414
4418
 
@@ -4816,6 +4820,22 @@
4816
4820
 
4817
4821
  <xsl:call-template name="refine_table-header-cell-style"/>
4818
4822
 
4823
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
4824
+ <!-- <xsl:choose>
4825
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
4826
+ <fo:block-container reference-orientation="270">
4827
+ <fo:block role="SKIP" text-align="start">
4828
+ <xsl:apply-templates />
4829
+ </fo:block>
4830
+ </fo:block-container>
4831
+ </xsl:when>
4832
+ <xsl:otherwise>
4833
+ <fo:block role="SKIP">
4834
+ <xsl:apply-templates />
4835
+ </fo:block>
4836
+ </xsl:otherwise>
4837
+ </xsl:choose> -->
4838
+
4819
4839
  <fo:block role="SKIP">
4820
4840
  <xsl:apply-templates/>
4821
4841
  </fo:block>
@@ -8336,6 +8356,15 @@
8336
8356
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
8337
8357
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
8338
8358
  </xsl:when>
8359
+ <!-- in WebP format, then convert image into PNG -->
8360
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
8361
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
8362
+ <xsl:value-of select="$src_png"/>
8363
+ </xsl:when>
8364
+ <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'))">
8365
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
8366
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8367
+ </xsl:when>
8339
8368
  <xsl:when test="not(starts-with(@src, 'data:'))">
8340
8369
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8341
8370
  </xsl:when>
@@ -12056,6 +12085,75 @@
12056
12085
  <!-- ===================================== -->
12057
12086
  <!-- Update xml -->
12058
12087
  <!-- ===================================== -->
12088
+
12089
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
12090
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
12091
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
12092
+
12093
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12094
+ <xsl:variable name="updated_xml_step1">
12095
+ <xsl:if test="$table_if = 'false'">
12096
+ <xsl:apply-templates mode="update_xml_step1"/>
12097
+ </xsl:if>
12098
+ </xsl:variable>
12099
+
12100
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
12101
+ <xsl:if test="$debug = 'true'">
12102
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
12103
+ <xsl:message>END updated_xml_step1</xsl:message>
12104
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
12105
+ <xsl:copy-of select="$updated_xml_step1"/>
12106
+ </redirect:write> -->
12107
+ </xsl:if>
12108
+
12109
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
12110
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
12111
+
12112
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12113
+ <xsl:variable name="updated_xml_step2">
12114
+
12115
+ <xsl:if test="$table_if = 'false'">
12116
+ <xsl:copy-of select="$updated_xml_step1"/>
12117
+ </xsl:if>
12118
+
12119
+ </xsl:variable>
12120
+
12121
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
12122
+ <xsl:if test="$debug = 'true'">
12123
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
12124
+ <xsl:message>END updated_xml_step2</xsl:message>
12125
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
12126
+ <xsl:copy-of select="$updated_xml_step2"/>
12127
+ </redirect:write> -->
12128
+ </xsl:if>
12129
+
12130
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
12131
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
12132
+
12133
+ <xsl:variable name="updated_xml_step3">
12134
+ <xsl:choose>
12135
+ <xsl:when test="$table_if = 'false'">
12136
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
12137
+ </xsl:when>
12138
+ <xsl:otherwise>
12139
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
12140
+ </xsl:otherwise>
12141
+ </xsl:choose>
12142
+ </xsl:variable>
12143
+
12144
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
12145
+ <xsl:if test="$debug = 'true'">
12146
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
12147
+ <xsl:message>END updated_xml_step3</xsl:message>
12148
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
12149
+ <xsl:copy-of select="$updated_xml_step3"/>
12150
+ </redirect:write> -->
12151
+ </xsl:if>
12152
+
12153
+ <xsl:copy-of select="$updated_xml_step3"/>
12154
+
12155
+ </xsl:template>
12156
+
12059
12157
  <!-- =========================================================================== -->
12060
12158
  <!-- STEP1: -->
12061
12159
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -12255,7 +12353,7 @@
12255
12353
 
12256
12354
  <!-- determine pagebreak is last element before </fo:flow> or not -->
12257
12355
  <xsl:variable name="isLast">
12258
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12356
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12259
12357
  <xsl:if test="following-sibling::*">false</xsl:if>
12260
12358
  </xsl:for-each>
12261
12359
  </xsl:variable>
@@ -12277,7 +12375,7 @@
12277
12375
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
12278
12376
 
12279
12377
  <!-- create a new page_sequence (opening elements) -->
12280
- <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>
12378
+ <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>
12281
12379
 
12282
12380
  <xsl:call-template name="insertOpeningElements">
12283
12381
  <xsl:with-param name="tree" select="$tree"/>
@@ -12287,7 +12385,7 @@
12287
12385
  </xsl:template>
12288
12386
 
12289
12387
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
12290
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12388
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12291
12389
  <element pos="{position()}">
12292
12390
  <xsl:copy-of select="@*[local-name() != 'id']"/>
12293
12391
  <xsl:value-of select="name()"/>
@@ -12468,7 +12566,7 @@
12468
12566
  <xsl:value-of select="substring-before($text, $tag_open)"/>
12469
12567
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
12470
12568
 
12471
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
12569
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
12472
12570
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
12473
12571
  </xsl:element>
12474
12572
 
@@ -13290,7 +13388,10 @@
13290
13388
  <xsl:call-template name="setTextAlignment">
13291
13389
  <xsl:with-param name="default" select="$text_align_default"/>
13292
13390
  </xsl:call-template>
13391
+ <xsl:call-template name="setKeepAttributes"/>
13392
+ </xsl:template>
13293
13393
 
13394
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
13294
13395
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
13295
13396
  <!-- Example: keep-lines-together="true" -->
13296
13397
  <xsl:if test="@keep-lines-together = 'true'">
@@ -13302,6 +13403,72 @@
13302
13403
  </xsl:if>
13303
13404
  </xsl:template>
13304
13405
 
13406
+ <!-- insert cover page image -->
13407
+ <!-- background cover image -->
13408
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
13409
+ <xsl:param name="number">1</xsl:param>
13410
+ <xsl:param name="name">coverpage-image</xsl:param>
13411
+ <xsl:variable name="num" select="number($number)"/>
13412
+ <!-- background image -->
13413
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
13414
+ <fo:block>
13415
+ <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]">
13416
+ <xsl:choose>
13417
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
13418
+ <fo:instream-foreign-object fox:alt-text="Image Front">
13419
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
13420
+ <xsl:call-template name="getSVG"/>
13421
+ </fo:instream-foreign-object>
13422
+ </xsl:when>
13423
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
13424
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
13425
+ </xsl:when>
13426
+ <xsl:otherwise> <!-- bitmap image -->
13427
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
13428
+ <xsl:if test="$coverimage_src != ''">
13429
+ <xsl:variable name="coverpage">
13430
+ <xsl:call-template name="getImageURL">
13431
+ <xsl:with-param name="src" select="$coverimage_src"/>
13432
+ </xsl:call-template>
13433
+ </xsl:variable>
13434
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
13435
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
13436
+ </xsl:if>
13437
+ </xsl:otherwise>
13438
+ </xsl:choose>
13439
+ </xsl:for-each>
13440
+ </fo:block>
13441
+ </fo:block-container>
13442
+ </xsl:template>
13443
+
13444
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
13445
+ <xsl:param name="src"/>
13446
+ <xsl:choose>
13447
+ <xsl:when test="starts-with($src, 'data:image')">
13448
+ <xsl:value-of select="$src"/>
13449
+ </xsl:when>
13450
+ <xsl:otherwise>
13451
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13452
+ </xsl:otherwise>
13453
+ </xsl:choose>
13454
+ </xsl:template>
13455
+
13456
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
13457
+ <xsl:choose>
13458
+ <xsl:when test="*[local-name() = 'svg']">
13459
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
13460
+ </xsl:when>
13461
+ <xsl:otherwise>
13462
+ <xsl:variable name="svg_content" select="document(@src)"/>
13463
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
13464
+ <xsl:apply-templates select="." mode="svg_update"/>
13465
+ </xsl:for-each>
13466
+ </xsl:otherwise>
13467
+ </xsl:choose>
13468
+ </xsl:template>
13469
+
13470
+ <!-- END: insert cover page image -->
13471
+
13305
13472
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
13306
13473
  <xsl:param name="number"/>
13307
13474
  <xsl:param name="first"/>