metanorma-ogc 2.7.2 → 2.7.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.
@@ -831,8 +831,8 @@
831
831
 
832
832
  <xsl:template name="insertListOf_Title">
833
833
  <xsl:param name="title"/>
834
- <fo:block-container margin-left="-18mm" keep-with-next="always" margin-bottom="10pt" space-before="36pt">
835
- <fo:block-container margin-left="0mm">
834
+ <fo:block-container margin-left="-18mm" keep-with-next="always" margin-bottom="10pt" space-before="36pt" role="SKIP">
835
+ <fo:block-container margin-left="0mm" role="H2">
836
836
  <xsl:call-template name="insertSectionTitle">
837
837
  <xsl:with-param name="title" select="$title"/>
838
838
  </xsl:call-template>
@@ -946,7 +946,7 @@
946
946
  <xsl:call-template name="insertListOf_Title">
947
947
  <xsl:with-param name="title" select="$title-list-tables"/>
948
948
  </xsl:call-template>
949
- <fo:block-container line-height="130%">
949
+ <fo:block-container line-height="130%" role="TOC">
950
950
  <xsl:for-each select="$contents//tables/table">
951
951
  <xsl:call-template name="insertListOf_Item"/>
952
952
  </xsl:for-each>
@@ -958,7 +958,7 @@
958
958
  <xsl:call-template name="insertListOf_Title">
959
959
  <xsl:with-param name="title" select="$title-list-figures"/>
960
960
  </xsl:call-template>
961
- <fo:block-container line-height="130%">
961
+ <fo:block-container line-height="130%" role="TOC">
962
962
  <xsl:for-each select="$contents//figures/figure">
963
963
  <xsl:call-template name="insertListOf_Item"/>
964
964
  </xsl:for-each>
@@ -970,7 +970,7 @@
970
970
  <xsl:call-template name="insertListOf_Title">
971
971
  <xsl:with-param name="title" select="$title-list-recommendations"/>
972
972
  </xsl:call-template>
973
- <fo:block-container line-height="130%">
973
+ <fo:block-container line-height="130%" role="TOC">
974
974
  <xsl:for-each select="xalan:nodeset($toc_recommendations)/*[normalize-space(@id) != '']">
975
975
  <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
976
976
  <fo:basic-link internal-destination="{@id}">
@@ -1012,9 +1012,7 @@
1012
1012
  <xsl:with-param name="letter-spacing" select="1.1"/>
1013
1013
  </xsl:call-template>
1014
1014
  </fo:block>
1015
- <fo:block-container width="22.5mm" border-bottom="2pt solid {$color_design}">
1016
- <fo:block margin-top="4pt"> </fo:block>
1017
- </fo:block-container>
1015
+ <xsl:call-template name="insertBigHorizontalLine"/>
1018
1016
  </fo:block>
1019
1017
  </fo:block-container>
1020
1018
  </fo:block-container>
@@ -1346,8 +1344,8 @@
1346
1344
 
1347
1345
  <xsl:choose>
1348
1346
  <xsl:when test="$level = 1">
1349
- <fo:block-container margin-left="-22mm">
1350
- <fo:block-container margin-left="0mm">
1347
+ <fo:block-container margin-left="-22mm" role="SKIP">
1348
+ <fo:block-container margin-left="0mm" role="SKIP">
1351
1349
  <fo:block margin-bottom="10pt" space-before="36pt" keep-with-next="always" role="H{$level}">
1352
1350
  <fo:table table-layout="fixed" width="100%">
1353
1351
  <fo:table-column column-width="22mm"/>
@@ -1824,9 +1822,7 @@
1824
1822
  </xsl:call-template> -->
1825
1823
  </fo:block>
1826
1824
 
1827
- <fo:block-container width="22.5mm" border-bottom="2pt solid {$color_design}">
1828
- <fo:block margin-top="4pt"> </fo:block>
1829
- </fo:block-container>
1825
+ <xsl:call-template name="insertBigHorizontalLine"/>
1830
1826
  </xsl:template>
