metanorma-iso 1.8.3 → 1.9.0

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 (41) 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 -6
  5. data/lib/asciidoctor/iso/cleanup.rb +0 -1
  6. data/lib/asciidoctor/iso/isodoc.rng +65 -7
  7. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  8. data/lib/asciidoctor/iso/isostandard.rng +18 -3
  9. data/lib/asciidoctor/iso/section.rb +3 -0
  10. data/lib/asciidoctor/iso/validate.rb +4 -17
  11. data/lib/asciidoctor/iso/validate_section.rb +50 -34
  12. data/lib/asciidoctor/iso/validate_style.rb +3 -3
  13. data/lib/isodoc/iso/base_convert.rb +41 -16
  14. data/lib/isodoc/iso/html/isodoc.css +475 -20
  15. data/lib/isodoc/iso/html/isodoc.scss +456 -23
  16. data/lib/isodoc/iso/html/wordstyle.css +202 -31
  17. data/lib/isodoc/iso/html/wordstyle.scss +194 -32
  18. data/lib/isodoc/iso/iso.amendment.xsl +524 -400
  19. data/lib/isodoc/iso/iso.international-standard.xsl +524 -400
  20. data/lib/isodoc/iso/isosts_convert.rb +12 -13
  21. data/lib/isodoc/iso/metadata.rb +2 -2
  22. data/lib/isodoc/iso/presentation_xml_convert.rb +62 -9
  23. data/lib/isodoc/iso/sts_convert.rb +4 -5
  24. data/lib/isodoc/iso/word_convert.rb +153 -39
  25. data/lib/isodoc/iso/xref.rb +27 -10
  26. data/lib/metanorma/iso/version.rb +1 -1
  27. data/metanorma-iso.gemspec +4 -4
  28. data/spec/asciidoctor/section_spec.rb +128 -7
  29. data/spec/asciidoctor/validate_spec.rb +15 -15
  30. data/spec/isodoc/amd_spec.rb +193 -201
  31. data/spec/isodoc/blocks_spec.rb +100 -88
  32. data/spec/isodoc/i18n_spec.rb +36 -36
  33. data/spec/isodoc/inline_spec.rb +472 -2
  34. data/spec/isodoc/iso_spec.rb +86 -138
  35. data/spec/isodoc/postproc_spec.rb +19 -10
  36. data/spec/isodoc/ref_spec.rb +6 -6
  37. data/spec/isodoc/section_spec.rb +394 -276
  38. data/spec/isodoc/table_spec.rb +166 -231
  39. data/spec/isodoc/terms_spec.rb +11 -8
  40. data/spec/isodoc/xref_spec.rb +147 -118
  41. metadata +8 -8
@@ -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">
@@ -1915,257 +1908,6 @@
1915
1908
  </fo:block>
1916
1909
  </xsl:template>
1917
1910
 
