metanorma-un 0.9.10 → 0.9.12

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: 7b7eed9a4ee7a8a2f881a16841acb2d6d9310618d61b27994d70eebb9e0c2cc1
4
- data.tar.gz: '00018c02bdbbec199661eb6e5aa43b09240a22948528a9fde135142445c82d5b'
3
+ metadata.gz: 2a6c281824f078936a2b881891ea6eb6986bbc13e5f6dfcdf0c491afe4809ad9
4
+ data.tar.gz: bd04e7c40788f7740898a032785f053b2f0fdc4923244329c2c220826567f1d7
5
5
  SHA512:
6
- metadata.gz: 63e67ef5e0bf08d8823bad86046701935fa38bec6e21fbdac22033903a49290dd0b854d564f8468625d9c28a3bfc217ce74b8582dfde386a689ea4c1c2dccc40
7
- data.tar.gz: 377c2a773f8c9d230506070943113c01009a49673607c92e93a4946b9ca060cc087f1ee8909fe8e6999a19c6a46b5e31df74359899a0a0eae5d614acd96162ec
6
+ metadata.gz: 50777f8af8469db384484c93ed2aed4a9f257993235773dfd57e4ac83240da12ea422b7d5f035b9cf7a32e20b12db1ac5f7020b37014f96429711b1f4c4ed176
7
+ data.tar.gz: 53ca280f48bc9f9ac05478088b41ad1382144e68114286ef6978a9e38f8b677979ca6363c4238d36afa5fa63d7621f9c92665cd8aee2c1a8177c07f6945ef6c9
@@ -389,7 +389,7 @@ p {
389
389
  font-weight: 700;
390
390
  font-size: 1em;
391
391
  text-align: center; }
