metanorma-cc 2.6.2 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1340,6 +1340,7 @@
1340
1340
  </xsl:template> <!-- refine_table-style -->
1341
1341
 
1342
1342
  <xsl:attribute-set name="table-name-style">
1343
+ <xsl:attribute name="role">Caption</xsl:attribute>
1343
1344
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1344
1345
 
1345
1346
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -1350,6 +1351,9 @@
1350
1351
 
1351
1352
  <xsl:template name="refine_table-name-style">
1352
1353
  <xsl:param name="continued"/>
1354
+ <xsl:if test="$continued = 'true'">
1355
+ <xsl:attribute name="role">SKIP</xsl:attribute>
1356
+ </xsl:if>
1353
1357
 
1354
1358
  </xsl:template> <!-- refine_table-name-style -->
1355
1359
 
@@ -3081,7 +3085,7 @@
3081
3085
  </xsl:if>
3082
3086
 
3083
3087
  </fo:block-container>
3084
- </xsl:variable>
3088
+ </xsl:variable> <!-- END: variable name="table" -->
3085
3089
 
3086
3090
  <xsl:variable name="isAdded" select="@added"/>
3087
3091
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -3091,14 +3095,14 @@
3091
3095
 
3092
3096
  <!-- centered table when table name is centered (see table-name-style) -->
3093
3097
 
3094
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
3098
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
3095
3099
 
3096
3100
  <fo:table-column column-width="proportional-column-width(1)"/>
3097
3101
  <fo:table-column column-width="{@width}"/>
3098
3102
  <fo:table-column column-width="proportional-column-width(1)"/>
3099
- <fo:table-body>
3100
- <fo:table-row>
3101
- <fo:table-cell column-number="2">
3103
+ <fo:table-body role="SKIP">
3104
+ <fo:table-row role="SKIP">
3105
+ <fo:table-cell column-number="2" role="SKIP">
3102
3106
  <xsl:copy-of select="$table-preamble"/>
3103
3107
  <fo:block role="SKIP">
3104
3108
  <xsl:call-template name="setTrackChangesStyles">
@@ -3139,11 +3143,12 @@
3139
3143
 
3140
3144
  </xsl:template>
3141
3145
 
3146
+ <!-- table/name-->
3142
3147
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3143
3148
  <xsl:param name="continued"/>
3144
3149
  <xsl:if test="normalize-space() != ''">
3145
3150
 
3146
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
3151
+ <fo:block xsl:use-attribute-sets="table-name-style">
3147
3152
 
3148
3153
  <xsl:call-template name="refine_table-name-style">
3149
3154
  <xsl:with-param name="continued" select="$continued"/>
@@ -3620,7 +3625,7 @@
3620
3625
 
3621
3626
  <xsl:variable name="tableWithNotesAndFootnotes">
3622
3627
 
3623
- <fo:table keep-with-previous="always">
3628
+ <fo:table keep-with-previous="always" role="SKIP">
3624
3629
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
3625
3630
  <xsl:variable name="name" select="local-name()"/>
3626
3631
  <xsl:choose>
@@ -3651,9 +3656,9 @@
3651
3656
  </xsl:otherwise>
3652
3657
  </xsl:choose>
3653
3658
 
3654
- <fo:table-body>
3655
- <fo:table-row>
3656
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3659
+ <fo:table-body role="SKIP">
3660
+ <fo:table-row role="SKIP">
3661
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
3657
3662
 
3658
3663
  <xsl:call-template name="refine_table-footer-cell-style"/>
3659
3664
 
@@ -3857,6 +3862,8 @@
3857
3862
 
3858
3863
  <xsl:template name="setTableRowAttributes">
3859
3864
 
3865
+ <xsl:call-template name="setColors"/>
3866
+
3860
3867
  </xsl:template> <!-- setTableRowAttributes -->
3861
3868
  <!-- ===================== -->
3862
3869
  <!-- END Table's row processing -->
@@ -3908,6 +3915,7 @@
3908
3915
  </xsl:attribute>
