metanorma-iso 3.0.2 → 3.0.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.
@@ -86,14 +86,15 @@
86
86
  <xsl:value-of select="$i18n_all_rights_reserved"/>
87
87
  </xsl:variable>
88
88
 
89
+ <xsl:variable name="iso_reference_" select="normalize-space(/iso:metanorma/iso:bibdata/iso:docidentifier[@type = 'iso-reference'])"/>
90
+ <xsl:variable name="iso_reference"><xsl:value-of select="$iso_reference_"/><xsl:if test="$iso_reference_ = ''"><xsl:value-of select="$docidentifier_iso"/></xsl:if></xsl:variable>
91
+
89
92
  <xsl:variable name="docidentifier_iso_with_lang_" select="normalize-space(/iso:metanorma/iso:bibdata/iso:docidentifier[@type = 'iso-with-lang'])"/>
90
- <xsl:variable name="docidentifier_iso_with_lang"><xsl:value-of select="$docidentifier_iso_with_lang_"/><xsl:if test="$docidentifier_iso_with_lang_ = ''"><xsl:value-of select="$docidentifier_iso"/></xsl:if></xsl:variable>
93
+ <xsl:variable name="docidentifier_iso_with_lang"><xsl:value-of select="$docidentifier_iso_with_lang_"/><xsl:if test="$docidentifier_iso_with_lang_ = ''"><xsl:value-of select="$iso_reference"/></xsl:if></xsl:variable>
91
94
 
92
95
  <xsl:variable name="lang-1st-letter_tmp" select="substring-before(substring-after($docidentifier_iso_with_lang, '('), ')')"/>
93
96
  <xsl:variable name="lang-1st-letter" select="concat('(', $lang-1st-letter_tmp , ')')"/>
94
97
 
95
- <xsl:variable name="iso_reference_" select="normalize-space(/iso:metanorma/iso:bibdata/iso:docidentifier[@type = 'iso-reference'])"/>
96
- <xsl:variable name="iso_reference"><xsl:value-of select="$iso_reference_"/><xsl:if test="$iso_reference_ = ''"><xsl:value-of select="$docidentifier_iso"/></xsl:if></xsl:variable>
97
98
  <xsl:variable name="anotherNumbers">
98
99
  <xsl:variable name="year_iso_reference" select="concat(':',substring-after($iso_reference,':'))"/>
99
100
  <xsl:for-each select="/iso:metanorma/iso:bibdata/iso:docidentifier[@type != '' and @type != 'ISO' and not(starts-with(@type, 'iso-')) and @type != 'URN']">
@@ -155,6 +156,8 @@
155
156
  <xsl:variable name="stagename" select="normalize-space(/iso:metanorma/iso:bibdata/iso:ext/iso:stagename)"/>
156
157
  <xsl:variable name="stagename_abbreviation" select="normalize-space(/iso:metanorma/iso:bibdata/iso:ext/iso:stagename/@abbreviation)"/>
157
158
  <xsl:variable name="stagename_localized" select="normalize-space(/iso:metanorma/iso:bibdata/iso:status/iso:stage[@language = $lang])"/>
159
+ <xsl:variable name="stagename_localized_coverpage"><xsl:copy-of select="/iso:metanorma/iso:bibdata/iso:status/iso:stage[@language = $lang and @type = 'coverpage']/node()"/></xsl:variable>
160
+ <xsl:variable name="stagename_localized_firstpage"><xsl:copy-of select="/iso:metanorma/iso:bibdata/iso:status/iso:stage[@language = $lang and @type = 'firstpage']/node()"/></xsl:variable>
158
161
  <xsl:variable name="abbreviation" select="normalize-space(/iso:metanorma/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
159
162
  <xsl:variable name="abbreviation_uppercased" select="java:toUpperCase(java:java.lang.String.new($abbreviation))"/>
160
163
 
@@ -1871,17 +1874,9 @@
1871
1874
  <xsl:choose>
