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.
@@ -512,13 +512,9 @@
512
512
  <xsl:attribute name="id">
513
513
  <xsl:value-of select="@id"/>
514
514
  </xsl:attribute>
515
- <xsl:attribute name="text-align">
516
- <xsl:choose>
517
- <!-- <xsl:when test="ancestor::ogc:preface">justify</xsl:when> -->
518
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
519
- <xsl:otherwise>left</xsl:otherwise><!-- justify -->
520
- </xsl:choose>
521
- </xsl:attribute>
515
+
516
+ <xsl:call-template name="setBlockAttributes"/>
517
+
522
518
  <xsl:attribute name="space-after">
523
519
  <xsl:choose>
524
520
  <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
@@ -649,7 +645,7 @@
649
645
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="ogc:xref"/>
650
646
 
651
647
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
652
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
648
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
653
649
 
654
650
  <!-- external parameters -->
655
651
 
@@ -2412,7 +2408,7 @@
2412
2408
 
2413
2409
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
2414
2410
 
2415
- <xsl:variable name="updated_xml_step_move_pagebreak_">
2411
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2416
2412
 
2417
2413
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2418
2414
 
@@ -2430,17 +2426,32 @@
2430
2426
  </xsl:variable>
2431
2427
 
2432
2428
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2433
-
2429
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
2430
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2434
2431
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2435
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
2432
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2436
2433
  </redirect:write>
2434
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2437
2435
 
2438
2436
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2439
2437
 
2438
+ <!-- TODO: instead of
2439
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
2440
+ in each template, add removing empty page_sequence here
2441
+ -->
2442
+
2443
+ <xsl:if test="$debug = 'true'">
2444
+ <redirect:write file="page_sequence_preface.xml">
2445
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2446
+ </redirect:write>
2447
+ </xsl:if>
2448
+
2449
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2440
2450
  <xsl:call-template name="deleteFile">
2441
2451
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2442
2452
  </xsl:call-template>
2443
- </xsl:template>
2453
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2454
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
2444
2455
 
2445
2456
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
2446
2457
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -2465,37 +2476,7 @@
2465
2476
  </xsl:for-each>
2466
2477
  </xsl:template><!-- END: processMainSectionsDefault -->
2467
2478
 
2468
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
2469
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2470
- <xsl:sort select="@displayorder" data-type="number"/>
2471
- <xsl:variable name="flatxml">
2472
- <xsl:apply-templates select="." mode="flatxml"/>
2473
- </xsl:variable>
2474
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2475
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2476
-
2477
- </xsl:for-each>
2478
-
2479
- <xsl:for-each select="/*/*[local-name()='annex']">
2480
- <xsl:sort select="@displayorder" data-type="number"/>
2481
- <xsl:variable name="flatxml">
2482
- <xsl:apply-templates select="." mode="flatxml"/>
2483
- </xsl:variable>
2484
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2485
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2486
- </xsl:for-each>
2487
-
2488
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2489
- <xsl:sort select="@displayorder" data-type="number"/>
2490
- <xsl:variable name="flatxml">
2491
- <xsl:apply-templates select="." mode="flatxml"/>
2492
- </xsl:variable>
2493
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2494
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2495
- </xsl:for-each>
2496
- </xsl:template>
2497
-
2498
- <!-- Example:
2479
+ <!-- Example:
2499
2480
  <iso-standard>
2500
2481
  <sections>
2501
2482
  <page_sequence>
@@ -2515,7 +2496,7 @@
2515
2496
  -->
2516
2497
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
2517
2498
 
2518
- <xsl:variable name="updated_xml_step_move_pagebreak_">
2499
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2519
2500
 
2520
2501
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2521
2502
 
@@ -2552,11 +2533,17 @@
2552
2533
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2553
2534
 
2554
2535
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2555
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
2536
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2556
2537
  </redirect:write>
2557
2538
 
2558
2539
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2559
2540
 
2541
+ <xsl:if test="$debug = 'true'">
2542
+ <redirect:write file="page_sequence_main.xml">
2543
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2544
+ </redirect:write>
2545
+ </xsl:if>
2546
+
2560
2547
  <xsl:call-template name="deleteFile">
2561
2548
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2562
2549
  </xsl:call-template>
@@ -2569,6 +2556,14 @@
2569
2556
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
2570
2557
  </xsl:template>
2571
2558
 
2559
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
2560
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
2561
+ <xsl:choose>
2562
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
2563
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
2564
+ </xsl:choose>
2565
+ </xsl:template>
2566
+
2572
2567
  <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>
2573
2568
  <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>
2574
2569
  <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>
@@ -2939,7 +2934,9 @@
2939
2934
 
2940
2935
  <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']"/>
2941
2936
  <xsl:if test="$isNoteOrFnExist = 'true'">
2942
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2937
+
2938
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2939
+
2943
2940
  </xsl:if>
2944
2941
 
2945
2942
  <xsl:choose>
