metanorma-un 0.12.10 → 0.12.11

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: d03895c10357482fce33d21c60982d847114eed9f059d63091ee098eef0eeef1
4
- data.tar.gz: 8b7c614b6f268b632f444b5cd183047a23f4e919ce30bf2b7ba9fd104ae2cb1e
3
+ metadata.gz: 7a451a86bffe4c53cf7a0c277908934e105b97176881ee18e2a4c49e24883c5e
4
+ data.tar.gz: d5fec713cf50f566ae2bfa320da3e319ce565569a38c15a2a7a8bc5bff7cf237
5
5
  SHA512:
6
- metadata.gz: 076be2f177b2f186ff2261c365c227c16cd2ad4c726d01f745261e37a2434555c0af2a987d96a4b9ba2f21016fdfe4d3cccb3f78720b44fed5f5668909235408
7
- data.tar.gz: d4ac6ba1b5e407b864f090f9b533e35313a7825ba155eed221374910afd3c774b6e7d7ab1e78006294b97e1b517e2d71820c202e1b04b5b21f6878a226085ceb
6
+ metadata.gz: 02730e9ae67a8dffe6204d6846b3b1f915bd042c24d671e663416e2e1c221cc732bd876224f72bac28490fa5b7ee2095f7901f2793e4940b49d6b3f0dbc08e84
7
+ data.tar.gz: 8e66883847d0242d332e14a18cd9b540d0b218cd5fe7f1e4098cf78ed20ec39fedb263304f7c79fccfacf0c4d2a7eb73440d67ad2ec015effb9215f6d60ceea1
@@ -471,12 +471,11 @@
471
471
  <xsl:if test="following-sibling::*">
472
472
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
473
473
  </xsl:if>
474
- <xsl:attribute name="text-align">
475
- <xsl:choose>
476
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
477
- <xsl:otherwise>justify</xsl:otherwise>
478
- </xsl:choose>
479
- </xsl:attribute>
474
+
475
+ <xsl:call-template name="setBlockAttributes">
476
+ <xsl:with-param name="text_align_default">justify</xsl:with-param>
477
+ </xsl:call-template>
478
+
480
479
  <xsl:apply-templates>
481
480
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
482
481
  </xsl:apply-templates>
@@ -658,7 +657,7 @@
658
657
  </fo:block-container>
659
658
  </xsl:template>
660
659
 
661
- <xsl:template match="un:dl" priority="2">
660
+ <xsl:template match="un:dl" priority="3">
662
661
  <fo:block-container margin-left="0mm">
663
662
  <xsl:if test="parent::*[local-name() = 'note']">
664
663
  <xsl:attribute name="margin-left">
@@ -681,6 +680,7 @@
681
680
  <xsl:template match="un:dt" priority="2">
682
681
  <fo:block margin-bottom="6pt">
683
682
  <xsl:apply-templates/>
683
+ <xsl:text> </xsl:text>
684
684
  <xsl:apply-templates select="following-sibling::un:dd[1]" mode="dd"/>
685
685
  </fo:block>
686
686
  </xsl:template>
@@ -734,7 +734,7 @@
734
734
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="un:xref"/>
735
735
 
736
736
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
737
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
737
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
738
738
 
739
739
  <!-- external parameters -->
740
740
 
@@ -2399,7 +2399,7 @@
2399
2399
 
2400
2400
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
2401
2401
 
2402
- <xsl:variable name="updated_xml_step_move_pagebreak_">
2402
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2403
2403
 
2404
2404
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2405
2405
 
@@ -2417,17 +2417,32 @@
2417
2417
  </xsl:variable>
2418
2418
 
2419
2419
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2420
-
2420
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
2421
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2421
2422
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2422
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
2423
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2423
2424
  </redirect:write>
2425
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2424
2426
 
2425
2427
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2426
2428
 
2429
+ <!-- TODO: instead of
2430
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
2431
+ in each template, add removing empty page_sequence here
2432
+ -->
2433
+
2434
+ <xsl:if test="$debug = 'true'">
2435
+ <redirect:write file="page_sequence_preface.xml">
2436
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2437
+ </redirect:write>
2438
+ </xsl:if>
2439
+
2440
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2427
2441
  <xsl:call-template name="deleteFile">
