metanorma-cc 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: cc0ffb6813bd4a4a9451ddba8a1d68f8b485e9a8ef182e77daa5cc31cd3078fe
4
- data.tar.gz: 012fa0089b821d23d6a43a5b09aa42384a651489e9723bd73fec055323857dfd
3
+ metadata.gz: fcbf053e321c0038009c2cd951cb5ae7ad92c274bd8f5c9d06a52c566d80b399
4
+ data.tar.gz: 679a37852bc9d342ea994af254011272cb5231471bded9c7fc1f600722fc495d
5
5
  SHA512:
6
- metadata.gz: b21c5e472e3f29cede108ffcf078ba4b5ea024c12db3c219976e43ef44d451573c31f78e4f7f7dc72d7b37e6c9f5ee5cc8484711b926405558eb6a32337d2428
7
- data.tar.gz: 4f77fe9a73a8f7b6ab8f81d2609d692057f56749705c32e035f279dbe1e1a70f8fdf934250483569c72144f8219b1f4421b2ea2dc20c3fb0fe680b3bcfab9c13
6
+ metadata.gz: 3cb08d3b379e86e38a98b83c57bd5deca2354d698fde5b3045f7bd0243ac2e2e0b57f1d8251239dced23f1a27fb376fa47798d85adeab9c4b42a618fd2d0bc63
7
+ data.tar.gz: c313a59b768bcf7a4a3564453c1fbcc4d87fefc8fc83d7ab26aa1d65d1bee1b6a83e685712dd292325c7e0cbbd96202c5b1f4f1cb88e7502c282e8bfd6f700ab
@@ -4,28 +4,54 @@
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
- <xsl:variable name="copyright">
10
- <xsl:text>© The Calendaring and Scheduling Consortium, Inc. </xsl:text>
11
- <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:copyright/mn:from"/>
12
- <xsl:text> – All rights reserved</xsl:text>
13
- </xsl:variable>
11
+ <xsl:variable name="variables_">
12
+ <xsl:for-each select="//mn:metanorma">
13
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
14
+
15
+ <xsl:variable name="current_document">
16
+ <xsl:copy-of select="."/>
17
+ </xsl:variable>
14
18
 
15
- <!-- <xsl:variable name="header">
16
- <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'csd']"/>
17
- <xsl:text>:</xsl:text>
18
- <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:copyright/mn:from"/>
19
- </xsl:variable> -->
20
- <xsl:variable name="header" select="/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'CalConnect']"/>
19
+ <xsl:for-each select="xalan:nodeset($current_document)">
20
+ <mnx:doc num="{$num}">
21
+ <xsl:variable name="copyright">
22
+ <xsl:text>© The Calendaring and Scheduling Consortium, Inc. </xsl:text>
23
+ <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:copyright/mn:from"/>
24
+ <xsl:text> All rights reserved</xsl:text>
25
+ </xsl:variable>
26
+ <copyright><xsl:value-of select="$copyright"/></copyright>
27
+
28
+ <xsl:variable name="header" select="/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'CalConnect']"/>
29
+ <header><xsl:value-of select="$header"/></header>
30
+ </mnx:doc>
31
+ </xsl:for-each>
32
+ </xsl:for-each>
33
+ </xsl:variable>
34
+ <xsl:variable name="variables" select="xalan:nodeset($variables_)"/>
21
35
 
22
36
  <xsl:variable name="contents_">
23
- <mnx:contents>
24
- <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
25
- <xsl:call-template name="processMainSectionsDefault_Contents"/>
26
- <xsl:apply-templates select="//mn:indexsect" mode="contents"/>
27
- <xsl:call-template name="processTablesFigures_Contents"/>
28
- </mnx:contents>
37
+ <xsl:variable name="bundle" select="count(//mn:metanorma) &gt; 1"/>
38
+ <xsl:for-each select="//mn:metanorma">
39
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
40
+ <xsl:variable name="docnumber"><xsl:value-of select="mn:bibdata/mn:docidentifier[@primary = 'true']"/></xsl:variable>
41
+ <xsl:variable name="current_document">
42
+ <xsl:copy-of select="."/>
43
+ </xsl:variable>
44
+ <xsl:for-each select="xalan:nodeset($current_document)">
45
+ <mnx:doc num="{$num}" firstpage_id="firstpage_id_{$num}" title-part="{$docnumber}" bundle="{$bundle}">
46
+ <mnx:contents>
47
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
48
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
49
+ <xsl:apply-templates select="//mn:indexsect" mode="contents"/>
50
+ <xsl:call-template name="processTablesFigures_Contents"/>
51
+ </mnx:contents>
52
+ </mnx:doc>
53
+ </xsl:for-each>
54
+ </xsl:for-each>
29
55
  </xsl:variable>
