metanorma-un 0.7.3 → 0.7.4

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: d22d2a2819fa74b365c8052975abb0dfc2af24f2b1c5cdac9883800b211de3e7
4
- data.tar.gz: 80d427b92261fd22e98e680d57f513ad13aa21e232e90db2c8ce42d77a3a661e
3
+ metadata.gz: ccaa87ab379c84d4d55870a2d11b39c373988215c8968bcddea4d6e3a419a2dd
4
+ data.tar.gz: 36d71cf8e66d7a05ee9972aecd2fc870fdb263e91eee5e7972344a1db786f000
5
5
  SHA512:
6
- metadata.gz: d9f251ee7f43bc0e1b493db91b38b87127612c2f35a4667df0e51d89f662aba17b732adfd86ea5fab8510a329e6822c8c766fca3b276c9addd77cf70d9056bdc
7
- data.tar.gz: 4525ece9666d7b3673bbb5996db9b6f68fae3dc2c61f274a23631cab587af43b4eb10584052ecfbd686466ca4293294f4341d2bab95d24afe8c935799a996742
6
+ metadata.gz: e5ce088a501262889e1357d6fb6475f060ecd79400f7f7de3e6fa0636b5fd8f8de019a13c6f6038ea0903ba6986688712d423f1c221f1d00553a0c621520ee25
7
+ data.tar.gz: 1135d540fdfc8bb6df1ff040874ff024c5d29b033a677660f3bf97bd6219ae4b1749072fb8bd433b13bb3d85c3352a2bbbfef3d27f37cedf3d996ad023c48fdf
@@ -169,7 +169,7 @@ module Asciidoctor
169
169
  def pdf_converter(node)
170
170
  return nil if node.attr("no-pdf")
171
171
 
172
- IsoDoc::UN::PdfConvert.new(doc_extract_attributes(node))
172
+ IsoDoc::UN::PdfConvert.new(pdf_extract_attributes(node))
173
173
  end
174
174
 
175
175
  def sections_cleanup(xmldoc)
@@ -1796,6 +1796,20 @@
1796
1796
  <data type="ID"/>
1797
1797
  </attribute>
1798
1798
  </optional>
1799
+ <optional>
1800
+ <attribute name="language"/>
1801
+ </optional>
1802
+ <optional>
1803
+ <attribute name="script"/>
1804
+ </optional>
1805
+ <optional>
1806
+ <attribute name="tag"/>
1807
+ </optional>
1808
+ <optional>
1809
+ <attribute name="multilingual-rendering">
1810
+ <ref name="MultilingualRenderingType"/>
1811
+ </attribute>
1812
+ </optional>
1799
1813
  <oneOrMore>
1800
1814
  <ref name="preferred"/>
1801
1815
  </oneOrMore>
@@ -17,7 +17,6 @@ $('#toggle').on('click', function(){
17
17
  else {
18
18
  $('nav').show();
19
19
  $('nav').animate({ 'left': '0px' }, 'slow');
20
- $('.container').animate({ 'padding-left': '360px' }, 'slow');
21
20
  }
22
21
  });
23
22
  </script>
@@ -7,6 +7,8 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
+
10
12
 
11
13
 
12
14
 
@@ -337,7 +339,7 @@
337
339
 
338
340
  <xsl:variable name="display">
339
341
  <xsl:choose>
340
- <xsl:when test="$level &gt; 3">false</xsl:when>
342
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
341
343
  <xsl:otherwise>true</xsl:otherwise>
342
344
  </xsl:choose>
343
345
  </xsl:variable>
@@ -553,31 +555,6 @@
553
555
  </xsl:template>
554
556
 
555
557
 
556
- <xsl:template match="un:title/un:fn | un:p/un:fn[not(ancestor::un:table)] | un:figure/un:name/un:fn" priority="2">
557
- <fo:footnote keep-with-previous.within-line="always">
558
- <xsl:variable name="number">
559
- <xsl:number level="any" count="un:fn[not(ancestor::un:table)]"/>
560
- </xsl:variable>
561
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
562
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
563
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
564
- </fo:basic-link>
565
- </fo:inline>
566
- <fo:footnote-body>
567
- <fo:block-container margin-left="-8mm">
568
- <fo:block font-size="9pt" text-align="justify" line-height="125%" font-weight="normal" text-indent="0" margin-left="8mm">
569
- <fo:inline id="footnote_{@reference}_{$number}" font-size="60%" keep-with-next.within-line="always" vertical-align="super" padding-right="8mm"> <!-- alignment-baseline="hanging" -->
570
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
571
- </fo:inline>
572
- <xsl:for-each select="un:p">
573
- <xsl:apply-templates/>
574
- </xsl:for-each>
575
- </fo:block>
576
- </fo:block-container>
577
- </fo:footnote-body>
578
- </fo:footnote>
579
- </xsl:template>
580
-
581
558
  <xsl:template match="un:fn/un:p">
582
559
  <fo:block>
583
560
  <xsl:apply-templates/>
@@ -1645,6 +1622,80 @@
1645
1622
 
1646
1623
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1647
1624
  <xsl:attribute name="line-height">135%</xsl:attribute>
