metanorma-iso 1.8.1 → 1.8.6

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 (46) 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 +1 -0
  6. data/lib/asciidoctor/iso/biblio.rng +1 -0
  7. data/lib/asciidoctor/iso/cleanup.rb +17 -5
  8. data/lib/asciidoctor/iso/front.rb +3 -1
  9. data/lib/asciidoctor/iso/front_id.rb +66 -50
  10. data/lib/asciidoctor/iso/isodoc.rng +209 -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_section.rb +16 -9
  15. data/lib/isodoc/iso/base_convert.rb +13 -13
  16. data/lib/isodoc/iso/html/isodoc.css +475 -20
  17. data/lib/isodoc/iso/html/isodoc.scss +456 -23
  18. data/lib/isodoc/iso/html/wordstyle.css +202 -31
  19. data/lib/isodoc/iso/html/wordstyle.scss +194 -32
  20. data/lib/isodoc/iso/iso.amendment.xsl +679 -473
  21. data/lib/isodoc/iso/iso.international-standard.xsl +679 -473
  22. data/lib/isodoc/iso/metadata.rb +3 -2
  23. data/lib/isodoc/iso/presentation_xml_convert.rb +18 -9
  24. data/lib/isodoc/iso/sts_convert.rb +10 -13
  25. data/lib/isodoc/iso/word_convert.rb +153 -39
  26. data/lib/isodoc/iso/xref.rb +42 -27
  27. data/lib/metanorma/iso/version.rb +1 -1
  28. data/metanorma-iso.gemspec +4 -4
  29. data/spec/asciidoctor/base_spec.rb +426 -334
  30. data/spec/asciidoctor/blocks_spec.rb +96 -34
  31. data/spec/asciidoctor/cleanup_spec.rb +383 -25
  32. data/spec/asciidoctor/section_spec.rb +0 -14
  33. data/spec/asciidoctor/validate_spec.rb +119 -39
  34. data/spec/isodoc/amd_spec.rb +193 -201
  35. data/spec/isodoc/blocks_spec.rb +100 -88
  36. data/spec/isodoc/i18n_spec.rb +36 -36
  37. data/spec/isodoc/inline_spec.rb +282 -2
  38. data/spec/isodoc/iso_spec.rb +86 -138
  39. data/spec/isodoc/postproc_spec.rb +492 -442
  40. data/spec/isodoc/ref_spec.rb +6 -6
  41. data/spec/isodoc/section_spec.rb +301 -306
  42. data/spec/isodoc/table_spec.rb +166 -231
  43. data/spec/isodoc/terms_spec.rb +11 -8
  44. data/spec/isodoc/xref_spec.rb +147 -118
  45. data/spec/spec_helper.rb +16 -15
  46. metadata +9 -9
@@ -23,13 +23,6 @@
23
23
  <xsl:variable name="marginTop" select="27.4"/>
24
24
  <xsl:variable name="marginBottom" select="13"/>
25
25
 
26
- <xsl:variable name="figure_name_height">14</xsl:variable>
27
- <xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><!-- paper width minus margins -->
28
- <xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><!-- paper height minus margins and title height -->
29
- <xsl:variable name="image_dpi" select="96"/>
30
- <xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/>
31
- <xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/>
32
-
33
26
  <xsl:variable name="docidentifierISO" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso'] | /iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'ISO']"/>
34
27
 
35
28
  <xsl:variable name="all_rights_reserved">
@@ -1425,7 +1418,7 @@
1425
1418
  </xsl:if>
1426
1419
  </xsl:template>
1427
1420
 
1428
-
1421
+ <xsl:template match="iso:p | iso:termsource | iso:termnote" mode="contents"/>
1429
1422
 
1430
1423
  <xsl:template name="getListItemFormat">
1431
1424
  <xsl:choose>
@@ -1752,61 +1745,7 @@
1752
1745
  <xsl:apply-templates/>
1753
1746
  </xsl:template>
1754
1747
 
1755
-
1756
-
1757
- <xsl:template match="iso:bibitem">
1758
- <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
1759
- <xsl:variable name="docidentifier">
1760
- <xsl:if test="iso:docidentifier">
1761
- <xsl:choose>
1762
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1763
- <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1764
- </xsl:choose>
1765
- </xsl:if>
1766
- </xsl:variable>
1767
- <xsl:value-of select="$docidentifier"/>
1768
- <xsl:apply-templates select="iso:note"/>
1769
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1770
- <fo:inline font-style="italic">
1771
- <xsl:choose>
1772
- <xsl:when test="iso:title[@type = 'main' and @language = $lang]">
1773
- <xsl:value-of select="iso:title[@type = 'main' and @language = $lang]"/>
1774
- </xsl:when>
1775
- <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1776
- <xsl:value-of select="iso:title[@type = 'main' and @language = 'en']"/>
1777
- </xsl:when>
1778
- <xsl:otherwise>
1779
- <xsl:value-of select="iso:title"/>
1780
- </xsl:otherwise>
1781
- </xsl:choose>
1782
- </fo:inline>
1783
- </fo:block>
1784
- </xsl:template>
1785
-
1786
-
1787
- <xsl:template match="iso:bibitem/iso:note" priority="2">
1788
- <fo:footnote>
1789
- <xsl:variable name="number">
1790
- <xsl:number level="any" count="iso:bibitem/iso:note"/>
1791
- </xsl:variable>
1792
- <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1793
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1794
- <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1795
- </fo:basic-link>
1796
- </fo:inline>
1797
- <fo:footnote-body>
1798
- <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1799
- <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1800
- <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1801
- </fo:inline>
1802
- <xsl:apply-templates/>
1803
- </fo:block>
1804
- </fo:footnote-body>
1805
- </fo:footnote>
1806
- </xsl:template>
1807
-
1808
-
1809
-
1748
+
1810
1749
  <xsl:template match="iso:ul | iso:ol" mode="ul_ol">
1811
1750
  <fo:list-block provisional-distance-between-starts="7mm" margin-top="8pt"> <!-- margin-bottom="8pt" -->
1812
1751
  <xsl:apply-templates/>
@@ -1872,6 +1811,34 @@
1872
1811
  </xsl:template>
1873
1812
 
1874
1813
 
1814
+ <xsl:template match="iso:bibitem">
1815
+ <fo:block id="{@id}" margin-bottom="6pt">
1816
+ <xsl:call-template name="processBibitem"/>
1817
+ </fo:block>
1818
+ </xsl:template>
1819
+
1820
+
1821
+ <xsl:template match="iso:bibitem/iso:note" priority="2">
1822
+ <fo:footnote>
1823
+ <xsl:variable name="number">
1824
+ <xsl:number level="any" count="iso:bibitem/iso:note"/>
1825
+ </xsl:variable>
1826
+ <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1827
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1828
+ <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1829
+ </fo:basic-link>
1830
+ </fo:inline>
1831
+ <fo:footnote-body>
1832
+ <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1833
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1834
+ <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1835
+ </fo:inline>
1836
+ <xsl:apply-templates/>
1837
+ </fo:block>
1838
+ </fo:footnote-body>
1839
+ </fo:footnote>
1840
+ </xsl:template>
1841
+
1875
1842
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1876
1843
  <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem"> -->
1877
1844
  <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem">
@@ -1886,40 +1853,18 @@
1886
1853
  </fo:list-item-label>
1887
1854
  <fo:list-item-body start-indent="body-start()">
1888
1855
  <fo:block>
1889
- <xsl:variable name="docidentifier">
1890
- <xsl:if test="iso:docidentifier">
1891
- <xsl:choose>
1892
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1893
- <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1894
- </xsl:choose>
1895
- </xsl:if>
1896
- </xsl:variable>
1897
- <xsl:value-of select="$docidentifier"/>
1898
- <xsl:apply-templates select="iso:note"/>
1899
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1900
- <xsl:choose>
1901
- <xsl:when test="iso:title[@type = 'main' and @language = $lang]">
1902
- <xsl:apply-templates select="iso:title[@type = 'main' and @language = $lang]"/>
1903
- </xsl:when>
1904
- <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1905
- <xsl:apply-templates select="iso:title[@type = 'main' and @language = 'en']"/>
1906
- </xsl:when>
1907
- <xsl:otherwise>
1908
- <xsl:apply-templates select="iso:title"/>
1909
- </xsl:otherwise>
1910
- </xsl:choose>
1911
- <xsl:apply-templates select="iso:formattedref"/>
1856
+ <xsl:call-template name="processBibitem"/>
1912
1857
  </fo:block>