392
- .figure > img {
392
+ .figure > img, .figure > svg {
393
393
  margin-left: auto;
394
394
  margin-right: auto;
395
395
  display: block;
@@ -212,7 +212,7 @@
212
212
  <xsl:variable name="charsToRemove" select="concat($upper, $lower, '.()~!@#$%^*-+:')"/>
213
213
  <xsl:variable name="code" select="translate(/un:un-standard/un:bibdata/un:docidentifier, $charsToRemove,'')"/>
214
214
 
215
- <fo:block-container absolute-position="fixed" left="20mm" top="258mm" width="30mm" text-align="center">
215
+ <fo:block-container absolute-position="fixed" left="20mm" top="258mm" width="30mm" text-align="center" id="__internal_layout__barcode_{generate-id()}">
216
216
  <fo:block font-size="10pt" text-align="left">
217
217
  <xsl:value-of select="/un:un-standard/un:bibdata/un:docidentifier"/>
218
218
  </fo:block>
@@ -284,7 +284,7 @@
284
284
  </xsl:if>
285
285
 
286
286
  <!-- Preface Pages (except Abstract, that showed in Summary on cover page`) -->
287
- <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() != 'note' or local-name() != 'admonition')]">
287
+ <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() = 'note' or local-name() = 'admonition')]">
288
288
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
289
289
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
290
290
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']"/>
@@ -375,17 +375,11 @@
375
375
  <fo:table-column column-width="17mm"/>
376
376
  <fo:table-body>
377
377
  <fo:table-row>
378
- <fo:table-cell padding-left="6mm" padding-top="2.5mm">
378
+ <fo:table-cell padding-left="6mm" padding-top="2.5mm" number-columns-spanned="3">
379
379
  <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt" role="H2">
380
380
  <xsl:apply-templates select="un:title/node()"/>
381
381
  </fo:block>
382
382
  </fo:table-cell>
383
- <fo:table-cell>
384
- <fo:block> </fo:block>
385
- </fo:table-cell>
386
- <fo:table-cell>
387
- <fo:block> </fo:block>
388
- </fo:table-cell>
389
383
  </fo:table-row>
390
384
  <fo:table-row>
391
385
  <fo:table-cell>
@@ -1251,6 +1245,11 @@
1251
1245
  </xsl:variable>
1252
1246
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1253
1247
 
1248
+ <xsl:variable name="table-cell-border_">
1249
+
1250
+ </xsl:variable>
1251
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
1252
+
1254
1253
  <xsl:attribute-set name="table-container-style">
1255
1254
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1256
1255
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1263,8 +1262,6 @@
1263
1262
  <xsl:attribute-set name="table-style">
1264
1263
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1265
1264
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1266
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1267
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1268
1265
 
1269
1266
  <xsl:attribute name="border-top">0.5pt solid black</xsl:attribute>
1270
1267
 
@@ -2374,10 +2371,18 @@
2374
2371
  <xsl:variable name="table_attributes">
2375
2372
 
2376
2373
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
2374
+
2375
+ <xsl:if test="$margin-side != 0">
2376
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2377
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2378
+ </xsl:if>
2379
+
2377
2380
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2378
2381
 
2379
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2380
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2382
+ <xsl:if test="$margin-side != 0">
2383
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2384
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2385
+ </xsl:if>
2381
2386
 
2382
2387
  </xsl:element>
2383
2388
  </xsl:variable>
@@ -3130,6 +3135,10 @@
3130
3135
  <xsl:template match="*[local-name()='tr']">
3131
3136
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3132
3137
 
3138
+ <xsl:if test="*[local-name() = 'th']">
3139
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3140
+ </xsl:if>
3141
+
3133
3142
  <xsl:call-template name="setTableRowAttributes"/>
3134
3143
  <xsl:apply-templates/>
3135
3144
  </fo:table-row>
@@ -4173,8 +4182,17 @@
4173
4182
  </fo:inline>
4174
4183
  </xsl:template> <!-- tt -->
4175
4184
 
4185
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4176
4186
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4177
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4187
+ <xsl:choose>
4188
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4189
+ <!-- url -->
4190
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4191
+ </xsl:when>
4192
+ <xsl:otherwise>
4193
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4194
+ </xsl:otherwise>
4195
+ </xsl:choose>
4178
4196
  </xsl:template>
4179
4197
 
4180
4198
  <xsl:template match="*[local-name()='underline']">
@@ -4530,8 +4548,11 @@
4530
4548
 
4531
4549
  <xsl:template name="add-zero-spaces-link-java">
4532
4550
  <xsl:param name="text" select="."/>
4551
+
4552
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4553
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4533
4554
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4534
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4555
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4535
4556
  </xsl:template>
4536
4557
 
4537
4558
  <!-- add zero space after dash character (for table's entries) -->
@@ -5088,6 +5109,9 @@
5088
5109
  <xsl:value-of select="substring($str, 2)"/>
5089
5110
  </xsl:template>
5090
5111
 
5112
+ <!-- ======================================= -->
5113
+ <!-- math -->
5114
+ <!-- ======================================= -->
5091
5115
  <xsl:template match="mathml:math">
5092
5116
  <xsl:variable name="isAdded" select="@added"/>
5093
5117
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5138,14 +5162,57 @@
5138
5162
  <xsl:value-of select="$comment_text"/>
5139
5163
  </xsl:template>
5140
5164
 
5165
+ <xsl:template match="*[local-name() = 'asciimath']">
5166
+ <xsl:param name="process" select="'false'"/>
5167
+ <xsl:if test="$process = 'true'">
5168
+ <xsl:apply-templates/>
5169
+ </xsl:if>
5170
+ </xsl:template>
5171
+
5172
+ <xsl:template match="*[local-name() = 'latexmath']"/>
5173
+
5174
+ <xsl:template name="getMathml_asciimath_text">
5175
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
5176
+ <xsl:variable name="latexmath">
5177
+
5178
+ </xsl:variable>
5179
+ <xsl:variable name="asciimath_text_following">
5180
+ <xsl:choose>
5181
+ <xsl:when test="normalize-space($latexmath) != ''">
5182
+ <xsl:value-of select="$latexmath"/>
5183
+ </xsl:when>
5184
+ <xsl:when test="normalize-space($asciimath) != ''">
5185
+ <xsl:value-of select="$asciimath"/>
5186
+ </xsl:when>
5187
+ <xsl:otherwise>
5188
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
5189
+ </xsl:otherwise>
5190
+ </xsl:choose>
5191
+ </xsl:variable>
5192
+ <xsl:variable name="asciimath_text_">
5193
+ <xsl:choose>
5194
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
5195
+ <xsl:value-of select="$asciimath_text_following"/>
5196
+ </xsl:when>
5197
+ <xsl:otherwise>
5198
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5199
+ </xsl:otherwise>
5200
+ </xsl:choose>
5201
+ </xsl:variable>
5202
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
5203
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
5204
+ <xsl:value-of select="$asciimath_text"/>
5205
+ </xsl:template>
5206
+
5141
5207
  <xsl:template name="mathml_instream_object">
5142
- <xsl:param name="comment_text"/>
5208
+ <xsl:param name="asciimath_text"/>
5143
5209
  <xsl:param name="mathml_content"/>
5144
5210
 
5145
- <xsl:variable name="comment_text_">
5211
+ <xsl:variable name="asciimath_text_">
5146
5212
  <xsl:choose>
5147
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5148
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5213
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
5214
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
5215
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
5149
5216
  </xsl:choose>
5150
5217
  </xsl:variable>
5151
5218
 
@@ -5162,10 +5229,10 @@
5162
5229
  </xsl:attribute>
5163
5230
 
5164
5231
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5165
- <xsl:if test="normalize-space($comment_text_) != ''">
5232
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
5166
5233
  <!-- put Mathin Alternate Text -->
5167
5234
  <xsl:attribute name="fox:alt-text">
5168
- <xsl:value-of select="$comment_text_"/>
5235
+ <xsl:value-of select="$asciimath_text_"/>
5169
5236
  </xsl:attribute>
5170
5237
  </xsl:if>
5171
5238
  <!-- </xsl:if> -->
@@ -5238,6 +5305,29 @@
5238
5305
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5239
5306
  </xsl:template>
5240
5307
 
5308
+ <!-- Examples:
5309
+ <stem type="AsciiMath">x = 1</stem>
5310
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
5311
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
5312
+ -->
5313
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5314
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5315
+
5316
+ <xsl:choose>
5317
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5318
+ <xsl:otherwise>
5319
+ <xsl:apply-templates>
5320
+ <xsl:with-param name="process">true</xsl:with-param>
5321
+ </xsl:apply-templates>
5322
+ </xsl:otherwise>
5323
+ </xsl:choose>
5324
+
5325
+ </fo:inline>
5326
+ </xsl:template>
5327
+ <!-- ======================================= -->
5328
+ <!-- END: math -->
5329
+ <!-- ======================================= -->
5330
+
5241
5331
  <xsl:template match="*[local-name()='localityStack']"/>
5242
5332
 
5243
5333
  <xsl:template match="*[local-name()='link']" name="link">
@@ -7936,6 +8026,10 @@
7936
8026
 
7937
8027
  <fo:list-block xsl:use-attribute-sets="list-style">
7938
8028
 
8029
+ <xsl:if test="local-name() = 'ol'">
8030
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
8031
+ </xsl:if>
8032
+
7939
8033
  <xsl:if test="*[local-name() = 'name']">
7940
8034
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
7941
8035
  </xsl:if>
@@ -8933,7 +9027,7 @@
8933
9027
 
8934
9028
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8935
9029
 
8936
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9030
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8937
9031
 
8938
9032
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8939
9033
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -9409,13 +9503,14 @@
9409
9503
  </xsl:template>
9410
9504
 
9411
9505
  <xsl:template name="setId">
9506
+ <xsl:param name="prefix"/>
9412
9507
  <xsl:attribute name="id">
9413
9508
  <xsl:choose>
9414
9509
  <xsl:when test="@id">
9415
- <xsl:value-of select="@id"/>
9510
+ <xsl:value-of select="concat($prefix, @id)"/>
9416
9511
  </xsl:when>
9417
9512
  <xsl:otherwise>
9418
- <xsl:value-of select="generate-id()"/>
9513
+ <xsl:value-of select="concat($prefix, generate-id())"/>
9419
9514
  </xsl:otherwise>
9420
9515
  </xsl:choose>
9421
9516
  </xsl:attribute>
@@ -212,7 +212,7 @@
212
212
  <xsl:variable name="charsToRemove" select="concat($upper, $lower, '.()~!@#$%^*-+:')"/>
213
213
  <xsl:variable name="code" select="translate(/un:un-standard/un:bibdata/un:docidentifier, $charsToRemove,'')"/>
214
214
 
215
- <fo:block-container absolute-position="fixed" left="20mm" top="258mm" width="30mm" text-align="center">
215
+ <fo:block-container absolute-position="fixed" left="20mm" top="258mm" width="30mm" text-align="center" id="__internal_layout__barcode_{generate-id()}">
216
216
  <fo:block font-size="10pt" text-align="left">
217
217
  <xsl:value-of select="/un:un-standard/un:bibdata/un:docidentifier"/>
218
218
  </fo:block>
@@ -284,7 +284,7 @@
284
284
  </xsl:if>
285
285
 
286
286
  <!-- Preface Pages (except Abstract, that showed in Summary on cover page`) -->
287
- <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() != 'note' or local-name() != 'admonition')]">
287
+ <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() = 'note' or local-name() = 'admonition')]">
288
288
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
289
289
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
290
290
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']"/>
@@ -375,17 +375,11 @@
375
375
  <fo:table-column column-width="17mm"/>
