metanorma-iso 1.10.1 → 1.10.5

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ubuntu.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/lib/asciidoctor/iso/base.rb +1 -1
  5. data/lib/asciidoctor/iso/basicdoc.rng +1 -11
  6. data/lib/asciidoctor/iso/biblio.rng +0 -2
  7. data/lib/asciidoctor/iso/front.rb +17 -4
  8. data/lib/asciidoctor/iso/front_id.rb +20 -17
  9. data/lib/asciidoctor/iso/isodoc.rng +61 -19
  10. data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
  11. data/lib/asciidoctor/iso/isostandard.rng +15 -3
  12. data/lib/asciidoctor/iso/reqt.rng +1 -1
  13. data/lib/asciidoctor/iso/section.rb +1 -1
  14. data/lib/asciidoctor/iso/validate.rb +1 -1
  15. data/lib/asciidoctor/iso/validate_image.rb +1 -1
  16. data/lib/asciidoctor/iso/validate_section.rb +1 -1
  17. data/lib/isodoc/iso/base_convert.rb +14 -31
  18. data/lib/isodoc/iso/html/isodoc.css +0 -1
  19. data/lib/isodoc/iso/html/isodoc.scss +0 -1
  20. data/lib/isodoc/iso/html/style-human.css +40 -9
  21. data/lib/isodoc/iso/html/style-human.scss +36 -9
  22. data/lib/isodoc/iso/html/style-iso.css +35 -6
  23. data/lib/isodoc/iso/html/style-iso.scss +31 -6
  24. data/lib/isodoc/iso/html/wordstyle.css +10 -8
  25. data/lib/isodoc/iso/html/wordstyle.scss +10 -8
  26. data/lib/isodoc/iso/html_convert.rb +81 -22
  27. data/lib/isodoc/iso/index.rb +53 -45
  28. data/lib/isodoc/iso/iso.amendment.xsl +333 -113
  29. data/lib/isodoc/iso/iso.international-standard.xsl +333 -113
  30. data/lib/isodoc/iso/isosts_convert.rb +6 -2
  31. data/lib/isodoc/iso/metadata.rb +27 -22
  32. data/lib/isodoc/iso/presentation_xml_convert.rb +60 -25
  33. data/lib/isodoc/iso/sts_convert.rb +3 -2
  34. data/lib/isodoc/iso/word_convert.rb +0 -2
  35. data/lib/metanorma/iso/processor.rb +2 -2
  36. data/lib/metanorma/iso/version.rb +1 -1
  37. data/metanorma-iso.gemspec +3 -3
  38. data/spec/asciidoctor/base_spec.rb +397 -545
  39. data/spec/asciidoctor/blocks_spec.rb +4 -4
  40. data/spec/asciidoctor/cleanup_spec.rb +15 -12
  41. data/spec/asciidoctor/refs_spec.rb +87 -84
  42. data/spec/isodoc/amd_spec.rb +261 -250
  43. data/spec/isodoc/i18n_spec.rb +7 -7
  44. data/spec/isodoc/inline_spec.rb +242 -216
  45. data/spec/isodoc/iso_spec.rb +3 -1
  46. data/spec/isodoc/postproc_spec.rb +111 -28
  47. data/spec/isodoc/section_spec.rb +3 -3
  48. data/spec/isodoc/terms_spec.rb +34 -41
  49. data/spec/isodoc/xref_spec.rb +3 -3
  50. data/spec/metanorma/processor_spec.rb +110 -14
  51. data/spec/vcr_cassettes/docrels.yml +37 -427
  52. metadata +8 -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
 
@@ -1423,7 +1423,9 @@
1423
1423
 
1424
1424
  <xsl:template name="getListItemFormat">
1425
1425
  <xsl:choose>
1426
- <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1426
+ <xsl:when test="local-name(..) = 'ul'">
1427
+ <xsl:call-template name="setULLabel"/>
1428
+ </xsl:when>
1427
1429
  <xsl:otherwise> <!-- for ordered lists -->
1428
1430
  <xsl:choose>
1429
1431
  <xsl:when test="../@type = 'arabic'">
@@ -1545,7 +1547,7 @@
1545
1547
  </xsl:choose>
1546
1548
  </xsl:template>
1547
1549
 
1548
- <xsl:template match="iso:title">
1550
+ <xsl:template match="iso:title" name="title">
1549
1551
 
1550
1552
  <xsl:variable name="level">
1551
1553
  <xsl:call-template name="getLevel"/>
@@ -1686,69 +1688,19 @@
1686
1688
  <xsl:template match="iso:li//iso:p//text()">
1687
1689
  <xsl:choose>
