metanorma-iso 1.10.0 → 1.10.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ubuntu.yml +41 -0
  3. data/Gemfile +3 -4
  4. data/Makefile +44 -0
  5. data/Rakefile +1 -1
  6. data/bin/rspec +1 -2
  7. data/lib/asciidoctor/iso/base.rb +1 -1
  8. data/lib/asciidoctor/iso/cleanup.rb +7 -6
  9. data/lib/asciidoctor/iso/front.rb +2 -2
  10. data/lib/asciidoctor/iso/isodoc.rng +68 -18
  11. data/lib/asciidoctor/iso/isostandard.rng +14 -0
  12. data/lib/asciidoctor/iso/section.rb +1 -1
  13. data/lib/asciidoctor/iso/validate.rb +1 -1
  14. data/lib/asciidoctor/iso/validate_section.rb +1 -1
  15. data/lib/isodoc/iso/html/isodoc.css +0 -1
  16. data/lib/isodoc/iso/html/isodoc.scss +0 -1
  17. data/lib/isodoc/iso/html/style-human.css +21 -1
  18. data/lib/isodoc/iso/html/style-human.scss +26 -1
  19. data/lib/isodoc/iso/html/style-iso.css +21 -1
  20. data/lib/isodoc/iso/html/style-iso.scss +26 -1
  21. data/lib/isodoc/iso/html_convert.rb +81 -22
  22. data/lib/isodoc/iso/i18n.rb +10 -9
  23. data/lib/isodoc/iso/iso.amendment.xsl +304 -118
  24. data/lib/isodoc/iso/iso.international-standard.xsl +304 -118
  25. data/lib/isodoc/iso/isosts_convert.rb +6 -2
  26. data/lib/isodoc/iso/presentation_xml_convert.rb +19 -9
  27. data/lib/isodoc/iso/sections.rb +2 -0
  28. data/lib/isodoc/iso/sts_convert.rb +5 -2
  29. data/lib/isodoc/iso/word_cleanup.rb +94 -0
  30. data/lib/isodoc/iso/word_convert.rb +12 -91
  31. data/lib/metanorma/iso/processor.rb +2 -2
  32. data/lib/metanorma/iso/version.rb +1 -1
  33. data/metanorma-iso.gemspec +3 -3
  34. data/spec/asciidoctor/base_spec.rb +543 -209
  35. data/spec/asciidoctor/blocks_spec.rb +4 -43
  36. data/spec/asciidoctor/cleanup_spec.rb +15 -12
  37. data/spec/asciidoctor/refs_spec.rb +174 -88
  38. data/spec/isodoc/i18n_spec.rb +32 -18
  39. data/spec/isodoc/inline_spec.rb +4 -4
  40. data/spec/isodoc/postproc_spec.rb +111 -28
  41. data/spec/isodoc/section_spec.rb +3 -3
  42. data/spec/isodoc/table_spec.rb +6 -8
  43. data/spec/isodoc/terms_spec.rb +30 -37
  44. data/spec/isodoc/xref_spec.rb +3 -3
  45. data/spec/metanorma/processor_spec.rb +110 -14
  46. data/spec/vcr_cassettes/docrels.yml +783 -0
  47. data/spec/vcr_cassettes/sortrefs.yml +599 -0
  48. metadata +12 -8
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
12
+ <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"/>
13
13
 
14
14
  <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
15
15
 
@@ -1686,69 +1686,19 @@
1686
1686
  <xsl:template match="iso:li//iso:p//text()">
1687
1687
  <xsl:choose>
1688
1688
  <xsl:when test="contains(., '&#9;')">
1689
+ <!-- <fo:inline white-space="pre"><xsl:value-of select="translate(., $thinspace, ' ')"/></fo:inline> -->
1689
1690
  <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
1690
1691
  </xsl:when>
1691
1692
  <xsl:otherwise>
1693
+ <!-- <xsl:value-of select="translate(., $thinspace, ' ')"/> -->
1692
1694
  <xsl:value-of select="."/>
1693
1695
  </xsl:otherwise>
1694
1696
  </xsl:choose>
1695
1697
 
