metanorma-un 0.12.4 → 0.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a6a30ba559e99be775cb5171f13cd196f8a2f3f47416c6fe5125d4a3b2ae158
4
- data.tar.gz: 5247a58efec6e008bbbe5e30bfd6838662e0c066d1105a8765c5c18d2e71381b
3
+ metadata.gz: b4afd0f6a635e8ed3383d14ddd21737aafbb61f4d5b1e47eb683936f82d5fc37
4
+ data.tar.gz: 4d11b23a6f99532384d12355db81fad52c020e1ab8495d0bb18313af8398e98b
5
5
  SHA512:
6
- metadata.gz: 675bb2c90ca90d8e4c3401b5f14f0231a36370277d241bd3779499ba1d51ab6d327cbba318d3c19e9675cd9a33c911f7a87cf048d77c0540f3da9fd1c8f5762b
7
- data.tar.gz: a5ed94230bf8b0a1bf4c2de826717cd1a07ee0ff2eb68a1e258aa57e64ed7f5db2e04e46cbfc86b7d1d99a6acb0c9a4e674e6d164cf5059a199af4ba510bd118
6
+ metadata.gz: 7a5bdeb035b8f335eb6637d69664926ffa42d74c5d7aabddda3e403e418e996c6efe44c1945ea8d87f6cddcab52257585e540e9eaffedc371c726ea21312e457
7
+ data.tar.gz: fbe220b5d596c020f3f16d03a67739bf9c5fed3b35617026a442ec52d0ccfb7afe1ef4d86a12c1d2c9d9f40b863b430f18d10ff1f6a4645a949e69f879cd5153
@@ -974,6 +974,7 @@
974
974
  <xsl:variable name="zero_width_space">​</xsl:variable>
975
975
  <xsl:variable name="hair_space"> </xsl:variable>
976
976
  <xsl:variable name="en_dash">–</xsl:variable>
977
+ <xsl:variable name="em_dash">—</xsl:variable>
977
978
 
978
979
  <xsl:template name="getTitle">
979
980
  <xsl:param name="name"/>
@@ -1281,6 +1282,10 @@
1281
1282
 
1282
1283
  </xsl:attribute-set> <!-- example-name-style -->
1283
1284
 
1285
+ <xsl:template name="refine_example-name-style">
1286
+
1287
+ </xsl:template>
1288
+
1284
1289
  <xsl:attribute-set name="example-p-style">
1285
1290
 
1286
1291
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1303,6 +1308,10 @@
1303
1308
 
1304
1309
  </xsl:attribute-set> <!-- termexample-name-style -->
1305
1310
 
1311
+ <xsl:template name="refine_termexample-name-style">
1312
+
1313
+ </xsl:template>
1314
+
1306
1315
  <!-- ========================== -->
1307
1316
  <!-- Table styles -->
1308
1317
  <!-- ========================== -->
@@ -1489,6 +1498,10 @@
1489
1498
 
1490
1499
  </xsl:attribute-set> <!-- table-fn-style -->
1491
1500
 
1501
+ <xsl:template name="refine_table-fn-style">
1502
+
1503
+ </xsl:template>
1504
+
1492
1505
  <xsl:attribute-set name="table-fn-number-style">
1493
1506
  <xsl:attribute name="font-size">80%</xsl:attribute>
1494
1507
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1497,6 +1510,10 @@
1497
1510
 
1498
1511
  </xsl:attribute-set> <!-- table-fn-number-style -->
1499
1512
 
1513
+ <xsl:template name="refine_table-fn-number-style">
1514
+
1515
+ </xsl:template>
1516
+
1500
1517
  <xsl:attribute-set name="fn-container-body-style">
1501
1518
  <xsl:attribute name="text-indent">0</xsl:attribute>
1502
1519
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -3841,8 +3858,9 @@
3841
3858
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3842
3859
 
3843
3860
  <fo:block xsl:use-attribute-sets="table-fn-style">
3844
-
3861
+ <xsl:call-template name="refine_table-fn-style"/>
3845
3862
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3863
+ <xsl:call-template name="refine_table-fn-number-style"/>
3846
3864
 
3847
3865
  <xsl:value-of select="@reference"/>
3848
3866
 
@@ -4978,12 +4996,18 @@
4978
4996
  </xsl:template>
4979
4997
 
4980
4998
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4981
- <xsl:variable name="text" select="normalize-space(.)"/>
4982
- <fo:inline font-size="75%" role="SKIP">
4999
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5000
+ <xsl:variable name="text" select="."/>
5001
+ <xsl:variable name="ratio_">
5002
+ 0.75
5003
+ </xsl:variable>
5004
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5005
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
4983
5006
  <xsl:if test="string-length($text) &gt; 0">
4984
5007
  <xsl:variable name="smallCapsText">
4985
5008
  <xsl:call-template name="recursiveSmallCaps">
4986
5009
  <xsl:with-param name="text" select="$text"/>
5010
+ <xsl:with-param name="ratio" select="$ratio"/>
4987
5011
  </xsl:call-template>
4988
5012
  </xsl:variable>
4989
5013
  <!-- merge neighboring fo:inline -->
@@ -5020,12 +5044,13 @@
5020
5044
 
5021
5045
  <xsl:template name="recursiveSmallCaps">
5022
5046
  <xsl:param name="text"/>