30
56
  <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
31
57
 
@@ -191,84 +217,96 @@
191
217
  <xsl:with-param name="contents" select="$contents"/>
192
218
  </xsl:call-template>
193
219
 
194
- <xsl:call-template name="cover-page"/>
195
-
196
220
  <xsl:variable name="updated_xml">
197
221
  <xsl:call-template name="updateXML"/>
198
222
  </xsl:variable>
199
223
 
200
- <xsl:if test="$debug = 'true'">
201
- <redirect:write file="updated_xml.xml">
202
- <xsl:copy-of select="$updated_xml"/>
203
- </redirect:write>
204
- </xsl:if>
224
+ <xsl:call-template name="debug_contents"/>
205
225
 
206
- <xsl:for-each select="xalan:nodeset($updated_xml)/*">
226
+ <xsl:for-each select="xalan:nodeset($updated_xml)//mn:metanorma">
227
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
207
228
 
208
- <xsl:variable name="updated_xml_with_pages">
209
- <xsl:call-template name="processPrefaceAndMainSectionsDefault_items"/>
229
+ <xsl:variable name="current_document">
230
+ <xsl:copy-of select="."/>
210
231
  </xsl:variable>
211
232
 
212
- <xsl:if test="$debug = 'true'">
213
- <redirect:write file="updated_xml_with_pages.xml">
214
- <xsl:copy-of select="$updated_xml_with_pages"/>
215
- </redirect:write>
216
- </xsl:if>
233
+ <xsl:for-each select="xalan:nodeset($current_document)">
217
234
 
218
- <xsl:if test="$debug = 'true'">
219
- <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
220
- <xsl:copy-of select="$contents"/>
221
- </redirect:write>
222
- </xsl:if>
235
+ <xsl:call-template name="cover-page">
236
+ <xsl:with-param name="num" select="$num"/>
237
+ </xsl:call-template>
223
238
 
224
- <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
239
+ <xsl:variable name="updated_xml_with_pages">
240
+ <xsl:call-template name="processPrefaceAndMainSectionsDefault_items"/>
241
+ </xsl:variable>
225
242
 
226
- <xsl:call-template name="inner-cover-page"/>
243
+ <xsl:if test="$debug = 'true'">
244
+ <redirect:write file="updated_xml_with_pages.xml">
245
+ <xsl:copy-of select="$updated_xml_with_pages"/>
246
+ </redirect:write>
247
+ </xsl:if>
227
248
 
228
- <xsl:for-each select=".//mn:page_sequence[parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
249
+ <xsl:call-template name="debug_contents"/>
229
250
 
230
- <!-- Copyright, Content, Foreword, etc. pages -->
231
- <fo:page-sequence xsl:use-attribute-sets="page-sequence-preface">
232
- <xsl:call-template name="refine_page-sequence-preface"/>
251
+ <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
233
252
 
234
- <xsl:call-template name="insertFootnoteSeparatorCommon"/>
235
- <xsl:call-template name="insertHeaderFooter"/>
236
- <fo:flow flow-name="xsl-region-body">
253
+ <xsl:call-template name="inner-cover-page">
254
+ <xsl:with-param name="num" select="$num"/>
255
+ </xsl:call-template>
237
256
 
238
- <!-- Table of contents, Foreword, Introduction -->
239
- <!-- <xsl:call-template name="processPrefaceSectionsDefault"/> -->
240
- <xsl:apply-templates/>
257
+ <xsl:for-each select=".//mn:page_sequence[parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
241
258
 