376
376
  <fo:table-body>
377
377
  <fo:table-row>
378
- <fo:table-cell padding-left="6mm" padding-top="2.5mm">
378
+ <fo:table-cell padding-left="6mm" padding-top="2.5mm" number-columns-spanned="3">
379
379
  <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt" role="H2">
380
380
  <xsl:apply-templates select="un:title/node()"/>
381
381
  </fo:block>
382
382
  </fo:table-cell>
383
- <fo:table-cell>
384
- <fo:block> </fo:block>
385
- </fo:table-cell>
386
- <fo:table-cell>
387
- <fo:block> </fo:block>
388
- </fo:table-cell>
389
383
  </fo:table-row>
390
384
  <fo:table-row>
391
385
  <fo:table-cell>
@@ -1251,6 +1245,11 @@
1251
1245
  </xsl:variable>
1252
1246
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1253
1247
 
1248
+ <xsl:variable name="table-cell-border_">
1249
+
1250
+ </xsl:variable>
1251
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
1252
+
1254
1253
  <xsl:attribute-set name="table-container-style">
1255
1254
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1256
1255
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1263,8 +1262,6 @@
1263
1262
  <xsl:attribute-set name="table-style">
1264
1263
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1265
1264
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1266
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1267
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1268
1265
 
1269
1266
  <xsl:attribute name="border-top">0.5pt solid black</xsl:attribute>
1270
1267
 
@@ -2374,10 +2371,18 @@
2374
2371
  <xsl:variable name="table_attributes">
2375
2372
 
2376
2373
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
2374
+
2375
+ <xsl:if test="$margin-side != 0">
2376
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2377
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2378
+ </xsl:if>
2379
+
2377
2380
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2378
2381
 
2379
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2380
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2382
+ <xsl:if test="$margin-side != 0">
2383
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2384
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2385
+ </xsl:if>
2381
2386
 
2382
2387
  </xsl:element>
2383
2388
  </xsl:variable>
@@ -3130,6 +3135,10 @@
3130
3135
  <xsl:template match="*[local-name()='tr']">
3131
3136
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3132
3137
 
3138
+ <xsl:if test="*[local-name() = 'th']">
3139
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3140
+ </xsl:if>
3141
+
3133
3142
  <xsl:call-template name="setTableRowAttributes"/>
3134
3143
  <xsl:apply-templates/>
3135
3144
  </fo:table-row>
@@ -4173,8 +4182,17 @@
4173
4182
  </fo:inline>
4174
4183
  </xsl:template> <!-- tt -->
4175
4184
 
4185
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4176
4186
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4177
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4187
+ <xsl:choose>
4188
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4189
+ <!-- url -->
4190
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4191
+ </xsl:when>
4192
+ <xsl:otherwise>
4193
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4194
+ </xsl:otherwise>
4195
+ </xsl:choose>
4178
4196
  </xsl:template>
4179
4197
 
4180
4198
  <xsl:template match="*[local-name()='underline']">
@@ -4530,8 +4548,11 @@
4530
4548
 
4531
4549
  <xsl:template name="add-zero-spaces-link-java">
4532
4550
  <xsl:param name="text" select="."/>
4551
+
4552
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4553
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4533
4554
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4534
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4555
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4535
4556
  </xsl:template>
4536
4557
 