1913
1858
  </fo:list-item-body>
1914
1859
  </fo:list-item>
1915
1860
  </fo:list-block>
1916
1861
  </xsl:template>
1917
1862
 
1918
- <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem" mode="contents"/> -->
1919
- <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem" mode="contents"/>
1863
+ <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem" mode="contents"/> [not(@normative='true')] -->
1864
+ <xsl:template match="iso:references/iso:bibitem" mode="contents"/>
1920
1865
 
1921
- <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem/iso:title"> -->
1922
- <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem/iso:title">
1866
+ <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem/iso:title"> iso:references[not(@normative='true')]/ -->
1867
+ <xsl:template match="iso:bibitem/iso:title">
1923
1868
  <fo:inline font-style="italic">
1924
1869
  <xsl:apply-templates/>
1925
1870
  </fo:inline>
@@ -1963,319 +1908,68 @@
1963
1908
  </fo:block>
1964
1909
  </xsl:template>
1965
1910
 
1911
+
1912
+ <!-- For express listings PDF attachments -->
1913
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
1914
+ <fo:inline xsl:use-attribute-sets="eref-style">
1915
+ <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
1916
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
1917
+ <xsl:if test="normalize-space(@citeas) = ''">
1918
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
1919
+ </xsl:if>
1920
+ <xsl:apply-templates/>
1921
+ </fo:basic-link>
1922
+ </fo:inline>
1923
+ </xsl:template>
1924
+
1925
+
1966
1926
  <!-- =================== -->
1967
- <!-- SVG images processing -->
1927
+ <!-- Index processing -->
1968
1928
  <!-- =================== -->
1969
- <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/>
1970
- <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
1971
- <xsl:param name="name"/>
1972
-
1973
- <xsl:variable name="svg_content">
1974
- <xsl:apply-templates select="." mode="svg_update"/>
1975
- </xsl:variable>
1976
-
1977
- <xsl:variable name="alt-text">
1978
- <xsl:choose>
1979
- <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
1980
- <xsl:value-of select="../*[local-name() = 'name']"/>
1981
- </xsl:when>
1982
- <xsl:when test="normalize-space($name) != ''">
1983
- <xsl:value-of select="$name"/>
1984
- </xsl:when>
1985
- <xsl:otherwise>Figure</xsl:otherwise>
1986
- </xsl:choose>
1987
- </xsl:variable>
1988
-
1989
- <xsl:choose>
1990
- <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1991
- <fo:block>
1992
- <xsl:variable name="width" select="@width"/>
1993
- <xsl:variable name="height" select="@height"/>
1994
-
1995
- <xsl:variable name="scale_x">
1996
- <xsl:choose>
1997
- <xsl:when test="$width &gt; $width_effective_px">
1998
- <xsl:value-of select="$width_effective_px div $width"/>
1999
- </xsl:when>
2000
- <xsl:otherwise>1</xsl:otherwise>
2001
- </xsl:choose>
2002
- </xsl:variable>
2003
-
2004
- <xsl:variable name="scale_y">
2005
- <xsl:choose>
2006
- <xsl:when test="$height * $scale_x &gt; $height_effective_px">
2007
- <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
2008
- </xsl:when>
2009
- <xsl:otherwise>1</xsl:otherwise>
2010
- </xsl:choose>
2011
- </xsl:variable>
2012
-
2013
- <xsl:variable name="scale">
2014
- <xsl:choose>
2015
- <xsl:when test="$scale_y != 1">
2016
- <xsl:value-of select="$scale_x * $scale_y"/>
2017
- </xsl:when>
2018
- <xsl:otherwise>
2019
- <xsl:value-of select="$scale_x"/>
2020
- </xsl:otherwise>
2021
- </xsl:choose>
2022
- </xsl:variable>
2023
-
2024
- <xsl:variable name="width_scale" select="round($width * $scale)"/>
2025
- <xsl:variable name="height_scale" select="round($height * $scale)"/>
2026
-
2027
- <fo:table table-layout="fixed" width="100%">
2028
- <fo:table-column column-width="proportional-column-width(1)"/>
2029
- <fo:table-column column-width="{$width_scale}px"/>
2030
- <fo:table-column column-width="proportional-column-width(1)"/>
2031
- <fo:table-body>
2032
- <fo:table-row>
2033
- <fo:table-cell column-number="2">
2034
- <fo:block>
2035
- <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
2036
- <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2037
- <fo:block line-height="0" font-size="0">
2038
- <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2039
- <xsl:call-template name="bookmark"/>
2040
- </xsl:for-each>
2041
- </fo:block>
2042
- </xsl:if>
2043
- <fo:block text-depth="0" line-height="0" font-size="0">
2044
-
2045
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2046
- <xsl:attribute name="width">100%</xsl:attribute>
2047
- <xsl:attribute name="content-height">100%</xsl:attribute>
2048
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2049
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2050
-
2051
- <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
2052
- </fo:instream-foreign-object>
2053
- </fo:block>
2054
-
2055
- <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
2056
- <xsl:with-param name="scale" select="$scale"/>
2057
- </xsl:apply-templates>
2058
- </fo:block-container>
2059
- </fo:block>
2060
- </fo:table-cell>
2061
- </fo:table-row>
2062
- </fo:table-body>
2063
- </fo:table>
1929
+
1930
+ <xsl:template match="iso:indexsect"/>
1931
+ <xsl:template match="iso:indexsect" mode="index">
1932
+
1933
+ <fo:page-sequence master-reference="index" force-page-count="no-force">
1934
+ <xsl:variable name="header-title">
1935
+ <xsl:choose>
1936
+ <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
1937
+ <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
1938
+ </xsl:when>
1939
+ <xsl:otherwise>
1940
+ <xsl:apply-templates select="./iso:title[1]" mode="header"/>
1941
+ </xsl:otherwise>
1942
+ </xsl:choose>
1943
+ </xsl:variable>
1944
+ <xsl:call-template name="insertHeaderFooter">
1945
+ <xsl:with-param name="header-title" select="$header-title"/>
1946
+ </xsl:call-template>
1947
+
1948
+ <fo:flow flow-name="xsl-region-body">
1949
+ <fo:block id="{@id}" span="all">
1950
+ <xsl:apply-templates select="iso:title"/>
2064
1951
  </fo:block>
2065
-
2066
- </xsl:when>
2067
- <xsl:otherwise>
2068
- <fo:block xsl:use-attribute-sets="image-style">
2069
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2070
- <xsl:attribute name="width">100%</xsl:attribute>
2071
- <xsl:attribute name="content-height">100%</xsl:attribute>
2072
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2073
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2074
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2075
- <!-- effective height / width = 1.48, 1.4 - with title -->
2076
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2077
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2078
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2079
- </xsl:if>
2080
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2081
- <xsl:copy-of select="$svg_content"/>
2082
- </fo:instream-foreign-object>
1952
+ <fo:block>
1953
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2083
1954
  </fo:block>
2084
- </xsl:otherwise>
2085
- </xsl:choose>
1955
+ </fo:flow>
1956
+ </fo:page-sequence>
2086
1957
  </xsl:template>
2087
1958
 