1872
1875
  <xsl:when test="$stage-abbreviation = 'DIS'"> <!-- or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' -->
1873
1876
  <xsl:choose>
1874
- <xsl:when test="$stagename_localized != '' and contains($stagename_localized, ' ')">
1875
- <!-- Draft International Standard to DRAFT -->
1876
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring-before($stagename_localized, ' ')))"/>
1877
- <xsl:value-of select="$linebreak"/>
1878
- <xsl:value-of select="substring-after($stagename_localized, ' ')"/>
1879
- </xsl:when>
1880
- <xsl:when test="contains($stagename, ' ')">
1881
- <!-- Draft International Standard to DRAFT -->
1882
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring-before($stagename, ' ')))"/>
1883
- <xsl:value-of select="$linebreak"/>
1884
- <xsl:value-of select="substring-after($stagename, ' ')"/>
1877
+ <xsl:when test="normalize-space($stagename_localized_coverpage) != ''">
1878
+ <!-- DRAFT<br/>International Standard-->
1879
+ <xsl:apply-templates select="xalan:nodeset($stagename_localized_coverpage)/node()"/>
1885
1880
  </xsl:when>
1886
1881
  <xsl:otherwise>
1887
1882
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
@@ -2177,6 +2172,7 @@
2177
2172
  <fo:table-row height="13mm">
2178
2173
  <fo:table-cell number-columns-spanned="2" border-right="{$cover_page_border}" display-align="after" padding-bottom="-1mm" line-height="1.1">&gt;
2179
2174
  <fo:block font-size="10pt">
2175
+ <!-- Reference number -->
2180
2176
  <xsl:value-of select="$i18n_reference_number"/>
2181
2177
  </fo:block>
2182
2178
  <fo:block font-size="10pt">
@@ -3229,11 +3225,11 @@
3229
3225
 
3230
3226
  <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
3231
3227
 
3232
- <!-- <xsl:if test="$debug = 'true'">
3228
+ <xsl:if test="$debug = 'true'">
3233
3229
  <redirect:write file="contents_.xml">
3234
3230
  <xsl:copy-of select="$contents"/>
3235
3231
  </redirect:write>
3236
- </xsl:if> -->
3232
+ </xsl:if>
3237
3233
 
3238
3234
  <xsl:variable name="margin-left">12</xsl:variable>
3239
3235
 
@@ -4878,6 +4874,7 @@
4878
4874
  <xsl:when test="$layoutVersion = '2024'">
4879
4875
  <xsl:choose>
4880
4876
  <xsl:when test="$doctype = 'committee-document'"><xsl:value-of select="$doctype_localized"/></xsl:when>
4877
+ <xsl:when test="normalize-space($stagename_localized_firstpage) != ''"><xsl:apply-templates select="xalan:nodeset($stagename_localized_firstpage)/node()"/></xsl:when>
4881
4878
  <xsl:otherwise><xsl:value-of select="$stagename-header-firstpage"/></xsl:otherwise>
4882
4879
  </xsl:choose>
4883
4880
  </xsl:when>
@@ -6421,6 +6418,7 @@
6421
6418
  </xsl:template> <!-- refine_table-style -->
6422
6419
 
6423
6420
  <xsl:attribute-set name="table-name-style">
6421
+ <xsl:attribute name="role">Caption</xsl:attribute>
6424
6422
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6425
6423
 
6426
6424
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -6432,6 +6430,9 @@
6432
6430
 
6433
6431
  <xsl:template name="refine_table-name-style">
6434
6432
  <xsl:param name="continued"/>
6433
+ <xsl:if test="$continued = 'true'">
6434
+ <xsl:attribute name="role">SKIP</xsl:attribute>
6435
+ </xsl:if>
6435
6436
 
6436
6437
  <xsl:if test="$continued = 'true'">
6437
6438
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
@@ -8368,7 +8369,7 @@
8368
8369
  </xsl:if>
