metanorma-ieee 1.4.2 → 1.4.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.
@@ -2801,7 +2801,7 @@
2801
2801
  <xsl:choose>
2802
2802
  <xsl:when test="ancestor::ieee:table/@unnumbered = 'true' and normalize-space($substring_after) = 'Key'"><!-- no display Table - --></xsl:when>
2803
2803
  <xsl:otherwise>
2804
- <fo:inline font-weight="bold" font-style="normal">
2804
+ <fo:inline font-weight="bold" font-style="normal" role="SKIP">
2805
2805
  <xsl:choose>
2806
2806
  <xsl:when test="$current_template = 'whitepaper' or $current_template= 'icap-whitepaper' or $current_template = 'industry-connection-report'">
2807
2807
  <!-- Figure N in blue color -->
@@ -4509,6 +4509,7 @@
4509
4509
  </xsl:template> <!-- refine_table-style -->
4510
4510
 
4511
4511
  <xsl:attribute-set name="table-name-style">
4512
+ <xsl:attribute name="role">Caption</xsl:attribute>
4512
4513
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4513
4514
 
4514
4515
  <xsl:attribute name="font-family">Arial</xsl:attribute>
@@ -4520,6 +4521,9 @@
4520
4521
 
4521
4522
  <xsl:template name="refine_table-name-style">
4522
4523
  <xsl:param name="continued"/>
4524
+ <xsl:if test="$continued = 'true'">
4525
+ <xsl:attribute name="role">SKIP</xsl:attribute>
4526
+ </xsl:if>
4523
4527
 
4524
4528
  </xsl:template> <!-- refine_table-name-style -->
4525
4529
 
@@ -6331,7 +6335,7 @@
6331
6335
  </xsl:if>
6332
6336
 
6333
6337
  </fo:block-container>
6334
- </xsl:variable>
6338
+ </xsl:variable> <!-- END: variable name="table" -->
6335
6339
 
6336
6340
  <xsl:variable name="isAdded" select="@added"/>
6337
6341
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -6368,11 +6372,12 @@
6368
6372
 
6369
6373
  </xsl:template>
6370
6374
 
6375
+ <!-- table/name-->
6371
6376
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
6372
6377
  <xsl:param name="continued"/>
6373
6378
  <xsl:if test="normalize-space() != ''">
6374
6379
 
6375
- <fo:inline>
6380
+ <fo:inline role="SKIP">
6376
6381
 
6377
6382
  <xsl:if test="$current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report'">
6378
6383
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -6846,7 +6851,7 @@
6846
6851
 
6847
6852
  <xsl:variable name="tableWithNotesAndFootnotes">
6848
6853
 
6849
- <fo:table keep-with-previous="always">
6854
+ <fo:table keep-with-previous="always" role="SKIP">
6850
6855
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
6851
6856
  <xsl:variable name="name" select="local-name()"/>
6852
6857
  <xsl:choose>
@@ -6877,9 +6882,9 @@
6877
6882
  </xsl:otherwise>
6878
6883
  </xsl:choose>
6879
6884
 
6880
- <fo:table-body>
6881
- <fo:table-row>
6882
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6885
+ <fo:table-body role="SKIP">
6886
+ <fo:table-row role="SKIP">
6887
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
6883
6888
 
6884
6889
  <xsl:call-template name="refine_table-footer-cell-style"/>
6885
6890
 
@@ -6953,7 +6958,7 @@
6953
6958
 
6954
6959
  <!-- if there isn't 'thead' and there is a table's title -->
6955
6960
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='thead']) and ancestor::*[local-name()='table']/*[local-name()='name']">
6956
- <fo:table-header>
6961
+ <fo:table-header role="Caption">
6957
6962
  <xsl:call-template name="table-header-title">
6958
6963
  <xsl:with-param name="cols-count" select="$cols-count"/>
6959
6964
  </xsl:call-template>
@@ -7126,6 +7131,8 @@
7126
7131
 
7127
7132
  <xsl:template name="setTableRowAttributes">
7128
7133
 
7134
+ <xsl:call-template name="setColors"/>
7135
+
7129
7136
  </xsl:template> <!-- setTableRowAttributes -->
7130
7137
  <!-- ===================== -->
7131
7138
  <!-- END Table's row processing -->
@@ -7177,6 +7184,7 @@
7177
7184
  </xsl:attribute>
7178
7185
  </xsl:if>
7179
7186
  <xsl:call-template name="display-align"/>
7187
+ <xsl:call-template name="setColors"/>
7180
7188
  </xsl:template>
7181
7189
 
7182
7190
  <xsl:template name="display-align">
@@ -7192,6 +7200,29 @@
7192
7200
  </xsl:if>
7193
7201
  </xsl:template>
7194
7202
 
7203
+ <xsl:template name="setColors">
7204
+ <xsl:variable name="styles__">
7205
+ <xsl:call-template name="split">
7206
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
7207
+ <xsl:with-param name="sep" select="';'"/>
7208
+ </xsl:call-template>
7209
+ </xsl:variable>
7210
+ <xsl:variable name="quot">"</xsl:variable>
7211
+ <xsl:variable name="styles_">
7212
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
7213
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
7214
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
7215
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
7216
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
7217
+ </xsl:if>
7218
+ </xsl:for-each>
7219
+ </xsl:variable>
7220
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
7221
+ <xsl:for-each select="$styles/style">
7222
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
7223
+ </xsl:for-each>
7224
+ </xsl:template>
7225
+
7195
7226
  <!-- cell in table body, footer -->
7196
7227
  <xsl:template match="*[local-name()='td']" name="td">
7197
7228
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -7203,12 +7234,12 @@
7203
7234
 
7204
7235
  <xsl:call-template name="refine_table-cell-style"/>
7205
7236
 
7237
+ <xsl:call-template name="setTableCellAttributes"/>
7238
+
7206
7239
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
7207
7240
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
7208
7241
  </xsl:if>
7209
7242
 
7210
- <xsl:call-template name="setTableCellAttributes"/>
7211
-
7212
7243
  <xsl:if test="$isGenerateTableIF = 'true'">
7213
7244
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
7214
7245
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -7293,6 +7324,7 @@
7293
7324
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
7294
7325
  <!-- fn in text -->
7295
7326
  <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">
7327
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
7296
7328
 
7297
7329
  <!-- list of unique footnotes -->
7298
7330
  <xsl:variable name="p_fn_">
@@ -7358,7 +7390,7 @@
7358
7390
  <xsl:copy-of select="$footnote_inline"/>
7359
7391
  </xsl:when>
7360
7392
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
7361
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
7393
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
7362
7394
 
7363
7395
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
7364
7396
  <xsl:copy-of select="$footnote_inline"/>
@@ -7767,39 +7799,51 @@
7767
7799
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
7768
7800
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
7769
7801
  <xsl:template match="*[local-name()='fn']">
7770
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
7802
+ <xsl:variable name="target" select="@target"/>
7803
+ <xsl:choose>
7804
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
7805
+ <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]">
7806
+ <xsl:call-template name="fn">
7807
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
7808
+ </xsl:call-template>
7809
+ </xsl:when>
7810
+ <xsl:otherwise>
7771
7811
 
7772
- <xsl:call-template name="refine_fn-reference-style"/>
7812
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
7773
7813
 
7774
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7775
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
7776
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
7777
- <!-- <xsl:attribute name="internal-destination">
7778
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7779
- </xsl:attribute>
7780
- </xsl:if>
7781
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7782
- <xsl:attribute name="internal-destination">
7783
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
7784
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
7785
- </xsl:attribute>
7786
- </xsl:if> -->
7787
- <!-- <xsl:if test="$namespace = 'plateau'">
7788
- <xsl:text>※</xsl:text>
7789
- </xsl:if> -->
7790
- <!-- <xsl:value-of select="@reference"/> -->
7814
+ <xsl:call-template name="refine_fn-reference-style"/>
7791
7815
 
7792
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
7816
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7817
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
7818
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
7819
+ <!-- <xsl:attribute name="internal-destination">
7820
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7821
+ </xsl:attribute>
7822
+ </xsl:if>
7823
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7824
+ <xsl:attribute name="internal-destination">
7825
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
7826
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
7827
+ </xsl:attribute>
7828
+ </xsl:if> -->
7829
+ <!-- <xsl:if test="$namespace = 'plateau'">
7830
+ <xsl:text>※</xsl:text>
7831
+ </xsl:if> -->
7832
+ <!-- <xsl:value-of select="@reference"/> -->
7793
7833
 
7794
- <!-- <xsl:if test="$namespace = 'bsi'">
7795
- <xsl:text>)</xsl:text>
7796
- </xsl:if> -->
7797
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7798
- <!-- <xsl:if test="$namespace = 'jis'">
7799
- <fo:inline font-weight="normal">)</fo:inline>
7800
- </xsl:if> -->
7801
- </fo:basic-link>
7802
- </fo:inline>
7834
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
7835
+
7836
+ <!-- <xsl:if test="$namespace = 'bsi'">
7837
+ <xsl:text>)</xsl:text>
7838
+ </xsl:if> -->
7839
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7840
+ <!-- <xsl:if test="$namespace = 'jis'">
7841
+ <fo:inline font-weight="normal">)</fo:inline>
7842
+ </xsl:if> -->
7843
+ </fo:basic-link>
7844
+ </fo:inline>
7845
+ </xsl:otherwise>
7846
+ </xsl:choose>
7803
7847
  </xsl:template> <!-- fn -->
7804
7848
 
7805
7849
  <!-- fn/text() -->
@@ -8990,7 +9034,7 @@
8990
9034
  <xsl:choose>
8991
9035
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
8992
9036
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
8993
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
9037
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
8994
9038
  </xsl:when>
8995
9039
  <xsl:otherwise>
8996
9040
  <xsl:apply-templates/>
@@ -8998,7 +9042,7 @@
8998
9042
  </xsl:choose>
8999
9043
  </xsl:template>
9000
9044
  <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">
9001
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
9045
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
9002
9046
  </xsl:template>
9003
9047
 
9004
9048
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -10040,24 +10084,26 @@
10040
10084
  <xsl:apply-templates select="." mode="mathml"/>
10041
10085
  </xsl:variable>
10042
10086
 
10043
- <fo:instream-foreign-object fox:alt-text="Math">
10087
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
10044
10088
 
10045
10089
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
10046
10090
 
10047
- <!-- put MathML in Actual Text -->
10048
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
10049
- <xsl:attribute name="fox:actual-text">
10050
- <xsl:value-of select="$mathml_content"/>
10051
- </xsl:attribute>
10052
-
10053
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
10054
- <xsl:if test="normalize-space($asciimath_text_) != ''">
10055
- <!-- put Mathin Alternate Text -->
10056
- <xsl:attribute name="fox:alt-text">
10057
- <xsl:value-of select="$asciimath_text_"/>
10091
+ <xsl:if test="$isGenerateTableIF = 'false'">
10092
+ <!-- put MathML in Actual Text -->
10093
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
10094
+ <xsl:attribute name="fox:actual-text">
10095
+ <xsl:value-of select="$mathml_content"/>
10058
10096
  </xsl:attribute>
10097
+
10098
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
10099
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
10100
+ <!-- put Mathin Alternate Text -->
10101
+ <xsl:attribute name="fox:alt-text">
10102
+ <xsl:value-of select="$asciimath_text_"/>
10103
+ </xsl:attribute>
10104
+ </xsl:if>
10105
+ <!-- </xsl:if> -->
10059
10106
  </xsl:if>
10060
- <!-- </xsl:if> -->
10061
10107
 
10062
10108
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
10063
10109
 
@@ -11793,6 +11839,13 @@
11793
11839
  <xsl:apply-templates select="."/>
11794
11840
  </xsl:template>
11795
11841
 
11842
+ <!-- prevent missing stem for table and figures in ToC -->
11843
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
11844
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
11845
+ <xsl:apply-templates select="."/>
11846
+ </xsl:if>
11847
+ </xsl:template>
11848
+
11796
11849
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
11797
11850
 
11798
11851
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -11813,6 +11866,8 @@
11813
11866
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
11814
11867
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
11815
11868
 
11869
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
11870
+
11816
11871
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
11817
11872
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
11818
11873
  <xsl:apply-templates mode="bookmarks"/>
@@ -11834,6 +11889,8 @@
11834
11889
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
11835
11890
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
11836
11891
 
11892
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
11893
+
11837
11894
  <!-- Bookmarks -->
11838
11895
  <xsl:template name="addBookmarks">
11839
11896
  <xsl:param name="contents"/>
@@ -12012,7 +12069,8 @@
12012
12069
 
12013
12070
  <xsl:for-each select="$contents_nodes//tables/table">
12014
12071
  <fo:bookmark internal-destination="{@id}">
12015
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
12072
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
12073
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
12016
12074
  </fo:bookmark>
12017
12075
  </xsl:for-each>
12018
12076
  </fo:bookmark>
@@ -12021,6 +12079,26 @@
12021
12079
  </xsl:template> <!-- insertTableBookmarks -->
12022
12080
  <!-- End Bookmarks -->
12023
12081
 
12082
+ <!-- ============================ -->
12083
+ <!-- mode="bookmark_clean" -->
12084
+ <!-- ============================ -->
12085
+ <xsl:template match="node()" mode="bookmark_clean">
12086
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
12087
+ </xsl:template>
12088
+
12089
+ <xsl:template match="text()" mode="bookmark_clean">
12090
+ <xsl:value-of select="."/>
12091
+ </xsl:template>
12092
+
12093
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
12094
+ <xsl:value-of select="normalize-space(.)"/>
12095
+ </xsl:template>
12096
+
12097
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
12098
+ <!-- ============================ -->
12099
+ <!-- END: mode="bookmark_clean" -->
12100
+ <!-- ============================ -->
12101
+
12024
12102
  <xsl:template name="getLangVersion">
12025
12103
  <xsl:param name="lang"/>
12026
12104
  <xsl:param name="doctype" select="''"/>
@@ -13707,21 +13785,32 @@
13707
13785
  <!-- ========== -->
13708
13786
 
13709
13787
  <xsl:variable name="reviews_">
13710
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
13788
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
13711
13789
  <xsl:copy>
13712
13790
  <xsl:copy-of select="@from"/>
13713
13791
  <xsl:copy-of select="@id"/>
13714
13792
  </xsl:copy>
13715
13793
  </xsl:for-each>
13794
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
13795
+ <xsl:copy>
13796
+ <xsl:copy-of select="@source"/>
13797
+ <xsl:copy-of select="@id"/>
13798
+ </xsl:copy>
13799
+ </xsl:for-each>
13716
13800
  </xsl:variable>
13717
13801
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
13718
13802
 
13719
13803
  <xsl:template name="addReviewHelper">
13720
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
13721
- <xsl:variable name="curr_id" select="@id"/>
13722
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
13723
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
13724
- <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>
13804
+ <xsl:if test="$isGenerateTableIF = 'false'">
13805
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
13806
+ <xsl:variable name="curr_id" select="@id"/>
13807
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
13808
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
13809
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
13810
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
13811
+ <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>
13812
+ </xsl:if>
13813
+ </xsl:for-each>
13725
13814
  </xsl:if>
13726
13815
  <!-- <fo:block>
13727
13816
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -13858,14 +13947,61 @@
13858
13947
 
13859
13948
  </xsl:template>
13860
13949
 
13861
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
13950
+ <!-- document text (not figures, or tables) footnotes -->
13951
+ <xsl:variable name="reviews_container_">
13952
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
13953
+ <xsl:variable name="update_xml_step1">
13954
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
13955
+ </xsl:variable>
13956
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
13957
+ </xsl:for-each>
13958
+ </xsl:variable>
13959
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
13960
+
13961
+ <xsl:template match="*[local-name() = 'review-container']"/>
13962
+
13963
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
13964
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
13965
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
13966
+ <xsl:if test="$isGenerateTableIF = 'false'">
13967
+ <xsl:choose>
13968
+ <!-- if there isn't the attribute '@from', then -->
13969
+ <xsl:when test="$id_from = ''">
13970
+ <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>
13971
+ </xsl:when>
13972
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
13973
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
13974
+ <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>
13975
+ </xsl:when>
13976
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
13977
+ <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>
13978
+ </xsl:when>
13979
+ </xsl:choose>
13980
+ </xsl:if>
13981
+ </xsl:template>
13982
+
13983
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
13984
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
13862
13985
  <!-- comment 2019-11-29 -->
13863
13986
  <!-- <fo:block font-weight="bold">Review:</fo:block>
13864
13987
  <xsl:apply-templates /> -->
13865
13988
 
13866
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
13989
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
13867
13990
 
13868
- <xsl:if test="1 = 1">
13991
+ <xsl:variable name="source" select="normalize-space(@source)"/>
13992
+
13993
+ <xsl:if test="$isGenerateTableIF = 'false'">
13994
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
13995
+
13996
+ <!-- <xsl:if test="@source = @end"> -->
13997
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
13998
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
13999
+ <!-- <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> -->
14000
+ <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>
14001
+ <!-- </xsl:if> -->
14002
+ </xsl:if>
14003
+
14004
+ <xsl:if test="1 = 2">
13869
14005
  <xsl:choose>
13870
14006
  <!-- if there isn't the attribute '@from', then -->
13871
14007
  <xsl:when test="$id_from = ''">
@@ -13873,10 +14009,10 @@
13873
14009
  </xsl:when>
13874
14010
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
13875
14011
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
13876
- <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>
14012
+ <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>
13877
14013
  </xsl:when>
13878
14014
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
13879
- <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>
14015
+ <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>
13880
14016
  </xsl:when>
13881
14017
  </xsl:choose>
13882
14018
  </xsl:if>
@@ -13936,16 +14072,21 @@
13936
14072
  <xsl:variable name="list_level">
13937
14073
  <xsl:choose>
13938
14074
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
13939
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
14075
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
14076
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
14077
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
13940
14078
  </xsl:choose>
13941
14079
  </xsl:variable>
13942
14080
  <xsl:choose>
13943
14081
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
13944
14082
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
13945
14083
  </xsl:when>
13946
- <xsl:when test="$list_level mod 3 = 0">
14084
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
13947
14085
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
13948
14086
  </xsl:when>
14087
+ <xsl:when test="$list_level mod 3 = 0">
14088
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
14089
+ </xsl:when>
13949
14090
  <xsl:when test="$list_level mod 2 = 0">
13950
14091
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
13951
14092
  </xsl:when>
@@ -13966,9 +14107,15 @@
13966
14107
  <xsl:when test="local-name(..) = 'ul'">
13967
14108
  <xsl:choose>
13968
14109
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
14110
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
14111
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
13969
14112
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
13970
14113
  </xsl:choose>
13971
14114
  </xsl:when>
14115
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
14116
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
14117
+ <xsl:value-of select="@label"/>
14118
+ </xsl:when>
13972
14119
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13973
14120
 
13974
14121
  <xsl:variable name="type" select="../@type"/>
@@ -14093,7 +14240,7 @@
14093
14240
 
14094
14241
  </xsl:otherwise>
14095
14242
  </xsl:choose>
14096
- </xsl:template>
14243
+ </xsl:template> <!-- getListItemFormat -->
14097
14244
 
14098
14245
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
14099
14246
  <xsl:param name="indent">0</xsl:param>
@@ -14225,6 +14372,11 @@
14225
14372
 
14226
14373
  <xsl:call-template name="refine_list-item-label-style"/>
14227
14374
 
14375
+ <xsl:if test="local-name(..) = 'ul'">
14376
+ <xsl:variable name="li_label" select="@label"/>
14377
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
14378
+ </xsl:if>
14379
+
14228
14380
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
14229
14381
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
14230
14382
  <xsl:call-template name="append_add-style"/>
@@ -14488,10 +14640,22 @@
14488
14640
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
14489
14641
 
14490
14642
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
14491
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
14492
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
14493
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
14494
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
14643
+ <xsl:variable name="bookmark_id" select="@id"/>
14644
+ <xsl:choose>
14645
+ <!-- Example:
14646
+ <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"/>
14647
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
14648
+ <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"/> -->
14649
+ <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]">
14650
+ <!-- skip here, see the template 'fmt-review-start' -->
14651
+ </xsl:when>
14652
+ <xsl:otherwise>
14653
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
14654
+ <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>
14655
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
14656
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
14657
+ </xsl:otherwise>
14658
+ </xsl:choose>
14495
14659
  </xsl:template>
14496
14660
  <!-- =================== -->
14497
14661
  <!-- End of Index processing -->
@@ -15659,6 +15823,16 @@
15659
15823
  </xsl:choose>
15660
15824
  </xsl:template>
15661
15825
 
15826
+ <!-- li/fmt-name -->
15827
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
15828
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
15829
+ <xsl:attribute name="full">true</xsl:attribute>
15830
+ </xsl:template>
15831
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
15832
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
15833
+ <xsl:attribute name="full">true</xsl:attribute>
15834
+ </xsl:template>
15835
+
15662
15836
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
15663
15837
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
15664
15838
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -15888,6 +16062,9 @@
15888
16062
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
15889
16063
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
15890
16064
 
16065
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
16066
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
16067
+
15891
16068
  <!-- END: update new Presentation XML -->
15892
16069
 
15893
16070
  <!-- =========================================================================== -->
@@ -16574,6 +16751,64 @@
16574
16751
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
16575
16752
  </xsl:template>
16576
16753
 
16754
+ <!-- ===================================== -->
16755
+ <!-- ===================================== -->
16756
+ <!-- Ruby text (CJK languages) rendering -->
16757
+ <!-- ===================================== -->
16758
+ <!-- ===================================== -->
16759
+ <xsl:template match="*[local-name() = 'ruby']">
16760
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
16761
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
16762
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
16763
+ </xsl:if>
16764
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
16765
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
16766
+ <!-- Example: width="2em" -->
16767
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
16768
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
16769
+ <xsl:variable name="text_width">
16770
+ <xsl:choose>
16771
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
16772
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
16773
+ </xsl:choose>
16774
+ </xsl:variable>
16775
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
16776
+
16777
+ <xsl:choose>
16778
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
16779
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
16780
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
16781
+ </xsl:when>
16782
+ <xsl:otherwise>
16783
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
16784
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
16785
+ </xsl:otherwise>
16786
+ </xsl:choose>
16787
+
16788
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
16789
+ </fo:inline-container>
16790
+ </xsl:template>
16791
+
16792
+ <xsl:template match="*[local-name() = 'rb']">
16793
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
16794
+ </xsl:template>
16795
+
16796
+ <xsl:template match="*[local-name() = 'rt']">
16797
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
16798
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
16799
+ <xsl:attribute name="space-before">0em</xsl:attribute>
16800
+ </xsl:if>
16801
+ <xsl:apply-templates/>
16802
+ </fo:block>
16803
+
16804
+ </xsl:template>
16805
+
16806
+ <!-- ===================================== -->
16807
+ <!-- ===================================== -->
16808
+ <!-- END: Ruby text (CJK languages) rendering -->
16809
+ <!-- ===================================== -->
16810
+ <!-- ===================================== -->
16811
+
16577
16812
  <xsl:template name="printEdition">
16578
16813
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
16579
16814