metanorma-jis 0.2.9 → 0.2.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: 5802f552014937f59b4ac8509da44c12a6d1daba68d6c68ec4580701ef9629b9
4
- data.tar.gz: 56027208cc4e320b533bb43e391ffb48104c81d9dc322e1279cf8a956d4a5a3e
3
+ metadata.gz: 974d35a99bba52ce5fa4e6073e02443f565c2bd47dc832ade4ca7ef69477422e
4
+ data.tar.gz: 50d6114af3794e0254f387d497d8e784b514043109b7a6085c317dfa12187ee3
5
5
  SHA512:
6
- metadata.gz: 9a922521b2270dcef779ad8fe7901e29bfed9e6d30e7b0035fd05023a8f0540f840ce5dcb23df380376e74c3cbbf571ab934788f53ad038a6d561359ba77f2c9
7
- data.tar.gz: f013e980b0548dc9a2959b2857109f0d1a28742b3778d39982d5650478c088405a6c7813c6e07fe31691acd23679b8d4f9fb80aa740b1d3fa384d0322a7051b0
6
+ metadata.gz: 710db35c6be4d09c66a2f50d4ccba657d5d565d890476cece59e4ec06fcae1e3421fde785a468f4ad95804bfbfbe0188528e29457654d902faecaea6526514e5
7
+ data.tar.gz: 29296cef62c29fa2612319db0726b9499997720c6e11dd27bb00e80db7d57c3165fbbe6c8c59c41036d87e1cb73c680da9280e215fa072fb2704a2b089c302d8
@@ -4,8 +4,6 @@
4
4
 
5
5
  <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
6
6
 
7
- <xsl:variable name="namespace_full">https://www.metanorma.org/ns/jis</xsl:variable>
8
-
9
7
  <xsl:variable name="debug">false</xsl:variable>
10
8
 
11
9
  <xsl:variable name="contents_">
@@ -1619,7 +1617,7 @@
1619
1617
  <xsl:strip-space xmlns:redirect="http://xml.apache.org/xalan/redirect" elements="jis:xref"/>
1620
1618
 
1621
1619
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1622
- <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/>
1620
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
1623
1621
 
1624
1622
  <!-- external parameters -->
1625
1623
 
@@ -3300,7 +3298,7 @@
3300
3298
 
3301
3299
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
3302
3300
 
3303
- <xsl:variable name="updated_xml_step_move_pagebreak_">
3301
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3304
3302
 
3305
3303
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3306
3304
 
@@ -3318,17 +3316,32 @@
3318
3316
  </xsl:variable>
3319
3317
 
3320
3318
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3321
-
3319
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
3320
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3322
3321
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3323
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3322
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3324
3323
  </redirect:write>
3324
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3325
3325
 
3326
3326
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3327
3327
 
3328
+ <!-- TODO: instead of
3329
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
3330
+ in each template, add removing empty page_sequence here
3331
+ -->
3332
+
3333
+ <xsl:if test="$debug = 'true'">
3334
+ <redirect:write file="page_sequence_preface.xml">
3335
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3336
+ </redirect:write>
3337
+ </xsl:if>
3338
+
3339
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3328
3340
  <xsl:call-template name="deleteFile">
3329
3341
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3330
3342
  </xsl:call-template>
3331
- </xsl:template>
3343
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3344
+ </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
3332
3345
 
3333
3346
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
3334
3347
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
@@ -3353,37 +3366,7 @@
3353
3366
  </xsl:for-each>
3354
3367
  </xsl:template><!-- END: processMainSectionsDefault -->
3355
3368
 