1696
1698
  </xsl:template>
1697
1699
 
1698
- <!--
1699
- <fn reference="1">
1700
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1701
- </fn>
1702
- -->
1703
1700
 
1704
- <xsl:variable name="p_fn">
1705
- <xsl:for-each select="//iso:p/iso:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
1706
- <!-- copy unique fn -->
1707
- <fn gen_id="{generate-id(.)}">
1708
- <xsl:copy-of select="@*"/>
1709
- <xsl:copy-of select="node()"/>
1710
- </fn>
1711
- </xsl:for-each>
1712
- </xsl:variable>
1713
1701
 
1714
- <xsl:template match="iso:p/iso:fn" priority="2">
1715
- <xsl:variable name="gen_id" select="generate-id(.)"/>
1716
- <xsl:variable name="reference" select="@reference"/>
1717
- <xsl:variable name="number">
1718
- <!-- <xsl:number level="any" count="iso:p/iso:fn"/> -->
1719
- <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
1720
- </xsl:variable>
1721
- <xsl:choose>
1722
- <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
1723
- <fo:footnote>
1724
- <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
1725
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1726
- <!-- <xsl:value-of select="@reference"/> -->
1727
- <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@normative='true']]/iso:note)"/><xsl:text>)</xsl:text>
1728
- </fo:basic-link>
1729
- </fo:inline>
1730
- <fo:footnote-body>
1731
- <fo:block font-size="10pt" margin-bottom="12pt">
1732
- <fo:inline id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
1733
- <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@normative='true']]/iso:note)"/><xsl:text>)</xsl:text>
1734
- </fo:inline>
1735
- <xsl:for-each select="iso:p">
1736
- <xsl:apply-templates/>
1737
- </xsl:for-each>
1738
- </fo:block>
1739
- </fo:footnote-body>
1740
- </fo:footnote>
1741
- </xsl:when>
1742
- <xsl:otherwise>
1743
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1744
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1745
- <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/>
1746
- </fo:basic-link>
1747
- </fo:inline>
1748
- </xsl:otherwise>
1749
- </xsl:choose>
1750
- </xsl:template>
1751
-
1752
1702
  <xsl:template match="iso:p/iso:fn/iso:p">
1753
1703
  <xsl:apply-templates/>
1754
1704
  </xsl:template>
@@ -1798,9 +1748,10 @@
1798
1748
  </xsl:variable>
1799
1749
  <fo:block line-height="1.1" role="H{$levelTerm}">
1800
1750
  <fo:block font-weight="bold" keep-with-next="always">
1801
- <xsl:apply-templates select="ancestor::iso:term/iso:name" mode="presentation"/>
1751
+ <xsl:apply-templates select="ancestor::iso:term[1]/iso:name" mode="presentation"/>
1802
1752
  </fo:block>
1803
1753
  <fo:block font-weight="bold" keep-with-next="always">
1754
+ <xsl:call-template name="setStyle_preferred"/>
1804
1755
  <xsl:apply-templates/>
1805
1756
  </fo:block>
1806
1757
  </fo:block>
@@ -2010,6 +1961,11 @@
2010
1961
  <!-- End of Index processing -->
2011
1962
  <!-- =================== -->
2012
1963
 
1964
+ <!-- <xsl:variable name="thinspace" select="'&#x2009;'"/>
1965
+ <xsl:template match="text()[contains(., $thinspace)]">
1966
+ <xsl:value-of select="translate(., $thinspace, ' ')"/>
1967
+ </xsl:template> -->
1968
+
2013
1969
 
2014
1970
  <xsl:template name="insertHeaderFooter">
2015
1971
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2740,6 +2696,76 @@
2740
2696
 
2741
2697
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2742
2698
  <xsl:attribute name="line-height">135%</xsl:attribute>