242
- <fo:block/> <!-- for prevent empty preface -->
243
- </fo:flow>
244
- </fo:page-sequence>
245
- </xsl:for-each>
259
+ <!-- Copyright, Content, Foreword, etc. pages -->
260
+ <fo:page-sequence xsl:use-attribute-sets="page-sequence-preface">
261
+ <xsl:call-template name="refine_page-sequence-preface"/>
246
262
 
247
- <xsl:for-each select=".//mn:page_sequence[not(parent::mn:preface)][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
248
-
249
- <!-- Document Pages -->
250
- <fo:page-sequence xsl:use-attribute-sets="page-sequence-main">
251
- <xsl:call-template name="refine_page-sequence-main"/>
252
-
253
- <xsl:call-template name="insertFootnoteSeparatorCommon"/>
254
- <xsl:call-template name="insertHeaderFooter"/>
255
- <fo:flow flow-name="xsl-region-body">
256
- <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt" role="H1">
257
- <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:title[@language = 'en']"/>
258
- </fo:block> -->
259
- <fo:block>
260
- <!-- <xsl:call-template name="processMainSectionsDefault"/> -->
261
- <xsl:apply-templates/>
262
- </fo:block>
263
- </fo:flow>
264
- </fo:page-sequence>
263
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
264
+ <xsl:call-template name="insertHeaderFooter">
265
+ <xsl:with-param name="num" select="$num"/>
266
+ </xsl:call-template>
267
+ <fo:flow flow-name="xsl-region-body">
265
268
 
266
- <!-- End Document Pages -->
269
+ <!-- Table of contents, Foreword, Introduction -->
270
+ <!-- <xsl:call-template name="processPrefaceSectionsDefault"/> -->
271
+ <xsl:apply-templates>
272
+ <xsl:with-param name="num" select="$num"/>
273
+ </xsl:apply-templates>
274
+
275
+ <fo:block/> <!-- for prevent empty preface -->
276
+ </fo:flow>
277
+ </fo:page-sequence>
278
+ </xsl:for-each>
279
+
280
+ <xsl:for-each select=".//mn:page_sequence[not(parent::mn:preface)][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
281
+
282
+ <!-- Document Pages -->
283
+ <fo:page-sequence xsl:use-attribute-sets="page-sequence-main">
284
+ <xsl:call-template name="refine_page-sequence-main"/>
285
+
286
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
287
+ <xsl:call-template name="insertHeaderFooter">
288
+ <xsl:with-param name="num" select="$num"/>
289
+ </xsl:call-template>
290
+ <fo:flow flow-name="xsl-region-body">
291
+ <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt" role="H1">
292
+ <xsl:value-of select="/mn:metanorma/mn:bibdata/mn:title[@language = 'en']"/>
293
+ </fo:block> -->
294
+ <fo:block>
295
+ <!-- <xsl:call-template name="processMainSectionsDefault"/> -->
296
+ <xsl:apply-templates/>
297
+ </fo:block>
298
+ </fo:flow>
299
+ </fo:page-sequence>
300
+
301
+ <!-- End Document Pages -->
302
+ </xsl:for-each>
267
303
  </xsl:for-each>
268
- </xsl:for-each>
269
304
 
270
- <xsl:call-template name="index-pages"/>
305
+ <xsl:call-template name="index-pages">
306
+ <xsl:with-param name="num" select="$num"/>
307
+ </xsl:call-template>
271
308
 
309
+ </xsl:for-each>
272
310
  </xsl:for-each>
273
311
 
274
312
  <xsl:call-template name="back-page"/>
@@ -277,24 +315,26 @@
277
315
  </xsl:template>
278
316
 
279
317
  <xsl:template name="cover-page">
318
+ <xsl:param name="num"/>
280
319
  <!-- Cover Page -->
281
320
  <xsl:choose>
282
321
  <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'">
283
322
  <xsl:call-template name="insertCoverPageFullImage"/>
284
323
  </xsl:when>
285
324
  <xsl:otherwise>
286
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
325
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
287
326
  <xsl:call-template name="insertFootnoteSeparatorCommon"/>
288
327
 
289
328
  <fo:static-content flow-name="cover-page-header" font-size="10pt">
290
329
  <fo:block-container height="23.5mm" display-align="before">