3356
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_flatxml">
3357
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3358
- <xsl:sort select="@displayorder" data-type="number"/>
3359
- <xsl:variable name="flatxml">
3360
- <xsl:apply-templates select="." mode="flatxml"/>
3361
- </xsl:variable>
3362
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3363
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3364
-
3365
- </xsl:for-each>
3366
-
3367
- <xsl:for-each select="/*/*[local-name()='annex']">
3368
- <xsl:sort select="@displayorder" data-type="number"/>
3369
- <xsl:variable name="flatxml">
3370
- <xsl:apply-templates select="." mode="flatxml"/>
3371
- </xsl:variable>
3372
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3373
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3374
- </xsl:for-each>
3375
-
3376
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3377
- <xsl:sort select="@displayorder" data-type="number"/>
3378
- <xsl:variable name="flatxml">
3379
- <xsl:apply-templates select="." mode="flatxml"/>
3380
- </xsl:variable>
3381
- <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3382
- <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3383
- </xsl:for-each>
3384
- </xsl:template>
3385
-
3386
- <!-- Example:
3369
+ <!-- Example:
3387
3370
  <iso-standard>
3388
3371
  <sections>
3389
3372
  <page_sequence>
@@ -3403,7 +3386,7 @@
3403
3386
  -->
3404
3387
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
3405
3388
 
3406
- <xsl:variable name="updated_xml_step_move_pagebreak_">
3389
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3407
3390
 
3408
3391
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3409
3392
 
@@ -3440,11 +3423,17 @@
3440
3423
  <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3441
3424
 
3442
3425
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3443
- <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
3426
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3444
3427
  </redirect:write>
3445
3428
 
3446
3429
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3447
3430
 
3431
+ <xsl:if test="$debug = 'true'">
3432
+ <redirect:write file="page_sequence_main.xml">
3433
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3434
+ </redirect:write>
3435
+ </xsl:if>
3436
+
3448
3437
  <xsl:call-template name="deleteFile">
3449
3438
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3450
3439
  </xsl:call-template>
@@ -3457,6 +3446,14 @@
3457
3446
  <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
3458
3447
  </xsl:template>
3459
3448
 
3449
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getPageSequenceOrientation">
3450
+ <xsl:variable name="previous_orientation" select="preceding-sibling::*[local-name() = 'page_sequence'][@orientation][1]/@orientation"/>
3451
+ <xsl:choose>
3452
+ <xsl:when test="@orientation = 'landscape'">-<xsl:value-of select="@orientation"/></xsl:when>
3453
+ <xsl:when test="$previous_orientation = 'landscape' and not(@orientation = 'portrait')">-<xsl:value-of select="$previous_orientation"/></xsl:when>
3454
+ </xsl:choose>
3455
+ </xsl:template>
3456
+
3460
3457
  <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>
3461
3458
  <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>
3462
3459
  <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>
@@ -3789,7 +3786,9 @@
3789
3786
 
3790
3787
  <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']"/>
3791
3788
  <xsl:if test="$isNoteOrFnExist = 'true'">
3792
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3789
+
3790
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3791
+
3793
3792
  </xsl:if>
3794
3793
 
3795
3794
  <xsl:choose>
@@ -3846,13 +3845,14 @@
3846
3845
  </fo:table>
3847
3846
 
3848
3847
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3849
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3850
- <xsl:call-template name="insertTableFooterInSeparateTable">
3851
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3852
- <xsl:with-param name="colwidths" select="$colwidths"/>
3853
- <xsl:with-param name="colgroup" select="$colgroup"/>
3854
- </xsl:call-template>
3855
- </xsl:for-each>
3848
+
3849
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3850
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3851
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3852
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3853
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3854
+ </xsl:call-template>
3855
+ </xsl:for-each>
3856
3856
 
3857
3857
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
3858
3858
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -3873,6 +3873,27 @@
3873
3873
 
3874
3874
  <!-- centered table when table name is centered (see table-name-style) -->
3875
3875
 
