metanorma-csa 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: dd413ea3a096d7a914e02ad4e4f262e21645a47c2affd8e59e348c34187a6f95
4
- data.tar.gz: acc7e8a923eb8df82a58b9413eb13ef7bc40e119cd0378a08fcd2eeaf37fdb18
3
+ metadata.gz: 01ab802f408110b46f666f1a3acdd39893e875a344f1172eec8de88691e15e13
4
+ data.tar.gz: 15dfbc30ce7bce4386d2ceaa68a700166813faea8598aa9afd463274a322d83b
5
5
  SHA512:
6
- metadata.gz: 8f75d7cc155fcc5e42bd2dd1c9d040830aca2a43c17d8b8dc97d5b7863ed8814ab4d8b39231ab1ee70e28a00384d31eba00260dae806a357313ef526862248c7
7
- data.tar.gz: d1f16279ed9b3133627e8bd903d7aa11075586d49ad3dc2a56bcb34a2215d2bc43881c89f15cc6cd81e153b2be161d6965852c644c69e5e4c264ab47822f9990
6
+ metadata.gz: ddc98949c374daf19333db4dbd35b9203f0276f6b28da181c127844aeb732281eaab9e26166b31f7ac1f8adc4266a7a95fee02dfa525d03efdfb9f1b050a0728
7
+ data.tar.gz: 0f2e0fce985dbf798b9ef2071abe82d3b4823162263dd288dd4409683ea7fd12513bb62389ef30d53edc7d2adf6b1e52e88e696637a7902c2f3a67cef7839284
@@ -474,13 +474,9 @@
474
474
  <xsl:attribute name="id">
475
475
  <xsl:value-of select="@id"/>
476
476
  </xsl:attribute>
477
- <xsl:attribute name="text-align">
478
- <xsl:choose>
479
- <!-- <xsl:when test="ancestor::csa:preface">justify</xsl:when> -->
480
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
481
- <xsl:otherwise>left</xsl:otherwise><!-- justify -->
482
- </xsl:choose>
483
- </xsl:attribute>
477
+
478
+ <xsl:call-template name="setBlockAttributes"/>
479
+
484
480
  <xsl:attribute name="space-after">
485
481
  <xsl:choose>
486
482
  <xsl:when test="ancestor::csa:li">0pt</xsl:when>
@@ -579,7 +575,7 @@
579
575
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="csa:xref"/>
580
576
 
581
577
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
582
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
578
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
583
579
 
584
580
  <!-- external parameters -->
585
581
 
@@ -2239,7 +2235,7 @@
2239
2235
 
2240
2236
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
2241
2237
 
2242
- <xsl:variable name="updated_xml_step_move_pagebreak_">
2238
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2243
2239
 
2244
2240
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2245
2241
 
@@ -2257,17 +2253,32 @@
2257
2253
  </xsl:variable>
2258
2254
 
2259
2255
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2260
-
2256
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
2257
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2261
2258
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2262
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
2259
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2263
2260
  </redirect:write>
2261
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2264
2262
 
2265
2263
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2266
2264
 
2265
+ <!-- TODO: instead of
2266
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
2267
+ in each template, add removing empty page_sequence here
2268
+ -->
2269
+
2270
+ <xsl:if test="$debug = 'true'">
2271
+ <redirect:write file="page_sequence_preface.xml">
2272
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2273
+ </redirect:write>
2274
+ </xsl:if>
2275
+
2276
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2267
2277
  <xsl:call-template name="deleteFile">
2268
2278
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2269
2279
  </xsl:call-template>
2270
- </xsl:template>
2280
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2281
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
2271
2282
 
2272
2283
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
2273
2284
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -2292,37 +2303,7 @@
2292
2303
  </xsl:for-each>
2293
2304
  </xsl:template><!-- END: processMainSectionsDefault -->
2294
2305
 
