metanorma-ribose 2.8.3 → 2.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa900719fa5ce68ae05ad7681eca4ef1c45677fd675dcaf1e8977de6c5d25701
4
- data.tar.gz: 566f33f03a3de079dae0b6f588553e9c2907d354349d647527836991017acb0a
3
+ metadata.gz: 1fbb992ae5d88dfa4d3ed56cae3b26408ceb0f6288649c8740445c6f7dd29fdf
4
+ data.tar.gz: 19c3be3471553ea2f5bbea70cff4fec4a4c7dab94d7cc18c85eb05bbb4d2e3e6
5
5
  SHA512:
6
- metadata.gz: bc70150e86130da1443f8b255cf1cbe8e9758502510b756e58693fbaf6e684daf3fc74987faf20746b29d579f5f38d54cff89de68f2072ae73a607f10f454013
7
- data.tar.gz: bc7daaacf3b65fcf6b153e1000ae3509b0132896586b7dd1b10069e203520d185d52e95460bbfe8f36009a436e2b4abbdd43a382c2eec0ae083daf355fc72b00
6
+ metadata.gz: ca3e11d854bb66ace28dd9cb23f9a933c3e3350beb52089ffc63573f1cb171cb242a22f84cbf202165cab349317c23f5132c4710bfe950bf5d70528430294d4c
7
+ data.tar.gz: 855702214afe869ab329b72d3105bb2c6db91e7819f01bf85629c7dbf7533e6fd5e9b1206f6d3631e39d4ce19d06fc0ea42637d9731f1b151919c6b89b96ec28
@@ -4,54 +4,67 @@
4
4
 
5
5
  <xsl:key name="kfn" match="mn:fn[not(ancestor::*[self::mn:table or self::mn:figure or self::mn:localized-strings] and not(ancestor::mn:fmt-name))]" use="@reference"/>
6
6
 
7
+ <xsl:key name="kid" match="*" use="@id"/>
8
+
7
9
  <xsl:variable name="debug">false</xsl:variable>
8
10
 
9
11
  <xsl:variable name="color_blue">rgb(22, 97, 173)</xsl:variable>
10
12
 
11
- <xsl:variable name="copyright_year" select="/mn:metanorma/mn:bibdata/mn:copyright/mn:from"/>
13
+ <xsl:variable name="variables_">
14
+ <xsl:for-each select="//mn:metanorma">
15
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
12
16
 
13
- <xsl:variable name="copyright">
14
- <xsl:text>© </xsl:text>
15
- <xsl:value-of select="$copyright_year"/>
16
- <xsl:text> </xsl:text>
17
- <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:copyright/mn:owner/mn:organization/mn:name"/>
17
+ <xsl:variable name="current_document">
18
+ <xsl:copy-of select="."/>
19
+ </xsl:variable>
20
+
21
+ <xsl:for-each select="xalan:nodeset($current_document)">
22
+ <mnx:doc num="{$num}">
23
+ <xsl:variable name="copyright_year" select="/mn:metanorma/mn:bibdata/mn:copyright/mn:from"/>
24
+ <xsl:variable name="copyright">
25
+ <xsl:text>© </xsl:text>
26
+ <xsl:value-of select="$copyright_year"/>
27
+ <xsl:text> </xsl:text>
28
+ <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:copyright/mn:owner/mn:organization/mn:name"/>
29
+ </xsl:variable>
30
+ <copyright><xsl:value-of select="$copyright"/></copyright>
31
+ </mnx:doc>
32
+ </xsl:for-each>
33
+ </xsl:for-each>
18
34
  </xsl:variable>
35
+ <xsl:variable name="variables" select="xalan:nodeset($variables_)"/>
19
36
 
20
37
  <xsl:variable name="contents_">
21
- <mnx:contents>
22
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[@type = 'toc']" mode="contents"/>
23
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:abstract" mode="contents"/>
24
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:foreword" mode="contents"/>
25
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:executivesummary" mode="contents"/>
26
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:introduction" mode="contents"/>
27
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[not(@type = 'toc')]" mode="contents"/>
28
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:acknowledgements" mode="contents"/>
38
+ <xsl:variable name="bundle" select="count(//mn:metanorma) &gt; 1"/>
39
+ <xsl:for-each select="//mn:metanorma">
40
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
41
+ <xsl:variable name="docnumber"><xsl:value-of select="mn:bibdata/mn:docidentifier[@primary = 'true']"/></xsl:variable>
29
42
 