2699
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2700
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2701
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2702
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2703
+
2704
+
2705
+
2706
+
2707
+
2708
+
2709
+
2710
+
2711
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2712
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2713
+
2714
+
2715
+
2716
+
2717
+
2718
+
2719
+
2720
+
2721
+
2722
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2723
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2724
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2725
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2726
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2727
+
2728
+
2729
+
2730
+
2731
+
2732
+
2733
+
2734
+
2735
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2736
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2737
+
2738
+
2739
+
2740
+
2741
+
2742
+
2743
+
2744
+
2745
+
2746
+
2747
+
2748
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2749
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2750
+
2751
+
2752
+
2753
+
2754
+
2755
+
2756
+
2757
+
2758
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
2759
+
2760
+
2761
+
2762
+
2763
+
2764
+
2765
+
2766
+
2767
+
2768
+
2743
2769
  </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">
2744
2770
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2745
2771
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2765,7 +2791,8 @@
2765
2791
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
2766
2792
 
2767
2793
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2768
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2794
+
2795
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
2769
2796
  <xsl:sort select="@displayorder" data-type="number"/>
2770
2797
  <xsl:apply-templates select="." mode="contents"/>
2771
2798
  </xsl:for-each>
@@ -2775,7 +2802,7 @@
2775
2802
  <xsl:apply-templates select="." mode="contents"/>
2776
2803
  </xsl:for-each>
2777
2804
 
2778
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2805
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2779
2806
  <xsl:sort select="@displayorder" data-type="number"/>
2780
2807
  <xsl:apply-templates select="." mode="contents"/>
2781
2808
  </xsl:for-each>
@@ -3781,6 +3808,104 @@
3781
3808
 
3782
3809
  </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">
3783
3810
  <xsl:apply-templates/>
3811
+ </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">
3812
+
3813
+ <!-- list of footnotes to calculate actual footnotes number -->
3814
+ <xsl:variable name="p_fn_">
3815
+ <xsl:choose>
3816
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3817
+ <fn gen_id="{generate-id(.)}">
3818
+ <xsl:copy-of select="@*"/>
3819
+ <xsl:copy-of select="node()"/>
3820
+ </fn>
3821
+ </xsl:when>
3822
+ <xsl:otherwise>
3823
+ <!-- itetation for:
3824
+ footnotes in bibdata/title
3825
+ footnotes in bibliography
3826
+ footnotes in document's body (except table's head/body/foot and figure text)
3827
+ -->
3828
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3829
+ <fn gen_id="{generate-id(.)}">
3830
+ <xsl:copy-of select="@*"/>
3831
+ <xsl:copy-of select="node()"/>
3832
+ </fn>
3833
+ </xsl:for-each>
3834
+ <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']/*">
3835
+ <xsl:sort select="@displayorder" data-type="number"/>
3836
+ <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])]">
3837
+ <!-- copy unique fn -->
3838
+ <fn gen_id="{generate-id(.)}">
3839
+ <xsl:copy-of select="@*"/>
3840
+ <xsl:copy-of select="node()"/>
3841
+ </fn>
3842
+ </xsl:for-each>
3843
+ </xsl:for-each>
3844
+ </xsl:otherwise>
3845
+ </xsl:choose>
3846
+ </xsl:variable>
3847
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3848
+
3849
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3850
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3851
+ <xsl:variable name="reference" select="@reference"/>
3852
+ <!-- fn sequence number in document -->
3853
+ <xsl:variable name="current_fn_number">
3854
+ <xsl:choose>
3855
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3856
+ <xsl:otherwise>
3857
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3858
+ </xsl:otherwise>
3859
+ </xsl:choose>
3860
+ </xsl:variable>
3861
+ <xsl:variable name="current_fn_number_text">
3862
+ <xsl:value-of select="$current_fn_number"/>
3863
+
3864
+
3865
+ <xsl:text>)</xsl:text>
3866
+
3867
+ </xsl:variable>
3868
+
3869
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3870
+ <xsl:variable name="footnote_inline">
3871
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3872
+
3873
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3874
+ <xsl:value-of select="$current_fn_number_text"/>
3875
+ </fo:basic-link>
3876
+ </fo:inline>
3877
+ </xsl:variable>
3878
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3879
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3880
+ <xsl:choose>
3881
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3882
+ <xsl:copy-of select="$footnote_inline"/>
3883
+ </xsl:when>
3884
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3885
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3886
+ <xsl:copy-of select="$footnote_inline"/>
3887
+ <fo:footnote-body>
3888
+
3889
+ <fo:block-container text-indent="0" start-indent="0">
3890
+
3891
+
3892
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3893
+
3894
+
3895
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3896
+
3897
+ <xsl:value-of select="$current_fn_number_text"/>
3898
+ </fo:inline>
3899
+ <xsl:apply-templates/>
3900
+ </fo:block>
3901
+ </fo:block-container>
3902
+ </fo:footnote-body>
3903
+ </fo:footnote>
3904
+ </xsl:when>
3905
+ <xsl:otherwise>
3906
+ <xsl:copy-of select="$footnote_inline"/>
3907
+ </xsl:otherwise>
3908
+ </xsl:choose>
3784
3909
  </xsl:template><xsl:template name="fn_display">
