metanorma-iso 1.8.0 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/lib/asciidoctor/iso/base.rb +14 -11
  6. data/lib/asciidoctor/iso/biblio.rng +1 -0
  7. data/lib/asciidoctor/iso/cleanup.rb +40 -24
  8. data/lib/asciidoctor/iso/front.rb +28 -16
  9. data/lib/asciidoctor/iso/front_id.rb +66 -50
  10. data/lib/asciidoctor/iso/isodoc.rng +191 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -0
  13. data/lib/asciidoctor/iso/section.rb +2 -1
  14. data/lib/asciidoctor/iso/validate.rb +22 -110
  15. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  16. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  17. data/lib/asciidoctor/iso/validate_section.rb +55 -29
  18. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  19. data/lib/asciidoctor/iso/validate_title.rb +2 -4
  20. data/lib/isodoc/iso/base_convert.rb +20 -14
  21. data/lib/isodoc/iso/html/isodoc.css +475 -20
  22. data/lib/isodoc/iso/html/isodoc.scss +456 -23
  23. data/lib/isodoc/iso/html/wordstyle.css +202 -31
  24. data/lib/isodoc/iso/html/wordstyle.scss +194 -32
  25. data/lib/isodoc/iso/iso.amendment.xsl +666 -193
  26. data/lib/isodoc/iso/iso.international-standard.xsl +666 -193
  27. data/lib/isodoc/iso/metadata.rb +3 -2
  28. data/lib/isodoc/iso/presentation_xml_convert.rb +15 -14
  29. data/lib/isodoc/iso/sts_convert.rb +10 -13
  30. data/lib/isodoc/iso/word_convert.rb +153 -39
  31. data/lib/isodoc/iso/xref.rb +44 -29
  32. data/lib/metanorma/iso/processor.rb +1 -0
  33. data/lib/metanorma/iso/version.rb +1 -1
  34. data/metanorma-iso.gemspec +3 -3
  35. data/spec/asciidoctor/base_spec.rb +426 -305
  36. data/spec/asciidoctor/blocks_spec.rb +96 -34
  37. data/spec/asciidoctor/cleanup_spec.rb +383 -25
  38. data/spec/asciidoctor/section_spec.rb +0 -14
  39. data/spec/asciidoctor/validate_spec.rb +218 -83
  40. data/spec/isodoc/amd_spec.rb +193 -201
  41. data/spec/isodoc/blocks_spec.rb +100 -88
  42. data/spec/isodoc/i18n_spec.rb +36 -36
  43. data/spec/isodoc/inline_spec.rb +2 -2
  44. data/spec/isodoc/iso_spec.rb +86 -138
  45. data/spec/isodoc/postproc_spec.rb +492 -442
  46. data/spec/isodoc/ref_spec.rb +6 -6
  47. data/spec/isodoc/section_spec.rb +301 -306
  48. data/spec/isodoc/table_spec.rb +166 -231
  49. data/spec/isodoc/terms_spec.rb +11 -8
  50. data/spec/isodoc/xref_spec.rb +147 -118
  51. data/spec/spec_helper.rb +16 -15
  52. metadata +8 -7
@@ -948,22 +948,24 @@
948
948
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@type, ' ',
949
949
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@number)"/>
950
950
  -->
951
- <!-- ISO/TC 34/SC 4/WG 3 -->
952
- <fo:block margin-bottom="12pt">
953
- <xsl:text>ISO</xsl:text>
954
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[@number]">
955
- <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
956
- </xsl:for-each>
957
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[@number]">
958
- <xsl:text>/SC </xsl:text>
959
- <xsl:value-of select="@number"/>
960
- </xsl:for-each>
961
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[@number]">
962
- <xsl:text>/WG </xsl:text>
963
- <xsl:value-of select="@number"/>
964
- </xsl:for-each>
965
- </fo:block>
966
-
951
+
952
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
953
+ <!-- ISO/TC 34/SC 4/WG 3 -->
954
+ <fo:block margin-bottom="12pt">
955
+ <xsl:text>ISO</xsl:text>
956
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != '']">
957
+ <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
958
+ </xsl:for-each>
959
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != '']">
960
+ <xsl:text>/SC </xsl:text>
961
+ <xsl:value-of select="@number"/>
962
+ </xsl:for-each>
963
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
964
+ <xsl:text>/WG </xsl:text>
965
+ <xsl:value-of select="@number"/>
966
+ </xsl:for-each>
967
+ </fo:block>
968
+ </xsl:if>
967
969
  <!-- Secretariat: AFNOR -->
968
970
 
969
971
  <fo:block margin-bottom="100pt">
@@ -1025,7 +1027,15 @@
1025
1027
  <fo:block font-size="11pt" margin-bottom="8pt"><xsl:value-of select="$linebreak"/></fo:block>
1026
1028
  <fo:block-container font-size="40pt" text-align="center" margin-bottom="12pt" border="0.5pt solid black">
1027
1029
  <xsl:variable name="stage-title" select="substring-after(substring-before($docidentifierISO, ' '), '/')"/>
1028
- <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1030
+ <xsl:choose>
1031
+ <xsl:when test="normalize-space($stage-title) != ''">
1032
+ <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1033
+ </xsl:when>
1034
+ <xsl:otherwise>
1035
+ <xsl:attribute name="border">0pt solid white</xsl:attribute>
1036
+ <fo:block> </fo:block>
1037
+ </xsl:otherwise>
1038
+ </xsl:choose>
1029
1039
  </fo:block-container>
1030
1040
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
1031
1041
 
@@ -1415,7 +1425,7 @@
1415
1425
  </xsl:if>
1416
1426
  </xsl:template>
1417
1427
 
1418
-
1428
+ <xsl:template match="iso:p | iso:termsource | iso:termnote" mode="contents"/>
1419
1429
 
1420
1430
  <xsl:template name="getListItemFormat">
1421
1431
  <xsl:choose>
@@ -1742,61 +1752,7 @@
1742
1752
  <xsl:apply-templates/>
1743
1753
  </xsl:template>
1744
1754
 
1745
-
1746
-
1747
- <xsl:template match="iso:bibitem">
1748
- <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
1749
- <xsl:variable name="docidentifier">
1750
- <xsl:if test="iso:docidentifier">
1751
- <xsl:choose>
1752
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1753
- <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1754
- </xsl:choose>
1755
- </xsl:if>
1756
- </xsl:variable>
1757
- <xsl:value-of select="$docidentifier"/>
1758
- <xsl:apply-templates select="iso:note"/>
1759
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1760
- <fo:inline font-style="italic">
1761
- <xsl:choose>
1762
- <xsl:when test="iso:title[@type = 'main' and @language = $lang]">
1763
- <xsl:value-of select="iso:title[@type = 'main' and @language = $lang]"/>
1764
- </xsl:when>
1765
- <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1766
- <xsl:value-of select="iso:title[@type = 'main' and @language = 'en']"/>
1767
- </xsl:when>
1768
- <xsl:otherwise>
1769
- <xsl:value-of select="iso:title"/>
1770
- </xsl:otherwise>
1771
- </xsl:choose>
1772
- </fo:inline>
1773
- </fo:block>
1774
- </xsl:template>
1775
-
1776
-
1777
- <xsl:template match="iso:bibitem/iso:note" priority="2">
1778
- <fo:footnote>
1779
- <xsl:variable name="number">
1780
- <xsl:number level="any" count="iso:bibitem/iso:note"/>
1781
- </xsl:variable>
1782
- <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1783
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1784
- <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1785
- </fo:basic-link>
1786
- </fo:inline>
1787
- <fo:footnote-body>
1788
- <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1789
- <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1790
- <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1791
- </fo:inline>
1792
- <xsl:apply-templates/>
1793
- </fo:block>
1794
- </fo:footnote-body>
1795
- </fo:footnote>
1796
- </xsl:template>
1797
-
1798
-
1799
-
1755
+
1800
1756
  <xsl:template match="iso:ul | iso:ol" mode="ul_ol">