291
330
  <fo:block padding-top="12.5mm">
292
- <xsl:value-of select="$copyright"/>
331
+ <xsl:value-of select="$variables/mnx:doc[@num = $num]/copyright"/>
293
332
  </fo:block>
294
333
  </fo:block-container>
295
334
  </fo:static-content>
296
335
 
297
336
  <fo:flow flow-name="xsl-region-body">
337
+ <xsl:call-template name="insert_firstpage_id"><xsl:with-param name="num" select="$num"/></xsl:call-template>
298
338
 
299
339
  <fo:block text-align="right">
300
340
  <!-- CC/FDS 18011:2018 -->
@@ -351,13 +391,16 @@
351
391
  </xsl:template> <!-- END: cover-page -->
352
392
 
353
393
  <xsl:template name="inner-cover-page">
394
+ <xsl:param name="num"/>
354
395
  <fo:page-sequence initial-page-number="2" xsl:use-attribute-sets="page-sequence-preface">
355
396
  <xsl:call-template name="refine_page-sequence-preface">
356
397
  <xsl:with-param name="skip_force_page_count">true</xsl:with-param>
357
398
  </xsl:call-template>
358
399
 
359
400
  <xsl:call-template name="insertFootnoteSeparatorCommon"/>
360
- <xsl:call-template name="insertHeaderFooter"/>
401
+ <xsl:call-template name="insertHeaderFooter">
402
+ <xsl:with-param name="num" select="$num"/>
403
+ </xsl:call-template>
361
404
  <fo:flow flow-name="xsl-region-body">
362
405
  <fo:block margin-bottom="15pt"> </fo:block>
363
406
  <fo:block margin-bottom="14pt">
@@ -372,7 +415,9 @@
372
415
  <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:legal-statement"/>
373
416
  </fo:block>
374
417
  <fo:block margin-bottom="12pt">
375
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:feedback-statement/mn:clause/mn:p[@id = 'boilerplate-name']"/>
418
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:feedback-statement/mn:clause/mn:p[@id = 'boilerplate-name']">
419
+ <xsl:with-param name="skip_id">true</xsl:with-param>
420
+ </xsl:apply-templates>
376
421
  </fo:block>
377
422
  <fo:block>
378
423
  <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:feedback-statement/mn:clause/mn:p[@id = 'boilerplate-address']"/>
@@ -418,7 +463,9 @@
418
463
  </xsl:template>
419
464
 
420
465
  <xsl:template match="mn:preface//mn:clause[@type = 'toc']" name="toc" priority="3">
466
+ <xsl:param name="num"/>
421
467
  <fo:block-container xsl:use-attribute-sets="toc-style">
468
+ <xsl:copy-of select="@id"/>
422
469
  <!-- render 'Contents' outside if role="TOC" -->
423
470
  <xsl:apply-templates select="mn:fmt-title"/>
424
471
  <fo:block role="TOC">
@@ -427,7 +474,7 @@
427
474
 
428
475
  <xsl:if test="count(*) = 1 and mn:fmt-title"> <!-- if there isn't user ToC -->
429
476
 
430
- <xsl:for-each select="$contents//mnx:item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
477
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:item[@display = 'true']">
431
478
 
432
479
  <fo:block xsl:use-attribute-sets="toc-item-style">
433
480
 
@@ -466,24 +513,28 @@
466
513
  </xsl:for-each>
467
514
 
468
515
  <!-- List of Tables -->
469
- <xsl:for-each select="$contents//mnx:tables/mnx:table">
470
- <xsl:if test="position() = 1">
471
- <xsl:call-template name="insertListOf_Title">
472
- <xsl:with-param name="title" select="$title-list-tables"/>
473
- </xsl:call-template>
474
- </xsl:if>
475
- <xsl:call-template name="insertListOf_Item"/>
476
- </xsl:for-each>
516
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
517
+ <xsl:call-template name="insertListOf_Title">
518
+ <xsl:with-param name="title" select="$title-list-tables"/>
519
+ </xsl:call-template>
520
+ <fo:block role="TOC">
521
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
522
+ <xsl:call-template name="insertListOf_Item"/>
523
+ </xsl:for-each>
524
+ </fo:block>
525
+ </xsl:if>
477
526
 