5047
+ <xsl:param name="ratio"/>
5023
5048
  <xsl:variable name="char" select="substring($text,1,1)"/>
5024
5049
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5025
5050
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5026
5051
  <xsl:choose>
5027
5052
  <xsl:when test="$char=$upperCase">
5028
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
5053
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5029
5054
  <xsl:value-of select="$upperCase"/>
5030
5055
  </fo:inline>
5031
5056
  </xsl:when>
@@ -5036,6 +5061,7 @@
5036
5061
  <xsl:if test="string-length($text) &gt; 1">
5037
5062
  <xsl:call-template name="recursiveSmallCaps">
5038
5063
  <xsl:with-param name="text" select="substring($text,2)"/>
5064
+ <xsl:with-param name="ratio" select="$ratio"/>
5039
5065
  </xsl:call-template>
5040
5066
  </xsl:if>
5041
5067
  </xsl:template>
@@ -5072,6 +5098,9 @@
5072
5098
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5073
5099
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5074
5100
  </xsl:if>
5101
+ <xsl:if test="$key = 'text-indent'">
5102
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
5103
+ </xsl:if>
5075
5104
  </xsl:for-each>
5076
5105
  </xsl:variable>
5077
5106
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -6474,6 +6503,11 @@
6474
6503
  </xsl:call-template>
6475
6504
  </xsl:template>
6476
6505
 
6506
+ <!-- command between two xref points to non-standard bibitem -->
6507
+ <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']]]">
6508
+ <xsl:value-of select="."/>
6509
+ </xsl:template>
6510
+
6477
6511
  <!-- ====== -->
6478
6512
  <!-- formula -->
6479
6513
  <!-- ====== -->
@@ -7126,16 +7160,44 @@
7126
7160
  </xsl:choose>
7127
7161
 
7128
7162
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7129
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7130
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7163
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7164
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7165
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7166
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7167
+
7168
+ <!-- Example: -->
7131
7169
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7132
7170
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7133
7171
  <!-- effective height / width = 1.48, 1.4 - with title -->
7134
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7172
+
7173
+ <xsl:variable name="scale_x">
7174
+ <xsl:choose>
7175
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7176
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7177
+ </xsl:when>
7178
+ <xsl:otherwise>1</xsl:otherwise>
7179
+ </xsl:choose>
7180
+ </xsl:variable>
7181
+ <xsl:variable name="scale_y">
7182
+ <xsl:choose>
7183
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7184
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7185
+ </xsl:when>
7186
+ <xsl:otherwise>1</xsl:otherwise>
7187
+ </xsl:choose>
7188
+ </xsl:variable>
7189
+
7190
+ <!-- for images with big height -->
7191
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7135
7192
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7136
7193
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7137
- </xsl:if>
7194
+ </xsl:if> -->
7138
7195
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7196
+
7197
+ <xsl:if test="$scale_y != 1">
7198
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7199
+ </xsl:if>
7200
+
7139
7201
  <xsl:copy-of select="$svg_content"/>
7140
7202
  </fo:instream-foreign-object>
7141
7203
  <!-- </fo:block> -->
@@ -7160,6 +7222,8 @@
7160
7222
  </xsl:attribute>
7161
7223
  </xsl:template>
7162
7224
 
7225
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
7226
+
7163
7227
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7164
7228
  <xsl:copy>
7165
7229
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -7173,8 +7237,13 @@
7173
7237
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7174
7238
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7175
7239
 
7240
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7241
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7242
+
7176
7243
  <xsl:attribute name="width">
7177
7244
  <xsl:choose>
7245
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7246
+ <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>
7178
7247
  <xsl:when test="$width != ''">
7179
7248
  <xsl:value-of select="round($width)"/>
7180
7249
  </xsl:when>
@@ -7183,6 +7252,8 @@
7183
7252
  </xsl:attribute>
7184
7253
  <xsl:attribute name="height">
7185
7254
  <xsl:choose>
7255
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7256
+ <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>
7186
7257
  <xsl:when test="$height != ''">
7187
7258
  <xsl:value-of select="round($height)"/>
7188
7259
  </xsl:when>
@@ -7194,6 +7265,28 @@
7194
7265
  </xsl:copy>
7195
7266
  </xsl:template>
7196
7267
 
7268
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7269
+ <!-- image[@width]/svg -->
7270
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7271
+ <xsl:attribute name="width">
7272
+ <xsl:choose>
7273
+ <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>
7274
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7275
+ </xsl:choose>
7276
+ </xsl:attribute>
7277
+ </xsl:template>
7278
+
7279
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7280
+ <!-- image[@height]/svg -->
7281
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7282
+ <xsl:attribute name="height">
7283
+ <xsl:choose>
7284
+ <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>
7285
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7286
+ </xsl:choose>
7287
+ </xsl:attribute>
7288
+ </xsl:template>
7289
+
7197
7290
  <!-- regex for 'display: inline-block;' -->
7198
7291
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7199
7292
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -8650,6 +8743,7 @@
8650
8743
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
8651
8744
  <xsl:if test="normalize-space() != ''">
8652
8745
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
8746
+ <xsl:call-template name="refine_termexample-name-style"/>
8653
8747
  <xsl:apply-templates/>
8654
8748
  </fo:inline>
8655
8749
  </xsl:if>