8369
8370
 
8370
8371
  </fo:block-container>
8371
- </xsl:variable>
8372
+ </xsl:variable> <!-- END: variable name="table" -->
8372
8373
 
8373
8374
  <xsl:variable name="isAdded" select="@added"/>
8374
8375
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8378,7 +8379,7 @@
8378
8379
 
8379
8380
  <!-- centered table when table name is centered (see table-name-style) -->
8380
8381
 
8381
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
8382
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
8382
8383
 
8383
8384
  <xsl:if test="$layoutVersion = '1951'">
8384
8385
  <xsl:attribute name="font-size">inherit</xsl:attribute>
@@ -8391,9 +8392,9 @@
8391
8392
  <fo:table-column column-width="proportional-column-width(1)"/>
8392
8393
  <fo:table-column column-width="{@width}"/>
8393
8394
  <fo:table-column column-width="proportional-column-width(1)"/>
8394
- <fo:table-body>
8395
- <fo:table-row>
8396
- <fo:table-cell column-number="2">
8395
+ <fo:table-body role="SKIP">
8396
+ <fo:table-row role="SKIP">
8397
+ <fo:table-cell column-number="2" role="SKIP">
8397
8398
  <xsl:copy-of select="$table-preamble"/>
8398
8399
  <fo:block role="SKIP">
8399
8400
  <xsl:call-template name="setTrackChangesStyles">
@@ -8439,11 +8440,12 @@
8439
8440
 
8440
8441
  </xsl:template>
8441
8442
 
8443
+ <!-- table/name-->
8442
8444
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
8443
8445
  <xsl:param name="continued"/>
8444
8446
  <xsl:if test="normalize-space() != ''">
8445
8447
 
8446
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
8448
+ <fo:block xsl:use-attribute-sets="table-name-style">
8447
8449
 
8448
8450
  <xsl:call-template name="refine_table-name-style">
8449
8451
  <xsl:with-param name="continued" select="$continued"/>
@@ -8944,7 +8946,7 @@
8944
8946
 
8945
8947
  <xsl:variable name="tableWithNotesAndFootnotes">
8946
8948
 
8947
- <fo:table keep-with-previous="always">
8949
+ <fo:table keep-with-previous="always" role="SKIP">
8948
8950
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
8949
8951
  <xsl:variable name="name" select="local-name()"/>
8950
8952
  <xsl:choose>
@@ -8975,9 +8977,9 @@
8975
8977
  </xsl:otherwise>
8976
8978
  </xsl:choose>
8977
8979
 
8978
- <fo:table-body>
8979
- <fo:table-row>
8980
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
8980
+ <fo:table-body role="SKIP">
8981
+ <fo:table-row role="SKIP">
8982
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
8981
8983
 
8982
8984
  <xsl:call-template name="refine_table-footer-cell-style"/>
8983
8985
 
@@ -9050,7 +9052,7 @@
9050
9052
 
9051
9053
  <!-- if there isn't 'thead' and there is a table's title -->