1625
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1626
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1627
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1628
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1629
+
1630
+
1631
+
1632
+
1633
+
1634
+
1635
+
1636
+
1637
+
1638
+
1639
+
1640
+
1641
+
1642
+
1643
+
1644
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1645
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1646
+
1647
+
1648
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1649
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1650
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1651
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1652
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1653
+
1654
+
1655
+
1656
+
1657
+
1658
+
1659
+
1660
+
1661
+
1662
+
1663
+
1664
+
1665
+
1666
+
1667
+
1668
+
1669
+
1670
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1671
+ <xsl:attribute name="text-align">justify</xsl:attribute>
1672
+ <xsl:attribute name="line-height">125%</xsl:attribute>
1673
+ <xsl:attribute name="margin-left">8mm</xsl:attribute>
1674
+
1675
+
1676
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1677
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1678
+
1679
+
1680
+
1681
+
1682
+
1683
+
1684
+
1685
+
1686
+
1687
+
1688
+
1689
+
1690
+
1691
+
1692
+
1693
+
1694
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1695
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1696
+ <xsl:attribute name="padding-right">8mm</xsl:attribute>
1697
+
1698
+
1648
1699
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1649
1700
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1650
1701
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2614,6 +2665,104 @@
2614
2665
 
2615
2666
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2616
2667
  <xsl:apply-templates/>
2668
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
2669
+
2670
+ <!-- list of footnotes to calculate actual footnotes number -->
2671
+ <xsl:variable name="p_fn_">
2672
+ <xsl:choose>
2673
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2674
+ <fn gen_id="{generate-id(.)}">
2675
+ <xsl:copy-of select="@*"/>
2676
+ <xsl:copy-of select="node()"/>
2677
+ </fn>
2678
+ </xsl:when>
2679
+ <xsl:otherwise>
2680
+ <!-- itetation for:
2681
+ footnotes in bibdata/title
2682
+ footnotes in bibliography
2683
+ footnotes in document's body (except table's head/body/foot and figure text)
2684
+ -->
2685
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2686
+ <fn gen_id="{generate-id(.)}">
2687
+ <xsl:copy-of select="@*"/>
2688
+ <xsl:copy-of select="node()"/>
2689
+ </fn>
2690
+ </xsl:for-each>
2691
+ <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']/*">
2692
+ <xsl:sort select="@displayorder" data-type="number"/>
2693
+ <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])]">
2694
+ <!-- copy unique fn -->
2695
+ <fn gen_id="{generate-id(.)}">
2696
+ <xsl:copy-of select="@*"/>
2697
+ <xsl:copy-of select="node()"/>
2698
+ </fn>
2699
+ </xsl:for-each>
2700
+ </xsl:for-each>
2701
+ </xsl:otherwise>
2702
+ </xsl:choose>
2703
+ </xsl:variable>
2704
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2705
+
2706
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2707
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2708
+ <xsl:variable name="reference" select="@reference"/>
2709
+ <!-- fn sequence number in document -->
2710
+ <xsl:variable name="current_fn_number">
2711
+ <xsl:choose>
2712
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2713
+ <xsl:otherwise>
2714
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2715
+ </xsl:otherwise>
2716
+ </xsl:choose>
2717
+ </xsl:variable>
2718
+ <xsl:variable name="current_fn_number_text">
2719
+ <xsl:value-of select="$current_fn_number"/>
2720
+
2721
+
2722
+ </xsl:variable>
2723
+
2724
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2725
+ <xsl:variable name="footnote_inline">
2726
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2727
+
2728
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2729
+ <xsl:value-of select="$current_fn_number_text"/>
2730
+ </fo:basic-link>
2731
+ </fo:inline>
2732
+ </xsl:variable>
2733
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2734
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2735
+ <xsl:choose>
2736
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2737
+ <xsl:copy-of select="$footnote_inline"/>
2738
+ </xsl:when>
2739
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2740
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2741
+ <xsl:copy-of select="$footnote_inline"/>
2742
+ <fo:footnote-body>
2743
+
2744
+ <fo:block-container text-indent="0" start-indent="0">
2745
+
2746
+
2747
+ <xsl:attribute name="margin-left">-8mm</xsl:attribute>
2748
+
2749
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2750
+
2751
+
2752
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2753
+
2754
+ <xsl:value-of select="$current_fn_number_text"/>
2755
+ </fo:inline>
2756
+ <xsl:apply-templates/>
2757
+ </fo:block>
2758
+ </fo:block-container>
2759
+ </fo:footnote-body>
2760
+ </fo:footnote>
2761
+ </xsl:when>
2762
+ <xsl:otherwise>
2763
+ <xsl:copy-of select="$footnote_inline"/>
2764
+ </xsl:otherwise>
2765
+ </xsl:choose>
2617
2766
  </xsl:template><xsl:template name="fn_display">
2618
2767
  <xsl:variable name="references">
2619
2768
 
@@ -2806,6 +2955,8 @@
2806
2955
 
2807
2956
  </fo:basic-link>
2808
2957
  </fo:inline>
2958
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2959
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2809
2960
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2810
2961
  <fo:inline>
2811
2962
  <xsl:apply-templates/>