2295
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
2296
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2297
- <xsl:sort select="@displayorder" data-type="number"/>
2298
- <xsl:variable name="flatxml">
2299
- <xsl:apply-templates select="." mode="flatxml"/>
2300
- </xsl:variable>
2301
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2302
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2303
-
2304
- </xsl:for-each>
2305
-
2306
- <xsl:for-each select="/*/*[local-name()='annex']">
2307
- <xsl:sort select="@displayorder" data-type="number"/>
2308
- <xsl:variable name="flatxml">
2309
- <xsl:apply-templates select="." mode="flatxml"/>
2310
- </xsl:variable>
2311
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2312
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2313
- </xsl:for-each>
2314
-
2315
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2316
- <xsl:sort select="@displayorder" data-type="number"/>
2317
- <xsl:variable name="flatxml">
2318
- <xsl:apply-templates select="." mode="flatxml"/>
2319
- </xsl:variable>
2320
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2321
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2322
- </xsl:for-each>
2323
- </xsl:template>
2324
-
2325
- <!-- Example:
2306
+ <!-- Example:
2326
2307
  <iso-standard>
2327
2308
  <sections>
2328
2309
  <page_sequence>
@@ -2342,7 +2323,7 @@
2342
2323
  -->
2343
2324
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
2344
2325
 
2345
- <xsl:variable name="updated_xml_step_move_pagebreak_">
2326
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2346
2327
 
2347
2328
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2348
2329
 
@@ -2379,11 +2360,17 @@
2379
2360
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2380
2361
 
2381
2362
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2382
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
2363
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2383
2364
  </redirect:write>
2384
2365
 
2385
2366
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2386
2367
 
2368
+ <xsl:if test="$debug = 'true'">
2369
+ <redirect:write file="page_sequence_main.xml">
2370
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2371
+ </redirect:write>
2372
+ </xsl:if>
2373
+
2387
2374
  <xsl:call-template name="deleteFile">
2388
2375
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2389
2376
  </xsl:call-template>
@@ -2396,6 +2383,14 @@
2396
2383
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
2397
2384
  </xsl:template>
2398
2385
 
2386
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
2387
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
2388
+ <xsl:choose>
2389
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
2390
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
2391
+ </xsl:choose>
2392
+ </xsl:template>
2393
+
2399
2394
  <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>
2400
2395
  <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>
2401
2396
  <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>
@@ -2726,7 +2721,9 @@
2726
2721
 
2727
2722
  <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']"/>
2728
2723
  <xsl:if test="$isNoteOrFnExist = 'true'">
2729
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2724
+
2725
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2726
+
2730
2727
  </xsl:if>
2731
2728
 
2732
2729
  <xsl:choose>
@@ -2783,13 +2780,14 @@
2783
2780
  </fo:table>
2784
2781
 
2785
2782
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2786
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2787
- <xsl:call-template name="insertTableFooterInSeparateTable">
2788
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2789
- <xsl:with-param name="colwidths" select="$colwidths"/>
2790
- <xsl:with-param name="colgroup" select="$colgroup"/>
2791
- </xsl:call-template>
2792
- </xsl:for-each>
2783
+
2784
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2785
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2786
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
2787
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2788
+ <xsl:with-param name="colgroup" select="$colgroup"/>
2789
+ </xsl:call-template>
2790
+ </xsl:for-each>
2793
2791
 
2794
2792
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
2795
2793
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -3179,8 +3177,10 @@
3179
3177
  <width_min><xsl:value-of select="@width_min"/></width_min>
3180
3178
  <e><xsl:value-of select="$d * $W div $D"/></e>
3181
3179
  <!-- set the column's width to the minimum width plus d times W over D. -->
3180
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3181
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
3182
3182
  <column divider="100">
3183
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3183
+ <xsl:value-of select="$column_width"/>
3184
3184
  </column>
3185
3185
  </xsl:for-each>
3186
3186
 
@@ -3588,6 +3588,22 @@
3588
3588
 
3589
3589
  <xsl:call-template name="refine_table-header-cell-style"/>
3590
3590
 