1688
1690
  <xsl:when test="contains(., '&#9;')">
1691
+ <!-- <fo:inline white-space="pre"><xsl:value-of select="translate(., $thinspace, ' ')"/></fo:inline> -->
1689
1692
  <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
1690
1693
  </xsl:when>
1691
1694
  <xsl:otherwise>
1695
+ <!-- <xsl:value-of select="translate(., $thinspace, ' ')"/> -->
1692
1696
  <xsl:value-of select="."/>
1693
1697
  </xsl:otherwise>
1694
1698
  </xsl:choose>
1695
1699
 
1696
1700
  </xsl:template>
1697
1701
 
1698
- <!--
1699
- <fn reference="1">
1700
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1701
- </fn>
1702
- -->
1703
1702
 
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
1703
 
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
1704
  <xsl:template match="iso:p/iso:fn/iso:p">
1753
1705
  <xsl:apply-templates/>
1754
1706
  </xsl:template>
@@ -1801,6 +1753,7 @@
1801
1753
  <xsl:apply-templates select="ancestor::iso:term[1]/iso:name" mode="presentation"/>
1802
1754
  </fo:block>
1803
1755
  <fo:block font-weight="bold" keep-with-next="always">
1756
+ <xsl:call-template name="setStyle_preferred"/>
1804
1757
  <xsl:apply-templates/>
1805
1758
  </fo:block>
1806
1759
  </fo:block>
@@ -2010,6 +1963,11 @@
2010
1963
  <!-- End of Index processing -->
2011
1964
  <!-- =================== -->
2012
1965
 
1966
+ <!-- <xsl:variable name="thinspace" select="'&#x2009;'"/>
1967
+ <xsl:template match="text()[contains(., $thinspace)]">
1968
+ <xsl:value-of select="translate(., $thinspace, ' ')"/>
1969
+ </xsl:template> -->
1970
+
2013
1971
 
2014
1972
  <xsl:template name="insertHeaderFooter">
2015
1973
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2740,6 +2698,76 @@
2740
2698
 
2741
2699
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2742
2700
  <xsl:attribute name="line-height">135%</xsl:attribute>
2701
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2702
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2703
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2704
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2705
+
2706
+
2707
+
2708
+
2709
+
2710
+
2711
+
2712
+
2713
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2714
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2715
+
2716
+
2717
+
2718
+
2719
+
2720
+
2721
+
2722
+
2723
+
2724
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2725
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2726
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2727
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2728
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2729
+
2730
+
2731
+
2732
+
2733
+
2734
+
2735
+
2736
+
2737
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2738
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2739
+
2740
+
2741
+
2742
+
2743
+
2744
+
2745
+
2746
+
2747
+
2748
+
2749
+
2750
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2751
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2752
+
2753
+
2754
+
2755
+
2756
+
2757
+
2758
+
2759
+
2760
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
2761
+
2762
+
2763
+
2764
+
2765
+
2766
+
2767
+
2768
+
2769
+
2770
+
2743
2771
  </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
2772
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2745
2773
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2765,7 +2793,8 @@
2765
2793
  <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
2794
 
2767
2795
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2768
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2796
+
2797
+ <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
2798
  <xsl:sort select="@displayorder" data-type="number"/>
2770
2799
  <xsl:apply-templates select="." mode="contents"/>
2771
2800
  </xsl:for-each>
@@ -2775,7 +2804,7 @@
2775
2804
  <xsl:apply-templates select="." mode="contents"/>
2776
2805
  </xsl:for-each>
2777
2806
 
2778
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2807
+ <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
2808
  <xsl:sort select="@displayorder" data-type="number"/>
2780
2809
  <xsl:apply-templates select="." mode="contents"/>
2781
2810
  </xsl:for-each>
@@ -3781,6 +3810,104 @@
3781
3810
 
3782
3811
  </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
3812
  <xsl:apply-templates/>
