metanorma-m3aawg 2.1.10 → 2.1.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: cc9281e2f8c3af7ccb5e07f8c71de9a2cf39f08dc252ec72e52400677bb90c94
4
- data.tar.gz: ef50d0fc782ce16d3030bc07af30708ac9ea55585e731d319d7fd552385d31e2
3
+ metadata.gz: 7063dbb2d2913a6dd0f2c6dc57e59093d49a47fe58054e7466627471480d16f5
4
+ data.tar.gz: a2e88be007d2b2f03cb10e0f1e8a14b52bdf0885d561109a3877f6eb42323bbb
5
5
  SHA512:
6
- metadata.gz: 7e4890c117d9232388551e99e7306314140faf4437514e0aafa1ccfe60fe2ea7b7099aacab53132b9579592e5f620d25619fca2d990d2ef355b56af71eb4e39d
7
- data.tar.gz: fc32e445697e8432e0ca7e18f0c16db8fa4b7d5676dd9222adbf19ed598271a5ae91d109205271c0e7a3216a7d0446a577df7108ee5f51ef7fb1b51e2ebd32fd
6
+ metadata.gz: 6a59bb5425e6fad085e9ecf00b1db6fb6c509a47ea0c49abeb30be44e62dcef94f53f33738dd7d11c87e4e99db4113bb070d95bbbb7fc06188849e561055053c
7
+ data.tar.gz: 9b3445fa1af9b8e0f71aab50dd18827e0e0f18b562fa2f627fc3180ecf226c372529f6f9ebff4cfc2c73755f0417cc421153a8a48abff3030c33b559165af4c5
@@ -408,7 +408,7 @@ div.figure {
408
408
  font-weight: 700;
409
409
  font-size: 1em;
410
410
  text-align: center; }