3785
3910
  <xsl:variable name="references">
3786
3911
 
@@ -3982,6 +4107,8 @@
3982
4107
 
3983
4108
  </fo:basic-link>
3984
4109
  </fo:inline>
4110
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4111
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3985
4112
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3986
4113
  <fo:inline>
3987
4114
  <xsl:apply-templates/>
@@ -4295,6 +4422,7 @@
4295
4422
  <fo:table-cell>
4296
4423
 
4297
4424
  <fo:block margin-top="6pt">
4425
+ <xsl:copy-of select="@id"/>
4298
4426
 
4299
4427
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
4300
4428
 
@@ -4994,22 +5122,6 @@
4994
5122
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4995
5123
  <xsl:apply-templates/>
4996
5124
  </fo:inline>
4997
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
4998
- <xsl:variable name="title-modified">
4999
-
5000
- <xsl:call-template name="getLocalizedString">
5001
- <xsl:with-param name="key">modified</xsl:with-param>
5002
- </xsl:call-template>
5003
-
5004
-
5005
- </xsl:variable>
5006
-
5007
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5008
- <xsl:choose>
5009
- <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>
5010
- <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>
5011
- </xsl:choose>
5012
- <xsl:apply-templates/>
5013
5125
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5014
5126
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5015
5127
 
@@ -5141,14 +5253,20 @@
5141
5253
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
5142
5254
  <fo:inline><xsl:apply-templates/></fo:inline>
5143
5255
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
5256
+ <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
5144
5257
  <fo:block id="{@id}">
5145
5258
  <xsl:apply-templates/>
5146
5259
  </fo:block>
5147
5260
  </xsl:template><xsl:template match="*[local-name() = 'term']">
5261
+ <!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
5148
5262
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5149
5263
 
5150
5264
 
5151
-
5265
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
5266
+
5267
+ <xsl:attribute name="space-before">12pt</xsl:attribute>
5268
+
5269
+ </xsl:if>
5152
5270
  <xsl:apply-templates/>
5153
5271
  </fo:block>
5154
5272
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
@@ -5572,12 +5690,12 @@
5572
5690
  </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
5573
5691
  <xsl:apply-templates mode="contents"/>
5574
5692
  <xsl:text> </xsl:text>
5575
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
5693
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
5576
5694
  <xsl:apply-templates mode="bookmarks"/>
5577
5695
  <xsl:text> </xsl:text>
5578
5696
  </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
5579
5697
  <xsl:value-of select="."/>
5580
- </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
5698
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
5581
5699
  <xsl:value-of select="."/>
5582
5700
  </xsl:template><xsl:template match="node()" mode="contents">
5583
5701
  <xsl:apply-templates mode="contents"/>
@@ -5847,6 +5965,8 @@
5847
5965
 
5848
5966
 
5849
5967
 
5968
+
5969
+
5850
5970
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5851
5971
  <xsl:variable name="_font-size">
5852
5972
 
@@ -5880,13 +6000,17 @@
5880
6000
 
5881
6001
 
5882
6002
 
6003
+
6004
+
5883
6005
  <xsl:apply-templates/>
5884
6006
  </fo:block>
5885
-
6007
+
5886
6008
 
5887
6009
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5888
6010
 
5889
6011
 
6012
+
6013
+
5890
6014
  </fo:block-container>
5891
6015
  </fo:block-container>
