metanorma-iho 1.1.2 → 1.1.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.
@@ -153,74 +153,131 @@
153
153
  <!-- Cover Page -->
154
154
  <fo:page-sequence master-reference="cover">
155
155
  <fo:flow flow-name="xsl-region-body">
156
- <fo:block-container position="absolute" left="14.25mm" top="12mm" id="__internal_layout__coverpage_{generate-id()}">
157
- <fo:table table-layout="fixed" width="181.1mm">
158
- <fo:table-column column-width="26mm"/>
159
- <fo:table-column column-width="19.4mm"/>
160
- <fo:table-column column-width="135.7mm"/>
161
- <fo:table-body>
162
- <fo:table-row>
163
- <fo:table-cell><fo:block> </fo:block></fo:table-cell>
164
- <fo:table-cell>
165
- <fo:block-container width="19.4mm" height="21mm" background-color="rgb(241, 234, 202)" border-bottom="0.05pt solid rgb(0, 21, 50)" text-align="center" display-align="center" font-size="10pt" font-weight="bold">
166
- <fo:block>
167
- <xsl:value-of select="$docidentifier"/>
168
- </fo:block>
169
- </fo:block-container>
170
- </fo:table-cell>
171
- <fo:table-cell><fo:block> </fo:block></fo:table-cell>
172
- </fo:table-row>
173
- <fo:table-row>
174
- <fo:table-cell display-align="after" text-align="right">
175
- <fo:block font-size="1">
176
- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-IHO))}" width="25.9mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image IHO"/>
177
- </fo:block>
178
- </fo:table-cell>
179
- <fo:table-cell number-columns-spanned="2" border="0.5pt solid rgb(0, 21, 50)" font-weight="bold" color="rgb(0, 0, 76)" padding-top="3mm">
180
- <fo:block-container height="165mm" width="115mm">
181
- <fo:block-container margin-left="10mm">
182
- <fo:block-container margin-left="0mm">
183
- <fo:block-container display-align="center" height="90mm">
184
- <fo:block font-size="28pt" role="H1" line-height="115%">
185
- <xsl:copy-of select="$title-en"/>
186
- </fo:block>
187
- </fo:block-container>
188
- <fo:block font-size="14pt">
189
- <xsl:value-of select="$edition"/>
190
- <xsl:if test="normalize-space($month_year) != ''">
191
- <xsl:text> – </xsl:text>
192
- <xsl:value-of select="$month_year"/>
156
+
157
+ <xsl:variable name="isCoverPageImage" select="normalize-space(/*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'coverpage-image']/*[local-name() = 'value']/*[local-name() = 'image'] and 1 = 1)"/>
158
+
159
+ <xsl:variable name="document_scheme" select="normalize-space(/*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
160
+
161
+ <xsl:choose>
162
+ <xsl:when test="$document_scheme != '' and $document_scheme != '2019' and $isCoverPageImage = 'true'">
163
+ <xsl:call-template name="insertBackgroundPageImage"/>
164
+ </xsl:when>
165
+ <xsl:otherwise>
166
+
167
+ <fo:block-container position="absolute" left="14.25mm" top="12mm" id="__internal_layout__coverpage_{generate-id()}">
168
+ <fo:table table-layout="fixed" width="181.1mm">
169
+ <fo:table-column column-width="26mm"/>
170
+ <fo:table-column column-width="19.4mm"/>
171
+ <fo:table-column column-width="135.7mm"/>
172
+ <fo:table-body>
173
+ <fo:table-row>
174
+ <fo:table-cell><fo:block> </fo:block></fo:table-cell>
175
+ <fo:table-cell>
176
+ <fo:block-container width="19.4mm" height="21mm" background-color="rgb(241, 234, 202)" border-bottom="0.05pt solid rgb(0, 21, 50)" text-align="center" display-align="center" font-size="10pt" font-weight="bold">
177
+ <xsl:if test="$isCoverPageImage = 'true'">
178
+ <xsl:attribute name="width">42.5mm</xsl:attribute>
179
+ </xsl:if>
180
+ <fo:block>
181
+ <xsl:value-of select="$docidentifier"/>
182
+ <xsl:if test="$isCoverPageImage = 'true'">
183
+ <xsl:text> </xsl:text><xsl:value-of select="$edition"/>
193
184
  </xsl:if>
194
185
  </fo:block>
195
186
  </fo:block-container>
196
- </fo:block-container>
197
- </fo:block-container>
198
- </fo:table-cell>
199
- </fo:table-row>
200
- <fo:table-row>
201
- <fo:table-cell>
202
- <fo:block font-size="1">
203
- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Logo-IHO))}" width="25.9mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Logo IHO"/>
204
- </fo:block>
205
- </fo:table-cell>
206
- <fo:table-cell>
207
- <fo:block font-size="1">
208
- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Text-IHO))}" width="25.8mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Text IHO"/>
209
- </fo:block>
210
- </fo:table-cell>
211
- <fo:table-cell>
212
- <fo:block-container width="79mm" height="72mm" margin-left="56.8mm" background-color="rgb(0, 172, 158)" text-align="right" display-align="after">
213
- <fo:block-container margin-left="0mm">
214
- <fo:block font-size="8pt" color="white" margin-right="5mm" margin-bottom="5mm" line-height-shift-adjustment="disregard-shifts">
215
- <xsl:apply-templates select="/iho:metanorma/iho:boilerplate/iho:feedback-statement"/>
187
+ </fo:table-cell>
188
+ <fo:table-cell><fo:block> </fo:block></fo:table-cell>
189
+ </fo:table-row>
190
+ <fo:table-row>
191
+ <fo:table-cell display-align="after" text-align="right">
192
+ <fo:block font-size="1">
193
+ <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-IHO))}" width="25.9mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image IHO"/>
216
194
  </fo:block>
217
- </fo:block-container>
218
- </fo:block-container>
219
- </fo:table-cell>
220
- </fo:table-row>
221
- </fo:table-body>
222
- </fo:table>
223
- </fo:block-container>
195
+ </fo:table-cell>
196
+
197
+ <!-- https://github.com/metanorma/metanorma-iho/issues/288 -->
198
+ <xsl:choose>
199
+ <xsl:when test="$isCoverPageImage = 'true'">
200
+ <fo:table-cell number-columns-spanned="2">
201
+ <fo:block-container font-size="0"> <!-- height="168mm" width="115mm" -->
202
+ <fo:block>
203
+ <xsl:for-each select="/*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'coverpage-image'][1]/*[local-name() = 'value']/*[local-name() = 'image'][1]">
204
+ <xsl:choose>
205
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
206
+ <fo:instream-foreign-object fox:alt-text="Image Front">
207
+ <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
208
+ <xsl:call-template name="getSVG"/>
209
+ </fo:instream-foreign-object>
210
+ </xsl:when>
211
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
212
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
213
+ </xsl:when>
214
+ <xsl:otherwise> <!-- bitmap image -->
215
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
216
+ <xsl:if test="$coverimage_src != ''">
217
+ <xsl:variable name="coverpage">
218
+ <xsl:call-template name="getImageURL">
219
+ <xsl:with-param name="src" select="$coverimage_src"/>
220
+ </xsl:call-template>
221
+ </xsl:variable>
222
+ <fo:external-graphic src="{$coverpage}" width="155.5mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
223
+ </xsl:if>
224
+ </xsl:otherwise>
225
+ </xsl:choose>
226
+ </xsl:for-each>
227
+ </fo:block>
228
+ </fo:block-container>
229
+ </fo:table-cell>
230
+ </xsl:when>
231
+ <xsl:otherwise>
232
+ <fo:table-cell number-columns-spanned="2" border="0.5pt solid rgb(0, 21, 50)" font-weight="bold" color="rgb(0, 0, 76)" padding-top="3mm">
233
+ <fo:block-container height="165mm" width="115mm">
234
+ <fo:block-container margin-left="10mm">
235
+ <fo:block-container margin-left="0mm">
236
+ <fo:block-container display-align="center" height="90mm">
237
+ <fo:block font-size="28pt" role="H1" line-height="115%">
238
+ <xsl:copy-of select="$title-en"/>
239
+ </fo:block>
240
+ </fo:block-container>
241
+ <fo:block font-size="14pt">
242
+ <xsl:value-of select="$edition"/>
243
+ <xsl:if test="normalize-space($month_year) != ''">
244
+ <xsl:text> – </xsl:text>
245
+ <xsl:value-of select="$month_year"/>
246
+ </xsl:if>
247
+ </fo:block>
248
+ </fo:block-container>
249
+ </fo:block-container>
250
+ </fo:block-container>
251
+ </fo:table-cell>
252
+ </xsl:otherwise>
253
+ </xsl:choose>
254
+ </fo:table-row>
255
+ <fo:table-row>
256
+ <fo:table-cell>
257
+ <fo:block font-size="1">
258
+ <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Logo-IHO))}" width="25.9mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Logo IHO"/>
259
+ </fo:block>
260
+ </fo:table-cell>
261
+ <fo:table-cell>
262
+ <fo:block font-size="1">
263
+ <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Text-IHO))}" width="25.8mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Text IHO"/>
264
+ </fo:block>
265
+ </fo:table-cell>
266
+ <fo:table-cell>
267
+ <fo:block-container width="79mm" height="72mm" margin-left="56.8mm" background-color="rgb(0, 172, 158)" text-align="right" display-align="after">
268
+ <fo:block-container margin-left="0mm">
269
+ <fo:block font-size="8pt" color="white" margin-right="5mm" margin-bottom="5mm" line-height-shift-adjustment="disregard-shifts">
270
+ <xsl:apply-templates select="/iho:metanorma/iho:boilerplate/iho:feedback-statement"/>
271
+ </fo:block>
272
+ </fo:block-container>
273
+ </fo:block-container>
274
+ </fo:table-cell>
275
+ </fo:table-row>
276
+ </fo:table-body>
277
+ </fo:table>
278
+ </fo:block-container>
279
+ </xsl:otherwise>
280
+ </xsl:choose>
224
281
  </fo:flow>
