metanorma-iso 1.8.5 → 1.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/lib/asciidoctor/iso/isodoc.rng +18 -1
- data/lib/isodoc/iso/iso.amendment.xsl +283 -285
- data/lib/isodoc/iso/iso.international-standard.xsl +283 -285
- data/lib/isodoc/iso/presentation_xml_convert.rb +18 -9
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +2 -2
- data/spec/isodoc/inline_spec.rb +280 -0
- data/spec/isodoc/section_spec.rb +1 -1
- metadata +6 -6
@@ -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 > $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 > $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 > (@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">
|
@@ -2839,6 +2581,7 @@
|
|
2839
2581
|
|
2840
2582
|
|
2841
2583
|
|
2584
|
+
|
2842
2585
|
</xsl:attribute-set><xsl:attribute-set name="note-style">
|
2843
2586
|
|
2844
2587
|
|
@@ -3059,14 +2802,15 @@
|
|
3059
2802
|
<xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
|
3060
2803
|
|
3061
2804
|
<!-- Normative references -->
|
3062
|
-
<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"/>
|
3063
2806
|
<!-- Terms and definitions -->
|
3064
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"/>
|
3065
2808
|
<!-- Another main sections -->
|
3066
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"/>
|
3067
2810
|
<xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
|
3068
2811
|
<!-- Bibliography -->
|
3069
|
-
<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
|
+
|
3070
2814
|
</xsl:template><xsl:template name="processPrefaceSectionsDefault">
|
3071
2815
|
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
|
3072
2816
|
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
|
@@ -3920,6 +3664,7 @@
|
|
3920
3664
|
|
3921
3665
|
|
3922
3666
|
|
3667
|
+
|
3923
3668
|
<xsl:if test="ancestor::*[local-name() = 'tfoot']">
|
3924
3669
|
<xsl:attribute name="border">solid black 0</xsl:attribute>
|
3925
3670
|
</xsl:if>
|
@@ -3967,6 +3712,7 @@
|
|
3967
3712
|
|
3968
3713
|
|
3969
3714
|
|
3715
|
+
|
3970
3716
|
<fo:inline padding-right="2mm">
|
3971
3717
|
|
3972
3718
|
|
@@ -4013,6 +3759,7 @@
|
|
4013
3759
|
|
4014
3760
|
|
4015
3761
|
|
3762
|
+
|
4016
3763
|
<xsl:value-of select="@reference"/>
|
4017
3764
|
|
4018
3765
|
|
@@ -4151,6 +3898,8 @@
|
|
4151
3898
|
<!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
|
4152
3899
|
<fo:inline font-size="80%" keep-with-previous.within-line="always">
|
4153
3900
|
|
3901
|
+
|
3902
|
+
|
4154
3903
|
<xsl:if test="ancestor::*[local-name()='td']">
|
4155
3904
|
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
4156
3905
|
<!-- <xsl:attribute name="alignment-baseline">hanging</xsl:attribute> -->
|
@@ -4163,6 +3912,7 @@
|
|
4163
3912
|
|
4164
3913
|
|
4165
3914
|
|
3915
|
+
|
4166
3916
|
<fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
|
4167
3917
|
|
4168
3918
|
|
@@ -5085,6 +4835,7 @@
|
|
5085
4835
|
<fo:inline xsl:use-attribute-sets="link-style">
|
5086
4836
|
|
5087
4837
|
|
4838
|
+
|
5088
4839
|
<xsl:choose>
|
5089
4840
|
<xsl:when test="$target_text = ''">
|
5090
4841
|
<xsl:apply-templates/>
|
@@ -5435,6 +5186,234 @@
|
|
5435
5186
|
<xsl:param name="height"/>
|
5436
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; "/>
|
5437
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 > $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 > $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 > (@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>
|
5438
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">
|
5439
5418
|
<xsl:apply-templates mode="contents"/>
|
5440
5419
|
<xsl:text> </xsl:text>
|
@@ -5463,28 +5442,39 @@
|
|
5463
5442
|
<xsl:when test="count(xalan:nodeset($contents)/doc) > 1">
|
5464
5443
|
<xsl:for-each select="xalan:nodeset($contents)/doc">
|
5465
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>
|
5466
5448
|
<fo:bookmark-title>
|
5467
|
-
<xsl:variable name="bookmark-title_">
|
5468
|
-
<xsl:call-template name="getLangVersion">
|
5469
|
-
<xsl:with-param name="lang" select="@lang"/>
|
5470
|
-
<xsl:with-param name="doctype" select="@doctype"/>
|
5471
|
-
<xsl:with-param name="title" select="@title-part"/>
|
5472
|
-
</xsl:call-template>
|
5473
|
-
</xsl:variable>
|
5474
5449
|
<xsl:choose>
|
5475
|
-
<xsl:when test="normalize-space(
|
5476
|
-
<xsl:
|
5477
|
-
|
5478
|
-
|
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>
|
5479
5458
|
<xsl:choose>
|
5480
|
-
<xsl:when test="
|
5481
|
-
|
5482
|
-
|
5483
|
-
<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>
|
5484
5470
|
</xsl:choose>
|
5471
|
+
</xsl:when>
|
5472
|
+
<xsl:otherwise>
|
5473
|
+
<xsl:value-of select="@title-part"/>
|
5485
5474
|
</xsl:otherwise>
|
5486
5475
|
</xsl:choose>
|
5487
5476
|
</fo:bookmark-title>
|
5477
|
+
|
5488
5478
|
<xsl:apply-templates select="contents/item" mode="bookmark"/>
|
5489
5479
|
|
5490
5480
|
<xsl:call-template name="insertFigureBookmarks">
|
@@ -5583,16 +5573,23 @@
|
|
5583
5573
|
<xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
|
5584
5574
|
</xsl:choose>
|
5585
5575
|
</xsl:template><xsl:template match="item" mode="bookmark">
|
5586
|
-
<
|
5587
|
-
|
5588
|
-
|
5589
|
-
|
5590
|
-
<xsl:
|
5591
|
-
|
5592
|
-
|
5593
|
-
|
5594
|
-
|
5595
|
-
|
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>
|
5596
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">
|
5597
5594
|
<xsl:if test="normalize-space() != ''">
|
5598
5595
|
<fo:block xsl:use-attribute-sets="figure-name-style">
|
@@ -6156,6 +6153,7 @@
|
|
6156
6153
|
</xsl:if>
|
6157
6154
|
|
6158
6155
|
<fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
|
6156
|
+
|
6159
6157
|
<xsl:if test="normalize-space(@citeas) = ''">
|
6160
6158
|
<xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
|
6161
6159
|
</xsl:if>
|