metanorma-cc 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1b508821074c6707aa0d3c4c54b281ec243ab5edcdb0b8ad10794857ac304fd
4
- data.tar.gz: dba05758b201ad35a5abfd87178aba2e6a05b7f5a0eb6d871f0e41c22117fa79
3
+ metadata.gz: 3f95d9b70ea62da093f7baa6002949fada2f62294926a883c98d213d368ef662
4
+ data.tar.gz: 54746529bdb2eb53ee458563933694b3e865a1d119493108681476383963c315
5
5
  SHA512:
6
- metadata.gz: 83e74bb8d6b7affe2fbcdda9a08c412aa0102002d177224b42078c42faa157dca49a9297af1ac912bb95eedb14df050a72e6bf59f7c766616dd933237ffcd788
7
- data.tar.gz: 30877425455e9ec93343a2bd5b0b1b9277fffdb5d76a15a52eb6ddc9107da2f7b26f28466f10fd5feea06aad851216ddcdcca33f107ae0af9ec303f89c0b03d1
6
+ metadata.gz: 11016d1f310a139bc828a96202323f5fb5c4ca2b43779ed1ad9613567553317ca50183e1710d4f1ccf20c2e7af70703c44f0a097f0ce3bd33847fc24f53ce58a
7
+ data.tar.gz: 1217b5e39d6556b41bc88ebb78ecf04ebad077a808da0f3387c5f026017e07407ac52dee1a0484330af19e94f3a71f66aae23d33145aeddee48c461bf6b0307b
@@ -20,12 +20,14 @@
20
20
  <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
21
21
  </xsl:variable>
22
22
 
23
- <xsl:variable name="contents">
23
+ <xsl:variable name="contents_">
24
24
  <contents>
25
25
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
26
26
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
27
+ <xsl:call-template name="processTablesFigures_Contents"/>
27
28
  </contents>
28
29
  </xsl:variable>
30
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
29
31
 
30
32
 
31
33
  <xsl:template match="/">
@@ -190,7 +192,7 @@
190
192
  <xsl:if test="$debug = 'true'">
191
193
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
192
194
  DEBUG
193
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
195
+ contents=<xsl:copy-of select="$contents"/>
194
196
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
195
197
  </xsl:if>
196
198
 
@@ -224,14 +226,13 @@
224
226
  </xsl:variable>
225
227
  <fo:block font-size="14pt" margin-bottom="15.5pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
226
228
 
227
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
229
+ <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
228
230
 
229
231
  <fo:block role="TOCI">
230
232
  <xsl:if test="@level = 1">
231
233
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
232
234
  </xsl:if>
233
235
 
234
-
235
236
  <fo:list-block>
236
237
  <xsl:attribute name="provisional-distance-between-starts">
237
238
  <xsl:choose>
@@ -261,6 +262,27 @@
261
262
  </fo:list-block>
262
263
  </fo:block>
263
264
  </xsl:for-each>
265
+
266
+ <!-- List of Tables -->
267
+ <xsl:if test="$contents//tables/table">
268
+ <xsl:call-template name="insertListOf_Title">
269
+ <xsl:with-param name="title" select="$title-list-tables"/>
270
+ </xsl:call-template>
271
+ <xsl:for-each select="$contents//tables/table">
272
+ <xsl:call-template name="insertListOf_Item"/>
273
+ </xsl:for-each>
274
+ </xsl:if>
275
+
276
+ <!-- List of Figures -->
277
+ <xsl:if test="$contents//figures/figure">
278
+ <xsl:call-template name="insertListOf_Title">
279
+ <xsl:with-param name="title" select="$title-list-figures"/>
280
+ </xsl:call-template>
281
+ <xsl:for-each select="$contents//figures/figure">
282
+ <xsl:call-template name="insertListOf_Item"/>
283
+ </xsl:for-each>
284
+ </xsl:if>
285
+
264
286
  </fo:block>
265
287
  </fo:block-container>
266
288
 