@@ -8800,6 +8894,7 @@
8800
8894
  </xsl:when>
8801
8895
  <xsl:otherwise>
8802
8896
  <fo:inline xsl:use-attribute-sets="example-name-style">
8897
+ <xsl:call-template name="refine_example-name-style"/>
8803
8898
  <xsl:apply-templates/>
8804
8899
  </fo:inline>
8805
8900
  </xsl:otherwise>
@@ -9263,7 +9358,9 @@
9263
9358
  </xsl:template> <!-- sections_element_style -->
9264
9359
 
9265
9360
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9266
- <fo:block break-after="page"/>
9361
+
9362
+ <fo:block break-after="page"/>
9363
+
9267
9364
  <fo:block>
9268
9365
  <xsl:call-template name="setId"/>
9269
9366
  <xsl:apply-templates/>
@@ -9335,7 +9432,7 @@
9335
9432
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9336
9433
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9337
9434
  </xsl:when>
9338
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9435
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9339
9436
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9340
9437
  </xsl:when>
9341
9438
  </xsl:choose>
@@ -10009,6 +10106,7 @@
10009
10106
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
10010
10107
 
10011
10108
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
10109
+
10012
10110
  <xsl:call-template name="processBibitem"/>
10013
10111
  </fo:block>
10014
10112
 
@@ -10029,6 +10127,7 @@
10029
10127
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10030
10128
  <xsl:otherwise>
10031
10129
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
10130
+
10032
10131
  <fo:list-item-label end-indent="label-end()">
10033
10132
  <fo:block role="SKIP">
10034
10133
  <fo:inline role="SKIP">
@@ -11800,4 +11899,6 @@
11800
11899
  </xsl:if>
11801
11900
  </xsl:template>
11802
11901
 
11902
+ <!-- update -->
11903
+
11803
11904
  </xsl:stylesheet>
@@ -974,6 +974,7 @@
974
974
  <xsl:variable name="zero_width_space">​</xsl:variable>
975
975
  <xsl:variable name="hair_space"> </xsl:variable>
976
976
  <xsl:variable name="en_dash">–</xsl:variable>
977
+ <xsl:variable name="em_dash">—</xsl:variable>
977
978
 
978
979
  <xsl:template name="getTitle">
979
980
  <xsl:param name="name"/>
@@ -1281,6 +1282,10 @@
1281
1282
 
1282
1283
  </xsl:attribute-set> <!-- example-name-style -->
1283
1284
 
1285
+ <xsl:template name="refine_example-name-style">
1286
+
1287
+ </xsl:template>
1288
+
1284
1289
  <xsl:attribute-set name="example-p-style">
1285
1290
 
1286
1291
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1303,6 +1308,10 @@
1303
1308
 
1304
1309
  </xsl:attribute-set> <!-- termexample-name-style -->
1305
1310
 
1311
+ <xsl:template name="refine_termexample-name-style">
1312
+
1313
+ </xsl:template>
1314
+
1306
1315
  <!-- ========================== -->
1307
1316
  <!-- Table styles -->
1308
1317
  <!-- ========================== -->
@@ -1489,6 +1498,10 @@
1489
1498
 
1490
1499
  </xsl:attribute-set> <!-- table-fn-style -->
1491
1500
 
1501
+ <xsl:template name="refine_table-fn-style">
1502
+
1503
+ </xsl:template>
1504
+
1492
1505
  <xsl:attribute-set name="table-fn-number-style">
1493
1506
  <xsl:attribute name="font-size">80%</xsl:attribute>
1494
1507
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1497,6 +1510,10 @@
1497
1510
 
1498
1511
  </xsl:attribute-set> <!-- table-fn-number-style -->
1499
1512
 
1513
+ <xsl:template name="refine_table-fn-number-style">
1514
+
1515
+ </xsl:template>
1516
+
1500
1517
  <xsl:attribute-set name="fn-container-body-style">
1501
1518
  <xsl:attribute name="text-indent">0</xsl:attribute>
1502
1519
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -3841,8 +3858,9 @@
3841
3858
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3842
3859
 
3843
3860
  <fo:block xsl:use-attribute-sets="table-fn-style">
3844
-
3861
+ <xsl:call-template name="refine_table-fn-style"/>
3845
3862
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3863
+ <xsl:call-template name="refine_table-fn-number-style"/>
3846
3864
 
3847
3865
  <xsl:value-of select="@reference"/>
3848
3866
 
@@ -4978,12 +4996,18 @@
4978
4996
  </xsl:template>
4979
4997
 
4980
4998
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4981
- <xsl:variable name="text" select="normalize-space(.)"/>
4982
- <fo:inline font-size="75%" role="SKIP">
4999
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5000
+ <xsl:variable name="text" select="."/>
5001
+ <xsl:variable name="ratio_">
5002
+ 0.75
5003
+ </xsl:variable>
5004
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5005
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
4983
5006
  <xsl:if test="string-length($text) &gt; 0">
4984
5007
  <xsl:variable name="smallCapsText">
4985
5008
  <xsl:call-template name="recursiveSmallCaps">
4986
5009
  <xsl:with-param name="text" select="$text"/>
5010
+ <xsl:with-param name="ratio" select="$ratio"/>
4987
5011
  </xsl:call-template>
4988
5012
  </xsl:variable>