1831
1827
 
1832
1828
  <xsl:template match="text()" mode="titlebig">
@@ -1952,8 +1948,14 @@
1952
1948
  </xsl:template>
1953
1949
 
1954
1950
  <xsl:template name="insertShortHorizontalLine">
1955
- <fo:block-container width="12.7mm" border-top="1pt solid {$color_design}" margin-top="3mm">
1956
- <fo:block font-size="1pt"> </fo:block>
1951
+ <fo:block-container width="12.7mm" border-top="1pt solid {$color_design}" margin-top="3mm" role="SKIP">
1952
+ <fo:block font-size="1pt" role="SKIP"><fo:wrapper role="artifact"> </fo:wrapper></fo:block>
1953
+ </fo:block-container>
1954
+ </xsl:template>
1955
+
1956
+ <xsl:template name="insertBigHorizontalLine">
1957
+ <fo:block-container width="22.5mm" border-bottom="2pt solid {$color_design}" role="SKIP">
1958
+ <fo:block margin-top="4pt" role="SKIP"><fo:wrapper role="artifact"> </fo:wrapper></fo:block>
1957
1959
  </fo:block-container>
1958
1960
  </xsl:template>
1959
1961
 
@@ -2702,6 +2704,7 @@
2702
2704
  </xsl:template> <!-- refine_table-style -->
2703
2705
 
2704
2706
  <xsl:attribute-set name="table-name-style">
2707
+ <xsl:attribute name="role">Caption</xsl:attribute>
2705
2708
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2706
2709
 
2707
2710
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -2714,6 +2717,9 @@
2714
2717
 
2715
2718
  <xsl:template name="refine_table-name-style">
2716
2719
  <xsl:param name="continued"/>
2720
+ <xsl:if test="$continued = 'true'">
2721
+ <xsl:attribute name="role">SKIP</xsl:attribute>
2722
+ </xsl:if>
2717
2723
 
2718
2724
  </xsl:template> <!-- refine_table-name-style -->
2719
2725
 
@@ -4577,7 +4583,7 @@
4577
4583
  </xsl:if>
4578
4584
 
4579
4585
  </fo:block-container>
4580
- </xsl:variable>
4586
+ </xsl:variable> <!-- END: variable name="table" -->
4581
4587
 
4582
4588
  <xsl:variable name="isAdded" select="@added"/>
4583
4589
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4631,11 +4637,12 @@
4631
4637
 
4632
4638
  </xsl:template>
4633
4639
 
4640
+ <!-- table/name-->
4634
4641
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
4635
4642
  <xsl:param name="continued"/>
4636
4643
  <xsl:if test="normalize-space() != ''">
4637
4644
 
4638
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
4645
+ <fo:block xsl:use-attribute-sets="table-name-style">
4639
4646
 
4640
4647
  <xsl:call-template name="refine_table-name-style">
4641
4648
  <xsl:with-param name="continued" select="$continued"/>
@@ -5112,7 +5119,7 @@
5112
5119
 
5113
5120
  <xsl:variable name="tableWithNotesAndFootnotes">
5114
5121
 
5115
- <fo:table keep-with-previous="always">
5122
+ <fo:table keep-with-previous="always" role="SKIP">
5116
5123
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
5117
5124
  <xsl:variable name="name" select="local-name()"/>
5118
5125
  <xsl:choose>
@@ -5143,9 +5150,9 @@
5143
5150
  </xsl:otherwise>
5144
5151
  </xsl:choose>
5145
5152
 
5146
- <fo:table-body>
5147
- <fo:table-row>
5148
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
5153
+ <fo:table-body role="SKIP">
5154
+ <fo:table-row role="SKIP">
5155
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
5149
5156
 
5150
5157
  <xsl:call-template name="refine_table-footer-cell-style"/>
5151
5158
 