1801
1757
  <fo:list-block provisional-distance-between-starts="7mm" margin-top="8pt"> <!-- margin-bottom="8pt" -->
1802
1758
  <xsl:apply-templates/>
@@ -1806,7 +1762,7 @@
1806
1762
  </xsl:for-each>
1807
1763
  </xsl:template>
1808
1764
 
1809
- <xsl:template match="iso:ul//iso:note | iso:ol//iso:note" priority="2"/>
1765
+ <xsl:template match="iso:ul/iso:note | iso:ol/iso:note | iso:ul/iso:li/iso:note | iso:ol/iso:li/iso:note" priority="2"/>
1810
1766
 
1811
1767
  <xsl:template match="iso:li">
1812
1768
  <fo:list-item id="{@id}">
@@ -1818,7 +1774,10 @@
1818
1774
  <fo:list-item-body start-indent="body-start()">
1819
1775
  <fo:block>
1820
1776
  <xsl:apply-templates/>
1821
- <xsl:apply-templates select=".//iso:note" mode="process"/>
1777
+ <!-- <xsl:apply-templates select=".//iso:note" mode="process"/> -->
1778
+ <xsl:for-each select="./iso:note">
1779
+ <xsl:call-template name="note"/>
1780
+ </xsl:for-each>
1822
1781
  </fo:block>
1823
1782
  </fo:list-item-body>
1824
1783
  </fo:list-item>
@@ -1828,6 +1787,10 @@
1828
1787
  <xsl:call-template name="note"/>
1829
1788
  </xsl:template>
1830
1789
 
1790
+ <xsl:template match="*" mode="process">
1791
+ <xsl:apply-templates select="."/>
1792
+ </xsl:template>
1793
+
1831
1794
  <xsl:template match="iso:preferred">
1832
1795
  <fo:block line-height="1.1">
1833
1796
  <fo:block font-weight="bold" keep-with-next="always">
@@ -1855,6 +1818,34 @@
1855
1818
  </xsl:template>
1856
1819
 
1857
1820
 
1821
+ <xsl:template match="iso:bibitem">
1822
+ <fo:block id="{@id}" margin-bottom="6pt">
1823
+ <xsl:call-template name="processBibitem"/>
1824
+ </fo:block>
1825
+ </xsl:template>
1826
+
1827
+
1828
+ <xsl:template match="iso:bibitem/iso:note" priority="2">
1829
+ <fo:footnote>
1830
+ <xsl:variable name="number">
1831
+ <xsl:number level="any" count="iso:bibitem/iso:note"/>
1832
+ </xsl:variable>
1833
+ <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1834
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1835
+ <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1836
+ </fo:basic-link>
1837
+ </fo:inline>
1838
+ <fo:footnote-body>
1839
+ <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1840
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1841
+ <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1842
+ </fo:inline>
1843
+ <xsl:apply-templates/>
1844
+ </fo:block>
1845
+ </fo:footnote-body>
1846
+ </fo:footnote>
1847
+ </xsl:template>
1848
+
1858
1849
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1859
1850
  <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem"> -->
1860
1851
  <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem">
@@ -1869,60 +1860,24 @@
1869
1860
  </fo:list-item-label>
1870
1861
  <fo:list-item-body start-indent="body-start()">
1871
1862
  <fo:block>
1872
- <xsl:variable name="docidentifier">
1873
- <xsl:if test="iso:docidentifier">
1874
- <xsl:choose>
1875
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1876
- <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1877
- </xsl:choose>
1878
- </xsl:if>
1879
- </xsl:variable>
1880
- <xsl:value-of select="$docidentifier"/>
1881
- <xsl:apply-templates select="iso:note"/>
1882
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1883
- <xsl:choose>
1884
- <xsl:when test="iso:title[@type = 'main' and @language = $lang]">
1885
- <xsl:apply-templates select="iso:title[@type = 'main' and @language = $lang]"/>
1886
- </xsl:when>
1887
- <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1888
- <xsl:apply-templates select="iso:title[@type = 'main' and @language = 'en']"/>
1889
- </xsl:when>
1890
- <xsl:otherwise>
1891
- <xsl:apply-templates select="iso:title"/>
1892
- </xsl:otherwise>
1893
- </xsl:choose>
1894
- <xsl:apply-templates select="iso:formattedref"/>
1863
+ <xsl:call-template name="processBibitem"/>
1895
1864
  </fo:block>
1896
1865
  </fo:list-item-body>
1897
1866
  </fo:list-item>
1898
1867
  </fo:list-block>
1899
1868
  </xsl:template>
1900
1869
 
1901
- <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem" mode="contents"/> -->
1902
- <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem" mode="contents"/>
1870
+ <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem" mode="contents"/> [not(@normative='true')] -->
1871
+ <xsl:template match="iso:references/iso:bibitem" mode="contents"/>
1903
1872
 
1904
- <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem/iso:title"> -->
1905
- <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem/iso:title">
1873
+ <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem/iso:title"> iso:references[not(@normative='true')]/ -->
1874
+ <xsl:template match="iso:bibitem/iso:title">
1906
1875
  <fo:inline font-style="italic">
1907
1876
  <xsl:apply-templates/>
1908
1877
  </fo:inline>
1909
1878
  </xsl:template>
1910
1879
 
1911
1880
 
1912
- <xsl:template match="mathml:math" priority="2">
1913
- <fo:inline font-family="Cambria Math">
1914
- <xsl:variable name="mathml">
1915
- <xsl:apply-templates select="." mode="mathml"/>
1916
- </xsl:variable>
1917
- <fo:instream-foreign-object fox:alt-text="Math">
1918
- <!-- <xsl:copy-of select="."/> -->
1919
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
1920
- </fo:instream-foreign-object>
1921
- </fo:inline>
1922
- </xsl:template>
1923
-
1924
-
1925
-
1926
1881
  <xsl:template match="iso:admonition">
1927
1882
  <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
1928
1883
  <xsl:variable name="type">
@@ -2670,6 +2625,9 @@
2670
2625
  <title-continued lang="en">(continued)</title-continued>
2671
2626
  <title-continued lang="fr">(continué)</title-continued>
2672
2627
 
2628
+ </xsl:variable><xsl:variable name="bibdata">
2629
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2630
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2673
2631
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2674
2632
  <xsl:param name="name"/>
2675
2633
  <xsl:param name="lang"/>
@@ -2695,13 +2653,16 @@
2695
2653
  </xsl:choose>
2696
2654
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
2697
2655
 
2656
+
2698
2657
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2699
2658
 
2659
+
2700
2660
  <xsl:attribute name="color">blue</xsl:attribute>
2701
2661
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2702
2662
 
2703
2663
 
2704
2664
 
2665
+
2705
2666
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2706
2667
  <xsl:attribute name="white-space">pre</xsl:attribute>
2707
2668
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2751,7 +2712,7 @@
2751
2712
 
2752
2713
 
2753
2714
 
2754
-
2715
+
2755
2716
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2756
2717
 
2757
2718
 
@@ -2768,6 +2729,7 @@
2768
2729
 
2769
2730
 
2770
2731
 
2732
+
2771
2733
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2772
2734
 
2773
2735
 
@@ -2777,6 +2739,7 @@
2777
2739
 
2778
2740
 
2779
2741
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2742
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2780
2743
 
2781
2744
 
2782
2745
 
@@ -2786,9 +2749,7 @@
2786
2749
 
2787
2750
 
2788
2751
 
2789
-
2790
-
2791
-
2752
+
2792
2753
 
2793
2754
 
2794
2755
 