1918
- <!-- =================== -->
1919
- <!-- SVG images processing -->
1920
- <!-- =================== -->
1921
- <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" 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>
1940
-
1941
- <xsl:choose>
1942
- <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1943
- <fo:block>
1944
- <xsl:variable name="width" select="@width"/>
1945
- <xsl:variable name="height" select="@height"/>
1946
-
1947
- <xsl:variable name="scale_x">
1948
- <xsl:choose>
1949
- <xsl:when test="$width &gt; $width_effective_px">
1950
- <xsl:value-of select="$width_effective_px div $width"/>
1951
- </xsl:when>
1952
- <xsl:otherwise>1</xsl:otherwise>
1953
- </xsl:choose>
1954
- </xsl:variable>
1955
-
1956
- <xsl:variable name="scale_y">
1957
- <xsl:choose>
1958
- <xsl:when test="$height * $scale_x &gt; $height_effective_px">
1959
- <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
1960
- </xsl:when>
1961
- <xsl:otherwise>1</xsl:otherwise>
1962
- </xsl:choose>
1963
- </xsl:variable>
1964
-
1965
- <xsl:variable name="scale">
1966
- <xsl:choose>
1967
- <xsl:when test="$scale_y != 1">
1968
- <xsl:value-of select="$scale_x * $scale_y"/>
1969
- </xsl:when>
1970
- <xsl:otherwise>
1971
- <xsl:value-of select="$scale_x"/>
1972
- </xsl:otherwise>
1973
- </xsl:choose>
1974
- </xsl:variable>
1975
-
1976
- <xsl:variable name="width_scale" select="round($width * $scale)"/>
1977
- <xsl:variable name="height_scale" select="round($height * $scale)"/>
1978
-
1979
- <fo:table table-layout="fixed" width="100%">
1980
- <fo:table-column column-width="proportional-column-width(1)"/>
1981
- <fo:table-column column-width="{$width_scale}px"/>
1982
- <fo:table-column column-width="proportional-column-width(1)"/>
1983
- <fo:table-body>
1984
- <fo:table-row>
1985
- <fo:table-cell column-number="2">
1986
- <fo:block>
1987
- <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
1988
- <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
1989
- <fo:block line-height="0" font-size="0">
1990
- <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
1991
- <xsl:call-template name="bookmark"/>
1992
- </xsl:for-each>
1993
- </fo:block>
1994
- </xsl:if>
1995
- <fo:block text-depth="0" line-height="0" font-size="0">
1996
-
1997
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
1998
- <xsl:attribute name="width">100%</xsl:attribute>
1999
- <xsl:attribute name="content-height">100%</xsl:attribute>
2000
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2001
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2002
-
2003
- <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
2004
- </fo:instream-foreign-object>
2005
- </fo:block>
2006
-
2007
- <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">
2008
- <xsl:with-param name="scale" select="$scale"/>
2009
- </xsl:apply-templates>
2010
- </fo:block-container>
2011
- </fo:block>
2012
- </fo:table-cell>
2013
- </fo:table-row>
2014
- </fo:table-body>
2015
- </fo:table>
2016
- </fo:block>
2017
-
2018
- </xsl:when>
2019
- <xsl:otherwise>
2020
- <fo:block xsl:use-attribute-sets="image-style">
2021
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2022
- <xsl:attribute name="width">100%</xsl:attribute>
2023
- <xsl:attribute name="content-height">100%</xsl:attribute>
2024
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2025
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2026
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2027
- <!-- effective height / width = 1.48, 1.4 - with title -->
2028
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2029
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2030
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2031
- </xsl:if>
2032
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2033
- <xsl:copy-of select="$svg_content"/>
2034
- </fo:instream-foreign-object>
2035
- </fo:block>
2036
- </xsl:otherwise>
2037
- </xsl:choose>
2038
- </xsl:template>
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
-
2062
- <xsl:template match="@*|node()" mode="svg_remove_a">
2063
- <xsl:copy>
2064
- <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2065
- </xsl:copy>
2066
- </xsl:template>
2067
-
2068
- <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2069
- <xsl:apply-templates mode="svg_remove_a"/>
2070
- </xsl:template>
2071
-
2072
- <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2073
- <xsl:param name="scale"/>
2074
- <xsl:variable name="dest">
2075
- <xsl:choose>
2076
- <xsl:when test="starts-with(@href, '#')">
2077
- <xsl:value-of select="substring-after(@href, '#')"/>
2078
- </xsl:when>
2079
- <xsl:otherwise>
2080
- <xsl:value-of select="@href"/>
2081
- </xsl:otherwise>
2082
- </xsl:choose>
2083
- </xsl:variable>
2084
- <xsl:for-each select="./*[local-name() = 'rect']">
2085
- <xsl:call-template name="insertSVGMapLink">
2086
- <xsl:with-param name="left" select="floor(@x * $scale)"/>
2087
- <xsl:with-param name="top" select="floor(@y * $scale)"/>
2088
- <xsl:with-param name="width" select="floor(@width * $scale)"/>
2089
- <xsl:with-param name="height" select="floor(@height * $scale)"/>
2090
- <xsl:with-param name="dest" select="$dest"/>
2091
- </xsl:call-template>
2092
- </xsl:for-each>
2093
-
2094
- <xsl:for-each select="./*[local-name() = 'polygon']">
2095
- <xsl:variable name="points">
2096
- <xsl:call-template name="split">
2097
- <xsl:with-param name="pText" select="@points"/>
2098
- </xsl:call-template>
2099
- </xsl:variable>
2100
- <xsl:variable name="x_coords">
2101
- <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2102
- <xsl:sort select="." data-type="number"/>
2103
- <x><xsl:value-of select="."/></x>
2104
- </xsl:for-each>
2105
- </xsl:variable>
2106
- <xsl:variable name="y_coords">
2107
- <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2108
- <xsl:sort select="." data-type="number"/>
2109
- <y><xsl:value-of select="."/></y>
2110
- </xsl:for-each>
2111
- </xsl:variable>
2112
- <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2113
- <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2114
- <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2115
- <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2116
- <xsl:call-template name="insertSVGMapLink">
2117
- <xsl:with-param name="left" select="floor($x * $scale)"/>
2118
- <xsl:with-param name="top" select="floor($y * $scale)"/>
2119
- <xsl:with-param name="width" select="floor($width * $scale)"/>
2120
- <xsl:with-param name="height" select="floor($height * $scale)"/>
2121
- <xsl:with-param name="dest" select="$dest"/>
2122
- </xsl:call-template>
2123
- </xsl:for-each>
2124
-
2125
- <xsl:for-each select="./*[local-name() = 'circle']">
2126
- <xsl:call-template name="insertSVGMapLink">
2127
- <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2128
- <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2129
- <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2130
- <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2131
- <xsl:with-param name="dest" select="$dest"/>
2132
- </xsl:call-template>
2133
- </xsl:for-each>
2134
- <xsl:for-each select="./*[local-name() = 'ellipse']">
2135
- <xsl:call-template name="insertSVGMapLink">
2136
- <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2137
- <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2138
- <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2139
- <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2140
- <xsl:with-param name="dest" select="$dest"/>
2141
- </xsl:call-template>
2142
- </xsl:for-each>
2143
- </xsl:template>
2144
-
2145
- <xsl:template name="insertSVGMapLink">
2146
- <xsl:param name="left"/>
2147
- <xsl:param name="top"/>
2148
- <xsl:param name="width"/>
2149
- <xsl:param name="height"/>
2150
- <xsl:param name="dest"/>
2151
- <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2152
- <fo:block font-size="1pt">
2153
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2154
- <fo:inline-container inline-progression-dimension="100%">
2155
- <fo:block-container height="{$height - 1}px" width="100%">
2156
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
2157
- <xsl:attribute name="background-color">magenta</xsl:attribute>
2158
- </xsl:if> -->
2159
- <fo:block> </fo:block></fo:block-container>
2160
- </fo:inline-container>
2161
- </fo:basic-link>
2162
- </fo:block>
2163
- </fo:block-container>
2164
- </xsl:template>
2165
-
2166
- <!-- =================== -->
2167
- <!-- End SVG images processing -->
2168
- <!-- =================== -->
2169
1911
 
2170
1912
  <!-- For express listings PDF attachments -->
2171
1913
  <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
@@ -2357,96 +2099,14 @@
2357
2099
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAFEAAABHCAIAAADwYjznAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAA66SURBVHhezZt5sM/VG8fNVH7JruxkSZKQ3TAYS7aGajKpFBnRxBjjkhrLrRgmYwm59hrGjC0miSmmIgoVZYu00GJtxkyMkV2/1+fzPh7nfr7fe33v/X6/9/d7/3HmOc/nLM/7PM95zjnfS6F//xc4f/786dOnXaXAUdCcjx071rt373vvvbdChQrNmzdfuXKl+1CAKFDOR44cqVWrVqFChf4T4vbbb7/zzjsnT57sPhcUCo7ztWvX2rRpc9tttxUtWvSuEAgwp/z0009dowJBwXGeM2dO4cKFRZWySJEikvF2o0aNrly54tqlHwXE+cyZM9WrV4czJMW5WLFixv+OO+6YPn26a5p+FBDnjIwM/Ak9AHMcm5mZyWY2TeXKlf/66y/XOs0oCM4HDhwoU6aMMSSqs7Kyfv75Z5jjYXmeff7yyy+7DmlGQXB+7LHHcLKFcdu2bXft2vXtt9/Onz9fS8AnVqRkyZLff/+965NOpJ3zhg0bIsQ4k7/55psvv/xy9+7dnTp1MlezLp07d3bd0on0cr569WqTJk18VlxI9uzZs3XrVjhv37597dq199xzD2vBV9aFo2vVqlWuc9qQXs6zZs2CcLCJ77oLPlWqVOEohqo4U8L/hRdesEVBeOihhy5evOj6pw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eBCsFk4MWubYJPnswvSFSFVBu3ryZJ5fj+e+//wVuVmgt0lkFPgAAAABJRU5ErkJggg==</xsl:text>
2358
2100
  </xsl:variable>
2359
2101
 
2360
- <xsl:template name="number-to-words">
2361
- <xsl:param name="number"/>
2362
- <xsl:variable name="words">
2363
- <words>
2364
- <word cardinal="1">One-</word>
2365
- <word ordinal="1">First </word>
2366
- <word cardinal="2">Two-</word>
2367
- <word ordinal="2">Second </word>
2368
- <word cardinal="3">Three-</word>
2369
- <word ordinal="3">Third </word>
2370
- <word cardinal="4">Four-</word>
2371
- <word ordinal="4">Fourth </word>
2372
- <word cardinal="5">Five-</word>
2373
- <word ordinal="5">Fifth </word>
2374
- <word cardinal="6">Six-</word>
2375
- <word ordinal="6">Sixth </word>
2376
- <word cardinal="7">Seven-</word>
2377
- <word ordinal="7">Seventh </word>
2378
- <word cardinal="8">Eight-</word>
2379
- <word ordinal="8">Eighth </word>
2380
- <word cardinal="9">Nine-</word>
2381
- <word ordinal="9">Ninth </word>
2382
- <word ordinal="10">Tenth </word>
2383
- <word ordinal="11">Eleventh </word>
2384
- <word ordinal="12">Twelfth </word>
2385
- <word ordinal="13">Thirteenth </word>
2386
- <word ordinal="14">Fourteenth </word>
2387
- <word ordinal="15">Fifteenth </word>
2388
- <word ordinal="16">Sixteenth </word>
2389
- <word ordinal="17">Seventeenth </word>
2390
- <word ordinal="18">Eighteenth </word>
2391
- <word ordinal="19">Nineteenth </word>
2392
- <word cardinal="20">Twenty-</word>
2393
- <word ordinal="20">Twentieth </word>
2394
- <word cardinal="30">Thirty-</word>
2395
- <word ordinal="30">Thirtieth </word>
2396
- <word cardinal="40">Forty-</word>
2397
- <word ordinal="40">Fortieth </word>
2398
- <word cardinal="50">Fifty-</word>
2399
- <word ordinal="50">Fiftieth </word>
2400
- <word cardinal="60">Sixty-</word>
2401
- <word ordinal="60">Sixtieth </word>
2402
- <word cardinal="70">Seventy-</word>
2403
- <word ordinal="70">Seventieth </word>
2404
- <word cardinal="80">Eighty-</word>
2405
- <word ordinal="80">Eightieth </word>
2406
- <word cardinal="90">Ninety-</word>
2407
- <word ordinal="90">Ninetieth </word>
2408
- <word cardinal="100">Hundred-</word>
2409
- <word ordinal="100">Hundredth </word>
2410
- </words>
2411
- </xsl:variable>
2412
-
2413
- <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
2414
-
2102
+ <xsl:template name="printEdition">
2103
+ <xsl:variable name="edition" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:edition)"/>
2104
+ <xsl:text> </xsl:text>
2415
2105
  <xsl:choose>
2416
- <xsl:when test="$ordinal != ''">
2417
- <xsl:value-of select="$ordinal"/>
2418
- </xsl:when>
2419
- <xsl:otherwise>
2420
- <xsl:choose>
2421
- <xsl:when test="$number &lt; 100">
2422
- <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
2423
- <xsl:variable name="digit" select="substring($number,2)"/>
2424
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
2425
- <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
2426
- </xsl:when>
2427
- <xsl:otherwise>
2428
- <!-- more 100 -->
2429
- <xsl:variable name="hundred" select="substring($number,1,1)"/>
2430
- <xsl:variable name="digits" select="number(substring($number,2))"/>
2431
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
2432
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
2433
- <xsl:call-template name="number-to-words">
2434
- <xsl:with-param name="number" select="$digits"/>
2435
- </xsl:call-template>
2436
- </xsl:otherwise>
2437
- </xsl:choose>
2438
- </xsl:otherwise>
2439
- </xsl:choose>
2440
- </xsl:template>
2441
-
2442
- <xsl:template name="printEdition">
2443
- <xsl:variable name="edition" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:edition)"/>
2444
- <xsl:text> </xsl:text>
2445
- <xsl:choose>
2446
- <xsl:when test="number($edition) = $edition">
2447
- <xsl:call-template name="number-to-words">
2448
- <xsl:with-param name="number" select="$edition"/>
2449
- </xsl:call-template>
2106
+ <xsl:when test="number($edition) = $edition">
2107
+ <xsl:call-template name="number-to-words">
2108
+ <xsl:with-param name="number" select="$edition"/>
2109
+ </xsl:call-template>
2450
2110
  </xsl:when>
2451
2111
  <xsl:when test="$edition != ''">
2452
2112
  <xsl:value-of select="$edition"/>
@@ -2662,6 +2322,7 @@
2662
2322
 
2663
2323
 
2664
2324
 
2325
+
2665
2326
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2666
2327
  <xsl:attribute name="white-space">pre</xsl:attribute>
2667
2328
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2711,7 +2372,7 @@
2711
2372
 
2712
2373
 
2713
2374
 
2714
-
2375
+
2715
2376
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2716
2377
 
2717
2378
 
@@ -2728,6 +2389,7 @@
2728
2389
 
2729
2390
 
2730
2391
 
2392
+
2731
2393
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2732
2394
 
2733
2395
 
@@ -2747,9 +2409,7 @@
2747
2409
 
2748
2410
 
2749
2411
 
2750
-
2751
-
2752
-
2412
+
2753
2413
 
2754
2414
 
2755
2415
 
@@ -2782,6 +2442,7 @@
2782
2442
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2783
2443
 
2784
2444
 
2445
+
2785
2446
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2786
2447
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2787
2448
 
@@ -2803,6 +2464,9 @@
2803
2464
 
2804
2465
 
2805
2466
 
2467
+
2468
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2469
+
2806
2470
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2807
2471
 
2808
2472
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2828,11 +2492,14 @@
2828
2492
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2829
2493
 
2830
2494
 
2495
+
2831
2496
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2832
2497
 
2833
2498
 
2834
2499
 
2835
2500
 
2501
+
2502
+
2836
2503
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2837
2504
 
2838
2505
 
@@ -2854,6 +2521,7 @@
2854
2521
 
2855
2522
 
2856
2523
 
2524
+
2857
2525
  </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">
2858
2526
 
2859
2527
 
@@ -2899,10 +2567,12 @@
2899
2567
 
2900
2568
 
2901
2569
 
2570
+
2902
2571
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2903
2572
 
2904
2573
 
2905
2574
 
2575
+
2906
2576
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2907
2577
 
2908
2578
 
@@ -2930,10 +2600,12 @@
2930
2600
 
2931
2601
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2932
2602
 
2603
+
2933
2604
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2934
2605
 
2935
2606
 
2936
2607
 
2608
+
2937
2609
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2938
2610
 
2939
2611
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -2960,6 +2632,7 @@
2960
2632
 
2961
2633
 
2962
2634
 
2635
+
2963
2636
 
2964
2637
 
2965
2638
 
@@ -3005,8 +2678,10 @@
3005
2678
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
3006
2679
 
3007
2680
 
2681
+
3008
2682
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
3009
2683
 
2684
+
3010
2685
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
3011
2686
 
3012
2687
 
@@ -3033,6 +2708,8 @@
3033
2708
  <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
3034
2709
 
3035
2710
 
2711
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
2712
+
3036
2713
  </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">
3037
2714
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3038
2715
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -3043,14 +2720,15 @@
3043
2720
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
3044
2721
 
3045
2722
  <!-- Normative references -->
3046
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
2723
+ <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"/>
3047
2724
  <!-- Terms and definitions -->
3048
2725
  <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"/>
3049
2726
  <!-- Another main sections -->
3050
2727
  <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"/>
3051
2728
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
3052
2729
  <!-- Bibliography -->
3053
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
2730
+ <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"/>
2731
+
3054
2732
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3055
2733
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
3056
2734
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -3086,11 +2764,11 @@
3086
2764
  <xsl:variable name="table">
3087
2765
 
3088
2766
  <xsl:variable name="simple-table">
3089
- <xsl:call-template name="getSimpleTable"/>
2767
+ <xsl:call-template name="getSimpleTable"/>
3090
2768
  </xsl:variable>
3091
2769
 
3092
2770
  <!-- <xsl:if test="$namespace = 'bipm'">
3093
- <fo:block>&#xA0;</fo:block>
2771
+ <fo:block>&#xA0;</fo:block>
3094
2772
  </xsl:if> -->
3095
2773
 
3096
2774
  <!-- $namespace = 'iso' or -->
@@ -3208,6 +2886,7 @@
3208
2886
 
3209
2887
 
3210
2888
 
2889
+
3211
2890
  </xsl:variable>
3212
2891
 
3213
2892
 
@@ -3351,6 +3030,9 @@
3351
3030
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3352
3031
 
3353
3032
 
3033
+
3034
+
3035
+
3354
3036
  <xsl:choose>
3355
3037
  <xsl:when test="$continued = 'true'">
3356
3038
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -3504,6 +3186,7 @@
3504
3186
  <xsl:with-param name="cols-count" select="$cols-count"/>
3505
3187
  </xsl:call-template>
3506
3188
 
3189
+
3507
3190
  <xsl:apply-templates/>
3508
3191
  </fo:table-header>
3509
3192
  </xsl:template><xsl:template name="table-header-title">
@@ -3659,6 +3342,7 @@
3659
3342
  <fo:table-row>
3660
3343
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3661
3344
 
3345
+
3662
3346
  <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
3663
3347
 
3664
3348
 
@@ -3671,6 +3355,10 @@
3671
3355
 
3672
3356
 
3673
3357
 
3358
+
3359
+ <!-- for BSI (not PAS) display Notes before footnotes -->
3360
+
3361
+
3674
3362
  <!-- except gb -->
3675
3363
 
3676
3364
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -3696,6 +3384,10 @@
3696
3384
  <!-- fn processing -->
3697
3385
  <xsl:call-template name="fn_display"/>
3698
3386
 
3387
+
3388
+ <!-- for PAS display Notes after footnotes -->
3389
+
3390
+
3699
3391
  </fo:table-cell>
3700
3392
  </fo:table-row>
3701
3393
  </fo:table-body>
@@ -3762,8 +3454,8 @@
3762
3454
  <fo:table-cell>
3763
3455
 
3764
3456
  <fo:marker marker-class-name="table_continued">
3765
- <xsl:value-of select="$title_continued"/>
3766
- </fo:marker>
3457
+ <xsl:value-of select="$title_continued"/>
3458
+ </fo:marker>
3767
3459
  <fo:block/>
3768
3460
  </fo:table-cell>
3769
3461
  </fo:table-row>
@@ -3804,6 +3496,7 @@
3804
3496
  </xsl:if>
3805
3497
  <xsl:if test="$parent-name = 'tfoot'">
3806
3498
 
3499
+
3807
3500
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3808
3501
  <xsl:attribute name="border-left">solid black 1pt</xsl:attribute>
3809
3502
  <xsl:attribute name="border-right">solid black 1pt</xsl:attribute>
@@ -3814,6 +3507,10 @@
3814
3507
 
3815
3508
 
3816
3509
 
3510
+
3511
+
3512
+
3513
+
3817
3514
  <!-- <xsl:if test="$namespace = 'bipm'">
3818
3515
  <xsl:attribute name="height">8mm</xsl:attribute>
3819
3516
  </xsl:if> -->
@@ -3845,6 +3542,7 @@
3845
3542
 
3846
3543
 
3847
3544
 
3545
+
3848
3546
  <xsl:if test="$lang = 'ar'">
3849
3547
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3850
3548
  </xsl:if>
@@ -3894,6 +3592,7 @@
3894
3592
 
3895
3593
 
3896
3594
 
3595
+
3897
3596
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3898
3597
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3899
3598
  </xsl:if>
@@ -3906,6 +3605,9 @@
3906
3605
 
3907
3606
 
3908
3607
 
3608
+
3609
+
3610
+
3909
3611
  <xsl:if test=".//*[local-name() = 'table']">
3910
3612
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3911
3613
  </xsl:if>
@@ -3930,6 +3632,7 @@
3930
3632
 
3931
3633
  <fo:block font-size="10pt" margin-bottom="12pt">
3932
3634
 
3635
+
3933
3636
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3934
3637
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3935
3638
 
@@ -3938,8 +3641,13 @@
3938
3641
 
3939
3642
 
3940
3643
 
3644
+
3645
+ <!-- Table's note name (NOTE, for example) -->
3646
+
3941
3647
  <fo:inline padding-right="2mm">
3942
3648
 
3649
+
3650
+
3943
3651
 
3944
3652
 
3945
3653
 
@@ -3947,6 +3655,8 @@
3947
3655
 
3948
3656
  </fo:inline>
3949
3657
 
3658
+
3659
+
3950
3660
  <xsl:apply-templates mode="process"/>
3951
3661
  </fo:block>
3952
3662
 
@@ -3966,6 +3676,8 @@
3966
3676
  <xsl:variable name="reference" select="@reference"/>
3967
3677
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3968
3678
  <fo:block margin-bottom="12pt">
3679
+
3680
+
3969
3681
 
3970
3682
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3971
3683
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -3984,9 +3696,11 @@
3984
3696
 
3985
3697
 
3986
3698
 
3699
+
3987
3700
  <xsl:value-of select="@reference"/>
3988
3701
 
3989
3702
 
3703
+
3990
3704
  </fo:inline>
3991
3705
  <fo:inline>
3992
3706
 
@@ -4122,6 +3836,8 @@
4122
3836
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
4123
3837
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
4124
3838
 
3839
+
3840
+
4125
3841
  <xsl:if test="ancestor::*[local-name()='td']">
4126
3842
  <xsl:attribute name="font-weight">normal</xsl:attribute>
4127
3843
  <!-- <xsl:attribute name="alignment-baseline">hanging</xsl:attribute> -->
@@ -4133,11 +3849,14 @@
4133
3849
 
4134
3850
 
4135
3851
 
3852
+
3853
+
4136
3854
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4137
3855
 
4138
3856
 
4139
3857
  <xsl:value-of select="@reference"/>
4140
3858
 
3859
+
4141
3860
  </fo:basic-link>
4142
3861
  </fo:inline>
4143
3862
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -4233,6 +3952,7 @@
4233
3952
 
4234
3953
 
4235
3954
 
3955
+
4236
3956
  <xsl:variable name="title-key">
4237
3957
 
4238
3958
  <xsl:call-template name="getLocalizedString">
@@ -4448,6 +4168,7 @@
4448
4168
 
4449
4169
  <fo:table-row>
4450
4170
 
4171
+
4451
4172
  <fo:table-cell>
4452
4173
 
4453
4174
  <fo:block margin-top="6pt">
@@ -4465,6 +4186,7 @@
4465
4186
 
4466
4187
 
4467
4188
 
4189
+
4468
4190
  <xsl:apply-templates/>
4469
4191
  <!-- <xsl:if test="$namespace = 'gb'">
4470
4192
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -4521,6 +4243,8 @@
4521
4243
 
4522
4244
  <xsl:apply-templates/>
4523
4245
  </fo:inline>
4246
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4247
+ <fo:inline padding-right="{@value}"> </fo:inline>
4524
4248
  </xsl:template><xsl:template match="*[local-name()='sup']">
4525
4249
  <fo:inline font-size="80%" vertical-align="super">
4526
4250
  <xsl:apply-templates/>
@@ -5017,9 +4741,27 @@
5017
4741
  <xsl:copy>
5018
4742
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
5019
4743
  </xsl:copy>
5020
- <mathml:mspace width="0.5ex"/>
4744
+ <xsl:choose>
4745
+ <!-- if in msub, then don't add space -->
4746
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
4747
+ <!-- if next char in digit, don't add space -->
4748
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
4749
+ <xsl:otherwise>
4750
+ <mathml:mspace width="0.5ex"/>
4751
+ </xsl:otherwise>
4752
+ </xsl:choose>
5021
4753
  </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">
5022
4754
  <xsl:variable name="target">
4755
+ <xsl:choose>
4756
+ <xsl:when test="@updatetype = 'true'">
4757
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
4758
+ </xsl:when>
4759
+ <xsl:otherwise>
4760
+ <xsl:value-of select="normalize-space(@target)"/>
4761
+ </xsl:otherwise>
4762
+ </xsl:choose>
4763
+ </xsl:variable>
4764
+ <xsl:variable name="target_text">
5023
4765
  <xsl:choose>
5024
4766
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5025
4767
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -5031,20 +4773,22 @@
5031
4773
  </xsl:variable>
5032
4774
  <fo:inline xsl:use-attribute-sets="link-style">
5033
4775
 
4776
+
4777
+
5034
4778
  <xsl:choose>
5035
- <xsl:when test="$target = ''">
4779
+ <xsl:when test="$target_text = ''">
5036
4780
  <xsl:apply-templates/>
5037
4781
  </xsl:when>
5038
4782
  <xsl:otherwise>
5039
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4783
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5040
4784
  <xsl:choose>
5041
4785
  <xsl:when test="normalize-space(.) = ''">
5042
- <!-- <xsl:value-of select="$target"/> -->
5043
4786
  <xsl:call-template name="add-zero-spaces-link-java">
5044
- <xsl:with-param name="text" select="$target"/>
4787
+ <xsl:with-param name="text" select="$target_text"/>
5045
4788
  </xsl:call-template>
5046
4789
  </xsl:when>
5047
4790
  <xsl:otherwise>
4791
+ <!-- output text from <link>text</link> -->
5048
4792
  <xsl:apply-templates/>
5049
4793
  </xsl:otherwise>
5050
4794
  </xsl:choose>
@@ -5139,6 +4883,7 @@
5139
4883
 
5140
4884
 
5141
4885
 
4886
+
5142
4887
  <fo:block-container margin-left="0mm">
5143
4888
 
5144
4889
 
@@ -5182,6 +4927,7 @@
5182
4927
  </xsl:choose>
5183
4928
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
5184
4929
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4930
+
5185
4931
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5186
4932
 
5187
4933
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -5257,6 +5003,7 @@
5257
5003
  </xsl:call-template>
5258
5004
 
5259
5005
  <fo:block>
5006
+
5260
5007
  <xsl:apply-templates/>
5261
5008
  </fo:block>
5262
5009
  <xsl:call-template name="fn_display_figure"/>
@@ -5379,6 +5126,234 @@
5379
5126
  <xsl:param name="height"/>
5380
5127
  <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; "/>
5381
5128
  <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; "/>