3876
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
3877
+
3878
+ <fo:table-column column-width="proportional-column-width(1)"/>
3879
+ <fo:table-column column-width="{@width}"/>
3880
+ <fo:table-column column-width="proportional-column-width(1)"/>
3881
+ <fo:table-body>
3882
+ <fo:table-row>
3883
+ <fo:table-cell column-number="2">
3884
+ <xsl:copy-of select="$table-preamble"/>
3885
+ <fo:block role="SKIP">
3886
+ <xsl:call-template name="setTrackChangesStyles">
3887
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3888
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3889
+ </xsl:call-template>
3890
+ <xsl:copy-of select="$table"/>
3891
+ </fo:block>
3892
+ </fo:table-cell>
3893
+ </fo:table-row>
3894
+ </fo:table-body>
3895
+ </fo:table>
3896
+
3876
3897
  </xsl:when>
3877
3898
  <xsl:otherwise>
3878
3899
  <xsl:choose>
@@ -4221,8 +4242,10 @@
4221
4242
  <width_min><xsl:value-of select="@width_min"/></width_min>
4222
4243
  <e><xsl:value-of select="$d * $W div $D"/></e>
4223
4244
  <!-- set the column's width to the minimum width plus d times W over D. -->
4245
+ <xsl:variable name="column_width_" select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4246
+ <xsl:variable name="column_width" select="$column_width_*($column_width_ &gt;= 0) - $column_width_*($column_width_ &lt; 0)"/> <!-- absolute value -->
4224
4247
  <column divider="100">
4225
- <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4248
+ <xsl:value-of select="$column_width"/>
4226
4249
  </column>
4227
4250
  </xsl:for-each>
4228
4251
 
@@ -4626,6 +4649,22 @@
4626
4649
 
4627
4650
  <xsl:call-template name="refine_table-header-cell-style"/>
4628
4651
 
4652
+ <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
4653
+ <!-- <xsl:choose>
4654
+ <xsl:when test="count(node()) = 1 and *[local-name() = 'span'][contains(@style, 'text-orientation')]">
4655
+ <fo:block-container reference-orientation="270">
4656
+ <fo:block role="SKIP" text-align="start">
4657
+ <xsl:apply-templates />
4658
+ </fo:block>
4659
+ </fo:block-container>
4660
+ </xsl:when>
4661
+ <xsl:otherwise>
4662
+ <fo:block role="SKIP">
4663
+ <xsl:apply-templates />
4664
+ </fo:block>
4665
+ </xsl:otherwise>
4666
+ </xsl:choose> -->
4667
+
4629
4668
  <fo:block role="SKIP">
4630
4669
  <xsl:apply-templates/>
4631
4670
  </fo:block>
@@ -8131,6 +8170,15 @@
8131
8170
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
8132
8171
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
8133
8172
  </xsl:when>
8173
+ <!-- in WebP format, then convert image into PNG -->
8174
+ <xsl:when test="starts-with(@src, 'data:image/webp')">
8175
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
8176
+ <xsl:value-of select="$src_png"/>
8177
+ </xsl:when>
8178
+ <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'))">
8179
+ <xsl:variable name="src_png" select="java:org.metanorma.fop.utils.ImageUtils.convertWebPtoPNG(@src)"/>
8180
+ <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8181
+ </xsl:when>
8134
8182
  <xsl:when test="not(starts-with(@src, 'data:'))">
8135
8183
  <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8136
8184
  </xsl:when>
@@ -11811,6 +11859,75 @@
11811
11859
  <!-- ===================================== -->
11812
11860
  <!-- Update xml -->
11813
11861
  <!-- ===================================== -->