@@ -5349,6 +5356,8 @@
5349
5356
 
5350
5357
  <xsl:template name="setTableRowAttributes">
5351
5358
 
5359
+ <xsl:call-template name="setColors"/>
5360
+
5352
5361
  </xsl:template> <!-- setTableRowAttributes -->
5353
5362
  <!-- ===================== -->
5354
5363
  <!-- END Table's row processing -->
@@ -5400,6 +5409,7 @@
5400
5409
  </xsl:attribute>
5401
5410
  </xsl:if>
5402
5411
  <xsl:call-template name="display-align"/>
5412
+ <xsl:call-template name="setColors"/>
5403
5413
  </xsl:template>
5404
5414
 
5405
5415
  <xsl:template name="display-align">
@@ -5415,6 +5425,29 @@
5415
5425
  </xsl:if>
5416
5426
  </xsl:template>
5417
5427
 
5428
+ <xsl:template name="setColors">
5429
+ <xsl:variable name="styles__">
5430
+ <xsl:call-template name="split">
5431
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
5432
+ <xsl:with-param name="sep" select="';'"/>
5433
+ </xsl:call-template>
5434
+ </xsl:variable>
5435
+ <xsl:variable name="quot">"</xsl:variable>
5436
+ <xsl:variable name="styles_">
5437
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
5438
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
5439
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
5440
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
5441
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
5442
+ </xsl:if>
5443
+ </xsl:for-each>
5444
+ </xsl:variable>
5445
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
5446
+ <xsl:for-each select="$styles/style">
5447
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
5448
+ </xsl:for-each>
5449
+ </xsl:template>
5450
+
5418
5451
  <!-- cell in table body, footer -->
5419
5452
  <xsl:template match="*[local-name()='td']" name="td">
5420
5453
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -5426,12 +5459,12 @@
5426
5459
 
5427
5460
  <xsl:call-template name="refine_table-cell-style"/>
5428
5461
 
5462
+ <xsl:call-template name="setTableCellAttributes"/>
5463
+
5429
5464
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
5430
5465
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
5431
5466
  </xsl:if>
5432
5467
 
5433
- <xsl:call-template name="setTableCellAttributes"/>
5434
-
5435
5468
  <xsl:if test="$isGenerateTableIF = 'true'">
5436
5469
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
5437
5470
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -5516,6 +5549,7 @@
5516
5549
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
5517
5550
  <!-- fn in text -->
5518
5551
  <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">
5552
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
5519
5553
 
5520
5554
  <!-- list of unique footnotes -->
5521
5555
  <xsl:variable name="p_fn_">
@@ -5581,7 +5615,7 @@
5581
5615
  <xsl:copy-of select="$footnote_inline"/>
5582
5616
  </xsl:when>
5583
5617
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
5584
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
5618
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
5585
5619
 
5586
5620
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
5587
5621
  <xsl:copy-of select="$footnote_inline"/>
@@ -5990,39 +6024,51 @@
5990
6024
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
5991
6025
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5992
6026
  <xsl:template match="*[local-name()='fn']">
5993
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
5994
-
5995
- <xsl:call-template name="refine_fn-reference-style"/>
6027
+ <xsl:variable name="target" select="@target"/>
6028
+ <xsl:choose>
6029
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
6030
+ <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]">
6031
+ <xsl:call-template name="fn">
6032
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
6033
+ </xsl:call-template>
6034
+ </xsl:when>
6035
+ <xsl:otherwise>
5996
6036
 
5997
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5998
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5999
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
6000
- <!-- <xsl:attribute name="internal-destination">
6001
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
6002
- </xsl:attribute>
6003
- </xsl:if>
6004
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
6005
- <xsl:attribute name="internal-destination">
6006
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
6007
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
6008
- </xsl:attribute>
6009
- </xsl:if> -->
6010
- <!-- <xsl:if test="$namespace = 'plateau'">
6011
- <xsl:text>※</xsl:text>
6012
- </xsl:if> -->
6013
- <!-- <xsl:value-of select="@reference"/> -->
6037
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
6014
6038
 