5129
+ </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">
5130
+ <xsl:param name="name"/>
5131
+
5132
+ <xsl:variable name="svg_content">
5133
+ <xsl:apply-templates select="." mode="svg_update"/>
5134
+ </xsl:variable>
5135
+
5136
+ <xsl:variable name="alt-text">
5137
+ <xsl:choose>
5138
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
5139
+ <xsl:value-of select="../*[local-name() = 'name']"/>
5140
+ </xsl:when>
5141
+ <xsl:when test="normalize-space($name) != ''">
5142
+ <xsl:value-of select="$name"/>
5143
+ </xsl:when>
5144
+ <xsl:otherwise>Figure</xsl:otherwise>
5145
+ </xsl:choose>
5146
+ </xsl:variable>
5147
+
5148
+ <xsl:choose>
5149
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
5150
+ <fo:block>
5151
+ <xsl:variable name="width" select="@width"/>
5152
+ <xsl:variable name="height" select="@height"/>
5153
+
5154
+ <xsl:variable name="scale_x">
5155
+ <xsl:choose>
5156
+ <xsl:when test="$width &gt; $width_effective_px">
5157
+ <xsl:value-of select="$width_effective_px div $width"/>
5158
+ </xsl:when>
5159
+ <xsl:otherwise>1</xsl:otherwise>
5160
+ </xsl:choose>
5161
+ </xsl:variable>
5162
+
5163
+ <xsl:variable name="scale_y">
5164
+ <xsl:choose>
5165
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
5166
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
5167
+ </xsl:when>
5168
+ <xsl:otherwise>1</xsl:otherwise>
5169
+ </xsl:choose>
5170
+ </xsl:variable>
5171
+
5172
+ <xsl:variable name="scale">
5173
+ <xsl:choose>
5174
+ <xsl:when test="$scale_y != 1">
5175
+ <xsl:value-of select="$scale_x * $scale_y"/>
5176
+ </xsl:when>
5177
+ <xsl:otherwise>
5178
+ <xsl:value-of select="$scale_x"/>
5179
+ </xsl:otherwise>
5180
+ </xsl:choose>
5181
+ </xsl:variable>
5182
+
5183
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
5184
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
5185
+
5186
+ <fo:table table-layout="fixed" width="100%">
5187
+ <fo:table-column column-width="proportional-column-width(1)"/>
5188
+ <fo:table-column column-width="{$width_scale}px"/>
5189
+ <fo:table-column column-width="proportional-column-width(1)"/>
5190
+ <fo:table-body>
5191
+ <fo:table-row>
5192
+ <fo:table-cell column-number="2">
5193
+ <fo:block>
5194
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
5195
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5196
+ <fo:block line-height="0" font-size="0">
5197
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5198
+ <xsl:call-template name="bookmark"/>
5199
+ </xsl:for-each>
5200
+ </fo:block>
5201
+ </xsl:if>
5202
+ <fo:block text-depth="0" line-height="0" font-size="0">
5203
+
5204
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5205
+ <xsl:attribute name="width">100%</xsl:attribute>
5206
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5207
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5208
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5209
+
5210
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
5211
+ </fo:instream-foreign-object>
5212
+ </fo:block>
5213
+
5214
+ <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">
5215
+ <xsl:with-param name="scale" select="$scale"/>
5216
+ </xsl:apply-templates>
5217
+ </fo:block-container>
5218
+ </fo:block>
5219
+ </fo:table-cell>
5220
+ </fo:table-row>
5221
+ </fo:table-body>
5222
+ </fo:table>
5223
+ </fo:block>
5224
+
5225
+ </xsl:when>
5226
+ <xsl:otherwise>
5227
+ <fo:block xsl:use-attribute-sets="image-style">
5228
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5229
+ <xsl:attribute name="width">100%</xsl:attribute>
5230
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5231
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5232
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5233
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5234
+ <!-- effective height / width = 1.48, 1.4 - with title -->
5235
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
5236
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
5237
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5238
+ </xsl:if>
5239
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5240
+ <xsl:copy-of select="$svg_content"/>
5241
+ </fo:instream-foreign-object>
5242
+ </fo:block>
5243
+ </xsl:otherwise>
5244
+ </xsl:choose>
5245
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
5246
+ <xsl:copy>
5247
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
5248
+ </xsl:copy>
5249
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
5250
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
5251
+ <xsl:value-of select="."/>
5252
+ </xsl:attribute>
5253
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5254
+ <xsl:variable name="svg_content" select="document(@src)"/>
5255
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
5256
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
5257
+ <xsl:call-template name="image_svg">
5258
+ <xsl:with-param name="name" select="$name"/>
5259
+ </xsl:call-template>
5260
+ </xsl:for-each>
5261
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
5262
+ <xsl:copy>
5263
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
5264
+ </xsl:copy>
5265
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
5266
+ <xsl:apply-templates mode="svg_remove_a"/>
5267
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
5268
+ <xsl:param name="scale"/>
5269
+ <xsl:variable name="dest">
5270
+ <xsl:choose>
5271
+ <xsl:when test="starts-with(@href, '#')">
5272
+ <xsl:value-of select="substring-after(@href, '#')"/>
5273
+ </xsl:when>
5274
+ <xsl:otherwise>
5275
+ <xsl:value-of select="@href"/>
5276
+ </xsl:otherwise>
5277
+ </xsl:choose>
5278
+ </xsl:variable>
5279
+ <xsl:for-each select="./*[local-name() = 'rect']">
5280
+ <xsl:call-template name="insertSVGMapLink">
5281
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
5282
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
5283
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
5284
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
5285
+ <xsl:with-param name="dest" select="$dest"/>
5286
+ </xsl:call-template>
5287
+ </xsl:for-each>
5288
+
5289
+ <xsl:for-each select="./*[local-name() = 'polygon']">
5290
+ <xsl:variable name="points">
5291
+ <xsl:call-template name="split">
5292
+ <xsl:with-param name="pText" select="@points"/>
5293
+ </xsl:call-template>
5294
+ </xsl:variable>
5295
+ <xsl:variable name="x_coords">
5296
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
5297
+ <xsl:sort select="." data-type="number"/>
5298
+ <x><xsl:value-of select="."/></x>
5299
+ </xsl:for-each>
5300
+ </xsl:variable>
5301
+ <xsl:variable name="y_coords">
5302
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
5303
+ <xsl:sort select="." data-type="number"/>
5304
+ <y><xsl:value-of select="."/></y>
5305
+ </xsl:for-each>
5306
+ </xsl:variable>
5307
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
5308
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
5309
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
5310
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
5311
+ <xsl:call-template name="insertSVGMapLink">
5312
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
5313
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
5314
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
5315
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
5316
+ <xsl:with-param name="dest" select="$dest"/>
5317
+ </xsl:call-template>
5318
+ </xsl:for-each>
5319
+
5320
+ <xsl:for-each select="./*[local-name() = 'circle']">
5321
+ <xsl:call-template name="insertSVGMapLink">
5322
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
5323
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
5324
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
5325
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
5326
+ <xsl:with-param name="dest" select="$dest"/>
5327
+ </xsl:call-template>
5328
+ </xsl:for-each>
5329
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
5330
+ <xsl:call-template name="insertSVGMapLink">
5331
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
5332
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
5333
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
5334
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
5335
+ <xsl:with-param name="dest" select="$dest"/>
5336
+ </xsl:call-template>
5337
+ </xsl:for-each>
5338
+ </xsl:template><xsl:template name="insertSVGMapLink">
5339
+ <xsl:param name="left"/>
5340
+ <xsl:param name="top"/>
5341
+ <xsl:param name="width"/>
5342
+ <xsl:param name="height"/>
5343
+ <xsl:param name="dest"/>
5344
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
5345
+ <fo:block font-size="1pt">
5346
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
5347
+ <fo:inline-container inline-progression-dimension="100%">
5348
+ <fo:block-container height="{$height - 1}px" width="100%">
5349
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
5350
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
5351
+ </xsl:if> -->
5352
+ <fo:block> </fo:block></fo:block-container>
5353
+ </fo:inline-container>
5354
+ </fo:basic-link>
5355
+ </fo:block>
5356
+ </fo:block-container>
5382
5357
  </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">
5383
5358
  <xsl:apply-templates mode="contents"/>
5384
5359
  <xsl:text> </xsl:text>
@@ -5407,28 +5382,39 @@
5407
5382
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5408
5383
  <xsl:for-each select="xalan:nodeset($contents)/doc">
5409
5384
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5385
+ <xsl:if test="@bundle = 'true'">
5386
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
5387
+ </xsl:if>
5410
5388
  <fo:bookmark-title>
5411
- <xsl:variable name="bookmark-title_">
5412
- <xsl:call-template name="getLangVersion">
5413
- <xsl:with-param name="lang" select="@lang"/>
5414
- <xsl:with-param name="doctype" select="@doctype"/>
5415
- <xsl:with-param name="title" select="@title-part"/>
5416
- </xsl:call-template>
5417
- </xsl:variable>
5418
5389
  <xsl:choose>
5419
- <xsl:when test="normalize-space($bookmark-title_) != ''">
5420
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
5421
- </xsl:when>
5422
- <xsl:otherwise>
5390
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
5391
+ <xsl:variable name="bookmark-title_">
5392
+ <xsl:call-template name="getLangVersion">
5393
+ <xsl:with-param name="lang" select="@lang"/>
5394
+ <xsl:with-param name="doctype" select="@doctype"/>
5395
+ <xsl:with-param name="title" select="@title-part"/>
5396
+ </xsl:call-template>
5397
+ </xsl:variable>
5423
5398
  <xsl:choose>
5424
- <xsl:when test="@lang = 'en'">English</xsl:when>
5425
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
5426
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5427
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5399
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
5400
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
5401
+ </xsl:when>
5402
+ <xsl:otherwise>
5403
+ <xsl:choose>
5404
+ <xsl:when test="@lang = 'en'">English</xsl:when>
5405
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
5406
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5407
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5408
+ </xsl:choose>
5409
+ </xsl:otherwise>
5428
5410
  </xsl:choose>
5411
+ </xsl:when>
5412
+ <xsl:otherwise>
5413
+ <xsl:value-of select="@title-part"/>
5429
5414
  </xsl:otherwise>
5430
5415
  </xsl:choose>
5431
5416
  </fo:bookmark-title>
5417
+
5432
5418
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5433
5419
 
5434
5420
  <xsl:call-template name="insertFigureBookmarks">
@@ -5527,20 +5513,28 @@
5527
5513
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
5528
5514
  </xsl:choose>
5529
5515
  </xsl:template><xsl:template match="item" mode="bookmark">
5530
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
5531
- <fo:bookmark-title>
5532
- <xsl:if test="@section != ''">
5533
- <xsl:value-of select="@section"/>
5534
- <xsl:text> </xsl:text>
5535
- </xsl:if>
5536
- <xsl:value-of select="normalize-space(title)"/>
5537
- </fo:bookmark-title>
5538
- <xsl:apply-templates mode="bookmark"/>
5539
- </fo:bookmark>
5516
+ <xsl:choose>
5517
+ <xsl:when test="@id != ''">
5518
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
5519
+ <fo:bookmark-title>
5520
+ <xsl:if test="@section != ''">
5521
+ <xsl:value-of select="@section"/>
5522
+ <xsl:text> </xsl:text>
5523
+ </xsl:if>
5524
+ <xsl:value-of select="normalize-space(title)"/>
5525
+ </fo:bookmark-title>
5526
+ <xsl:apply-templates mode="bookmark"/>
5527
+ </fo:bookmark>
5528
+ </xsl:when>
5529
+ <xsl:otherwise>
5530
+ <xsl:apply-templates mode="bookmark"/>
5531
+ </xsl:otherwise>
5532
+ </xsl:choose>
5540
5533
  </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">
5541
5534
  <xsl:if test="normalize-space() != ''">
5542
5535
  <fo:block xsl:use-attribute-sets="figure-name-style">
5543
5536
 
5537
+
5544
5538
  <xsl:apply-templates/>
5545
5539
  </fo:block>
5546
5540
  </xsl:if>
@@ -5620,6 +5614,8 @@
5620
5614
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5621
5615
 
5622
5616
  <fo:block-container margin-left="0mm">
5617
+ <xsl:copy-of select="@id"/>
5618
+
5623
5619
  <xsl:if test="parent::*[local-name() = 'note']">
5624
5620
  <xsl:attribute name="margin-left">
5625
5621
  <xsl:choose>
@@ -5630,7 +5626,9 @@
5630
5626
 
5631
5627
  </xsl:if>
5632
5628
  <fo:block-container margin-left="0mm">
5633
-
5629
+
5630
+
5631
+
5634
5632
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5635
5633
  <xsl:variable name="_font-size">
5636
5634
 
@@ -5659,10 +5657,14 @@
5659
5657
  </xsl:choose>
5660
5658
  </xsl:attribute>
5661
5659
  </xsl:if>
5662
- <xsl:apply-templates/>
5663
- </fo:block>
5660
+
5661
+ <xsl:apply-templates/>
5662
+ </fo:block>
5663
+
5664
+
5664
5665
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5665
5666
 
5667
+
5666
5668
  </fo:block-container>
5667
5669
  </fo:block-container>
5668
5670
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5897,6 +5899,7 @@
5897
5899
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5898
5900
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5899
5901
 
5902
+
5900
5903
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5901
5904
 
5902
5905
  <xsl:variable name="element">
@@ -6010,14 +6013,14 @@
6010
6013
  <fo:inline>
6011
6014
 
6012
6015
 
6013
- <!-- <xsl:call-template name="getLocalizedString">
6014
- <xsl:with-param name="key">source</xsl:with-param>
6015
- </xsl:call-template> -->
6016
+
6017
+
6016
6018
  <xsl:value-of select="$localized.source"/>
6019
+ <xsl:text>: </xsl:text>
6020
+
6017
6021
 
6018
6022
 
6019
6023
 
6020
- <xsl:text>: </xsl:text>
6021
6024
  </fo:inline>
6022
6025
 
6023
6026
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -6088,7 +6091,9 @@
6088
6091
 
6089
6092
 
6090
6093
  </xsl:if>
6091
-
6094
+
6095
+
6096
+
6092
6097
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6093
6098
  <xsl:if test="normalize-space(@citeas) = ''">
6094
6099
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -6097,6 +6102,7 @@
6097
6102
 
6098
6103
 
6099
6104
 
6105
+
6100
6106
  </xsl:if>
6101
6107
 
6102
6108
  <xsl:apply-templates/>
@@ -6123,6 +6129,7 @@
6123
6129
 
6124
6130
 
6125
6131
 
6132
+
6126
6133
  <xsl:choose>
6127
6134
  <xsl:when test="$depth = 2">3</xsl:when>
6128
6135
  <xsl:otherwise>4</xsl:otherwise>
@@ -6241,6 +6248,7 @@
6241
6248
  <xsl:call-template name="setId"/>
6242
6249
 
6243
6250
 
6251
+
6244
6252
  <xsl:apply-templates/>
6245
6253
  </fo:block>
6246
6254
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -6513,17 +6521,17 @@
6513
6521
  <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')]"/>