5892
6016
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -6122,7 +6246,8 @@
6122
6246
  </fo:block>
6123
6247
  </fo:table-cell>
6124
6248
  </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
6125
- <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
6249
+ <fo:block font-size="11pt">
6250
+
6126
6251
  <xsl:apply-templates/>
6127
6252
  </fo:block>
6128
6253
  </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
@@ -6237,58 +6362,69 @@
6237
6362
  <xsl:variable name="termsource_text">
6238
6363
  <xsl:apply-templates/>
6239
6364
  </xsl:variable>
6240
-
6241
- <xsl:choose>
6365
+ <xsl:copy-of select="$termsource_text"/>
6366
+ <!-- <xsl:choose>
6242
6367
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6243
- <!-- <xsl:apply-templates /> -->
6244
6368
  <xsl:copy-of select="$termsource_text"/>
6245
6369
  </xsl:when>
6246
- <xsl:otherwise>
6247
-
6370
+ <xsl:otherwise>
6371
+ <xsl:if test="$namespace = 'bsi'">
6372
+ <xsl:choose>
6373
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6374
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6375
+ </xsl:choose>
6376
+ </xsl:if>
6377
+ <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'">
6248
6378
  <xsl:text>[</xsl:text>
6249
-
6250
- <!-- <xsl:apply-templates /> -->
6379
+ </xsl:if>
6251
6380
  <xsl:copy-of select="$termsource_text"/>
6252
-
6381
+ <xsl:if test="$namespace = 'bsi'">
6382
+ <xsl:choose>
6383
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6384
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6385
+ </xsl:choose>
6386
+ </xsl:if>
6387
+ <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'">
6253
6388
  <xsl:text>]</xsl:text>
6254
-
6389
+ </xsl:if>
6255
6390
  </xsl:otherwise>
6256
- </xsl:choose>
6391
+ </xsl:choose> -->
6257
6392
  </fo:block>
6258
6393
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6259
6394
  <xsl:if test="normalize-space() != ''">
6260
6395
  <xsl:value-of select="."/>
6261
6396
  </xsl:if>
6262
- </xsl:template><xsl:variable name="localized.source">
6263
- <xsl:call-template name="getLocalizedString">
6264
- <xsl:with-param name="key">source</xsl:with-param>
6265
- </xsl:call-template>
6266
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6397
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6398
+ <fo:inline>
6399
+
6400
+
6401
+ <xsl:value-of select="."/>
6402
+ </fo:inline>
6403
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6267
6404
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6268
6405
  <xsl:if test="normalize-space(@citeas) = ''">
6269
6406
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6270
6407
  </xsl:if>
6271
-
6272
-
6273
- <fo:inline>
6274
-
6275
-
6276
-
6277
-
6278
-
6279
- <xsl:value-of select="$localized.source"/>
6280
- <xsl:text>: </xsl:text>
6281
-
6282
-
6283
-
6284
-
6285
- </fo:inline>
6286
-
6287
6408
  <fo:inline xsl:use-attribute-sets="origin-style">
6288
6409
  <xsl:apply-templates/>
6289
6410
  </fo:inline>
6411
+ </fo:basic-link>
6412
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6413
+ <xsl:variable name="title-modified">
6290
6414
 
6291
- </fo:basic-link>
6415
+ <xsl:call-template name="getLocalizedString">
6416
+ <xsl:with-param name="key">modified</xsl:with-param>
6417
+ </xsl:call-template>
6418
+
6419
+
6420
+ </xsl:variable>
6421
+
6422
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6423
+ <xsl:choose>
6424
+ <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>
6425
+ <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>
6426
+ </xsl:choose>
6427
+ <xsl:apply-templates/>
6292
6428
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6293
6429
  <fo:inline><xsl:apply-templates/></fo:inline>
6294
6430
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6331,12 +6467,20 @@
6331
6467
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6332
6468
  <xsl:text>— </xsl:text>
6333
6469
  <xsl:apply-templates/>