11862
+
11863
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="updateXML">
11864
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step1</xsl:message></xsl:if>
11865
+ <xsl:variable name="startTime1" select="java:getTime(java:java.util.Date.new())"/>
11866
+
11867
+ <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11868
+ <xsl:variable name="updated_xml_step1">
11869
+ <xsl:if test="$table_if = 'false'">
11870
+ <xsl:apply-templates mode="update_xml_step1"/>
11871
+ </xsl:if>
11872
+ </xsl:variable>
11873
+
11874
+ <xsl:variable name="endTime1" select="java:getTime(java:java.util.Date.new())"/>
11875
+ <xsl:if test="$debug = 'true'">
11876
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime1 - $startTime1"/> msec.</xsl:message>
11877
+ <xsl:message>END updated_xml_step1</xsl:message>
11878
+ <!-- <redirect:write file="updated_xml_step1_{java:getTime(java:java.util.Date.new())}.xml">
11879
+ <xsl:copy-of select="$updated_xml_step1"/>
11880
+ </redirect:write> -->
11881
+ </xsl:if>
11882
+
11883
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step2</xsl:message></xsl:if>
11884
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
11885
+
11886
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
11887
+ <xsl:variable name="updated_xml_step2">
11888
+
11889
+ <xsl:if test="$table_if = 'false'">
11890
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step1)" mode="update_xml_step2"/>
11891
+ </xsl:if>
11892
+
11893
+ </xsl:variable>
11894
+
11895
+ <xsl:variable name="endTime2" select="java:getTime(java:java.util.Date.new())"/>
11896
+ <xsl:if test="$debug = 'true'">
11897
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime2 - $startTime2"/> msec.</xsl:message>
11898
+ <xsl:message>END updated_xml_step2</xsl:message>
11899
+ <!-- <redirect:write file="updated_xml_step2_{java:getTime(java:java.util.Date.new())}.xml">
11900
+ <xsl:copy-of select="$updated_xml_step2"/>
11901
+ </redirect:write> -->
11902
+ </xsl:if>
11903
+
11904
+ <xsl:if test="$debug = 'true'"><xsl:message>START updated_xml_step3</xsl:message></xsl:if>
11905
+ <xsl:variable name="startTime3" select="java:getTime(java:java.util.Date.new())"/>
11906
+
11907
+ <xsl:variable name="updated_xml_step3">
11908
+ <xsl:choose>
11909
+ <xsl:when test="$table_if = 'false'">
11910
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
11911
+ </xsl:when>
11912
+ <xsl:otherwise>
11913
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
11914
+ </xsl:otherwise>
11915
+ </xsl:choose>
11916
+ </xsl:variable>
11917
+
11918
+ <xsl:variable name="endTime3" select="java:getTime(java:java.util.Date.new())"/>
11919
+ <xsl:if test="$debug = 'true'">
11920
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime3 - $startTime3"/> msec.</xsl:message>
11921
+ <xsl:message>END updated_xml_step3</xsl:message>
11922
+ <!-- <redirect:write file="updated_xml_step3_{java:getTime(java:java.util.Date.new())}.xml">
11923
+ <xsl:copy-of select="$updated_xml_step3"/>
11924
+ </redirect:write> -->
11925
+ </xsl:if>
11926
+
11927
+ <xsl:copy-of select="$updated_xml_step3"/>
11928
+
11929
+ </xsl:template>
11930
+
11814
11931
  <!-- =========================================================================== -->
11815
11932
  <!-- STEP1: -->
11816
11933
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
@@ -12010,7 +12127,7 @@
12010
12127
 
12011
12128
  <!-- determine pagebreak is last element before </fo:flow> or not -->
12012
12129
  <xsl:variable name="isLast">
12013
- <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12130
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12014
12131
  <xsl:if test="following-sibling::*">false</xsl:if>
12015
12132
  </xsl:for-each>
12016
12133
  </xsl:variable>
@@ -12032,7 +12149,7 @@
12032
12149
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
12033
12150
 
12034
12151
  <!-- create a new page_sequence (opening elements) -->
12035
- <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>
12152
+ <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>
12036
12153
 
12037
12154
  <xsl:call-template name="insertOpeningElements">
12038
12155
  <xsl:with-param name="tree" select="$tree"/>
@@ -12042,7 +12159,7 @@
12042
12159
  </xsl:template>
12043
12160
 
12044
12161
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
12045
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12162
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12046
12163
  <element pos="{position()}">
12047
12164
  <xsl:copy-of select="@*[local-name() != 'id']"/>