4989
5013
  <!-- merge neighboring fo:inline -->
@@ -5020,12 +5044,13 @@
5020
5044
 
5021
5045
  <xsl:template name="recursiveSmallCaps">
5022
5046
  <xsl:param name="text"/>
5047
+ <xsl:param name="ratio"/>
5023
5048
  <xsl:variable name="char" select="substring($text,1,1)"/>
5024
5049
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5025
5050
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5026
5051
  <xsl:choose>
5027
5052
  <xsl:when test="$char=$upperCase">
5028
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
5053
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5029
5054
  <xsl:value-of select="$upperCase"/>
5030
5055
  </fo:inline>
5031
5056
  </xsl:when>
@@ -5036,6 +5061,7 @@
5036
5061
  <xsl:if test="string-length($text) &gt; 1">
5037
5062
  <xsl:call-template name="recursiveSmallCaps">
5038
5063
  <xsl:with-param name="text" select="substring($text,2)"/>
5064
+ <xsl:with-param name="ratio" select="$ratio"/>
5039
5065
  </xsl:call-template>
5040
5066
  </xsl:if>
5041
5067
  </xsl:template>
@@ -5072,6 +5098,9 @@
5072
5098
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5073
5099
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5074
5100
  </xsl:if>
5101
+ <xsl:if test="$key = 'text-indent'">
5102
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
5103
+ </xsl:if>
5075
5104
  </xsl:for-each>
5076
5105
  </xsl:variable>
5077
5106
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -6474,6 +6503,11 @@
6474
6503
  </xsl:call-template>
6475
6504
  </xsl:template>
6476
6505
 
6506
+ <!-- command between two xref points to non-standard bibitem -->
6507
+ <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']]]">
6508
+ <xsl:value-of select="."/>
6509
+ </xsl:template>
6510
+
6477
6511
  <!-- ====== -->
6478
6512
  <!-- formula -->
6479
6513
  <!-- ====== -->
@@ -7126,16 +7160,44 @@
7126
7160
  </xsl:choose>
7127
7161
 
7128
7162
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7129
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7130
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7163
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7164
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7165
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7166
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7167
+
7168
+ <!-- Example: -->
7131
7169
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7132
7170
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7133
7171
  <!-- effective height / width = 1.48, 1.4 - with title -->
7134
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7172
+
7173
+ <xsl:variable name="scale_x">
7174
+ <xsl:choose>
7175
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7176
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7177
+ </xsl:when>
7178
+ <xsl:otherwise>1</xsl:otherwise>
7179
+ </xsl:choose>
7180
+ </xsl:variable>
7181
+ <xsl:variable name="scale_y">
7182
+ <xsl:choose>
7183
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7184
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7185
+ </xsl:when>
7186
+ <xsl:otherwise>1</xsl:otherwise>
7187
+ </xsl:choose>
7188
+ </xsl:variable>
7189
+
7190
+ <!-- for images with big height -->
7191
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7135
7192
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7136
7193
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7137
- </xsl:if>
7194
+ </xsl:if> -->
7138
7195
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7196
+
7197
+ <xsl:if test="$scale_y != 1">
7198
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7199
+ </xsl:if>
7200
+
7139
7201
  <xsl:copy-of select="$svg_content"/>
7140
7202
  </fo:instream-foreign-object>
7141
7203
  <!-- </fo:block> -->
@@ -7160,6 +7222,8 @@
7160
7222
  </xsl:attribute>
7161
7223
  </xsl:template>
7162
7224
 
7225
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
7226
+
7163
7227
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7164
7228
  <xsl:copy>
7165
7229
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -7173,8 +7237,13 @@
7173
7237
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7174
7238
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7175
7239
 
7240
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7241
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7242
+
7176
7243
  <xsl:attribute name="width">
7177
7244
  <xsl:choose>
7245
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7246
+ <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>
7178
7247
  <xsl:when test="$width != ''">
7179
7248
  <xsl:value-of select="round($width)"/>
7180
7249
  </xsl:when>
@@ -7183,6 +7252,8 @@
7183
7252
  </xsl:attribute>
7184
7253
  <xsl:attribute name="height">
7185
7254
  <xsl:choose>
7255
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7256
+ <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>
7186
7257
  <xsl:when test="$height != ''">
7187
7258
  <xsl:value-of select="round($height)"/>
7188
7259
  </xsl:when>
@@ -7194,6 +7265,28 @@
7194
7265
  </xsl:copy>
7195
7266
  </xsl:template>
7196
7267
 
7268
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7269
+ <!-- image[@width]/svg -->
7270
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7271
+ <xsl:attribute name="width">
7272
+ <xsl:choose>
7273
+ <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>
7274
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7275
+ </xsl:choose>
7276
+ </xsl:attribute>
7277
+ </xsl:template>
7278
+
7279
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7280
+ <!-- image[@height]/svg -->
7281
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7282
+ <xsl:attribute name="height">
7283
+ <xsl:choose>
7284
+ <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>
7285
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7286
+ </xsl:choose>
7287
+ </xsl:attribute>
7288
+ </xsl:template>
7289
+
7197
7290
  <!-- regex for 'display: inline-block;' -->
7198
7291
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7199
7292
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -8650,6 +8743,7 @@
8650
8743
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
8651
8744
  <xsl:if test="normalize-space() != ''">
8652
8745
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
8746
+ <xsl:call-template name="refine_termexample-name-style"/>
8653
8747
  <xsl:apply-templates/>
8654
8748
  </fo:inline>
8655
8749
  </xsl:if>
@@ -8800,6 +8894,7 @@
8800
8894
  </xsl:when>
8801
8895
  <xsl:otherwise>
8802
8896
  <fo:inline xsl:use-attribute-sets="example-name-style">
8897
+ <xsl:call-template name="refine_example-name-style"/>
8803
8898
  <xsl:apply-templates/>
8804
8899
  </fo:inline>
8805
8900
  </xsl:otherwise>
@@ -9263,7 +9358,9 @@
9263
9358
  </xsl:template> <!-- sections_element_style -->
9264
9359
 
9265
9360
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9266
- <fo:block break-after="page"/>
9361
+
9362
+ <fo:block break-after="page"/>
9363
+
9267
9364
  <fo:block>
9268
9365
  <xsl:call-template name="setId"/>
9269
9366
  <xsl:apply-templates/>
@@ -9335,7 +9432,7 @@
9335
9432
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9336
9433
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9337
9434
  </xsl:when>
9338
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9435
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9339
9436
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9340
9437
  </xsl:when>
9341
9438
  </xsl:choose>
@@ -10009,6 +10106,7 @@
10009
10106
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
10010
10107
 
10011
10108
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
10109
+
10012
10110
  <xsl:call-template name="processBibitem"/>
10013
10111
  </fo:block>
10014
10112
 
@@ -10029,6 +10127,7 @@
10029
10127
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10030
10128
  <xsl:otherwise>
10031
10129
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
10130
+
10032
10131
  <fo:list-item-label end-indent="label-end()">
10033
10132
  <fo:block role="SKIP">
10034
10133
  <fo:inline role="SKIP">
@@ -11800,4 +11899,6 @@
11800
11899
  </xsl:if>
11801
11900
  </xsl:template>
11802
11901
 
11902
+ <!-- update -->
11903
+
11803
11904
  </xsl:stylesheet>
@@ -1080,6 +1080,7 @@
1080
1080
  <xsl:variable name="zero_width_space">​</xsl:variable>
1081
1081
  <xsl:variable name="hair_space"> </xsl:variable>
1082
1082
  <xsl:variable name="en_dash">–</xsl:variable>
1083
+ <xsl:variable name="em_dash">—</xsl:variable>
1083
1084
 
1084
1085
  <xsl:template name="getTitle">
1085
1086
  <xsl:param name="name"/>
@@ -1387,6 +1388,10 @@
1387
1388
 
1388
1389
  </xsl:attribute-set> <!-- example-name-style -->
1389
1390
 
1391
+ <xsl:template name="refine_example-name-style">
1392
+
1393
+ </xsl:template>
1394
+
1390
1395
  <xsl:attribute-set name="example-p-style">
1391
1396
 
1392
1397
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1409,6 +1414,10 @@
1409
1414
 
1410
1415
  </xsl:attribute-set> <!-- termexample-name-style -->
1411
1416
 
1417
+ <xsl:template name="refine_termexample-name-style">
1418
+
1419
+ </xsl:template>
1420
+
1412
1421
  <!-- ========================== -->
1413
1422
  <!-- Table styles -->
1414
1423
  <!-- ========================== -->
@@ -1609,6 +1618,10 @@
1609
1618
 
1610
1619
  </xsl:attribute-set> <!-- table-fn-style -->
1611
1620
 
1621
+ <xsl:template name="refine_table-fn-style">
1622
+
1623
+ </xsl:template>
1624
+
1612
1625
  <xsl:attribute-set name="table-fn-number-style">
1613
1626
  <xsl:attribute name="font-size">80%</xsl:attribute>
1614
1627
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1617,6 +1630,10 @@
1617
1630
 
1618
1631
  </xsl:attribute-set> <!-- table-fn-number-style -->
1619
1632
 
1633
+ <xsl:template name="refine_table-fn-number-style">
1634
+
1635
+ </xsl:template>
1636
+
1620
1637
  <xsl:attribute-set name="fn-container-body-style">
1621
1638
  <xsl:attribute name="text-indent">0</xsl:attribute>
1622
1639
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -3968,8 +3985,9 @@
3968
3985
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3969
3986
 
3970
3987
  <fo:block xsl:use-attribute-sets="table-fn-style">
3971
-
3988
+ <xsl:call-template name="refine_table-fn-style"/>
3972
3989
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3990
+ <xsl:call-template name="refine_table-fn-number-style"/>
3973
3991
 
3974
3992
  <xsl:value-of select="@reference"/>
3975
3993
 
@@ -5105,12 +5123,18 @@
5105
5123
  </xsl:template>
5106
5124
 
5107
5125
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5108
- <xsl:variable name="text" select="normalize-space(.)"/>
5109
- <fo:inline font-size="75%" role="SKIP">
5126
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5127
+ <xsl:variable name="text" select="."/>
5128
+ <xsl:variable name="ratio_">
5129
+ 0.75
5130
+ </xsl:variable>
5131
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5132
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
5110
5133
  <xsl:if test="string-length($text) &gt; 0">
5111
5134
  <xsl:variable name="smallCapsText">
5112
5135
  <xsl:call-template name="recursiveSmallCaps">
5113
5136
  <xsl:with-param name="text" select="$text"/>
5137
+ <xsl:with-param name="ratio" select="$ratio"/>
5114
5138
  </xsl:call-template>
5115
5139
  </xsl:variable>
5116
5140
  <!-- merge neighboring fo:inline -->
@@ -5147,12 +5171,13 @@
5147
5171
 
5148
5172
  <xsl:template name="recursiveSmallCaps">
5149
5173
  <xsl:param name="text"/>
5174
+ <xsl:param name="ratio"/>
5150
5175
  <xsl:variable name="char" select="substring($text,1,1)"/>
5151
5176
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5152
5177
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5153
5178
  <xsl:choose>
5154
5179
  <xsl:when test="$char=$upperCase">
5155
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
5180
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5156
5181
  <xsl:value-of select="$upperCase"/>
5157
5182
  </fo:inline>
5158
5183
  </xsl:when>
@@ -5163,6 +5188,7 @@
5163
5188
  <xsl:if test="string-length($text) &gt; 1">
5164
5189
  <xsl:call-template name="recursiveSmallCaps">
5165
5190
  <xsl:with-param name="text" select="substring($text,2)"/>
5191
+ <xsl:with-param name="ratio" select="$ratio"/>
5166
5192
  </xsl:call-template>
5167
5193
  </xsl:if>
5168
5194
  </xsl:template>
@@ -5199,6 +5225,9 @@
5199
5225
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5200
5226
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5201
5227
  </xsl:if>
5228
+ <xsl:if test="$key = 'text-indent'">
5229
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
5230
+ </xsl:if>
5202
5231
  </xsl:for-each>
5203
5232
  </xsl:variable>
5204
5233
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -6601,6 +6630,11 @@
6601
6630
  </xsl:call-template>
6602
6631
  </xsl:template>
6603
6632
 
6633
+ <!-- command between two xref points to non-standard bibitem -->
6634
+ <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']]]">
6635
+ <xsl:value-of select="."/>
6636
+ </xsl:template>
6637
+
6604
6638
  <!-- ====== -->
6605
6639
  <!-- formula -->
6606
6640
  <!-- ====== -->
@@ -7253,16 +7287,44 @@
7253
7287
  </xsl:choose>
7254
7288
 
7255
7289
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7256
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7257
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7290
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7291
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7292
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7293
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7294
+
7295
+ <!-- Example: -->
7258
7296
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7259
7297
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7260
7298
  <!-- effective height / width = 1.48, 1.4 - with title -->
7261
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7299
+
7300
+ <xsl:variable name="scale_x">
7301
+ <xsl:choose>
7302
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7303
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7304
+ </xsl:when>
7305
+ <xsl:otherwise>1</xsl:otherwise>
7306
+ </xsl:choose>
7307
+ </xsl:variable>
7308
+ <xsl:variable name="scale_y">
7309
+ <xsl:choose>
7310
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7311
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7312
+ </xsl:when>
7313
+ <xsl:otherwise>1</xsl:otherwise>
7314
+ </xsl:choose>
7315
+ </xsl:variable>
7316
+
7317
+ <!-- for images with big height -->
7318
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7262
7319
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7263
7320
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7264
- </xsl:if>
7321
+ </xsl:if> -->
7265
7322
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7323
+
7324
+ <xsl:if test="$scale_y != 1">
7325
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7326
+ </xsl:if>
7327
+
7266
7328
  <xsl:copy-of select="$svg_content"/>
7267
7329
  </fo:instream-foreign-object>
7268
7330
  <!-- </fo:block> -->
@@ -7287,6 +7349,8 @@
7287
7349
  </xsl:attribute>
7288
7350
  </xsl:template>
7289
7351
 
7352
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
7353
+
7290
7354
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7291
7355
  <xsl:copy>
7292
7356
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -7300,8 +7364,13 @@
7300
7364
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7301
7365
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7302
7366
 
7367
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7368
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7369
+
7303
7370
  <xsl:attribute name="width">
7304
7371
  <xsl:choose>
7372
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7373
+ <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>
7305
7374
  <xsl:when test="$width != ''">
7306
7375
  <xsl:value-of select="round($width)"/>
7307
7376
  </xsl:when>
@@ -7310,6 +7379,8 @@
7310
7379
  </xsl:attribute>
7311
7380
  <xsl:attribute name="height">
7312
7381
  <xsl:choose>
7382
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7383
+ <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>
7313
7384
  <xsl:when test="$height != ''">
7314
7385
  <xsl:value-of select="round($height)"/>
7315
7386
  </xsl:when>
@@ -7321,6 +7392,28 @@
7321
7392
  </xsl:copy>
7322
7393
  </xsl:template>
7323
7394
 
7395
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7396
+ <!-- image[@width]/svg -->
7397
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7398
+ <xsl:attribute name="width">
7399
+ <xsl:choose>
7400
+ <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>
7401
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7402
+ </xsl:choose>
7403
+ </xsl:attribute>
7404
+ </xsl:template>
7405
+
7406
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7407
+ <!-- image[@height]/svg -->
7408
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7409
+ <xsl:attribute name="height">
7410
+ <xsl:choose>
7411
+ <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>
7412
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7413
+ </xsl:choose>
7414
+ </xsl:attribute>
7415
+ </xsl:template>
7416
+
7324
7417
  <!-- regex for 'display: inline-block;' -->
7325
7418
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7326
7419
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -8777,6 +8870,7 @@
8777
8870
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
8778
8871
  <xsl:if test="normalize-space() != ''">
8779
8872
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
8873
+ <xsl:call-template name="refine_termexample-name-style"/>
8780
8874
  <xsl:apply-templates/>
8781
8875
  </fo:inline>
8782
8876
  </xsl:if>
@@ -8927,6 +9021,7 @@
8927
9021
  </xsl:when>
8928
9022
  <xsl:otherwise>
8929
9023
  <fo:inline xsl:use-attribute-sets="example-name-style">
9024
+ <xsl:call-template name="refine_example-name-style"/>
8930
9025
  <xsl:apply-templates/>
8931
9026
  </fo:inline>
8932
9027
  </xsl:otherwise>
@@ -9390,7 +9485,9 @@
9390
9485
  </xsl:template> <!-- sections_element_style -->
9391
9486
 
9392
9487
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9393
- <fo:block break-after="page"/>
9488
+
9489
+ <fo:block break-after="page"/>
9490
+
9394
9491
  <fo:block>
9395
9492
  <xsl:call-template name="setId"/>
9396
9493
  <xsl:apply-templates/>
@@ -9462,7 +9559,7 @@
9462
9559
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9463
9560
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9464
9561
  </xsl:when>
9465
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9562
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9466
9563
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9467
9564
  </xsl:when>
9468
9565
  </xsl:choose>
@@ -10136,6 +10233,7 @@
10136
10233
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
10137
10234
 
10138
10235
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
10236
+
10139
10237
  <xsl:call-template name="processBibitem"/>
10140
10238
  </fo:block>
10141
10239
 
@@ -10156,6 +10254,7 @@
10156
10254
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10157
10255
  <xsl:otherwise>
10158
10256
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
10257
+
10159
10258
  <fo:list-item-label end-indent="label-end()">
10160
10259
  <fo:block role="SKIP">
10161
10260
  <fo:inline role="SKIP">
@@ -11928,4 +12027,6 @@
11928
12027
  </xsl:if>
11929
12028
  </xsl:template>
11930
12029
 
12030
+ <!-- update -->
12031
+
11931
12032
  </xsl:stylesheet>
@@ -208,7 +208,9 @@
208
208
  </define>
209
209
  <define name="roledescription">
210
210
  <element name="description">
211
- <ref name="FormattedString"/>
211
+ <oneOrMore>
212
+ <ref name="TextElement"/>
213
+ </oneOrMore>
212
214
  </element>
213
215
  </define>
214
216
  <define name="person">
@@ -333,7 +335,9 @@
333
335
  </define>
334
336
  <define name="affiliationdescription">
335
337
  <element name="description">
336
- <ref name="FormattedString"/>
338
+ <oneOrMore>
339
+ <ref name="TextElement"/>
340
+ </oneOrMore>
337
341
  </element>
338
342
  </define>
339
343
  <define name="organization">
@@ -897,7 +901,9 @@
897
901
  </define>
898
902
  <define name="formattedref">
899
903
  <element name="formattedref">
900
- <ref name="FormattedString"/>
904
+ <oneOrMore>
905
+ <ref name="TextElement"/>
906
+ </oneOrMore>
901
907
  </element>
902
908
  </define>
903
909
  <define name="license">
@@ -942,7 +948,9 @@
942
948
  <optional>
943
949
  <attribute name="type"/>
944
950
  </optional>
945
- <ref name="FormattedString"/>
951
+ <zeroOrMore>
952
+ <ref name="TextElement"/>
953
+ </zeroOrMore>
946
954
  </define>
947
955
  <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
948
956
  <define name="TypedUri">
@@ -1042,7 +1050,9 @@
1042
1050
  <optional>
1043
1051
  <attribute name="script"/>
1044
1052
  </optional>
1045
- <text/>
1053
+ <oneOrMore>
1054
+ <ref name="TextElement"/>
1055
+ </oneOrMore>
1046
1056
  </element>
1047
1057
  </define>
1048
1058
  <define name="docnumber">
@@ -1267,12 +1277,16 @@
1267
1277
  <optional>
1268
1278
  <attribute name="type"/>
1269
1279
  </optional>
1270
- <ref name="FormattedString"/>
1280
+ <oneOrMore>
1281
+ <ref name="TextElement"/>
1282
+ </oneOrMore>
1271
1283
  </element>
1272
1284
  </define>
1273
1285
  <define name="bibabstract">
1274
1286
  <element name="abstract">
1275
- <ref name="FormattedString"/>
1287
+ <oneOrMore>
1288
+ <ref name="TextElement"/>
1289
+ </oneOrMore>
1276
1290
  </element>
1277
1291
  </define>
1278
1292
  <define name="copyright">
@@ -1377,7 +1391,9 @@
1377
1391
  </attribute>
1378
1392
  <optional>
1379
1393
  <element name="description">
1380
- <ref name="FormattedString"/>
1394
+ <oneOrMore>
1395
+ <ref name="TextElement"/>
1396
+ </oneOrMore>
1381
1397
  </element>
1382
1398
  </optional>
1383
1399
  <element name="bibitem">