3591
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
3592
+ <!-- <xsl:choose>
3593
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
3594
+ <fo:block-container reference-orientation="270">
3595
+ <fo:block role="SKIP" text-align="start">
3596
+ <xsl:apply-templates />
3597
+ </fo:block>
3598
+ </fo:block-container>
3599
+ </xsl:when>
3600
+ <xsl:otherwise>
3601
+ <fo:block role="SKIP">
3602
+ <xsl:apply-templates />
3603
+ </fo:block>
3604
+ </xsl:otherwise>
3605
+ </xsl:choose> -->
3606
+
3591
3607
  <fo:block role="SKIP">
3592
3608
  <xsl:apply-templates/>
3593
3609
  </fo:block>
@@ -7083,6 +7099,15 @@
7083
7099
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
7084
7100
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7085
7101
  </xsl:when>
7102
+ <!-- in WebP format, then convert image into PNG -->
7103
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
7104
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7105
+ <xsl:value-of select="$src_png"/>
7106
+ </xsl:when>
7107
+ <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'))">
7108
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7109
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7110
+ </xsl:when>
7086
7111
  <xsl:when test="not(starts-with(@src, 'data:'))">
7087
7112
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7088
7113
  </xsl:when>
@@ -10733,6 +10758,75 @@
10733
10758
  <!-- ===================================== -->
10734
10759
  <!-- Update xml -->
10735
10760
  <!-- ===================================== -->
10761
+
10762
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
10763
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
10764
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
10765
+
10766
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10767
+ <xsl:variable name="updated_xml_step1">
10768
+ <xsl:if test="$table_if = 'false'">
10769
+ <xsl:apply-templates mode="update_xml_step1"/>
10770
+ </xsl:if>
10771
+ </xsl:variable>
10772
+
10773
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
10774
+ <xsl:if test="$debug = 'true'">
10775
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
10776
+ <xsl:message>END updated_xml_step1</xsl:message>
10777
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
10778
+ <xsl:copy-of select="$updated_xml_step1"/>
10779
+ </redirect:write> -->
10780
+ </xsl:if>
10781
+
10782
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
10783
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
10784
+
10785
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
10786
+ <xsl:variable name="updated_xml_step2">
10787
+
10788
+ <xsl:if test="$table_if = 'false'">
10789
+ <xsl:copy-of select="$updated_xml_step1"/>
10790
+ </xsl:if>
10791
+
10792
+ </xsl:variable>
10793
+
10794
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
10795
+ <xsl:if test="$debug = 'true'">
10796
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
10797
+ <xsl:message>END updated_xml_step2</xsl:message>
10798
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
10799
+ <xsl:copy-of select="$updated_xml_step2"/>
10800
+ </redirect:write> -->
10801
+ </xsl:if>
10802
+
10803
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
10804
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
10805
+
10806
+ <xsl:variable name="updated_xml_step3">
10807
+ <xsl:choose>
10808
+ <xsl:when test="$table_if = 'false'">
10809
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
10810
+ </xsl:when>
10811
+ <xsl:otherwise>
10812
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
10813
+ </xsl:otherwise>
10814
+ </xsl:choose>
10815
+ </xsl:variable>
10816
+
10817
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
10818
+ <xsl:if test="$debug = 'true'">
10819
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
10820
+ <xsl:message>END updated_xml_step3</xsl:message>
10821
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
10822
+ <xsl:copy-of select="$updated_xml_step3"/>
10823
+ </redirect:write> -->
10824
+ </xsl:if>
10825
+
10826
+ <xsl:copy-of select="$updated_xml_step3"/>
10827
+
10828
+ </xsl:template>
10829
+
10736
10830
  <!-- =========================================================================== -->
10737
10831
  <!-- STEP1: -->
10738
10832
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -10932,7 +11026,7 @@
10932
11026
 
10933
11027
  <!-- determine pagebreak is last element before </fo:flow> or not -->
10934
11028
  <xsl:variable name="isLast">
10935
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11029
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
10936
11030
  <xsl:if test="following-sibling::*">false</xsl:if>
10937
11031
  </xsl:for-each>
10938
11032
  </xsl:variable>
@@ -10954,7 +11048,7 @@
10954
11048
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
10955
11049
 
10956
11050
  <!-- create a new page_sequence (opening elements) -->
10957
- <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>
11051
+ <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>
10958
11052
 