3813
+ </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">
3814
+
3815
+ <!-- list of footnotes to calculate actual footnotes number -->
3816
+ <xsl:variable name="p_fn_">
3817
+ <xsl:choose>
3818
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3819
+ <fn gen_id="{generate-id(.)}">
3820
+ <xsl:copy-of select="@*"/>
3821
+ <xsl:copy-of select="node()"/>
3822
+ </fn>
3823
+ </xsl:when>
3824
+ <xsl:otherwise>
3825
+ <!-- itetation for:
3826
+ footnotes in bibdata/title
3827
+ footnotes in bibliography
3828
+ footnotes in document's body (except table's head/body/foot and figure text)
3829
+ -->
3830
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3831
+ <fn gen_id="{generate-id(.)}">
3832
+ <xsl:copy-of select="@*"/>
3833
+ <xsl:copy-of select="node()"/>
3834
+ </fn>
3835
+ </xsl:for-each>
3836
+ <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']/*">
3837
+ <xsl:sort select="@displayorder" data-type="number"/>
3838
+ <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])]">
3839
+ <!-- copy unique fn -->
3840
+ <fn gen_id="{generate-id(.)}">
3841
+ <xsl:copy-of select="@*"/>
3842
+ <xsl:copy-of select="node()"/>
3843
+ </fn>
3844
+ </xsl:for-each>
3845
+ </xsl:for-each>
3846
+ </xsl:otherwise>
3847
+ </xsl:choose>
3848
+ </xsl:variable>
3849
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3850
+
3851
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3852
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3853
+ <xsl:variable name="reference" select="@reference"/>
3854
+ <!-- fn sequence number in document -->
3855
+ <xsl:variable name="current_fn_number">
3856
+ <xsl:choose>
3857
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3858
+ <xsl:otherwise>
3859
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3860
+ </xsl:otherwise>
3861
+ </xsl:choose>
3862
+ </xsl:variable>
3863
+ <xsl:variable name="current_fn_number_text">
3864
+ <xsl:value-of select="$current_fn_number"/>
3865
+
3866
+
3867
+ <xsl:text>)</xsl:text>
3868
+
3869
+ </xsl:variable>
3870
+
3871
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3872
+ <xsl:variable name="footnote_inline">
3873
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3874
+
3875
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3876
+ <xsl:value-of select="$current_fn_number_text"/>
3877
+ </fo:basic-link>
3878
+ </fo:inline>
3879
+ </xsl:variable>
3880
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3881
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3882
+ <xsl:choose>
3883
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3884
+ <xsl:copy-of select="$footnote_inline"/>
3885
+ </xsl:when>
3886
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3887
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3888
+ <xsl:copy-of select="$footnote_inline"/>
3889
+ <fo:footnote-body>
3890
+
3891
+ <fo:block-container text-indent="0" start-indent="0">
3892
+
3893
+
3894
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3895
+
3896
+
3897
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3898
+
3899
+ <xsl:value-of select="$current_fn_number_text"/>
3900
+ </fo:inline>
3901
+ <xsl:apply-templates/>
3902
+ </fo:block>
3903
+ </fo:block-container>
3904
+ </fo:footnote-body>
3905
+ </fo:footnote>
3906
+ </xsl:when>
3907
+ <xsl:otherwise>
3908
+ <xsl:copy-of select="$footnote_inline"/>
3909
+ </xsl:otherwise>
3910
+ </xsl:choose>
3784
3911
  </xsl:template><xsl:template name="fn_display">
3785
3912
  <xsl:variable name="references">
3786
3913
 
@@ -3982,6 +4109,8 @@
3982
4109
 
3983
4110
  </fo:basic-link>
3984
4111
  </fo:inline>
4112
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4113
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3985
4114
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3986
4115
  <fo:inline>
3987
4116
  <xsl:apply-templates/>
@@ -4355,6 +4484,7 @@
4355
4484
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4356
4485
  <xsl:apply-templates/>
4357
4486
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
4487
+ <xsl:apply-templates select="@language"/>
4358
4488
  <xsl:apply-templates/>
4359
4489
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4360
4490
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -4995,22 +5125,6 @@
4995
5125
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4996
5126
  <xsl:apply-templates/>
4997
5127
  </fo:inline>
4998
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
4999
- <xsl:variable name="title-modified">
5000
-
5001
- <xsl:call-template name="getLocalizedString">
5002
- <xsl:with-param name="key">modified</xsl:with-param>
5003
- </xsl:call-template>
5004
-
5005
-
5006
- </xsl:variable>
5007
-
5008
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5009
- <xsl:choose>
5010
- <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>
5011
- <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>
5012
- </xsl:choose>
5013
- <xsl:apply-templates/>
5014
5128
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5015
5129
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5016
5130
 
@@ -5579,12 +5693,12 @@
5579
5693
  </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">
5580
5694
  <xsl:apply-templates mode="contents"/>
5581
5695
  <xsl:text> </xsl:text>
5582
- </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">
5696
+ </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">
5583
5697
  <xsl:apply-templates mode="bookmarks"/>
5584
5698
  <xsl:text> </xsl:text>
5585
5699
  </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">
5586
5700
  <xsl:value-of select="."/>
5587
- </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">
5701
+ </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">
5588
5702
  <xsl:value-of select="."/>
5589
5703
  </xsl:template><xsl:template match="node()" mode="contents">