@@ -2996,13 +2993,14 @@
2996
2993
  </fo:table>
2997
2994
 
2998
2995
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2999
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3000
- <xsl:call-template name="insertTableFooterInSeparateTable">
3001
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3002
- <xsl:with-param name="colwidths" select="$colwidths"/>
3003
- <xsl:with-param name="colgroup" select="$colgroup"/>
3004
- </xsl:call-template>
3005
- </xsl:for-each>
2996
+
2997
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2998
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2999
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3000
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3001
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3002
+ </xsl:call-template>
3003
+ </xsl:for-each>
3006
3004
 
3007
3005
  <xsl:apply-templates select="*[local-name()='name']"/>
3008
3006
 
@@ -3390,8 +3388,10 @@
3390
3388
  <width_min><xsl:value-of select="@width_min"/></width_min>
3391
3389
  <e><xsl:value-of select="$d * $W div $D"/></e>
3392
3390
  <!-- set the column's width to the minimum width plus d times W over D. -->
3391
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3392
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
3393
3393
  <column divider="100">
3394
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3394
+ <xsl:value-of select="$column_width"/>
3395
3395
  </column>
3396
3396
  </xsl:for-each>
3397
3397
 
@@ -3799,6 +3799,22 @@
3799
3799
 
3800
3800
  <xsl:call-template name="refine_table-header-cell-style"/>
3801
3801
 
3802
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
3803
+ <!-- <xsl:choose>
3804
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
3805
+ <fo:block-container reference-orientation="270">
3806
+ <fo:block role="SKIP" text-align="start">
3807
+ <xsl:apply-templates />
3808
+ </fo:block>
3809
+ </fo:block-container>
3810
+ </xsl:when>
3811
+ <xsl:otherwise>
3812
+ <fo:block role="SKIP">
3813
+ <xsl:apply-templates />
3814
+ </fo:block>
3815
+ </xsl:otherwise>
3816
+ </xsl:choose> -->
3817
+
3802
3818
  <fo:block role="SKIP">
3803
3819
  <xsl:apply-templates/>
3804
3820
  </fo:block>
@@ -7306,6 +7322,15 @@
7306
7322
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
7307
7323
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7308
7324
  </xsl:when>
7325
+ <!-- in WebP format, then convert image into PNG -->
7326
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
7327
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7328
+ <xsl:value-of select="$src_png"/>
7329
+ </xsl:when>
7330
+ <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'))">
7331
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
7332
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7333
+ </xsl:when>
7309
7334
  <xsl:when test="not(starts-with(@src, 'data:'))">
7310
7335
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7311
7336
  </xsl:when>
@@ -11007,6 +11032,75 @@
11007
11032
  <!-- ===================================== -->
11008
11033
  <!-- Update xml -->
11009
11034
  <!-- ===================================== -->
11035
+
11036
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
11037
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
11038
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
11039
+
11040
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11041
+ <xsl:variable name="updated_xml_step1">
11042
+ <xsl:if test="$table_if = 'false'">
11043
+ <xsl:apply-templates mode="update_xml_step1"/>
11044
+ </xsl:if>
11045
+ </xsl:variable>
11046
+
11047
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
11048
+ <xsl:if test="$debug = 'true'">
11049
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
11050
+ <xsl:message>END updated_xml_step1</xsl:message>
11051
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
11052
+ <xsl:copy-of select="$updated_xml_step1"/>
11053
+ </redirect:write> -->
11054
+ </xsl:if>
11055
+
11056
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
11057
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
11058
+
11059
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
11060
+ <xsl:variable name="updated_xml_step2">
11061
+
11062
+ <xsl:if test="$table_if = 'false'">
11063
+ <xsl:copy-of select="$updated_xml_step1"/>
11064
+ </xsl:if>
11065
+
11066
+ </xsl:variable>
11067
+
11068
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
11069
+ <xsl:if test="$debug = 'true'">
11070
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
11071
+ <xsl:message>END updated_xml_step2</xsl:message>
11072
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
11073
+ <xsl:copy-of select="$updated_xml_step2"/>
11074
+ </redirect:write> -->
11075
+ </xsl:if>
11076
+
11077
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
11078
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
11079
+
11080
+ <xsl:variable name="updated_xml_step3">
11081
+ <xsl:choose>
11082
+ <xsl:when test="$table_if = 'false'">
11083
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
11084
+ </xsl:when>
11085
+ <xsl:otherwise>
11086
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
11087
+ </xsl:otherwise>
11088
+ </xsl:choose>
11089
+ </xsl:variable>
11090
+
11091
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
11092
+ <xsl:if test="$debug = 'true'">
11093
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
11094
+ <xsl:message>END updated_xml_step3</xsl:message>
11095
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
11096
+ <xsl:copy-of select="$updated_xml_step3"/>
11097
+ </redirect:write> -->
11098
+ </xsl:if>
11099
+
11100
+ <xsl:copy-of select="$updated_xml_step3"/>
11101
+
11102
+ </xsl:template>
11103
+
11010
11104
  <!-- =========================================================================== -->
11011
11105
  <!-- STEP1: -->
11012
11106
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -11206,7 +11300,7 @@
11206
11300
 
11207
11301
  <!-- determine pagebreak is last element before </fo:flow> or not -->
11208
11302
  <xsl:variable name="isLast">
11209
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11303
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11210
11304
  <xsl:if test="following-sibling::*">false</xsl:if>
11211
11305
  </xsl:for-each>
11212
11306
  </xsl:variable>
@@ -11228,7 +11322,7 @@
11228
11322
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
11229
11323
 
11230
11324
  <!-- create a new page_sequence (opening elements) -->
11231
- <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>
11325
+ <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>
11232
11326
 
11233
11327
  <xsl:call-template name="insertOpeningElements">
11234
11328
  <xsl:with-param name="tree" select="$tree"/>
@@ -11238,7 +11332,7 @@
11238
11332
  </xsl:template>
11239
11333
 
11240
11334
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
11241
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11335
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11242
11336
  <element pos="{position()}">
11243
11337
  <xsl:copy-of select="@*[local-name() != 'id']"/>
11244
11338
  <xsl:value-of select="name()"/>
@@ -11419,7 +11513,7 @@
11419
11513
  <xsl:value-of select="substring-before($text, $tag_open)"/>
11420
11514
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
11421
11515
 
11422
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
11516
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
11423
11517
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
11424
11518
  </xsl:element>
11425
11519
 
@@ -12241,7 +12335,10 @@
12241
12335
  <xsl:call-template name="setTextAlignment">
12242
12336
  <xsl:with-param name="default" select="$text_align_default"/>
12243
12337
  </xsl:call-template>
12338
+ <xsl:call-template name="setKeepAttributes"/>
12339
+ </xsl:template>
12244
12340
 
12341
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
12245
12342
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
12246
12343
  <!-- Example: keep-lines-together="true" -->
12247
12344
  <xsl:if test="@keep-lines-together = 'true'">
@@ -12253,6 +12350,72 @@
12253
12350
  </xsl:if>
12254
12351
  </xsl:template>
12255
12352
 
12353
+ <!-- insert cover page image -->
12354
+ <!-- background cover image -->
12355
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
12356
+ <xsl:param name="number">1</xsl:param>
12357
+ <xsl:param name="name">coverpage-image</xsl:param>
12358
+ <xsl:variable name="num" select="number($number)"/>
12359
+ <!-- background image -->
12360
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
12361
+ <fo:block>
12362
+ <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]">
12363
+ <xsl:choose>
12364
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
12365
+ <fo:instream-foreign-object fox:alt-text="Image Front">
12366
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
12367
+ <xsl:call-template name="getSVG"/>
12368
+ </fo:instream-foreign-object>
12369
+ </xsl:when>
12370
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
12371
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
12372
+ </xsl:when>
12373
+ <xsl:otherwise> <!-- bitmap image -->
12374
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
12375
+ <xsl:if test="$coverimage_src != ''">
12376
+ <xsl:variable name="coverpage">
12377
+ <xsl:call-template name="getImageURL">
12378
+ <xsl:with-param name="src" select="$coverimage_src"/>
12379
+ </xsl:call-template>
12380
+ </xsl:variable>
12381
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
12382
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
12383
+ </xsl:if>
12384
+ </xsl:otherwise>
12385
+ </xsl:choose>
12386
+ </xsl:for-each>
12387
+ </fo:block>
12388
+ </fo:block-container>
12389
+ </xsl:template>
12390
+
12391
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
12392
+ <xsl:param name="src"/>
12393
+ <xsl:choose>
12394
+ <xsl:when test="starts-with($src, 'data:image')">
12395
+ <xsl:value-of select="$src"/>
12396
+ </xsl:when>
12397
+ <xsl:otherwise>
12398
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12399
+ </xsl:otherwise>
12400
+ </xsl:choose>
12401
+ </xsl:template>
12402
+
12403
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
12404
+ <xsl:choose>
12405
+ <xsl:when test="*[local-name() = 'svg']">
12406
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
12407
+ </xsl:when>
12408
+ <xsl:otherwise>
12409
+ <xsl:variable name="svg_content" select="document(@src)"/>
12410
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
12411
+ <xsl:apply-templates select="." mode="svg_update"/>
12412
+ </xsl:for-each>
12413
+ </xsl:otherwise>
12414
+ </xsl:choose>
12415
+ </xsl:template>
12416
+
12417
+ <!-- END: insert cover page image -->
12418
+
12256
12419
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
12257
12420
  <xsl:param name="number"/>
12258
12421
  <xsl:param name="first"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.5.9".freeze
3
+ VERSION = "2.5.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.9
4
+ version: 2.5.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: iso-639