4537
4558
  <!-- add zero space after dash character (for table's entries) -->
@@ -5088,6 +5109,9 @@
5088
5109
  <xsl:value-of select="substring($str, 2)"/>
5089
5110
  </xsl:template>
5090
5111
 
5112
+ <!-- ======================================= -->
5113
+ <!-- math -->
5114
+ <!-- ======================================= -->
5091
5115
  <xsl:template match="mathml:math">
5092
5116
  <xsl:variable name="isAdded" select="@added"/>
5093
5117
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5138,14 +5162,57 @@
5138
5162
  <xsl:value-of select="$comment_text"/>
5139
5163
  </xsl:template>
5140
5164
 
5165
+ <xsl:template match="*[local-name() = 'asciimath']">
5166
+ <xsl:param name="process" select="'false'"/>
5167
+ <xsl:if test="$process = 'true'">
5168
+ <xsl:apply-templates/>
5169
+ </xsl:if>
5170
+ </xsl:template>
5171
+
5172
+ <xsl:template match="*[local-name() = 'latexmath']"/>
5173
+
5174
+ <xsl:template name="getMathml_asciimath_text">
5175
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
5176
+ <xsl:variable name="latexmath">
5177
+
5178
+ </xsl:variable>
5179
+ <xsl:variable name="asciimath_text_following">
5180
+ <xsl:choose>
5181
+ <xsl:when test="normalize-space($latexmath) != ''">
5182
+ <xsl:value-of select="$latexmath"/>
5183
+ </xsl:when>
5184
+ <xsl:when test="normalize-space($asciimath) != ''">
5185
+ <xsl:value-of select="$asciimath"/>
5186
+ </xsl:when>
5187
+ <xsl:otherwise>
5188
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
5189
+ </xsl:otherwise>
5190
+ </xsl:choose>
5191
+ </xsl:variable>
5192
+ <xsl:variable name="asciimath_text_">
5193
+ <xsl:choose>
5194
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
5195
+ <xsl:value-of select="$asciimath_text_following"/>
5196
+ </xsl:when>
5197
+ <xsl:otherwise>
5198
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5199
+ </xsl:otherwise>
5200
+ </xsl:choose>
5201
+ </xsl:variable>
5202
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
5203
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
5204
+ <xsl:value-of select="$asciimath_text"/>
5205
+ </xsl:template>
5206
+
5141
5207
  <xsl:template name="mathml_instream_object">
5142
- <xsl:param name="comment_text"/>
5208
+ <xsl:param name="asciimath_text"/>
5143
5209
  <xsl:param name="mathml_content"/>
5144
5210
 
5145
- <xsl:variable name="comment_text_">
5211
+ <xsl:variable name="asciimath_text_">
5146
5212
  <xsl:choose>
5147
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5148
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5213
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
5214
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
5215
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
5149
5216
  </xsl:choose>
5150
5217
  </xsl:variable>
5151
5218
 
@@ -5162,10 +5229,10 @@
5162
5229
  </xsl:attribute>
5163
5230
 
5164
5231
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5165
- <xsl:if test="normalize-space($comment_text_) != ''">
5232
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
5166
5233
  <!-- put Mathin Alternate Text -->
5167
5234
  <xsl:attribute name="fox:alt-text">
5168
- <xsl:value-of select="$comment_text_"/>
5235
+ <xsl:value-of select="$asciimath_text_"/>
5169
5236
  </xsl:attribute>
5170
5237
  </xsl:if>
5171
5238
  <!-- </xsl:if> -->
@@ -5238,6 +5305,29 @@
5238
5305
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5239
5306
  </xsl:template>
5240
5307
 
5308
+ <!-- Examples:
5309
+ <stem type="AsciiMath">x = 1</stem>
5310
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
5311
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
5312
+ -->
5313
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5314
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5315
+
5316
+ <xsl:choose>
5317
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5318
+ <xsl:otherwise>
5319
+ <xsl:apply-templates>
5320
+ <xsl:with-param name="process">true</xsl:with-param>
5321
+ </xsl:apply-templates>
5322
+ </xsl:otherwise>
5323
+ </xsl:choose>
5324
+
5325
+ </fo:inline>
5326
+ </xsl:template>
5327
+ <!-- ======================================= -->
5328
+ <!-- END: math -->
5329
+ <!-- ======================================= -->
5330
+
5241
5331
  <xsl:template match="*[local-name()='localityStack']"/>
5242
5332
 
5243
5333
  <xsl:template match="*[local-name()='link']" name="link">
@@ -7936,6 +8026,10 @@
7936
8026
 
7937
8027
  <fo:list-block xsl:use-attribute-sets="list-style">
7938
8028
 
8029
+ <xsl:if test="local-name() = 'ol'">
8030
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
8031
+ </xsl:if>
8032
+
7939
8033
  <xsl:if test="*[local-name() = 'name']">
7940
8034
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
7941
8035
  </xsl:if>
@@ -8933,7 +9027,7 @@
8933
9027
 
8934
9028
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8935
9029
 
8936
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9030
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8937
9031
 
8938
9032
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8939
9033
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -9409,13 +9503,14 @@
9409
9503
  </xsl:template>
9410
9504
 
9411
9505
  <xsl:template name="setId">
9506
+ <xsl:param name="prefix"/>
9412
9507
  <xsl:attribute name="id">
9413
9508
  <xsl:choose>
9414
9509
  <xsl:when test="@id">
9415
- <xsl:value-of select="@id"/>
9510
+ <xsl:value-of select="concat($prefix, @id)"/>
9416
9511
  </xsl:when>
9417
9512
  <xsl:otherwise>
9418
- <xsl:value-of select="generate-id()"/>
9513
+ <xsl:value-of select="concat($prefix, generate-id())"/>
9419
9514
  </xsl:otherwise>
9420
9515
  </xsl:choose>
9421
9516
  </xsl:attribute>