@@ -294,6 +316,40 @@
294
316
  </fo:root>
295
317
  </xsl:template>
296
318
 
319
+ <xsl:template name="insertListOf_Title">
320
+ <xsl:param name="title"/>
321
+ <fo:block role="TOCI" margin-top="6pt" keep-with-next="always">
322
+ <xsl:value-of select="$title"/>
323
+ </fo:block>
324
+ </xsl:template>
325
+
326
+ <xsl:template name="insertListOf_Item">
327
+ <fo:block role="TOCI">
328
+ <fo:list-block provisional-distance-between-starts="8mm">
329
+ <fo:list-item>
330
+ <fo:list-item-label end-indent="label-end()">
331
+ <fo:block/>
332
+ </fo:list-item-label>
333
+ <fo:list-item-body start-indent="body-start()">
334
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
335
+ <fo:basic-link internal-destination="{@id}">
336
+ <xsl:call-template name="setAltText">
337
+ <xsl:with-param name="value" select="@alt-text"/>
338
+ </xsl:call-template>
339
+ <xsl:apply-templates select="." mode="contents"/>
340
+ <fo:inline keep-together.within-line="always">
341
+ <fo:leader leader-pattern="dots"/>
342
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
343
+ </fo:inline>
344
+ </fo:basic-link>
345
+ </fo:block>
346
+ </fo:list-item-body>
347
+ </fo:list-item>
348
+ </fo:list-block>
349
+ </fo:block>
350
+ </xsl:template>
351
+
352
+
297
353
  <xsl:template match="node()">
298
354
  <xsl:apply-templates/>
299
355
  </xsl:template>
@@ -504,7 +560,7 @@
504
560
  </xsl:template>
505
561
 
506
562
 
507
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
563
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
508
564
  <xsl:call-template name="getLang"/>
509
565
  </xsl:variable><xsl:variable name="pageWidth_">
510
566
  210
@@ -550,7 +606,7 @@
550
606
  <xsl:text>Contents</xsl:text>
551
607
 
552
608
  </title-toc>
553
-
609
+
554
610
  <title-descriptors lang="en">Descriptors</title-descriptors>
555
611
 
556
612
  <title-part lang="en">
@@ -586,7 +642,31 @@
586
642
  <title-continued lang="en">(continued)</title-continued>
587
643
  <title-continued lang="fr">(continué)</title-continued>
588
644
 
589
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
645
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
646
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
647
+ <xsl:value-of select="$toc_table_title"/>
648
+ <xsl:if test="normalize-space($toc_table_title) = ''">
649
+ <xsl:call-template name="getTitle">
650
+ <xsl:with-param name="name" select="'title-list-tables'"/>
651
+ </xsl:call-template>
652
+ </xsl:if>
653
+ </xsl:variable><xsl:variable name="title-list-figures">
654
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
655
+ <xsl:value-of select="$toc_figure_title"/>
656
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
657
+ <xsl:call-template name="getTitle">
658
+ <xsl:with-param name="name" select="'title-list-figures'"/>
659
+ </xsl:call-template>
660
+ </xsl:if>
661
+ </xsl:variable><xsl:variable name="title-list-recommendations">
662
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
663
+ <xsl:value-of select="$toc_requirement_title"/>
664
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
665
+ <xsl:call-template name="getTitle">
666
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
667
+ </xsl:call-template>
668
+ </xsl:if>
669
+ </xsl:variable><xsl:variable name="bibdata">
590
670
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
591
671
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
592
672
  </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
@@ -1790,6 +1870,30 @@
1790
1870
  <xsl:sort select="@displayorder" data-type="number"/>
1791
1871
  <xsl:apply-templates select="." mode="contents"/>
1792
1872
  </xsl:for-each>