@@ -59,7 +59,9 @@ module Metanorma
59
59
  dn = "#{dn}(#{abbr})" unless abbr.empty?
60
60
  end
61
61
  id = node.attr("docidentifier") and dn = id
62
- xml.docidentifier { |i| i << dn }
62
+ xml.docidentifier primary: "true" do |i|
63
+ i << dn
64
+ end
63
65
  end
64
66
 
65
67
  def metadata_distribution(node, xml)
@@ -156,44 +156,7 @@
156
156
  </define>
157
157
  <define name="xref">
158
158
  <element name="xref">
159
- <attribute name="target">
160
- <data type="string">
161
- <param name="pattern">\i\c*|\c+#\c+</param>
162
- </data>
163
- </attribute>
164
- <optional>
165
- <attribute name="to">
166
- <data type="string">
167
- <param name="pattern">\i\c*|\c+#\c+</param>
168
- </data>
169
- </attribute>
170
- </optional>
171
- <optional>
172
- <attribute name="type">
173
- <ref name="ReferenceFormat"/>
174
- </attribute>
175
- </optional>
176
- <optional>
177
- <attribute name="alt"/>
178
- </optional>
179
- <optional>
180
- <attribute name="case">
181
- <choice>
182
- <value>capital</value>
183
- <value>lowercase</value>
184
- </choice>
185
- </attribute>
186
- </optional>
187
- <optional>
188
- <attribute name="droploc">
189
- <data type="boolean"/>
190
- </attribute>
191
- </optional>
192
- <optional>
193
- <attribute name="style">
194
- <ref name="XrefStyleType"/>
195
- </attribute>
196
- </optional>
159
+ <ref name="XrefAttributes"/>
197
160
  <ref name="XrefBody"/>
198
161
  </element>
199
162
  </define>
@@ -407,23 +370,7 @@
407
370
  </define>
408
371
  <define name="figure">
409
372
  <element name="figure">
410
- <attribute name="id">
411
- <data type="ID"/>
412
- </attribute>
413
- <optional>
414
- <attribute name="unnumbered">
415
- <data type="boolean"/>
416
- </attribute>
417
- </optional>
418
- <optional>
419
- <attribute name="number"/>
420
- </optional>
421
- <optional>
422
- <attribute name="subsequence"/>
423
- </optional>
424
- <optional>
425
- <attribute name="class"/>
426
- </optional>
373
+ <ref name="FigureAttributes"/>
427
374
  <ref name="BlockAttributes"/>
428
375
  <optional>
429
376
  <ref name="tname"/>
@@ -2450,6 +2397,49 @@
2450
2397
  </zeroOrMore>
2451
2398
  </element>
2452
2399
  </define>
2400
+ <define name="XrefAttributes">
2401
+ <attribute name="target">
2402
+ <data type="string">
2403
+ <param name="pattern">\i\c*|\c+#\c+</param>
2404
+ </data>
2405
+ </attribute>
2406
+ <optional>
2407
+ <attribute name="to">
2408
+ <data type="string">
2409
+ <param name="pattern">\i\c*|\c+#\c+</param>
2410
+ </data>
2411
+ </attribute>
2412
+ </optional>
2413
+ <optional>
2414
+ <attribute name="type">
2415
+ <ref name="ReferenceFormat"/>
2416
+ </attribute>
2417
+ </optional>
2418
+ <optional>
2419
+ <attribute name="alt"/>
2420
+ </optional>
2421
+ <optional>
2422
+ <attribute name="case">
2423
+ <choice>
2424
+ <value>capital</value>
2425
+ <value>lowercase</value>
2426
+ </choice>
2427
+ </attribute>
2428
+ </optional>
2429
+ <optional>
2430
+ <attribute name="droploc">
2431
+ <data type="boolean"/>
2432
+ </attribute>
2433
+ </optional>
2434
+ <optional>
2435
+ <attribute name="style">
2436
+ <ref name="XrefStyleType"/>
2437
+ </attribute>
2438
+ </optional>
2439
+ <optional>
2440
+ <attribute name="label"/>
2441
+ </optional>
2442
+ </define>
2453
2443
  <define name="XrefBody">
2454
2444
  <zeroOrMore>
2455
2445
  <ref name="XrefTarget"/>
@@ -2528,6 +2518,28 @@
2528
2518
  <attribute name="columns"/>
2529
2519
  </optional>
2530
2520
  </define>
2521
+ <define name="FigureAttributes">
2522
+ <attribute name="id">
2523
+ <data type="ID"/>
2524
+ </attribute>
2525
+ <optional>
2526
+ <attribute name="unnumbered">
2527
+ <data type="boolean"/>
2528
+ </attribute>
2529
+ </optional>
2530
+ <optional>
2531
+ <attribute name="number"/>
2532
+ </optional>
2533
+ <optional>
2534
+ <attribute name="subsequence"/>
2535
+ </optional>
2536
+ <optional>
2537
+ <attribute name="class"/>
2538
+ </optional>
2539
+ <optional>
2540
+ <attribute name="width"/>
2541
+ </optional>
2542
+ </define>
2531
2543
  <start>
2532
2544
  <ref name="standard-document"/>
2533
2545
  </start>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.12.4".freeze
3
+ VERSION = "0.12.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.4
4
+ version: 0.12.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-04 00:00:00.000000000 Z
11
+ date: 2024-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639