metanorma-itu 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.
@@ -1808,10 +1808,11 @@
1808
1808
  <xsl:if test="$doctype != 'resolution' and $doctype != 'service-publication'">
1809
1809
  <fo:block break-after="page"/>
1810
1810
  <fo:block-container>
1811
- <fo:block role="TOC">
1812
-
1811
+ <fo:block role="SKIP">
1813
1812
  <xsl:apply-templates/>
1813
+ </fo:block>
1814
1814
 
1815
+ <fo:block role="TOC">
1815
1816
  <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
1816
1817
 
1817
1818
  <xsl:for-each select="$contents/doc[@num = $num]//item[@display = 'true']">
@@ -3715,6 +3716,7 @@
3715
3716
  </xsl:template> <!-- refine_table-style -->
3716
3717
 
3717
3718
  <xsl:attribute-set name="table-name-style">
3719
+ <xsl:attribute name="role">Caption</xsl:attribute>
3718
3720
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3719
3721
 
3720
3722
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -3725,6 +3727,9 @@
3725
3727
 
3726
3728
  <xsl:template name="refine_table-name-style">
3727
3729
  <xsl:param name="continued"/>
3730
+ <xsl:if test="$continued = 'true'">
3731
+ <xsl:attribute name="role">SKIP</xsl:attribute>
3732
+ </xsl:if>
3728
3733
 
3729
3734
  </xsl:template> <!-- refine_table-name-style -->
3730
3735
 
@@ -5545,7 +5550,7 @@
5545
5550
  </xsl:if>
5546
5551
 
5547
5552
  </fo:block-container>
5548
- </xsl:variable>
5553
+ </xsl:variable> <!-- END: variable name="table" -->
5549
5554
 
5550
5555
  <xsl:variable name="isAdded" select="@added"/>
5551
5556
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5555,14 +5560,14 @@
5555
5560
 
5556
5561
  <!-- centered table when table name is centered (see table-name-style) -->
5557
5562
 
5558
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
5563
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
5559
5564
 
5560
5565
  <fo:table-column column-width="proportional-column-width(1)"/>
5561
5566
  <fo:table-column column-width="{@width}"/>
5562
5567
  <fo:table-column column-width="proportional-column-width(1)"/>
5563
- <fo:table-body>
5564
- <fo:table-row>
5565
- <fo:table-cell column-number="2">
5568
+ <fo:table-body role="SKIP">
5569
+ <fo:table-row role="SKIP">
5570
+ <fo:table-cell column-number="2" role="SKIP">
5566
5571
  <xsl:copy-of select="$table-preamble"/>
5567
5572
  <fo:block role="SKIP">
5568
5573
  <xsl:call-template name="setTrackChangesStyles">
@@ -5603,11 +5608,12 @@
5603
5608
 
5604
5609
  </xsl:template>
5605
5610
 
5611
+ <!-- table/name-->
5606
5612
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
5607
5613
  <xsl:param name="continued"/>
5608
5614
  <xsl:if test="normalize-space() != ''">
5609
5615
 
5610
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
5616
+ <fo:block xsl:use-attribute-sets="table-name-style">
5611
5617
 
5612
5618
  <xsl:call-template name="refine_table-name-style">
5613
5619
  <xsl:with-param name="continued" select="$continued"/>
@@ -6084,7 +6090,7 @@
6084
6090
 
6085
6091
  <xsl:variable name="tableWithNotesAndFootnotes">
6086
6092
 
6087
- <fo:table keep-with-previous="always">
6093
+ <fo:table keep-with-previous="always" role="SKIP">
6088
6094
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
6089
6095
  <xsl:variable name="name" select="local-name()"/>
6090
6096
  <xsl:choose>
@@ -6122,9 +6128,9 @@
6122
6128
  </xsl:otherwise>
6123
6129
  </xsl:choose>
6124
6130
 
6125
- <fo:table-body>
6126
- <fo:table-row>
6127
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6131
+ <fo:table-body role="SKIP">
6132
+ <fo:table-row role="SKIP">
6133
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
6128
6134
 