1873
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
1874
+ <xsl:param name="always"/>
1875
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
1876
+ <xsl:call-template name="processTables_Contents"/>
1877
+ </xsl:if>
1878
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
1879
+ <xsl:call-template name="processFigures_Contents"/>
1880
+ </xsl:if>
1881
+ </xsl:template><xsl:template name="processTables_Contents">
1882
+ <tables>
1883
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1884
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
1885
+ <xsl:copy-of select="*[local-name() = 'name']"/>
1886
+ </table>
1887
+ </xsl:for-each>
1888
+ </tables>
1889
+ </xsl:template><xsl:template name="processFigures_Contents">
1890
+ <figures>
1891
+ <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ') and normalize-space(@id) != '']">
1892
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
1893
+ <xsl:copy-of select="*[local-name() = 'name']"/>
1894
+ </figure>
1895
+ </xsl:for-each>
1896
+ </figures>
1793
1897
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1794
1898
  <xsl:for-each select="/*/*[local-name()='preface']/*">
1795
1899
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -2568,37 +2672,7 @@
2568
2672
 
2569
2673
  <!-- list of footnotes to calculate actual footnotes number -->
2570
2674
  <xsl:variable name="p_fn_">
2571
- <xsl:choose>
2572
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2573
- <fn gen_id="{generate-id(.)}">
2574
- <xsl:copy-of select="@*"/>
2575
- <xsl:copy-of select="node()"/>
2576
- </fn>
2577
- </xsl:when>
2578
- <xsl:otherwise>
2579
- <!-- itetation for:
2580
- footnotes in bibdata/title
2581
- footnotes in bibliography
2582
- footnotes in document's body (except table's head/body/foot and figure text)
2583
- -->
2584
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2585
- <fn gen_id="{generate-id(.)}">
2586
- <xsl:copy-of select="@*"/>
2587
- <xsl:copy-of select="node()"/>
2588
- </fn>
2589
- </xsl:for-each>
2590
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
2591
- <xsl:sort select="@displayorder" data-type="number"/>
2592
- <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
2593
- <!-- copy unique fn -->
2594
- <fn gen_id="{generate-id(.)}">
2595
- <xsl:copy-of select="@*"/>
2596
- <xsl:copy-of select="node()"/>
2597
- </fn>
2598
- </xsl:for-each>
2599
- </xsl:for-each>
2600
- </xsl:otherwise>
2601
- </xsl:choose>
2675
+ <xsl:call-template name="get_fn_list"/>
2602
2676
  </xsl:variable>
2603
2677
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2604
2678
 
@@ -2659,6 +2733,38 @@
2659
2733
  <xsl:copy-of select="$footnote_inline"/>
2660
2734
  </xsl:otherwise>
2661
2735
  </xsl:choose>
2736
+ </xsl:template><xsl:template name="get_fn_list">
2737
+ <xsl:choose>
2738
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2739
+ <fn gen_id="{generate-id(.)}">
2740
+ <xsl:copy-of select="@*"/>
2741
+ <xsl:copy-of select="node()"/>
2742
+ </fn>
2743
+ </xsl:when>
2744
+ <xsl:otherwise>
2745
+ <!-- itetation for:
2746
+ footnotes in bibdata/title
2747
+ footnotes in bibliography
2748
+ footnotes in document's body (except table's head/body/foot and figure text)
2749
+ -->
2750
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2751
+ <fn gen_id="{generate-id(.)}">
2752
+ <xsl:copy-of select="@*"/>
2753
+ <xsl:copy-of select="node()"/>
2754
+ </fn>
2755
+ </xsl:for-each>
2756
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
2757
+ <xsl:sort select="@displayorder" data-type="number"/>
2758
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
2759
+ <!-- copy unique fn -->
2760
+ <fn gen_id="{generate-id(.)}">
2761
+ <xsl:copy-of select="@*"/>
2762
+ <xsl:copy-of select="node()"/>
2763
+ </fn>
2764
+ </xsl:for-each>
2765
+ </xsl:for-each>
2766
+ </xsl:otherwise>
2767
+ </xsl:choose>
2662
2768
  </xsl:template><xsl:template name="table_fn_display">