478
527
  <!-- List of Figures -->
479
- <xsl:for-each select="$contents//mnx:figures/mnx:figure">
480
- <xsl:if test="position() = 1">
481
- <xsl:call-template name="insertListOf_Title">
482
- <xsl:with-param name="title" select="$title-list-figures"/>
483
- </xsl:call-template>
484
- </xsl:if>
485
- <xsl:call-template name="insertListOf_Item"/>
486
- </xsl:for-each>
528
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
529
+ <xsl:call-template name="insertListOf_Title">
530
+ <xsl:with-param name="title" select="$title-list-figures"/>
531
+ </xsl:call-template>
532
+ <fo:block role="TOC">
533
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
534
+ <xsl:call-template name="insertListOf_Item"/>
535
+ </xsl:for-each>
536
+ </fo:block>
537
+ </xsl:if>
487
538
  </xsl:if>
488
539
  </fo:block>
489
540
  </fo:block-container>
@@ -586,6 +637,8 @@
586
637
  </xsl:choose>
587
638
  </xsl:variable>
588
639
 
640
+ <xsl:call-template name="setNamedDestination"/>
641
+
589
642
  <xsl:variable name="title_styles">
590
643
  <styles xsl:use-attribute-sets="title-style"><xsl:call-template name="refine_title-style"/></styles>
591
644
  </xsl:variable>
@@ -593,6 +646,8 @@
593
646
  <xsl:element name="{$element-name}">
594
647
  <xsl:copy-of select="xalan:nodeset($title_styles)/styles/@*"/>
595
648
 
649
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
650
+
596
651
  <xsl:apply-templates/>
597
652
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
598
653
  </xsl:element>
@@ -601,6 +656,7 @@
601
656
  <xsl:template match="mn:p" name="paragraph">
602
657
  <xsl:param name="inline" select="'false'"/>
603
658
  <xsl:param name="split_keep-within-line"/>
659
+ <xsl:param name="skip_id">false</xsl:param>
604
660
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
605
661
  <xsl:variable name="element-name">
606
662
  <xsl:choose>
@@ -612,6 +668,10 @@
612
668
  </xsl:choose>
613
669
  </xsl:variable>
614
670
 
671
+ <xsl:if test="$skip_id = 'false'">
672
+ <xsl:call-template name="setNamedDestination"/>
673
+ </xsl:if>
674
+
615
675
  <xsl:variable name="p_styles">
616
676
  <styles xsl:use-attribute-sets="p-style">
617
677
  <xsl:call-template name="refine_p-style"><xsl:with-param name="element-name" select="$element-name"/></xsl:call-template>
@@ -620,6 +680,9 @@
620
680
 
621
681
  <xsl:element name="{$element-name}">
622
682
  <xsl:copy-of select="xalan:nodeset($p_styles)/styles/@*"/>
683
+ <xsl:if test="$skip_id = 'false'">
684
+ <xsl:call-template name="copyParagraphId"/>
685
+ </xsl:if>
623
686
 
624
687
  <xsl:apply-templates>
625
688
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -639,28 +702,35 @@
639
702
  </xsl:template>
640
703
 
641
704
  <xsl:template name="insertHeaderFooter">
642
- <xsl:call-template name="insertHeader"/>
643
- <xsl:call-template name="insertFooter"/>
705
+ <xsl:param name="num"/>
706
+ <xsl:call-template name="insertHeader">
707
+ <xsl:with-param name="num" select="$num"/>
708
+ </xsl:call-template>
709
+ <xsl:call-template name="insertFooter">
710
+ <xsl:with-param name="num" select="$num"/>
711
+ </xsl:call-template>
644
712
  </xsl:template>
645
713
 
646
714
  <xsl:template name="insertHeader">
715
+ <xsl:param name="num"/>
647
716
  <fo:static-content flow-name="header-even" role="artifact">
648
717
  <fo:block-container height="17mm" display-align="before">
649
718
  <fo:block padding-top="12.5mm">
650
- <xsl:value-of select="$header"/>
719
+ <xsl:value-of select="$variables/mnx:doc[@num = $num]/header"/>
651
720
  </fo:block>
652
721
  </fo:block-container>
653
722
  </fo:static-content>
654
723
  <fo:static-content flow-name="header-odd" role="artifact">
655
724
  <fo:block-container height="17mm" display-align="before">
656
725
  <fo:block text-align="right" padding-top="12.5mm">
657
- <xsl:value-of select="$header"/>
726
+ <xsl:value-of select="$variables/mnx:doc[@num = $num]/header"/>
658
727
  </fo:block>
659
728
  </fo:block-container>
660
729
  </fo:static-content>
661
730
  </xsl:template>
662
731
 
663
732
  <xsl:template name="insertFooter">
733
+ <xsl:param name="num"/>
664
734
  <fo:static-content flow-name="footer-even" role="artifact">
665
735
  <fo:block-container font-size="10pt" height="100%" display-align="after">
666
736
  <fo:table table-layout="fixed" width="100%">
@@ -672,7 +742,7 @@
672
742
  <fo:block padding-bottom="5mm"><fo:page-number/></fo:block>
673
743
  </fo:table-cell>
674
744
  <fo:table-cell padding-right="2mm">
675
- <fo:block padding-bottom="5mm" text-align="right"><xsl:value-of select="$copyright"/></fo:block>
745
+ <fo:block padding-bottom="5mm" text-align="right"><xsl:value-of select="$variables/mnx:doc[@num = $num]/copyright"/></fo:block>
676
746
  </fo:table-cell>
677
747
  </fo:table-row>
678
748
  </fo:table-body>
@@ -687,7 +757,7 @@
687
757
  <fo:table-body>
688
758
  <fo:table-row>
689
759
  <fo:table-cell>
690
- <fo:block padding-bottom="5mm"><xsl:value-of select="$copyright"/></fo:block>
760
+ <fo:block padding-bottom="5mm"><xsl:value-of select="$variables/mnx:doc[@num = $num]/copyright"/></fo:block>
691
761
  </fo:table-cell>
692
762
  <fo:table-cell padding-right="2mm">
693
763
  <fo:block padding-bottom="5mm" text-align="right"><fo:page-number/></fo:block>
@@ -1534,6 +1604,46 @@
1534
1604
  </xsl:template>
1535
1605
 
1536
1606
  <xsl:template name="addNamedDestinationAttribute">
1607
+ <xsl:variable name="docnum"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
1608
+ <xsl:variable name="caption_label" select="translate(normalize-space(.//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
1609
+
1610
+ <xsl:variable name="named_dest_">
1611
+ <xsl:choose>
1612
+ <xsl:when test="count(ancestor::mn:figure) &gt; 1"/> <!-- prevent id 'a)' -->
1613
+ <xsl:when test="ancestor::mn:note or ancestor::mn:example or ancestor::mn:termnote or ancestor::mn:termexample or ancestor::mn:admonition"/>
1614
+ <xsl:when test="$caption_label = '' and parent::mn:foreword">
1615
+ <xsl:variable name="foreword_number"><xsl:number count="mn:foreword" level="any"/></xsl:variable>
1616
+ <xsl:if test="$foreword_number = 1">Foreword</xsl:if>
1617
+ </xsl:when>
1618
+ <xsl:when test="$caption_label = '' and parent::mn:introduction">
1619
+ <xsl:variable name="introduction_number"><xsl:number count="mn:introduction" level="any"/></xsl:variable>
1620
+ <xsl:if test="$introduction_number = 1">Introduction</xsl:if>
1621
+ </xsl:when>
1622
+ <xsl:when test="$caption_label = ''"/>
1623
+ <xsl:when test="../@unnumbered = 'true'"/>
1624
+ <xsl:when test="normalize-space(java:matches(java:java.lang.String.new($caption_label), '[\x21-\xFF]+')) = 'false'"/>
1625
+ <!-- 1.1 in Appendix 1 -->
1626
+ <xsl:otherwise>
1627
+ <xsl:if test="ancestor::mn:annex and string(number(substring($caption_label, 1, 1))) != 'NaN'">
1628
+ <xsl:variable name="annex_caption_label" select="translate(normalize-space(ancestor::mn:annex[1]/mn:fmt-title//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
1629
+ <xsl:value-of select="concat($annex_caption_label, '_')"/>
1630
+ </xsl:if>
1631
+ <xsl:if test="parent::mn:formula">Formula</xsl:if>
1632
+ <xsl:value-of select="$caption_label"/>
1633
+ </xsl:otherwise>
1634
+ </xsl:choose>
1635
+ </xsl:variable>
1636
+ <xsl:variable name="named_dest" select="normalize-space($named_dest_)"/>
1637
+ <xsl:if test="$named_dest != ''">
1638
+ <xsl:variable name="named_dest_doc_">
1639
+ <xsl:value-of select="$named_dest"/>
1640
+ <xsl:if test="$docnum != '1'">_<xsl:value-of select="$docnum"/></xsl:if>
1641
+ </xsl:variable>
1642
+ <xsl:variable name="named_dest_doc" select="normalize-space($named_dest_doc_)"/>
1643
+ <xsl:if test="not(key('kid', $named_dest_doc))"> <!-- if element with id '$named_dest_doc' doesn't exist in the document -->
1644
+ <xsl:attribute name="named_dest"><xsl:value-of select="normalize-space($named_dest_doc)"/></xsl:attribute>
1645
+ </xsl:if>
1646
+ </xsl:if>
1537
1647
  </xsl:template>
1538
1648
 
1539
1649
  <xsl:template match="mn:fmt-name" mode="update_xml_step1">
@@ -2466,9 +2576,11 @@
2466
2576
  </xsl:template>
2467
2577
 
2468
2578
  <xsl:template match="mn:feedback-statement//mn:p">
2579
+ <xsl:param name="skip_id">false</xsl:param>
2469
2580
  <xsl:param name="margin"/>
2470
2581
  <!-- process in the template 'paragraph' -->
2471
2582
  <xsl:call-template name="paragraph">
2583
+ <xsl:with-param name="skip_id" select="$skip_id"/>
2472
2584
  <xsl:with-param name="margin" select="$margin"/>
2473
2585
  </xsl:call-template>
2474
2586
  </xsl:template>
@@ -8832,7 +8944,12 @@
8832
8944
  <xsl:template match="mn:figure[@class = 'pseudocode']">
8833
8945
  <xsl:call-template name="setNamedDestination"/>
8834
8946
  <fo:block id="{@id}">
8835
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
8947
+ <fo:block role="SKIP">
8948
+ <xsl:for-each select="mn:fmt-name"> <!-- set context -->
8949
+ <xsl:call-template name="setIDforNamedDestination"/>
8950
+ </xsl:for-each>
8951
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
8952
+ </fo:block>
8836
8953
  </fo:block>
8837
8954
  <xsl:apply-templates select="mn:fmt-name"/>
8838
8955
  </xsl:template>
@@ -11378,7 +11495,7 @@
11378
11495
  </xsl:variable>
11379
11496
 
11380
11497
  <xsl:template name="index-pages">
11381
- <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
11498
+ <xsl:param name="num"/>
11382
11499
 
11383
11500
  <xsl:variable name="docid">
11384
11501
  <xsl:call-template name="getDocumentId"/>
@@ -11398,10 +11515,17 @@
11398
11515
  </xsl:apply-templates>
11399
11516
  </xsl:template>
11400
11517
  <xsl:template match="mn:indexsect"/>
11518
+ <xsl:template match="/" mode="index">
11519
+ <xsl:param name="num"/>
11520
+ <xsl:apply-templates mode="index">
11521
+ <xsl:with-param name="num" select="$num"/>
11522
+ </xsl:apply-templates>
11523
+ </xsl:template>
11401
11524
  <xsl:template match="mn:indexsect" mode="index">
11402
11525
  <xsl:param name="num"/>
11403
11526
  <fo:page-sequence master-reference="index" force-page-count="no-force">
11404
11527
  <xsl:call-template name="insertHeaderFooter">
11528
+ <xsl:with-param name="num" select="$num"/>
11405
11529
  <xsl:with-param name="section">main</xsl:with-param>
11406
11530
  </xsl:call-template>
11407
11531
  <fo:flow flow-name="xsl-region-body">
@@ -13234,6 +13358,15 @@
13234
13358
  </xsl:if>