3909
3916
  </xsl:if>
3910
3917
  <xsl:call-template name="display-align"/>
3918
+ <xsl:call-template name="setColors"/>
3911
3919
  </xsl:template>
3912
3920
 
3913
3921
  <xsl:template name="display-align">
@@ -3923,6 +3931,29 @@
3923
3931
  </xsl:if>
3924
3932
  </xsl:template>
3925
3933
 
3934
+ <xsl:template name="setColors">
3935
+ <xsl:variable name="styles__">
3936
+ <xsl:call-template name="split">
3937
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
3938
+ <xsl:with-param name="sep" select="';'"/>
3939
+ </xsl:call-template>
3940
+ </xsl:variable>
3941
+ <xsl:variable name="quot">"</xsl:variable>
3942
+ <xsl:variable name="styles_">
3943
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
3944
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
3945
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
3946
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
3947
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
3948
+ </xsl:if>
3949
+ </xsl:for-each>
3950
+ </xsl:variable>
3951
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
3952
+ <xsl:for-each select="$styles/style">
3953
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
3954
+ </xsl:for-each>
3955
+ </xsl:template>
3956
+
3926
3957
  <!-- cell in table body, footer -->
3927
3958
  <xsl:template match="*[local-name()='td']" name="td">
3928
3959
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -3934,12 +3965,12 @@
3934
3965
 
3935
3966
  <xsl:call-template name="refine_table-cell-style"/>
3936
3967
 
3968
+ <xsl:call-template name="setTableCellAttributes"/>
3969
+
3937
3970
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3938
3971
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3939
3972
  </xsl:if>
3940
3973
 
3941
- <xsl:call-template name="setTableCellAttributes"/>
3942
-
3943
3974
  <xsl:if test="$isGenerateTableIF = 'true'">
3944
3975
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3945
3976
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -4024,6 +4055,7 @@
4024
4055
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4025
4056
  <!-- fn in text -->
4026
4057
  <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
4058
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
4027
4059
 
4028
4060
  <!-- list of unique footnotes -->
4029
4061
  <xsl:variable name="p_fn_">
@@ -4089,7 +4121,7 @@
4089
4121
  <xsl:copy-of select="$footnote_inline"/>
4090
4122
  </xsl:when>
4091
4123
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4092
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4124
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
4093
4125
 
4094
4126
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4095
4127
  <xsl:copy-of select="$footnote_inline"/>
@@ -4498,39 +4530,51 @@
4498
4530
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4499
4531
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4500
4532
  <xsl:template match="*[local-name()='fn']">
4501
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
4502
-
4503
- <xsl:call-template name="refine_fn-reference-style"/>
4533
+ <xsl:variable name="target" select="@target"/>
4534
+ <xsl:choose>
4535
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
4536
+ <xsl:when test="not(ancestor::*[local-name() = 'table'][1]/*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body'][@id = $target]) and $footnotes/*[local-name() = 'fmt-fn-body'][@id = $target]">
4537
+ <xsl:call-template name="fn">
4538
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
4539
+ </xsl:call-template>
4540
+ </xsl:when>
4541
+ <xsl:otherwise>
4504
4542
 
4505
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4506
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4507
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4508
- <!-- <xsl:attribute name="internal-destination">
4509
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4510
- </xsl:attribute>
4511
- </xsl:if>
4512
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4513
- <xsl:attribute name="internal-destination">
4514
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4515
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4516
- </xsl:attribute>
4517
- </xsl:if> -->
4518
- <!-- <xsl:if test="$namespace = 'plateau'">
4519
- <xsl:text>※</xsl:text>
4520
- </xsl:if> -->
4521
- <!-- <xsl:value-of select="@reference"/> -->
4543
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
4522
4544
 
4523
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4545
+ <xsl:call-template name="refine_fn-reference-style"/>
4524
4546
 