9052
9054
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='thead']) and ancestor::*[local-name()='table']/*[local-name()='name']">
9053
- <fo:table-header>
9055
+ <fo:table-header role="Caption">
9054
9056
  <xsl:call-template name="table-header-title">
9055
9057
  <xsl:with-param name="cols-count" select="$cols-count"/>
9056
9058
  </xsl:call-template>
@@ -9226,6 +9228,8 @@
9226
9228
 
9227
9229
  <xsl:template name="setTableRowAttributes">
9228
9230
 
9231
+ <xsl:call-template name="setColors"/>
9232
+
9229
9233
  </xsl:template> <!-- setTableRowAttributes -->
9230
9234
  <!-- ===================== -->
9231
9235
  <!-- END Table's row processing -->
@@ -9277,6 +9281,7 @@
9277
9281
  </xsl:attribute>
9278
9282
  </xsl:if>
9279
9283
  <xsl:call-template name="display-align"/>
9284
+ <xsl:call-template name="setColors"/>
9280
9285
  </xsl:template>
9281
9286
 
9282
9287
  <xsl:template name="display-align">
@@ -9292,6 +9297,29 @@
9292
9297
  </xsl:if>
9293
9298
  </xsl:template>
9294
9299
 
9300
+ <xsl:template name="setColors">
9301
+ <xsl:variable name="styles__">
9302
+ <xsl:call-template name="split">
9303
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
9304
+ <xsl:with-param name="sep" select="';'"/>
9305
+ </xsl:call-template>
9306
+ </xsl:variable>
9307
+ <xsl:variable name="quot">"</xsl:variable>
9308
+ <xsl:variable name="styles_">
9309
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
9310
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
9311
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
9312
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
9313
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
9314
+ </xsl:if>
9315
+ </xsl:for-each>
9316
+ </xsl:variable>
9317
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
9318
+ <xsl:for-each select="$styles/style">
9319
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
9320
+ </xsl:for-each>
9321
+ </xsl:template>
9322
+
9295
9323
  <!-- cell in table body, footer -->
9296
9324
  <xsl:template match="*[local-name()='td']" name="td">
9297
9325
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -9303,12 +9331,12 @@
9303
9331
 
9304
9332
  <xsl:call-template name="refine_table-cell-style"/>
9305
9333
 
9334
+ <xsl:call-template name="setTableCellAttributes"/>
9335
+
9306
9336
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
9307
9337
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
9308
9338
  </xsl:if>
9309
9339
 
9310
- <xsl:call-template name="setTableCellAttributes"/>
9311
-
9312
9340
  <xsl:if test="$isGenerateTableIF = 'true'">
9313
9341
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
9314
9342
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -9393,6 +9421,7 @@
9393
9421
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
9394
9422
  <!-- fn in text -->
9395
9423
  <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">
9424
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
9396
9425
 
9397
9426
  <!-- list of unique footnotes -->
9398
9427
  <xsl:variable name="p_fn_">
@@ -9471,7 +9500,7 @@
9471
9500
  <xsl:copy-of select="$footnote_inline"/>
9472
9501
  </xsl:when>
9473
9502
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
9474
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
9503
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
9475
9504
 
9476
9505
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
9477
9506
  <xsl:copy-of select="$footnote_inline"/>
@@ -9880,39 +9909,51 @@
9880
9909
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
9881
9910
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
9882
9911
  <xsl:template match="*[local-name()='fn']">
9883
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
9912
+ <xsl:variable name="target" select="@target"/>
9913
+ <xsl:choose>
9914
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
9915
+ <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]">
9916
+ <xsl:call-template name="fn">
9917
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
9918
+ </xsl:call-template>
9919
+ </xsl:when>
9920
+ <xsl:otherwise>
9884
9921
 
9885
- <xsl:call-template name="refine_fn-reference-style"/>
9922
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
9886
9923
 
9887
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9888
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9889
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9890
- <!-- <xsl:attribute name="internal-destination">
9891
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9892
- </xsl:attribute>
9893
- </xsl:if>
9894
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9895
- <xsl:attribute name="internal-destination">
9896
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9897
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9898
- </xsl:attribute>
9899
- </xsl:if> -->
9900
- <!-- <xsl:if test="$namespace = 'plateau'">
9901
- <xsl:text>※</xsl:text>
9902
- </xsl:if> -->
9903
- <!-- <xsl:value-of select="@reference"/> -->
9924
+ <xsl:call-template name="refine_fn-reference-style"/>
9925
+
9926
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9927
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9928
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9929
+ <!-- <xsl:attribute name="internal-destination">
9930
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9931
+ </xsl:attribute>
9932
+ </xsl:if>
9933
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9934
+ <xsl:attribute name="internal-destination">
9935
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9936
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9937
+ </xsl:attribute>
9938
+ </xsl:if> -->
9939
+ <!-- <xsl:if test="$namespace = 'plateau'">
9940
+ <xsl:text>※</xsl:text>
9941
+ </xsl:if> -->
9942
+ <!-- <xsl:value-of select="@reference"/> -->
9904
9943
 
9905
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9944
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9906
9945
 
9907
- <!-- <xsl:if test="$namespace = 'bsi'">
9908
- <xsl:text>)</xsl:text>
9909
- </xsl:if> -->
9910
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9911
- <!-- <xsl:if test="$namespace = 'jis'">
9912
- <fo:inline font-weight="normal">)</fo:inline>
9913
- </xsl:if> -->
9914
- </fo:basic-link>
9915
- </fo:inline>
9946
+ <!-- <xsl:if test="$namespace = 'bsi'">
9947
+ <xsl:text>)</xsl:text>
9948
+ </xsl:if> -->
9949
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9950
+ <!-- <xsl:if test="$namespace = 'jis'">
9951
+ <fo:inline font-weight="normal">)</fo:inline>
9952
+ </xsl:if> -->
9953
+ </fo:basic-link>
9954
+ </fo:inline>
9955
+ </xsl:otherwise>
9956
+ </xsl:choose>
9916
9957
  </xsl:template> <!-- fn -->
9917
9958
 
9918
9959
  <!-- fn/text() -->
@@ -11206,7 +11247,7 @@
11206
11247
  <xsl:choose>
11207
11248
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
11208
11249
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
11209
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
11250
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
11210
11251
  </xsl:when>
11211
11252
  <xsl:otherwise>
11212
11253
  <xsl:apply-templates/>
@@ -11214,7 +11255,7 @@
11214
11255
  </xsl:choose>
11215
11256
  </xsl:template>
11216
11257
  <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">
11217
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
11258
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
11218
11259
  </xsl:template>
11219
11260
 
11220
11261
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -12254,24 +12295,26 @@
12254
12295
  <xsl:apply-templates select="." mode="mathml"/>
12255
12296
  </xsl:variable>
12256
12297
 
12257
- <fo:instream-foreign-object fox:alt-text="Math">
12298
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
12258
12299
 
12259
12300
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
12260
12301
 
12261
- <!-- put MathML in Actual Text -->
12262
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
12263
- <xsl:attribute name="fox:actual-text">
12264
- <xsl:value-of select="$mathml_content"/>
12265
- </xsl:attribute>
12266
-
12267
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
12268
- <xsl:if test="normalize-space($asciimath_text_) != ''">
12269
- <!-- put Mathin Alternate Text -->
12270
- <xsl:attribute name="fox:alt-text">
12271
- <xsl:value-of select="$asciimath_text_"/>
12302
+ <xsl:if test="$isGenerateTableIF = 'false'">
12303
+ <!-- put MathML in Actual Text -->
12304
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
12305
+ <xsl:attribute name="fox:actual-text">
12306
+ <xsl:value-of select="$mathml_content"/>
12272
12307
  </xsl:attribute>
12308
+
12309
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
12310
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
12311
+ <!-- put Mathin Alternate Text -->
12312
+ <xsl:attribute name="fox:alt-text">
12313
+ <xsl:value-of select="$asciimath_text_"/>
12314
+ </xsl:attribute>
12315
+ </xsl:if>
12316
+ <!-- </xsl:if> -->
12273
12317
  </xsl:if>
12274
- <!-- </xsl:if> -->
12275
12318
 
12276
12319
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
12277
12320
 
@@ -14045,6 +14088,13 @@
14045
14088
  <xsl:apply-templates select="."/>
14046
14089
  </xsl:template>
14047
14090
 
14091
+ <!-- prevent missing stem for table and figures in ToC -->
14092
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
14093
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
14094
+ <xsl:apply-templates select="."/>
14095
+ </xsl:if>
14096
+ </xsl:template>
14097
+
14048
14098
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
14049
14099
 
14050
14100
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -14065,6 +14115,8 @@
14065
14115
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
14066
14116
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
14067
14117
 
14118
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
14119
+
14068
14120
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
14069
14121
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
14070
14122
  <xsl:apply-templates mode="bookmarks"/>
@@ -14086,6 +14138,8 @@
14086
14138
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
14087
14139
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
14088
14140
 
14141
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
14142
+
14089
14143
  <!-- Bookmarks -->
14090
14144
  <xsl:template name="addBookmarks">
14091
14145
  <xsl:param name="contents"/>
@@ -14264,7 +14318,8 @@
14264
14318
 
14265
14319
  <xsl:for-each select="$contents_nodes//tables/table">
14266
14320
  <fo:bookmark internal-destination="{@id}">
14267
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
14321
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
14322
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
14268
14323
  </fo:bookmark>
14269
14324
  </xsl:for-each>
14270
14325
  </fo:bookmark>
@@ -14273,6 +14328,26 @@
14273
14328
  </xsl:template> <!-- insertTableBookmarks -->
14274
14329
  <!-- End Bookmarks -->
14275
14330
 
14331
+ <!-- ============================ -->
14332
+ <!-- mode="bookmark_clean" -->
14333
+ <!-- ============================ -->
14334
+ <xsl:template match="node()" mode="bookmark_clean">
14335
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
14336
+ </xsl:template>
14337
+
14338
+ <xsl:template match="text()" mode="bookmark_clean">
14339
+ <xsl:value-of select="."/>
14340
+ </xsl:template>
14341
+
14342
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
14343
+ <xsl:value-of select="normalize-space(.)"/>
14344
+ </xsl:template>
14345
+
14346
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
14347
+ <!-- ============================ -->
14348
+ <!-- END: mode="bookmark_clean" -->
14349
+ <!-- ============================ -->
14350
+
14276
14351
  <xsl:template name="getLangVersion">
14277
14352
  <xsl:param name="lang"/>
14278
14353
  <xsl:param name="doctype" select="''"/>
@@ -15979,21 +16054,32 @@
15979
16054
  <!-- ========== -->
15980
16055
 
15981
16056
  <xsl:variable name="reviews_">
15982
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
16057
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
15983
16058
  <xsl:copy>
15984
16059
  <xsl:copy-of select="@from"/>
15985
16060
  <xsl:copy-of select="@id"/>
15986
16061
  </xsl:copy>
15987
16062
  </xsl:for-each>
16063
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
16064
+ <xsl:copy>
16065
+ <xsl:copy-of select="@source"/>
16066
+ <xsl:copy-of select="@id"/>
16067
+ </xsl:copy>
16068
+ </xsl:for-each>
15988
16069
  </xsl:variable>
15989
16070
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
15990
16071
 
15991
16072
  <xsl:template name="addReviewHelper">
15992
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
15993
- <xsl:variable name="curr_id" select="@id"/>
15994
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
15995
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
15996
- <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>
16073
+ <xsl:if test="$isGenerateTableIF = 'false'">
16074
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
16075
+ <xsl:variable name="curr_id" select="@id"/>
16076
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
16077
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
16078
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
16079
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
16080
+ <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>
16081
+ </xsl:if>
16082
+ </xsl:for-each>
15997
16083
  </xsl:if>
15998
16084
  <!-- <fo:block>
15999
16085
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -16141,14 +16227,61 @@
16141
16227
 
16142
16228
  </xsl:template>
16143
16229
 
16144
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
16230
+ <!-- document text (not figures, or tables) footnotes -->
16231
+ <xsl:variable name="reviews_container_">
16232
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
16233
+ <xsl:variable name="update_xml_step1">
16234
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
16235
+ </xsl:variable>
16236
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
16237
+ </xsl:for-each>
16238
+ </xsl:variable>
16239
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
16240
+
16241
+ <xsl:template match="*[local-name() = 'review-container']"/>
16242
+
16243
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
16244
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
16245
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
16246
+ <xsl:if test="$isGenerateTableIF = 'false'">
16247
+ <xsl:choose>
16248
+ <!-- if there isn't the attribute '@from', then -->
16249
+ <xsl:when test="$id_from = ''">
16250
+ <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>
16251
+ </xsl:when>
16252
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
16253
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
16254
+ <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>
16255
+ </xsl:when>
16256
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
16257
+ <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>
16258
+ </xsl:when>
16259
+ </xsl:choose>
16260
+ </xsl:if>
16261
+ </xsl:template>
16262
+
16263
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
16264
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
16145
16265
  <!-- comment 2019-11-29 -->
16146
16266
  <!-- <fo:block font-weight="bold">Review:</fo:block>
16147
16267
  <xsl:apply-templates /> -->
16148
16268
 
16149
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
16269
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
16150
16270
 
16151
- <xsl:if test="1 = 1">
16271
+ <xsl:variable name="source" select="normalize-space(@source)"/>
16272
+
16273
+ <xsl:if test="$isGenerateTableIF = 'false'">
16274
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
16275
+
16276
+ <!-- <xsl:if test="@source = @end"> -->
16277
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
16278
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
16279
+ <!-- <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> -->
16280
+ <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>
16281
+ <!-- </xsl:if> -->
16282
+ </xsl:if>
16283
+
16284
+ <xsl:if test="1 = 2">
16152
16285
  <xsl:choose>
16153
16286
  <!-- if there isn't the attribute '@from', then -->
16154
16287
  <xsl:when test="$id_from = ''">
@@ -16156,10 +16289,10 @@
16156
16289
  </xsl:when>
16157
16290
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
16158
16291
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
16159
- <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>
16292
+ <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>
16160
16293
  </xsl:when>
16161
16294
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
16162
- <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>
16295
+ <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>
16163
16296
  </xsl:when>
16164
16297
  </xsl:choose>
16165
16298
  </xsl:if>
@@ -16215,16 +16348,21 @@
16215
16348
  <xsl:variable name="list_level">
16216
16349
  <xsl:choose>
16217
16350
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
16218
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
16351
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
16352
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
16353
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
16219
16354
  </xsl:choose>
16220
16355
  </xsl:variable>
16221
16356
  <xsl:choose>
16222
16357
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
16223
16358
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
16224
16359
  </xsl:when>
16225
- <xsl:when test="$list_level mod 3 = 0">
16360
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
16226
16361
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
16227
16362
  </xsl:when>
16363
+ <xsl:when test="$list_level mod 3 = 0">
16364
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
16365
+ </xsl:when>
16228
16366
  <xsl:when test="$list_level mod 2 = 0">
16229
16367
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
16230
16368
  </xsl:when>
@@ -16245,9 +16383,15 @@
16245
16383
  <xsl:when test="local-name(..) = 'ul'">
16246
16384
  <xsl:choose>
16247
16385
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
16386
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
16387
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
16248
16388
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
16249
16389
  </xsl:choose>
16250
16390
  </xsl:when>
16391
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
16392
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
16393
+ <xsl:value-of select="@label"/>
16394
+ </xsl:when>
16251
16395
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
16252
16396
 
16253
16397
  <xsl:variable name="type" select="../@type"/>
@@ -16379,7 +16523,7 @@
16379
16523
 
16380
16524
  </xsl:otherwise>
16381
16525
  </xsl:choose>
16382
- </xsl:template>
16526
+ </xsl:template> <!-- getListItemFormat -->
16383
16527
 
16384
16528
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
16385
16529
  <xsl:param name="indent">0</xsl:param>
@@ -16541,6 +16685,11 @@
16541
16685
 
16542
16686
  <xsl:call-template name="refine_list-item-label-style"/>
16543
16687
 
16688
+ <xsl:if test="local-name(..) = 'ul'">
16689
+ <xsl:variable name="li_label" select="@label"/>
16690
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
16691
+ </xsl:if>
16692
+
16544
16693
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
16545
16694
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
16546
16695
  <xsl:call-template name="append_add-style"/>
@@ -16804,10 +16953,22 @@
16804
16953
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
16805
16954
 
16806
16955
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
16807
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
16808
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
16809
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
16810
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
16956
+ <xsl:variable name="bookmark_id" select="@id"/>
16957
+ <xsl:choose>
16958
+ <!-- Example:
16959
+ <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"/>
16960
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
16961
+ <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"/> -->
16962
+ <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]">
16963
+ <!-- skip here, see the template 'fmt-review-start' -->
16964
+ </xsl:when>
16965
+ <xsl:otherwise>
16966
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
16967
+ <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>
16968
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
16969
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
16970
+ </xsl:otherwise>
16971
+ </xsl:choose>
16811
16972
  </xsl:template>
16812
16973
  <!-- =================== -->
16813
16974
  <!-- End of Index processing -->
@@ -17937,6 +18098,16 @@
17937
18098
  </xsl:choose>
17938
18099
  </xsl:template>
17939
18100
 
18101
+ <!-- li/fmt-name -->
18102
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
18103
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
18104
+ <xsl:attribute name="full">true</xsl:attribute>
18105
+ </xsl:template>
18106
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
18107
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
18108
+ <xsl:attribute name="full">true</xsl:attribute>
18109
+ </xsl:template>
18110
+
17940
18111
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
17941
18112
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
17942
18113
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -18166,6 +18337,9 @@
18166
18337
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
18167
18338
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
18168
18339
 
18340
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
18341
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
18342
+
18169
18343
  <!-- END: update new Presentation XML -->
18170
18344
 
18171
18345
  <!-- =========================================================================== -->
@@ -18871,6 +19045,64 @@
18871
19045
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
18872
19046
  </xsl:template>
18873
19047
 
19048
+ <!-- ===================================== -->
19049
+ <!-- ===================================== -->
19050
+ <!-- Ruby text (CJK languages) rendering -->
19051
+ <!-- ===================================== -->
19052
+ <!-- ===================================== -->
19053
+ <xsl:template match="*[local-name() = 'ruby']">
19054
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
19055
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
19056
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
19057
+ </xsl:if>
19058
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
19059
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
19060
+ <!-- Example: width="2em" -->
19061
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
19062
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
19063
+ <xsl:variable name="text_width">
19064
+ <xsl:choose>
19065
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
19066
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
19067
+ </xsl:choose>
19068
+ </xsl:variable>
19069
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
19070
+
19071
+ <xsl:choose>
19072
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
19073
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
19074
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
19075
+ </xsl:when>
19076
+ <xsl:otherwise>
19077
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
19078
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
19079
+ </xsl:otherwise>
19080
+ </xsl:choose>
19081
+
19082
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
19083
+ </fo:inline-container>
19084
+ </xsl:template>
19085
+
19086
+ <xsl:template match="*[local-name() = 'rb']">
19087
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
19088
+ </xsl:template>
19089
+
19090
+ <xsl:template match="*[local-name() = 'rt']">
19091
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
19092
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
19093
+ <xsl:attribute name="space-before">0em</xsl:attribute>
19094
+ </xsl:if>
19095
+ <xsl:apply-templates/>
19096
+ </fo:block>
19097
+
19098
+ </xsl:template>
19099
+
19100
+ <!-- ===================================== -->
19101
+ <!-- ===================================== -->
19102
+ <!-- END: Ruby text (CJK languages) rendering -->
19103
+ <!-- ===================================== -->
19104
+ <!-- ===================================== -->
19105
+
18874
19106
  <xsl:template name="printEdition">
18875
19107
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
18876
19108