13235
13359
  </xsl:template>
13236
13360
 
13361
+ <!-- debug templates -->
13362
+ <xsl:template name="debug_contents">
13363
+ <xsl:if test="$debug = 'true'">
13364
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
13365
+ <xsl:copy-of select="$contents"/>
13366
+ </redirect:write>
13367
+ </xsl:if>
13368
+ </xsl:template>
13369
+
13237
13370
  <xsl:template name="processPrefaceSectionsDefault">
13238
13371
  <xsl:param name="num"/>
13239
13372
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
@@ -14446,14 +14579,18 @@
14446
14579
  </xsl:template>
14447
14580
 
14448
14581
  <xsl:template name="setIDforNamedDestination">
14449
- <xsl:if test="@named_dest">
14450
- <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
14582
+ <xsl:if test="$isGenerateTableIF = 'false'">
14583
+ <xsl:if test="@named_dest">
14584
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
14585
+ </xsl:if>
14451
14586
  </xsl:if>
14452
14587
  </xsl:template>
14453
14588
 
14454
14589
  <xsl:template name="setIDforNamedDestinationInline">
14455
- <xsl:if test="@named_dest">
14456
- <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
14590
+ <xsl:if test="$isGenerateTableIF = 'false'">
14591
+ <xsl:if test="@named_dest">
14592
+ <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
14593
+ </xsl:if>
14457
14594
  </xsl:if>
14458
14595
  </xsl:template>
14459
14596
 
@@ -14463,7 +14600,7 @@
14463
14600
  <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'">
14464
14601
  <fox:destination internal-destination="{@id}"/>
14465
14602
  </xsl:if>
14466
- <xsl:for-each select=". | mn:fmt-title | mn:fmt-name">
14603
+ <xsl:for-each select=". | mn:fmt-title[1] | mn:fmt-name[1]">
14467
14604
  <xsl:if test="@named_dest">
14468
14605
  <fox:destination internal-destination="{@named_dest}"/>
14469
14606
  </xsl:if>
@@ -14471,6 +14608,12 @@
14471
14608
  </xsl:if>
14472
14609
  </xsl:template>
14473
14610
 
14611
+ <xsl:template name="copyParagraphId">
14612
+ <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'">
14613
+ <xsl:copy-of select="@id"/>
14614
+ </xsl:if>
14615
+ </xsl:template>
14616
+
14474
14617
  <xsl:template name="add-letter-spacing">
14475
14618
  <xsl:param name="text"/>
14476
14619
  <xsl:param name="letter-spacing" select="'0.15'"/>
@@ -14693,7 +14836,7 @@
14693
14836
  <xsl:template name="insertCoverPageFullImage">
14694
14837
  <xsl:param name="name">coverpage-image</xsl:param>
14695
14838
  <xsl:for-each select="//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/*[local-name() = $name][1]/mn:image">
14696
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
14839
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
14697
14840
  <fo:flow flow-name="xsl-region-body">
14698
14841
  <xsl:call-template name="insertBackgroundPageImage">
14699
14842
  <xsl:with-param name="number" select="position()"/>
@@ -15157,6 +15300,18 @@
15157
15300
  </xsl:attribute>
15158
15301
  </xsl:template>
15159
15302
 
15303
+ <xsl:template name="insert_firstpage_id">
15304
+ <xsl:param name="num"/>
15305
+ <fo:wrapper role="artifact">
15306
+ <fo:block-container absolute-position="fixed" top="1mm">
15307
+ <xsl:if test="$num = 1">
15308
+ <xsl:attribute name="id">firstpage_id_0</xsl:attribute>
15309
+ </xsl:if>
15310
+ <fo:block id="firstpage_id_{$num}" role="SKIP"> </fo:block>
15311
+ </fo:block-container>
15312
+ </fo:wrapper>
15313
+ </xsl:template>
15314
+
15160
15315
  <xsl:template name="getCharByCodePoint">
15161
15316
  <xsl:param name="codepoint"/>
15162
15317
  <xsl:param name="radix">16</xsl:param>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cc
3
- VERSION = "2.8.3".freeze
3
+ VERSION = "2.8.4".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -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-cc
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