@@ -2821,8 +2782,10 @@
2821
2782
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2822
2783
 
2823
2784
 
2785
+
2824
2786
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2825
2787
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2788
+
2826
2789
 
2827
2790
 
2828
2791
 
@@ -2841,6 +2804,9 @@
2841
2804
 
2842
2805
 
2843
2806
 
2807
+
2808
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2809
+
2844
2810
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2845
2811
 
2846
2812
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2861,19 +2827,23 @@
2861
2827
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
2862
2828
 
2863
2829
 
2830
+
2864
2831
  <xsl:attribute name="color">blue</xsl:attribute>
2865
2832
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2866
2833
 
2867
2834
 
2835
+
2868
2836
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2869
2837
 
2870
2838
 
2871
2839
 
2872
2840
 
2841
+
2873
2842
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2874
2843
 
2875
2844
 
2876
2845
 
2846
+
2877
2847
 
2878
2848
 
2879
2849
 
@@ -2890,6 +2860,7 @@
2890
2860
 
2891
2861
 
2892
2862
 
2863
+
2893
2864
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
2894
2865
 
2895
2866
 
@@ -2897,6 +2868,7 @@
2897
2868
 
2898
2869
 
2899
2870
 
2871
+
2900
2872
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
2901
2873
 
2902
2874
 
@@ -2926,6 +2898,7 @@
2926
2898
 
2927
2899
 
2928
2900
 
2901
+
2929
2902
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2930
2903
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
2931
2904
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -2933,9 +2906,12 @@
2933
2906
 
2934
2907
 
2935
2908
 
2909
+
2936
2910
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2911
+
2937
2912
 
2938
2913
 
2914
+
2939
2915
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2940
2916
 
2941
2917
 
@@ -2960,18 +2936,22 @@
2960
2936
 
2961
2937
 
2962
2938
 
2939
+
2963
2940
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2964
2941
 
2942
+
2965
2943
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2966
2944
 
2967
2945
 
2968
2946
 
2947
+
2969
2948
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2970
2949
 
2971
2950
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2972
2951
 
2973
2952
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2974
2953
 
2954
+
2975
2955
 
2976
2956
 
2977
2957
 
@@ -2991,6 +2971,7 @@
2991
2971
 
2992
2972
 
2993
2973
 
2974
+
2994
2975
 
2995
2976
 
2996
2977
 
@@ -3004,10 +2985,12 @@
3004
2985
 
3005
2986
 
3006
2987
 
2988
+
3007
2989
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
3008
2990
 
3009
2991
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
3010
2992
 
2993
+
3011
2994
  <xsl:attribute name="width">100%</xsl:attribute>
3012
2995
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
3013
2996
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3034,20 +3017,39 @@
3034
3017
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
3035
3018
 
3036
3019
 
3020
+
3037
3021
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
3038
3022
 
3023
+
3039
3024
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
3040
3025
 
3041
3026
 
3042
3027
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3043
3028
 
3044
- </xsl:attribute-set><xsl:attribute-set name="add-style">
3029
+
3030
+ </xsl:attribute-set><xsl:variable name="color-added-text">
3031
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
3032
+ </xsl:variable><xsl:attribute-set name="add-style">
3045
3033
  <xsl:attribute name="color">red</xsl:attribute>
3046
3034
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
3047
- </xsl:attribute-set><xsl:attribute-set name="del-style">
3048
- <xsl:attribute name="color">red</xsl:attribute>
3035
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
3036
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
3037
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
3038
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3039
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
3040
+ <xsl:text>red</xsl:text>
3041
+ </xsl:variable><xsl:attribute-set name="del-style">
3042
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
3049
3043
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
3050
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
3044
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
3045
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
3046
+
3047
+ <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
3048
+
3049
+
3050
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
3051
+
3052
+ </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="processPrefaceSectionsDefault_Contents">
3051
3053
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3052
3054
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
3053
3055
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3092,18 +3094,19 @@
3092
3094
  <xsl:call-template name="add-zero-spaces-java"/>
3093
3095
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3094
3096
 
3097
+ <xsl:variable name="table-preamble">
3098
+
3099
+
3100
+ </xsl:variable>
3101
+
3095
3102
  <xsl:variable name="table">
3096
3103
 
3097
3104
  <xsl:variable name="simple-table">
3098
- <xsl:call-template name="getSimpleTable"/>
3105
+ <xsl:call-template name="getSimpleTable"/>
3099
3106
  </xsl:variable>
3100
3107
 
3101
-
3102
-
3103
-
3104
-
3105
3108
  <!-- <xsl:if test="$namespace = 'bipm'">
3106
- <fo:block>&#xA0;</fo:block>
3109
+ <fo:block>&#xA0;</fo:block>
3107
3110
  </xsl:if> -->
3108
3111
 
3109
3112
  <!-- $namespace = 'iso' or -->
@@ -3112,7 +3115,7 @@
3112
3115
 
3113
3116
 
3114
3117
 
3115
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3118
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3116
3119
 
3117
3120
  <!-- <xsl:variable name="cols-count">
3118
3121
  <xsl:choose>
@@ -3131,8 +3134,6 @@
3131
3134
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3132
3135
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3133
3136
 
3134
-
3135
-
3136
3137
  <xsl:variable name="colwidths">
3137
3138
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3138
3139
  <xsl:call-template name="calculate-column-widths">
@@ -3160,8 +3161,10 @@
3160
3161
  </xsl:choose>
3161
3162
  </xsl:variable>
3162
3163
 
3164
+
3163
3165
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3164
3166
 
3167
+
3165
3168
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3166
3169
 
3167
3170
 
@@ -3173,6 +3176,7 @@
3173
3176
 
3174
3177
 
3175
3178
 
3179
+
3176
3180
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
3177
3181
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3178
3182
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -3182,6 +3186,7 @@
3182
3186
 
3183
3187
 
3184
3188
 
3189
+
3185
3190
  <xsl:variable name="table_width">
3186
3191
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3187
3192
  100%
@@ -3195,12 +3200,19 @@
3195
3200
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3196
3201
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3197
3202
 
3203
+
3198
3204
  <attribute name="border">1.5pt solid black</attribute>
3199
3205
  <xsl:if test="*[local-name()='thead']">
3200
3206
  <attribute name="border-top">1pt solid black</attribute>
3201
3207
  </xsl:if>
3202
3208
 
3203
3209
 
3210
+ <xsl:if test="ancestor::*[local-name() = 'table']">
3211
+ <!-- for internal table in table cell -->
3212
+ <attribute name="border">0.5pt solid black</attribute>
3213
+ </xsl:if>
3214
+
3215
+
3204
3216
 
3205
3217
 
3206
3218
  <attribute name="margin-left">0mm</attribute>
@@ -3212,6 +3224,7 @@
3212
3224
 
3213
3225
 
3214
3226
 
3227
+
3215
3228
  </xsl:variable>
3216
3229
 
3217
3230
 
@@ -3295,7 +3308,8 @@
3295
3308
  </fo:block-container>
3296
3309
  </xsl:variable>
3297
3310
 
3298
-
3311
+ <xsl:variable name="isAdded" select="@added"/>
3312
+ <xsl:variable name="isDeleted" select="@deleted"/>
3299
3313
 
3300
3314
  <xsl:choose>
3301
3315
  <xsl:when test="@width">
@@ -3309,7 +3323,14 @@
3309
3323
  <fo:table-body>
3310
3324
  <fo:table-row>
3311
3325
  <fo:table-cell column-number="2">
3312
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3326
+ <xsl:copy-of select="$table-preamble"/>
3327
+ <fo:block>
3328
+ <xsl:call-template name="setTrackChangesStyles">
3329
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3330
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3331
+ </xsl:call-template>
3332
+ <xsl:copy-of select="$table"/>
3333
+ </fo:block>
3313
3334
  </fo:table-cell>