2428
2442
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2429
2443
  </xsl:call-template>
2430
- </xsl:template>
2444
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2445
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
2431
2446
 
2432
2447
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
2433
2448
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -2452,37 +2467,7 @@
2452
2467
  </xsl:for-each>
2453
2468
  </xsl:template><!-- END: processMainSectionsDefault -->
2454
2469
 
2455
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
2456
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2457
- <xsl:sort select="@displayorder" data-type="number"/>
2458
- <xsl:variable name="flatxml">
2459
- <xsl:apply-templates select="." mode="flatxml"/>
2460
- </xsl:variable>
2461
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2462
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2463
-
2464
- </xsl:for-each>
2465
-
2466
- <xsl:for-each select="/*/*[local-name()='annex']">
2467
- <xsl:sort select="@displayorder" data-type="number"/>
2468
- <xsl:variable name="flatxml">
2469
- <xsl:apply-templates select="." mode="flatxml"/>
2470
- </xsl:variable>
2471
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2472
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2473
- </xsl:for-each>
2474
-
2475
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2476
- <xsl:sort select="@displayorder" data-type="number"/>
2477
- <xsl:variable name="flatxml">
2478
- <xsl:apply-templates select="." mode="flatxml"/>
2479
- </xsl:variable>
2480
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2481
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2482
- </xsl:for-each>
2483
- </xsl:template>
2484
-
2485
- <!-- Example:
2470
+ <!-- Example:
2486
2471
  <iso-standard>
2487
2472
  <sections>
2488
2473
  <page_sequence>
@@ -2502,7 +2487,7 @@
2502
2487
  -->
2503
2488
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
2504
2489
 
2505
- <xsl:variable name="updated_xml_step_move_pagebreak_">
2490
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2506
2491
 
2507
2492
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2508
2493
 
@@ -2539,11 +2524,17 @@
2539
2524
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2540
2525
 
2541
2526
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2542
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
2527
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2543
2528
  </redirect:write>
2544
2529
 
2545
2530
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2546
2531
 
2532
+ <xsl:if test="$debug = 'true'">
2533
+ <redirect:write file="page_sequence_main.xml">
2534
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2535
+ </redirect:write>
2536
+ </xsl:if>
2537
+
2547
2538
  <xsl:call-template name="deleteFile">
2548
2539
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2549
2540
  </xsl:call-template>
@@ -2556,6 +2547,14 @@
2556
2547
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
2557
2548
  </xsl:template>
2558
2549
 
2550
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
2551
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
2552
+ <xsl:choose>
2553
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
2554
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
2555
+ </xsl:choose>
2556
+ </xsl:template>
2557
+
2559
2558
  <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>
2560
2559
  <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>
2561
2560
  <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>
@@ -2894,7 +2893,9 @@
2894
2893
 
2895
2894
  <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']"/>
2896
2895
  <xsl:if test="$isNoteOrFnExist = 'true'">
2897
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2896
+
2897
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2898
+
2898
2899
  </xsl:if>
2899
2900
 
2900
2901
  <xsl:choose>
@@ -2951,13 +2952,14 @@
2951
2952
  </fo:table>
2952
2953
 
2953
2954
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2954
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2955
- <xsl:call-template name="insertTableFooterInSeparateTable">
2956
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2957
- <xsl:with-param name="colwidths" select="$colwidths"/>
2958
- <xsl:with-param name="colgroup" select="$colgroup"/>
2959
- </xsl:call-template>
2960
- </xsl:for-each>
2955
+
2956
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2957
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2958
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
2959
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2960
+ <xsl:with-param name="colgroup" select="$colgroup"/>
2961
+ </xsl:call-template>
2962
+ </xsl:for-each>
2961
2963
 
2962
2964
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
2963
2965
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -3343,8 +3345,10 @@
3343
3345
  <width_min><xsl:value-of select="@width_min"/></width_min>
3344
3346
  <e><xsl:value-of select="$d * $W div $D"/></e>
3345
3347
  <!-- set the column's width to the minimum width plus d times W over D. -->
3348
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3349
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
3346
3350
  <column divider="100">
3347
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3351
+ <xsl:value-of select="$column_width"/>
3348
3352
  </column>
3349
3353
  </xsl:for-each>
3350
3354
 