5590
5704
  <xsl:apply-templates mode="contents"/>
@@ -5854,6 +5968,8 @@
5854
5968
 
5855
5969
 
5856
5970
 
5971
+
5972
+
5857
5973
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5858
5974
  <xsl:variable name="_font-size">
5859
5975
 
@@ -5887,13 +6003,17 @@
5887
6003
 
5888
6004
 
5889
6005
 
6006
+
6007
+
5890
6008
  <xsl:apply-templates/>
5891
6009
  </fo:block>
5892
-
6010
+
5893
6011
 
5894
6012
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5895
6013
 
5896
6014
 
6015
+
6016
+
5897
6017
  </fo:block-container>
5898
6018
  </fo:block-container>
5899
6019
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -6245,60 +6365,69 @@
6245
6365
  <xsl:variable name="termsource_text">
6246
6366
  <xsl:apply-templates/>
6247
6367
  </xsl:variable>
6248
-
6249
- <xsl:choose>
6368
+ <xsl:copy-of select="$termsource_text"/>
6369
+ <!-- <xsl:choose>
6250
6370
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6251
- <!-- <xsl:apply-templates /> -->
6252
6371
  <xsl:copy-of select="$termsource_text"/>
6253
6372
  </xsl:when>
6254
6373
  <xsl:otherwise>
6255
-
6256
-
6374
+ <xsl:if test="$namespace = 'bsi'">
6375
+ <xsl:choose>
6376
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6377
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6378
+ </xsl:choose>
6379
+ </xsl:if>
6380
+ <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'">
6257
6381
  <xsl:text>[</xsl:text>
6258
-
6259
- <!-- <xsl:apply-templates /> -->
6382
+ </xsl:if>
6260
6383
  <xsl:copy-of select="$termsource_text"/>
6261
-
6262
-
6384
+ <xsl:if test="$namespace = 'bsi'">
6385
+ <xsl:choose>
6386
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6387
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6388
+ </xsl:choose>
6389
+ </xsl:if>
6390
+ <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'">
6263
6391
  <xsl:text>]</xsl:text>
6264
-
6392
+ </xsl:if>
6265
6393
  </xsl:otherwise>
6266
- </xsl:choose>
6394
+ </xsl:choose> -->
6267
6395
  </fo:block>
6268
6396
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6269
6397
  <xsl:if test="normalize-space() != ''">
6270
6398
  <xsl:value-of select="."/>
6271
6399
  </xsl:if>
6272
- </xsl:template><xsl:variable name="localized.source">
6273
- <xsl:call-template name="getLocalizedString">
6274
- <xsl:with-param name="key">source</xsl:with-param>
6275
- </xsl:call-template>
6276
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6400
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6401
+ <fo:inline>
6402
+
6403
+
6404
+ <xsl:value-of select="."/>
6405
+ </fo:inline>
6406
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6277
6407
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6278
6408
  <xsl:if test="normalize-space(@citeas) = ''">
6279
6409
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6280
6410
  </xsl:if>
6281
-
6282
-
6283
- <fo:inline>
6284
-
6285
-
6286
-
6287
-
6288
-
6289
- <xsl:value-of select="$localized.source"/>
6290
- <xsl:text>: </xsl:text>
6291
-
6292
-
6293
-
6294
-
6295
- </fo:inline>
6296
-
6297
6411
  <fo:inline xsl:use-attribute-sets="origin-style">
6298
6412
  <xsl:apply-templates/>
6299
6413
  </fo:inline>
6414
+ </fo:basic-link>
6415
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6416
+ <xsl:variable name="title-modified">
6300
6417
 
6301
- </fo:basic-link>
6418
+ <xsl:call-template name="getLocalizedString">
6419
+ <xsl:with-param name="key">modified</xsl:with-param>
6420
+ </xsl:call-template>
6421
+
6422
+
6423
+ </xsl:variable>
6424
+
6425
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6426
+ <xsl:choose>
6427
+ <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>
6428
+ <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>
6429
+ </xsl:choose>
6430
+ <xsl:apply-templates/>
6302
6431
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6303
6432
  <fo:inline><xsl:apply-templates/></fo:inline>
6304
6433
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6489,15 +6618,20 @@
6489
6618
  <fo:block xsl:use-attribute-sets="deprecates-style">
6490
6619
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
6491
6620
  </fo:block>
6621
+ </xsl:template><xsl:template name="setStyle_preferred">
6622
+ <xsl:if test="*[local-name() = 'strong']">
6623
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
6624
+ </xsl:if>
6492
6625
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6493
6626
  <fo:block xsl:use-attribute-sets="definition-style">