2663
2769
  <xsl:variable name="references">
2664
2770
 
@@ -2830,7 +2936,7 @@
2830
2936
  </fo:inline>
2831
2937
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2832
2938
  <fo:inline><xsl:value-of select="."/></fo:inline>
2833
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2939
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
2834
2940
  <fo:inline>
2835
2941
  <xsl:apply-templates/>
2836
2942
  </fo:inline>
@@ -4516,13 +4622,14 @@
4516
4622
  <xsl:apply-templates mode="bookmarks"/>
4517
4623
  </xsl:template><xsl:template name="addBookmarks">
4518
4624
  <xsl:param name="contents"/>
4519
- <xsl:if test="xalan:nodeset($contents)//item">
4625
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4626
+ <xsl:if test="$contents_nodes//item">
4520
4627
  <fo:bookmark-tree>
4521
4628
  <xsl:choose>
4522
- <xsl:when test="xalan:nodeset($contents)/doc">
4629
+ <xsl:when test="$contents_nodes/doc">
4523
4630
  <xsl:choose>
4524
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4525
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4631
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
4632
+ <xsl:for-each select="$contents_nodes/doc">
4526
4633
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4527
4634
  <xsl:if test="@bundle = 'true'">
4528
4635
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -4573,7 +4680,7 @@
4573
4680
  </xsl:for-each>
4574
4681
  </xsl:when>
4575
4682
  <xsl:otherwise>
4576
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4683
+ <xsl:for-each select="$contents_nodes/doc">
4577
4684
 
4578
4685
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4579
4686
 
@@ -4591,25 +4698,36 @@
4591
4698
  </xsl:choose>
4592
4699
  </xsl:when>
4593
4700
  <xsl:otherwise>
4594
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
4701
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
4702
+
4703
+ <xsl:call-template name="insertFigureBookmarks">
4704
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
4705
+ </xsl:call-template>
4706
+
4707
+ <xsl:call-template name="insertTableBookmarks">
4708
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
4709
+ <xsl:with-param name="lang" select="@lang"/>
4710
+ </xsl:call-template>
4711
+
4595
4712
  </xsl:otherwise>
4596
4713
  </xsl:choose>
4597
4714
 
4715
+
4598
4716
 
4599
4717
 
4600
4718
 
4601
4719
 
4602
-
4603
-
4720
+
4604
4721
 
4605
4722
  </fo:bookmark-tree>
4606
4723
  </xsl:if>
4607
4724
  </xsl:template><xsl:template name="insertFigureBookmarks">
4608
4725
  <xsl:param name="contents"/>
4609
- <xsl:if test="xalan:nodeset($contents)/figure">
4610
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
4726
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4727
+ <xsl:if test="$contents_nodes/figure">
4728
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
4611
4729
  <fo:bookmark-title>Figures</fo:bookmark-title>
4612
- <xsl:for-each select="xalan:nodeset($contents)/figure">
4730
+ <xsl:for-each select="$contents_nodes/figure">
4613
4731
  <fo:bookmark internal-destination="{@id}">
4614
4732
  <fo:bookmark-title>
4615
4733
  <xsl:value-of select="normalize-space(title)"/>
@@ -4618,18 +4736,40 @@
4618
4736
  </xsl:for-each>
4619
4737
  </fo:bookmark>
4620
4738
  </xsl:if>
4739
+
4740
+
4741
+ <xsl:if test="$contents_nodes//figures/figure">
4742
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
4743
+
4744
+
4745
+
4746
+ <xsl:variable name="bookmark-title">
4747
+
4748
+ <xsl:value-of select="$title-list-figures"/>
4749
+
4750
+ </xsl:variable>
4751
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
4752
+ <xsl:for-each select="$contents_nodes//figures/figure">
4753
+ <fo:bookmark internal-destination="{@id}">
4754
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
4755
+ </fo:bookmark>
4756
+ </xsl:for-each>
4757
+ </fo:bookmark>
4758
+ </xsl:if>
4759
+
4621
4760
  </xsl:template><xsl:template name="insertTableBookmarks">