6514
6522
  <xsl:choose>
6515
6523
  <xsl:when test="normalize-space($_doc_ident) != ''">
6516
- <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"/>
6524
+ <!-- <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"/>
6517
6525
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
6518
6526
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6519
- </xsl:if>
6527
+ </xsl:if> -->
6520
6528
  <xsl:value-of select="$_doc_ident"/>
6521
6529
  </xsl:when>
6522
6530
  <xsl:otherwise>
6523
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6531
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6524
6532
  <xsl:if test="$type != ''">
6525
6533
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6526
- </xsl:if>
6534
+ </xsl:if> -->
6527
6535
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6528
6536
  </xsl:otherwise>
6529
6537
  </xsl:choose>
@@ -6836,6 +6844,9 @@
6836
6844
  <xsl:when test="parent::*[local-name() = 'preface']">
6837
6845
  <xsl:value-of select="$level_total - 1"/>
6838
6846
  </xsl:when>
6847
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
6848
+ <xsl:value-of select="$level_total - 1"/>
6849
+ </xsl:when>
6839
6850
  <xsl:when test="ancestor::*[local-name() = 'preface']">
6840
6851
  <xsl:value-of select="$level_total - 2"/>
6841
6852
  </xsl:when>
@@ -6976,7 +6987,14 @@
6976
6987
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6977
6988
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6978
6989
  </xsl:when>
6979
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6990
+ <xsl:otherwise>
6991
+ <xsl:variable name="key_">
6992
+ <xsl:call-template name="capitalize">
6993
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
6994
+ </xsl:call-template>
6995
+ </xsl:variable>
6996
+ <xsl:value-of select="$key_"/>
6997
+ </xsl:otherwise>
6980
6998
  </xsl:choose>
6981
6999
 
6982
7000
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -7019,4 +7037,110 @@
7019
7037
  <xsl:value-of select="$align"/>
7020
7038
  </xsl:when>
7021
7039
  </xsl:choose>
7040
+ </xsl:template><xsl:template name="setTextAlignment">
7041
+ <xsl:param name="default">left</xsl:param>
7042
+ <xsl:attribute name="text-align">
7043
+ <xsl:choose>
7044
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7045
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7046
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7047
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7048
+ </xsl:choose>
7049
+ </xsl:attribute>
7050
+ </xsl:template><xsl:template name="number-to-words">
7051
+ <xsl:param name="number"/>
7052
+ <xsl:param name="first"/>
7053
+ <xsl:if test="$number != ''">
7054
+ <xsl:variable name="words">
7055
+ <words>
7056
+ <word cardinal="1">One-</word>
7057
+ <word ordinal="1">First </word>
7058
+ <word cardinal="2">Two-</word>
7059
+ <word ordinal="2">Second </word>
7060
+ <word cardinal="3">Three-</word>
7061
+ <word ordinal="3">Third </word>
7062
+ <word cardinal="4">Four-</word>
7063
+ <word ordinal="4">Fourth </word>
7064
+ <word cardinal="5">Five-</word>
7065
+ <word ordinal="5">Fifth </word>
7066
+ <word cardinal="6">Six-</word>
7067
+ <word ordinal="6">Sixth </word>
7068
+ <word cardinal="7">Seven-</word>
7069
+ <word ordinal="7">Seventh </word>
7070
+ <word cardinal="8">Eight-</word>
7071
+ <word ordinal="8">Eighth </word>
7072
+ <word cardinal="9">Nine-</word>
7073
+ <word ordinal="9">Ninth </word>
7074
+ <word ordinal="10">Tenth </word>
7075
+ <word ordinal="11">Eleventh </word>
7076
+ <word ordinal="12">Twelfth </word>
7077
+ <word ordinal="13">Thirteenth </word>
7078
+ <word ordinal="14">Fourteenth </word>
7079
+ <word ordinal="15">Fifteenth </word>
7080
+ <word ordinal="16">Sixteenth </word>
7081
+ <word ordinal="17">Seventeenth </word>
7082
+ <word ordinal="18">Eighteenth </word>
7083
+ <word ordinal="19">Nineteenth </word>
7084
+ <word cardinal="20">Twenty-</word>
7085
+ <word ordinal="20">Twentieth </word>
7086
+ <word cardinal="30">Thirty-</word>
7087
+ <word ordinal="30">Thirtieth </word>
7088
+ <word cardinal="40">Forty-</word>
7089
+ <word ordinal="40">Fortieth </word>
7090
+ <word cardinal="50">Fifty-</word>
7091
+ <word ordinal="50">Fiftieth </word>
7092
+ <word cardinal="60">Sixty-</word>
7093
+ <word ordinal="60">Sixtieth </word>
7094
+ <word cardinal="70">Seventy-</word>
7095
+ <word ordinal="70">Seventieth </word>
7096
+ <word cardinal="80">Eighty-</word>
7097
+ <word ordinal="80">Eightieth </word>
7098
+ <word cardinal="90">Ninety-</word>
7099
+ <word ordinal="90">Ninetieth </word>
7100
+ <word cardinal="100">Hundred-</word>
7101
+ <word ordinal="100">Hundredth </word>
7102
+ </words>
7103
+ </xsl:variable>
7104
+
7105
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
7106
+
7107
+ <xsl:variable name="value">
7108
+ <xsl:choose>
7109
+ <xsl:when test="$ordinal != ''">
7110
+ <xsl:value-of select="$ordinal"/>
7111
+ </xsl:when>
7112
+ <xsl:otherwise>
7113
+ <xsl:choose>
7114
+ <xsl:when test="$number &lt; 100">
7115
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
7116
+ <xsl:variable name="digit" select="substring($number,2)"/>
7117
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
7118
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
7119
+ </xsl:when>
7120
+ <xsl:otherwise>
7121
+ <!-- more 100 -->
7122
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
7123
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
7124
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
7125
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
7126
+ <xsl:call-template name="number-to-words">
7127
+ <xsl:with-param name="number" select="$digits"/>
7128
+ </xsl:call-template>
7129
+ </xsl:otherwise>
7130
+ </xsl:choose>
7131
+ </xsl:otherwise>
7132
+ </xsl:choose>
7133
+ </xsl:variable>
7134
+ <xsl:choose>
7135
+ <xsl:when test="$first = 'true'">
7136
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
7137
+ <xsl:call-template name="capitalize">
7138
+ <xsl:with-param name="str" select="$value_lc"/>
7139
+ </xsl:call-template>
7140
+ </xsl:when>
7141
+ <xsl:otherwise>
7142
+ <xsl:value-of select="$value"/>
7143
+ </xsl:otherwise>
7144
+ </xsl:choose>
7145
+ </xsl:if>
7022
7146
  </xsl:template></xsl:stylesheet>