6334
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
6470
+ </xsl:template><xsl:variable name="bibitem_hidden_">
6471
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6472
+ <xsl:copy-of select="."/>
6473
+ </xsl:for-each>
6474
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
6475
+ <xsl:copy-of select="."/>
6476
+ </xsl:for-each>
6477
+ </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6335
6478
 
6336
6479
  <xsl:variable name="bibitemid">
6337
6480
  <xsl:choose>
6338
- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
6339
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6481
+ <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6482
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6483
+ <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6340
6484
  <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6341
6485
  </xsl:choose>
6342
6486
  </xsl:variable>
@@ -6425,10 +6569,10 @@
6425
6569
  </xsl:choose>
6426
6570
  </xsl:variable>
6427
6571
 
6428
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6572
+ <!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
6429
6573
 
6430
6574
  <xsl:choose>
6431
- <xsl:when test="$language = 'zh'">
6575
+ <xsl:when test="$lang = 'zh'">
6432
6576
  <fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
6433
6577
  </xsl:when>
6434
6578
  <xsl:when test="../../@inline-header = 'true'">
@@ -6471,15 +6615,20 @@
6471
6615
  <fo:block xsl:use-attribute-sets="deprecates-style">
6472
6616
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
6473
6617
  </fo:block>
6618
+ </xsl:template><xsl:template name="setStyle_preferred">
6619
+ <xsl:if test="*[local-name() = 'strong']">
6620
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
6621
+ </xsl:if>
6474
6622
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6475
6623
  <fo:block xsl:use-attribute-sets="definition-style">
6476
6624
  <xsl:apply-templates/>
6477
6625
  </fo:block>
6478
6626
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
6479
6627
  <xsl:apply-templates/>
6480
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
6628
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
6481
6629
  <fo:inline> <xsl:apply-templates/></fo:inline>
6482
- <fo:block> </fo:block>
6630
+ <!-- <fo:block>&#xA0;</fo:block> -->
6631
+ <fo:block/>
6483
6632
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
6484
6633
 
6485
6634
  <fo:block>
@@ -6904,7 +7053,31 @@
6904
7053
  <fo:block-container border="1pt solid black" width="50%">
6905
7054
  <fo:block> </fo:block>
6906
7055
  </fo:block-container>
6907
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
7056
+ </xsl:template><xsl:variable name="toc_level">
7057
+ <xsl:choose>
7058
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
7059
+ <xsl:otherwise><!-- default value -->
7060
+
7061
+
7062
+
7063
+
7064
+
7065
+
7066
+
7067
+
7068
+
7069
+
7070
+
7071
+
7072
+
7073
+
7074
+
7075
+
7076
+
7077
+
7078
+ </xsl:otherwise>
7079
+ </xsl:choose>
7080
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6908
7081
  <xsl:param name="colwidths"/>
6909
7082
  <xsl:variable name="colwidths_">
6910
7083
  <xsl:choose>
@@ -7439,12 +7612,15 @@
7439
7612
  <xsl:param name="default">left</xsl:param>
7440
7613
  <xsl:attribute name="text-align">
7441
7614
  <xsl:choose>
7442
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7615
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
7443
7616
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7444
7617
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7445
7618
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7446
7619
  </xsl:choose>
7447
7620
  </xsl:attribute>
7621
+ <xsl:if test="@align = 'indent'">
7622
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
7623
+ </xsl:if>
7448
7624
  </xsl:template><xsl:template name="number-to-words">
7449
7625
  <xsl:param name="number"/>
7450
7626
  <xsl:param name="first"/>
@@ -7541,4 +7717,14 @@
7541
7717
  </xsl:otherwise>
7542
7718
  </xsl:choose>
7543
7719
  </xsl:if>
7720
+ </xsl:template><xsl:template name="setAltText">
7721
+ <xsl:param name="value"/>
7722
+ <xsl:attribute name="fox:alt-text">
7723
+ <xsl:choose>
7724
+ <xsl:when test="normalize-space($value) != ''">
7725
+ <xsl:value-of select="$value"/>
7726
+ </xsl:when>
7727
+ <xsl:otherwise>_</xsl:otherwise>
7728
+ </xsl:choose>
7729
+ </xsl:attribute>
7544
7730
  </xsl:template></xsl:stylesheet>