3314
3335
  </fo:table-row>
3315
3336
  </fo:table-body>
@@ -3320,18 +3341,49 @@
3320
3341
 
3321
3342
  </xsl:when>
3322
3343
  <xsl:otherwise>
3323
- <xsl:copy-of select="$table"/>
3344
+ <xsl:choose>
3345
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3346
+ <xsl:copy-of select="$table-preamble"/>
3347
+ <fo:block>
3348
+ <xsl:call-template name="setTrackChangesStyles">
3349
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3350
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3351
+ </xsl:call-template>
3352
+ <xsl:copy-of select="$table"/>
3353
+ </fo:block>
3354
+ </xsl:when>
3355
+ <xsl:otherwise>
3356
+ <xsl:copy-of select="$table-preamble"/>
3357
+ <xsl:copy-of select="$table"/>
3358
+ </xsl:otherwise>
3359
+ </xsl:choose>
3324
3360
  </xsl:otherwise>
3325
3361
  </xsl:choose>
3326
3362
 
3327
3363
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
3364
+ <xsl:param name="continued"/>
3328
3365
  <xsl:if test="normalize-space() != ''">
3329
3366
  <fo:block xsl:use-attribute-sets="table-name-style">
3330
3367
 
3331
3368
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3332
3369
 
3333
3370
 
3334
- <xsl:apply-templates/>
3371
+
3372
+
3373
+
3374
+ <xsl:choose>
3375
+ <xsl:when test="$continued = 'true'">
3376
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
3377
+
3378
+ <xsl:apply-templates/>
3379
+
3380
+ </xsl:when>
3381
+ <xsl:otherwise>
3382
+ <xsl:apply-templates/>
3383
+ </xsl:otherwise>
3384
+ </xsl:choose>
3385
+
3386
+
3335
3387
  </fo:block>
3336
3388
  </xsl:if>
3337
3389
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -3383,7 +3435,7 @@
3383
3435
  </xsl:for-each>
3384
3436
  </xsl:when>
3385
3437
  <xsl:otherwise>
3386
- <xsl:for-each select="xalan:nodeset($table)//tr">
3438
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
3387
3439
  <xsl:variable name="td_text">
3388
3440
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3389
3441
 
@@ -3472,21 +3524,27 @@
3472
3524
  <xsl:with-param name="cols-count" select="$cols-count"/>
3473
3525
  </xsl:call-template>
3474
3526
 
3527
+
3475
3528
  <xsl:apply-templates/>
3476
3529
  </fo:table-header>
3477
3530
  </xsl:template><xsl:template name="table-header-title">
3478
- <xsl:param name="cols-count"/>
3531
+ <xsl:param name="cols-count"/>
3479
3532
  <!-- row for title -->
3480
3533
  <fo:table-row>
3481
3534
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
3482
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3535
+
3536
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3537
+ <xsl:with-param name="continued">true</xsl:with-param>
3538
+ </xsl:apply-templates>
3483
3539
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3484
3540
  <xsl:call-template name="fn_name_display"/>
3485
- </xsl:for-each>
3486
- <fo:block text-align="right" font-style="italic">
3487
- <xsl:text> </xsl:text>
3488
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3489
- </fo:block>
3541
+ </xsl:for-each>
3542
+
3543
+ <fo:block text-align="right" font-style="italic">
3544
+ <xsl:text> </xsl:text>
3545
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3546
+ </fo:block>
3547
+
3490
3548
  </fo:table-cell>
3491
3549
  </fo:table-row>
3492
3550
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3707,20 +3765,26 @@
3707
3765
  <xsl:call-template name="getTitle">
3708
3766
  <xsl:with-param name="name" select="'title-continued'"/>
3709
3767
  </xsl:call-template>
3710
- </xsl:variable>
3768
+ </xsl:variable>
3769
+
3770
+ <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3771
+ <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3772
+
3711
3773
  <fo:table-row height="0" keep-with-next.within-page="always">
3712
3774
  <fo:table-cell>
3713
- <fo:marker marker-class-name="table_continued"/>
3775
+
3776
+
3777
+ <fo:marker marker-class-name="table_continued"/>
3778
+
3714
3779
  <fo:block/>
3715
3780
  </fo:table-cell>
3716
3781
  </fo:table-row>
3717
3782
  <fo:table-row height="0" keep-with-next.within-page="always">
3718
3783
  <fo:table-cell>
3719
- <fo:marker marker-class-name="table_continued">
3720
- <!-- <fo:inline font-style="italic" font-weight="normal"> -->
3721
- <xsl:value-of select="$title_continued"/>
3722
- <!-- </fo:inline> -->
3723
- </fo:marker>
3784
+
3785
+ <fo:marker marker-class-name="table_continued">
3786
+ <xsl:value-of select="$title_continued"/>
3787
+ </fo:marker>
3724
3788
  <fo:block/>
3725
3789
  </fo:table-cell>
3726
3790
  </fo:table-row>
@@ -3757,6 +3821,7 @@
3757
3821
 
3758
3822
 
3759
3823
 
3824
+
3760
3825
  </xsl:if>
3761
3826
  <xsl:if test="$parent-name = 'tfoot'">
3762
3827
 
@@ -3770,6 +3835,10 @@
3770
3835
 
3771
3836
 
3772
3837
 
3838
+
3839
+
3840
+
3841
+
3773
3842
  <!-- <xsl:if test="$namespace = 'bipm'">
3774
3843
  <xsl:attribute name="height">8mm</xsl:attribute>
3775
3844
  </xsl:if> -->
@@ -3781,12 +3850,14 @@
3781
3850
  <xsl:attribute name="text-align">
3782
3851
  <xsl:choose>
3783
3852
  <xsl:when test="@align">
3784
- <xsl:value-of select="@align"/>
3853
+ <xsl:call-template name="setAlignment"/>
3854
+ <!-- <xsl:value-of select="@align"/> -->
3785
3855
  </xsl:when>
3786
3856
  <xsl:otherwise>center</xsl:otherwise>
3787
3857
  </xsl:choose>
3788
3858
  </xsl:attribute>
3789
3859
 
3860
+
3790
3861
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
3791
3862
 
3792
3863
 
@@ -3799,6 +3870,10 @@
3799
3870
 
3800
3871
 
3801
3872
 
3873
+
3874
+ <xsl:if test="$lang = 'ar'">
3875
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3876
+ </xsl:if>
3802
3877
  <xsl:if test="@colspan">
3803
3878
  <xsl:attribute name="number-columns-spanned">
3804
3879
  <xsl:value-of select="@colspan"/>
@@ -3830,16 +3905,21 @@
3830
3905
  <xsl:attribute name="text-align">
3831
3906
  <xsl:choose>
3832
3907
  <xsl:when test="@align">
3833
- <xsl:value-of select="@align"/>
3908
+ <xsl:call-template name="setAlignment"/>
3909
+ <!-- <xsl:value-of select="@align"/> -->
3834
3910
  </xsl:when>
3835
3911
  <xsl:otherwise>left</xsl:otherwise>
3836
3912
  </xsl:choose>
3837
3913
  </xsl:attribute>
3914
+ <xsl:if test="$lang = 'ar'">
3915
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3916
+ </xsl:if>
3838
3917
  <!-- and ancestor::*[local-name() = 'thead'] -->
3839
3918
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3840
3919
 
3841
3920
 
3842
3921
 
3922
+
3843
3923
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3844
3924
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3845
3925
  </xsl:if>
@@ -3852,6 +3932,12 @@
3852
3932
 
3853
3933
 
3854
3934
 
3935
+
3936
+
3937
+
3938
+ <xsl:if test=".//*[local-name() = 'table']">
3939
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3940
+ </xsl:if>
3855
3941
  <xsl:if test="@colspan">