2088
- <xsl:template match="@*|node()" mode="svg_update">
2089
- <xsl:copy>
2090
- <xsl:apply-templates select="@*|node()" mode="svg_update"/>
2091
- </xsl:copy>
2092
- </xsl:template>
2093
-
2094
- <xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
2095
- <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
2096
- <xsl:value-of select="."/>
2097
- </xsl:attribute>
2098
- </xsl:template>
2099
-
2100
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
2101
- <xsl:variable name="svg_content" select="document(@src)"/>
2102
- <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
2103
- <xsl:for-each select="xalan:nodeset($svg_content)/node()">
2104
- <xsl:call-template name="image_svg">
2105
- <xsl:with-param name="name" select="$name"/>
2106
- </xsl:call-template>
2107
- </xsl:for-each>
2108
- </xsl:template>
2109
-
2110
- <xsl:template match="@*|node()" mode="svg_remove_a">
2111
- <xsl:copy>
2112
- <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2113
- </xsl:copy>
2114
- </xsl:template>
2115
-
2116
- <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2117
- <xsl:apply-templates mode="svg_remove_a"/>
2118
- </xsl:template>
2119
-
2120
- <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2121
- <xsl:param name="scale"/>
2122
- <xsl:variable name="dest">
2123
- <xsl:choose>
2124
- <xsl:when test="starts-with(@href, '#')">
2125
- <xsl:value-of select="substring-after(@href, '#')"/>
2126
- </xsl:when>
2127
- <xsl:otherwise>
2128
- <xsl:value-of select="@href"/>
2129
- </xsl:otherwise>
2130
- </xsl:choose>
2131
- </xsl:variable>
2132
- <xsl:for-each select="./*[local-name() = 'rect']">
2133
- <xsl:call-template name="insertSVGMapLink">
2134
- <xsl:with-param name="left" select="floor(@x * $scale)"/>
2135
- <xsl:with-param name="top" select="floor(@y * $scale)"/>
2136
- <xsl:with-param name="width" select="floor(@width * $scale)"/>
2137
- <xsl:with-param name="height" select="floor(@height * $scale)"/>
2138
- <xsl:with-param name="dest" select="$dest"/>
2139
- </xsl:call-template>
2140
- </xsl:for-each>
2141
-
2142
- <xsl:for-each select="./*[local-name() = 'polygon']">
2143
- <xsl:variable name="points">
2144
- <xsl:call-template name="split">
2145
- <xsl:with-param name="pText" select="@points"/>
2146
- </xsl:call-template>
2147
- </xsl:variable>
2148
- <xsl:variable name="x_coords">
2149
- <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2150
- <xsl:sort select="." data-type="number"/>
2151
- <x><xsl:value-of select="."/></x>
2152
- </xsl:for-each>
2153
- </xsl:variable>
2154
- <xsl:variable name="y_coords">
2155
- <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2156
- <xsl:sort select="." data-type="number"/>
2157
- <y><xsl:value-of select="."/></y>
2158
- </xsl:for-each>
2159
- </xsl:variable>
2160
- <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2161
- <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2162
- <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2163
- <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2164
- <xsl:call-template name="insertSVGMapLink">
2165
- <xsl:with-param name="left" select="floor($x * $scale)"/>
2166
- <xsl:with-param name="top" select="floor($y * $scale)"/>
2167
- <xsl:with-param name="width" select="floor($width * $scale)"/>
2168
- <xsl:with-param name="height" select="floor($height * $scale)"/>
2169
- <xsl:with-param name="dest" select="$dest"/>
2170
- </xsl:call-template>
2171
- </xsl:for-each>
2172
-
2173
- <xsl:for-each select="./*[local-name() = 'circle']">
2174
- <xsl:call-template name="insertSVGMapLink">
2175
- <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2176
- <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2177
- <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2178
- <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2179
- <xsl:with-param name="dest" select="$dest"/>
2180
- </xsl:call-template>
2181
- </xsl:for-each>
2182
- <xsl:for-each select="./*[local-name() = 'ellipse']">
2183
- <xsl:call-template name="insertSVGMapLink">
2184
- <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2185
- <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2186
- <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2187
- <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2188
- <xsl:with-param name="dest" select="$dest"/>
2189
- </xsl:call-template>
2190
- </xsl:for-each>
2191
- </xsl:template>
2192
-
2193
- <xsl:template name="insertSVGMapLink">
2194
- <xsl:param name="left"/>
2195
- <xsl:param name="top"/>
2196
- <xsl:param name="width"/>
2197
- <xsl:param name="height"/>
2198
- <xsl:param name="dest"/>
2199
- <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2200
- <fo:block font-size="1pt">
2201
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2202
- <fo:inline-container inline-progression-dimension="100%">
2203
- <fo:block-container height="{$height - 1}px" width="100%">
2204
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
2205
- <xsl:attribute name="background-color">magenta</xsl:attribute>
2206
- </xsl:if> -->
2207
- <fo:block> </fo:block></fo:block-container>
2208
- </fo:inline-container>
2209
- </fo:basic-link>
2210
- </fo:block>
2211
- </fo:block-container>
2212
- </xsl:template>
2213
-
2214
- <!-- =================== -->
2215
- <!-- End SVG images processing -->
2216
- <!-- =================== -->
2217
-
2218
- <!-- For express listings PDF attachments -->
2219
- <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
2220
- <fo:inline xsl:use-attribute-sets="eref-style">
2221
- <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2222
- <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
2223
- <xsl:if test="normalize-space(@citeas) = ''">
2224
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
2225
- </xsl:if>
2226
- <xsl:apply-templates/>
2227
- </fo:basic-link>
2228
- </fo:inline>
2229
- </xsl:template>
2230
-
2231
-
2232
- <!-- =================== -->
2233
- <!-- Index processing -->
2234
- <!-- =================== -->
2235
-
2236
- <xsl:template match="iso:indexsect"/>
2237
- <xsl:template match="iso:indexsect" mode="index">
2238
-
2239
- <fo:page-sequence master-reference="index" force-page-count="no-force">
2240
- <xsl:variable name="header-title">
2241
- <xsl:choose>
2242
- <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2243
- <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
2244
- </xsl:when>
2245
- <xsl:otherwise>
2246
- <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2247
- </xsl:otherwise>
2248
- </xsl:choose>
2249
- </xsl:variable>
2250
- <xsl:call-template name="insertHeaderFooter">
2251
- <xsl:with-param name="header-title" select="$header-title"/>
2252
- </xsl:call-template>
2253
-
2254
- <fo:flow flow-name="xsl-region-body">
2255
- <fo:block id="{@id}" span="all">
2256
- <xsl:apply-templates select="iso:title"/>
2257
- </fo:block>
2258
- <fo:block>
2259
- <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2260
- </fo:block>
2261
- </fo:flow>
2262
- </fo:page-sequence>
2263
- </xsl:template>
2264
-
2265
- <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
2266
- <xsl:template match="iso:indexsect/iso:title" priority="4">
2267
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
2268
- <!-- Index -->
2269
- <xsl:apply-templates/>
2270
- </fo:block>
2271
- </xsl:template>
2272
-
2273
- <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
2274
- <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
2275
- <!-- Letter A, B, C, ... -->
2276
- <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2277
- <xsl:apply-templates/>
2278
- </fo:block>
1959
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
1960
+ <xsl:template match="iso:indexsect/iso:title" priority="4">
1961
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
1962
+ <!-- Index -->
1963
+ <xsl:apply-templates/>
1964
+ </fo:block>
1965
+ </xsl:template>
1966
+
1967
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
1968
+ <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
1969
+ <!-- Letter A, B, C, ... -->
1970
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
1971
+ <xsl:apply-templates/>
1972
+ </fo:block>
2279
1973
  </xsl:template>
2280
1974
 
2281
1975
  <xsl:template match="iso:indexsect//iso:li/text()">
@@ -2673,6 +2367,9 @@
2673
2367
  <title-continued lang="en">(continued)</title-continued>
2674
2368
  <title-continued lang="fr">(continué)</title-continued>
2675
2369
 
2370
+ </xsl:variable><xsl:variable name="bibdata">
2371
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2372
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2676
2373
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2677
2374
  <xsl:param name="name"/>
2678
2375
  <xsl:param name="lang"/>
@@ -2701,11 +2398,13 @@
2701
2398
 
2702
2399
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2703
2400
 
2401
+
2704
2402
  <xsl:attribute name="color">blue</xsl:attribute>
2705
2403
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2706
2404
 
2707
2405
 
2708
2406
 
2407
+
2709
2408
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2710
2409
  <xsl:attribute name="white-space">pre</xsl:attribute>
2711
2410
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2755,7 +2454,7 @@
2755
2454
 
2756
2455
 
2757
2456
 
2758
-
2457
+
2759
2458
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2760
2459
 
2761
2460
 
@@ -2772,6 +2471,7 @@
2772
2471
 
2773
2472
 
2774
2473
 
2474
+
2775
2475
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2776
2476
 
2777
2477
 
@@ -2791,9 +2491,7 @@
2791
2491
 
2792
2492
 
2793
2493
 
2794
-
2795
-
2796
-
2494
+
2797
2495
 
2798
2496
 
2799
2497
 
@@ -2826,8 +2524,10 @@
2826
2524
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2827
2525
 
2828
2526
 
2527
+
2829
2528
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2830
2529
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2530
+
2831
2531
 
2832
2532
 
2833
2533
 
@@ -2846,6 +2546,9 @@
2846
2546
 
2847
2547
 
2848
2548
 
2549
+
2550
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2551
+
2849
2552
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2850
2553
 
2851
2554
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2866,19 +2569,24 @@
2866
2569
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
2867
2570
 
2868
2571
 