4622
4761
  <xsl:param name="contents"/>
4623
4762
  <xsl:param name="lang"/>
4624
- <xsl:if test="xalan:nodeset($contents)/table">
4625
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
4763
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4764
+ <xsl:if test="$contents_nodes/table">
4765
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
4626
4766
  <fo:bookmark-title>
4627
4767
  <xsl:choose>
4628
4768
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4629
4769
  <xsl:otherwise>Tables</xsl:otherwise>
4630
4770
  </xsl:choose>
4631
4771
  </fo:bookmark-title>
4632
- <xsl:for-each select="xalan:nodeset($contents)/table">
4772
+ <xsl:for-each select="$contents_nodes/table">
4633
4773
  <fo:bookmark internal-destination="{@id}">
4634
4774
  <fo:bookmark-title>
4635
4775
  <xsl:value-of select="normalize-space(title)"/>
@@ -4638,6 +4778,29 @@
4638
4778
  </xsl:for-each>
4639
4779
  </fo:bookmark>
4640
4780
  </xsl:if>
4781
+
4782
+
4783
+ <xsl:if test="$contents_nodes//tables/table">
4784
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
4785
+
4786
+
4787
+
4788
+ <xsl:variable name="bookmark-title">
4789
+
4790
+ <xsl:value-of select="$title-list-tables"/>
4791
+
4792
+ </xsl:variable>
4793
+
4794
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
4795
+
4796
+ <xsl:for-each select="$contents_nodes//tables/table">
4797
+ <fo:bookmark internal-destination="{@id}">
4798
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
4799
+ </fo:bookmark>
4800
+ </xsl:for-each>
4801
+ </fo:bookmark>
4802
+ </xsl:if>
4803
+
4641
4804
  </xsl:template><xsl:template name="getLangVersion">
4642
4805
  <xsl:param name="lang"/>
4643
4806
  <xsl:param name="doctype" select="''"/>
@@ -5294,6 +5457,8 @@
5294
5457
  </xsl:otherwise>
5295
5458
  </xsl:choose> -->
5296
5459
  </fo:block>
5460
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5461
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5297
5462
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5298
5463
  <xsl:if test="normalize-space() != ''">
5299
5464
  <xsl:value-of select="."/>
@@ -5368,26 +5533,11 @@
5368
5533
  </xsl:template><xsl:template match="*[local-name() = 'author']">
5369
5534
  <xsl:text>— </xsl:text>
5370
5535
  <xsl:apply-templates/>
5371
- </xsl:template><xsl:variable name="bibitem_hidden_">
5372
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
5373
- <xsl:copy-of select="."/>
5374
- </xsl:for-each>
5375
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
5376
- <xsl:copy-of select="."/>
5377
- </xsl:for-each>
5378
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
5379
-
5380
- <xsl:variable name="bibitemid">
5381
- <xsl:choose>
5382
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
5383
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
5384
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5385
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5386
- </xsl:choose>
5387
- </xsl:variable>
5388
-
5536
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
5537
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
5538
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
5389
5539
  <xsl:choose>
5390
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
5540
+ <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5391
5541
  <fo:inline xsl:use-attribute-sets="eref-style">
5392
5542
  <xsl:if test="@type = 'footnote'">
5393
5543
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -5401,8 +5551,8 @@
5401
5551
  <xsl:variable name="text" select="normalize-space()"/>
5402
5552
 
5403
5553
 
5404
-
5405
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5554
+
5555
+ <fo:basic-link fox:alt-text="{@citeas}">
5406
5556
  <xsl:if test="normalize-space(@citeas) = ''">
5407
5557
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5408
5558
  </xsl:if>
@@ -5415,14 +5565,21 @@
5415
5565
 
5416
5566
  </xsl:if>
5417
5567
 
