metanorma-ogc 2.5.3 → 2.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0877a135122a9679c77a798d1dcdbb87ab12eb88064d4e9cb0b27e6801ce01e
4
- data.tar.gz: 96698d9f3307659aae17d583013669f255b66fb26da573ec1a5c6895bb305f2d
3
+ metadata.gz: 35eb5d112459eeed0144cd0540f405b6d0747de419d8480cde65847345378228
4
+ data.tar.gz: c0fc6b930e03b9602a1608abb8341af9f9dc36fb0f59c45fe72341a441564a0c
5
5
  SHA512:
6
- metadata.gz: 87400e1bc50e17d41f0ee8ac284d0b711eb90537904751cf974073a59294aab85ff65167df3cddc3d5cebd7c17e1abb601e54a3e8fe7261e414f9450ed885a57
7
- data.tar.gz: 9a97e9cc207be3725110845bbc29d13c688cba3d58ad297eca15dfa53dd89ef62901561191287aecfa3e01bba431325f077230448b09c369151b0ad3e581e7eb
6
+ metadata.gz: fa414b2a8de42c48ec54c897536126b37f83f025fec56726692bce77a4a2699ec7510ef4c55876d885ec14bcc59af350e758d0dc1ab63b5a58b76c629937904c
7
+ data.tar.gz: 370285842b061ab348ddc3b6d8316e57179e6c3107ca08229881f83e9f223c83b1c144a38749df6150236c182b7e4058d845f4c176580030b569ee21d97caff8
@@ -1813,6 +1813,7 @@
1813
1813
  <xsl:variable name="zero_width_space">​</xsl:variable>
1814
1814
  <xsl:variable name="hair_space"> </xsl:variable>
1815
1815
  <xsl:variable name="en_dash">–</xsl:variable>
1816
+ <xsl:variable name="em_dash">—</xsl:variable>
1816
1817
 
1817
1818
  <xsl:template name="getTitle">
1818
1819
  <xsl:param name="name"/>
@@ -2193,6 +2194,10 @@
2193
2194
 
2194
2195
  </xsl:attribute-set> <!-- example-name-style -->
2195
2196
 
2197
+ <xsl:template name="refine_example-name-style">
2198
+
2199
+ </xsl:template>
2200
+
2196
2201
  <xsl:attribute-set name="example-p-style">
2197
2202
 
2198
2203
  <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
@@ -2209,6 +2214,10 @@
2209
2214
 
2210
2215
  </xsl:attribute-set> <!-- termexample-name-style -->
2211
2216
 
2217
+ <xsl:template name="refine_termexample-name-style">
2218
+
2219
+ </xsl:template>
2220
+
2212
2221
  <!-- ========================== -->
2213
2222
  <!-- Table styles -->
2214
2223
  <!-- ========================== -->
@@ -2398,6 +2407,10 @@
2398
2407
 
2399
2408
  </xsl:attribute-set> <!-- table-fn-style -->
2400
2409
 
2410
+ <xsl:template name="refine_table-fn-style">
2411
+
2412
+ </xsl:template>
2413
+
2401
2414
  <xsl:attribute-set name="table-fn-number-style">
2402
2415
  <xsl:attribute name="font-size">80%</xsl:attribute>
2403
2416
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2406,6 +2419,10 @@
2406
2419
 
2407
2420
  </xsl:attribute-set> <!-- table-fn-number-style -->
2408
2421
 
2422
+ <xsl:template name="refine_table-fn-number-style">
2423
+
2424
+ </xsl:template>
2425
+
2409
2426
  <xsl:attribute-set name="fn-container-body-style">
2410
2427
  <xsl:attribute name="text-indent">0</xsl:attribute>
2411
2428
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -4840,8 +4857,9 @@
4840
4857
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4841
4858
 
4842
4859
  <fo:block xsl:use-attribute-sets="table-fn-style">
4843
-
4860
+ <xsl:call-template name="refine_table-fn-style"/>
4844
4861
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4862
+ <xsl:call-template name="refine_table-fn-number-style"/>
4845
4863
 
4846
4864
  <xsl:value-of select="@reference"/>
4847
4865
 
@@ -6000,12 +6018,18 @@
6000
6018
  </xsl:template>
6001
6019
 
6002
6020
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6003
- <xsl:variable name="text" select="normalize-space(.)"/>
6004
- <fo:inline font-size="75%" role="SKIP">
6021
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6022
+ <xsl:variable name="text" select="."/>
6023
+ <xsl:variable name="ratio_">
6024
+ 0.75
6025
+ </xsl:variable>
6026
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
6027
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
6005
6028
  <xsl:if test="string-length($text) &gt; 0">
6006
6029
  <xsl:variable name="smallCapsText">
6007
6030
  <xsl:call-template name="recursiveSmallCaps">
6008
6031
  <xsl:with-param name="text" select="$text"/>
6032
+ <xsl:with-param name="ratio" select="$ratio"/>
6009
6033
  </xsl:call-template>
6010
6034
  </xsl:variable>
6011
6035
  <!-- merge neighboring fo:inline -->
@@ -6042,12 +6066,13 @@
6042
6066
 
6043
6067
  <xsl:template name="recursiveSmallCaps">
6044
6068
  <xsl:param name="text"/>
6069
+ <xsl:param name="ratio"/>
6045
6070
  <xsl:variable name="char" select="substring($text,1,1)"/>
6046
6071
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
6047
6072
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
6048
6073
  <xsl:choose>
6049
6074
  <xsl:when test="$char=$upperCase">
6050
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
6075
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
6051
6076
  <xsl:value-of select="$upperCase"/>
6052
6077
  </fo:inline>
6053
6078
  </xsl:when>
@@ -6058,6 +6083,7 @@
6058
6083
  <xsl:if test="string-length($text) &gt; 1">
6059
6084
  <xsl:call-template name="recursiveSmallCaps">
6060
6085
  <xsl:with-param name="text" select="substring($text,2)"/>
6086
+ <xsl:with-param name="ratio" select="$ratio"/>
6061
6087
  </xsl:call-template>
6062
6088
  </xsl:if>
6063
6089
  </xsl:template>
@@ -6094,6 +6120,9 @@
6094
6120
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
6095
6121
  <style name="{$key}"><xsl:value-of select="$value"/></style>
6096
6122
  </xsl:if>
6123
+ <xsl:if test="$key = 'text-indent'">
6124
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
6125
+ </xsl:if>
6097
6126
  </xsl:for-each>
6098
6127
  </xsl:variable>
6099
6128
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -7500,6 +7529,11 @@
7500
7529
  </xsl:call-template>
7501
7530
  </xsl:template>
7502
7531
 
7532
+ <!-- command between two xref points to non-standard bibitem -->
7533
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
7534
+ <xsl:value-of select="."/>
7535
+ </xsl:template>
7536
+
7503
7537
  <!-- ====== -->
7504
7538
  <!-- formula -->
7505
7539
  <!-- ====== -->
@@ -8143,16 +8177,44 @@
8143
8177
  </xsl:choose>
8144
8178
 
8145
8179
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8146
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8147
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8180
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8181
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8182
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8183
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8184
+
8185
+ <!-- Example: -->
8148
8186
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8149
8187
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8150
8188
  <!-- effective height / width = 1.48, 1.4 - with title -->
8151
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8189
+
8190
+ <xsl:variable name="scale_x">
8191
+ <xsl:choose>
8192
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8193
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8194
+ </xsl:when>
8195
+ <xsl:otherwise>1</xsl:otherwise>
8196
+ </xsl:choose>
8197
+ </xsl:variable>
8198
+ <xsl:variable name="scale_y">
8199
+ <xsl:choose>
8200
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8201
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8202
+ </xsl:when>
8203
+ <xsl:otherwise>1</xsl:otherwise>
8204
+ </xsl:choose>
8205
+ </xsl:variable>
8206
+
8207
+ <!-- for images with big height -->
8208
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8152
8209
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8153
8210
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8154
- </xsl:if>
8211
+ </xsl:if> -->
8155
8212
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8213
+
8214
+ <xsl:if test="$scale_y != 1">
8215
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8216
+ </xsl:if>
8217
+
8156
8218
  <xsl:copy-of select="$svg_content"/>
8157
8219
  </fo:instream-foreign-object>
8158
8220
  <!-- </fo:block> -->
@@ -8177,6 +8239,8 @@
8177
8239
  </xsl:attribute>
8178
8240
  </xsl:template>
8179
8241
 
8242
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
8243
+
8180
8244
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
8181
8245
  <xsl:copy>
8182
8246
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -8190,8 +8254,13 @@
8190
8254
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8191
8255
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8192
8256
 
8257
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8258
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8259
+
8193
8260
  <xsl:attribute name="width">
8194
8261
  <xsl:choose>
8262
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8263
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8195
8264
  <xsl:when test="$width != ''">
8196
8265
  <xsl:value-of select="round($width)"/>
8197
8266
  </xsl:when>
@@ -8200,6 +8269,8 @@
8200
8269
  </xsl:attribute>
8201
8270
  <xsl:attribute name="height">
8202
8271
  <xsl:choose>
8272
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8273
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8203
8274
  <xsl:when test="$height != ''">
8204
8275
  <xsl:value-of select="round($height)"/>
8205
8276
  </xsl:when>
@@ -8211,6 +8282,28 @@
8211
8282
  </xsl:copy>
8212
8283
  </xsl:template>
8213
8284
 
8285
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8286
+ <!-- image[@width]/svg -->
8287
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8288
+ <xsl:attribute name="width">
8289
+ <xsl:choose>
8290
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8291
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8292
+ </xsl:choose>
8293
+ </xsl:attribute>
8294
+ </xsl:template>
8295
+
8296
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8297
+ <!-- image[@height]/svg -->
8298
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8299
+ <xsl:attribute name="height">
8300
+ <xsl:choose>
8301
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8302
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8303
+ </xsl:choose>
8304
+ </xsl:attribute>
8305
+ </xsl:template>
8306
+
8214
8307
  <!-- regex for 'display: inline-block;' -->
8215
8308
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8216
8309
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9719,6 +9812,7 @@
9719
9812
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
9720
9813
  <xsl:if test="normalize-space() != ''">
9721
9814
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
9815
+ <xsl:call-template name="refine_termexample-name-style"/>
9722
9816
  <xsl:apply-templates/>
9723
9817
  </fo:inline>
9724
9818
  </xsl:if>
@@ -9869,6 +9963,7 @@
9869
9963
  </xsl:when>
9870
9964
  <xsl:otherwise>
9871
9965
  <fo:inline xsl:use-attribute-sets="example-name-style">
9966
+ <xsl:call-template name="refine_example-name-style"/>
9872
9967
  <xsl:apply-templates/>:
9873
9968
  </fo:inline>
9874
9969
  </xsl:otherwise>
@@ -10331,7 +10426,9 @@
10331
10426
  </xsl:template> <!-- sections_element_style -->
10332
10427
 
10333
10428
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10334
- <fo:block break-after="page"/>
10429
+
10430
+ <fo:block break-after="page"/>
10431
+
10335
10432
  <fo:block>
10336
10433
  <xsl:call-template name="setId"/>
10337
10434
  <xsl:apply-templates/>
@@ -10398,7 +10495,7 @@
10398
10495
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10399
10496
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10400
10497
  </xsl:when>
10401
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10498
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10402
10499
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10403
10500
  </xsl:when>
10404
10501
  </xsl:choose>
@@ -11070,6 +11167,7 @@
11070
11167
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
11071
11168
 
11072
11169
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
11170
+
11073
11171
  <xsl:call-template name="processBibitem"/>
11074
11172
  </fo:block>
11075
11173
 
@@ -11111,6 +11209,7 @@
11111
11209
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
11112
11210
  <xsl:otherwise>
11113
11211
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
11212
+
11114
11213
  <fo:list-item-label end-indent="label-end()">
11115
11214
  <fo:block role="SKIP">
11116
11215
  <fo:inline role="SKIP">
@@ -12876,4 +12975,6 @@
12876
12975
  </xsl:if>
12877
12976
  </xsl:template>
12878
12977
 
12978
+ <!-- update -->
12979
+
12879
12980
  </xsl:stylesheet>
@@ -1813,6 +1813,7 @@
1813
1813
  <xsl:variable name="zero_width_space">​</xsl:variable>
1814
1814
  <xsl:variable name="hair_space"> </xsl:variable>
1815
1815
  <xsl:variable name="en_dash">–</xsl:variable>
1816
+ <xsl:variable name="em_dash">—</xsl:variable>
1816
1817
 
1817
1818
  <xsl:template name="getTitle">
1818
1819
  <xsl:param name="name"/>
@@ -2193,6 +2194,10 @@
2193
2194
 
2194
2195
  </xsl:attribute-set> <!-- example-name-style -->
2195
2196
 
2197
+ <xsl:template name="refine_example-name-style">
2198
+
2199
+ </xsl:template>
2200
+
2196
2201
  <xsl:attribute-set name="example-p-style">
2197
2202
 
2198
2203
  <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
@@ -2209,6 +2214,10 @@
2209
2214
 
2210
2215
  </xsl:attribute-set> <!-- termexample-name-style -->
2211
2216
 
2217
+ <xsl:template name="refine_termexample-name-style">
2218
+
2219
+ </xsl:template>
2220
+
2212
2221
  <!-- ========================== -->
2213
2222
  <!-- Table styles -->
2214
2223
  <!-- ========================== -->
@@ -2398,6 +2407,10 @@
2398
2407
 
2399
2408
  </xsl:attribute-set> <!-- table-fn-style -->
2400
2409
 
2410
+ <xsl:template name="refine_table-fn-style">
2411
+
2412
+ </xsl:template>
2413
+
2401
2414
  <xsl:attribute-set name="table-fn-number-style">
2402
2415
  <xsl:attribute name="font-size">80%</xsl:attribute>
2403
2416
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2406,6 +2419,10 @@
2406
2419
 
2407
2420
  </xsl:attribute-set> <!-- table-fn-number-style -->
2408
2421
 
2422
+ <xsl:template name="refine_table-fn-number-style">
2423
+
2424
+ </xsl:template>
2425
+
2409
2426
  <xsl:attribute-set name="fn-container-body-style">
2410
2427
  <xsl:attribute name="text-indent">0</xsl:attribute>
2411
2428
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -4840,8 +4857,9 @@
4840
4857
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4841
4858
 
4842
4859
  <fo:block xsl:use-attribute-sets="table-fn-style">
4843
-
4860
+ <xsl:call-template name="refine_table-fn-style"/>
4844
4861
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4862
+ <xsl:call-template name="refine_table-fn-number-style"/>
4845
4863
 
4846
4864
  <xsl:value-of select="@reference"/>
4847
4865
 
@@ -6000,12 +6018,18 @@
6000
6018
  </xsl:template>
6001
6019
 
6002
6020
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6003
- <xsl:variable name="text" select="normalize-space(.)"/>
6004
- <fo:inline font-size="75%" role="SKIP">
6021
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6022
+ <xsl:variable name="text" select="."/>
6023
+ <xsl:variable name="ratio_">
6024
+ 0.75
6025
+ </xsl:variable>
6026
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
6027
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
6005
6028
  <xsl:if test="string-length($text) &gt; 0">
6006
6029
  <xsl:variable name="smallCapsText">
6007
6030
  <xsl:call-template name="recursiveSmallCaps">
6008
6031
  <xsl:with-param name="text" select="$text"/>
6032
+ <xsl:with-param name="ratio" select="$ratio"/>
6009
6033
  </xsl:call-template>
6010
6034
  </xsl:variable>
6011
6035
  <!-- merge neighboring fo:inline -->
@@ -6042,12 +6066,13 @@
6042
6066
 
6043
6067
  <xsl:template name="recursiveSmallCaps">
6044
6068
  <xsl:param name="text"/>
6069
+ <xsl:param name="ratio"/>
6045
6070
  <xsl:variable name="char" select="substring($text,1,1)"/>
6046
6071
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
6047
6072
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
6048
6073
  <xsl:choose>
6049
6074
  <xsl:when test="$char=$upperCase">
6050
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
6075
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
6051
6076
  <xsl:value-of select="$upperCase"/>
6052
6077
  </fo:inline>
6053
6078
  </xsl:when>
@@ -6058,6 +6083,7 @@
6058
6083
  <xsl:if test="string-length($text) &gt; 1">
6059
6084
  <xsl:call-template name="recursiveSmallCaps">
6060
6085
  <xsl:with-param name="text" select="substring($text,2)"/>
6086
+ <xsl:with-param name="ratio" select="$ratio"/>
6061
6087
  </xsl:call-template>
6062
6088
  </xsl:if>
6063
6089
  </xsl:template>
@@ -6094,6 +6120,9 @@
6094
6120
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
6095
6121
  <style name="{$key}"><xsl:value-of select="$value"/></style>
6096
6122
  </xsl:if>
6123
+ <xsl:if test="$key = 'text-indent'">
6124
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
6125
+ </xsl:if>
6097
6126
  </xsl:for-each>
6098
6127
  </xsl:variable>
6099
6128
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -7500,6 +7529,11 @@
7500
7529
  </xsl:call-template>
7501
7530
  </xsl:template>
7502
7531
 
7532
+ <!-- command between two xref points to non-standard bibitem -->
7533
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
7534
+ <xsl:value-of select="."/>
7535
+ </xsl:template>
7536
+
7503
7537
  <!-- ====== -->
7504
7538
  <!-- formula -->
7505
7539
  <!-- ====== -->
@@ -8143,16 +8177,44 @@
8143
8177
  </xsl:choose>
8144
8178
 
8145
8179
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8146
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8147
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8180
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8181
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8182
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8183
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8184
+
8185
+ <!-- Example: -->
8148
8186
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8149
8187
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8150
8188
  <!-- effective height / width = 1.48, 1.4 - with title -->
8151
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8189
+
8190
+ <xsl:variable name="scale_x">
8191
+ <xsl:choose>
8192
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8193
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8194
+ </xsl:when>
8195
+ <xsl:otherwise>1</xsl:otherwise>
8196
+ </xsl:choose>
8197
+ </xsl:variable>
8198
+ <xsl:variable name="scale_y">
8199
+ <xsl:choose>
8200
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8201
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8202
+ </xsl:when>
8203
+ <xsl:otherwise>1</xsl:otherwise>
8204
+ </xsl:choose>
8205
+ </xsl:variable>
8206
+
8207
+ <!-- for images with big height -->
8208
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8152
8209
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8153
8210
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8154
- </xsl:if>
8211
+ </xsl:if> -->
8155
8212
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8213
+
8214
+ <xsl:if test="$scale_y != 1">
8215
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8216
+ </xsl:if>
8217
+
8156
8218
  <xsl:copy-of select="$svg_content"/>
8157
8219
  </fo:instream-foreign-object>
8158
8220
  <!-- </fo:block> -->
@@ -8177,6 +8239,8 @@
8177
8239
  </xsl:attribute>
8178
8240
  </xsl:template>
8179
8241
 
8242
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
8243
+
8180
8244
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
8181
8245
  <xsl:copy>
8182
8246
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -8190,8 +8254,13 @@
8190
8254
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8191
8255
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8192
8256
 
8257
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8258
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8259
+
8193
8260
  <xsl:attribute name="width">
8194
8261
  <xsl:choose>
8262
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8263
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8195
8264
  <xsl:when test="$width != ''">
8196
8265
  <xsl:value-of select="round($width)"/>
8197
8266
  </xsl:when>
@@ -8200,6 +8269,8 @@
8200
8269
  </xsl:attribute>
8201
8270
  <xsl:attribute name="height">
8202
8271
  <xsl:choose>
8272
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8273
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8203
8274
  <xsl:when test="$height != ''">
8204
8275
  <xsl:value-of select="round($height)"/>
8205
8276
  </xsl:when>
@@ -8211,6 +8282,28 @@
8211
8282
  </xsl:copy>
8212
8283
  </xsl:template>
8213
8284
 
8285
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8286
+ <!-- image[@width]/svg -->
8287
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8288
+ <xsl:attribute name="width">
8289
+ <xsl:choose>
8290
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8291
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8292
+ </xsl:choose>
8293
+ </xsl:attribute>
8294
+ </xsl:template>
8295
+
8296
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8297
+ <!-- image[@height]/svg -->
8298
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8299
+ <xsl:attribute name="height">
8300
+ <xsl:choose>
8301
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8302
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8303
+ </xsl:choose>
8304
+ </xsl:attribute>
8305
+ </xsl:template>
8306
+
8214
8307
  <!-- regex for 'display: inline-block;' -->
8215
8308
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8216
8309
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9719,6 +9812,7 @@
9719
9812
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
9720
9813
  <xsl:if test="normalize-space() != ''">
9721
9814
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
9815
+ <xsl:call-template name="refine_termexample-name-style"/>
9722
9816
  <xsl:apply-templates/>
9723
9817
  </fo:inline>
9724
9818
  </xsl:if>
@@ -9869,6 +9963,7 @@
9869
9963
  </xsl:when>
9870
9964
  <xsl:otherwise>
9871
9965
  <fo:inline xsl:use-attribute-sets="example-name-style">
9966
+ <xsl:call-template name="refine_example-name-style"/>
9872
9967
  <xsl:apply-templates/>:
9873
9968
  </fo:inline>
9874
9969
  </xsl:otherwise>
@@ -10331,7 +10426,9 @@
10331
10426
  </xsl:template> <!-- sections_element_style -->
10332
10427
 
10333
10428
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10334
- <fo:block break-after="page"/>
10429
+
10430
+ <fo:block break-after="page"/>
10431
+
10335
10432
  <fo:block>
10336
10433
  <xsl:call-template name="setId"/>
10337
10434
  <xsl:apply-templates/>
@@ -10398,7 +10495,7 @@
10398
10495
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10399
10496
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10400
10497
  </xsl:when>
10401
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10498
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10402
10499
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10403
10500
  </xsl:when>
10404
10501
  </xsl:choose>
@@ -11070,6 +11167,7 @@
11070
11167
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
11071
11168
 
11072
11169
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
11170
+
11073
11171
  <xsl:call-template name="processBibitem"/>
11074
11172
  </fo:block>
11075
11173
 
@@ -11111,6 +11209,7 @@
11111
11209
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
11112
11210
  <xsl:otherwise>
11113
11211
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
11212
+
11114
11213
  <fo:list-item-label end-indent="label-end()">
11115
11214
  <fo:block role="SKIP">
11116
11215
  <fo:inline role="SKIP">
@@ -12876,4 +12975,6 @@
12876
12975
  </xsl:if>
12877
12976
  </xsl:template>
12878
12977
 
12978
+ <!-- update -->
12979
+
12879
12980
  </xsl:stylesheet>