2572
+
2869
2573
  <xsl:attribute name="color">blue</xsl:attribute>
2870
2574
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2871
2575
 
2872
2576
 
2577
+
2873
2578
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2874
2579
 
2875
2580
 
2876
2581
 
2877
2582
 
2583
+
2584
+
2878
2585
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2879
2586
 
2880
2587
 
2881
2588
 
2589
+
2882
2590
 
2883
2591
 
2884
2592
 
@@ -2895,6 +2603,7 @@
2895
2603
 
2896
2604
 
2897
2605
 
2606
+
2898
2607
  </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">
2899
2608
 
2900
2609
 
@@ -2902,6 +2611,7 @@
2902
2611
 
2903
2612
 
2904
2613
 
2614
+
2905
2615
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
2906
2616
 
2907
2617
 
@@ -2931,6 +2641,7 @@
2931
2641
 
2932
2642
 
2933
2643
 
2644
+
2934
2645
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2935
2646
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
2936
2647
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -2938,9 +2649,12 @@
2938
2649
 
2939
2650
 
2940
2651
 
2652
+
2941
2653
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2654
+
2942
2655
 
2943
2656
 
2657
+
2944
2658
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2945
2659
 
2946
2660
 
@@ -2965,18 +2679,22 @@
2965
2679
 
2966
2680
 
2967
2681
 
2682
+
2968
2683
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2969
2684
 
2685
+
2970
2686
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2971
2687
 
2972
2688
 
2973
2689
 
2690
+
2974
2691
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2975
2692
 
2976
2693
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2977
2694
 
2978
2695
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2979
2696
 
2697
+
2980
2698
 
2981
2699
 
2982
2700
 
@@ -2996,6 +2714,7 @@
2996
2714
 
2997
2715
 
2998
2716
 
2717
+
2999
2718
 
3000
2719
 
3001
2720
 
@@ -3009,10 +2728,12 @@
3009
2728
 
3010
2729
 
3011
2730
 
2731
+
3012
2732
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
3013
2733
 
3014
2734
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
3015
2735
 
2736
+
3016
2737
  <xsl:attribute name="width">100%</xsl:attribute>
3017
2738
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
3018
2739
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3039,13 +2760,16 @@
3039
2760
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
3040
2761
 
3041
2762
 
2763
+
3042
2764
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
3043
2765
 
2766
+
3044
2767
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
3045
2768
 
3046
2769
 
3047
2770
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3048
2771
 
2772
+
3049
2773
  </xsl:attribute-set><xsl:variable name="color-added-text">
3050
2774
  <xsl:text>rgb(0, 255, 0)</xsl:text>
3051
2775
  </xsl:variable><xsl:attribute-set name="add-style">
@@ -3066,6 +2790,8 @@
3066
2790
  <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
3067
2791
 
3068
2792
 
2793
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
2794
+
3069
2795
  </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">
3070
2796
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3071
2797
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -3076,14 +2802,15 @@
3076
2802
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
3077
2803
 
3078
2804
  <!-- Normative references -->
3079
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
2805
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
3080
2806
  <!-- Terms and definitions -->
3081
2807
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
3082
2808
  <!-- Another main sections -->
3083
2809
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
3084
2810
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
3085
2811
  <!-- Bibliography -->
3086
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
2812
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
2813
+
3087
2814
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3088
2815
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
3089
2816
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -3119,11 +2846,11 @@
3119
2846
  <xsl:variable name="table">
3120
2847
 
3121
2848
  <xsl:variable name="simple-table">
3122
- <xsl:call-template name="getSimpleTable"/>
2849
+ <xsl:call-template name="getSimpleTable"/>
3123
2850
  </xsl:variable>
3124
2851
 
3125
2852
  <!-- <xsl:if test="$namespace = 'bipm'">
3126
- <fo:block>&#xA0;</fo:block>
2853
+ <fo:block>&#xA0;</fo:block>
3127
2854
  </xsl:if> -->
3128
2855
 
3129
2856
  <!-- $namespace = 'iso' or -->
@@ -3181,6 +2908,7 @@
3181
2908
 
3182
2909
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3183
2910
 
2911
+
3184
2912
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3185
2913
 
3186
2914
 
@@ -3192,6 +2920,7 @@
3192
2920
 
3193
2921
 
3194
2922
 
2923
+
3195
2924
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
3196
2925
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3197
2926
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -3201,6 +2930,7 @@
3201
2930
 
3202
2931
 
3203
2932
 
2933
+
3204
2934
  <xsl:variable name="table_width">
3205
2935
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3206
2936
  100%
@@ -3214,6 +2944,7 @@
3214
2944
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3215
2945
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3216
2946
 
2947
+
3217
2948
  <attribute name="border">1.5pt solid black</attribute>
3218
2949
  <xsl:if test="*[local-name()='thead']">
3219
2950
  <attribute name="border-top">1pt solid black</attribute>
@@ -3237,6 +2968,7 @@
3237
2968
 
3238
2969
 
3239
2970
 
2971
+
3240
2972
  </xsl:variable>
3241
2973
 
3242
2974
 
@@ -3373,13 +3105,29 @@
3373
3105
  </xsl:choose>
3374
3106
 
3375
3107
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
3108
+ <xsl:param name="continued"/>
3376
3109
  <xsl:if test="normalize-space() != ''">
3377
3110
  <fo:block xsl:use-attribute-sets="table-name-style">
3378
3111
 
3379
3112
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3380
3113
 
3381
3114
 
3382
- <xsl:apply-templates/>
3115
+
3116
+
3117
+
3118
+ <xsl:choose>
3119
+ <xsl:when test="$continued = 'true'">
3120
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
3121
+
3122
+ <xsl:apply-templates/>
3123
+
3124
+ </xsl:when>
3125
+ <xsl:otherwise>
3126
+ <xsl:apply-templates/>
3127
+ </xsl:otherwise>
3128
+ </xsl:choose>
3129
+
3130
+
3383
3131
  </fo:block>
3384
3132
  </xsl:if>
3385
3133
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -3520,21 +3268,27 @@
3520
3268
  <xsl:with-param name="cols-count" select="$cols-count"/>
3521
3269
  </xsl:call-template>
3522
3270
 
3271
+
3523
3272
  <xsl:apply-templates/>
3524
3273
  </fo:table-header>
3525
3274
  </xsl:template><xsl:template name="table-header-title">
3526
- <xsl:param name="cols-count"/>
3275
+ <xsl:param name="cols-count"/>
3527
3276
  <!-- row for title -->
3528
3277
  <fo:table-row>
3529
3278
  <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">
3530
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3279
+
3280
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3281
+ <xsl:with-param name="continued">true</xsl:with-param>
3282
+ </xsl:apply-templates>
3531
3283
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3532
3284
  <xsl:call-template name="fn_name_display"/>
3533
- </xsl:for-each>
3534
- <fo:block text-align="right" font-style="italic">
3535
- <xsl:text> </xsl:text>
3536
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3537
- </fo:block>
3285
+ </xsl:for-each>
3286
+
3287
+ <fo:block text-align="right" font-style="italic">
3288
+ <xsl:text> </xsl:text>
3289
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3290
+ </fo:block>
3291
+
3538
3292
  </fo:table-cell>
3539
3293
  </fo:table-row>
3540
3294
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3755,20 +3509,26 @@
3755
3509
  <xsl:call-template name="getTitle">
3756
3510
  <xsl:with-param name="name" select="'title-continued'"/>
3757
3511
  </xsl:call-template>
3758
- </xsl:variable>
3512
+ </xsl:variable>
3513
+
3514
+ <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3515
+ <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3516
+
3759
3517
  <fo:table-row height="0" keep-with-next.within-page="always">
3760
3518
  <fo:table-cell>
3761
- <fo:marker marker-class-name="table_continued"/>
3519
+
3520
+
3521
+ <fo:marker marker-class-name="table_continued"/>
3522
+
3762
3523
  <fo:block/>
3763
3524
  </fo:table-cell>
3764
3525
  </fo:table-row>
3765
3526
  <fo:table-row height="0" keep-with-next.within-page="always">
3766
3527
  <fo:table-cell>
3767
- <fo:marker marker-class-name="table_continued">
3768
- <!-- <fo:inline font-style="italic" font-weight="normal"> -->
3769
- <xsl:value-of select="$title_continued"/>
3770
- <!-- </fo:inline> -->
3771
- </fo:marker>
3528
+
3529
+ <fo:marker marker-class-name="table_continued">
3530
+ <xsl:value-of select="$title_continued"/>
3531
+ </fo:marker>
3772
3532
  <fo:block/>
3773
3533
  </fo:table-cell>
3774
3534
  </fo:table-row>
@@ -3805,6 +3565,7 @@
3805
3565
 
3806
3566
 
3807
3567
 
3568
+
3808
3569
  </xsl:if>
3809
3570
  <xsl:if test="$parent-name = 'tfoot'">
3810
3571
 
@@ -3818,6 +3579,10 @@
3818
3579
 
3819
3580
 
3820
3581
 
3582
+
3583
+
3584
+
3585
+
3821
3586
  <!-- <xsl:if test="$namespace = 'bipm'">
3822
3587
  <xsl:attribute name="height">8mm</xsl:attribute>
3823
3588
  </xsl:if> -->
@@ -3836,6 +3601,7 @@
3836
3601
  </xsl:choose>
3837
3602
  </xsl:attribute>
3838
3603
 
3604
+
3839
3605
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
3840
3606
 
3841
3607
 
@@ -3848,6 +3614,7 @@
3848
3614
 
3849
3615
 
3850
3616
 
3617
+
3851
3618
  <xsl:if test="$lang = 'ar'">
3852
3619
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3853
3620
  </xsl:if>
@@ -3896,6 +3663,8 @@
3896
3663
 
3897
3664
 
3898
3665
 
3666
+
3667
+
3899
3668
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3900
3669
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3901
3670
  </xsl:if>
@@ -3908,6 +3677,9 @@
3908
3677
 
3909
3678
 
3910
3679
 
3680
+
3681
+
3682
+
3911
3683
  <xsl:if test=".//*[local-name() = 'table']">
3912
3684
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3913
3685
  </xsl:if>
@@ -3940,6 +3712,7 @@
3940
3712
 
3941
3713
 
3942
3714
 
3715
+
3943
3716
  <fo:inline padding-right="2mm">
3944
3717
 
3945
3718
 
@@ -3986,6 +3759,7 @@
3986
3759
 
3987
3760
 
3988
3761
 
3762
+
3989
3763
  <xsl:value-of select="@reference"/>
3990
3764
 
3991
3765
 
@@ -4124,6 +3898,8 @@
4124
3898
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
4125
3899
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
4126
3900
 
3901
+
3902
+
4127
3903
  <xsl:if test="ancestor::*[local-name()='td']">
4128
3904
  <xsl:attribute name="font-weight">normal</xsl:attribute>
4129
3905
  <!-- <xsl:attribute name="alignment-baseline">hanging</xsl:attribute> -->
@@ -4135,6 +3911,8 @@
4135
3911
 
4136
3912
 
4137
3913
 
3914
+
3915
+
4138
3916
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4139
3917
 
4140
3918
 
@@ -4235,6 +4013,7 @@
4235
4013
 
4236
4014
 
4237
4015
 
4016
+
4238
4017
  <xsl:variable name="title-key">
4239
4018
 
4240
4019
  <xsl:call-template name="getLocalizedString">
@@ -4450,6 +4229,7 @@
4450
4229
 
4451
4230
  <fo:table-row>
4452
4231
 
4232
+
4453
4233
  <fo:table-cell>
4454
4234
 
4455
4235
  <fo:block margin-top="6pt">
@@ -4467,6 +4247,7 @@
4467
4247
 
4468
4248
 
4469
4249
 
4250
+
4470
4251
  <xsl:apply-templates/>
4471
4252
  <!-- <xsl:if test="$namespace = 'gb'">
4472
4253
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -4523,6 +4304,8 @@
4523
4304
 
4524
4305
  <xsl:apply-templates/>
4525
4306
  </fo:inline>
4307
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4308
+ <fo:inline padding-right="{@value}"> </fo:inline>
4526
4309
  </xsl:template><xsl:template match="*[local-name()='sup']">
4527
4310
  <fo:inline font-size="80%" vertical-align="super">
4528
4311
  <xsl:apply-templates/>
@@ -4548,6 +4331,7 @@
4548
4331
 
4549
4332
 
4550
4333
 
4334
+
4551
4335
 
4552
4336
  </xsl:variable>
4553
4337
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4929,11 +4713,15 @@
4929
4713
  </xsl:apply-templates>
4930
4714
  </xsl:template><xsl:template name="getLang">
4931
4715
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4716
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4932
4717
  <xsl:variable name="language">
4933
4718
  <xsl:choose>
4934
4719
  <xsl:when test="$language_current != ''">
4935
4720
  <xsl:value-of select="$language_current"/>
4936
4721
  </xsl:when>
4722
+ <xsl:when test="$language_current_2 != ''">
4723
+ <xsl:value-of select="$language_current_2"/>
4724
+ </xsl:when>
4937
4725
  <xsl:otherwise>
4938
4726
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4939
4727
  </xsl:otherwise>
@@ -5014,9 +4802,27 @@
5014
4802
  <xsl:copy>
5015
4803
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
5016
4804
  </xsl:copy>
5017
- <mathml:mspace width="0.5ex"/>
4805
+ <xsl:choose>
4806
+ <!-- if in msub, then don't add space -->
4807
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
4808
+ <!-- if next char in digit, don't add space -->
4809
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
4810
+ <xsl:otherwise>
4811
+ <mathml:mspace width="0.5ex"/>
4812
+ </xsl:otherwise>
4813
+ </xsl:choose>
5018
4814
  </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">
5019
4815
  <xsl:variable name="target">
4816
+ <xsl:choose>
4817
+ <xsl:when test="@updatetype = 'true'">
4818
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
4819
+ </xsl:when>
4820
+ <xsl:otherwise>
4821
+ <xsl:value-of select="normalize-space(@target)"/>
4822
+ </xsl:otherwise>
4823
+ </xsl:choose>
4824
+ </xsl:variable>
4825
+ <xsl:variable name="target_text">
5020
4826
  <xsl:choose>
5021
4827
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5022
4828
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -5028,20 +4834,22 @@
5028
4834
  </xsl:variable>
5029
4835
  <fo:inline xsl:use-attribute-sets="link-style">
5030
4836
 
4837
+
4838
+
5031
4839
  <xsl:choose>
5032
- <xsl:when test="$target = ''">
4840
+ <xsl:when test="$target_text = ''">
5033
4841
  <xsl:apply-templates/>
5034
4842
  </xsl:when>
5035
4843
  <xsl:otherwise>
5036
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4844
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5037
4845
  <xsl:choose>
5038
4846
  <xsl:when test="normalize-space(.) = ''">
5039
- <!-- <xsl:value-of select="$target"/> -->
5040
4847
  <xsl:call-template name="add-zero-spaces-link-java">
5041
- <xsl:with-param name="text" select="$target"/>
4848
+ <xsl:with-param name="text" select="$target_text"/>
5042
4849
  </xsl:call-template>
5043
4850
  </xsl:when>
5044
4851
  <xsl:otherwise>
4852
+ <!-- output text from <link>text</link> -->
5045
4853
  <xsl:apply-templates/>
5046
4854
  </xsl:otherwise>
5047
4855
  </xsl:choose>
@@ -5153,6 +4961,7 @@
5153
4961
 
5154
4962
 
5155
4963
  <fo:inline xsl:use-attribute-sets="note-name-style">
4964
+
5156
4965
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5157
4966
  </fo:inline>
5158
4967
  <xsl:apply-templates/>
@@ -5178,7 +4987,9 @@
5178
4987
  </xsl:choose>
5179
4988
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
5180
4989
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4990
+
5181
4991
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4992
+
5182
4993
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5183
4994
  </fo:inline>
5184
4995
  <xsl:apply-templates/>
@@ -5252,13 +5063,17 @@
5252
5063
  </xsl:call-template>
5253
5064
 
5254
5065
  <fo:block>
5066
+
5255
5067
  <xsl:apply-templates/>
5256
5068
  </fo:block>
5257
5069
  <xsl:call-template name="fn_display_figure"/>
5258
5070
  <xsl:for-each select="*[local-name() = 'note']">
5259
5071
  <xsl:call-template name="note"/>
5260
5072
  </xsl:for-each>
5261
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5073
+
5074
+
5075
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5076
+
5262
5077
  </fo:block-container>
5263
5078
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
5264
5079
  <fo:block id="{@id}">
@@ -5371,21 +5186,249 @@
5371
5186
  <xsl:param name="height"/>
5372
5187
  <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; "/>
5373
5188
  <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; "/>