5418
-
5568
+ <xsl:choose>
5569
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
5570
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
5571
+ </xsl:when>
5572
+ <xsl:otherwise>
5573
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5574
+ </xsl:otherwise>
5575
+ </xsl:choose>
5419
5576
 
5420
5577
  <xsl:apply-templates/>
5421
5578
  </fo:basic-link>
5422
-
5579
+
5423
5580
  </fo:inline>
5424
5581
  </xsl:when>
5425
- <xsl:otherwise>
5582
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5426
5583
  <fo:inline><xsl:apply-templates/></fo:inline>
5427
5584
  </xsl:otherwise>
5428
5585
  </xsl:choose>
@@ -6158,6 +6315,24 @@
6158
6315
  <xsl:apply-templates/>
6159
6316
  </fo:inline>
6160
6317
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
6318
+
6319
+ <!-- list of footnotes to calculate actual footnotes number -->
6320
+ <xsl:variable name="p_fn_">
6321
+ <xsl:call-template name="get_fn_list"/>
6322
+ </xsl:variable>
6323
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
6324
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
6325
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
6326
+ <!-- fn sequence number in document -->
6327
+ <xsl:variable name="current_fn_number">
6328
+ <xsl:choose>
6329
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
6330
+ <xsl:otherwise>
6331
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
6332
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
6333
+ </xsl:otherwise>
6334
+ </xsl:choose>
6335
+ </xsl:variable>
6161
6336
  <fo:footnote>
6162
6337
  <xsl:variable name="number">
6163
6338
 
@@ -6166,22 +6341,26 @@
6166
6341
  <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6167
6342
  </xsl:when>
6168
6343
  <xsl:otherwise>
6169
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6344
+ <xsl:value-of select="$current_fn_number"/>
6170
6345
  </xsl:otherwise>
6171
6346
  </xsl:choose>
6172
6347
 
6173
6348
  </xsl:variable>
6349
+
6350
+ <xsl:variable name="current_fn_number_text">
6351
+ <xsl:value-of select="$number"/>
6352
+
6353
+ </xsl:variable>
6354
+
6174
6355
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
6175
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
6176
- <xsl:value-of select="$number"/>
6177
-
6356
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
6357
+ <xsl:value-of select="$current_fn_number_text"/>
6178
6358
  </fo:basic-link>
6179
6359
  </fo:inline>
6180
6360
  <fo:footnote-body>
6181
6361
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
6182
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6183
- <xsl:value-of select="$number"/>
6184
-
6362
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6363
+ <xsl:value-of select="$current_fn_number_text"/>
6185
6364
  </fo:inline>
6186
6365
  <xsl:apply-templates/>
6187
6366
  </fo:block>
@@ -6421,6 +6600,78 @@
6421
6600
  <xsl:apply-templates/>
6422
6601
  </fo:block>
6423
6602
 