4525
- <!-- <xsl:if test="$namespace = 'bsi'">
4526
- <xsl:text>)</xsl:text>
4527
- </xsl:if> -->
4528
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4529
- <!-- <xsl:if test="$namespace = 'jis'">
4530
- <fo:inline font-weight="normal">)</fo:inline>
4531
- </xsl:if> -->
4532
- </fo:basic-link>
4533
- </fo:inline>
4547
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4548
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4549
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4550
+ <!-- <xsl:attribute name="internal-destination">
4551
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4552
+ </xsl:attribute>
4553
+ </xsl:if>
4554
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4555
+ <xsl:attribute name="internal-destination">
4556
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4557
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4558
+ </xsl:attribute>
4559
+ </xsl:if> -->
4560
+ <!-- <xsl:if test="$namespace = 'plateau'">
4561
+ <xsl:text>※</xsl:text>
4562
+ </xsl:if> -->
4563
+ <!-- <xsl:value-of select="@reference"/> -->
4564
+
4565
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4566
+
4567
+ <!-- <xsl:if test="$namespace = 'bsi'">
4568
+ <xsl:text>)</xsl:text>
4569
+ </xsl:if> -->
4570
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4571
+ <!-- <xsl:if test="$namespace = 'jis'">
4572
+ <fo:inline font-weight="normal">)</fo:inline>
4573
+ </xsl:if> -->
4574
+ </fo:basic-link>
4575
+ </fo:inline>
4576
+ </xsl:otherwise>
4577
+ </xsl:choose>
4534
4578
  </xsl:template> <!-- fn -->
4535
4579
 
4536
4580
  <!-- fn/text() -->
@@ -5724,7 +5768,7 @@
5724
5768
  <xsl:choose>
5725
5769
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5726
5770
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5727
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
5771
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
5728
5772
  </xsl:when>
5729
5773
  <xsl:otherwise>
5730
5774
  <xsl:apply-templates/>
@@ -5732,7 +5776,7 @@
5732
5776
  </xsl:choose>
5733
5777
  </xsl:template>
5734
5778
  <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
5735
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5779
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
5736
5780
  </xsl:template>
5737
5781
 
5738
5782
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -6772,24 +6816,26 @@
6772
6816
  <xsl:apply-templates select="." mode="mathml"/>
6773
6817
  </xsl:variable>
6774
6818
 
6775
- <fo:instream-foreign-object fox:alt-text="Math">
6819
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
6776
6820
 
6777
6821
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
6778
6822
 
6779
- <!-- put MathML in Actual Text -->
6780
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
6781
- <xsl:attribute name="fox:actual-text">
6782
- <xsl:value-of select="$mathml_content"/>
6783
- </xsl:attribute>
6784
-
6785
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6786
- <xsl:if test="normalize-space($asciimath_text_) != ''">
6787
- <!-- put Mathin Alternate Text -->
6788
- <xsl:attribute name="fox:alt-text">
6789
- <xsl:value-of select="$asciimath_text_"/>
6823
+ <xsl:if test="$isGenerateTableIF = 'false'">
6824
+ <!-- put MathML in Actual Text -->
6825
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
6826
+ <xsl:attribute name="fox:actual-text">
6827
+ <xsl:value-of select="$mathml_content"/>
6790
6828
  </xsl:attribute>
6829
+
6830
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6831
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
6832
+ <!-- put Mathin Alternate Text -->
6833
+ <xsl:attribute name="fox:alt-text">
6834
+ <xsl:value-of select="$asciimath_text_"/>
6835
+ </xsl:attribute>
6836
+ </xsl:if>
6837
+ <!-- </xsl:if> -->
6791
6838
  </xsl:if>
6792
- <!-- </xsl:if> -->
6793
6839
 
6794
6840
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6795
6841
 
@@ -8525,6 +8571,13 @@
8525
8571
  <xsl:apply-templates select="."/>
8526
8572
  </xsl:template>
8527
8573
 
8574
+ <!-- prevent missing stem for table and figures in ToC -->
8575
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
8576
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
8577
+ <xsl:apply-templates select="."/>
8578
+ </xsl:if>
8579
+ </xsl:template>
8580
+
8528
8581
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
8529
8582
 