3856
3942
  <xsl:attribute name="number-columns-spanned">
3857
3943
  <xsl:value-of select="@colspan"/>
@@ -3985,13 +4071,13 @@
3985
4071
  </xsl:choose>
3986
4072
  </xsl:variable>
3987
4073
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3988
- <xsl:element name="{$ns}:table">
4074
+ <!-- <xsl:element name="{$ns}:table"> -->
3989
4075
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3990
4076
  <tbody>
3991
4077
  <xsl:apply-templates mode="dl"/>
3992
4078
  </tbody>
3993
4079
  </xsl:for-each>
3994
- </xsl:element>
4080
+ <!-- </xsl:element> -->
3995
4081
  </xsl:variable>
3996
4082
 
3997
4083
  <xsl:call-template name="calculate-column-widths">
@@ -4076,6 +4162,7 @@
4076
4162
 
4077
4163
 
4078
4164
 
4165
+
4079
4166
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4080
4167
 
4081
4168
 
@@ -4088,6 +4175,8 @@
4088
4175
  <xsl:apply-templates/>
4089
4176
  </fo:inline>
4090
4177
  </xsl:template><xsl:template match="*[local-name()='dl']">
4178
+ <xsl:variable name="isAdded" select="@added"/>
4179
+ <xsl:variable name="isDeleted" select="@deleted"/>
4091
4180
  <fo:block-container>
4092
4181
 
4093
4182
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4104,6 +4193,12 @@
4104
4193
  </xsl:attribute>
4105
4194
 
4106
4195
  </xsl:if>
4196
+
4197
+ <xsl:call-template name="setTrackChangesStyles">
4198
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4199
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4200
+ </xsl:call-template>
4201
+
4107
4202
  <fo:block-container>
4108
4203
 
4109
4204
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -4168,6 +4263,7 @@
4168
4263
 
4169
4264
 
4170
4265
 
4266
+
4171
4267
  <xsl:variable name="title-key">
4172
4268
 
4173
4269
  <xsl:call-template name="getLocalizedString">
@@ -4225,11 +4321,11 @@
4225
4321
  </xsl:choose>
4226
4322
  </xsl:variable>
4227
4323
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
4228
- <xsl:element name="{$ns}:table">
4324
+ <!-- <xsl:element name="{$ns}:table"> -->
4229
4325
  <tbody>
4230
4326
  <xsl:apply-templates mode="dl"/>
4231
4327
  </tbody>
4232
- </xsl:element>
4328
+ <!-- </xsl:element> -->
4233
4329
  </xsl:variable>
4234
4330
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
4235
4331
  <xsl:variable name="colwidths">
@@ -4383,6 +4479,7 @@
4383
4479
 
4384
4480
  <fo:table-row>
4385
4481
 
4482
+
4386
4483
  <fo:table-cell>
4387
4484
 
4388
4485
  <fo:block margin-top="6pt">
@@ -4400,6 +4497,7 @@
4400
4497
 
4401
4498
 
4402
4499
 
4500
+
4403
4501
  <xsl:apply-templates/>
4404
4502
  <!-- <xsl:if test="$namespace = 'gb'">
4405
4503
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -4456,6 +4554,8 @@
4456
4554
 
4457
4555
  <xsl:apply-templates/>
4458
4556
  </fo:inline>
4557
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4558
+ <fo:inline padding-right="{@value}"> </fo:inline>
4459
4559
  </xsl:template><xsl:template match="*[local-name()='sup']">
4460
4560
  <fo:inline font-size="80%" vertical-align="super">
4461
4561
  <xsl:apply-templates/>
@@ -4481,6 +4581,7 @@
4481
4581
 
4482
4582
 
4483
4583
 
4584
+
4484
4585
 
4485
4586
  </xsl:variable>
4486
4587
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4499,9 +4600,71 @@
4499
4600
  <xsl:apply-templates/>
4500
4601
  </fo:inline>
4501
4602
  </xsl:template><xsl:template match="*[local-name()='add']">
4502
- <fo:inline xsl:use-attribute-sets="add-style">
4503
- <xsl:apply-templates/>
4504
- </fo:inline>
4603
+ <xsl:choose>
4604
+ <xsl:when test="@amendment">
4605
+ <fo:inline>
4606
+ <xsl:call-template name="insertTag">
4607
+ <xsl:with-param name="kind">A</xsl:with-param>
4608
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4609
+ </xsl:call-template>
4610
+ <xsl:apply-templates/>
4611
+ <xsl:call-template name="insertTag">
4612
+ <xsl:with-param name="type">closing</xsl:with-param>
4613
+ <xsl:with-param name="kind">A</xsl:with-param>
4614
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4615
+ </xsl:call-template>
4616
+ </fo:inline>
4617
+ </xsl:when>
4618
+ <xsl:when test="@corrigenda">
4619
+ <fo:inline>
4620
+ <xsl:call-template name="insertTag">
4621
+ <xsl:with-param name="kind">C</xsl:with-param>
4622
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4623
+ </xsl:call-template>
4624
+ <xsl:apply-templates/>
4625
+ <xsl:call-template name="insertTag">
4626
+ <xsl:with-param name="type">closing</xsl:with-param>
4627
+ <xsl:with-param name="kind">C</xsl:with-param>
4628
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4629
+ </xsl:call-template>
4630
+ </fo:inline>
4631
+ </xsl:when>
4632
+ <xsl:otherwise>
4633
+ <fo:inline xsl:use-attribute-sets="add-style">
4634
+ <xsl:apply-templates/>
4635
+ </fo:inline>
4636
+ </xsl:otherwise>
4637
+ </xsl:choose>
4638
+
4639
+ </xsl:template><xsl:template name="insertTag">
4640
+ <xsl:param name="type"/>
4641
+ <xsl:param name="kind"/>
4642
+ <xsl:param name="value"/>
4643
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4644
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4645
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4646
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4647
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4648
+ <xsl:attribute name="height">5mm</xsl:attribute>
4649
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4650
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4651
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4652
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4653
+ <g>
4654
+ <xsl:if test="$type = 'closing'">
4655
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4656
+ </xsl:if>
4657
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4658
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4659
+ </g>
4660
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4661
+ <xsl:if test="$type = 'closing'">
4662
+ <xsl:attribute name="x">25</xsl:attribute>
4663
+ </xsl:if>
4664
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4665
+ </text>
4666
+ </svg>
4667
+ </fo:instream-foreign-object>
4505
4668
  </xsl:template><xsl:template match="*[local-name()='del']">
4506
4669
  <fo:inline xsl:use-attribute-sets="del-style">
4507
4670
  <xsl:apply-templates/>
@@ -4800,11 +4963,15 @@
4800
4963
  </xsl:apply-templates>
4801
4964
  </xsl:template><xsl:template name="getLang">
4802
4965
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4966
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4803
4967
  <xsl:variable name="language">
4804
4968
  <xsl:choose>
4805
4969
  <xsl:when test="$language_current != ''">
4806
4970
  <xsl:value-of select="$language_current"/>
4807
4971
  </xsl:when>
4972
+ <xsl:when test="$language_current_2 != ''">
4973
+ <xsl:value-of select="$language_current_2"/>
4974
+ </xsl:when>
4808
4975
  <xsl:otherwise>
4809
4976
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4810
4977
  </xsl:otherwise>
@@ -4844,13 +5011,30 @@
4844
5011
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4845
5012
  <xsl:value-of select="substring($str, 2)"/>
4846
5013
  </xsl:template><xsl:template match="mathml:math">
4847
- <fo:inline font-family="STIX Two Math"> <!-- -->
5014
+ <xsl:variable name="isAdded" select="@added"/>
5015
+ <xsl:variable name="isDeleted" select="@deleted"/>
5016
+
5017
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5018
+
5019
+
5020
+ <xsl:call-template name="setTrackChangesStyles">
5021
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5022
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5023
+ </xsl:call-template>
4848
5024
 
4849
5025
  <xsl:variable name="mathml">
4850
5026
  <xsl:apply-templates select="." mode="mathml"/>
4851
5027
  </xsl:variable>
4852
5028
  <fo:instream-foreign-object fox:alt-text="Math">
4853
5029
 
5030
+
5031
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
5032
+ <xsl:attribute name="width">95%</xsl:attribute>
5033
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5034
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5035
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5036
+ </xsl:if>
5037
+
4854
5038
  <!-- <xsl:copy-of select="."/> -->
4855
5039
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4856
5040
  </fo:instream-foreign-object>
@@ -4868,9 +5052,27 @@
4868
5052
  <xsl:copy>
4869
5053
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4870
5054
  </xsl:copy>
4871
- <mathml:mspace width="0.5ex"/>
5055
+ <xsl:choose>
5056
+ <!-- if in msub, then don't add space -->
5057
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
5058
+ <!-- if next char in digit, don't add space -->
5059
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
5060
+ <xsl:otherwise>
5061
+ <mathml:mspace width="0.5ex"/>
5062
+ </xsl:otherwise>
5063
+ </xsl:choose>
4872
5064
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4873
5065
  <xsl:variable name="target">
5066
+ <xsl:choose>
5067
+ <xsl:when test="@updatetype = 'true'">
5068
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
5069
+ </xsl:when>
5070
+ <xsl:otherwise>
5071
+ <xsl:value-of select="normalize-space(@target)"/>
5072
+ </xsl:otherwise>
5073
+ </xsl:choose>
5074
+ </xsl:variable>
5075
+ <xsl:variable name="target_text">
4874
5076
  <xsl:choose>
4875
5077
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4876
5078
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -4882,20 +5084,21 @@
4882
5084
  </xsl:variable>
4883
5085
  <fo:inline xsl:use-attribute-sets="link-style">
4884
5086
 
5087
+
4885
5088
  <xsl:choose>
4886
- <xsl:when test="$target = ''">
5089
+ <xsl:when test="$target_text = ''">
4887
5090
  <xsl:apply-templates/>
4888
5091
  </xsl:when>
4889
5092
  <xsl:otherwise>
4890
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
5093
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
4891
5094
  <xsl:choose>
4892
5095
  <xsl:when test="normalize-space(.) = ''">
4893
- <!-- <xsl:value-of select="$target"/> -->
4894
5096
  <xsl:call-template name="add-zero-spaces-link-java">
4895
- <xsl:with-param name="text" select="$target"/>
5097
+ <xsl:with-param name="text" select="$target_text"/>
4896
5098
  </xsl:call-template>
4897
5099
  </xsl:when>
4898
5100
  <xsl:otherwise>
5101
+ <!-- output text from <link>text</link> -->
4899
5102
  <xsl:apply-templates/>
4900
5103
  </xsl:otherwise>
4901
5104
  </xsl:choose>
@@ -5007,6 +5210,7 @@
5007
5210
 
5008
5211
 
5009
5212
  <fo:inline xsl:use-attribute-sets="note-name-style">
5213
+
5010
5214
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5011
5215
  </fo:inline>
5012
5216
  <xsl:apply-templates/>
@@ -5032,7 +5236,9 @@
5032
5236
  </xsl:choose>
5033
5237
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
5034
5238
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5239
+
5035
5240
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5241
+
5036
5242
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5037
5243
  </fo:inline>
5038
5244
  <xsl:apply-templates/>
@@ -5096,16 +5302,27 @@
5096
5302
  </fo:inline>
5097
5303
  </xsl:if>
5098
5304
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5305
+ <xsl:variable name="isAdded" select="@added"/>
5306
+ <xsl:variable name="isDeleted" select="@deleted"/>
5099
5307
  <fo:block-container id="{@id}">
5100
5308
 
5309
+ <xsl:call-template name="setTrackChangesStyles">
5310
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5311
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5312
+ </xsl:call-template>
5313
+
5101
5314
  <fo:block>
5315
+
5102
5316
  <xsl:apply-templates/>
5103
5317
  </fo:block>
5104
5318
  <xsl:call-template name="fn_display_figure"/>
5105
5319
  <xsl:for-each select="*[local-name() = 'note']">
5106
5320
  <xsl:call-template name="note"/>
5107
5321
  </xsl:for-each>
5108
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5322
+
5323
+
5324
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5325
+
5109
5326
  </fo:block-container>
5110
5327
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
5111
5328
  <fo:block id="{@id}">
@@ -5117,6 +5334,8 @@
5117
5334
  <xsl:apply-templates/>
5118
5335
  </fo:block>
5119
5336
  </xsl:template><xsl:template match="*[local-name() = 'image']">
5337
+ <xsl:variable name="isAdded" select="../@added"/>
5338
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5120
5339
  <xsl:choose>
5121
5340
  <xsl:when test="ancestor::*[local-name() = 'title']">
5122
5341
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -5132,7 +5351,26 @@
5132
5351
  <xsl:variable name="src">
5133
5352
  <xsl:call-template name="image_src"/>
5134
5353
  </xsl:variable>
5135
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5354
+
5355
+ <xsl:choose>
5356
+ <xsl:when test="$isDeleted = 'true'">
5357
+ <!-- enclose in svg -->
5358
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5359
+ <xsl:attribute name="width">100%</xsl:attribute>
5360
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5361
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5362
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5363
+
5364
+
5365
+ <xsl:apply-templates select="." mode="cross_image"/>
5366
+
5367
+ </fo:instream-foreign-object>
5368
+ </xsl:when>
5369
+ <xsl:otherwise>
5370
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5371
+ </xsl:otherwise>
5372
+ </xsl:choose>
5373
+
5136
5374
  </fo:block>
5137
5375
  </xsl:otherwise>
5138
5376
  </xsl:choose>
@@ -5148,21 +5386,70 @@
5148
5386
  <xsl:value-of select="@src"/>
5149
5387
  </xsl:otherwise>
5150
5388
  </xsl:choose>
5389
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5390
+ <xsl:choose>
5391
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5392
+ <xsl:variable name="src">
5393
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5394
+ </xsl:variable>
5395
+ <xsl:variable name="width" select="document($src)/@width"/>
5396
+ <xsl:variable name="height" select="document($src)/@height"/>
5397
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5398
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5399
+ </svg>
5400
+ </xsl:when>
5401
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5402
+ <xsl:variable name="src">
5403
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5404
+ </xsl:variable>
5405
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5406
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5407
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5408
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5409
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5410
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5411
+ </svg>
5412
+ </xsl:when>
5413
+ <xsl:otherwise>
5414
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5415
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5416
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5417
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5418
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5419
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5420
+ <!-- width=<xsl:value-of select="$width"/> -->
5421
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5422
+ <!-- height=<xsl:value-of select="$height"/> -->
5423
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5424
+ <image xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5425
+ <xsl:call-template name="svg_cross">
5426
+ <xsl:with-param name="width" select="$width"/>
5427
+ <xsl:with-param name="height" select="$height"/>
5428
+ </xsl:call-template>
5429
+ </svg>
5430
+ </xsl:otherwise>
5431
+ </xsl:choose>
5432
+
5433
+ </xsl:template><xsl:template name="svg_cross">
5434
+ <xsl:param name="width"/>
5435
+ <xsl:param name="height"/>
5436
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5437
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5151
5438
  </xsl:template><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">
5152
5439
  <xsl:apply-templates mode="contents"/>
5153
5440
  <xsl:text> </xsl:text>
5154
5441
  </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">
5155
5442
  <xsl:apply-templates mode="bookmarks"/>
5156
5443
  <xsl:text> </xsl:text>