5189
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
5190
+ <xsl:param name="name"/>
5191
+
5192
+ <xsl:variable name="svg_content">
5193
+ <xsl:apply-templates select="." mode="svg_update"/>
5194
+ </xsl:variable>
5195
+
5196
+ <xsl:variable name="alt-text">
5197
+ <xsl:choose>
5198
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
5199
+ <xsl:value-of select="../*[local-name() = 'name']"/>
5200
+ </xsl:when>
5201
+ <xsl:when test="normalize-space($name) != ''">
5202
+ <xsl:value-of select="$name"/>
5203
+ </xsl:when>
5204
+ <xsl:otherwise>Figure</xsl:otherwise>
5205
+ </xsl:choose>
5206
+ </xsl:variable>
5207
+
5208
+ <xsl:choose>
5209
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
5210
+ <fo:block>
5211
+ <xsl:variable name="width" select="@width"/>
5212
+ <xsl:variable name="height" select="@height"/>
5213
+
5214
+ <xsl:variable name="scale_x">
5215
+ <xsl:choose>
5216
+ <xsl:when test="$width &gt; $width_effective_px">
5217
+ <xsl:value-of select="$width_effective_px div $width"/>
5218
+ </xsl:when>
5219
+ <xsl:otherwise>1</xsl:otherwise>
5220
+ </xsl:choose>
5221
+ </xsl:variable>
5222
+
5223
+ <xsl:variable name="scale_y">
5224
+ <xsl:choose>
5225
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
5226
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
5227
+ </xsl:when>
5228
+ <xsl:otherwise>1</xsl:otherwise>
5229
+ </xsl:choose>
5230
+ </xsl:variable>
5231
+
5232
+ <xsl:variable name="scale">
5233
+ <xsl:choose>
5234
+ <xsl:when test="$scale_y != 1">
5235
+ <xsl:value-of select="$scale_x * $scale_y"/>
5236
+ </xsl:when>
5237
+ <xsl:otherwise>
5238
+ <xsl:value-of select="$scale_x"/>
5239
+ </xsl:otherwise>
5240
+ </xsl:choose>
5241
+ </xsl:variable>
5242
+
5243
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
5244
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
5245
+
5246
+ <fo:table table-layout="fixed" width="100%">
5247
+ <fo:table-column column-width="proportional-column-width(1)"/>
5248
+ <fo:table-column column-width="{$width_scale}px"/>
5249
+ <fo:table-column column-width="proportional-column-width(1)"/>
5250
+ <fo:table-body>
5251
+ <fo:table-row>
5252
+ <fo:table-cell column-number="2">
5253
+ <fo:block>
5254
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
5255
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5256
+ <fo:block line-height="0" font-size="0">
5257
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5258
+ <xsl:call-template name="bookmark"/>
5259
+ </xsl:for-each>
5260
+ </fo:block>
5261
+ </xsl:if>
5262
+ <fo:block text-depth="0" line-height="0" font-size="0">
5263
+
5264
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5265
+ <xsl:attribute name="width">100%</xsl:attribute>
5266
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5267
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5268
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5269
+
5270
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
5271
+ </fo:instream-foreign-object>
5272
+ </fo:block>
5273
+
5274
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
5275
+ <xsl:with-param name="scale" select="$scale"/>
5276
+ </xsl:apply-templates>
5277
+ </fo:block-container>
5278
+ </fo:block>
5279
+ </fo:table-cell>
5280
+ </fo:table-row>
5281
+ </fo:table-body>
5282
+ </fo:table>
5283
+ </fo:block>
5284
+
5285
+ </xsl:when>
5286
+ <xsl:otherwise>
5287
+ <fo:block xsl:use-attribute-sets="image-style">
5288
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5289
+ <xsl:attribute name="width">100%</xsl:attribute>
5290
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5291
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5292
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5293
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5294
+ <!-- effective height / width = 1.48, 1.4 - with title -->
5295
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
5296
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
5297
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5298
+ </xsl:if>
5299
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5300
+ <xsl:copy-of select="$svg_content"/>
5301
+ </fo:instream-foreign-object>
5302
+ </fo:block>
5303
+ </xsl:otherwise>
5304
+ </xsl:choose>
5305
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
5306
+ <xsl:copy>
5307
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
5308
+ </xsl:copy>
5309
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
5310
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
5311
+ <xsl:value-of select="."/>
5312
+ </xsl:attribute>
5313
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5314
+ <xsl:variable name="svg_content" select="document(@src)"/>
5315
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
5316
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
5317
+ <xsl:call-template name="image_svg">
5318
+ <xsl:with-param name="name" select="$name"/>
5319
+ </xsl:call-template>
5320
+ </xsl:for-each>
5321
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
5322
+ <xsl:copy>
5323
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
5324
+ </xsl:copy>
5325
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
5326
+ <xsl:apply-templates mode="svg_remove_a"/>
5327
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
5328
+ <xsl:param name="scale"/>
5329
+ <xsl:variable name="dest">
5330
+ <xsl:choose>
5331
+ <xsl:when test="starts-with(@href, '#')">
5332
+ <xsl:value-of select="substring-after(@href, '#')"/>
5333
+ </xsl:when>
5334
+ <xsl:otherwise>
5335
+ <xsl:value-of select="@href"/>
5336
+ </xsl:otherwise>
5337
+ </xsl:choose>
5338
+ </xsl:variable>
5339
+ <xsl:for-each select="./*[local-name() = 'rect']">
5340
+ <xsl:call-template name="insertSVGMapLink">
5341
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
5342
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
5343
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
5344
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
5345
+ <xsl:with-param name="dest" select="$dest"/>
5346
+ </xsl:call-template>
5347
+ </xsl:for-each>
5348
+
5349
+ <xsl:for-each select="./*[local-name() = 'polygon']">
5350
+ <xsl:variable name="points">
5351
+ <xsl:call-template name="split">
5352
+ <xsl:with-param name="pText" select="@points"/>
5353
+ </xsl:call-template>
5354
+ </xsl:variable>
5355
+ <xsl:variable name="x_coords">
5356
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
5357
+ <xsl:sort select="." data-type="number"/>
5358
+ <x><xsl:value-of select="."/></x>
5359
+ </xsl:for-each>
5360
+ </xsl:variable>
5361
+ <xsl:variable name="y_coords">
5362
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
5363
+ <xsl:sort select="." data-type="number"/>
5364
+ <y><xsl:value-of select="."/></y>
5365
+ </xsl:for-each>
5366
+ </xsl:variable>
5367
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
5368
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
5369
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
5370
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
5371
+ <xsl:call-template name="insertSVGMapLink">
5372
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
5373
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
5374
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
5375
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
5376
+ <xsl:with-param name="dest" select="$dest"/>
5377
+ </xsl:call-template>
5378
+ </xsl:for-each>
5379
+
5380
+ <xsl:for-each select="./*[local-name() = 'circle']">
5381
+ <xsl:call-template name="insertSVGMapLink">
5382
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
5383
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
5384
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
5385
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
5386
+ <xsl:with-param name="dest" select="$dest"/>
5387
+ </xsl:call-template>
5388
+ </xsl:for-each>
5389
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
5390
+ <xsl:call-template name="insertSVGMapLink">
5391
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
5392
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
5393
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
5394
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
5395
+ <xsl:with-param name="dest" select="$dest"/>
5396
+ </xsl:call-template>
5397
+ </xsl:for-each>
5398
+ </xsl:template><xsl:template name="insertSVGMapLink">
5399
+ <xsl:param name="left"/>
5400
+ <xsl:param name="top"/>
5401
+ <xsl:param name="width"/>
5402
+ <xsl:param name="height"/>
5403
+ <xsl:param name="dest"/>
5404
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
5405
+ <fo:block font-size="1pt">
5406
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
5407
+ <fo:inline-container inline-progression-dimension="100%">
5408
+ <fo:block-container height="{$height - 1}px" width="100%">
5409
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
5410
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
5411
+ </xsl:if> -->
5412
+ <fo:block> </fo:block></fo:block-container>
5413
+ </fo:inline-container>
5414
+ </fo:basic-link>
5415
+ </fo:block>
5416
+ </fo:block-container>
5374
5417
  </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">
5375
5418
  <xsl:apply-templates mode="contents"/>
5376
5419
  <xsl:text> </xsl:text>
5377
5420
  </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">
5378
5421
  <xsl:apply-templates mode="bookmarks"/>
5379
5422
  <xsl:text> </xsl:text>
5380
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
5423
+ </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">
5381
5424
  <xsl:value-of select="."/>
5382
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5425
+ </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">
5383
5426
  <xsl:value-of select="."/>
5384
5427
  </xsl:template><xsl:template match="node()" mode="contents">
5385
5428
  <xsl:apply-templates mode="contents"/>
5386
5429
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5387
5430
  <xsl:apply-templates mode="bookmarks"/>
5388
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5431
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5389
5432
  <xsl:apply-templates select="."/>
5390
5433
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5391
5434
  <xsl:apply-templates mode="bookmarks"/>
@@ -5399,28 +5442,39 @@
5399
5442
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5400
5443
  <xsl:for-each select="xalan:nodeset($contents)/doc">
5401
5444
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5445
+ <xsl:if test="@bundle = 'true'">
5446
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
5447
+ </xsl:if>
5402
5448
  <fo:bookmark-title>
5403
- <xsl:variable name="bookmark-title_">
5404
- <xsl:call-template name="getLangVersion">
5405
- <xsl:with-param name="lang" select="@lang"/>
5406
- <xsl:with-param name="doctype" select="@doctype"/>
5407
- <xsl:with-param name="title" select="@title-part"/>
5408
- </xsl:call-template>
5409
- </xsl:variable>
5410
5449
  <xsl:choose>
5411
- <xsl:when test="normalize-space($bookmark-title_) != ''">
5412
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
5413
- </xsl:when>
5414
- <xsl:otherwise>
5450
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
5451
+ <xsl:variable name="bookmark-title_">
5452
+ <xsl:call-template name="getLangVersion">
5453
+ <xsl:with-param name="lang" select="@lang"/>
5454
+ <xsl:with-param name="doctype" select="@doctype"/>
5455
+ <xsl:with-param name="title" select="@title-part"/>
5456
+ </xsl:call-template>
5457
+ </xsl:variable>
5415
5458
  <xsl:choose>
5416
- <xsl:when test="@lang = 'en'">English</xsl:when>
5417
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
5418
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5419
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5459
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
5460
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
5461
+ </xsl:when>
5462
+ <xsl:otherwise>
5463
+ <xsl:choose>
5464
+ <xsl:when test="@lang = 'en'">English</xsl:when>
5465
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
5466
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5467
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5468
+ </xsl:choose>
5469
+ </xsl:otherwise>
5420
5470
  </xsl:choose>
5471
+ </xsl:when>
5472
+ <xsl:otherwise>
5473
+ <xsl:value-of select="@title-part"/>
5421
5474
  </xsl:otherwise>
5422
5475
  </xsl:choose>
5423
5476
  </fo:bookmark-title>
5477
+
5424
5478
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5425
5479
 
5426
5480
  <xsl:call-template name="insertFigureBookmarks">
@@ -5519,20 +5573,28 @@
5519
5573
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
5520
5574
  </xsl:choose>
5521
5575
  </xsl:template><xsl:template match="item" mode="bookmark">
5522
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
5523
- <fo:bookmark-title>
5524
- <xsl:if test="@section != ''">
5525
- <xsl:value-of select="@section"/>
5526
- <xsl:text> </xsl:text>
5527
- </xsl:if>
5528
- <xsl:value-of select="normalize-space(title)"/>
5529
- </fo:bookmark-title>
5530
- <xsl:apply-templates mode="bookmark"/>
5531
- </fo:bookmark>
5576
+ <xsl:choose>
5577
+ <xsl:when test="@id != ''">
5578
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
5579
+ <fo:bookmark-title>
5580
+ <xsl:if test="@section != ''">
5581
+ <xsl:value-of select="@section"/>
5582
+ <xsl:text> </xsl:text>
5583
+ </xsl:if>
5584
+ <xsl:value-of select="normalize-space(title)"/>
5585
+ </fo:bookmark-title>
5586
+ <xsl:apply-templates mode="bookmark"/>
5587
+ </fo:bookmark>
5588
+ </xsl:when>
5589
+ <xsl:otherwise>
5590
+ <xsl:apply-templates mode="bookmark"/>
5591
+ </xsl:otherwise>
5592
+ </xsl:choose>
5532
5593
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
5533
5594
  <xsl:if test="normalize-space() != ''">
5534
5595
  <fo:block xsl:use-attribute-sets="figure-name-style">
5535
5596
 
5597
+
5536
5598
  <xsl:apply-templates/>
5537
5599
  </fo:block>
5538
5600
  </xsl:if>
@@ -5584,6 +5646,8 @@
5584
5646
  </fo:list-item-body>
5585
5647
  </fo:list-item>
5586
5648
  </fo:list-block>
5649
+ </xsl:template><xsl:template name="extractSection">
5650
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5587
5651
  </xsl:template><xsl:template name="extractTitle">
5588
5652
  <xsl:choose>
5589
5653
  <xsl:when test="*[local-name() = 'tab']">
@@ -5610,6 +5674,8 @@
5610
5674
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5611
5675
 
5612
5676
  <fo:block-container margin-left="0mm">
5677
+ <xsl:copy-of select="@id"/>
5678
+
5613
5679
  <xsl:if test="parent::*[local-name() = 'note']">
5614
5680
  <xsl:attribute name="margin-left">
5615
5681
  <xsl:choose>
@@ -5620,7 +5686,9 @@
5620
5686
 
5621
5687
  </xsl:if>
5622
5688
  <fo:block-container margin-left="0mm">
5623
-
5689
+
5690
+
5691
+
5624
5692
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5625
5693
  <xsl:variable name="_font-size">
5626
5694
 
@@ -5631,6 +5699,7 @@
5631
5699
  9
5632
5700
 
5633
5701
 
5702
+
5634
5703
 
5635
5704
 
5636
5705
 
@@ -5648,10 +5717,14 @@
5648
5717
  </xsl:choose>
5649
5718
  </xsl:attribute>
5650
5719
  </xsl:if>
5651
- <xsl:apply-templates/>
5652
- </fo:block>
5720
+
5721
+ <xsl:apply-templates/>
5722
+ </fo:block>
5723
+
5724
+
5653
5725
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5654
5726
 
5727
+
5655
5728
  </fo:block-container>
5656
5729
  </fo:block-container>
5657
5730
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5886,6 +5959,7 @@
5886
5959
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5887
5960
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5888
5961
 
5962
+
5889
5963
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5890
5964
 
5891
5965
  <xsl:variable name="element">
@@ -5958,7 +6032,7 @@
5958
6032
  </fo:inline>
5959
6033
  </xsl:otherwise>
5960
6034
  </xsl:choose>
5961
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
6035
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5962
6036
  <fo:block xsl:use-attribute-sets="termsource-style">
5963
6037
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5964
6038
  <xsl:variable name="termsource_text">
@@ -5967,13 +6041,15 @@
5967
6041
 
5968
6042
  <xsl:choose>
5969
6043
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5970
- <xsl:apply-templates/>
6044
+ <!-- <xsl:apply-templates /> -->
6045
+ <xsl:copy-of select="$termsource_text"/>
5971
6046
  </xsl:when>
5972
6047
  <xsl:otherwise>
5973
6048
 
5974
6049
  <xsl:text>[</xsl:text>
5975
6050
 
5976
- <xsl:apply-templates/>
6051
+ <!-- <xsl:apply-templates /> -->
6052
+ <xsl:copy-of select="$termsource_text"/>
5977
6053
 
5978
6054
  <xsl:text>]</xsl:text>
5979
6055
 
@@ -5984,20 +6060,27 @@
5984
6060
  <xsl:if test="normalize-space() != ''">
5985
6061
  <xsl:value-of select="."/>
5986
6062
  </xsl:if>
5987
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
6063
+ </xsl:template><xsl:variable name="localized.source">
6064
+ <xsl:call-template name="getLocalizedString">
6065
+ <xsl:with-param name="key">source</xsl:with-param>
6066
+ </xsl:call-template>
6067
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5988
6068
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6069
+ <xsl:if test="normalize-space(@citeas) = ''">
6070
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6071
+ </xsl:if>
5989
6072
 
5990
6073
  <fo:inline>
5991
6074
 
5992
6075
 
5993
6076
 
5994
- <xsl:call-template name="getLocalizedString">
5995
- <xsl:with-param name="key">source</xsl:with-param>
5996
- </xsl:call-template>
6077
+
6078
+ <xsl:value-of select="$localized.source"/>
6079
+ <xsl:text>: </xsl:text>
6080
+
5997
6081
 
5998
6082
 