8530
8583
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -8545,6 +8598,8 @@
8545
8598
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
8546
8599
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
8547
8600
 
8601
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
8602
+
8548
8603
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
8549
8604
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
8550
8605
  <xsl:apply-templates mode="bookmarks"/>
@@ -8566,6 +8621,8 @@
8566
8621
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
8567
8622
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
8568
8623
 
8624
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
8625
+
8569
8626
  <!-- Bookmarks -->
8570
8627
  <xsl:template name="addBookmarks">
8571
8628
  <xsl:param name="contents"/>
@@ -8744,7 +8801,8 @@
8744
8801
 
8745
8802
  <xsl:for-each select="$contents_nodes//tables/table">
8746
8803
  <fo:bookmark internal-destination="{@id}">
8747
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
8804
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
8805
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
8748
8806
  </fo:bookmark>
8749
8807
  </xsl:for-each>
8750
8808
  </fo:bookmark>
@@ -8753,6 +8811,26 @@
8753
8811
  </xsl:template> <!-- insertTableBookmarks -->
8754
8812
  <!-- End Bookmarks -->
8755
8813
 
8814
+ <!-- ============================ -->
8815
+ <!-- mode="bookmark_clean" -->
8816
+ <!-- ============================ -->
8817
+ <xsl:template match="node()" mode="bookmark_clean">
8818
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
8819
+ </xsl:template>
8820
+
8821
+ <xsl:template match="text()" mode="bookmark_clean">
8822
+ <xsl:value-of select="."/>
8823
+ </xsl:template>
8824
+
8825
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
8826
+ <xsl:value-of select="normalize-space(.)"/>
8827
+ </xsl:template>
8828
+
8829
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
8830
+ <!-- ============================ -->
8831
+ <!-- END: mode="bookmark_clean" -->
8832
+ <!-- ============================ -->
8833
+
8756
8834
  <xsl:template name="getLangVersion">
8757
8835
  <xsl:param name="lang"/>
8758
8836
  <xsl:param name="doctype" select="''"/>
@@ -10451,21 +10529,32 @@
10451
10529
  <!-- ========== -->
10452
10530
 
10453
10531
  <xsl:variable name="reviews_">
10454
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
10532
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
10455
10533
  <xsl:copy>
10456
10534
  <xsl:copy-of select="@from"/>
10457
10535
  <xsl:copy-of select="@id"/>
10458
10536
  </xsl:copy>
10459
10537
  </xsl:for-each>
10538
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
10539
+ <xsl:copy>
10540
+ <xsl:copy-of select="@source"/>
10541
+ <xsl:copy-of select="@id"/>
10542
+ </xsl:copy>
10543
+ </xsl:for-each>
10460
10544
  </xsl:variable>
10461
10545
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
10462
10546
 
10463
10547
  <xsl:template name="addReviewHelper">
10464
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10465
- <xsl:variable name="curr_id" select="@id"/>
10466
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
10467
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10468
- <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10548
+ <xsl:if test="$isGenerateTableIF = 'false'">
10549
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10550
+ <xsl:variable name="curr_id" select="@id"/>
10551
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
10552
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
10553
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
10554
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10555
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10556
+ </xsl:if>
10557
+ </xsl:for-each>
10469
10558
  </xsl:if>
10470
10559
  <!-- <fo:block>
10471
10560
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -10607,14 +10696,61 @@
10607
10696
 
10608
10697
  </xsl:template>
10609
10698
 
10610
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10699
+ <!-- document text (not figures, or tables) footnotes -->
10700
+ <xsl:variable name="reviews_container_">
10701
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
10702
+ <xsl:variable name="update_xml_step1">
10703
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
10704
+ </xsl:variable>
10705
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
10706
+ </xsl:for-each>
10707
+ </xsl:variable>
10708
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
10709
+
10710
+ <xsl:template match="*[local-name() = 'review-container']"/>
10711
+
10712
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
10713
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10714
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
10715
+ <xsl:if test="$isGenerateTableIF = 'false'">
10716
+ <xsl:choose>
10717
+ <!-- if there isn't the attribute '@from', then -->
10718
+ <xsl:when test="$id_from = ''">
10719
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10720
+ </xsl:when>
10721
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10722
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
10723
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10724
+ </xsl:when>
10725
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10726
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10727
+ </xsl:when>
10728
+ </xsl:choose>
10729
+ </xsl:if>
10730
+ </xsl:template>
10731
+
10732
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
10733
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10611
10734
  <!-- comment 2019-11-29 -->