@@ -3756,6 +3760,22 @@
3756
3760
 
3757
3761
  <xsl:call-template name="refine_table-header-cell-style"/>
3758
3762
 
3763
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
3764
+ <!-- <xsl:choose>
3765
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
3766
+ <fo:block-container reference-orientation="270">
3767
+ <fo:block role="SKIP" text-align="start">
3768
+ <xsl:apply-templates />
3769
+ </fo:block>
3770
+ </fo:block-container>
3771
+ </xsl:when>
3772
+ <xsl:otherwise>
3773
+ <fo:block role="SKIP">
3774
+ <xsl:apply-templates />
3775
+ </fo:block>
3776
+ </xsl:otherwise>
3777
+ </xsl:choose> -->
3778
+
3759
3779
  <fo:block role="SKIP">
3760
3780
  <xsl:apply-templates/>
3761
3781
  </fo:block>
@@ -7258,6 +7278,15 @@
7258
7278
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
7259
7279
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7260
7280
  </xsl:when>
7281
+ <!-- in WebP format, then convert image into PNG -->
7282
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
7283
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7284
+ <xsl:value-of select="$src_png"/>
7285
+ </xsl:when>
7286
+ <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'))">
7287
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7288
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7289
+ </xsl:when>
7261
7290
  <xsl:when test="not(starts-with(@src, 'data:'))">
7262
7291
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7263
7292
  </xsl:when>
@@ -10919,6 +10948,75 @@
10919
10948
  <!-- ===================================== -->
10920
10949
  <!-- Update xml -->
10921
10950
  <!-- ===================================== -->
10951
+
10952
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
10953
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
10954
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
10955
+
10956
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10957
+ <xsl:variable name="updated_xml_step1">
10958
+ <xsl:if test="$table_if = 'false'">
10959
+ <xsl:apply-templates mode="update_xml_step1"/>
10960
+ </xsl:if>
10961
+ </xsl:variable>
10962
+
10963
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
10964
+ <xsl:if test="$debug = 'true'">
10965
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
10966
+ <xsl:message>END updated_xml_step1</xsl:message>
10967
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
10968
+ <xsl:copy-of select="$updated_xml_step1"/>
10969
+ </redirect:write> -->
10970
+ </xsl:if>
10971
+
10972
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
10973
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
10974
+
10975
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
10976
+ <xsl:variable name="updated_xml_step2">
10977
+
10978
+ <xsl:if test="$table_if = 'false'">
10979
+ <xsl:copy-of select="$updated_xml_step1"/>
10980
+ </xsl:if>
10981
+
10982
+ </xsl:variable>
10983
+
10984
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
10985
+ <xsl:if test="$debug = 'true'">
10986
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
10987
+ <xsl:message>END updated_xml_step2</xsl:message>
10988
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
10989
+ <xsl:copy-of select="$updated_xml_step2"/>
10990
+ </redirect:write> -->
10991
+ </xsl:if>
10992
+
10993
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
10994
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
10995
+
10996
+ <xsl:variable name="updated_xml_step3">
10997
+ <xsl:choose>
10998
+ <xsl:when test="$table_if = 'false'">
10999
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
11000
+ </xsl:when>
11001
+ <xsl:otherwise>
11002
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
11003
+ </xsl:otherwise>
11004
+ </xsl:choose>
11005
+ </xsl:variable>
11006
+
11007
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
11008
+ <xsl:if test="$debug = 'true'">
11009
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
11010
+ <xsl:message>END updated_xml_step3</xsl:message>
11011
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
11012
+ <xsl:copy-of select="$updated_xml_step3"/>
11013
+ </redirect:write> -->
11014
+ </xsl:if>
11015
+
11016
+ <xsl:copy-of select="$updated_xml_step3"/>
11017
+
11018
+ </xsl:template>
11019
+
10922
11020
  <!-- =========================================================================== -->
10923
11021
  <!-- STEP1: -->
10924
11022
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -11118,7 +11216,7 @@
11118
11216
 
11119
11217
  <!-- determine pagebreak is last element before </fo:flow> or not -->
11120
11218
  <xsl:variable name="isLast">
11121
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11219
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11122
11220
  <xsl:if test="following-sibling::*">false</xsl:if>
11123
11221
  </xsl:for-each>
11124
11222
  </xsl:variable>
@@ -11140,7 +11238,7 @@
11140
11238
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
11141
11239
 
11142
11240
  <!-- create a new page_sequence (opening elements) -->
11143
- <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>
11241
+ <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>
11144
11242
 
11145
11243
  <xsl:call-template name="insertOpeningElements">
11146
11244
  <xsl:with-param name="tree" select="$tree"/>
@@ -11150,7 +11248,7 @@
11150
11248
  </xsl:template>
11151
11249
 
11152
11250
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
11153
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11251
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11154
11252
  <element pos="{position()}">
11155
11253
  <xsl:copy-of select="@*[local-name() != 'id']"/>
11156
11254
  <xsl:value-of select="name()"/>
@@ -11331,7 +11429,7 @@
11331
11429
  <xsl:value-of select="substring-before($text, $tag_open)"/>
11332
11430
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
11333
11431
 
11334
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
11432
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
11335
11433
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
11336
11434
  </xsl:element>
11337
11435
 
@@ -12153,7 +12251,10 @@
12153
12251
  <xsl:call-template name="setTextAlignment">
12154
12252
  <xsl:with-param name="default" select="$text_align_default"/>
12155
12253
  </xsl:call-template>
12254
+ <xsl:call-template name="setKeepAttributes"/>
12255
+ </xsl:template>
12156
12256
 
12257
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
12157
12258
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
12158
12259
  <!-- Example: keep-lines-together="true" -->
12159
12260
  <xsl:if test="@keep-lines-together = 'true'">
@@ -12165,6 +12266,72 @@
12165
12266
  </xsl:if>
12166
12267
  </xsl:template>
12167
12268
 
12269
+ <!-- insert cover page image -->
12270
+ <!-- background cover image -->
12271
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
12272
+ <xsl:param name="number">1</xsl:param>
12273
+ <xsl:param name="name">coverpage-image</xsl:param>
12274
+ <xsl:variable name="num" select="number($number)"/>
12275
+ <!-- background image -->
12276
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
12277
+ <fo:block>
12278
+ <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]">
12279
+ <xsl:choose>
12280
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
12281
+ <fo:instream-foreign-object fox:alt-text="Image Front">
12282
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
12283
+ <xsl:call-template name="getSVG"/>
12284
+ </fo:instream-foreign-object>
12285
+ </xsl:when>
12286
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
12287
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
12288
+ </xsl:when>
12289
+ <xsl:otherwise> <!-- bitmap image -->
12290
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
12291
+ <xsl:if test="$coverimage_src != ''">
12292
+ <xsl:variable name="coverpage">
12293
+ <xsl:call-template name="getImageURL">
12294
+ <xsl:with-param name="src" select="$coverimage_src"/>
12295
+ </xsl:call-template>
12296
+ </xsl:variable>
12297
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
12298
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
12299
+ </xsl:if>
12300
+ </xsl:otherwise>
12301
+ </xsl:choose>
12302
+ </xsl:for-each>
12303
+ </fo:block>
12304
+ </fo:block-container>
12305
+ </xsl:template>
12306
+
12307
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
12308
+ <xsl:param name="src"/>
12309
+ <xsl:choose>
12310
+ <xsl:when test="starts-with($src, 'data:image')">
12311
+ <xsl:value-of select="$src"/>
12312
+ </xsl:when>
12313
+ <xsl:otherwise>
12314
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12315
+ </xsl:otherwise>
12316
+ </xsl:choose>
12317
+ </xsl:template>
12318
+
12319
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
12320
+ <xsl:choose>
12321
+ <xsl:when test="*[local-name() = 'svg']">
12322
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
12323
+ </xsl:when>
12324
+ <xsl:otherwise>
12325
+ <xsl:variable name="svg_content" select="document(@src)"/>
12326
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
12327
+ <xsl:apply-templates select="." mode="svg_update"/>
12328
+ </xsl:for-each>
12329
+ </xsl:otherwise>
12330
+ </xsl:choose>
12331
+ </xsl:template>
12332
+
12333
+ <!-- END: insert cover page image -->
12334
+
12168
12335
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
12169
12336
  <xsl:param name="number"/>
12170
12337
  <xsl:param name="first"/>