6494
6627
  <xsl:apply-templates/>
6495
6628
  </fo:block>
6496
6629
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
6497
6630
  <xsl:apply-templates/>
6498
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
6631
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
6499
6632
  <fo:inline> <xsl:apply-templates/></fo:inline>
6500
- <fo:block> </fo:block>
6633
+ <!-- <fo:block>&#xA0;</fo:block> -->
6634
+ <fo:block/>
6501
6635
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
6502
6636
 
6503
6637
  <fo:block>
@@ -6558,6 +6692,51 @@
6558
6692
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6559
6693
  <!-- 0xA0 to space replacement -->
6560
6694
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6695
+ </xsl:template><xsl:variable name="ul_labels_">
6696
+
6697
+
6698
+
6699
+
6700
+
6701
+
6702
+
6703
+ <label>—</label> <!-- em dash -->
6704
+
6705
+
6706
+
6707
+
6708
+
6709
+
6710
+
6711
+
6712
+
6713
+
6714
+
6715
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6716
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6717
+ <xsl:variable name="list_level">
6718
+ <xsl:choose>
6719
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
6720
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
6721
+ </xsl:choose>
6722
+ </xsl:variable>
6723
+ <xsl:choose>
6724
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
6725
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
6726
+ </xsl:when>
6727
+ <xsl:when test="$list_level mod 3 = 0">
6728
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
6729
+ </xsl:when>
6730
+ <xsl:when test="$list_level mod 2 = 0">
6731
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
6732
+ </xsl:when>
6733
+ <xsl:otherwise>
6734
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
6735
+ </xsl:otherwise>
6736
+ </xsl:choose>
6737
+ </xsl:template><xsl:template match="label" mode="ul_labels">
6738
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6739
+ <xsl:value-of select="."/>
6561
6740
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6562
6741
  <xsl:choose>
6563
6742
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6922,7 +7101,31 @@
6922
7101
  <fo:block-container border="1pt solid black" width="50%">
6923
7102
  <fo:block> </fo:block>
6924
7103
  </fo:block-container>
6925
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
7104
+ </xsl:template><xsl:variable name="toc_level">
7105
+ <xsl:choose>
7106
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
7107
+ <xsl:otherwise><!-- default value -->
7108
+
7109
+
7110
+
7111
+
7112
+
7113
+
7114
+
7115
+
7116
+
7117
+
7118
+
7119
+
7120
+
7121
+
7122
+
7123
+
7124
+
7125
+
7126
+ </xsl:otherwise>
7127
+ </xsl:choose>
7128
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6926
7129
  <xsl:param name="colwidths"/>
6927
7130
  <xsl:variable name="colwidths_">
6928
7131
  <xsl:choose>
@@ -7013,6 +7216,10 @@
7013
7216
  </svg>
7014
7217
  </fo:instream-foreign-object>
7015
7218
  </fo:inline>
7219
+ </xsl:template><xsl:template match="@language">
7220
+ <xsl:copy-of select="."/>
7221
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
7222
+ <xsl:call-template name="title"/>
7016
7223
  </xsl:template><xsl:template name="convertDate">
7017
7224
  <xsl:param name="date"/>
7018
7225
  <xsl:param name="format" select="'short'"/>
@@ -7457,12 +7664,15 @@
7457
7664
  <xsl:param name="default">left</xsl:param>
7458
7665
  <xsl:attribute name="text-align">
7459
7666
  <xsl:choose>
7460
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7667
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
7461
7668
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7462
7669
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7463
7670
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7464
7671
  </xsl:choose>
7465
7672
  </xsl:attribute>
7673
+ <xsl:if test="@align = 'indent'">
7674
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
7675
+ </xsl:if>
7466
7676
  </xsl:template><xsl:template name="number-to-words">
7467
7677
  <xsl:param name="number"/>
7468
7678
  <xsl:param name="first"/>
@@ -7559,4 +7769,14 @@
7559
7769
  </xsl:otherwise>
7560
7770
  </xsl:choose>
7561
7771
  </xsl:if>
7772
+ </xsl:template><xsl:template name="setAltText">
7773
+ <xsl:param name="value"/>
7774
+ <xsl:attribute name="fox:alt-text">
7775
+ <xsl:choose>
7776
+ <xsl:when test="normalize-space($value) != ''">
7777
+ <xsl:value-of select="$value"/>
7778
+ </xsl:when>
7779
+ <xsl:otherwise>_</xsl:otherwise>
7780
+ </xsl:choose>
7781
+ </xsl:attribute>
7562
7782
  </xsl:template></xsl:stylesheet>