6015
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
6039
+ <xsl:call-template name="refine_fn-reference-style"/>
6016
6040
 
6017
- <!-- <xsl:if test="$namespace = 'bsi'">
6018
- <xsl:text>)</xsl:text>
6019
- </xsl:if> -->
6020
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
6021
- <!-- <xsl:if test="$namespace = 'jis'">
6022
- <fo:inline font-weight="normal">)</fo:inline>
6023
- </xsl:if> -->
6024
- </fo:basic-link>
6025
- </fo:inline>
6041
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6042
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
6043
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
6044
+ <!-- <xsl:attribute name="internal-destination">
6045
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
6046
+ </xsl:attribute>
6047
+ </xsl:if>
6048
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
6049
+ <xsl:attribute name="internal-destination">
6050
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
6051
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
6052
+ </xsl:attribute>
6053
+ </xsl:if> -->
6054
+ <!-- <xsl:if test="$namespace = 'plateau'">
6055
+ <xsl:text>※</xsl:text>
6056
+ </xsl:if> -->
6057
+ <!-- <xsl:value-of select="@reference"/> -->
6058
+
6059
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
6060
+
6061
+ <!-- <xsl:if test="$namespace = 'bsi'">
6062
+ <xsl:text>)</xsl:text>
6063
+ </xsl:if> -->
6064
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
6065
+ <!-- <xsl:if test="$namespace = 'jis'">
6066
+ <fo:inline font-weight="normal">)</fo:inline>
6067
+ </xsl:if> -->
6068
+ </fo:basic-link>
6069
+ </fo:inline>
6070
+ </xsl:otherwise>
6071
+ </xsl:choose>
6026
6072
  </xsl:template> <!-- fn -->
6027
6073
 
6028
6074
  <!-- fn/text() -->
@@ -7225,7 +7271,7 @@
7225
7271
  <xsl:choose>
7226
7272
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
7227
7273
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
7228
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
7274
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
7229
7275
  </xsl:when>
7230
7276
  <xsl:otherwise>
7231
7277
  <xsl:apply-templates/>
@@ -7233,7 +7279,7 @@
7233
7279
  </xsl:choose>
7234
7280
  </xsl:template>
7235
7281
  <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">
7236
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
7282
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
7237
7283
  </xsl:template>
7238
7284
 
7239
7285
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -8273,24 +8319,26 @@
8273
8319
  <xsl:apply-templates select="." mode="mathml"/>
8274
8320
  </xsl:variable>
8275
8321
 
8276
- <fo:instream-foreign-object fox:alt-text="Math">
8322
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
8277
8323
 
8278
8324
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
8279
8325
 
8280
- <!-- put MathML in Actual Text -->
8281
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
8282
- <xsl:attribute name="fox:actual-text">
8283
- <xsl:value-of select="$mathml_content"/>
8284
- </xsl:attribute>
8285
-
8286
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8287
- <xsl:if test="normalize-space($asciimath_text_) != ''">
8288
- <!-- put Mathin Alternate Text -->
8289
- <xsl:attribute name="fox:alt-text">
8290
- <xsl:value-of select="$asciimath_text_"/>
8326
+ <xsl:if test="$isGenerateTableIF = 'false'">
8327
+ <!-- put MathML in Actual Text -->
8328
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
8329
+ <xsl:attribute name="fox:actual-text">
8330
+ <xsl:value-of select="$mathml_content"/>
8291
8331
  </xsl:attribute>
8332
+
8333
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8334
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8335
+ <!-- put Mathin Alternate Text -->
8336
+ <xsl:attribute name="fox:alt-text">
8337
+ <xsl:value-of select="$asciimath_text_"/>
8338
+ </xsl:attribute>
8339
+ </xsl:if>
8340
+ <!-- </xsl:if> -->
8292
8341
  </xsl:if>
8293
- <!-- </xsl:if> -->
8294
8342
 
8295
8343
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
8296
8344
 
@@ -10032,6 +10080,13 @@
10032
10080
  <xsl:apply-templates select="."/>
10033
10081
  </xsl:template>
10034
10082
 
10083
+ <!-- prevent missing stem for table and figures in ToC -->
10084
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
10085
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
10086
+ <xsl:apply-templates select="."/>
10087
+ </xsl:if>
10088
+ </xsl:template>
10089
+
10035
10090
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
10036
10091
 
10037
10092
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -10052,6 +10107,8 @@
10052
10107
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
10053
10108
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
10054
10109
 
10110
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
10111
+
10055
10112
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
10056
10113
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
10057
10114
  <xsl:apply-templates mode="bookmarks"/>
@@ -10073,6 +10130,8 @@
10073
10130
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
10074
10131
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
10075
10132
 
10133
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
10134
+
10076
10135
  <!-- Bookmarks -->
10077
10136
  <xsl:template name="addBookmarks">
10078
10137
  <xsl:param name="contents"/>
@@ -10226,6 +10285,26 @@
10226
10285
  </xsl:template> <!-- insertTableBookmarks -->
10227
10286
  <!-- End Bookmarks -->
10228
10287
 
10288
+ <!-- ============================ -->
10289
+ <!-- mode="bookmark_clean" -->
10290
+ <!-- ============================ -->
10291
+ <xsl:template match="node()" mode="bookmark_clean">
10292
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
10293
+ </xsl:template>
10294
+
10295
+ <xsl:template match="text()" mode="bookmark_clean">
10296
+ <xsl:value-of select="."/>
10297
+ </xsl:template>
10298
+
10299
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
10300
+ <xsl:value-of select="normalize-space(.)"/>
10301
+ </xsl:template>
10302
+
10303
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
10304
+ <!-- ============================ -->
10305
+ <!-- END: mode="bookmark_clean" -->
10306
+ <!-- ============================ -->
10307
+
10229
10308
  <xsl:template name="getLangVersion">
10230
10309
  <xsl:param name="lang"/>
10231
10310
  <xsl:param name="doctype" select="''"/>
@@ -11948,21 +12027,32 @@
11948
12027
  <!-- ========== -->
11949
12028
 
11950
12029
  <xsl:variable name="reviews_">
11951
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
12030
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
11952
12031
  <xsl:copy>
11953
12032
  <xsl:copy-of select="@from"/>
11954
12033
  <xsl:copy-of select="@id"/>
11955
12034
  </xsl:copy>
11956
12035
  </xsl:for-each>
12036
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
12037
+ <xsl:copy>
12038
+ <xsl:copy-of select="@source"/>
12039
+ <xsl:copy-of select="@id"/>
12040
+ </xsl:copy>
12041
+ </xsl:for-each>
11957
12042
  </xsl:variable>
11958
12043
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
11959
12044
 
11960
12045
  <xsl:template name="addReviewHelper">
11961
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11962
- <xsl:variable name="curr_id" select="@id"/>
11963
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
11964
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11965
- <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>
12046
+ <xsl:if test="$isGenerateTableIF = 'false'">
12047
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
12048
+ <xsl:variable name="curr_id" select="@id"/>
12049
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
12050
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
12051
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
12052
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
12053
+ <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>
12054
+ </xsl:if>
12055
+ </xsl:for-each>
11966
12056
  </xsl:if>
11967
12057
  <!-- <fo:block>
11968
12058
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -12104,14 +12194,61 @@
12104
12194
 
12105
12195
  </xsl:template>
12106
12196
 
12107
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
12197
+ <!-- document text (not figures, or tables) footnotes -->
12198
+ <xsl:variable name="reviews_container_">
12199
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
12200
+ <xsl:variable name="update_xml_step1">
12201
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
12202
+ </xsl:variable>
12203
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
12204
+ </xsl:for-each>
12205
+ </xsl:variable>
12206
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
12207
+
12208
+ <xsl:template match="*[local-name() = 'review-container']"/>
12209
+
12210
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
12211
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
12212
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12213
+ <xsl:if test="$isGenerateTableIF = 'false'">
12214
+ <xsl:choose>
12215
+ <!-- if there isn't the attribute '@from', then -->
12216
+ <xsl:when test="$id_from = ''">
12217
+ <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>
12218
+ </xsl:when>
12219
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12220
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
12221
+ <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>
12222
+ </xsl:when>
12223
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12224
+ <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>
12225
+ </xsl:when>
12226
+ </xsl:choose>
12227
+ </xsl:if>
12228
+ </xsl:template>
12229
+
12230
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
12231
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
12108
12232
  <!-- comment 2019-11-29 -->
12109
12233
  <!-- <fo:block font-weight="bold">Review:</fo:block>
12110
12234
  <xsl:apply-templates /> -->
12111
12235
 
12112
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12236
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
12113
12237
 
12114
- <xsl:if test="1 = 1">
12238
+ <xsl:variable name="source" select="normalize-space(@source)"/>
12239
+
12240
+ <xsl:if test="$isGenerateTableIF = 'false'">
12241
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
12242
+
12243
+ <!-- <xsl:if test="@source = @end"> -->
12244
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
12245
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
12246
+ <!-- <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> -->
12247
+ <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>
12248
+ <!-- </xsl:if> -->
12249
+ </xsl:if>
12250
+
12251
+ <xsl:if test="1 = 2">
12115
12252
  <xsl:choose>
12116
12253
  <!-- if there isn't the attribute '@from', then -->
12117
12254
  <xsl:when test="$id_from = ''">
@@ -12119,10 +12256,10 @@
12119
12256
  </xsl:when>
12120
12257
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12121
12258
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
12122
- <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>
12259
+ <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>
12123
12260
  </xsl:when>
12124
12261
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12125
- <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>
12262
+ <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>
12126
12263
  </xsl:when>
12127
12264
  </xsl:choose>
12128
12265
  </xsl:if>
@@ -12171,16 +12308,21 @@
12171
12308
  <xsl:variable name="list_level">
12172
12309
  <xsl:choose>
12173
12310
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
12174
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
12311
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
12312
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
12313
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
12175
12314
  </xsl:choose>
12176
12315
  </xsl:variable>
12177
12316
  <xsl:choose>
12178
12317
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
12179
12318
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
12180
12319
  </xsl:when>
12181
- <xsl:when test="$list_level mod 3 = 0">
12320
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
12182
12321
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
12183
12322
  </xsl:when>
12323
+ <xsl:when test="$list_level mod 3 = 0">
12324
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
12325
+ </xsl:when>
12184
12326
  <xsl:when test="$list_level mod 2 = 0">
12185
12327
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
12186
12328
  </xsl:when>
@@ -12201,9 +12343,15 @@
12201
12343
  <xsl:when test="local-name(..) = 'ul'">
12202
12344
  <xsl:choose>
12203
12345
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
12346
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
12347
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
12204
12348
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
12205
12349
  </xsl:choose>
12206
12350
  </xsl:when>
12351
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
12352
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
12353
+ <xsl:value-of select="@label"/>
12354
+ </xsl:when>
12207
12355
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12208
12356
 
12209
12357
  <xsl:variable name="type" select="../@type"/>
@@ -12328,7 +12476,7 @@
12328
12476
 
12329
12477
  </xsl:otherwise>
12330
12478
  </xsl:choose>
12331
- </xsl:template>
12479
+ </xsl:template> <!-- getListItemFormat -->
12332
12480
 
12333
12481
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
12334
12482
  <xsl:param name="indent">0</xsl:param>
@@ -12460,6 +12608,11 @@
12460
12608
 
12461
12609
  <xsl:call-template name="refine_list-item-label-style"/>
12462
12610
 
12611
+ <xsl:if test="local-name(..) = 'ul'">
12612
+ <xsl:variable name="li_label" select="@label"/>
12613
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
12614
+ </xsl:if>
12615
+
12463
12616
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
12464
12617
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
12465
12618
  <xsl:call-template name="append_add-style"/>
@@ -12723,10 +12876,22 @@
12723
12876
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
12724
12877
 
12725
12878
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
12726
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
12727
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
12728
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
12729
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12879
+ <xsl:variable name="bookmark_id" select="@id"/>
12880
+ <xsl:choose>
12881
+ <!-- Example:
12882
+ <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"/>
12883
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
12884
+ <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"/> -->
12885
+ <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]">
12886
+ <!-- skip here, see the template 'fmt-review-start' -->
12887
+ </xsl:when>
12888
+ <xsl:otherwise>
12889
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
12890
+ <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>
12891
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
12892
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12893
+ </xsl:otherwise>
12894
+ </xsl:choose>
12730
12895
  </xsl:template>
12731
12896
  <!-- =================== -->
12732
12897
  <!-- End of Index processing -->
@@ -13851,6 +14016,16 @@
13851
14016
  </xsl:choose>
13852
14017
  </xsl:template>
13853
14018
 
14019
+ <!-- li/fmt-name -->
14020
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
14021
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
14022
+ <xsl:attribute name="full">true</xsl:attribute>
14023
+ </xsl:template>
14024
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
14025
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
14026
+ <xsl:attribute name="full">true</xsl:attribute>
14027
+ </xsl:template>
14028
+
13854
14029
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
13855
14030
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
13856
14031
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -14080,6 +14255,9 @@
14080
14255
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
14081
14256
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
14082
14257
 
14258
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
14259
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
14260
+
14083
14261
  <!-- END: update new Presentation XML -->
14084
14262
 
14085
14263
  <!-- =========================================================================== -->
@@ -14662,6 +14840,64 @@
14662
14840
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
14663
14841
  </xsl:template>
14664
14842
 
14843
+ <!-- ===================================== -->
14844
+ <!-- ===================================== -->
14845
+ <!-- Ruby text (CJK languages) rendering -->
14846
+ <!-- ===================================== -->
14847
+ <!-- ===================================== -->
14848
+ <xsl:template match="*[local-name() = 'ruby']">
14849
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
14850
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
14851
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
14852
+ </xsl:if>
14853
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
14854
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
14855
+ <!-- Example: width="2em" -->
14856
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
14857
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
14858
+ <xsl:variable name="text_width">
14859
+ <xsl:choose>
14860
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
14861
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
14862
+ </xsl:choose>
14863
+ </xsl:variable>
14864
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
14865
+
14866
+ <xsl:choose>
14867
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
14868
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
14869
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
14870
+ </xsl:when>
14871
+ <xsl:otherwise>
14872
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
14873
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
14874
+ </xsl:otherwise>
14875
+ </xsl:choose>
14876
+
14877
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
14878
+ </fo:inline-container>
14879
+ </xsl:template>
14880
+
14881
+ <xsl:template match="*[local-name() = 'rb']">
14882
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
14883
+ </xsl:template>
14884
+
14885
+ <xsl:template match="*[local-name() = 'rt']">
14886
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
14887
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
14888
+ <xsl:attribute name="space-before">0em</xsl:attribute>
14889
+ </xsl:if>
14890
+ <xsl:apply-templates/>
14891
+ </fo:block>
14892
+
14893
+ </xsl:template>
14894
+
14895
+ <!-- ===================================== -->
14896
+ <!-- ===================================== -->
14897
+ <!-- END: Ruby text (CJK languages) rendering -->
14898
+ <!-- ===================================== -->
14899
+ <!-- ===================================== -->
14900
+
14665
14901
  <xsl:template name="printEdition">
14666
14902
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
14667
14903