6603
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
6604
+ <xsl:copy>
6605
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
6606
+ </xsl:copy>
6607
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
6608
+ <xsl:copy>
6609
+ <xsl:copy-of select="@*"/>
6610
+
6611
+ <xsl:variable name="nodes_preface_">
6612
+ <xsl:for-each select="*">
6613
+ <node id="{@id}"/>
6614
+ </xsl:for-each>
6615
+ </xsl:variable>
6616
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
6617
+
6618
+ <xsl:for-each select="*">
6619
+ <xsl:sort select="@displayorder" data-type="number"/>
6620
+
6621
+ <!-- process Section's title -->
6622
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
6623
+ <xsl:if test="$preceding-sibling_id != ''">
6624
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
6625
+ </xsl:if>
6626
+
6627
+ <xsl:choose>
6628
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
6629
+ <xsl:otherwise>
6630
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6631
+ </xsl:otherwise>
6632
+ </xsl:choose>
6633
+
6634
+ </xsl:for-each>
6635
+ </xsl:copy>
6636
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
6637
+ <xsl:copy>
6638
+ <xsl:copy-of select="@*"/>
6639
+
6640
+ <xsl:variable name="nodes_sections_">
6641
+ <xsl:for-each select="*">
6642
+ <node id="{@id}"/>
6643
+ </xsl:for-each>
6644
+ </xsl:variable>
6645
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
6646
+
6647
+ <!-- move section 'Normative references' inside 'sections' -->
6648
+ <xsl:for-each select="* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
6649
+ <xsl:sort select="@displayorder" data-type="number"/>
6650
+
6651
+ <!-- process Section's title -->
6652
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
6653
+ <xsl:if test="$preceding-sibling_id != ''">
6654
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
6655
+ </xsl:if>
6656
+
6657
+ <xsl:choose>
6658
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
6659
+ <xsl:otherwise>
6660
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6661
+ </xsl:otherwise>
6662
+ </xsl:choose>
6663
+
6664
+ </xsl:for-each>
6665
+ </xsl:copy>
6666
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
6667
+ <xsl:copy>
6668
+ <xsl:copy-of select="@*"/>
6669
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
6670
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
6671
+ <xsl:sort select="@displayorder" data-type="number"/>
6672
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6673
+ </xsl:for-each>
6674
+ </xsl:copy>
6424
6675
  </xsl:template><xsl:template name="convertDate">
6425
6676
  <xsl:param name="date"/>
6426
6677
  <xsl:param name="format" select="'short'"/>
@@ -844,6 +844,26 @@ p.Tablebody, li.Tablebody, div.Tablebody {
844
844
  mso-bidi-font-family: {{bodyfont}};
845
845
  mso-ansi-language: EN-GB; }
846
846
 
847
+ p.TOCTitle, li.TOCTitle, div.TOCTitle {
848
+ mso-style-name: "TOC Title";
849
+ mso-style-unhide: no;
850
+ margin-top: 0in;
851
+ margin-right: 0in;
852
+ margin-bottom: {{normalfontsize}};
853
+ margin-left: 0in;
854
+ text-align: left;
855
+ page-break-after: avoid;
856
+ mso-pagination: none;
857
+ mso-hyphenate: none;
858
+ mso-layout-grid-align: none;
859
+ font-size: {{normalfontsize}};
860
+ mso-bidi-font-size: 10.0pt;
861
+ font-weight: bold;
862
+ font-family: {{headerfont}};
863
+ mso-fareast-font-family: {{headerfont}};
864
+ mso-bidi-font-family: {{headerfont}};
865
+ mso-fareast-language: EN-US; }
866
+
847
867
  /* Page Definitions */
848
868
  @page {
849
869
  size: 612.0pt 792.0pt;
@@ -793,6 +793,25 @@ p.Tablebody, li.Tablebody, div.Tablebody
793
793
  mso-fareast-font-family:$bodyfont;
794
794
  mso-bidi-font-family:$bodyfont;
795
795
  mso-ansi-language:EN-GB;}
796
+ p.TOCTitle, li.TOCTitle, div.TOCTitle
797
+ {mso-style-name:"TOC Title";
798
+ mso-style-unhide:no;
799
+ margin-top:0in;
800
+ margin-right:0in;
801
+ margin-bottom:$normalfontsize;
802
+ margin-left:0in;
803
+ text-align:left;
804
+ page-break-after:avoid;
805
+ mso-pagination:none;
806
+ mso-hyphenate:none;
807
+ mso-layout-grid-align:none;
808
+ font-size:$normalfontsize;
809
+ mso-bidi-font-size:10.0pt;
810
+ font-weight:bold;
811
+ font-family:$headerfont;
812
+ mso-fareast-font-family:$headerfont;
813
+ mso-bidi-font-family:$headerfont;
814
+ mso-fareast-language:EN-US;}
796
815
 
797
816
 
798
817
  /* Page Definitions */
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.0.4".freeze
3
+ VERSION = "2.0.5".freeze
4
4
  end
5
5
  end
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.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-21 00:00:00.000000000 Z
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic