metanorma-iho 1.1.3 → 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
 
@@ -4417,6 +4479,7 @@
4417
4479
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4418
4480
  <!-- fn in text -->
4419
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>
4420
4483
 
4421
4484
  <!-- list of unique footnotes -->
4422
4485
  <xsl:variable name="p_fn_">
@@ -4482,7 +4545,7 @@
4482
4545
  <xsl:copy-of select="$footnote_inline"/>
4483
4546
  </xsl:when>
4484
4547
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4485
- <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'">
4486
4549
 
4487
4550
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4488
4551
  <xsl:copy-of select="$footnote_inline"/>
@@ -4891,39 +4954,51 @@
4891
4954
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4892
4955
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4893
4956
  <xsl:template match="*[local-name()='fn']">
4894
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
4895
-
4896
- <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>
4897
4966
 
4898
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4899
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4900
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4901
- <!-- <xsl:attribute name="internal-destination">
4902
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4903
- </xsl:attribute>
4904
- </xsl:if>
4905
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4906
- <xsl:attribute name="internal-destination">
4907
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4908
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4909
- </xsl:attribute>
4910
- </xsl:if> -->
4911
- <!-- <xsl:if test="$namespace = 'plateau'">
4912
- <xsl:text>※</xsl:text>
4913
- </xsl:if> -->
4914
- <!-- <xsl:value-of select="@reference"/> -->
4967
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
4915
4968
 
4916
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4969
+ <xsl:call-template name="refine_fn-reference-style"/>
4917
4970
 
4918
- <!-- <xsl:if test="$namespace = 'bsi'">
4919
- <xsl:text>)</xsl:text>
4920
- </xsl:if> -->
4921
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4922
- <!-- <xsl:if test="$namespace = 'jis'">
4923
- <fo:inline font-weight="normal">)</fo:inline>
4924
- </xsl:if> -->
4925
- </fo:basic-link>
4926
- </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>
4927
5002
  </xsl:template> <!-- fn -->
4928
5003
 
4929
5004
  <!-- fn/text() -->
@@ -8995,6 +9070,13 @@
8995
9070
  <xsl:apply-templates select="."/>
8996
9071
  </xsl:template>
8997
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
+
8998
9080
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
8999
9081
 
9000
9082
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -9218,7 +9300,8 @@
9218
9300
 
9219
9301
  <xsl:for-each select="$contents_nodes//tables/table">
9220
9302
  <fo:bookmark internal-destination="{@id}">
9221
- <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>
9222
9305
  </fo:bookmark>
9223
9306
  </xsl:for-each>
9224
9307
  </fo:bookmark>
@@ -9227,6 +9310,26 @@
9227
9310
  </xsl:template> <!-- insertTableBookmarks -->
9228
9311
  <!-- End Bookmarks -->
9229
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
+
9230
9333
  <xsl:template name="getLangVersion">
9231
9334
  <xsl:param name="lang"/>
9232
9335
  <xsl:param name="doctype" select="''"/>
@@ -11232,9 +11335,15 @@
11232
11335
  <xsl:when test="local-name(..) = 'ul'">
11233
11336
  <xsl:choose>
11234
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>
11235
11340
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
11236
11341
  </xsl:choose>
11237
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>
11238
11347
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11239
11348
 
11240
11349
  <xsl:variable name="type" select="../@type"/>
@@ -11359,7 +11468,7 @@
11359
11468
 
11360
11469
  </xsl:otherwise>
11361
11470
  </xsl:choose>
11362
- </xsl:template>
11471
+ </xsl:template> <!-- getListItemFormat -->
11363
11472
 
11364
11473
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
11365
11474
  <xsl:param name="indent">0</xsl:param>
@@ -11491,6 +11600,11 @@
11491
11600
 
11492
11601
  <xsl:call-template name="refine_list-item-label-style"/>
11493
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
+
11494
11608
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
11495
11609
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
11496
11610
  <xsl:call-template name="append_add-style"/>
@@ -12890,6 +13004,16 @@
12890
13004
  </xsl:choose>
12891
13005
  </xsl:template>
12892
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
+
12893
13017
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
12894
13018
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
12895
13019
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13704,6 +13828,64 @@
13704
13828
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
13705
13829
  </xsl:template>
13706
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
+
13707
13889
  <xsl:template name="printEdition">
13708
13890
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
13709
13891
 
@@ -124,18 +124,6 @@ _bib)
124
124
 
125
125
  def term1(elem); end
126
126
 
127
- # KILL
128
- def termsource1(elem)
129
- elem.parent.nil? and return
130
- while elem&.next_element&.name == "termsource"
131
- elem << "; #{to_xml(elem.next_element.remove.children)}"
132
- end
133
- t = elem.at("./ancestor::xmlns:term") or return
134
- s = l10n(" [#{to_xml(elem.remove.children).strip}]")
135
- defn = t.at(ns(".//definition[last()]")) or return
136
- defn.elements.last << s
137
- end
138
-
139
127
  def termsource1(elem)
140
128
  elem.parent.nil? and return
141
129
  super
@@ -143,8 +131,8 @@ _bib)
143
131
 
144
132
  def termsource_label(elem, sources)
145
133
  elem.at("./ancestor::xmlns:term") or return
146
- elem.replace(l10n("[#{sources}]"))
147
- end
134
+ elem.replace(l10n("[#{sources}]"))
135
+ end
148
136
 
149
137
  def termcleanup(docxml)
150
138
  collapse_term docxml
@@ -162,14 +150,20 @@ _bib)
162
150
  source.remove
163
151
  end
164
152
 
165
- def clausedelim
153
+ def clausedelim
166
154
  ""
167
155
  end
168
156
 
169
- def clause(docxml)
170
- super
171
- docxml.xpath(ns("//executivesummary | //appendix")).each { |x| clause1(x) }
172
- end
157
+ def clause(docxml)
158
+ super
159
+ docxml.xpath(ns("//executivesummary | //appendix")).each do |x|
160
+ clause1(x)
161
+ end
162
+ end
163
+
164
+ def ul_label_list(_elem)
165
+ %w(&#x2022; &#x2014; &#x6f;)
166
+ end
173
167
 
174
168
  include Init
175
169
  end
@@ -1701,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
1701
1701
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
1702
1702
  The target of a footnote is the location it is embedded in within the text</a:documentation>
1703
1703
  <element name="fn">
1704
- <attribute name="reference">
1705
- <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1706
- </attribute>
1707
- <oneOrMore>
1708
- <ref name="paragraph">
1709
- <a:documentation>The content of the footnote</a:documentation>
1710
- </ref>
1711
- </oneOrMore>
1704
+ <ref name="FnAttributes"/>
1705
+ <ref name="FnBody"/>
1712
1706
  </element>
1713
1707
  </define>
1708
+ <define name="FnBody">
1709
+ <oneOrMore>
1710
+ <ref name="paragraph">
1711
+ <a:documentation>The content of the footnote</a:documentation>
1712
+ </ref>
1713
+ </oneOrMore>
1714
+ </define>
1715
+ <define name="FnAttributes">
1716
+ <attribute name="reference">
1717
+ <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1718
+ </attribute>
1719
+ </define>
1714
1720
  <define name="callout">
1715
1721
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
1716
1722
  <element name="callout">