30
- <xsl:call-template name="processMainSectionsDefault_Contents"/>
31
-
32
- <xsl:apply-templates select="//mn:indexsect" mode="contents"/>
33
-
34
- <xsl:call-template name="processTablesFigures_Contents"/>
35
- </mnx:contents>
36
- </xsl:variable>
37
- <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
38
-
39
- <xsl:variable name="docnumber_version">
40
- <xsl:value-of select="concat(/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'rsd' or @type = 'Ribose' or @primary = 'true'], ':', $copyright_year)"/>
41
- <xsl:variable name="edition" select="normalize-space(/mn:metanorma/mn:bibdata/mn:edition[normalize-space(@language) = ''])"/>
42
- <xsl:if test="$edition != ''">
43
- <xsl:variable name="title-version">
44
- <xsl:call-template name="capitalize">
45
- <xsl:with-param name="str">
46
- <xsl:call-template name="getLocalizedString">
47
- <xsl:with-param name="key">version</xsl:with-param>
48
- </xsl:call-template>
49
- </xsl:with-param>
50
- </xsl:call-template>
43
+ <xsl:variable name="current_document">
44
+ <xsl:copy-of select="."/>
51
45
  </xsl:variable>
52
- <xsl:value-of select="concat(', ', $title-version, ' ', $edition)"/>
53
- </xsl:if>
46
+ <xsl:for-each select="xalan:nodeset($current_document)">
47
+ <mnx:doc num="{$num}" firstpage_id="firstpage_id_{$num}" title-part="{$docnumber}" bundle="{$bundle}">
48
+ <mnx:contents>
49
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[@type = 'toc']" mode="contents"/>
50
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:abstract" mode="contents"/>
51
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:foreword" mode="contents"/>
52
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:executivesummary" mode="contents"/>
53
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:introduction" mode="contents"/>
54
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[not(@type = 'toc')]" mode="contents"/>
55
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:acknowledgements" mode="contents"/>
56
+
57
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
58
+
59
+ <xsl:apply-templates select="//mn:indexsect" mode="contents"/>
60
+
61
+ <xsl:call-template name="processTablesFigures_Contents"/>
62
+ </mnx:contents>
63
+ </mnx:doc>
64
+ </xsl:for-each>
65
+ </xsl:for-each>
54
66
  </xsl:variable>
67
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
55
68
 
56
69
  <xsl:template name="layout-master-set">
57
70
  <fo:layout-master-set>
@@ -219,92 +232,105 @@
219
232
  <xsl:with-param name="contents" select="$contents"/>
220
233
  </xsl:call-template>
221
234
 
222
- <xsl:call-template name="cover-page"/>
223
-
224
- <xsl:call-template name="inner-cover-page"/>
225
-
226
235
  <xsl:variable name="updated_xml">
227
236
  <xsl:call-template name="updateXML"/>
228
237
  <!-- <xsl:copy-of select="."/> -->
229
238
  </xsl:variable>
230
239
 
231
- <xsl:if test="$debug = 'true'">
232
- <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
233
- <xsl:copy-of select="$contents"/>
234
- </redirect:write>
235
- </xsl:if>
240
+ <xsl:call-template name="debug_contents"/>
236
241
 
237
- <xsl:for-each select="xalan:nodeset($updated_xml)/*">
242
+ <!-- <xsl:for-each select="xalan:nodeset($updated_xml)/*"> -->
243
+ <xsl:for-each select="xalan:nodeset($updated_xml)//mn:metanorma">
244
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
238
245
 
239
- <!-- ToC pages -->
240
- <xsl:variable name="toc_and_boilerplate">
241
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[@type = 'toc']"/>
246
+ <xsl:variable name="current_document">
247
+ <xsl:copy-of select="."/>
248
+ </xsl:variable>
242
249
 
243
- <!-- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:copyright-statement"/>
244
-
245
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:legal-statement"/>
246
-
247
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:feedback-statement"/> -->
250
+ <xsl:for-each select="xalan:nodeset($current_document)">
248
251
 