@@ -3796,22 +3947,6 @@
3796
3947
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3797
3948
  <xsl:apply-templates/>
3798
3949
  </fo:inline>
3799
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3800
- <xsl:variable name="title-modified">
3801
-
3802
-
3803
- <xsl:call-template name="getTitle">
3804
- <xsl:with-param name="name" select="'title-modified'"/>
3805
- </xsl:call-template>
3806
-
3807
- </xsl:variable>
3808
-
3809
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3810
- <xsl:choose>
3811
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3812
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3813
- </xsl:choose>
3814
- <xsl:apply-templates/>
3815
3950
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3816
3951
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3817
3952
 
@@ -5061,45 +5196,69 @@
5061
5196
  <xsl:variable name="termsource_text">
5062
5197
  <xsl:apply-templates/>
5063
5198
  </xsl:variable>
5064
-
5065
- <xsl:choose>
5199
+ <xsl:copy-of select="$termsource_text"/>
5200
+ <!-- <xsl:choose>
5066
5201
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5067
- <!-- <xsl:apply-templates /> -->
5068
5202
  <xsl:copy-of select="$termsource_text"/>
5069
5203
  </xsl:when>
5070
5204
  <xsl:otherwise>
5071
-
5072
-
5205
+ <xsl:if test="$namespace = 'bsi'">
5206
+ <xsl:choose>
5207
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
5208
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
5209
+ </xsl:choose>
5210
+ </xsl:if>
5211
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
5073
5212
  <xsl:text>[</xsl:text>
5074
-
5075
- <!-- <xsl:apply-templates /> -->
5213
+ </xsl:if>
5076
5214
  <xsl:copy-of select="$termsource_text"/>
5077
-
5078
-
5215
+ <xsl:if test="$namespace = 'bsi'">
5216
+ <xsl:choose>
5217
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
5218
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
5219
+ </xsl:choose>
5220
+ </xsl:if>
5221
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
5079
5222
  <xsl:text>]</xsl:text>
5080
-
5223
+ </xsl:if>
5081
5224
  </xsl:otherwise>
5082
- </xsl:choose>
5225
+ </xsl:choose> -->
5083
5226
  </fo:block>
5084
5227
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5085
5228
  <xsl:if test="normalize-space() != ''">
5086
5229
  <xsl:value-of select="."/>
5087
5230
  </xsl:if>
5088
- </xsl:template><xsl:variable name="localized.source">
5089
- <xsl:call-template name="getLocalizedString">
5090
- <xsl:with-param name="key">source</xsl:with-param>
5091
- </xsl:call-template>
5092
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5231
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
5232
+ <fo:inline>
5233
+
5234
+
5235
+ <xsl:value-of select="."/>
5236
+ </fo:inline>
5237
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
5093
5238
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5094
5239
  <xsl:if test="normalize-space(@citeas) = ''">
5095
5240
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5096
5241
  </xsl:if>
5097
-
5098
5242
  <fo:inline xsl:use-attribute-sets="origin-style">
5099
5243
  <xsl:apply-templates/>
5100
5244
  </fo:inline>
5245
+ </fo:basic-link>
5246
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5247
+ <xsl:variable name="title-modified">
5101
5248
 
5102
- </fo:basic-link>
5249
+
5250
+ <xsl:call-template name="getTitle">
5251
+ <xsl:with-param name="name" select="'title-modified'"/>
5252
+ </xsl:call-template>
5253
+
5254
+ </xsl:variable>
5255
+
5256
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5257
+ <xsl:choose>
5258
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
5259
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
5260
+ </xsl:choose>
5261
+ <xsl:apply-templates/>
5103
5262
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5104
5263
  <fo:inline><xsl:apply-templates/></fo:inline>
5105
5264
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5709,7 +5868,31 @@
5709
5868
  <fo:block-container border="1pt solid black" width="50%">
5710
5869
  <fo:block> </fo:block>
5711
5870
  </fo:block-container>
5712
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5871
+ </xsl:template><xsl:variable name="toc_level">
5872
+ <xsl:choose>
5873
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5874
+ <xsl:otherwise><!-- default value -->
5875
+
5876
+
5877
+
5878
+
5879
+
5880
+
5881
+
5882
+
5883
+
5884
+
5885
+
5886
+
5887
+
5888
+
5889
+
5890
+
5891
+ 3
5892
+
5893
+ </xsl:otherwise>
5894
+ </xsl:choose>
5895
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5713
5896
  <xsl:param name="colwidths"/>
5714
5897
  <xsl:variable name="colwidths_">
5715
5898
  <xsl:choose>
@@ -6349,4 +6532,14 @@
6349
6532
  </xsl:otherwise>
6350
6533
  </xsl:choose>
6351
6534
  </xsl:if>
6535
+ </xsl:template><xsl:template name="setAltText">
6536
+ <xsl:param name="value"/>
6537
+ <xsl:attribute name="fox:alt-text">
6538
+ <xsl:choose>
6539
+ <xsl:when test="normalize-space($value) != ''">
6540
+ <xsl:value-of select="$value"/>
6541
+ </xsl:when>
6542
+ <xsl:otherwise>_</xsl:otherwise>
6543
+ </xsl:choose>
6544
+ </xsl:attribute>
6352
6545
  </xsl:template></xsl:stylesheet>
@@ -7,6 +7,8 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
+
10
12
 
11
13
 
12
14
 
@@ -337,7 +339,7 @@
337
339
 
338
340
  <xsl:variable name="display">
339
341
  <xsl:choose>
340
- <xsl:when test="$level &gt; 3">false</xsl:when>
342
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
341
343
  <xsl:otherwise>true</xsl:otherwise>
342
344
  </xsl:choose>
343
345
  </xsl:variable>
@@ -553,31 +555,6 @@
553
555
  </xsl:template>
554
556
 
555
557
 
556
- <xsl:template match="un:title/un:fn | un:p/un:fn[not(ancestor::un:table)] | un:figure/un:name/un:fn" priority="2">
557
- <fo:footnote keep-with-previous.within-line="always">
558
- <xsl:variable name="number">
559
- <xsl:number level="any" count="un:fn[not(ancestor::un:table)]"/>
560
- </xsl:variable>
561
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
562
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
563
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
564
- </fo:basic-link>
565
- </fo:inline>
566
- <fo:footnote-body>
567
- <fo:block-container margin-left="-8mm">
568
- <fo:block font-size="9pt" text-align="justify" line-height="125%" font-weight="normal" text-indent="0" margin-left="8mm">
569
- <fo:inline id="footnote_{@reference}_{$number}" font-size="60%" keep-with-next.within-line="always" vertical-align="super" padding-right="8mm"> <!-- alignment-baseline="hanging" -->
570
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
571
- </fo:inline>
572
- <xsl:for-each select="un:p">
573
- <xsl:apply-templates/>
574
- </xsl:for-each>
575
- </fo:block>
576
- </fo:block-container>
577
- </fo:footnote-body>
578
- </fo:footnote>
579
- </xsl:template>
580
-
581
558
  <xsl:template match="un:fn/un:p">
582
559
  <fo:block>
583
560
  <xsl:apply-templates/>
@@ -1645,6 +1622,80 @@
1645
1622
 
1646
1623
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1647
1624
  <xsl:attribute name="line-height">135%</xsl:attribute>
1625
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1626
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1627
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1628
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1629
+
1630
+
1631
+
1632
+
1633
+
1634
+
1635
+
1636
+
1637
+
1638
+
1639
+
1640
+
1641
+
1642
+
1643
+
1644
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1645
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1646
+
1647
+
1648
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1649
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1650
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1651
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1652
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1653
+
1654
+
1655
+
1656
+
1657
+
1658
+
1659
+
1660
+
1661
+
1662
+
1663
+
1664
+
1665
+
1666
+
1667
+
1668
+
1669
+
1670
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1671
+ <xsl:attribute name="text-align">justify</xsl:attribute>
1672
+ <xsl:attribute name="line-height">125%</xsl:attribute>
1673
+ <xsl:attribute name="margin-left">8mm</xsl:attribute>
1674
+
1675
+
1676
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1677
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1678
+
1679
+
1680
+
1681
+
1682
+
1683
+
1684
+
1685
+
1686
+
1687
+
1688
+
1689
+
1690
+
1691
+
1692
+
1693
+
1694
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1695
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1696
+ <xsl:attribute name="padding-right">8mm</xsl:attribute>
1697
+
1698
+
1648
1699
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1649
1700
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1650
1701
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2614,6 +2665,104 @@
2614
2665
 
2615
2666
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2616
2667
  <xsl:apply-templates/>
2668
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
2669
+
2670
+ <!-- list of footnotes to calculate actual footnotes number -->
2671
+ <xsl:variable name="p_fn_">
2672
+ <xsl:choose>
2673
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2674
+ <fn gen_id="{generate-id(.)}">
2675
+ <xsl:copy-of select="@*"/>
2676
+ <xsl:copy-of select="node()"/>
2677
+ </fn>
2678
+ </xsl:when>
2679
+ <xsl:otherwise>
2680
+ <!-- itetation for:
2681
+ footnotes in bibdata/title
2682
+ footnotes in bibliography
2683
+ footnotes in document's body (except table's head/body/foot and figure text)
2684
+ -->
2685
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2686
+ <fn gen_id="{generate-id(.)}">
2687
+ <xsl:copy-of select="@*"/>
2688
+ <xsl:copy-of select="node()"/>
2689
+ </fn>
2690
+ </xsl:for-each>
2691
+ <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']/*">
2692
+ <xsl:sort select="@displayorder" data-type="number"/>
2693
+ <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])]">
2694
+ <!-- copy unique fn -->
2695
+ <fn gen_id="{generate-id(.)}">
2696
+ <xsl:copy-of select="@*"/>
2697
+ <xsl:copy-of select="node()"/>
2698
+ </fn>
2699
+ </xsl:for-each>
2700
+ </xsl:for-each>
2701
+ </xsl:otherwise>
2702
+ </xsl:choose>
2703
+ </xsl:variable>
2704
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2705
+
2706
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2707
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2708
+ <xsl:variable name="reference" select="@reference"/>
2709
+ <!-- fn sequence number in document -->
2710
+ <xsl:variable name="current_fn_number">
2711
+ <xsl:choose>
2712
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2713
+ <xsl:otherwise>
2714
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2715
+ </xsl:otherwise>
2716
+ </xsl:choose>
2717
+ </xsl:variable>
2718
+ <xsl:variable name="current_fn_number_text">
2719
+ <xsl:value-of select="$current_fn_number"/>
2720
+
2721
+
2722
+ </xsl:variable>
2723
+
2724
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2725
+ <xsl:variable name="footnote_inline">
2726
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2727
+
2728
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2729
+ <xsl:value-of select="$current_fn_number_text"/>
2730
+ </fo:basic-link>
2731
+ </fo:inline>
2732
+ </xsl:variable>
2733
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2734
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2735
+ <xsl:choose>
2736
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2737
+ <xsl:copy-of select="$footnote_inline"/>
2738
+ </xsl:when>
2739
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2740
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2741
+ <xsl:copy-of select="$footnote_inline"/>
2742
+ <fo:footnote-body>
2743
+
2744
+ <fo:block-container text-indent="0" start-indent="0">
2745
+
2746
+
2747
+ <xsl:attribute name="margin-left">-8mm</xsl:attribute>
2748
+
2749
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2750
+
2751
+
2752
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2753
+
2754
+ <xsl:value-of select="$current_fn_number_text"/>
2755
+ </fo:inline>
2756
+ <xsl:apply-templates/>
2757
+ </fo:block>
2758
+ </fo:block-container>
2759
+ </fo:footnote-body>
2760
+ </fo:footnote>
2761
+ </xsl:when>
2762
+ <xsl:otherwise>
2763
+ <xsl:copy-of select="$footnote_inline"/>
2764
+ </xsl:otherwise>
2765
+ </xsl:choose>
2617
2766
  </xsl:template><xsl:template name="fn_display">
2618
2767
  <xsl:variable name="references">
2619
2768
 
@@ -2806,6 +2955,8 @@
2806
2955
 
2807
2956
  </fo:basic-link>
2808
2957
  </fo:inline>
2958
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2959
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2809
2960
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2810
2961
  <fo:inline>
2811
2962
  <xsl:apply-templates/>
@@ -3796,22 +3947,6 @@
3796
3947
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3797
3948
  <xsl:apply-templates/>
3798
3949
  </fo:inline>
3799
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3800
- <xsl:variable name="title-modified">
3801
-
3802
-
3803
- <xsl:call-template name="getTitle">
3804
- <xsl:with-param name="name" select="'title-modified'"/>
3805
- </xsl:call-template>
3806
-
3807
- </xsl:variable>
3808
-
3809
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3810
- <xsl:choose>
3811
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3812
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3813
- </xsl:choose>
3814
- <xsl:apply-templates/>
3815
3950
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3816
3951
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3817
3952
 
@@ -5061,45 +5196,69 @@
5061
5196
  <xsl:variable name="termsource_text">
5062
5197
  <xsl:apply-templates/>
5063
5198
  </xsl:variable>
5064
-
5065
- <xsl:choose>
5199
+ <xsl:copy-of select="$termsource_text"/>
5200
+ <!-- <xsl:choose>
5066
5201
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5067
- <!-- <xsl:apply-templates /> -->
5068
5202
  <xsl:copy-of select="$termsource_text"/>
5069
5203
  </xsl:when>
5070
5204
  <xsl:otherwise>
5071
-
5072
-
5205
+ <xsl:if test="$namespace = 'bsi'">
5206
+ <xsl:choose>
5207
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
5208
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
5209
+ </xsl:choose>
5210
+ </xsl:if>
5211
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
5073
5212
  <xsl:text>[</xsl:text>
5074
-
5075
- <!-- <xsl:apply-templates /> -->
5213
+ </xsl:if>
5076
5214
  <xsl:copy-of select="$termsource_text"/>
5077
-
5078
-
5215
+ <xsl:if test="$namespace = 'bsi'">
5216
+ <xsl:choose>
5217
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
5218
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
5219
+ </xsl:choose>
5220
+ </xsl:if>
5221
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
5079
5222
  <xsl:text>]</xsl:text>
5080
-
5223
+ </xsl:if>
5081
5224
  </xsl:otherwise>
5082
- </xsl:choose>
5225
+ </xsl:choose> -->
5083
5226
  </fo:block>
5084
5227
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5085
5228
  <xsl:if test="normalize-space() != ''">
5086
5229
  <xsl:value-of select="."/>
5087
5230
  </xsl:if>
5088
- </xsl:template><xsl:variable name="localized.source">
5089
- <xsl:call-template name="getLocalizedString">
5090
- <xsl:with-param name="key">source</xsl:with-param>
5091
- </xsl:call-template>
5092
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5231
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
5232
+ <fo:inline>
5233
+
5234
+
5235
+ <xsl:value-of select="."/>
5236
+ </fo:inline>
5237
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
5093
5238
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5094
5239
  <xsl:if test="normalize-space(@citeas) = ''">
5095
5240
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5096
5241
  </xsl:if>
5097
-
5098
5242
  <fo:inline xsl:use-attribute-sets="origin-style">
5099
5243
  <xsl:apply-templates/>
5100
5244
  </fo:inline>
5245
+ </fo:basic-link>
5246
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5247
+ <xsl:variable name="title-modified">
5101
5248
 
5102
- </fo:basic-link>
5249
+
5250
+ <xsl:call-template name="getTitle">
5251
+ <xsl:with-param name="name" select="'title-modified'"/>
5252
+ </xsl:call-template>
5253
+
5254
+ </xsl:variable>
5255
+
5256
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5257
+ <xsl:choose>
5258
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
5259
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
5260
+ </xsl:choose>
5261
+ <xsl:apply-templates/>
5103
5262
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5104
5263
  <fo:inline><xsl:apply-templates/></fo:inline>
5105
5264
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5709,7 +5868,31 @@
5709
5868
  <fo:block-container border="1pt solid black" width="50%">
5710
5869
  <fo:block> </fo:block>
5711
5870
  </fo:block-container>
5712
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5871
+ </xsl:template><xsl:variable name="toc_level">
5872
+ <xsl:choose>
5873
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5874
+ <xsl:otherwise><!-- default value -->
5875
+
5876
+
5877
+
5878
+
5879
+
5880
+
5881
+
5882
+
5883
+
5884
+
5885
+
5886
+
5887
+
5888
+
5889
+
5890
+
5891
+ 3
5892
+
5893
+ </xsl:otherwise>
5894
+ </xsl:choose>
5895
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5713
5896
  <xsl:param name="colwidths"/>
5714
5897
  <xsl:variable name="colwidths_">
5715
5898
  <xsl:choose>
@@ -6349,4 +6532,14 @@
6349
6532
  </xsl:otherwise>
6350
6533
  </xsl:choose>
6351
6534
  </xsl:if>
6535
+ </xsl:template><xsl:template name="setAltText">
6536
+ <xsl:param name="value"/>
6537
+ <xsl:attribute name="fox:alt-text">
6538
+ <xsl:choose>
6539
+ <xsl:when test="normalize-space($value) != ''">
6540
+ <xsl:value-of select="$value"/>
6541
+ </xsl:when>
6542
+ <xsl:otherwise>_</xsl:otherwise>
6543
+ </xsl:choose>
6544
+ </xsl:attribute>
6352
6545
  </xsl:template></xsl:stylesheet>
@@ -7,6 +7,8 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
+
10
12
 
11
13
 
12
14
 
@@ -217,7 +219,7 @@
217
219
  <xsl:attribute name="margin-left">20mm</xsl:attribute>
218
220
  </xsl:if>
219
221
  <xsl:if test="@level &gt;= 3 and @section != ''">
220
- <xsl:attribute name="margin-left">28mm</xsl:attribute>
222
+ <xsl:attribute name="margin-left"><xsl:value-of select="(@level - 2) * 28"/>mm</xsl:attribute>
221
223
  </xsl:if>
222
224
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
223
225
  <xsl:if test="@section != ''">
@@ -362,7 +364,7 @@
362
364
  <xsl:variable name="display">
363
365
  <xsl:choose>
364
366
  <xsl:when test="ancestor-or-self::un:annex and $level &gt;= 2">false</xsl:when>
365
- <xsl:when test="$level &gt; 3">false</xsl:when>
367
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
366
368
  <xsl:when test="@inline-header='true'">false</xsl:when>
367
369
  <xsl:otherwise>true</xsl:otherwise>
368
370
  </xsl:choose>
@@ -593,31 +595,6 @@
593
595
  </fo:block>
594
596
  </xsl:template>
595
597
 
596
-
597
- <!-- un:fn[not(ancestor::un:un-standard)] means fn element in virtual variable $title -->
598
- <xsl:template match="un:title//un:fn | un:p/un:fn[not(ancestor::un:table)]" priority="2">
599
- <fo:footnote keep-with-previous.within-line="always">
600
- <xsl:variable name="number">
601
- <xsl:number level="any" count="un:fn[not(ancestor::un:table)]"/>
602
- </xsl:variable>
603
- <fo:inline font-size="55%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% -->
604
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
605
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
606
- </fo:basic-link>
607
- </fo:inline>
608
- <fo:footnote-body>
609
- <fo:block font-size="9pt" line-height="125%" font-weight="normal" text-indent="0">
610
- <fo:inline id="footnote_{@reference}_{$number}" font-size="60%" padding-right="1mm" keep-with-next.within-line="always" vertical-align="super"> <!-- alignment-baseline="hanging" -->
611
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
612
- </fo:inline>
613
- <xsl:for-each select="un:p">
614
- <xsl:apply-templates/>
615
- </xsl:for-each>
616
- </fo:block>
617
- </fo:footnote-body>
618
- </fo:footnote>
619
- </xsl:template>
620
-
621
598
  <xsl:template match="un:fn/un:p">
622
599
  <fo:block>
623
600
  <xsl:apply-templates/>
@@ -1603,6 +1580,78 @@
1603
1580
 
1604
1581
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1605
1582
  <xsl:attribute name="line-height">135%</xsl:attribute>
1583
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1584
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1585
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1586
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+ <xsl:attribute name="font-size">55%</xsl:attribute>
1604
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1605
+
1606
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1607
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1608
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1609
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1610
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1611
+
1612
+
1613
+
1614
+
1615
+
1616
+
1617
+
1618
+
1619
+
1620
+
1621
+
1622
+
1623
+
1624
+
1625
+
1626
+
1627
+
1628
+
1629
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1630
+ <xsl:attribute name="line-height">125%</xsl:attribute>
1631
+
1632
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1633
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1634
+
1635
+
1636
+
1637
+
1638
+
1639
+
1640
+
1641
+
1642
+
1643
+
1644
+
1645
+
1646
+
1647
+
1648
+
1649
+
1650
+
1651
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1652
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1653
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1654
+
1606
1655
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1607
1656
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1608
1657
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2577,6 +2626,102 @@
2577
2626
 
2578
2627
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2579
2628
  <xsl:apply-templates/>
2629
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
2630
+
2631
+ <!-- list of footnotes to calculate actual footnotes number -->
2632
+ <xsl:variable name="p_fn_">
2633
+ <xsl:choose>
2634
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2635
+ <fn gen_id="{generate-id(.)}">
2636
+ <xsl:copy-of select="@*"/>
2637
+ <xsl:copy-of select="node()"/>
2638
+ </fn>
2639
+ </xsl:when>
2640
+ <xsl:otherwise>
2641
+ <!-- itetation for:
2642
+ footnotes in bibdata/title
2643
+ footnotes in bibliography
2644
+ footnotes in document's body (except table's head/body/foot and figure text)
2645
+ -->
2646
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2647
+ <fn gen_id="{generate-id(.)}">
2648
+ <xsl:copy-of select="@*"/>
2649
+ <xsl:copy-of select="node()"/>
2650
+ </fn>
2651
+ </xsl:for-each>
2652
+ <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']/*">
2653
+ <xsl:sort select="@displayorder" data-type="number"/>
2654
+ <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])]">
2655
+ <!-- copy unique fn -->
2656
+ <fn gen_id="{generate-id(.)}">
2657
+ <xsl:copy-of select="@*"/>
2658
+ <xsl:copy-of select="node()"/>
2659
+ </fn>
2660
+ </xsl:for-each>
2661
+ </xsl:for-each>
2662
+ </xsl:otherwise>
2663
+ </xsl:choose>
2664
+ </xsl:variable>
2665
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2666
+
2667
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2668
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2669
+ <xsl:variable name="reference" select="@reference"/>
2670
+ <!-- fn sequence number in document -->
2671
+ <xsl:variable name="current_fn_number">
2672
+ <xsl:choose>
2673
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2674
+ <xsl:otherwise>
2675
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2676
+ </xsl:otherwise>
2677
+ </xsl:choose>
2678
+ </xsl:variable>
2679
+ <xsl:variable name="current_fn_number_text">
2680
+ <xsl:value-of select="$current_fn_number"/>
2681
+
2682
+
2683
+ </xsl:variable>
2684
+
2685
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2686
+ <xsl:variable name="footnote_inline">
2687
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2688
+
2689
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2690
+ <xsl:value-of select="$current_fn_number_text"/>
2691
+ </fo:basic-link>
2692
+ </fo:inline>
2693
+ </xsl:variable>
2694
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2695
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2696
+ <xsl:choose>
2697
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2698
+ <xsl:copy-of select="$footnote_inline"/>
2699
+ </xsl:when>
2700
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2701
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2702
+ <xsl:copy-of select="$footnote_inline"/>
2703
+ <fo:footnote-body>
2704
+
2705
+ <fo:block-container text-indent="0" start-indent="0">
2706
+
2707
+
2708
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2709
+
2710
+
2711
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2712
+
2713
+ <xsl:value-of select="$current_fn_number_text"/>
2714
+ </fo:inline>
2715
+ <xsl:apply-templates/>
2716
+ </fo:block>
2717
+ </fo:block-container>
2718
+ </fo:footnote-body>
2719
+ </fo:footnote>
2720
+ </xsl:when>
2721
+ <xsl:otherwise>
2722
+ <xsl:copy-of select="$footnote_inline"/>
2723
+ </xsl:otherwise>
2724
+ </xsl:choose>
2580
2725
  </xsl:template><xsl:template name="fn_display">
2581
2726
  <xsl:variable name="references">
2582
2727
 
@@ -2769,6 +2914,8 @@
2769
2914
 
2770
2915
  </fo:basic-link>
2771
2916
  </fo:inline>
2917
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2918
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2772
2919
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2773
2920
  <fo:inline>
2774
2921
  <xsl:apply-templates/>
@@ -3759,22 +3906,6 @@
3759
3906
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3760
3907
  <xsl:apply-templates/>
3761
3908
  </fo:inline>
3762
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3763
- <xsl:variable name="title-modified">
3764
-
3765
-
3766
- <xsl:call-template name="getTitle">
3767
- <xsl:with-param name="name" select="'title-modified'"/>
3768
- </xsl:call-template>
3769
-
3770
- </xsl:variable>
3771
-
3772
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3773
- <xsl:choose>
3774
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3775
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3776
- </xsl:choose>
3777
- <xsl:apply-templates/>
3778
3909
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3779
3910
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3780
3911
 
@@ -5033,45 +5164,69 @@
5033
5164
  <xsl:variable name="termsource_text">
5034
5165
  <xsl:apply-templates/>
5035
5166
  </xsl:variable>
5036
-
5037
- <xsl:choose>
5167
+ <xsl:copy-of select="$termsource_text"/>
5168
+ <!-- <xsl:choose>
5038
5169
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5039
- <!-- <xsl:apply-templates /> -->
5040
5170
  <xsl:copy-of select="$termsource_text"/>
5041
5171
  </xsl:when>
5042
5172
  <xsl:otherwise>
5043
-
5044
-
5173
+ <xsl:if test="$namespace = 'bsi'">
5174
+ <xsl:choose>
5175
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
5176
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
5177
+ </xsl:choose>
5178
+ </xsl:if>
5179
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
5045
5180
  <xsl:text>[</xsl:text>
5046
-
5047
- <!-- <xsl:apply-templates /> -->
5181
+ </xsl:if>
5048
5182
  <xsl:copy-of select="$termsource_text"/>
5049
-
5050
-
5183
+ <xsl:if test="$namespace = 'bsi'">
5184
+ <xsl:choose>
5185
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
5186
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
5187
+ </xsl:choose>
5188
+ </xsl:if>
5189
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
5051
5190
  <xsl:text>]</xsl:text>
5052
-
5191
+ </xsl:if>
5053
5192
  </xsl:otherwise>
5054
- </xsl:choose>
5193
+ </xsl:choose> -->
5055
5194
  </fo:block>
5056
5195
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5057
5196
  <xsl:if test="normalize-space() != ''">
5058
5197
  <xsl:value-of select="."/>
5059
5198
  </xsl:if>
5060
- </xsl:template><xsl:variable name="localized.source">
5061
- <xsl:call-template name="getLocalizedString">
5062
- <xsl:with-param name="key">source</xsl:with-param>
5063
- </xsl:call-template>
5064
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5199
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
5200
+ <fo:inline>
5201
+
5202
+
5203
+ <xsl:value-of select="."/>
5204
+ </fo:inline>
5205
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
5065
5206
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5066
5207
  <xsl:if test="normalize-space(@citeas) = ''">
5067
5208
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5068
5209
  </xsl:if>
5069
-
5070
5210
  <fo:inline xsl:use-attribute-sets="origin-style">
5071
5211
  <xsl:apply-templates/>
5072
5212
  </fo:inline>
5213
+ </fo:basic-link>
5214
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5215
+ <xsl:variable name="title-modified">
5073
5216
 
5074
- </fo:basic-link>
5217
+
5218
+ <xsl:call-template name="getTitle">
5219
+ <xsl:with-param name="name" select="'title-modified'"/>
5220
+ </xsl:call-template>
5221
+
5222
+ </xsl:variable>
5223
+
5224
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5225
+ <xsl:choose>
5226
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
5227
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
5228
+ </xsl:choose>
5229
+ <xsl:apply-templates/>
5075
5230
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5076
5231
  <fo:inline><xsl:apply-templates/></fo:inline>
5077
5232
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5681,7 +5836,31 @@
5681
5836
  <fo:block-container border="1pt solid black" width="50%">
5682
5837
  <fo:block> </fo:block>
5683
5838
  </fo:block-container>
5684
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5839
+ </xsl:template><xsl:variable name="toc_level">
5840
+ <xsl:choose>
5841
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5842
+ <xsl:otherwise><!-- default value -->
5843
+
5844
+
5845
+
5846
+
5847
+
5848
+
5849
+
5850
+
5851
+
5852
+
5853
+
5854
+
5855
+
5856
+
5857
+
5858
+
5859
+
5860
+ 3
5861
+ </xsl:otherwise>
5862
+ </xsl:choose>
5863
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5685
5864
  <xsl:param name="colwidths"/>
5686
5865
  <xsl:variable name="colwidths_">
5687
5866
  <xsl:choose>
@@ -6321,4 +6500,14 @@
6321
6500
  </xsl:otherwise>
6322
6501
  </xsl:choose>
6323
6502
  </xsl:if>
6503
+ </xsl:template><xsl:template name="setAltText">
6504
+ <xsl:param name="value"/>
6505
+ <xsl:attribute name="fox:alt-text">
6506
+ <xsl:choose>
6507
+ <xsl:when test="normalize-space($value) != ''">
6508
+ <xsl:value-of select="$value"/>
6509
+ </xsl:when>
6510
+ <xsl:otherwise>_</xsl:otherwise>
6511
+ </xsl:choose>
6512
+ </xsl:attribute>
6324
6513
  </xsl:template></xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.7.3".freeze
3
+ VERSION = "0.7.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.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: 2021-11-29 00:00:00.000000000 Z
11
+ date: 2021-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
292
  - !ruby/object:Gem::Version
293
293
  version: '0'
294
294
  requirements: []
295
- rubygems_version: 3.2.22
295
+ rubygems_version: 3.2.32
296
296
  signing_key:
297
297
  specification_version: 4
298
298
  summary: Metanorma for UN.