6129
6135
  <xsl:call-template name="refine_table-footer-cell-style"/>
6130
6136
 
@@ -6338,6 +6344,8 @@
6338
6344
  <xsl:attribute name="min-height">5mm</xsl:attribute>
6339
6345
  </xsl:if>
6340
6346
 
6347
+ <xsl:call-template name="setColors"/>
6348
+
6341
6349
  </xsl:template> <!-- setTableRowAttributes -->
6342
6350
  <!-- ===================== -->
6343
6351
  <!-- END Table's row processing -->
@@ -6389,6 +6397,7 @@
6389
6397
  </xsl:attribute>
6390
6398
  </xsl:if>
6391
6399
  <xsl:call-template name="display-align"/>
6400
+ <xsl:call-template name="setColors"/>
6392
6401
  </xsl:template>
6393
6402
 
6394
6403
  <xsl:template name="display-align">
@@ -6404,6 +6413,29 @@
6404
6413
  </xsl:if>
6405
6414
  </xsl:template>
6406
6415
 
6416
+ <xsl:template name="setColors">
6417
+ <xsl:variable name="styles__">
6418
+ <xsl:call-template name="split">
6419
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
6420
+ <xsl:with-param name="sep" select="';'"/>
6421
+ </xsl:call-template>
6422
+ </xsl:variable>
6423
+ <xsl:variable name="quot">"</xsl:variable>
6424
+ <xsl:variable name="styles_">
6425
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
6426
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
6427
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
6428
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
6429
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
6430
+ </xsl:if>
6431
+ </xsl:for-each>
6432
+ </xsl:variable>
6433
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
6434
+ <xsl:for-each select="$styles/style">
6435
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
6436
+ </xsl:for-each>
6437
+ </xsl:template>
6438
+
6407
6439
  <!-- cell in table body, footer -->
6408
6440
  <xsl:template match="*[local-name()='td']" name="td">
6409
6441
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -6415,12 +6447,12 @@
6415
6447
 
6416
6448
  <xsl:call-template name="refine_table-cell-style"/>
6417
6449
 
6450
+ <xsl:call-template name="setTableCellAttributes"/>
6451
+
6418
6452
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
6419
6453
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6420
6454
  </xsl:if>
6421
6455
 
6422
- <xsl:call-template name="setTableCellAttributes"/>
6423
-
6424
6456
  <xsl:if test="$isGenerateTableIF = 'true'">
6425
6457
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
6426
6458
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -6505,6 +6537,7 @@
6505
6537
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
6506
6538
  <!-- fn in text -->
6507
6539
  <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">
6540
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
6508
6541
 
6509
6542
  <!-- list of unique footnotes -->
6510
6543
  <xsl:variable name="p_fn_">
@@ -6570,7 +6603,7 @@
6570
6603
  <xsl:copy-of select="$footnote_inline"/>
6571
6604
  </xsl:when>
6572
6605
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
6573
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
6606
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
6574
6607
 
6575
6608
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
6576
6609
  <xsl:copy-of select="$footnote_inline"/>
@@ -6981,39 +7014,51 @@
6981
7014
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
6982
7015
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
6983
7016
  <xsl:template match="*[local-name()='fn']">
6984
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
7017
+ <xsl:variable name="target" select="@target"/>
7018
+ <xsl:choose>
7019
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
7020
+ <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]">
7021
+ <xsl:call-template name="fn">
7022
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
7023
+ </xsl:call-template>
7024
+ </xsl:when>
7025
+ <xsl:otherwise>
6985
7026
 
6986
- <xsl:call-template name="refine_fn-reference-style"/>
7027
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
6987
7028
 
6988
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6989
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
6990
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
6991
- <!-- <xsl:attribute name="internal-destination">
6992
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
6993
- </xsl:attribute>
6994
- </xsl:if>
6995
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
6996
- <xsl:attribute name="internal-destination">
6997
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
6998
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
6999
- </xsl:attribute>
7000
- </xsl:if> -->
7001
- <!-- <xsl:if test="$namespace = 'plateau'">
7002
- <xsl:text>※</xsl:text>
7003
- </xsl:if> -->
7004
- <!-- <xsl:value-of select="@reference"/> -->
7005
-
7006
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
7029
+ <xsl:call-template name="refine_fn-reference-style"/>
7007
7030
 
7008
- <!-- <xsl:if test="$namespace = 'bsi'">
7009
- <xsl:text>)</xsl:text>
7010
- </xsl:if> -->
7011
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7012
- <!-- <xsl:if test="$namespace = 'jis'">
7013
- <fo:inline font-weight="normal">)</fo:inline>
7014
- </xsl:if> -->
7015
- </fo:basic-link>
7016
- </fo:inline>
7031
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7032
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
7033
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
7034
+ <!-- <xsl:attribute name="internal-destination">
7035
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7036
+ </xsl:attribute>
7037
+ </xsl:if>
7038
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7039
+ <xsl:attribute name="internal-destination">
7040
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
7041
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
7042
+ </xsl:attribute>
7043
+ </xsl:if> -->
7044
+ <!-- <xsl:if test="$namespace = 'plateau'">
7045
+ <xsl:text>※</xsl:text>
7046
+ </xsl:if> -->
7047
+ <!-- <xsl:value-of select="@reference"/> -->
7048
+
7049
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
7050
+
7051
+ <!-- <xsl:if test="$namespace = 'bsi'">
7052
+ <xsl:text>)</xsl:text>
7053
+ </xsl:if> -->
7054
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7055
+ <!-- <xsl:if test="$namespace = 'jis'">
7056
+ <fo:inline font-weight="normal">)</fo:inline>
7057
+ </xsl:if> -->
7058
+ </fo:basic-link>
7059
+ </fo:inline>
7060
+ </xsl:otherwise>
7061
+ </xsl:choose>
7017
7062
  </xsl:template> <!-- fn -->
7018
7063
 
7019
7064
  <!-- fn/text() -->
@@ -8250,7 +8295,7 @@
8250
8295
  <xsl:choose>
8251
8296
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
8252
8297
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
8253
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
8298
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
8254
8299
  </xsl:when>
8255
8300
  <xsl:otherwise>
8256
8301
  <xsl:apply-templates/>
@@ -8258,7 +8303,7 @@
8258
8303
  </xsl:choose>
8259
8304
  </xsl:template>
8260
8305
  <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">
8261
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
8306
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
8262
8307
  </xsl:template>
8263
8308
 
8264
8309
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -9298,24 +9343,26 @@
9298
9343
  <xsl:apply-templates select="." mode="mathml"/>
9299
9344
  </xsl:variable>
9300
9345
 
9301
- <fo:instream-foreign-object fox:alt-text="Math">
9346
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
9302
9347
 
9303
9348
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
9304
9349
 
9305
- <!-- put MathML in Actual Text -->
9306
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
9307
- <xsl:attribute name="fox:actual-text">
9308
- <xsl:value-of select="$mathml_content"/>
9309
- </xsl:attribute>
9310
-
9311
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
9312
- <xsl:if test="normalize-space($asciimath_text_) != ''">
9313
- <!-- put Mathin Alternate Text -->
9314
- <xsl:attribute name="fox:alt-text">
9315
- <xsl:value-of select="$asciimath_text_"/>
9350
+ <xsl:if test="$isGenerateTableIF = 'false'">
9351
+ <!-- put MathML in Actual Text -->
9352
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
9353
+ <xsl:attribute name="fox:actual-text">
9354
+ <xsl:value-of select="$mathml_content"/>
9316
9355
  </xsl:attribute>
9356
+
9357
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
9358
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
9359
+ <!-- put Mathin Alternate Text -->
9360
+ <xsl:attribute name="fox:alt-text">
9361
+ <xsl:value-of select="$asciimath_text_"/>
9362
+ </xsl:attribute>
9363
+ </xsl:if>
9364
+ <!-- </xsl:if> -->
9317
9365
  </xsl:if>
9318
- <!-- </xsl:if> -->
9319
9366
 
9320
9367
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
9321
9368
 
@@ -11055,6 +11102,13 @@
11055
11102
  <xsl:apply-templates select="."/>
11056
11103
  </xsl:template>
11057
11104
 
11105
+ <!-- prevent missing stem for table and figures in ToC -->
11106
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
11107
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
11108
+ <xsl:apply-templates select="."/>
11109
+ </xsl:if>
11110
+ </xsl:template>
11111
+
11058
11112
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
11059
11113
 
11060
11114
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -11075,6 +11129,8 @@
11075
11129
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
11076
11130
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
11077
11131
 
11132
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
11133
+
11078
11134
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
11079
11135
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
11080
11136
  <xsl:apply-templates mode="bookmarks"/>
@@ -11096,6 +11152,8 @@
11096
11152
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
11097
11153
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
11098
11154
 
11155
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
11156
+
11099
11157
  <!-- Bookmarks -->
11100
11158
  <xsl:template name="addBookmarks">
11101
11159
  <xsl:param name="contents"/>
@@ -11274,7 +11332,8 @@
11274
11332
 
11275
11333
  <xsl:for-each select="$contents_nodes//tables/table">
11276
11334
  <fo:bookmark internal-destination="{@id}">
11277
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
11335
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
11336
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
11278
11337
  </fo:bookmark>
11279
11338
  </xsl:for-each>
11280
11339
  </fo:bookmark>
@@ -11283,6 +11342,26 @@
11283
11342
  </xsl:template> <!-- insertTableBookmarks -->
11284
11343
  <!-- End Bookmarks -->
11285
11344
 
11345
+ <!-- ============================ -->
11346
+ <!-- mode="bookmark_clean" -->
11347
+ <!-- ============================ -->
11348
+ <xsl:template match="node()" mode="bookmark_clean">
11349
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
11350
+ </xsl:template>
11351
+
11352
+ <xsl:template match="text()" mode="bookmark_clean">
11353
+ <xsl:value-of select="."/>
11354
+ </xsl:template>
11355
+
11356
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
11357
+ <xsl:value-of select="normalize-space(.)"/>
11358
+ </xsl:template>
11359
+
11360
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
11361
+ <!-- ============================ -->
11362
+ <!-- END: mode="bookmark_clean" -->
11363
+ <!-- ============================ -->
11364
+
11286
11365
  <xsl:template name="getLangVersion">
11287
11366
  <xsl:param name="lang"/>
11288
11367
  <xsl:param name="doctype" select="''"/>
@@ -12972,21 +13051,32 @@
12972
13051
  <!-- ========== -->
12973
13052
 
12974
13053
  <xsl:variable name="reviews_">
12975
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
13054
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
12976
13055
  <xsl:copy>
12977
13056
  <xsl:copy-of select="@from"/>
12978
13057
  <xsl:copy-of select="@id"/>
12979
13058
  </xsl:copy>
12980
13059
  </xsl:for-each>
13060
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
13061
+ <xsl:copy>
13062
+ <xsl:copy-of select="@source"/>
13063
+ <xsl:copy-of select="@id"/>
13064
+ </xsl:copy>
13065
+ </xsl:for-each>
12981
13066
  </xsl:variable>
12982
13067
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
12983
13068
 
12984
13069
  <xsl:template name="addReviewHelper">
12985
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
12986
- <xsl:variable name="curr_id" select="@id"/>
12987
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
12988
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
12989
- <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>
13070
+ <xsl:if test="$isGenerateTableIF = 'false'">
13071
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
13072
+ <xsl:variable name="curr_id" select="@id"/>
13073
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
13074
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
13075
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
13076
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
13077
+ <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>
13078
+ </xsl:if>
13079
+ </xsl:for-each>
12990
13080
  </xsl:if>
12991
13081
  <!-- <fo:block>
12992
13082
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -13134,14 +13224,61 @@
13134
13224
 
13135
13225
  </xsl:template>
13136
13226
 