225
282
  </fo:page-sequence>
226
283
  <!-- End Cover Page -->
@@ -1661,6 +1718,7 @@
1661
1718
  </xsl:template> <!-- refine_table-style -->
1662
1719
 
1663
1720
  <xsl:attribute-set name="table-name-style">
1721
+ <xsl:attribute name="role">Caption</xsl:attribute>
1664
1722
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1665
1723
 
1666
1724
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1672,6 +1730,9 @@
1672
1730
 
1673
1731
  <xsl:template name="refine_table-name-style">
1674
1732
  <xsl:param name="continued"/>
1733
+ <xsl:if test="$continued = 'true'">
1734
+ <xsl:attribute name="role">SKIP</xsl:attribute>
1735
+ </xsl:if>
1675
1736
 
1676
1737
  </xsl:template> <!-- refine_table-name-style -->
1677
1738
 
@@ -3448,7 +3509,7 @@
3448
3509
  </xsl:if>
3449
3510
 
3450
3511
  </fo:block-container>
3451
- </xsl:variable>
3512
+ </xsl:variable> <!-- END: variable name="table" -->
3452
3513
 
3453
3514
  <xsl:variable name="isAdded" select="@added"/>
3454
3515
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -3458,14 +3519,14 @@
3458
3519
 
3459
3520
  <!-- centered table when table name is centered (see table-name-style) -->
3460
3521
 
3461
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
3522
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
3462
3523
 
3463
3524
  <fo:table-column column-width="proportional-column-width(1)"/>
3464
3525
  <fo:table-column column-width="{@width}"/>
3465
3526
  <fo:table-column column-width="proportional-column-width(1)"/>
3466
- <fo:table-body>
3467
- <fo:table-row>
3468
- <fo:table-cell column-number="2">
3527
+ <fo:table-body role="SKIP">
3528
+ <fo:table-row role="SKIP">
3529
+ <fo:table-cell column-number="2" role="SKIP">
3469
3530
  <xsl:copy-of select="$table-preamble"/>
3470
3531
  <fo:block role="SKIP">
3471
3532
  <xsl:call-template name="setTrackChangesStyles">
@@ -3506,11 +3567,12 @@
3506
3567
 
3507
3568
  </xsl:template>
3508
3569
 
3570
+ <!-- table/name-->
3509
3571
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3510
3572
  <xsl:param name="continued"/>
3511
3573
  <xsl:if test="normalize-space() != ''">
3512
3574
 
3513
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
3575
+ <fo:block xsl:use-attribute-sets="table-name-style">
3514
3576
 
3515
3577
  <xsl:call-template name="refine_table-name-style">
3516
3578
  <xsl:with-param name="continued" select="$continued"/>
@@ -3987,7 +4049,7 @@
3987
4049
 
3988
4050
  <xsl:variable name="tableWithNotesAndFootnotes">
3989
4051
 
3990
- <fo:table keep-with-previous="always">
4052
+ <fo:table keep-with-previous="always" role="SKIP">
3991
4053
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
3992
4054
  <xsl:variable name="name" select="local-name()"/>
3993
4055
  <xsl:choose>
@@ -4018,9 +4080,9 @@
4018
4080
  </xsl:otherwise>
4019
4081
  </xsl:choose>
4020
4082
 
4021
- <fo:table-body>
4022
- <fo:table-row>
4023
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
4083
+ <fo:table-body role="SKIP">
4084
+ <fo:table-row role="SKIP">
4085
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
4024
4086
 
4025
4087
  <xsl:call-template name="refine_table-footer-cell-style"/>
4026
4088
 
@@ -4224,6 +4286,8 @@
4224
4286
 
4225
4287
  <xsl:template name="setTableRowAttributes">
4226
4288
 
4289
+ <xsl:call-template name="setColors"/>
4290
+
4227
4291
  </xsl:template> <!-- setTableRowAttributes -->
4228
4292
  <!-- ===================== -->
4229
4293
  <!-- END Table's row processing -->
@@ -4275,6 +4339,7 @@
4275
4339
  </xsl:attribute>
4276
4340
  </xsl:if>
4277
4341
  <xsl:call-template name="display-align"/>
4342
+ <xsl:call-template name="setColors"/>
4278
4343
  </xsl:template>
4279
4344
 
4280
4345
  <xsl:template name="display-align">
@@ -4290,6 +4355,29 @@
4290
4355
  </xsl:if>
4291
4356
  </xsl:template>
4292
4357
 
4358
+ <xsl:template name="setColors">
4359
+ <xsl:variable name="styles__">
4360
+ <xsl:call-template name="split">
4361
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
4362
+ <xsl:with-param name="sep" select="';'"/>
4363
+ </xsl:call-template>
4364
+ </xsl:variable>
4365
+ <xsl:variable name="quot">"</xsl:variable>
4366
+ <xsl:variable name="styles_">
4367
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
4368
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
4369
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
4370
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
4371
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
4372
+ </xsl:if>
4373
+ </xsl:for-each>
4374
+ </xsl:variable>
4375
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
4376
+ <xsl:for-each select="$styles/style">
4377
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4378
+ </xsl:for-each>
4379
+ </xsl:template>
4380
+
4293
4381
  <!-- cell in table body, footer -->
4294
4382
  <xsl:template match="*[local-name()='td']" name="td">
4295
4383
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -4301,12 +4389,12 @@
4301
4389
 
4302
4390
  <xsl:call-template name="refine_table-cell-style"/>
4303
4391
 
4392
+ <xsl:call-template name="setTableCellAttributes"/>
4393
+
4304
4394
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4305
4395
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4306
4396
  </xsl:if>
4307
4397
 
4308
- <xsl:call-template name="setTableCellAttributes"/>
4309
-
4310
4398
  <xsl:if test="$isGenerateTableIF = 'true'">
4311
4399
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4312
4400
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -4391,6 +4479,7 @@
4391
4479
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4392
4480
  <!-- fn in text -->
4393
4481
  <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">
4482
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
4394
4483
 
4395
4484
  <!-- list of unique footnotes -->
4396
4485
  <xsl:variable name="p_fn_">
@@ -4456,7 +4545,7 @@
4456
4545
  <xsl:copy-of select="$footnote_inline"/>
4457
4546
  </xsl:when>
4458
4547
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4459
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4548
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
4460
4549
 
4461
4550
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4462
4551
  <xsl:copy-of select="$footnote_inline"/>
@@ -4865,39 +4954,51 @@
4865
4954
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4866
4955
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4867
4956
  <xsl:template match="*[local-name()='fn']">
4868
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
4869
-
4870
- <xsl:call-template name="refine_fn-reference-style"/>
4957
+ <xsl:variable name="target" select="@target"/>
4958
+ <xsl:choose>
4959
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
4960
+ <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]">
4961
+ <xsl:call-template name="fn">
4962
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
4963
+ </xsl:call-template>
4964
+ </xsl:when>
4965
+ <xsl:otherwise>
4871
4966
 
4872
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4873
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4874
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4875
- <!-- <xsl:attribute name="internal-destination">
4876
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4877
- </xsl:attribute>
4878
- </xsl:if>
4879
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4880
- <xsl:attribute name="internal-destination">
4881
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4882
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4883
- </xsl:attribute>
4884
- </xsl:if> -->
4885
- <!-- <xsl:if test="$namespace = 'plateau'">
4886
- <xsl:text>※</xsl:text>
4887
- </xsl:if> -->
4888
- <!-- <xsl:value-of select="@reference"/> -->
4967
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
4889
4968
 
4890
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4969
+ <xsl:call-template name="refine_fn-reference-style"/>
4891
4970
 
4892
- <!-- <xsl:if test="$namespace = 'bsi'">
4893
- <xsl:text>)</xsl:text>
4894
- </xsl:if> -->
4895
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4896
- <!-- <xsl:if test="$namespace = 'jis'">
4897
- <fo:inline font-weight="normal">)</fo:inline>
4898
- </xsl:if> -->
4899
- </fo:basic-link>
4900
- </fo:inline>
4971
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4972
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4973
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4974
+ <!-- <xsl:attribute name="internal-destination">
4975
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4976
+ </xsl:attribute>
4977
+ </xsl:if>
4978
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4979
+ <xsl:attribute name="internal-destination">
4980
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4981
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4982
+ </xsl:attribute>
4983
+ </xsl:if> -->
4984
+ <!-- <xsl:if test="$namespace = 'plateau'">
4985
+ <xsl:text>※</xsl:text>
4986
+ </xsl:if> -->
4987
+ <!-- <xsl:value-of select="@reference"/> -->
4988
+
4989
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4990
+
4991
+ <!-- <xsl:if test="$namespace = 'bsi'">
4992
+ <xsl:text>)</xsl:text>
4993
+ </xsl:if> -->
4994
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4995
+ <!-- <xsl:if test="$namespace = 'jis'">
4996
+ <fo:inline font-weight="normal">)</fo:inline>
4997
+ </xsl:if> -->
4998
+ </fo:basic-link>
4999
+ </fo:inline>
5000
+ </xsl:otherwise>
5001
+ </xsl:choose>
4901
5002
  </xsl:template> <!-- fn -->
4902
5003
 
4903
5004
  <!-- fn/text() -->
@@ -6166,7 +6267,7 @@
6166
6267
  <xsl:choose>
6167
6268
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
6168
6269
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
6169
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
6270
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
6170
6271
  </xsl:when>
6171
6272
  <xsl:otherwise>
6172
6273
  <xsl:apply-templates/>
@@ -6174,7 +6275,7 @@
6174
6275
  </xsl:choose>
6175
6276
  </xsl:template>
6176
6277
  <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">
6177
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6278
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
6178
6279
  </xsl:template>
6179
6280
 
6180
6281
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -7214,24 +7315,26 @@
7214
7315
  <xsl:apply-templates select="." mode="mathml"/>
7215
7316
  </xsl:variable>
7216
7317
 
7217
- <fo:instream-foreign-object fox:alt-text="Math">
7318
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
7218
7319
 
7219
7320
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
7220
7321
 
7221
- <!-- put MathML in Actual Text -->
7222
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7223
- <xsl:attribute name="fox:actual-text">
7224
- <xsl:value-of select="$mathml_content"/>
7225
- </xsl:attribute>
7226
-
7227
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7228
- <xsl:if test="normalize-space($asciimath_text_) != ''">
7229
- <!-- put Mathin Alternate Text -->
7230
- <xsl:attribute name="fox:alt-text">
7231
- <xsl:value-of select="$asciimath_text_"/>
7322
+ <xsl:if test="$isGenerateTableIF = 'false'">
7323
+ <!-- put MathML in Actual Text -->
7324
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7325
+ <xsl:attribute name="fox:actual-text">
7326
+ <xsl:value-of select="$mathml_content"/>
7232
7327
  </xsl:attribute>
7328
+
7329
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7330
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
7331
+ <!-- put Mathin Alternate Text -->
7332
+ <xsl:attribute name="fox:alt-text">
7333
+ <xsl:value-of select="$asciimath_text_"/>
7334
+ </xsl:attribute>
7335
+ </xsl:if>
7336
+ <!-- </xsl:if> -->
7233
7337
  </xsl:if>
7234
- <!-- </xsl:if> -->
7235
7338
 
7236
7339
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
7237
7340
 
@@ -8967,6 +9070,13 @@
8967
9070
  <xsl:apply-templates select="."/>
8968
9071
  </xsl:template>
8969
9072
 
9073
+ <!-- prevent missing stem for table and figures in ToC -->
9074
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
9075
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
9076
+ <xsl:apply-templates select="."/>
9077
+ </xsl:if>
9078
+ </xsl:template>
9079
+
8970
9080
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
8971
9081
 
8972
9082
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -8987,6 +9097,8 @@
8987
9097
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
8988
9098
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
8989
9099
 
9100
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
9101
+
8990
9102
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
8991
9103
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
8992
9104
  <xsl:apply-templates mode="bookmarks"/>
@@ -9008,6 +9120,8 @@
9008
9120
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
9009
9121
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
9010
9122
 
9123
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
9124
+
9011
9125
  <!-- Bookmarks -->
9012
9126
  <xsl:template name="addBookmarks">
9013
9127
  <xsl:param name="contents"/>
@@ -9186,7 +9300,8 @@
9186
9300
 
9187
9301
  <xsl:for-each select="$contents_nodes//tables/table">
9188
9302
  <fo:bookmark internal-destination="{@id}">
9189
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
9303
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
9304
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
9190
9305
  </fo:bookmark>
9191
9306
  </xsl:for-each>
9192
9307
  </fo:bookmark>
@@ -9195,6 +9310,26 @@
9195
9310
  </xsl:template> <!-- insertTableBookmarks -->
9196
9311
  <!-- End Bookmarks -->
9197
9312
 
9313
+ <!-- ============================ -->
9314
+ <!-- mode="bookmark_clean" -->
9315
+ <!-- ============================ -->
9316
+ <xsl:template match="node()" mode="bookmark_clean">
9317
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
9318
+ </xsl:template>
9319
+
9320
+ <xsl:template match="text()" mode="bookmark_clean">
9321
+ <xsl:value-of select="."/>
9322
+ </xsl:template>
9323
+
9324
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
9325
+ <xsl:value-of select="normalize-space(.)"/>
9326
+ </xsl:template>
9327
+
9328
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
9329
+ <!-- ============================ -->
9330
+ <!-- END: mode="bookmark_clean" -->
9331
+ <!-- ============================ -->
9332
+
9198
9333
  <xsl:template name="getLangVersion">
9199
9334
  <xsl:param name="lang"/>
9200
9335
  <xsl:param name="doctype" select="''"/>
@@ -10886,21 +11021,32 @@
10886
11021
  <!-- ========== -->
10887
11022
 
10888
11023
  <xsl:variable name="reviews_">
10889
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
11024
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
10890
11025
  <xsl:copy>
10891
11026
  <xsl:copy-of select="@from"/>
10892
11027
  <xsl:copy-of select="@id"/>
10893
11028
  </xsl:copy>
10894
11029
  </xsl:for-each>
11030
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
11031
+ <xsl:copy>
11032
+ <xsl:copy-of select="@source"/>
11033
+ <xsl:copy-of select="@id"/>
11034
+ </xsl:copy>
11035
+ </xsl:for-each>
10895
11036
  </xsl:variable>
10896
11037
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
10897
11038
 
10898
11039
  <xsl:template name="addReviewHelper">
10899
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10900
- <xsl:variable name="curr_id" select="@id"/>
10901
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
10902
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10903
- <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>
11040
+ <xsl:if test="$isGenerateTableIF = 'false'">
11041
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11042
+ <xsl:variable name="curr_id" select="@id"/>
11043
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
11044
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
11045
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
11046
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11047
+ <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>
11048
+ </xsl:if>
11049
+ </xsl:for-each>
10904
11050
  </xsl:if>
10905
11051
  <!-- <fo:block>
10906
11052
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -11037,14 +11183,61 @@
11037
11183
 
11038
11184
  </xsl:template>
11039
11185
 
11040
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11186
+ <!-- document text (not figures, or tables) footnotes -->
11187
+ <xsl:variable name="reviews_container_">
11188
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
11189
+ <xsl:variable name="update_xml_step1">
11190
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
11191
+ </xsl:variable>
11192
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
11193
+ </xsl:for-each>
11194
+ </xsl:variable>
11195
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
11196
+
11197
+ <xsl:template match="*[local-name() = 'review-container']"/>
11198
+
11199
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
11200
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11201
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11202
+ <xsl:if test="$isGenerateTableIF = 'false'">
11203
+ <xsl:choose>
11204
+ <!-- if there isn't the attribute '@from', then -->
11205
+ <xsl:when test="$id_from = ''">
11206
+ <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>
11207
+ </xsl:when>
11208
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11209
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
11210
+ <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>
11211
+ </xsl:when>
11212
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11213
+ <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>
11214
+ </xsl:when>
11215
+ </xsl:choose>
11216
+ </xsl:if>
11217
+ </xsl:template>
11218
+
11219
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
11220
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11041
11221
  <!-- comment 2019-11-29 -->
11042
11222
  <!-- <fo:block font-weight="bold">Review:</fo:block>
11043
11223
  <xsl:apply-templates /> -->
11044
11224
 
11045
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11225
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
11046
11226
 
11047
- <xsl:if test="1 = 1">
11227
+ <xsl:variable name="source" select="normalize-space(@source)"/>
11228
+
11229
+ <xsl:if test="$isGenerateTableIF = 'false'">
11230
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
11231
+
11232
+ <!-- <xsl:if test="@source = @end"> -->
11233
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
11234
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
11235
+ <!-- <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> -->
11236
+ <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>
11237
+ <!-- </xsl:if> -->
11238
+ </xsl:if>
11239
+
11240
+ <xsl:if test="1 = 2">
11048
11241
  <xsl:choose>
11049
11242
  <!-- if there isn't the attribute '@from', then -->
11050
11243
  <xsl:when test="$id_from = ''">
@@ -11052,10 +11245,10 @@
11052
11245
  </xsl:when>
11053
11246
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11054
11247
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
11055
- <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>
11248
+ <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>
11056
11249
  </xsl:when>
11057
11250
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11058
- <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>
11251
+ <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>
11059
11252
  </xsl:when>
11060
11253
  </xsl:choose>
11061
11254
  </xsl:if>
@@ -11107,16 +11300,21 @@
11107
11300
  <xsl:variable name="list_level">
11108
11301
  <xsl:choose>
11109
11302
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
11110
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
11303
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
11304
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
11305
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
11111
11306
  </xsl:choose>
11112
11307
  </xsl:variable>
11113
11308
  <xsl:choose>
11114
11309
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
11115
11310
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
11116
11311
  </xsl:when>
11117
- <xsl:when test="$list_level mod 3 = 0">
11312
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
11118
11313
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
11119
11314
  </xsl:when>
11315
+ <xsl:when test="$list_level mod 3 = 0">
11316
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
11317
+ </xsl:when>
11120
11318
  <xsl:when test="$list_level mod 2 = 0">
11121
11319
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
11122
11320
  </xsl:when>
@@ -11137,9 +11335,15 @@
11137
11335
  <xsl:when test="local-name(..) = 'ul'">
11138
11336
  <xsl:choose>
11139
11337
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
11338
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
11339
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
11140
11340
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
11141
11341
  </xsl:choose>
11142
11342
  </xsl:when>
11343
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
11344
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
11345
+ <xsl:value-of select="@label"/>
11346
+ </xsl:when>
11143
11347
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11144
11348
 
11145
11349
  <xsl:variable name="type" select="../@type"/>
@@ -11264,7 +11468,7 @@
11264
11468
 
11265
11469
  </xsl:otherwise>
11266
11470
  </xsl:choose>