10959
11053
  <xsl:call-template name="insertOpeningElements">
10960
11054
  <xsl:with-param name="tree" select="$tree"/>
@@ -10964,7 +11058,7 @@
10964
11058
  </xsl:template>
10965
11059
 
10966
11060
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
10967
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11061
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
10968
11062
  <element pos="{position()}">
10969
11063
  <xsl:copy-of select="@*[local-name() != 'id']"/>
10970
11064
  <xsl:value-of select="name()"/>
@@ -11145,7 +11239,7 @@
11145
11239
  <xsl:value-of select="substring-before($text, $tag_open)"/>
11146
11240
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
11147
11241
 
11148
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
11242
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
11149
11243
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
11150
11244
  </xsl:element>
11151
11245
 
@@ -11967,7 +12061,10 @@
11967
12061
  <xsl:call-template name="setTextAlignment">
11968
12062
  <xsl:with-param name="default" select="$text_align_default"/>
11969
12063
  </xsl:call-template>
12064
+ <xsl:call-template name="setKeepAttributes"/>
12065
+ </xsl:template>
11970
12066
 
12067
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
11971
12068
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
11972
12069
  <!-- Example: keep-lines-together="true" -->
11973
12070
  <xsl:if test="@keep-lines-together = 'true'">
@@ -11979,6 +12076,72 @@
11979
12076
  </xsl:if>
11980
12077
  </xsl:template>
11981
12078
 
12079
+ <!-- insert cover page image -->
12080
+ <!-- background cover image -->
12081
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
12082
+ <xsl:param name="number">1</xsl:param>
12083
+ <xsl:param name="name">coverpage-image</xsl:param>
12084
+ <xsl:variable name="num" select="number($number)"/>
12085
+ <!-- background image -->
12086
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
12087
+ <fo:block>
12088
+ <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]">
12089
+ <xsl:choose>
12090
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
12091
+ <fo:instream-foreign-object fox:alt-text="Image Front">
12092
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
12093
+ <xsl:call-template name="getSVG"/>
12094
+ </fo:instream-foreign-object>
12095
+ </xsl:when>
12096
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
12097
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
12098
+ </xsl:when>
12099
+ <xsl:otherwise> <!-- bitmap image -->
12100
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
12101
+ <xsl:if test="$coverimage_src != ''">
12102
+ <xsl:variable name="coverpage">
12103
+ <xsl:call-template name="getImageURL">
12104
+ <xsl:with-param name="src" select="$coverimage_src"/>
12105
+ </xsl:call-template>
12106
+ </xsl:variable>
12107
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
12108
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
12109
+ </xsl:if>
12110
+ </xsl:otherwise>
12111
+ </xsl:choose>
12112
+ </xsl:for-each>
12113
+ </fo:block>
12114
+ </fo:block-container>
12115
+ </xsl:template>
12116
+
12117
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
12118
+ <xsl:param name="src"/>
12119
+ <xsl:choose>
12120
+ <xsl:when test="starts-with($src, 'data:image')">
12121
+ <xsl:value-of select="$src"/>
12122
+ </xsl:when>
12123
+ <xsl:otherwise>
12124
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12125
+ </xsl:otherwise>
12126
+ </xsl:choose>
12127
+ </xsl:template>
12128
+
12129
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
12130
+ <xsl:choose>
12131
+ <xsl:when test="*[local-name() = 'svg']">
12132
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
12133
+ </xsl:when>
12134
+ <xsl:otherwise>
12135
+ <xsl:variable name="svg_content" select="document(@src)"/>
12136
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
12137
+ <xsl:apply-templates select="." mode="svg_update"/>
12138
+ </xsl:for-each>
12139
+ </xsl:otherwise>
12140
+ </xsl:choose>
12141
+ </xsl:template>
12142
+
12143
+ <!-- END: insert cover page image -->
12144
+
11982
12145
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
11983
12146
  <xsl:param name="number"/>
11984
12147
  <xsl:param name="first"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "2.4.8".freeze
3
+ VERSION = "2.4.9".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
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: exe
10
10
  cert_chain: []
11
- date: 2024-06-04 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-generic