12048
12165
  <xsl:value-of select="name()"/>
@@ -12327,7 +12444,7 @@
12327
12444
  <xsl:value-of select="substring-before($text, $tag_open)"/>
12328
12445
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
12329
12446
 
12330
- <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
12447
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}" namespace="{$namespace_full}">
12331
12448
  <xsl:value-of select="substring-before($text_after, $tag_close)"/>
12332
12449
  </xsl:element>
12333
12450
 
@@ -13150,7 +13267,10 @@
13150
13267
  <xsl:call-template name="setTextAlignment">
13151
13268
  <xsl:with-param name="default" select="$text_align_default"/>
13152
13269
  </xsl:call-template>
13270
+ <xsl:call-template name="setKeepAttributes"/>
13271
+ </xsl:template>
13153
13272
 
13273
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="setKeepAttributes">
13154
13274
  <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
13155
13275
  <!-- Example: keep-lines-together="true" -->
13156
13276
  <xsl:if test="@keep-lines-together = 'true'">
@@ -13162,6 +13282,72 @@
13162
13282
  </xsl:if>
13163
13283
  </xsl:template>
13164
13284
 
13285
+ <!-- insert cover page image -->
13286
+ <!-- background cover image -->
13287
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
13288
+ <xsl:param name="number">1</xsl:param>
13289
+ <xsl:param name="name">coverpage-image</xsl:param>
13290
+ <xsl:variable name="num" select="number($number)"/>
13291
+ <!-- background image -->
13292
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
13293
+ <fo:block>
13294
+ <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]">
13295
+ <xsl:choose>
13296
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
13297
+ <fo:instream-foreign-object fox:alt-text="Image Front">
13298
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
13299
+ <xsl:call-template name="getSVG"/>
13300
+ </fo:instream-foreign-object>
13301
+ </xsl:when>
13302
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
13303
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
13304
+ </xsl:when>
13305
+ <xsl:otherwise> <!-- bitmap image -->
13306
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
13307
+ <xsl:if test="$coverimage_src != ''">
13308
+ <xsl:variable name="coverpage">
13309
+ <xsl:call-template name="getImageURL">
13310
+ <xsl:with-param name="src" select="$coverimage_src"/>
13311
+ </xsl:call-template>
13312
+ </xsl:variable>
13313
+ <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
13314
+ <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
13315
+ </xsl:if>
13316
+ </xsl:otherwise>
13317
+ </xsl:choose>
13318
+ </xsl:for-each>
13319
+ </fo:block>
13320
+ </fo:block-container>
13321
+ </xsl:template>
13322
+
13323
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getImageURL">
13324
+ <xsl:param name="src"/>
13325
+ <xsl:choose>
13326
+ <xsl:when test="starts-with($src, 'data:image')">
13327
+ <xsl:value-of select="$src"/>
13328
+ </xsl:when>
13329
+ <xsl:otherwise>
13330
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13331
+ </xsl:otherwise>
13332
+ </xsl:choose>
13333
+ </xsl:template>
13334
+
13335
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getSVG">
13336
+ <xsl:choose>
13337
+ <xsl:when test="*[local-name() = 'svg']">
13338
+ <xsl:apply-templates select="*[local-name() = 'svg']" mode="svg_update"/>
13339
+ </xsl:when>
13340
+ <xsl:otherwise>
13341
+ <xsl:variable name="svg_content" select="document(@src)"/>
13342
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
13343
+ <xsl:apply-templates select="." mode="svg_update"/>
13344
+ </xsl:for-each>
13345
+ </xsl:otherwise>
13346
+ </xsl:choose>
13347
+ </xsl:template>
13348
+
13349
+ <!-- END: insert cover page image -->
13350
+
13165
13351
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
13166
13352
  <xsl:param name="number"/>
13167
13353
  <xsl:param name="first"/>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.2.9".freeze
3
+ VERSION = "0.2.10".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
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: japanese_calendar