411
- div.figure > img {
411
+ div.figure > img, div.figure > svg {
412
412
  margin-left: auto;
413
413
  margin-right: auto;
414
414
  display: block;
@@ -51,9 +51,9 @@
51
51
  </fo:simple-page-master>
52
52
 
53
53
  <fo:simple-page-master master-name="last" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
54
- <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
54
+ <fo:region-body margin-top="20mm" margin-bottom="54mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
55
55
  <fo:region-before region-name="header" extent="{$marginTop}mm"/>
56
- <fo:region-after region-name="footer-last" extent="53mm"/>
56
+ <fo:region-after region-name="footer-last" extent="53.2mm"/>
57
57
  <fo:region-start region-name="left-region" extent="17.3mm"/>
58
58
  <fo:region-end region-name="right-region" extent="17.3mm"/>
59
59
  </fo:simple-page-master>
@@ -104,7 +104,7 @@
104
104
  </fo:block-container>
105
105
  </fo:static-content>
106
106
  <fo:static-content flow-name="footer" role="artifact">
107
- <fo:block-container height="31mm" font-size="10pt">
107
+ <fo:block-container font-size="10pt">
108
108
  <fo:block text-align-last="justify" margin-top="2mm">
109
109
  <fo:inline font-weight="bold">
110
110
  <fo:inline>M<fo:inline font-size="6.5pt" vertical-align="super">3</fo:inline>AAWG </fo:inline>
@@ -216,7 +216,7 @@
216
216
  <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
217
217
  <xsl:choose>
218
218
  <xsl:when test="@section = ''">
219
- <fo:table table-layout="fixed" width="100%">
219
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__price_toc_{generate-id()}">
220
220
  <fo:table-column column-width="180mm"/>
221
221
  <fo:table-body>
222
222
  <fo:table-row height="6mm">
@@ -241,7 +241,7 @@
241
241
  </fo:table>
242
242
  </xsl:when>
243
243
  <xsl:otherwise>
244
- <fo:table table-layout="fixed" width="100%">
244
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__price_toc_{generate-id()}">
245
245
  <fo:table-column column-width="5mm"/> <!-- 25mm -->
246
246
  <fo:table-column column-width="175mm"/> <!-- 155mm -->
247
247
  <fo:table-body>
@@ -1051,6 +1051,14 @@
1051
1051
 
1052
1052
  </xsl:attribute-set>
1053
1053
 
1054
+ <xsl:attribute-set name="pre-style">
1055
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1056
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1057
+
1058
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1059
+
1060
+ </xsl:attribute-set>
1061
+
1054
1062
  <xsl:attribute-set name="permission-style">
1055
1063
 
1056
1064
  </xsl:attribute-set>
@@ -1160,6 +1168,11 @@
1160
1168
  </xsl:variable>
1161
1169
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1162
1170
 
1171
+ <xsl:variable name="table-cell-border_">
1172
+
1173
+ </xsl:variable>
1174
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
1175
+
1163
1176
  <xsl:attribute-set name="table-container-style">
1164
1177
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1165
1178
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1169,8 +1182,6 @@
1169
1182
  <xsl:attribute-set name="table-style">
1170
1183
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1171
1184
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1172
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1173
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1174
1185
 
1175
1186
  </xsl:attribute-set><!-- table-style -->
1176
1187
 
@@ -2266,10 +2277,18 @@
2266
2277
  <xsl:variable name="table_attributes">
2267
2278
 
2268
2279
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
2280
+
2281
+ <xsl:if test="$margin-side != 0">
2282
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2283
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2284
+ </xsl:if>
2285
+
2269
2286
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2270
2287
 
2271
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2272
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2288
+ <xsl:if test="$margin-side != 0">
2289
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2290
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2291
+ </xsl:if>
2273
2292
 
2274
2293
  </xsl:element>
2275
2294
  </xsl:variable>
@@ -3025,6 +3044,10 @@
3025
3044
  <xsl:template match="*[local-name()='tr']">
3026
3045
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3027
3046
 
3047
+ <xsl:if test="*[local-name() = 'th']">
3048
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3049
+ </xsl:if>
3050
+
3028
3051
  <xsl:call-template name="setTableRowAttributes"/>
3029
3052
  <xsl:apply-templates/>
3030
3053
  </fo:table-row>
@@ -4065,8 +4088,17 @@
4065
4088
  </fo:inline>
4066
4089
  </xsl:template> <!-- tt -->
4067
4090
 
4091
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4068
4092
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4069
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4093
+ <xsl:choose>
4094
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4095
+ <!-- url -->
4096
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4097
+ </xsl:when>
4098
+ <xsl:otherwise>
4099
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4100
+ </xsl:otherwise>
4101
+ </xsl:choose>
4070
4102
  </xsl:template>
4071
4103
 
4072
4104
  <xsl:template match="*[local-name()='underline']">
@@ -4422,8 +4454,11 @@
4422
4454
 
4423
4455
  <xsl:template name="add-zero-spaces-link-java">
4424
4456
  <xsl:param name="text" select="."/>
4457
+
4458
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4459
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4425
4460
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4426
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4461
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4427
4462
  </xsl:template>
4428
4463
 
4429
4464
  <!-- add zero space after dash character (for table's entries) -->
@@ -4980,6 +5015,9 @@
4980
5015
  <xsl:value-of select="substring($str, 2)"/>
4981
5016
  </xsl:template>
4982
5017
 
5018
+ <!-- ======================================= -->
5019
+ <!-- math -->
5020
+ <!-- ======================================= -->
4983
5021
  <xsl:template match="mathml:math">
4984
5022
  <xsl:variable name="isAdded" select="@added"/>
4985
5023
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5030,14 +5068,57 @@
5030
5068
  <xsl:value-of select="$comment_text"/>
5031
5069
  </xsl:template>
5032
5070
 
5071
+ <xsl:template match="*[local-name() = 'asciimath']">
5072
+ <xsl:param name="process" select="'false'"/>
5073
+ <xsl:if test="$process = 'true'">
5074
+ <xsl:apply-templates/>
5075
+ </xsl:if>
5076
+ </xsl:template>
5077
+
5078
+ <xsl:template match="*[local-name() = 'latexmath']"/>
5079
+
5080
+ <xsl:template name="getMathml_asciimath_text">
5081
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
5082
+ <xsl:variable name="latexmath">
5083
+
5084
+ </xsl:variable>
5085
+ <xsl:variable name="asciimath_text_following">
5086
+ <xsl:choose>
5087
+ <xsl:when test="normalize-space($latexmath) != ''">
5088
+ <xsl:value-of select="$latexmath"/>
5089
+ </xsl:when>
5090
+ <xsl:when test="normalize-space($asciimath) != ''">
5091
+ <xsl:value-of select="$asciimath"/>
5092
+ </xsl:when>
5093
+ <xsl:otherwise>
5094
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
5095
+ </xsl:otherwise>
5096
+ </xsl:choose>
5097
+ </xsl:variable>
5098
+ <xsl:variable name="asciimath_text_">
5099
+ <xsl:choose>
5100
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
5101
+ <xsl:value-of select="$asciimath_text_following"/>
5102
+ </xsl:when>
5103
+ <xsl:otherwise>
5104
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5105
+ </xsl:otherwise>
5106
+ </xsl:choose>
5107
+ </xsl:variable>
5108
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
5109
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
5110
+ <xsl:value-of select="$asciimath_text"/>
5111
+ </xsl:template>
5112
+
5033
5113
  <xsl:template name="mathml_instream_object">
5034
- <xsl:param name="comment_text"/>
5114
+ <xsl:param name="asciimath_text"/>
5035
5115
  <xsl:param name="mathml_content"/>
5036
5116
 
5037
- <xsl:variable name="comment_text_">
5117
+ <xsl:variable name="asciimath_text_">
5038
5118
  <xsl:choose>
5039
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5040
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5119
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
5120
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
5121
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
5041
5122
  </xsl:choose>
5042
5123
  </xsl:variable>
5043
5124
 
@@ -5054,10 +5135,10 @@
5054
5135
  </xsl:attribute>
5055
5136
 
5056
5137
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5057
- <xsl:if test="normalize-space($comment_text_) != ''">
5138
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
5058
5139
  <!-- put Mathin Alternate Text -->
5059
5140
  <xsl:attribute name="fox:alt-text">
5060
- <xsl:value-of select="$comment_text_"/>
5141
+ <xsl:value-of select="$asciimath_text_"/>
5061
5142
  </xsl:attribute>
5062
5143
  </xsl:if>
5063
5144
  <!-- </xsl:if> -->
@@ -5130,6 +5211,29 @@
5130
5211
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5131
5212
  </xsl:template>
5132
5213
 
5214
+ <!-- Examples:
5215
+ <stem type="AsciiMath">x = 1</stem>
5216
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
5217
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
5218
+ -->
5219
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5220
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5221
+
5222
+ <xsl:choose>
5223
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5224
+ <xsl:otherwise>
5225
+ <xsl:apply-templates>
5226
+ <xsl:with-param name="process">true</xsl:with-param>
5227
+ </xsl:apply-templates>
5228
+ </xsl:otherwise>
5229
+ </xsl:choose>
5230
+
5231
+ </fo:inline>
5232
+ </xsl:template>
5233
+ <!-- ======================================= -->
5234
+ <!-- END: math -->
5235
+ <!-- ======================================= -->
5236
+
5133
5237
  <xsl:template match="*[local-name()='localityStack']"/>
5134
5238
 
5135
5239
  <xsl:template match="*[local-name()='link']" name="link">
@@ -6472,9 +6576,9 @@
6472
6576
  <xsl:apply-templates mode="contents_item"/>
6473
6577
  </xsl:template>
6474
6578
 
6475
- <!-- ====== -->
6476
- <!-- sourcecode -->
6477
- <!-- ====== -->
6579
+ <!-- =============== -->
6580
+ <!-- sourcecode -->
6581
+ <!-- =============== -->
6478
6582
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6479
6583
 
6480
6584
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -6771,8 +6875,22 @@
6771
6875
  </fo:block>
6772
6876
  </xsl:if>
6773
6877
  </xsl:template>
6774
- <!-- ====== -->
6775
- <!-- ====== -->
6878
+ <!-- =============== -->
6879
+ <!-- END sourcecode -->
6880
+ <!-- =============== -->
6881
+
6882
+ <!-- =============== -->
6883
+ <!-- pre -->
6884
+ <!-- =============== -->
6885
+ <xsl:template match="*[local-name()='pre']" name="pre">
6886
+ <fo:block xsl:use-attribute-sets="pre-style">
6887
+ <xsl:copy-of select="@id"/>
6888
+ <xsl:apply-templates/>
6889
+ </fo:block>
6890
+ </xsl:template>
6891
+ <!-- =============== -->
6892
+ <!-- pre -->
6893
+ <!-- =============== -->
6776
6894
 
6777
6895
  <!-- ========== -->
6778
6896
  <!-- permission -->
@@ -8851,7 +8969,7 @@
8851
8969
 
8852
8970
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8853
8971
 
8854
- <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">
8972
+ <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">
8855
8973
 
8856
8974
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8857
8975
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -9327,13 +9445,14 @@
9327
9445
  </xsl:template>
9328
9446
 
9329
9447
  <xsl:template name="setId">
9448
+ <xsl:param name="prefix"/>
9330
9449
  <xsl:attribute name="id">
9331
9450
  <xsl:choose>
9332
9451
  <xsl:when test="@id">
9333
- <xsl:value-of select="@id"/>
9452
+ <xsl:value-of select="concat($prefix, @id)"/>
9334
9453
  </xsl:when>
9335
9454
  <xsl:otherwise>
9336
- <xsl:value-of select="generate-id()"/>
9455
+ <xsl:value-of select="concat($prefix, generate-id())"/>
9337
9456
  </xsl:otherwise>
9338
9457
  </xsl:choose>
9339
9458
  </xsl:attribute>
@@ -51,9 +51,9 @@
51
51
  </fo:simple-page-master>
52
52
 
53
53
  <fo:simple-page-master master-name="last" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
54
- <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
54
+ <fo:region-body margin-top="20mm" margin-bottom="54mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
55
55
  <fo:region-before region-name="header" extent="{$marginTop}mm"/>
56
- <fo:region-after region-name="footer-last" extent="53mm"/>
56
+ <fo:region-after region-name="footer-last" extent="53.2mm"/>
57
57
  <fo:region-start region-name="left-region" extent="17.3mm"/>
58
58
  <fo:region-end region-name="right-region" extent="17.3mm"/>
59
59
  </fo:simple-page-master>
@@ -104,7 +104,7 @@
104
104
  </fo:block-container>
105
105
  </fo:static-content>
106
106
  <fo:static-content flow-name="footer" role="artifact">
107
- <fo:block-container height="31mm" font-size="10pt">
107
+ <fo:block-container font-size="10pt">
108
108
  <fo:block text-align-last="justify" margin-top="2mm">
109
109
  <fo:inline font-weight="bold">
110
110
  <fo:inline>M<fo:inline font-size="6.5pt" vertical-align="super">3</fo:inline>AAWG </fo:inline>
@@ -216,7 +216,7 @@
216
216
  <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
217
217
  <xsl:choose>
218
218
  <xsl:when test="@section = ''">
219
- <fo:table table-layout="fixed" width="100%">
219
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__price_toc_{generate-id()}">
220
220
  <fo:table-column column-width="180mm"/>
221
221
  <fo:table-body>
222
222
  <fo:table-row height="6mm">
@@ -241,7 +241,7 @@
241
241
  </fo:table>
242
242
  </xsl:when>
243
243
  <xsl:otherwise>
244
- <fo:table table-layout="fixed" width="100%">
244
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__price_toc_{generate-id()}">
245
245
  <fo:table-column column-width="5mm"/> <!-- 25mm -->
246
246
  <fo:table-column column-width="175mm"/> <!-- 155mm -->
247
247
  <fo:table-body>
@@ -1051,6 +1051,14 @@
1051
1051
 
1052
1052
  </xsl:attribute-set>
1053
1053
 
1054
+ <xsl:attribute-set name="pre-style">
1055
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1056
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1057
+
1058
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1059
+
1060
+ </xsl:attribute-set>
1061
+
1054
1062
  <xsl:attribute-set name="permission-style">
1055
1063
 
1056
1064
  </xsl:attribute-set>
@@ -1160,6 +1168,11 @@
1160
1168
  </xsl:variable>
1161
1169
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1162
1170
 
1171
+ <xsl:variable name="table-cell-border_">
1172
+
1173
+ </xsl:variable>
1174
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
1175
+
1163
1176
  <xsl:attribute-set name="table-container-style">
1164
1177
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1165
1178
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1169,8 +1182,6 @@
1169
1182
  <xsl:attribute-set name="table-style">
1170
1183
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1171
1184
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1172
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1173
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1174
1185
 
1175
1186
  </xsl:attribute-set><!-- table-style -->
1176
1187
 
@@ -2266,10 +2277,18 @@
2266
2277
  <xsl:variable name="table_attributes">
2267
2278
 
2268
2279
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
2280
+
2281
+ <xsl:if test="$margin-side != 0">
2282
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2283
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2284
+ </xsl:if>
2285
+
2269
2286
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2270
2287
 
2271
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2272
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2288
+ <xsl:if test="$margin-side != 0">
2289
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2290
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2291
+ </xsl:if>
2273
2292
 
2274
2293
  </xsl:element>
2275
2294
  </xsl:variable>
@@ -3025,6 +3044,10 @@
3025
3044
  <xsl:template match="*[local-name()='tr']">
3026
3045
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3027
3046
 
3047
+ <xsl:if test="*[local-name() = 'th']">
3048
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3049
+ </xsl:if>
3050
+
3028
3051
  <xsl:call-template name="setTableRowAttributes"/>
3029
3052
  <xsl:apply-templates/>
3030
3053
  </fo:table-row>
@@ -4065,8 +4088,17 @@
4065
4088
  </fo:inline>
4066
4089
  </xsl:template> <!-- tt -->
4067
4090
 
4091
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4068
4092
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4069
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4093
+ <xsl:choose>
4094
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4095
+ <!-- url -->
4096
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4097
+ </xsl:when>
4098
+ <xsl:otherwise>
4099
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4100
+ </xsl:otherwise>
4101
+ </xsl:choose>
4070
4102
  </xsl:template>
4071
4103
 
4072
4104
  <xsl:template match="*[local-name()='underline']">
@@ -4422,8 +4454,11 @@
4422
4454
 
4423
4455
  <xsl:template name="add-zero-spaces-link-java">
4424
4456
  <xsl:param name="text" select="."/>
4457
+
4458
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4459
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4425
4460
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4426
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4461
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4427
4462
  </xsl:template>
4428
4463
 
4429
4464
  <!-- add zero space after dash character (for table's entries) -->
@@ -4980,6 +5015,9 @@
4980
5015
  <xsl:value-of select="substring($str, 2)"/>
4981
5016
  </xsl:template>
4982
5017
 
5018
+ <!-- ======================================= -->
5019
+ <!-- math -->
5020
+ <!-- ======================================= -->
4983
5021
  <xsl:template match="mathml:math">
4984
5022
  <xsl:variable name="isAdded" select="@added"/>
4985
5023
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5030,14 +5068,57 @@
5030
5068
  <xsl:value-of select="$comment_text"/>
5031
5069
  </xsl:template>
5032
5070
 
5071
+ <xsl:template match="*[local-name() = 'asciimath']">
5072
+ <xsl:param name="process" select="'false'"/>
5073
+ <xsl:if test="$process = 'true'">
5074
+ <xsl:apply-templates/>
5075
+ </xsl:if>
5076
+ </xsl:template>
5077
+
5078
+ <xsl:template match="*[local-name() = 'latexmath']"/>
5079
+
5080
+ <xsl:template name="getMathml_asciimath_text">
5081
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
5082
+ <xsl:variable name="latexmath">
5083
+
5084
+ </xsl:variable>
5085
+ <xsl:variable name="asciimath_text_following">
5086
+ <xsl:choose>
5087
+ <xsl:when test="normalize-space($latexmath) != ''">
5088
+ <xsl:value-of select="$latexmath"/>
5089
+ </xsl:when>
5090
+ <xsl:when test="normalize-space($asciimath) != ''">
5091
+ <xsl:value-of select="$asciimath"/>
5092
+ </xsl:when>
5093
+ <xsl:otherwise>
5094
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
5095
+ </xsl:otherwise>
5096
+ </xsl:choose>
5097
+ </xsl:variable>
5098
+ <xsl:variable name="asciimath_text_">
5099
+ <xsl:choose>
5100
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
5101
+ <xsl:value-of select="$asciimath_text_following"/>
5102
+ </xsl:when>
5103
+ <xsl:otherwise>
5104
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5105
+ </xsl:otherwise>
5106
+ </xsl:choose>
5107
+ </xsl:variable>
5108
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
5109
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
5110
+ <xsl:value-of select="$asciimath_text"/>
5111
+ </xsl:template>
5112
+
5033
5113
  <xsl:template name="mathml_instream_object">
5034
- <xsl:param name="comment_text"/>
5114
+ <xsl:param name="asciimath_text"/>
5035
5115
  <xsl:param name="mathml_content"/>
5036
5116
 
5037
- <xsl:variable name="comment_text_">
5117
+ <xsl:variable name="asciimath_text_">
5038
5118
  <xsl:choose>
5039
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5040
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5119
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
5120
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
5121
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
5041
5122
  </xsl:choose>
5042
5123
  </xsl:variable>
5043
5124
 
@@ -5054,10 +5135,10 @@
5054
5135
  </xsl:attribute>
5055
5136
 
5056
5137
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5057
- <xsl:if test="normalize-space($comment_text_) != ''">
5138
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
5058
5139
  <!-- put Mathin Alternate Text -->
5059
5140
  <xsl:attribute name="fox:alt-text">
5060
- <xsl:value-of select="$comment_text_"/>
5141
+ <xsl:value-of select="$asciimath_text_"/>
5061
5142
  </xsl:attribute>
5062
5143
  </xsl:if>
5063
5144
  <!-- </xsl:if> -->
@@ -5130,6 +5211,29 @@
5130
5211
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5131
5212
  </xsl:template>
5132
5213
 
5214
+ <!-- Examples:
5215
+ <stem type="AsciiMath">x = 1</stem>
5216
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
5217
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
5218
+ -->
5219
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5220
+ <fo:inline xsl:use-attribute-sets="mathml-style">
5221
+
5222
+ <xsl:choose>
5223
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5224
+ <xsl:otherwise>
5225
+ <xsl:apply-templates>
5226
+ <xsl:with-param name="process">true</xsl:with-param>
5227
+ </xsl:apply-templates>
5228
+ </xsl:otherwise>
5229
+ </xsl:choose>
5230
+
5231
+ </fo:inline>
5232
+ </xsl:template>
5233
+ <!-- ======================================= -->
5234
+ <!-- END: math -->
5235
+ <!-- ======================================= -->
5236
+
5133
5237
  <xsl:template match="*[local-name()='localityStack']"/>
5134
5238
 
5135
5239
  <xsl:template match="*[local-name()='link']" name="link">
@@ -6472,9 +6576,9 @@
6472
6576
  <xsl:apply-templates mode="contents_item"/>
6473
6577
  </xsl:template>
6474
6578
 
6475
- <!-- ====== -->
6476
- <!-- sourcecode -->
6477
- <!-- ====== -->
6579
+ <!-- =============== -->
6580
+ <!-- sourcecode -->
6581
+ <!-- =============== -->
6478
6582
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6479
6583
 
6480
6584
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -6771,8 +6875,22 @@
6771
6875
  </fo:block>
6772
6876
  </xsl:if>
6773
6877
  </xsl:template>
6774
- <!-- ====== -->
6775
- <!-- ====== -->
6878
+ <!-- =============== -->
6879
+ <!-- END sourcecode -->
6880
+ <!-- =============== -->
6881
+
6882
+ <!-- =============== -->
6883
+ <!-- pre -->
6884
+ <!-- =============== -->
6885
+ <xsl:template match="*[local-name()='pre']" name="pre">
6886
+ <fo:block xsl:use-attribute-sets="pre-style">
6887
+ <xsl:copy-of select="@id"/>
6888
+ <xsl:apply-templates/>
6889
+ </fo:block>
6890
+ </xsl:template>
6891
+ <!-- =============== -->
6892
+ <!-- pre -->
6893
+ <!-- =============== -->
6776
6894
 
6777
6895
  <!-- ========== -->
6778
6896
  <!-- permission -->
@@ -8851,7 +8969,7 @@
8851
8969
 
8852
8970
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8853
8971
 
8854
- <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">
8972
+ <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">
8855
8973
 
8856
8974
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8857
8975
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -9327,13 +9445,14 @@
9327
9445
  </xsl:template>
9328
9446
 
9329
9447
  <xsl:template name="setId">
9448
+ <xsl:param name="prefix"/>
9330
9449
  <xsl:attribute name="id">
9331
9450
  <xsl:choose>
9332
9451
  <xsl:when test="@id">
9333
- <xsl:value-of select="@id"/>
9452
+ <xsl:value-of select="concat($prefix, @id)"/>
9334
9453
  </xsl:when>
9335
9454
  <xsl:otherwise>
9336
- <xsl:value-of select="generate-id()"/>
9455
+ <xsl:value-of select="concat($prefix, generate-id())"/>
9337
9456
  </xsl:otherwise>
9338
9457
  </xsl:choose>
9339
9458
  </xsl:attribute>