13137
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
13227
+ <!-- document text (not figures, or tables) footnotes -->
13228
+ <xsl:variable name="reviews_container_">
13229
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
13230
+ <xsl:variable name="update_xml_step1">
13231
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
13232
+ </xsl:variable>
13233
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
13234
+ </xsl:for-each>
13235
+ </xsl:variable>
13236
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
13237
+
13238
+ <xsl:template match="*[local-name() = 'review-container']"/>
13239
+
13240
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
13241
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
13242
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
13243
+ <xsl:if test="$isGenerateTableIF = 'false'">
13244
+ <xsl:choose>
13245
+ <!-- if there isn't the attribute '@from', then -->
13246
+ <xsl:when test="$id_from = ''">
13247
+ <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>
13248
+ </xsl:when>
13249
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
13250
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
13251
+ <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>
13252
+ </xsl:when>
13253
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
13254
+ <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>
13255
+ </xsl:when>
13256
+ </xsl:choose>
13257
+ </xsl:if>
13258
+ </xsl:template>
13259
+
13260
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
13261
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
13138
13262
  <!-- comment 2019-11-29 -->
13139
13263
  <!-- <fo:block font-weight="bold">Review:</fo:block>
13140
13264
  <xsl:apply-templates /> -->
13141
13265
 
13142
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
13266
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
13143
13267
 
13144
- <xsl:if test="1 = 1">
13268
+ <xsl:variable name="source" select="normalize-space(@source)"/>
13269
+
13270
+ <xsl:if test="$isGenerateTableIF = 'false'">
13271
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
13272
+
13273
+ <!-- <xsl:if test="@source = @end"> -->
13274
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
13275
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
13276
+ <!-- <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> -->
13277
+ <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>
13278
+ <!-- </xsl:if> -->
13279
+ </xsl:if>
13280
+
13281
+ <xsl:if test="1 = 2">
13145
13282
  <xsl:choose>
13146
13283
  <!-- if there isn't the attribute '@from', then -->
13147
13284
  <xsl:when test="$id_from = ''">
@@ -13149,10 +13286,10 @@
13149
13286
  </xsl:when>
13150
13287
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
13151
13288
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
13152
- <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>
13289
+ <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>
13153
13290
  </xsl:when>
13154
13291
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
13155
- <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>
13292
+ <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>
13156
13293
  </xsl:when>
13157
13294
  </xsl:choose>
13158
13295
  </xsl:if>
@@ -13203,16 +13340,21 @@
13203
13340
  <xsl:variable name="list_level">
13204
13341
  <xsl:choose>
13205
13342
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
13206
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
13343
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
13344
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
13345
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
13207
13346
  </xsl:choose>
13208
13347
  </xsl:variable>
13209
13348
  <xsl:choose>
13210
13349
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
13211
13350
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
13212
13351
  </xsl:when>
13213
- <xsl:when test="$list_level mod 3 = 0">
13352
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
13214
13353
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
13215
13354
  </xsl:when>
13355
+ <xsl:when test="$list_level mod 3 = 0">
13356
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
13357
+ </xsl:when>
13216
13358
  <xsl:when test="$list_level mod 2 = 0">
13217
13359
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
13218
13360
  </xsl:when>
@@ -13233,9 +13375,15 @@
13233
13375
  <xsl:when test="local-name(..) = 'ul'">
13234
13376
  <xsl:choose>
13235
13377
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
13378
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
13379
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
13236
13380
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
13237
13381
  </xsl:choose>
13238
13382
  </xsl:when>
13383
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
13384
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
13385
+ <xsl:value-of select="@label"/>
13386
+ </xsl:when>
13239
13387
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13240
13388
 
13241
13389
  <xsl:variable name="type" select="../@type"/>
@@ -13360,7 +13508,7 @@
13360
13508
 
13361
13509
  </xsl:otherwise>
13362
13510
  </xsl:choose>
13363
- </xsl:template>
13511
+ </xsl:template> <!-- getListItemFormat -->
13364
13512
 
13365
13513
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
13366
13514
  <xsl:param name="indent">0</xsl:param>