10612
10735
  <!-- <fo:block font-weight="bold">Review:</fo:block>
10613
10736
  <xsl:apply-templates /> -->
10614
10737
 
10615
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
10738
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
10616
10739
 
10617
- <xsl:if test="1 = 1">
10740
+ <xsl:variable name="source" select="normalize-space(@source)"/>
10741
+
10742
+ <xsl:if test="$isGenerateTableIF = 'false'">
10743
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
10744
+
10745
+ <!-- <xsl:if test="@source = @end"> -->
10746
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
10747
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
10748
+ <!-- <fo:block id="{$source}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$source}" fox:alt-text="Annot___{$source}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block> -->
10749
+ <fo:block id="{@id}" font-size="1pt" role="SKIP" keep-with-next="always" line-height="0.1"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10750
+ <!-- </xsl:if> -->
10751
+ </xsl:if>
10752
+
10753
+ <xsl:if test="1 = 2">
10618
10754
  <xsl:choose>
10619
10755
  <!-- if there isn't the attribute '@from', then -->
10620
10756
  <xsl:when test="$id_from = ''">
@@ -10622,10 +10758,10 @@
10622
10758
  </xsl:when>
10623
10759
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10624
10760
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
10625
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10761
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10626
10762
  </xsl:when>
10627
10763
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10628
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10764
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
10629
10765
  </xsl:when>
10630
10766
  </xsl:choose>
10631
10767
  </xsl:if>
@@ -10674,16 +10810,21 @@
10674
10810
  <xsl:variable name="list_level">
10675
10811
  <xsl:choose>
10676
10812
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
10677
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
10813
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
10814
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
10815
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
10678
10816
  </xsl:choose>
10679
10817
  </xsl:variable>
10680
10818
  <xsl:choose>
10681
10819
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
10682
10820
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
10683
10821
  </xsl:when>
10684
- <xsl:when test="$list_level mod 3 = 0">
10822
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
10685
10823
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
10686
10824
  </xsl:when>
10825
+ <xsl:when test="$list_level mod 3 = 0">
10826
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
10827
+ </xsl:when>
10687
10828
  <xsl:when test="$list_level mod 2 = 0">
10688
10829
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
10689
10830
  </xsl:when>
@@ -10704,9 +10845,15 @@
10704
10845
  <xsl:when test="local-name(..) = 'ul'">
10705
10846
  <xsl:choose>
10706
10847
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
10848
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
10849
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
10707
10850
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
10708
10851
  </xsl:choose>
10709
10852
  </xsl:when>
10853
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
10854
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
10855
+ <xsl:value-of select="@label"/>
10856
+ </xsl:when>
10710
10857
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
10711
10858
 
10712
10859
  <xsl:variable name="type" select="../@type"/>
@@ -10831,7 +10978,7 @@
10831
10978
 
10832
10979
  </xsl:otherwise>
10833
10980
  </xsl:choose>
10834
- </xsl:template>
10981
+ </xsl:template> <!-- getListItemFormat -->
10835
10982
 
10836
10983
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
10837
10984
  <xsl:param name="indent">0</xsl:param>
@@ -10963,6 +11110,11 @@
10963
11110
 
10964
11111
  <xsl:call-template name="refine_list-item-label-style"/>
10965
11112
 
11113
+ <xsl:if test="local-name(..) = 'ul'">
11114
+ <xsl:variable name="li_label" select="@label"/>
11115
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
11116
+ </xsl:if>
11117
+
10966
11118
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
10967
11119
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
10968
11120
  <xsl:call-template name="append_add-style"/>