5999
6083
 
6000
- <xsl:text>: </xsl:text>
6001
6084
  </fo:inline>
6002
6085
 
6003
6086
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -6070,6 +6153,7 @@
6070
6153
  </xsl:if>
6071
6154
 
6072
6155
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6156
+
6073
6157
  <xsl:if test="normalize-space(@citeas) = ''">
6074
6158
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6075
6159
  </xsl:if>
@@ -6103,6 +6187,7 @@
6103
6187
 
6104
6188
 
6105
6189
 
6190
+
6106
6191
  <xsl:choose>
6107
6192
  <xsl:when test="$depth = 2">3</xsl:when>
6108
6193
  <xsl:otherwise>4</xsl:otherwise>
@@ -6205,7 +6290,6 @@
6205
6290
 
6206
6291
 
6207
6292
 
6208
-
6209
6293
  <xsl:apply-templates/>
6210
6294
  </fo:block>
6211
6295
 
@@ -6222,6 +6306,7 @@
6222
6306
  <xsl:call-template name="setId"/>
6223
6307
 
6224
6308
 
6309
+
6225
6310
  <xsl:apply-templates/>
6226
6311
  </fo:block>
6227
6312
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -6248,7 +6333,7 @@
6248
6333
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6249
6334
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6250
6335
  <xsl:choose>
6251
- <xsl:when test="parent::*[local-name() = 'note']">
6336
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
6252
6337
  <fo:block-container>
6253
6338
  <xsl:attribute name="margin-left">
6254
6339
  <xsl:choose>
@@ -6258,6 +6343,7 @@
6258
6343
  </xsl:attribute>
6259
6344
 
6260
6345
 
6346
+
6261
6347
  <fo:block-container margin-left="0mm">
6262
6348
  <fo:block>
6263
6349
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -6459,21 +6545,51 @@
6459
6545
 
6460
6546
 
6461
6547
 
6548
+
6549
+
6550
+ <!-- start ISO bibtem processing -->
6551
+ <xsl:variable name="docidentifier">
6552
+ <xsl:if test="*[local-name() = 'docidentifier']">
6553
+ <xsl:choose>
6554
+ <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
6555
+ <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier']"/></xsl:otherwise>
6556
+ </xsl:choose>
6557
+ </xsl:if>
6558
+ </xsl:variable>
6559
+ <xsl:value-of select="$docidentifier"/>
6560
+ <xsl:apply-templates select="*[local-name() = 'note']"/>
6561
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6562
+ <xsl:choose>
6563
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
6564
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
6565
+ </xsl:when>
6566
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
6567
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
6568
+ </xsl:when>
6569
+ <xsl:otherwise>
6570
+ <xsl:apply-templates select="*[local-name() = 'title']"/>
6571
+ </xsl:otherwise>
6572
+ </xsl:choose>
6573
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6574
+ <!-- end ISO bibitem processing -->
6575
+
6576
+
6577
+
6462
6578
  </xsl:template><xsl:template name="processBibitemDocId">
6463
6579
  <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')]"/>
6464
6580
  <xsl:choose>
6465
6581
  <xsl:when test="normalize-space($_doc_ident) != ''">
6466
- <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"/>
6582
+ <!-- <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"/>
6467
6583
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
6468
6584
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6469
- </xsl:if>
6585
+ </xsl:if> -->
6470
6586
  <xsl:value-of select="$_doc_ident"/>
6471
6587
  </xsl:when>
6472
6588
  <xsl:otherwise>
6473
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6589
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6474
6590
  <xsl:if test="$type != ''">
6475
6591
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6476
- </xsl:if>
6592
+ </xsl:if> -->
6477
6593
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6478
6594
  </xsl:otherwise>
6479
6595
  </xsl:choose>
@@ -6515,6 +6631,70 @@
6515
6631
  <xsl:value-of select="substring(.,1,1)"/>
6516
6632
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
6517
6633
  <fo:inline><xsl:apply-templates/></fo:inline>
6634
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6635
+ <fo:block>
6636
+ <xsl:apply-templates/>
6637
+ </fo:block>
6638
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6639
+ <fo:inline><xsl:apply-templates/></fo:inline>
6640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6641
+ <fo:inline>
6642
+ <xsl:call-template name="text_input"/>
6643
+ </fo:inline>
6644
+ </xsl:template><xsl:template name="text_input">
6645
+ <xsl:variable name="count">
6646
+ <xsl:choose>
6647
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6648
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6649
+ <xsl:otherwise>10</xsl:otherwise>
6650
+ </xsl:choose>
6651
+ </xsl:variable>
6652
+ <xsl:call-template name="repeat">
6653
+ <xsl:with-param name="char" select="'_'"/>
6654
+ <xsl:with-param name="count" select="$count"/>
6655
+ </xsl:call-template>
6656
+ <xsl:text> </xsl:text>
6657
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6658
+ <xsl:variable name="caption">
6659
+ <xsl:choose>
6660
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6661
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6662
+ </xsl:choose>
6663
+ </xsl:variable>
6664
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6665
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6666
+ <fo:inline padding-right="1mm">
6667
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6668
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6669
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6670
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6671
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6672
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6673
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6674
+ </svg>
6675
+ </fo:instream-foreign-object>
6676
+ </fo:inline>
6677
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6678
+ <fo:inline padding-right="1mm">
6679
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6680
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6681
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6682
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6683
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6684
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6685
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6686
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6687
+ </svg>
6688
+ </fo:instream-foreign-object>
6689
+ </fo:inline>
6690
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6691
+ <fo:inline>
6692
+ <xsl:call-template name="text_input"/>
6693
+ </fo:inline>
6694
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6695
+ <fo:block-container border="1pt solid black" width="50%">
6696
+ <fo:block> </fo:block>
6697
+ </fo:block-container>
6518
6698
  </xsl:template><xsl:template name="convertDate">
6519
6699
  <xsl:param name="date"/>
6520
6700
  <xsl:param name="format" select="'short'"/>
@@ -6722,6 +6902,9 @@
6722
6902
  <xsl:when test="parent::*[local-name() = 'preface']">
6723
6903
  <xsl:value-of select="$level_total - 1"/>
6724
6904
  </xsl:when>
6905
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
6906
+ <xsl:value-of select="$level_total - 1"/>
6907
+ </xsl:when>
6725
6908
  <xsl:when test="ancestor::*[local-name() = 'preface']">
6726
6909
  <xsl:value-of select="$level_total - 2"/>
6727
6910
  </xsl:when>
@@ -6777,6 +6960,7 @@
6777
6960
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
6778
6961
  <xsl:variable name="XSLNS">
6779
6962
 
6963
+
6780
6964
  <xsl:value-of select="document('')//*/namespace::iso"/>
6781
6965
 
6782
6966
 
@@ -6846,17 +7030,29 @@
6846
7030
  </xsl:call-template>
6847
7031
  </xsl:if>
6848
7032
  </xsl:template><xsl:template name="getLocalizedString">
6849
- <xsl:param name="key"/>
7033
+ <xsl:param name="key"/>
6850
7034
 
6851
7035
  <xsl:variable name="curr_lang">
6852
7036
  <xsl:call-template name="getLang"/>
6853
7037
  </xsl:variable>
6854
7038
 
7039
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
7040
+
6855
7041
  <xsl:choose>
7042
+ <xsl:when test="$data_value != ''">
7043
+ <xsl:value-of select="$data_value"/>
7044
+ </xsl:when>
6856
7045
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6857
7046
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6858
7047
  </xsl:when>
6859
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
7048
+ <xsl:otherwise>
7049
+ <xsl:variable name="key_">
7050
+ <xsl:call-template name="capitalize">
7051
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
7052
+ </xsl:call-template>
7053
+ </xsl:variable>
7054
+ <xsl:value-of select="$key_"/>
7055
+ </xsl:otherwise>
6860
7056
  </xsl:choose>
6861
7057
 
6862
7058
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -6899,4 +7095,14 @@
6899
7095
  <xsl:value-of select="$align"/>
6900
7096
  </xsl:when>
6901
7097
  </xsl:choose>
7098
+ </xsl:template><xsl:template name="setTextAlignment">
7099
+ <xsl:param name="default">left</xsl:param>
7100
+ <xsl:attribute name="text-align">
7101
+ <xsl:choose>
7102
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7103
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7104
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7105
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7106
+ </xsl:choose>
7107
+ </xsl:attribute>
6902
7108
  </xsl:template></xsl:stylesheet>