249
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/*"/>
250
- </xsl:variable>
252
+ <xsl:call-template name="cover-page">
253
+ <xsl:with-param name="num" select="$num"/>
254
+ </xsl:call-template>
251
255
 
252
- <xsl:if test="normalize-space($toc_and_boilerplate) != ''">
253
- <fo:page-sequence xsl:use-attribute-sets="page-sequence-main"> <!-- master-reference="toc" -->
254
- <xsl:call-template name="insertHeaderFooter">
255
- <xsl:with-param name="section">toc</xsl:with-param>
256
- </xsl:call-template>
257
- <fo:flow flow-name="xsl-region-body">
256
+ <xsl:call-template name="inner-cover-page"/>
258
257
 
259
- <xsl:copy-of select="$toc_and_boilerplate"/>
258
+ <!-- ToC pages -->
259
+ <xsl:variable name="toc_and_boilerplate">
260
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[@type = 'toc']">
261
+ <xsl:with-param name="num" select="$num"/>
262
+ </xsl:apply-templates>
260
263
 
261
- </fo:flow>
262
- </fo:page-sequence>
263
- </xsl:if>
264
- <!-- ============== -->
265
- <!-- END ToC pages -->
266
- <!-- ============== -->
264
+ <!-- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:copyright-statement"/>
265
+
266
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:legal-statement"/>
267
+
268
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:feedback-statement"/> -->
267
269
 
268
- <xsl:variable name="updated_xml_with_pages">
269
- <xsl:call-template name="processPrefaceAndMainSectionsRibose_items"/>
270
- </xsl:variable>
270
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/*"/>
271
+ </xsl:variable>
271
272
 
272
- <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface -->
273
+ <xsl:if test="normalize-space($toc_and_boilerplate) != ''">
274
+ <fo:page-sequence xsl:use-attribute-sets="page-sequence-main"> <!-- master-reference="toc" -->
275
+ <xsl:call-template name="insertHeaderFooter">
276
+ <xsl:with-param name="num" select="$num"/>
277
+ <xsl:with-param name="section">toc</xsl:with-param>
278
+ </xsl:call-template>
279
+ <fo:flow flow-name="xsl-region-body">
273
280
 
274
- <xsl:for-each select=".//mn:page_sequence[normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
281
+ <xsl:copy-of select="$toc_and_boilerplate"/>
275
282
 
276
- <fo:page-sequence xsl:use-attribute-sets="page-sequence-main">
277
- <xsl:call-template name="refine_page-sequence-main"/>
283
+ </fo:flow>
284
+ </fo:page-sequence>
285
+ </xsl:if>
286
+ <!-- ============== -->
287
+ <!-- END ToC pages -->
288
+ <!-- ============== -->
278
289
 
279
- <xsl:call-template name="insertFootnoteSeparatorCommon"/>
290
+ <xsl:variable name="updated_xml_with_pages">
291
+ <xsl:call-template name="processPrefaceAndMainSectionsRibose_items"/>
292
+ </xsl:variable>
280
293
 
281
- <xsl:call-template name="insertHeaderFooter">
282
- <xsl:with-param name="section">main</xsl:with-param>
283
- </xsl:call-template>
284
- <fo:flow flow-name="xsl-region-body" role="SKIP">
294
+ <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface -->
285
295
 
286
- <fo:block line-height="130%" role="SKIP">
296
+ <xsl:for-each select=".//mn:page_sequence[normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
287
297
 
288
- <!-- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:abstract" />
289
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:foreword" />
290
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:executivesummary" />
291
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:introduction" />
292
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[not(@type = 'toc')]" />
293
- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:acknowledgements" />
294
-
295
- <xsl:call-template name="processMainSectionsDefault"/> -->
298
+ <fo:page-sequence xsl:use-attribute-sets="page-sequence-main">
299
+ <xsl:call-template name="refine_page-sequence-main"/>
296
300
 
297
- <xsl:apply-templates/>
301
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
298
302
 
299
- </fo:block>
300
- </fo:flow>
301
- </fo:page-sequence>
303
+ <xsl:call-template name="insertHeaderFooter">
304
+ <xsl:with-param name="num" select="$num"/>
305
+ <xsl:with-param name="section">main</xsl:with-param>
306
+ </xsl:call-template>
307
+ <fo:flow flow-name="xsl-region-body" role="SKIP">
308
+
309
+ <fo:block line-height="130%" role="SKIP">
310
+
311
+ <!-- <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:abstract" />
312
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:foreword" />
313
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:executivesummary" />
314
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:introduction" />
315
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:clause[not(@type = 'toc')]" />
316
+ <xsl:apply-templates select="/mn:metanorma/mn:preface/mn:acknowledgements" />
317
+
318
+ <xsl:call-template name="processMainSectionsDefault"/> -->
319
+
320
+ <xsl:apply-templates/>
321
+
322
+ </fo:block>
323
+ </fo:flow>
324
+ </fo:page-sequence>
325
+ </xsl:for-each>
302
326
  </xsl:for-each>
303
- </xsl:for-each>
304
327
 
305
- <!-- Index -->
306
- <xsl:call-template name="index-pages"/>
328
+ <!-- Index -->
329
+ <xsl:call-template name="index-pages">
330
+ <xsl:with-param name="num" select="$num"/>
331
+ </xsl:call-template>
307
332
 
333
+ </xsl:for-each>
308
334
  </xsl:for-each> <!-- xalan:nodeset($updated_xml)/* -->
309
335
 
310
336
  <xsl:call-template name="back-page"/>
@@ -313,15 +339,37 @@
313
339
  </xsl:template>
314
340
 
315
341
  <xsl:template name="cover-page">
342
+ <xsl:param name="num"/>
316
343
  <!-- Cover Page -->
317
344
  <xsl:choose>
318
345
  <xsl:when test="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:coverpage-image/mn:image and normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:full-coverpage-replacement) = 'true'">
319
346
  <xsl:call-template name="insertCoverPageFullImage"/>
320
347
  </xsl:when>
321
348
  <xsl:otherwise>
322
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
349
+
350
+ <xsl:variable name="copyright_year" select="/mn:metanorma/mn:bibdata/mn:copyright/mn:from"/>
351
+ <xsl:variable name="docnumber_version">
352
+ <xsl:value-of select="concat(/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'rsd' or @type = 'Ribose' or @primary = 'true'], ':', $copyright_year)"/>
353
+ <xsl:variable name="edition" select="normalize-space(/mn:metanorma/mn:bibdata/mn:edition[normalize-space(@language) = ''])"/>
354
+ <xsl:if test="$edition != ''">
355
+ <xsl:variable name="title-version">
356
+ <xsl:call-template name="capitalize">
357
+ <xsl:with-param name="str">
358
+ <xsl:call-template name="getLocalizedString">
359
+ <xsl:with-param name="key">version</xsl:with-param>
360
+ </xsl:call-template>
361
+ </xsl:with-param>
362
+ </xsl:call-template>
363
+ </xsl:variable>
364
+ <xsl:value-of select="concat(', ', $title-version, ' ', $edition)"/>
365
+ </xsl:if>
366
+ </xsl:variable>
367
+
368
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
323
369
 
324
370
  <fo:flow flow-name="xsl-region-body" color="black">
371
+ <xsl:call-template name="insert_firstpage_id"><xsl:with-param name="num" select="$num"/></xsl:call-template>
372
+
325
373
  <!-- background image -->
326
374
  <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0">
327
375
  <fo:block>
@@ -521,18 +569,19 @@
521
569
  <xsl:variable name="toc_item_indent">7</xsl:variable>
522
570
 
523
571
  <xsl:template match="mn:preface/mn:clause[@type = 'toc']" name="toc" priority="3">
572
+ <xsl:param name="num"/>
524
573
  <fo:block role="SKIP">
525
574
  <xsl:copy-of select="@id"/>
526
575
  <xsl:apply-templates/>
527
576
 
528
577
  <xsl:if test="count(*) = 1 and mn:fmt-title"> <!-- if there isn't user ToC -->
529
578
 
530
- <xsl:if test="$contents//mnx:item[@display = 'true']">
579
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:item[@display = 'true']">
531
580
 
532
581
  <fo:block-container xsl:use-attribute-sets="toc-style">
533
582
  <fo:block-container xsl:use-attribute-sets="reset-margins-style">
534
583
  <fo:block role="TOC">
535
- <xsl:for-each select="$contents//mnx:item[@display = 'true']">
584
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:item[@display = 'true']">
536
585
  <fo:block xsl:use-attribute-sets="toc-item-style">
537
586
 
538
587
  <xsl:call-template name="refine_toc-item-style"/>
@@ -558,24 +607,24 @@
558
607
  </fo:block>
559
608
 
560
609
  <!-- List of Tables -->
561
- <xsl:if test="$contents//mnx:tables/mnx:table">
610
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
562
611
  <xsl:call-template name="insertListOf_Title">
563
612
  <xsl:with-param name="title" select="$title-list-tables"/>
564
613
  </xsl:call-template>
565
614
  <fo:block role="TOC">
566
- <xsl:for-each select="$contents//mnx:tables/mnx:table">
615
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
567
616
  <xsl:call-template name="insertListOf_Item"/>
568
617
  </xsl:for-each>
569
618
  </fo:block>
570
619
  </xsl:if>
571
620
 
572
621
  <!-- List of Figures -->
573
- <xsl:if test="$contents//mnx:figures/mnx:figure">
622
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
574
623
  <xsl:call-template name="insertListOf_Title">
575
624
  <xsl:with-param name="title" select="$title-list-figures"/>
576
625
  </xsl:call-template>
577
626
  <fo:block role="TOC">
578
- <xsl:for-each select="$contents//mnx:figures/mnx:figure">
627
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
579
628
  <xsl:call-template name="insertListOf_Item"/>
580
629
  </xsl:for-each>
581
630
  </fo:block>
@@ -882,6 +931,10 @@
882
931
  <fo:inline xsl:use-attribute-sets="term-number-style">
883
932
  <xsl:call-template name="refine_term-number-style"/>
884
933
 
934
+ <xsl:for-each select="ancestor::mn:term[1]/mn:fmt-name"><!-- change context -->
935
+ <xsl:call-template name="setIDforNamedDestination"/>
936
+ </xsl:for-each>
937
+
885
938
  <xsl:apply-templates select="ancestor::mn:term[1]/mn:fmt-name"/>
886
939
  </fo:inline>
887
940
  </xsl:if>
@@ -1012,13 +1065,16 @@
1012
1065
  </xsl:template>
1013
1066
 
1014
1067
  <xsl:template name="insertHeaderFooter">
1068
+ <xsl:param name="num"/>
1015
1069
  <xsl:param name="section"/>
1016
1070
 
1017
1071
  <xsl:call-template name="insertHeader">
1018
1072
  <xsl:with-param name="section" select="$section"/>
1019
1073
  </xsl:call-template>
1020
1074
 
1021
- <xsl:call-template name="insertFooter"/>
1075
+ <xsl:call-template name="insertFooter">
1076
+ <xsl:with-param name="num" select="$num"/>
1077
+ </xsl:call-template>
1022
1078
  </xsl:template>
1023
1079
 
1024
1080
  <xsl:template name="insertHeader">
@@ -1129,6 +1185,7 @@
1129
1185
  </xsl:template>
1130
1186
 
1131
1187
  <xsl:template name="insertFooter">
1188
+ <xsl:param name="num"/>
1132
1189
  <!-- <xsl:param name="invert"/> -->
1133
1190
  <xsl:variable name="footerText">
1134
1191
  <!-- Ribose -->
@@ -1141,14 +1198,17 @@
1141
1198
  </xsl:call-template>
1142
1199
  </xsl:variable>
1143
1200
  <xsl:call-template name="insertFooterOdd">
1201
+ <xsl:with-param name="num" select="$num"/>
1144
1202
  <xsl:with-param name="footerText" select="$footerText"/>
1145
1203
  </xsl:call-template>
1146
1204
  <xsl:call-template name="insertFooterEven">
1205
+ <xsl:with-param name="num" select="$num"/>
1147
1206
  <xsl:with-param name="footerText" select="$footerText"/>
1148
1207
  </xsl:call-template>
1149
1208
  </xsl:template>
1150
1209
 
1151
1210
  <xsl:template name="insertFooterOdd">
1211
+ <xsl:param name="num"/>
1152
1212
  <xsl:param name="footerText"/>
1153
1213
  <fo:static-content flow-name="footer-odd" role="artifact">
1154
1214
  <fo:block-container font-size="8pt" height="100%" color="black">
@@ -1157,7 +1217,7 @@
1157
1217
  <xsl:value-of select="$footerText"/>
1158
1218
  <fo:inline keep-together.within-line="always">
1159
1219
  <fo:leader leader-pattern="space"/>
1160
- <xsl:value-of select="$copyright"/>
1220
+ <xsl:value-of select="$variables/mnx:doc[@num = $num]/copyright"/>
1161
1221
  </fo:inline>
1162
1222
  </fo:block>
1163
1223
  </fo:block-container>
@@ -1165,6 +1225,7 @@
1165
1225
  </xsl:template>
1166
1226
 
1167
1227
  <xsl:template name="insertFooterEven">
1228
+ <xsl:param name="num"/>
1168
1229
  <xsl:param name="footerText"/>
1169
1230
  <fo:static-content flow-name="footer-even" role="artifact">
1170
1231
  <fo:block-container font-size="8pt" height="100%" color="black">
@@ -1178,7 +1239,7 @@
1178
1239
  </fo:inline>
1179
1240
  <fo:inline keep-together.within-line="always">
1180
1241
  <fo:leader leader-pattern="space"/>
1181
- <xsl:value-of select="$copyright"/>
1242
+ <xsl:value-of select="$variables/mnx:doc[@num = $num]/copyright"/>
1182
1243
  </fo:inline>
1183
1244
  </fo:block>
1184
1245
  </fo:block-container>
@@ -2076,6 +2137,46 @@
2076
2137
  </xsl:template>
2077
2138
 
2078
2139
  <xsl:template name="addNamedDestinationAttribute">
2140
+ <xsl:variable name="docnum"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
2141
+ <xsl:variable name="caption_label" select="translate(normalize-space(.//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
2142
+
2143
+ <xsl:variable name="named_dest_">
2144
+ <xsl:choose>
2145
+ <xsl:when test="count(ancestor::mn:figure) &gt; 1"/> <!-- prevent id 'a)' -->
2146
+ <xsl:when test="ancestor::mn:note or ancestor::mn:example or ancestor::mn:termnote or ancestor::mn:termexample or ancestor::mn:admonition"/>
2147
+ <xsl:when test="$caption_label = '' and parent::mn:foreword">
2148
+ <xsl:variable name="foreword_number"><xsl:number count="mn:foreword" level="any"/></xsl:variable>
2149
+ <xsl:if test="$foreword_number = 1">Foreword</xsl:if>
2150
+ </xsl:when>
2151
+ <xsl:when test="$caption_label = '' and parent::mn:introduction">
2152
+ <xsl:variable name="introduction_number"><xsl:number count="mn:introduction" level="any"/></xsl:variable>
2153
+ <xsl:if test="$introduction_number = 1">Introduction</xsl:if>
2154
+ </xsl:when>
2155
+ <xsl:when test="$caption_label = ''"/>
2156
+ <xsl:when test="../@unnumbered = 'true'"/>
2157
+ <xsl:when test="normalize-space(java:matches(java:java.lang.String.new($caption_label), '[\x21-\xFF]+')) = 'false'"/>
2158
+ <!-- 1.1 in Appendix 1 -->
2159
+ <xsl:otherwise>
2160
+ <xsl:if test="ancestor::mn:annex and string(number(substring($caption_label, 1, 1))) != 'NaN'">
2161
+ <xsl:variable name="annex_caption_label" select="translate(normalize-space(ancestor::mn:annex[1]/mn:fmt-title//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
2162
+ <xsl:value-of select="concat($annex_caption_label, '_')"/>
2163
+ </xsl:if>
2164
+ <xsl:if test="parent::mn:formula">Formula</xsl:if>
2165
+ <xsl:value-of select="$caption_label"/>
2166
+ </xsl:otherwise>
2167
+ </xsl:choose>
2168
+ </xsl:variable>
2169
+ <xsl:variable name="named_dest" select="normalize-space($named_dest_)"/>
2170
+ <xsl:if test="$named_dest != ''">
2171
+ <xsl:variable name="named_dest_doc_">
2172
+ <xsl:value-of select="$named_dest"/>
2173
+ <xsl:if test="$docnum != '1'">_<xsl:value-of select="$docnum"/></xsl:if>
2174
+ </xsl:variable>
2175
+ <xsl:variable name="named_dest_doc" select="normalize-space($named_dest_doc_)"/>
2176
+ <xsl:if test="not(key('kid', $named_dest_doc))"> <!-- if element with id '$named_dest_doc' doesn't exist in the document -->
2177
+ <xsl:attribute name="named_dest"><xsl:value-of select="normalize-space($named_dest_doc)"/></xsl:attribute>
2178
+ </xsl:if>
2179
+ </xsl:if>
2079
2180
  </xsl:template>
2080
2181
 
2081
2182
  <xsl:template match="mn:fmt-name" mode="update_xml_step1">
@@ -3029,9 +3130,11 @@
3029
3130
  </xsl:template>
3030
3131
 
3031
3132
  <xsl:template match="mn:feedback-statement//mn:p">
3133
+ <xsl:param name="skip_id">false</xsl:param>
3032
3134
  <xsl:param name="margin"/>
3033
3135
  <!-- process in the template 'paragraph' -->
3034
3136
  <xsl:call-template name="paragraph">
3137
+ <xsl:with-param name="skip_id" select="$skip_id"/>
3035
3138
  <xsl:with-param name="margin" select="$margin"/>
3036
3139
  </xsl:call-template>
3037
3140
  </xsl:template>
@@ -9520,7 +9623,12 @@
9520
9623
  <xsl:template match="mn:figure[@class = 'pseudocode']">
9521
9624
  <xsl:call-template name="setNamedDestination"/>
9522
9625
  <fo:block id="{@id}">
9523
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
9626
+ <fo:block role="SKIP">
9627
+ <xsl:for-each select="mn:fmt-name"> <!-- set context -->
9628
+ <xsl:call-template name="setIDforNamedDestination"/>
9629
+ </xsl:for-each>
9630
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
9631
+ </fo:block>
9524
9632
  </fo:block>
9525
9633
  <xsl:apply-templates select="mn:fmt-name"/>
9526
9634
  </xsl:template>
@@ -12152,7 +12260,7 @@
12152
12260
  </xsl:variable>
12153
12261
 
12154
12262
  <xsl:template name="index-pages">
12155
- <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
12263
+ <xsl:param name="num"/>
12156
12264
 
12157
12265
  <xsl:variable name="docid">
12158
12266
  <xsl:call-template name="getDocumentId"/>
@@ -12172,10 +12280,17 @@
12172
12280
  </xsl:apply-templates>
12173
12281
  </xsl:template>
12174
12282
  <xsl:template match="mn:indexsect"/>
12283
+ <xsl:template match="/" mode="index">
12284
+ <xsl:param name="num"/>
12285
+ <xsl:apply-templates mode="index">
12286
+ <xsl:with-param name="num" select="$num"/>
12287
+ </xsl:apply-templates>
12288
+ </xsl:template>
12175
12289
  <xsl:template match="mn:indexsect" mode="index">
12176
12290
  <xsl:param name="num"/>
12177
12291
  <fo:page-sequence master-reference="index" force-page-count="no-force">
12178
12292
  <xsl:call-template name="insertHeaderFooter">
12293
+ <xsl:with-param name="num" select="$num"/>
12179
12294
  <xsl:with-param name="section">main</xsl:with-param>
12180
12295
  </xsl:call-template>
12181
12296
  <fo:flow flow-name="xsl-region-body">
@@ -14032,6 +14147,15 @@
14032
14147
  </xsl:if>
14033
14148
  </xsl:template>
14034
14149
 
14150
+ <!-- debug templates -->
14151
+ <xsl:template name="debug_contents">
14152
+ <xsl:if test="$debug = 'true'">
14153
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
14154
+ <xsl:copy-of select="$contents"/>
14155
+ </redirect:write>
14156
+ </xsl:if>
14157
+ </xsl:template>
14158
+
14035
14159
  <xsl:template name="processPrefaceSectionsDefault">
14036
14160
  <xsl:param name="num"/>
14037
14161
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
@@ -15248,14 +15372,18 @@
15248
15372
  </xsl:template>
15249
15373
 
15250
15374
  <xsl:template name="setIDforNamedDestination">
15251
- <xsl:if test="@named_dest">
15252
- <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
15375
+ <xsl:if test="$isGenerateTableIF = 'false'">
15376
+ <xsl:if test="@named_dest">
15377
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
15378
+ </xsl:if>
15253
15379
  </xsl:if>
15254
15380
  </xsl:template>
15255
15381
 
15256
15382
  <xsl:template name="setIDforNamedDestinationInline">
15257
- <xsl:if test="@named_dest">
15258
- <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
15383
+ <xsl:if test="$isGenerateTableIF = 'false'">
15384
+ <xsl:if test="@named_dest">
15385
+ <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
15386
+ </xsl:if>
15259
15387
  </xsl:if>
15260
15388
  </xsl:template>
15261
15389
 
@@ -15265,7 +15393,7 @@
15265
15393
  <xsl:if test="@id and normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}.*')) = 'false'">
15266
15394
  <fox:destination internal-destination="{@id}"/>
15267
15395
  </xsl:if>
15268
- <xsl:for-each select=". | mn:fmt-title | mn:fmt-name">
15396
+ <xsl:for-each select=". | mn:fmt-title[1] | mn:fmt-name[1]">
15269
15397
  <xsl:if test="@named_dest">
15270
15398
  <fox:destination internal-destination="{@named_dest}"/>
15271
15399
  </xsl:if>
@@ -15273,6 +15401,12 @@
15273
15401
  </xsl:if>
15274
15402
  </xsl:template>
15275
15403
 
15404
+ <xsl:template name="copyParagraphId">
15405
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}.*')) = 'false'">
15406
+ <xsl:copy-of select="@id"/>
15407
+ </xsl:if>
15408
+ </xsl:template>
15409
+
15276
15410
  <xsl:template name="add-letter-spacing">
15277
15411
  <xsl:param name="text"/>
15278
15412
  <xsl:param name="letter-spacing" select="'0.15'"/>
@@ -15495,7 +15629,7 @@
15495
15629
  <xsl:template name="insertCoverPageFullImage">
15496
15630
  <xsl:param name="name">coverpage-image</xsl:param>
15497
15631
  <xsl:for-each select="//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/*[local-name() = $name][1]/mn:image">
15498
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
15632
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
15499
15633
  <fo:flow flow-name="xsl-region-body">
15500
15634
  <xsl:call-template name="insertBackgroundPageImage">
15501
15635
  <xsl:with-param name="number" select="position()"/>
@@ -15959,6 +16093,18 @@
15959
16093
  </xsl:attribute>
15960
16094
  </xsl:template>
15961
16095
 
16096
+ <xsl:template name="insert_firstpage_id">
16097
+ <xsl:param name="num"/>
16098
+ <fo:wrapper role="artifact">
16099
+ <fo:block-container absolute-position="fixed" top="1mm">
16100
+ <xsl:if test="$num = 1">
16101
+ <xsl:attribute name="id">firstpage_id_0</xsl:attribute>
16102
+ </xsl:if>
16103
+ <fo:block id="firstpage_id_{$num}" role="SKIP"> </fo:block>
16104
+ </fo:block-container>
16105
+ </fo:wrapper>
16106
+ </xsl:template>
16107
+
15962
16108
  <xsl:template name="getCharByCodePoint">
15963
16109
  <xsl:param name="codepoint"/>
15964
16110
  <xsl:param name="radix">16</xsl:param>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ribose
3
- VERSION = "2.8.3".freeze
3
+ VERSION = "2.8.4".freeze
4
4
  end
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 3.3.0"
32
+ spec.add_dependency "metanorma-generic", "~> 3.3.3"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ribose
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.3
4
+ version: 2.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-03-30 00:00:00.000000000 Z
11
+ date: 2026-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.0
19
+ version: 3.3.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.3.0
26
+ version: 3.3.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement