metanorma-iso 1.7.4 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) 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 +3 -7
  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 +321 -4
  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 +8 -2
  21. data/lib/isodoc/iso/html/style-human.css +7 -0
  22. data/lib/isodoc/iso/html/style-iso.css +7 -0
  23. data/lib/isodoc/iso/html_convert.rb +0 -1
  24. data/lib/isodoc/iso/iso.amendment.xsl +680 -198
  25. data/lib/isodoc/iso/iso.international-standard.xsl +680 -198
  26. data/lib/isodoc/iso/metadata.rb +1 -0
  27. data/lib/isodoc/iso/presentation_xml_convert.rb +44 -33
  28. data/lib/isodoc/iso/sts_convert.rb +10 -13
  29. data/lib/isodoc/iso/word_convert.rb +0 -1
  30. data/lib/isodoc/iso/xref.rb +52 -34
  31. data/lib/metanorma/iso/processor.rb +1 -0
  32. data/lib/metanorma/iso/version.rb +1 -1
  33. data/metanorma-iso.gemspec +7 -7
  34. data/spec/asciidoctor/base_spec.rb +426 -305
  35. data/spec/asciidoctor/blocks_spec.rb +96 -34
  36. data/spec/asciidoctor/cleanup_spec.rb +383 -25
  37. data/spec/asciidoctor/section_spec.rb +0 -14
  38. data/spec/asciidoctor/validate_spec.rb +218 -83
  39. data/spec/isodoc/postproc_spec.rb +481 -438
  40. data/spec/spec_helper.rb +16 -15
  41. metadata +46 -46
  42. data/lib/isodoc/iso/html/scripts.html +0 -178
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -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">
@@ -1964,7 +1919,24 @@
1964
1919
  <!-- SVG images processing -->
1965
1920
  <!-- =================== -->
1966
1921
  <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/>
1967
- <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2">
1922
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
1923
+ <xsl:param name="name"/>
1924
+
1925
+ <xsl:variable name="svg_content">
1926
+ <xsl:apply-templates select="." mode="svg_update"/>
1927
+ </xsl:variable>
1928
+
1929
+ <xsl:variable name="alt-text">
1930
+ <xsl:choose>
1931
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
1932
+ <xsl:value-of select="../*[local-name() = 'name']"/>
1933
+ </xsl:when>
1934
+ <xsl:when test="normalize-space($name) != ''">
1935
+ <xsl:value-of select="$name"/>
1936
+ </xsl:when>
1937
+ <xsl:otherwise>Figure</xsl:otherwise>
1938
+ </xsl:choose>
1939
+ </xsl:variable>
1968
1940
 
1969
1941
  <xsl:choose>
1970
1942
  <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
@@ -2021,13 +1993,14 @@
2021
1993
  </fo:block>
2022
1994
  </xsl:if>
2023
1995
  <fo:block text-depth="0" line-height="0" font-size="0">
2024
- <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
1996
+
1997
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2025
1998
  <xsl:attribute name="width">100%</xsl:attribute>
2026
1999
  <xsl:attribute name="content-height">100%</xsl:attribute>
2027
2000
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2028
2001
  <xsl:attribute name="scaling">uniform</xsl:attribute>
2029
2002
 
2030
- <xsl:apply-templates select="." mode="svg_remove_a"/>
2003
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
2031
2004
  </fo:instream-foreign-object>
2032
2005
  </fo:block>
2033
2006
 
@@ -2045,7 +2018,7 @@
2045
2018
  </xsl:when>
2046
2019
  <xsl:otherwise>
2047
2020
  <fo:block xsl:use-attribute-sets="image-style">
2048
- <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2021
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2049
2022
  <xsl:attribute name="width">100%</xsl:attribute>
2050
2023
  <xsl:attribute name="content-height">100%</xsl:attribute>
2051
2024
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
@@ -2057,13 +2030,35 @@
2057
2030
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2058
2031
  </xsl:if>
2059
2032
  <xsl:attribute name="scaling">uniform</xsl:attribute>
2060
- <xsl:copy-of select="."/>
2033
+ <xsl:copy-of select="$svg_content"/>
2061
2034
  </fo:instream-foreign-object>
2062
2035
  </fo:block>
2063
2036
  </xsl:otherwise>
2064
2037
  </xsl:choose>
2065
2038
  </xsl:template>
2066
2039
 
2040
+ <xsl:template match="@*|node()" mode="svg_update">
2041
+ <xsl:copy>
2042
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
2043
+ </xsl:copy>
2044
+ </xsl:template>
2045
+
2046
+ <xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
2047
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
2048
+ <xsl:value-of select="."/>
2049
+ </xsl:attribute>
2050
+ </xsl:template>
2051
+
2052
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
2053
+ <xsl:variable name="svg_content" select="document(@src)"/>
2054
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
2055
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
2056
+ <xsl:call-template name="image_svg">
2057
+ <xsl:with-param name="name" select="$name"/>
2058
+ </xsl:call-template>
2059
+ </xsl:for-each>
2060
+ </xsl:template>
2061
+
2067
2062
  <xsl:template match="@*|node()" mode="svg_remove_a">
2068
2063
  <xsl:copy>
2069
2064
  <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
@@ -2630,6 +2625,9 @@
2630
2625
  <title-continued lang="en">(continued)</title-continued>
2631
2626
  <title-continued lang="fr">(continué)</title-continued>
2632
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']"/>
2633
2631
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2634
2632
  <xsl:param name="name"/>
2635
2633
  <xsl:param name="lang"/>
@@ -2655,13 +2653,16 @@
2655
2653
  </xsl:choose>
2656
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">
2657
2655
 
2656
+
2658
2657
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2659
2658
 
2659
+
2660
2660
  <xsl:attribute name="color">blue</xsl:attribute>
2661
2661
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2662
2662
 
2663
2663
 
2664
2664
 
2665
+
2665
2666
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2666
2667
  <xsl:attribute name="white-space">pre</xsl:attribute>
2667
2668
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2728,6 +2729,7 @@
2728
2729
 
2729
2730
 
2730
2731
 
2732
+
2731
2733
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2732
2734
 
2733
2735
 
@@ -2737,6 +2739,7 @@
2737
2739
 
2738
2740
 
2739
2741
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2742
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2740
2743
 
2741
2744
 
2742
2745
 
@@ -2746,9 +2749,7 @@
2746
2749
 
2747
2750
 
2748
2751
 
2749
-
2750
-
2751
-
2752
+
2752
2753
 
2753
2754
 
2754
2755
 
@@ -2783,6 +2784,7 @@
2783
2784
 
2784
2785
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2785
2786
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2787
+
2786
2788
 
2787
2789
 
2788
2790
 
@@ -2801,6 +2803,7 @@
2801
2803
 
2802
2804
 
2803
2805
 
2806
+
2804
2807
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2805
2808
 
2806
2809
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2821,19 +2824,23 @@
2821
2824
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
2822
2825
 
2823
2826
 
2827
+
2824
2828
  <xsl:attribute name="color">blue</xsl:attribute>
2825
2829
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2826
2830
 
2827
2831
 
2832
+
2828
2833
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2829
2834
 
2830
2835
 
2831
2836
 
2832
2837
 
2838
+
2833
2839
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2834
2840
 
2835
2841
 
2836
2842
 
2843
+
2837
2844
 
2838
2845
 
2839
2846
 
@@ -2857,6 +2864,7 @@
2857
2864
 
2858
2865
 
2859
2866
 
2867
+
2860
2868
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
2861
2869
 
2862
2870
 
@@ -2886,6 +2894,7 @@
2886
2894
 
2887
2895
 
2888
2896
 
2897
+
2889
2898
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2890
2899
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
2891
2900
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -2894,6 +2903,7 @@
2894
2903
 
2895
2904
 
2896
2905
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2906
+
2897
2907
 
2898
2908
 
2899
2909
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -2920,18 +2930,22 @@
2920
2930
 
2921
2931
 
2922
2932
 
2933
+
2923
2934
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2924
2935
 
2936
+
2925
2937
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2926
2938
 
2927
2939
 
2928
2940
 
2941
+
2929
2942
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2930
2943
 
2931
2944
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2932
2945
 
2933
2946
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2934
2947
 
2948
+
2935
2949
 
2936
2950
 
2937
2951
 
@@ -2964,10 +2978,12 @@
2964
2978
 
2965
2979
 
2966
2980
 
2981
+
2967
2982
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2968
2983
 
2969
2984
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2970
2985
 
2986
+
2971
2987
  <xsl:attribute name="width">100%</xsl:attribute>
2972
2988
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2973
2989
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -2993,15 +3009,38 @@
2993
3009
 
2994
3010
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2995
3011
 
2996
-
3012
+
3013
+
2997
3014
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2998
3015
 
3016
+
2999
3017
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
3000
3018
 
3001
3019
 
3002
3020
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3003
3021
 
3004
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
3022
+
3023
+ </xsl:attribute-set><xsl:variable name="color-added-text">
3024
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
3025
+ </xsl:variable><xsl:attribute-set name="add-style">
3026
+ <xsl:attribute name="color">red</xsl:attribute>
3027
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3028
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
3029
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
3030
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
3031
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3032
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
3033
+ <xsl:text>red</xsl:text>
3034
+ </xsl:variable><xsl:attribute-set name="del-style">
3035
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
3036
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
3037
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
3038
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
3039
+
3040
+ <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
3041
+
3042
+
3043
+ </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">
3005
3044
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3006
3045
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
3007
3046
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3046,16 +3085,17 @@
3046
3085
  <xsl:call-template name="add-zero-spaces-java"/>
3047
3086
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3048
3087
 
3088
+ <xsl:variable name="table-preamble">
3089
+
3090
+
3091
+ </xsl:variable>
3092
+
3049
3093
  <xsl:variable name="table">
3050
3094
 
3051
3095
  <xsl:variable name="simple-table">
3052
3096
  <xsl:call-template name="getSimpleTable"/>
3053
3097
  </xsl:variable>
3054
3098
 
3055
-
3056
-
3057
-
3058
-
3059
3099
  <!-- <xsl:if test="$namespace = 'bipm'">
3060
3100
  <fo:block>&#xA0;</fo:block>
3061
3101
  </xsl:if> -->
@@ -3066,7 +3106,7 @@
3066
3106
 
3067
3107
 
3068
3108
 
3069
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3109
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3070
3110
 
3071
3111
  <!-- <xsl:variable name="cols-count">
3072
3112
  <xsl:choose>
@@ -3085,8 +3125,6 @@
3085
3125
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3086
3126
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3087
3127
 
3088
-
3089
-
3090
3128
  <xsl:variable name="colwidths">
3091
3129
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3092
3130
  <xsl:call-template name="calculate-column-widths">
@@ -3114,8 +3152,10 @@
3114
3152
  </xsl:choose>
3115
3153
  </xsl:variable>
3116
3154
 
3155
+
3117
3156
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3118
3157
 
3158
+
3119
3159
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3120
3160
 
3121
3161
 
@@ -3127,6 +3167,7 @@
3127
3167
 
3128
3168
 
3129
3169
 
3170
+
3130
3171
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
3131
3172
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3132
3173
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -3136,6 +3177,7 @@
3136
3177
 
3137
3178
 
3138
3179
 
3180
+
3139
3181
  <xsl:variable name="table_width">
3140
3182
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3141
3183
  100%
@@ -3149,12 +3191,19 @@
3149
3191
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3150
3192
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3151
3193
 
3194
+
3152
3195
  <attribute name="border">1.5pt solid black</attribute>
3153
3196
  <xsl:if test="*[local-name()='thead']">
3154
3197
  <attribute name="border-top">1pt solid black</attribute>
3155
3198
  </xsl:if>
3156
3199
 
3157
3200
 
3201
+ <xsl:if test="ancestor::*[local-name() = 'table']">
3202
+ <!-- for internal table in table cell -->
3203
+ <attribute name="border">0.5pt solid black</attribute>
3204
+ </xsl:if>
3205
+
3206
+
3158
3207
 
3159
3208
 
3160
3209
  <attribute name="margin-left">0mm</attribute>
@@ -3249,7 +3298,8 @@
3249
3298
  </fo:block-container>
3250
3299
  </xsl:variable>
3251
3300
 
3252
-
3301
+ <xsl:variable name="isAdded" select="@added"/>
3302
+ <xsl:variable name="isDeleted" select="@deleted"/>
3253
3303
 
3254
3304
  <xsl:choose>
3255
3305
  <xsl:when test="@width">
@@ -3263,7 +3313,14 @@
3263
3313
  <fo:table-body>
3264
3314
  <fo:table-row>
3265
3315
  <fo:table-cell column-number="2">
3266
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3316
+ <xsl:copy-of select="$table-preamble"/>
3317
+ <fo:block>
3318
+ <xsl:call-template name="setTrackChangesStyles">
3319
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3320
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3321
+ </xsl:call-template>
3322
+ <xsl:copy-of select="$table"/>
3323
+ </fo:block>
3267
3324
  </fo:table-cell>
3268
3325
  </fo:table-row>
3269
3326
  </fo:table-body>
@@ -3274,18 +3331,46 @@
3274
3331
 
3275
3332
  </xsl:when>
3276
3333
  <xsl:otherwise>
3277
- <xsl:copy-of select="$table"/>
3334
+ <xsl:choose>
3335
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3336
+ <xsl:copy-of select="$table-preamble"/>
3337
+ <fo:block>
3338
+ <xsl:call-template name="setTrackChangesStyles">
3339
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3340
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3341
+ </xsl:call-template>
3342
+ <xsl:copy-of select="$table"/>
3343
+ </fo:block>
3344
+ </xsl:when>
3345
+ <xsl:otherwise>
3346
+ <xsl:copy-of select="$table-preamble"/>
3347
+ <xsl:copy-of select="$table"/>
3348
+ </xsl:otherwise>
3349
+ </xsl:choose>
3278
3350
  </xsl:otherwise>
3279
3351
  </xsl:choose>
3280
3352
 
3281
3353
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
3354
+ <xsl:param name="continued"/>
3282
3355
  <xsl:if test="normalize-space() != ''">
3283
3356
  <fo:block xsl:use-attribute-sets="table-name-style">
3284
3357
 
3285
3358
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3286
3359
 
3287
3360
 
3288
- <xsl:apply-templates/>
3361
+ <xsl:choose>
3362
+ <xsl:when test="$continued = 'true'">
3363
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
3364
+
3365
+ <xsl:apply-templates/>
3366
+
3367
+ </xsl:when>
3368
+ <xsl:otherwise>
3369
+ <xsl:apply-templates/>
3370
+ </xsl:otherwise>
3371
+ </xsl:choose>
3372
+
3373
+
3289
3374
  </fo:block>
3290
3375
  </xsl:if>
3291
3376
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -3337,7 +3422,7 @@
3337
3422
  </xsl:for-each>
3338
3423
  </xsl:when>
3339
3424
  <xsl:otherwise>
3340
- <xsl:for-each select="xalan:nodeset($table)//tr">
3425
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
3341
3426
  <xsl:variable name="td_text">
3342
3427
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3343
3428
 
@@ -3429,18 +3514,23 @@
3429
3514
  <xsl:apply-templates/>
3430
3515
  </fo:table-header>
3431
3516
  </xsl:template><xsl:template name="table-header-title">
3432
- <xsl:param name="cols-count"/>
3517
+ <xsl:param name="cols-count"/>
3433
3518
  <!-- row for title -->
3434
3519
  <fo:table-row>
3435
3520
  <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">
3436
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3521
+
3522
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3523
+ <xsl:with-param name="continued">true</xsl:with-param>
3524
+ </xsl:apply-templates>
3437
3525
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3438
3526
  <xsl:call-template name="fn_name_display"/>
3439
- </xsl:for-each>
3440
- <fo:block text-align="right" font-style="italic">
3441
- <xsl:text> </xsl:text>
3442
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3443
- </fo:block>
3527
+ </xsl:for-each>
3528
+
3529
+ <fo:block text-align="right" font-style="italic">
3530
+ <xsl:text> </xsl:text>
3531
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3532
+ </fo:block>
3533
+
3444
3534
  </fo:table-cell>
3445
3535
  </fo:table-row>
3446
3536
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3661,19 +3751,25 @@
3661
3751
  <xsl:call-template name="getTitle">
3662
3752
  <xsl:with-param name="name" select="'title-continued'"/>
3663
3753
  </xsl:call-template>
3664
- </xsl:variable>
3754
+ </xsl:variable>
3755
+
3756
+ <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3757
+ <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3758
+
3665
3759
  <fo:table-row height="0" keep-with-next.within-page="always">
3666
3760
  <fo:table-cell>
3667
- <fo:marker marker-class-name="table_continued"/>
3761
+
3762
+
3763
+ <fo:marker marker-class-name="table_continued"/>
3764
+
3668
3765
  <fo:block/>
3669
3766
  </fo:table-cell>
3670
3767
  </fo:table-row>
3671
3768
  <fo:table-row height="0" keep-with-next.within-page="always">
3672
3769
  <fo:table-cell>
3673
- <fo:marker marker-class-name="table_continued">
3674
- <!-- <fo:inline font-style="italic" font-weight="normal"> -->
3675
- <xsl:value-of select="$title_continued"/>
3676
- <!-- </fo:inline> -->
3770
+
3771
+ <fo:marker marker-class-name="table_continued">
3772
+ <xsl:value-of select="$title_continued"/>
3677
3773
  </fo:marker>
3678
3774
  <fo:block/>
3679
3775
  </fo:table-cell>
@@ -3711,6 +3807,7 @@
3711
3807
 
3712
3808
 
3713
3809
 
3810
+
3714
3811
  </xsl:if>
3715
3812
  <xsl:if test="$parent-name = 'tfoot'">
3716
3813
 
@@ -3735,12 +3832,14 @@
3735
3832
  <xsl:attribute name="text-align">
3736
3833
  <xsl:choose>
3737
3834
  <xsl:when test="@align">
3738
- <xsl:value-of select="@align"/>
3835
+ <xsl:call-template name="setAlignment"/>
3836
+ <!-- <xsl:value-of select="@align"/> -->
3739
3837
  </xsl:when>
3740
3838
  <xsl:otherwise>center</xsl:otherwise>
3741
3839
  </xsl:choose>
3742
3840
  </xsl:attribute>
3743
3841
 
3842
+
3744
3843
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
3745
3844
 
3746
3845
 
@@ -3753,6 +3852,10 @@
3753
3852
 
3754
3853
 
3755
3854
 
3855
+
3856
+ <xsl:if test="$lang = 'ar'">
3857
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3858
+ </xsl:if>
3756
3859
  <xsl:if test="@colspan">
3757
3860
  <xsl:attribute name="number-columns-spanned">
3758
3861
  <xsl:value-of select="@colspan"/>
@@ -3784,16 +3887,21 @@
3784
3887
  <xsl:attribute name="text-align">
3785
3888
  <xsl:choose>
3786
3889
  <xsl:when test="@align">
3787
- <xsl:value-of select="@align"/>
3890
+ <xsl:call-template name="setAlignment"/>
3891
+ <!-- <xsl:value-of select="@align"/> -->
3788
3892
  </xsl:when>
3789
3893
  <xsl:otherwise>left</xsl:otherwise>
3790
3894
  </xsl:choose>
3791
3895
  </xsl:attribute>
3896
+ <xsl:if test="$lang = 'ar'">
3897
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3898
+ </xsl:if>
3792
3899
  <!-- and ancestor::*[local-name() = 'thead'] -->
3793
3900
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3794
3901
 
3795
3902
 
3796
3903
 
3904
+
3797
3905
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3798
3906
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3799
3907
  </xsl:if>
@@ -3806,6 +3914,9 @@
3806
3914
 
3807
3915
 
3808
3916
 
3917
+ <xsl:if test=".//*[local-name() = 'table']">
3918
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3919
+ </xsl:if>
3809
3920
  <xsl:if test="@colspan">
3810
3921
  <xsl:attribute name="number-columns-spanned">
3811
3922
  <xsl:value-of select="@colspan"/>
@@ -3939,13 +4050,13 @@
3939
4050
  </xsl:choose>
3940
4051
  </xsl:variable>
3941
4052
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3942
- <xsl:element name="{$ns}:table">
4053
+ <!-- <xsl:element name="{$ns}:table"> -->
3943
4054
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3944
4055
  <tbody>
3945
4056
  <xsl:apply-templates mode="dl"/>
3946
4057
  </tbody>
3947
4058
  </xsl:for-each>
3948
- </xsl:element>
4059
+ <!-- </xsl:element> -->
3949
4060
  </xsl:variable>
3950
4061
 
3951
4062
  <xsl:call-template name="calculate-column-widths">
@@ -4042,6 +4153,8 @@
4042
4153
  <xsl:apply-templates/>
4043
4154
  </fo:inline>
4044
4155
  </xsl:template><xsl:template match="*[local-name()='dl']">
4156
+ <xsl:variable name="isAdded" select="@added"/>
4157
+ <xsl:variable name="isDeleted" select="@deleted"/>
4045
4158
  <fo:block-container>
4046
4159
 
4047
4160
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4058,6 +4171,12 @@
4058
4171
  </xsl:attribute>
4059
4172
 
4060
4173
  </xsl:if>
4174
+
4175
+ <xsl:call-template name="setTrackChangesStyles">
4176
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4177
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4178
+ </xsl:call-template>
4179
+
4061
4180
  <fo:block-container>
4062
4181
 
4063
4182
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -4122,6 +4241,7 @@
4122
4241
 
4123
4242
 
4124
4243
 
4244
+
4125
4245
  <xsl:variable name="title-key">
4126
4246
 
4127
4247
  <xsl:call-template name="getLocalizedString">
@@ -4179,11 +4299,11 @@
4179
4299
  </xsl:choose>
4180
4300
  </xsl:variable>
4181
4301
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
4182
- <xsl:element name="{$ns}:table">
4302
+ <!-- <xsl:element name="{$ns}:table"> -->
4183
4303
  <tbody>
4184
4304
  <xsl:apply-templates mode="dl"/>
4185
4305
  </tbody>
4186
- </xsl:element>
4306
+ <!-- </xsl:element> -->
4187
4307
  </xsl:variable>
4188
4308
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
4189
4309
  <xsl:variable name="colwidths">
@@ -4410,6 +4530,8 @@
4410
4530
 
4411
4531
  <xsl:apply-templates/>
4412
4532
  </fo:inline>
4533
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4534
+ <fo:inline padding-right="{@value}"> </fo:inline>
4413
4535
  </xsl:template><xsl:template match="*[local-name()='sup']">
4414
4536
  <fo:inline font-size="80%" vertical-align="super">
4415
4537
  <xsl:apply-templates/>
@@ -4435,6 +4557,7 @@
4435
4557
 
4436
4558
 
4437
4559
 
4560
+
4438
4561
 
4439
4562
  </xsl:variable>
4440
4563
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4452,8 +4575,74 @@
4452
4575
  <fo:inline text-decoration="underline">
4453
4576
  <xsl:apply-templates/>
4454
4577
  </fo:inline>
4578
+ </xsl:template><xsl:template match="*[local-name()='add']">
4579
+ <xsl:choose>
4580
+ <xsl:when test="@amendment">
4581
+ <fo:inline>
4582
+ <xsl:call-template name="insertTag">
4583
+ <xsl:with-param name="kind">A</xsl:with-param>
4584
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4585
+ </xsl:call-template>
4586
+ <xsl:apply-templates/>
4587
+ <xsl:call-template name="insertTag">
4588
+ <xsl:with-param name="type">closing</xsl:with-param>
4589
+ <xsl:with-param name="kind">A</xsl:with-param>
4590
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4591
+ </xsl:call-template>
4592
+ </fo:inline>
4593
+ </xsl:when>
4594
+ <xsl:when test="@corrigenda">
4595
+ <fo:inline>
4596
+ <xsl:call-template name="insertTag">
4597
+ <xsl:with-param name="kind">C</xsl:with-param>
4598
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4599
+ </xsl:call-template>
4600
+ <xsl:apply-templates/>
4601
+ <xsl:call-template name="insertTag">
4602
+ <xsl:with-param name="type">closing</xsl:with-param>
4603
+ <xsl:with-param name="kind">C</xsl:with-param>
4604
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4605
+ </xsl:call-template>
4606
+ </fo:inline>
4607
+ </xsl:when>
4608
+ <xsl:otherwise>
4609
+ <fo:inline xsl:use-attribute-sets="add-style">
4610
+ <xsl:apply-templates/>
4611
+ </fo:inline>
4612
+ </xsl:otherwise>
4613
+ </xsl:choose>
4614
+
4615
+ </xsl:template><xsl:template name="insertTag">
4616
+ <xsl:param name="type"/>
4617
+ <xsl:param name="kind"/>
4618
+ <xsl:param name="value"/>
4619
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4620
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4621
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4622
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4623
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4624
+ <xsl:attribute name="height">5mm</xsl:attribute>
4625
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4626
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4627
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4628
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4629
+ <g>
4630
+ <xsl:if test="$type = 'closing'">
4631
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4632
+ </xsl:if>
4633
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4634
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4635
+ </g>
4636
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4637
+ <xsl:if test="$type = 'closing'">
4638
+ <xsl:attribute name="x">25</xsl:attribute>
4639
+ </xsl:if>
4640
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4641
+ </text>
4642
+ </svg>
4643
+ </fo:instream-foreign-object>
4455
4644
  </xsl:template><xsl:template match="*[local-name()='del']">
4456
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4645
+ <fo:inline xsl:use-attribute-sets="del-style">
4457
4646
  <xsl:apply-templates/>
4458
4647
  </fo:inline>
4459
4648
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -4750,11 +4939,15 @@
4750
4939
  </xsl:apply-templates>
4751
4940
  </xsl:template><xsl:template name="getLang">
4752
4941
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4942
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4753
4943
  <xsl:variable name="language">
4754
4944
  <xsl:choose>
4755
4945
  <xsl:when test="$language_current != ''">
4756
4946
  <xsl:value-of select="$language_current"/>
4757
4947
  </xsl:when>
4948
+ <xsl:when test="$language_current_2 != ''">
4949
+ <xsl:value-of select="$language_current_2"/>
4950
+ </xsl:when>
4758
4951
  <xsl:otherwise>
4759
4952
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4760
4953
  </xsl:otherwise>
@@ -4794,13 +4987,30 @@
4794
4987
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4795
4988
  <xsl:value-of select="substring($str, 2)"/>
4796
4989
  </xsl:template><xsl:template match="mathml:math">
4797
- <fo:inline font-family="STIX Two Math"> <!-- -->
4990
+ <xsl:variable name="isAdded" select="@added"/>
4991
+ <xsl:variable name="isDeleted" select="@deleted"/>
4992
+
4993
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4994
+
4995
+
4996
+ <xsl:call-template name="setTrackChangesStyles">
4997
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4998
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4999
+ </xsl:call-template>
4798
5000
 
4799
5001
  <xsl:variable name="mathml">
4800
5002
  <xsl:apply-templates select="." mode="mathml"/>
4801
5003
  </xsl:variable>
4802
5004
  <fo:instream-foreign-object fox:alt-text="Math">
4803
5005
 
5006
+
5007
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
5008
+ <xsl:attribute name="width">95%</xsl:attribute>
5009
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5010
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5011
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5012
+ </xsl:if>
5013
+
4804
5014
  <!-- <xsl:copy-of select="."/> -->
4805
5015
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4806
5016
  </fo:instream-foreign-object>
@@ -4821,6 +5031,16 @@
4821
5031
  <mathml:mspace width="0.5ex"/>
4822
5032
  </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">
4823
5033
  <xsl:variable name="target">
5034
+ <xsl:choose>
5035
+ <xsl:when test="@updatetype = 'true'">
5036
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
5037
+ </xsl:when>
5038
+ <xsl:otherwise>
5039
+ <xsl:value-of select="normalize-space(@target)"/>
5040
+ </xsl:otherwise>
5041
+ </xsl:choose>
5042
+ </xsl:variable>
5043
+ <xsl:variable name="target_text">
4824
5044
  <xsl:choose>
4825
5045
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4826
5046
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -4833,19 +5053,19 @@
4833
5053
  <fo:inline xsl:use-attribute-sets="link-style">
4834
5054
 
4835
5055
  <xsl:choose>
4836
- <xsl:when test="$target = ''">
5056
+ <xsl:when test="$target_text = ''">
4837
5057
  <xsl:apply-templates/>
4838
5058
  </xsl:when>
4839
5059
  <xsl:otherwise>
4840
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
5060
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
4841
5061
  <xsl:choose>
4842
5062
  <xsl:when test="normalize-space(.) = ''">
4843
- <!-- <xsl:value-of select="$target"/> -->
4844
5063
  <xsl:call-template name="add-zero-spaces-link-java">
4845
- <xsl:with-param name="text" select="$target"/>
5064
+ <xsl:with-param name="text" select="$target_text"/>
4846
5065
  </xsl:call-template>
4847
5066
  </xsl:when>
4848
5067
  <xsl:otherwise>
5068
+ <!-- output text from <link>text</link> -->
4849
5069
  <xsl:apply-templates/>
4850
5070
  </xsl:otherwise>
4851
5071
  </xsl:choose>
@@ -4957,6 +5177,7 @@
4957
5177
 
4958
5178
 
4959
5179
  <fo:inline xsl:use-attribute-sets="note-name-style">
5180
+
4960
5181
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4961
5182
  </fo:inline>
4962
5183
  <xsl:apply-templates/>
@@ -4983,6 +5204,7 @@
4983
5204
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
4984
5205
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4985
5206
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5207
+
4986
5208
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4987
5209
  </fo:inline>
4988
5210
  <xsl:apply-templates/>
@@ -5046,8 +5268,15 @@
5046
5268
  </fo:inline>
5047
5269
  </xsl:if>
5048
5270
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5271
+ <xsl:variable name="isAdded" select="@added"/>
5272
+ <xsl:variable name="isDeleted" select="@deleted"/>
5049
5273
  <fo:block-container id="{@id}">
5050
5274
 
5275
+ <xsl:call-template name="setTrackChangesStyles">
5276
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5277
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5278
+ </xsl:call-template>
5279
+
5051
5280
  <fo:block>
5052
5281
  <xsl:apply-templates/>
5053
5282
  </fo:block>
@@ -5055,7 +5284,10 @@
5055
5284
  <xsl:for-each select="*[local-name() = 'note']">
5056
5285
  <xsl:call-template name="note"/>
5057
5286
  </xsl:for-each>
5058
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5287
+
5288
+
5289
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5290
+
5059
5291
  </fo:block-container>
5060
5292
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
5061
5293
  <fo:block id="{@id}">
@@ -5067,37 +5299,122 @@
5067
5299
  <xsl:apply-templates/>
5068
5300
  </fo:block>
5069
5301
  </xsl:template><xsl:template match="*[local-name() = 'image']">
5070
- <fo:block xsl:use-attribute-sets="image-style">
5071
-
5072
-
5073
- <xsl:variable name="src">
5074
- <xsl:choose>
5075
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5076
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5077
- </xsl:when>
5078
- <xsl:otherwise>
5079
- <xsl:value-of select="@src"/>
5080
- </xsl:otherwise>
5081
- </xsl:choose>
5082
- </xsl:variable>
5083
-
5084
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5085
- </fo:block>
5302
+ <xsl:variable name="isAdded" select="../@added"/>
5303
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5304
+ <xsl:choose>
5305
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5306
+ <fo:inline padding-left="1mm" padding-right="1mm">
5307
+ <xsl:variable name="src">
5308
+ <xsl:call-template name="image_src"/>
5309
+ </xsl:variable>
5310
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5311
+ </fo:inline>
5312
+ </xsl:when>
5313
+ <xsl:otherwise>
5314
+ <fo:block xsl:use-attribute-sets="image-style">
5315
+
5316
+ <xsl:variable name="src">
5317
+ <xsl:call-template name="image_src"/>
5318
+ </xsl:variable>
5319
+
5320
+ <xsl:choose>
5321
+ <xsl:when test="$isDeleted = 'true'">
5322
+ <!-- enclose in svg -->
5323
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5324
+ <xsl:attribute name="width">100%</xsl:attribute>
5325
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5326
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5327
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5328
+
5329
+
5330
+ <xsl:apply-templates select="." mode="cross_image"/>
5331
+
5332
+ </fo:instream-foreign-object>
5333
+ </xsl:when>
5334
+ <xsl:otherwise>
5335
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5336
+ </xsl:otherwise>
5337
+ </xsl:choose>
5338
+
5339
+ </fo:block>
5340
+ </xsl:otherwise>
5341
+ </xsl:choose>
5342
+ </xsl:template><xsl:template name="image_src">
5343
+ <xsl:choose>
5344
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5345
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5346
+ </xsl:when>
5347
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5348
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5349
+ </xsl:when>
5350
+ <xsl:otherwise>
5351
+ <xsl:value-of select="@src"/>
5352
+ </xsl:otherwise>
5353
+ </xsl:choose>
5354
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5355
+ <xsl:choose>
5356
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5357
+ <xsl:variable name="src">
5358
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5359
+ </xsl:variable>
5360
+ <xsl:variable name="width" select="document($src)/@width"/>
5361
+ <xsl:variable name="height" select="document($src)/@height"/>
5362
+ <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">
5363
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5364
+ </svg>
5365
+ </xsl:when>
5366
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5367
+ <xsl:variable name="src">
5368
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5369
+ </xsl:variable>
5370
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5371
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5372
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5373
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5374
+ <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">
5375
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5376
+ </svg>
5377
+ </xsl:when>
5378
+ <xsl:otherwise>
5379
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5380
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5381
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5382
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5383
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5384
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5385
+ <!-- width=<xsl:value-of select="$width"/> -->
5386
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5387
+ <!-- height=<xsl:value-of select="$height"/> -->
5388
+ <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">
5389
+ <image xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5390
+ <xsl:call-template name="svg_cross">
5391
+ <xsl:with-param name="width" select="$width"/>
5392
+ <xsl:with-param name="height" select="$height"/>
5393
+ </xsl:call-template>
5394
+ </svg>
5395
+ </xsl:otherwise>
5396
+ </xsl:choose>
5397
+
5398
+ </xsl:template><xsl:template name="svg_cross">
5399
+ <xsl:param name="width"/>
5400
+ <xsl:param name="height"/>
5401
+ <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; "/>
5402
+ <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; "/>
5086
5403
  </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">
5087
5404
  <xsl:apply-templates mode="contents"/>
5088
5405
  <xsl:text> </xsl:text>
5089
5406
  </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">
5090
5407
  <xsl:apply-templates mode="bookmarks"/>
5091
5408
  <xsl:text> </xsl:text>
5092
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
5409
+ </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">
5093
5410
  <xsl:value-of select="."/>
5094
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5411
+ </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">
5095
5412
  <xsl:value-of select="."/>
5096
5413
  </xsl:template><xsl:template match="node()" mode="contents">
5097
5414
  <xsl:apply-templates mode="contents"/>
5098
5415
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5099
5416
  <xsl:apply-templates mode="bookmarks"/>
5100
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5417
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5101
5418
  <xsl:apply-templates select="."/>
5102
5419
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5103
5420
  <xsl:apply-templates mode="bookmarks"/>
@@ -5296,6 +5613,8 @@
5296
5613
  </fo:list-item-body>
5297
5614
  </fo:list-item>
5298
5615
  </fo:list-block>
5616
+ </xsl:template><xsl:template name="extractSection">
5617
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5299
5618
  </xsl:template><xsl:template name="extractTitle">
5300
5619
  <xsl:choose>
5301
5620
  <xsl:when test="*[local-name() = 'tab']">
@@ -5322,6 +5641,7 @@
5322
5641
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5323
5642
 
5324
5643
  <fo:block-container margin-left="0mm">
5644
+ <xsl:copy-of select="@id"/>
5325
5645
  <xsl:if test="parent::*[local-name() = 'note']">
5326
5646
  <xsl:attribute name="margin-left">
5327
5647
  <xsl:choose>
@@ -5343,6 +5663,7 @@
5343
5663
  9
5344
5664
 
5345
5665
 
5666
+
5346
5667
 
5347
5668
 
5348
5669
 
@@ -5598,6 +5919,7 @@
5598
5919
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5599
5920
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5600
5921
 
5922
+
5601
5923
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5602
5924
 
5603
5925
  <xsl:variable name="element">
@@ -5625,6 +5947,7 @@
5625
5947
  <xsl:variable name="element">
5626
5948
 
5627
5949
  inline
5950
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5628
5951
  </xsl:variable>
5629
5952
  <xsl:choose>
5630
5953
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5632,7 +5955,7 @@
5632
5955
  <xsl:apply-templates/>
5633
5956
  </fo:inline>
5634
5957
  </xsl:when>
5635
- <xsl:when test="normalize-space($element) = 'block'">
5958
+ <xsl:when test="contains(normalize-space($element), 'block')">
5636
5959
  <fo:block xsl:use-attribute-sets="example-name-style">
5637
5960
  <xsl:apply-templates/>
5638
5961
  </fo:block>
@@ -5669,7 +5992,7 @@
5669
5992
  </fo:inline>
5670
5993
  </xsl:otherwise>
5671
5994
  </xsl:choose>
5672
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
5995
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5673
5996
  <fo:block xsl:use-attribute-sets="termsource-style">
5674
5997
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5675
5998
  <xsl:variable name="termsource_text">
@@ -5678,13 +6001,15 @@
5678
6001
 
5679
6002
  <xsl:choose>
5680
6003
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5681
- <xsl:apply-templates/>
6004
+ <!-- <xsl:apply-templates /> -->
6005
+ <xsl:copy-of select="$termsource_text"/>
5682
6006
  </xsl:when>
5683
6007
  <xsl:otherwise>
5684
6008
 
5685
6009
  <xsl:text>[</xsl:text>
5686
6010
 
5687
- <xsl:apply-templates/>
6011
+ <!-- <xsl:apply-templates /> -->
6012
+ <xsl:copy-of select="$termsource_text"/>
5688
6013
 
5689
6014
  <xsl:text>]</xsl:text>
5690
6015
 
@@ -5695,20 +6020,25 @@
5695
6020
  <xsl:if test="normalize-space() != ''">
5696
6021
  <xsl:value-of select="."/>
5697
6022
  </xsl:if>
5698
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
6023
+ </xsl:template><xsl:variable name="localized.source">
6024
+ <xsl:call-template name="getLocalizedString">
6025
+ <xsl:with-param name="key">source</xsl:with-param>
6026
+ </xsl:call-template>
6027
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5699
6028
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6029
+ <xsl:if test="normalize-space(@citeas) = ''">
6030
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6031
+ </xsl:if>
5700
6032
 
5701
6033
  <fo:inline>
5702
6034
 
5703
6035
 
6036
+ <xsl:value-of select="$localized.source"/>
6037
+ <xsl:text>: </xsl:text>
5704
6038
 
5705
- <xsl:call-template name="getLocalizedString">
5706
- <xsl:with-param name="key">source</xsl:with-param>
5707
- </xsl:call-template>
5708
6039
 
5709
6040
 
5710
6041
 
5711
- <xsl:text>: </xsl:text>
5712
6042
  </fo:inline>
5713
6043
 
5714
6044
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -5814,6 +6144,7 @@
5814
6144
 
5815
6145
 
5816
6146
 
6147
+
5817
6148
  <xsl:choose>
5818
6149
  <xsl:when test="$depth = 2">3</xsl:when>
5819
6150
  <xsl:otherwise>4</xsl:otherwise>
@@ -5856,7 +6187,8 @@
5856
6187
  </fo:inline>
5857
6188
  </xsl:when>
5858
6189
  <xsl:otherwise>
5859
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6190
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6191
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5860
6192
  </xsl:otherwise>
5861
6193
  </xsl:choose>
5862
6194
 
@@ -5915,7 +6247,6 @@
5915
6247
 
5916
6248
 
5917
6249
 
5918
-
5919
6250
  <xsl:apply-templates/>
5920
6251
  </fo:block>
5921
6252
 
@@ -5958,7 +6289,7 @@
5958
6289
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5959
6290
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5960
6291
  <xsl:choose>
5961
- <xsl:when test="parent::*[local-name() = 'note']">
6292
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
5962
6293
  <fo:block-container>
5963
6294
  <xsl:attribute name="margin-left">
5964
6295
  <xsl:choose>
@@ -5968,6 +6299,7 @@
5968
6299
  </xsl:attribute>
5969
6300
 
5970
6301
 
6302
+
5971
6303
  <fo:block-container margin-left="0mm">
5972
6304
  <fo:block>
5973
6305
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -6169,6 +6501,36 @@
6169
6501
 
6170
6502
 
6171
6503
 
6504
+
6505
+
6506
+ <!-- start ISO bibtem processing -->
6507
+ <xsl:variable name="docidentifier">
6508
+ <xsl:if test="*[local-name() = 'docidentifier']">
6509
+ <xsl:choose>
6510
+ <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
6511
+ <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier']"/></xsl:otherwise>
6512
+ </xsl:choose>
6513
+ </xsl:if>
6514
+ </xsl:variable>
6515
+ <xsl:value-of select="$docidentifier"/>
6516
+ <xsl:apply-templates select="*[local-name() = 'note']"/>
6517
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6518
+ <xsl:choose>
6519
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
6520
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
6521
+ </xsl:when>
6522
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
6523
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
6524
+ </xsl:when>
6525
+ <xsl:otherwise>
6526
+ <xsl:apply-templates select="*[local-name() = 'title']"/>
6527
+ </xsl:otherwise>
6528
+ </xsl:choose>
6529
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6530
+ <!-- end ISO bibitem processing -->
6531
+
6532
+
6533
+
6172
6534
  </xsl:template><xsl:template name="processBibitemDocId">
6173
6535
  <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')]"/>
6174
6536
  <xsl:choose>
@@ -6225,6 +6587,70 @@
6225
6587
  <xsl:value-of select="substring(.,1,1)"/>
6226
6588
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
6227
6589
  <fo:inline><xsl:apply-templates/></fo:inline>
6590
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6591
+ <fo:block>
6592
+ <xsl:apply-templates/>
6593
+ </fo:block>
6594
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6595
+ <fo:inline><xsl:apply-templates/></fo:inline>
6596
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6597
+ <fo:inline>
6598
+ <xsl:call-template name="text_input"/>
6599
+ </fo:inline>
6600
+ </xsl:template><xsl:template name="text_input">
6601
+ <xsl:variable name="count">
6602
+ <xsl:choose>
6603
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6604
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6605
+ <xsl:otherwise>10</xsl:otherwise>
6606
+ </xsl:choose>
6607
+ </xsl:variable>
6608
+ <xsl:call-template name="repeat">
6609
+ <xsl:with-param name="char" select="'_'"/>
6610
+ <xsl:with-param name="count" select="$count"/>
6611
+ </xsl:call-template>
6612
+ <xsl:text> </xsl:text>
6613
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6614
+ <xsl:variable name="caption">
6615
+ <xsl:choose>
6616
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6617
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6618
+ </xsl:choose>
6619
+ </xsl:variable>
6620
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6621
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6622
+ <fo:inline padding-right="1mm">
6623
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6624
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6625
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6626
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6627
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6628
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6629
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6630
+ </svg>
6631
+ </fo:instream-foreign-object>
6632
+ </fo:inline>
6633
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6634
+ <fo:inline padding-right="1mm">
6635
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6636
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6637
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6638
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6639
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6640
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6641
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6642
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6643
+ </svg>
6644
+ </fo:instream-foreign-object>
6645
+ </fo:inline>
6646
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6647
+ <fo:inline>
6648
+ <xsl:call-template name="text_input"/>
6649
+ </fo:inline>
6650
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6651
+ <fo:block-container border="1pt solid black" width="50%">
6652
+ <fo:block> </fo:block>
6653
+ </fo:block-container>
6228
6654
  </xsl:template><xsl:template name="convertDate">
6229
6655
  <xsl:param name="date"/>
6230
6656
  <xsl:param name="format" select="'short'"/>
@@ -6432,6 +6858,9 @@
6432
6858
  <xsl:when test="parent::*[local-name() = 'preface']">
6433
6859
  <xsl:value-of select="$level_total - 1"/>
6434
6860
  </xsl:when>
6861
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
6862
+ <xsl:value-of select="$level_total - 1"/>
6863
+ </xsl:when>
6435
6864
  <xsl:when test="ancestor::*[local-name() = 'preface']">
6436
6865
  <xsl:value-of select="$level_total - 2"/>
6437
6866
  </xsl:when>
@@ -6487,6 +6916,7 @@
6487
6916
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
6488
6917
  <xsl:variable name="XSLNS">
6489
6918
 
6919
+
6490
6920
  <xsl:value-of select="document('')//*/namespace::iso"/>
6491
6921
 
6492
6922
 
@@ -6556,17 +6986,69 @@
6556
6986
  </xsl:call-template>
6557
6987
  </xsl:if>
6558
6988
  </xsl:template><xsl:template name="getLocalizedString">
6559
- <xsl:param name="key"/>
6989
+ <xsl:param name="key"/>
6560
6990
 
6561
6991
  <xsl:variable name="curr_lang">
6562
6992
  <xsl:call-template name="getLang"/>
6563
6993
  </xsl:variable>
6564
6994
 
6995
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6996
+
6565
6997
  <xsl:choose>
6998
+ <xsl:when test="$data_value != ''">
6999
+ <xsl:value-of select="$data_value"/>
7000
+ </xsl:when>
6566
7001
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6567
7002
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6568
7003
  </xsl:when>
6569
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
7004
+ <xsl:otherwise>
7005
+ <xsl:variable name="key_">
7006
+ <xsl:call-template name="capitalize">
7007
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
7008
+ </xsl:call-template>
7009
+ </xsl:variable>
7010
+ <xsl:value-of select="$key_"/>
7011
+ </xsl:otherwise>
6570
7012
  </xsl:choose>
6571
7013
 
7014
+ </xsl:template><xsl:template name="setTrackChangesStyles">
7015
+ <xsl:param name="isAdded"/>
7016
+ <xsl:param name="isDeleted"/>
7017
+ <xsl:choose>
7018
+ <xsl:when test="local-name() = 'math'">
7019
+ <xsl:if test="$isAdded = 'true'">
7020
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
7021
+ </xsl:if>
7022
+ <xsl:if test="$isDeleted = 'true'">
7023
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
7024
+ </xsl:if>
7025
+ </xsl:when>
7026
+ <xsl:otherwise>
7027
+ <xsl:if test="$isAdded = 'true'">
7028
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
7029
+ <xsl:attribute name="padding">2mm</xsl:attribute>
7030
+ </xsl:if>
7031
+ <xsl:if test="$isDeleted = 'true'">
7032
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
7033
+ <xsl:if test="local-name() = 'table'">
7034
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
7035
+ </xsl:if>
7036
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
7037
+ <xsl:attribute name="padding">2mm</xsl:attribute>
7038
+ </xsl:if>
7039
+ </xsl:otherwise>
7040
+ </xsl:choose>
7041
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
7042
+ <xsl:if test="$lang = 'ar'">
7043
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
7044
+ </xsl:if>
7045
+ </xsl:template><xsl:template name="setAlignment">
7046
+ <xsl:param name="align" select="normalize-space(@align)"/>
7047
+ <xsl:choose>
7048
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
7049
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
7050
+ <xsl:when test="$align != ''">
7051
+ <xsl:value-of select="$align"/>
7052
+ </xsl:when>
7053
+ </xsl:choose>
6572
7054
  </xsl:template></xsl:stylesheet>