@@ -13492,6 +13640,11 @@
13492
13640
 
13493
13641
  <xsl:call-template name="refine_list-item-label-style"/>
13494
13642
 
13643
+ <xsl:if test="local-name(..) = 'ul'">
13644
+ <xsl:variable name="li_label" select="@label"/>
13645
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
13646
+ </xsl:if>
13647
+
13495
13648
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
13496
13649
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
13497
13650
  <xsl:call-template name="append_add-style"/>
@@ -13755,10 +13908,22 @@
13755
13908
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
13756
13909
 
13757
13910
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
13758
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
13759
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
13760
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
13761
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
13911
+ <xsl:variable name="bookmark_id" select="@id"/>
13912
+ <xsl:choose>
13913
+ <!-- Example:
13914
+ <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"/>
13915
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
13916
+ <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"/> -->
13917
+ <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]">
13918
+ <!-- skip here, see the template 'fmt-review-start' -->
13919
+ </xsl:when>
13920
+ <xsl:otherwise>
13921
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
13922
+ <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>
13923
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
13924
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
13925
+ </xsl:otherwise>
13926
+ </xsl:choose>
13762
13927
  </xsl:template>
13763
13928
  <!-- =================== -->
13764
13929
  <!-- End of Index processing -->
@@ -14915,6 +15080,16 @@
14915
15080
  </xsl:choose>
14916
15081
  </xsl:template>
14917
15082
 
15083
+ <!-- li/fmt-name -->
15084
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
15085
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
15086
+ <xsl:attribute name="full">true</xsl:attribute>
15087
+ </xsl:template>
15088
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
15089
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
15090
+ <xsl:attribute name="full">true</xsl:attribute>
15091
+ </xsl:template>
15092
+
14918
15093
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
14919
15094
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
14920
15095
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -15144,6 +15319,9 @@
15144
15319
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
15145
15320
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
15146
15321
 
15322
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
15323
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
15324
+
15147
15325
  <!-- END: update new Presentation XML -->
15148
15326
 
15149
15327
  <!-- =========================================================================== -->
@@ -15726,6 +15904,64 @@
15726
15904
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
15727
15905
  </xsl:template>
15728
15906
 
15907
+ <!-- ===================================== -->
15908
+ <!-- ===================================== -->
15909
+ <!-- Ruby text (CJK languages) rendering -->
15910
+ <!-- ===================================== -->
15911
+ <!-- ===================================== -->
15912
+ <xsl:template match="*[local-name() = 'ruby']">
15913
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
15914
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
15915
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
15916
+ </xsl:if>
15917
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
15918
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
15919
+ <!-- Example: width="2em" -->
15920
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
15921
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
15922
+ <xsl:variable name="text_width">
15923
+ <xsl:choose>
15924
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
15925
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
15926
+ </xsl:choose>
15927
+ </xsl:variable>
15928
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
15929
+
15930
+ <xsl:choose>
15931
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
15932
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
15933
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
15934
+ </xsl:when>
15935
+ <xsl:otherwise>
15936
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
15937
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
15938
+ </xsl:otherwise>
15939
+ </xsl:choose>
15940
+
15941
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
15942
+ </fo:inline-container>
15943
+ </xsl:template>
15944
+
15945
+ <xsl:template match="*[local-name() = 'rb']">
15946
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
15947
+ </xsl:template>
15948
+
15949
+ <xsl:template match="*[local-name() = 'rt']">
15950
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
15951
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
15952
+ <xsl:attribute name="space-before">0em</xsl:attribute>
15953
+ </xsl:if>
15954
+ <xsl:apply-templates/>
15955
+ </fo:block>
15956
+
15957
+ </xsl:template>
15958
+
15959
+ <!-- ===================================== -->
15960
+ <!-- ===================================== -->
15961
+ <!-- END: Ruby text (CJK languages) rendering -->
15962
+ <!-- ===================================== -->
15963
+ <!-- ===================================== -->
15964
+
15729
15965
  <xsl:template name="printEdition">
15730
15966
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
15731
15967