11267
- </xsl:template>
11471
+ </xsl:template> <!-- getListItemFormat -->
11268
11472
 
11269
11473
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
11270
11474
  <xsl:param name="indent">0</xsl:param>
@@ -11396,6 +11600,11 @@
11396
11600
 
11397
11601
  <xsl:call-template name="refine_list-item-label-style"/>
11398
11602
 
11603
+ <xsl:if test="local-name(..) = 'ul'">
11604
+ <xsl:variable name="li_label" select="@label"/>
11605
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
11606
+ </xsl:if>
11607
+
11399
11608
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
11400
11609
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
11401
11610
  <xsl:call-template name="append_add-style"/>
@@ -11659,10 +11868,22 @@
11659
11868
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
11660
11869
 
11661
11870
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
11662
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11663
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
11664
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11665
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11871
+ <xsl:variable name="bookmark_id" select="@id"/>
11872
+ <xsl:choose>
11873
+ <!-- Example:
11874
+ <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"/>
11875
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
11876
+ <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"/> -->
11877
+ <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]">
11878
+ <!-- skip here, see the template 'fmt-review-start' -->
11879
+ </xsl:when>
11880
+ <xsl:otherwise>
11881
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11882
+ <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>
11883
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11884
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11885
+ </xsl:otherwise>
11886
+ </xsl:choose>
11666
11887
  </xsl:template>
11667
11888
  <!-- =================== -->
11668
11889
  <!-- End of Index processing -->
@@ -12783,6 +13004,16 @@
12783
13004
  </xsl:choose>
12784
13005
  </xsl:template>
12785
13006
 
13007
+ <!-- li/fmt-name -->
13008
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
13009
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
13010
+ <xsl:attribute name="full">true</xsl:attribute>
13011
+ </xsl:template>
13012
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
13013
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
13014
+ <xsl:attribute name="full">true</xsl:attribute>
13015
+ </xsl:template>
13016
+
12786
13017
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
12787
13018
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
12788
13019
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13012,6 +13243,9 @@
13012
13243
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
13013
13244
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
13014
13245
 
13246
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
13247
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
13248
+
13015
13249
  <!-- END: update new Presentation XML -->
13016
13250
 
13017
13251
  <!-- =========================================================================== -->
@@ -13594,6 +13828,64 @@
13594
13828
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
13595
13829
  </xsl:template>
13596
13830
 
13831
+ <!-- ===================================== -->
13832
+ <!-- ===================================== -->
13833
+ <!-- Ruby text (CJK languages) rendering -->
13834
+ <!-- ===================================== -->
13835
+ <!-- ===================================== -->
13836
+ <xsl:template match="*[local-name() = 'ruby']">
13837
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
13838
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
13839
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
13840
+ </xsl:if>
13841
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
13842
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
13843
+ <!-- Example: width="2em" -->
13844
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
13845
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
13846
+ <xsl:variable name="text_width">
13847
+ <xsl:choose>
13848
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
13849
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
13850
+ </xsl:choose>
13851
+ </xsl:variable>
13852
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
13853
+
13854
+ <xsl:choose>
13855
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
13856
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
13857
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
13858
+ </xsl:when>
13859
+ <xsl:otherwise>
13860
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
13861
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
13862
+ </xsl:otherwise>
13863
+ </xsl:choose>
13864
+
13865
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
13866
+ </fo:inline-container>
13867
+ </xsl:template>
13868
+
13869
+ <xsl:template match="*[local-name() = 'rb']">
13870
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
13871
+ </xsl:template>
13872
+
13873
+ <xsl:template match="*[local-name() = 'rt']">
13874
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
13875
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
13876
+ <xsl:attribute name="space-before">0em</xsl:attribute>
13877
+ </xsl:if>
13878
+ <xsl:apply-templates/>
13879
+ </fo:block>
13880
+
13881
+ </xsl:template>
13882
+
13883
+ <!-- ===================================== -->
13884
+ <!-- ===================================== -->
13885
+ <!-- END: Ruby text (CJK languages) rendering -->
13886
+ <!-- ===================================== -->
13887
+ <!-- ===================================== -->
13888
+
13597
13889
  <xsl:template name="printEdition">
13598
13890
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
13599
13891