@@ -11226,10 +11378,22 @@
11226
11378
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
11227
11379
 
11228
11380
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
11229
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11230
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
11231
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11232
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11381
+ <xsl:variable name="bookmark_id" select="@id"/>
11382
+ <xsl:choose>
11383
+ <!-- Example:
11384
+ <fmt-review-start id="_7ef81cf7-3f6c-4ed4-9c1f-1ba092052bbd" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" end="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/>
11385
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
11386
+ <fmt-review-end id="_f336a8d0-08a8-4b7f-a1aa-b04688ed40c1" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" start="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/> -->
11387
+ <xsl:when test="1 = 2 and preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]">
11388
+ <!-- skip here, see the template 'fmt-review-start' -->
11389
+ </xsl:when>
11390
+ <xsl:otherwise>
11391
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11392
+ <fo:inline id="{@id}" font-size="1pt"><xsl:if test="preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]"><xsl:attribute name="line-height">0.1</xsl:attribute></xsl:if><xsl:value-of select="$hair_space"/></fo:inline>
11393
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11394
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11395
+ </xsl:otherwise>
11396
+ </xsl:choose>
11233
11397
  </xsl:template>
11234
11398
  <!-- =================== -->
11235
11399
  <!-- End of Index processing -->
@@ -12352,6 +12516,16 @@
12352
12516
  </xsl:choose>
12353
12517
  </xsl:template>
12354
12518
 
12519
+ <!-- li/fmt-name -->
12520
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
12521
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
12522
+ <xsl:attribute name="full">true</xsl:attribute>
12523
+ </xsl:template>
12524
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
12525
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
12526
+ <xsl:attribute name="full">true</xsl:attribute>
12527
+ </xsl:template>
12528
+
12355
12529
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
12356
12530
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
12357
12531
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12581,6 +12755,9 @@
12581
12755
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
12582
12756
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
12583
12757
 
12758
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
12759
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
12760
+
12584
12761
  <!-- END: update new Presentation XML -->
12585
12762
 
12586
12763
  <!-- =========================================================================== -->
@@ -13163,6 +13340,64 @@
13163
13340
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
13164
13341
  </xsl:template>
13165
13342
 
13343
+ <!-- ===================================== -->
13344
+ <!-- ===================================== -->
13345
+ <!-- Ruby text (CJK languages) rendering -->
13346
+ <!-- ===================================== -->
13347
+ <!-- ===================================== -->
13348
+ <xsl:template match="*[local-name() = 'ruby']">
13349
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
13350
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
13351
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
13352
+ </xsl:if>
13353
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
13354
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
13355
+ <!-- Example: width="2em" -->
13356
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
13357
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
13358
+ <xsl:variable name="text_width">
13359
+ <xsl:choose>
13360
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
13361
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
13362
+ </xsl:choose>
13363
+ </xsl:variable>
13364
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
13365
+
13366
+ <xsl:choose>
13367
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
13368
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
13369
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
13370
+ </xsl:when>
13371
+ <xsl:otherwise>
13372
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
13373
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
13374
+ </xsl:otherwise>
13375
+ </xsl:choose>
13376
+
13377
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
13378
+ </fo:inline-container>
13379
+ </xsl:template>
13380
+
13381
+ <xsl:template match="*[local-name() = 'rb']">
13382
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
13383
+ </xsl:template>
13384
+
13385
+ <xsl:template match="*[local-name() = 'rt']">
13386
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
13387
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
13388
+ <xsl:attribute name="space-before">0em</xsl:attribute>
13389
+ </xsl:if>
13390
+ <xsl:apply-templates/>
13391
+ </fo:block>
13392
+
13393
+ </xsl:template>
13394
+
13395
+ <!-- ===================================== -->
13396
+ <!-- ===================================== -->
13397
+ <!-- END: Ruby text (CJK languages) rendering -->
13398
+ <!-- ===================================== -->
13399
+ <!-- ===================================== -->
13400
+
13166
13401
  <xsl:template name="printEdition">
13167
13402
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
13168
13403