5157
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
5444
+ </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">
5158
5445
  <xsl:value-of select="."/>
5159
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5446
+ </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">
5160
5447
  <xsl:value-of select="."/>
5161
5448
  </xsl:template><xsl:template match="node()" mode="contents">
5162
5449
  <xsl:apply-templates mode="contents"/>
5163
5450
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5164
5451
  <xsl:apply-templates mode="bookmarks"/>
5165
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5452
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5166
5453
  <xsl:apply-templates select="."/>
5167
5454
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5168
5455
  <xsl:apply-templates mode="bookmarks"/>
@@ -5310,6 +5597,7 @@
5310
5597
  <xsl:if test="normalize-space() != ''">
5311
5598
  <fo:block xsl:use-attribute-sets="figure-name-style">
5312
5599
 
5600
+
5313
5601
  <xsl:apply-templates/>
5314
5602
  </fo:block>
5315
5603
  </xsl:if>
@@ -5361,6 +5649,8 @@
5361
5649
  </fo:list-item-body>
5362
5650
  </fo:list-item>
5363
5651
  </fo:list-block>
5652
+ </xsl:template><xsl:template name="extractSection">
5653
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5364
5654
  </xsl:template><xsl:template name="extractTitle">
5365
5655
  <xsl:choose>
5366
5656
  <xsl:when test="*[local-name() = 'tab']">
@@ -5387,6 +5677,8 @@
5387
5677
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5388
5678
 
5389
5679
  <fo:block-container margin-left="0mm">
5680
+ <xsl:copy-of select="@id"/>
5681
+
5390
5682
  <xsl:if test="parent::*[local-name() = 'note']">
5391
5683
  <xsl:attribute name="margin-left">
5392
5684
  <xsl:choose>
@@ -5397,7 +5689,9 @@
5397
5689
 
5398
5690
  </xsl:if>
5399
5691
  <fo:block-container margin-left="0mm">
5400
-
5692
+
5693
+
5694
+
5401
5695
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5402
5696
  <xsl:variable name="_font-size">
5403
5697
 
@@ -5408,6 +5702,7 @@
5408
5702
  9
5409
5703
 
5410
5704
 
5705
+
5411
5706
 
5412
5707
 
5413
5708
 
@@ -5425,10 +5720,14 @@
5425
5720
  </xsl:choose>
5426
5721
  </xsl:attribute>
5427
5722
  </xsl:if>
5428
- <xsl:apply-templates/>
5429
- </fo:block>
5723
+
5724
+ <xsl:apply-templates/>
5725
+ </fo:block>
5726
+
5727
+
5430
5728
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5431
5729
 
5730
+
5432
5731
  </fo:block-container>
5433
5732
  </fo:block-container>
5434
5733
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5663,6 +5962,7 @@
5663
5962
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5664
5963
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5665
5964
 
5965
+
5666
5966
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5667
5967
 
5668
5968
  <xsl:variable name="element">
@@ -5690,6 +5990,7 @@
5690
5990
  <xsl:variable name="element">
5691
5991
 
5692
5992
  inline
5993
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5693
5994
  </xsl:variable>
5694
5995
  <xsl:choose>
5695
5996
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5697,7 +5998,7 @@
5697
5998
  <xsl:apply-templates/>
5698
5999
  </fo:inline>
5699
6000
  </xsl:when>
5700
- <xsl:when test="normalize-space($element) = 'block'">
6001
+ <xsl:when test="contains(normalize-space($element), 'block')">
5701
6002
  <fo:block xsl:use-attribute-sets="example-name-style">
5702
6003
  <xsl:apply-templates/>
5703
6004
  </fo:block>
@@ -5734,7 +6035,7 @@
5734
6035
  </fo:inline>
5735
6036
  </xsl:otherwise>
5736
6037
  </xsl:choose>
5737
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
6038
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5738
6039
  <fo:block xsl:use-attribute-sets="termsource-style">
5739
6040
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5740
6041
  <xsl:variable name="termsource_text">
@@ -5743,13 +6044,15 @@
5743
6044
 
5744
6045
  <xsl:choose>
5745
6046
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5746
- <xsl:apply-templates/>
6047
+ <!-- <xsl:apply-templates /> -->
6048
+ <xsl:copy-of select="$termsource_text"/>
5747
6049
  </xsl:when>
5748
6050
  <xsl:otherwise>
5749
6051
 
5750
6052
  <xsl:text>[</xsl:text>
5751
6053
 
5752
- <xsl:apply-templates/>
6054
+ <!-- <xsl:apply-templates /> -->
6055
+ <xsl:copy-of select="$termsource_text"/>
5753
6056
 
5754
6057
  <xsl:text>]</xsl:text>
5755
6058
 
@@ -5760,20 +6063,27 @@
5760
6063
  <xsl:if test="normalize-space() != ''">
5761
6064
  <xsl:value-of select="."/>
5762
6065
  </xsl:if>
5763
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
6066
+ </xsl:template><xsl:variable name="localized.source">
6067
+ <xsl:call-template name="getLocalizedString">
6068
+ <xsl:with-param name="key">source</xsl:with-param>
6069
+ </xsl:call-template>
6070
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5764
6071
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6072
+ <xsl:if test="normalize-space(@citeas) = ''">
6073
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6074
+ </xsl:if>
5765
6075
 
5766
6076
  <fo:inline>
5767
6077
 
5768
6078
 
5769
6079
 
5770
- <xsl:call-template name="getLocalizedString">
5771
- <xsl:with-param name="key">source</xsl:with-param>
5772
- </xsl:call-template>
6080
+
6081
+ <xsl:value-of select="$localized.source"/>
6082
+ <xsl:text>: </xsl:text>
6083
+
5773
6084
 
5774
6085
 
5775
6086
 
5776
- <xsl:text>: </xsl:text>
5777
6087
  </fo:inline>
5778
6088
 
5779
6089
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -5879,6 +6189,7 @@
5879
6189
 
5880
6190
 
5881
6191
 
6192
+
5882
6193
  <xsl:choose>
5883
6194
  <xsl:when test="$depth = 2">3</xsl:when>
5884
6195
  <xsl:otherwise>4</xsl:otherwise>
@@ -5921,7 +6232,8 @@
5921
6232
  </fo:inline>
5922
6233
  </xsl:when>
5923
6234
  <xsl:otherwise>
5924
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6235
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6236
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5925
6237
  </xsl:otherwise>
5926
6238
  </xsl:choose>
5927
6239
 
@@ -5980,7 +6292,6 @@
5980
6292
 
5981
6293
 
5982
6294
 
5983
-
5984
6295
  <xsl:apply-templates/>
5985
6296
  </fo:block>
5986
6297
 
@@ -5997,6 +6308,7 @@
5997
6308
  <xsl:call-template name="setId"/>
5998
6309
 
5999
6310
 
6311
+
6000
6312
  <xsl:apply-templates/>
6001
6313
  </fo:block>
6002
6314
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -6023,7 +6335,7 @@
6023
6335
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6024
6336
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6025
6337
  <xsl:choose>
6026
- <xsl:when test="parent::*[local-name() = 'note']">
6338
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
6027
6339
  <fo:block-container>
6028
6340
  <xsl:attribute name="margin-left">
6029
6341
  <xsl:choose>
@@ -6033,6 +6345,7 @@
6033
6345
  </xsl:attribute>
6034
6346
 
6035
6347
 
6348
+
6036
6349
  <fo:block-container margin-left="0mm">
6037
6350
  <fo:block>
6038
6351
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -6234,21 +6547,51 @@
6234
6547
 
6235
6548
 
6236
6549
 
6550
+
6551
+
6552
+ <!-- start ISO bibtem processing -->
6553
+ <xsl:variable name="docidentifier">
6554
+ <xsl:if test="*[local-name() = 'docidentifier']">
6555
+ <xsl:choose>
6556
+ <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
6557
+ <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier']"/></xsl:otherwise>
6558
+ </xsl:choose>
6559
+ </xsl:if>
6560
+ </xsl:variable>
6561
+ <xsl:value-of select="$docidentifier"/>
6562
+ <xsl:apply-templates select="*[local-name() = 'note']"/>
6563
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6564
+ <xsl:choose>
6565
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
6566
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
6567
+ </xsl:when>
6568
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
6569
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
6570
+ </xsl:when>
6571
+ <xsl:otherwise>
6572
+ <xsl:apply-templates select="*[local-name() = 'title']"/>
6573
+ </xsl:otherwise>
6574
+ </xsl:choose>
6575
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6576
+ <!-- end ISO bibitem processing -->
6577
+
6578
+
6579
+
6237
6580
  </xsl:template><xsl:template name="processBibitemDocId">
6238
6581
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
6239
6582
  <xsl:choose>
6240
6583
  <xsl:when test="normalize-space($_doc_ident) != ''">
6241
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
6584
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
6242
6585
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
6243
6586
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6244
- </xsl:if>
6587
+ </xsl:if> -->
6245
6588
  <xsl:value-of select="$_doc_ident"/>
6246
6589
  </xsl:when>
6247
6590
  <xsl:otherwise>
6248
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6591
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6249
6592
  <xsl:if test="$type != ''">
6250
6593
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6251
- </xsl:if>
6594
+ </xsl:if> -->
6252
6595
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6253
6596
  </xsl:otherwise>
6254
6597
  </xsl:choose>
@@ -6290,6 +6633,70 @@
6290
6633
  <xsl:value-of select="substring(.,1,1)"/>
6291
6634
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
6292
6635
  <fo:inline><xsl:apply-templates/></fo:inline>
6636
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6637
+ <fo:block>
6638
+ <xsl:apply-templates/>
6639
+ </fo:block>
6640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6641
+ <fo:inline><xsl:apply-templates/></fo:inline>
6642
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6643
+ <fo:inline>
6644
+ <xsl:call-template name="text_input"/>
6645
+ </fo:inline>
6646
+ </xsl:template><xsl:template name="text_input">
6647
+ <xsl:variable name="count">
6648
+ <xsl:choose>
6649
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6650
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6651
+ <xsl:otherwise>10</xsl:otherwise>
6652
+ </xsl:choose>
6653
+ </xsl:variable>
6654
+ <xsl:call-template name="repeat">
6655
+ <xsl:with-param name="char" select="'_'"/>
6656
+ <xsl:with-param name="count" select="$count"/>
6657
+ </xsl:call-template>
6658
+ <xsl:text> </xsl:text>
6659
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6660
+ <xsl:variable name="caption">
6661
+ <xsl:choose>
6662
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6663
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6664
+ </xsl:choose>
6665
+ </xsl:variable>
6666
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6667
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6668
+ <fo:inline padding-right="1mm">
6669
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6670
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6671
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6672
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6673
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6674
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6675
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6676
+ </svg>
6677
+ </fo:instream-foreign-object>
6678
+ </fo:inline>
6679
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6680
+ <fo:inline padding-right="1mm">
6681
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6682
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6683
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6684
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6685
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6686
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6687
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6688
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6689
+ </svg>
6690
+ </fo:instream-foreign-object>
6691
+ </fo:inline>
6692
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6693
+ <fo:inline>
6694
+ <xsl:call-template name="text_input"/>
6695
+ </fo:inline>
6696
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6697
+ <fo:block-container border="1pt solid black" width="50%">
6698
+ <fo:block> </fo:block>
6699
+ </fo:block-container>
6293
6700
  </xsl:template><xsl:template name="convertDate">
6294
6701
  <xsl:param name="date"/>
6295
6702
  <xsl:param name="format" select="'short'"/>
@@ -6497,6 +6904,9 @@
6497
6904
  <xsl:when test="parent::*[local-name() = 'preface']">
6498
6905
  <xsl:value-of select="$level_total - 1"/>
6499
6906
  </xsl:when>
6907
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
6908
+ <xsl:value-of select="$level_total - 1"/>
6909
+ </xsl:when>
6500
6910
  <xsl:when test="ancestor::*[local-name() = 'preface']">
6501
6911
  <xsl:value-of select="$level_total - 2"/>
6502
6912
  </xsl:when>
@@ -6552,6 +6962,7 @@
6552
6962
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
6553
6963
  <xsl:variable name="XSLNS">
6554
6964
 
6965
+
6555
6966
  <xsl:value-of select="document('')//*/namespace::iso"/>
6556
6967
 
6557
6968
 
@@ -6621,17 +7032,79 @@
6621
7032
  </xsl:call-template>
6622
7033
  </xsl:if>
6623
7034
  </xsl:template><xsl:template name="getLocalizedString">
6624
- <xsl:param name="key"/>
7035
+ <xsl:param name="key"/>
6625
7036
 
6626
7037
  <xsl:variable name="curr_lang">
6627
7038
  <xsl:call-template name="getLang"/>
6628
7039
  </xsl:variable>
6629
7040
 
7041
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
7042
+
6630
7043
  <xsl:choose>
7044
+ <xsl:when test="$data_value != ''">
7045
+ <xsl:value-of select="$data_value"/>
7046
+ </xsl:when>
6631
7047
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6632
7048
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6633
7049
  </xsl:when>
6634
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
7050
+ <xsl:otherwise>
7051
+ <xsl:variable name="key_">
7052
+ <xsl:call-template name="capitalize">
7053
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
7054
+ </xsl:call-template>
7055
+ </xsl:variable>
7056
+ <xsl:value-of select="$key_"/>
7057
+ </xsl:otherwise>
6635
7058
  </xsl:choose>
6636
7059
 
7060
+ </xsl:template><xsl:template name="setTrackChangesStyles">
7061
+ <xsl:param name="isAdded"/>
7062
+ <xsl:param name="isDeleted"/>
7063
+ <xsl:choose>
7064
+ <xsl:when test="local-name() = 'math'">
7065
+ <xsl:if test="$isAdded = 'true'">
7066
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
7067
+ </xsl:if>
7068
+ <xsl:if test="$isDeleted = 'true'">
7069
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
7070
+ </xsl:if>
7071
+ </xsl:when>
7072
+ <xsl:otherwise>
7073
+ <xsl:if test="$isAdded = 'true'">
7074
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
7075
+ <xsl:attribute name="padding">2mm</xsl:attribute>
7076
+ </xsl:if>
7077
+ <xsl:if test="$isDeleted = 'true'">
7078
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
7079
+ <xsl:if test="local-name() = 'table'">
7080
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
7081
+ </xsl:if>
7082
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
7083
+ <xsl:attribute name="padding">2mm</xsl:attribute>
7084
+ </xsl:if>
7085
+ </xsl:otherwise>
7086
+ </xsl:choose>
7087
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
7088
+ <xsl:if test="$lang = 'ar'">
7089
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
7090
+ </xsl:if>
7091
+ </xsl:template><xsl:template name="setAlignment">
7092
+ <xsl:param name="align" select="normalize-space(@align)"/>
7093
+ <xsl:choose>
7094
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
7095
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
7096
+ <xsl:when test="$align != ''">
7097
+ <xsl:value-of select="$align"/>
7098
+ </xsl:when>
7099
+ </xsl:choose>
7100
+ </xsl:template><xsl:template name="setTextAlignment">
7101
+ <xsl:param name="default">left</xsl:param>
7102
+ <xsl:attribute name="text-align">
7103
+ <xsl:choose>
7104
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7105
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7106
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7107
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7108
+ </xsl:choose>
7109
+ </xsl:attribute>
6637
7110
  </xsl:template></xsl:stylesheet>