metanorma-bipm 2.1.11 → 2.1.12

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: deb15c0d884da169c86a1bc0f84306a50058f5f58efab8e9a2ff4dddbf5ddb85
4
- data.tar.gz: b938f5f8bf762bef096481a495ac313cbb6266114560e0c3204a5d9f2f90beb3
3
+ metadata.gz: 9646a056278cd68248390dedde7d635cf80d4b6617fc8d5d50ddce0654a3e4e1
4
+ data.tar.gz: 3a58fd80e587e34342b9f95944f05ce38da2ef28fdeab15b9ec41d2e7d469c98
5
5
  SHA512:
6
- metadata.gz: fc2984c3c54e5c1acc31a127120ba972dc844de5b3a3b189f13f0847a690ccd2a24241363695d4f9ad3ccc27b776c72a5d632281af8103f980e737b3f18b59e5
7
- data.tar.gz: b7f2f9a00f0bff7fe711db8d0616bf30ff67131684ba4fe3098d0aac078ba0ba41fcce0f30d2a05da817044c8a977ad63320aa77a225e6c656d20782dfe6d8a7
6
+ metadata.gz: bd897f8bdd06512637106113cc6f1d45a836bd9f3d18964a50187e03c6a7b6d8b17271945f26ae5dde87e410a77e244ac79de8cb121bf6bb7a93bb303226e8ed
7
+ data.tar.gz: 5dee365292ec477ebbb3d97e0eacd27fdeb1ce0999496ba999f8c336c5171e5e9d867baef20c03995339f3f2b8a4d17ba61c7c4b8c18c0288f3e5d18dfa436b7
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  end
9
9
 
10
10
  def convert1(docxml, filename, dir)
11
- @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
11
+ @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
12
12
  "@acronym"))&.value == "JCGM"
13
13
  super
14
14
  end
@@ -42,7 +42,8 @@ module IsoDoc
42
42
 
43
43
  def implicit_reference(bib)
44
44
  b = bib.at(ns("./docidentifier[@primary = 'true'][@type = 'BIPM']"))
45
- return true if /^(CGPM|CIPM|CCDS|CCTF)\s
45
+ doctype = bib.at(ns("//bibdata/ext/doctype"))&.text
46
+ return true if doctype == "brochure" && /^(CGPM|CIPM|CCDS|CCTF)\s
46
47
  (Resolution|Recommendation|Declaration|Decision|Recommendation|Meeting)/x
47
48
  .match?(b&.text)
48
49
 
@@ -1058,7 +1058,7 @@
1058
1058
  <!-- <xsl:copy-of select="$contents"/> -->
1059
1059
 
1060
1060
  <xsl:if test="$contents/doc[@id = $docid]//item[@display='true']">
1061
- <fo:table table-layout="fixed" width="100%">
1061
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__toc_{generate-id()}">
1062
1062
  <fo:table-column column-width="127mm"/>
1063
1063
  <fo:table-column column-width="12mm"/>
1064
1064
  <fo:table-body>
@@ -2242,8 +2242,13 @@
2242
2242
  <!-- ====== -->
2243
2243
 
2244
2244
  <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]" priority="3">
2245
- <fo:table table-layout="fixed" width="173.5mm">
2245
+ <fo:block keep-with-next="always">
2246
2246
  <xsl:call-template name="setId"/>
2247
+ </fo:block>
2248
+ <fo:table table-layout="fixed" width="173.5mm">
2249
+ <xsl:call-template name="setId">
2250
+ <xsl:with-param name="prefix">__internal_layout__</xsl:with-param>
2251
+ </xsl:call-template>
2247
2252
  <fo:table-column column-width="137mm"/>
2248
2253
  <fo:table-column column-width="2.5mm"/>
2249
2254
  <fo:table-column column-width="34mm"/>
@@ -2386,11 +2391,16 @@
2386
2391
  </xsl:variable>
2387
2392
  <xsl:variable name="space-before-value" select="normalize-space($space-before)"/>
2388
2393
 
2394
+ <fo:block keep-with-next="always">
2395
+ <xsl:call-template name="setId"/>
2396
+ </fo:block>
2389
2397
  <fo:table table-layout="fixed" width="174mm" line-height="135%">
2390
2398
  <xsl:if test="@orientation = 'landscape'">
2391
2399
  <xsl:attribute name="width">261mm</xsl:attribute> <!-- 87 = (297 - 210) -->
2392
2400
  </xsl:if>
2393
- <xsl:call-template name="setId"/>
2401
+ <xsl:call-template name="setId">
2402
+ <xsl:with-param name="prefix">__internal_layout__</xsl:with-param>
2403
+ </xsl:call-template>
2394
2404
  <xsl:if test="$space-before-value != ''">
2395
2405
  <xsl:attribute name="space-before"><xsl:value-of select="$space-before-value"/></xsl:attribute>
2396
2406
  </xsl:if>
@@ -3743,7 +3753,7 @@
3743
3753
  </fo:block>
3744
3754
  </fo:block-container>
3745
3755
  <!-- grey opacity -->
3746
- <fo:block-container absolute-position="fixed" left="0" top="0">
3756
+ <fo:block-container absolute-position="fixed" left="0" top="0" id="{concat('__internal_layout__', 'Logo-BIPM-Metro_', generate-id())}">
3747
3757
  <fo:block>
3748
3758
  <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
3749
3759
  <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="215.9mm" height="279.4mm">
@@ -4215,6 +4225,12 @@
4215
4225
 
4216
4226
  </xsl:attribute-set>
4217
4227
 
4228
+ <xsl:attribute-set name="pre-style">
4229
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4230
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4231
+
4232
+ </xsl:attribute-set>
4233
+
4218
4234
  <xsl:attribute-set name="permission-style">
4219
4235
 
4220
4236
  </xsl:attribute-set>
@@ -4313,6 +4329,11 @@
4313
4329
  </xsl:variable>
4314
4330
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
4315
4331
 
4332
+ <xsl:variable name="table-cell-border_">
4333
+
4334
+ </xsl:variable>
4335
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
4336
+
4316
4337
  <xsl:attribute-set name="table-container-style">
4317
4338
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4318
4339
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4325,8 +4346,6 @@
4325
4346
  <xsl:attribute-set name="table-style">
4326
4347
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
4327
4348
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
4328
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4329
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4330
4349
 
4331
4350
  </xsl:attribute-set><!-- table-style -->
4332
4351
 
@@ -5459,6 +5478,12 @@
5459
5478
  <xsl:variable name="table_attributes">
5460
5479
 
5461
5480
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
5481
+
5482
+ <xsl:if test="$margin-side != 0">
5483
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5484
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5485
+ </xsl:if>
5486
+
5462
5487
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
5463
5488
 
5464
5489
  <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber]) and not(ancestor::*[local-name() = 'doccontrol'])">
@@ -6247,6 +6272,10 @@
6247
6272
  <xsl:template match="*[local-name()='tr']">
6248
6273
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6249
6274
 
6275
+ <xsl:if test="*[local-name() = 'th']">
6276
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
6277
+ </xsl:if>
6278
+
6250
6279
  <xsl:call-template name="setTableRowAttributes"/>
6251
6280
  <xsl:apply-templates/>
6252
6281
  </fo:table-row>
@@ -8269,6 +8298,9 @@
8269
8298
  <xsl:value-of select="substring($str, 2)"/>
8270
8299
  </xsl:template>
8271
8300
 
8301
+ <!-- ======================================= -->
8302
+ <!-- math -->
8303
+ <!-- ======================================= -->
8272
8304
  <xsl:template match="mathml:math">
8273
8305
  <xsl:variable name="isAdded" select="@added"/>
8274
8306
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8304,17 +8336,18 @@
8304
8336
  <xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
8305
8337
  <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
8306
8338
  <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
8307
- <xsl:variable name="comment_text">
8308
- <xsl:call-template name="getMathml_comment_text"/>
8339
+ <xsl:variable name="asciimath_text">
8340
+ <!-- <xsl:call-template name="getMathml_comment_text"/> -->
8341
+ <xsl:call-template name="getMathml_asciimath_text"/>
8309
8342
  </xsl:variable>
8310
- <xsl:if test="normalize-space($comment_text) != ''">
8343
+ <xsl:if test="normalize-space($asciimath_text) != ''">
8311
8344
  <!-- put Mathin Alternate Text -->
8312
8345
  <xsl:attribute name="fox:alt-text">
8313
- <xsl:value-of select="$comment_text"/>
8346
+ <xsl:value-of select="$asciimath_text"/>
8314
8347
  </xsl:attribute>
8315
8348
  </xsl:if>
8316
8349
  <xsl:call-template name="mathml_instream_object">
8317
- <xsl:with-param name="comment_text" select="$comment_text"/>
8350
+ <xsl:with-param name="asciimath_text" select="$asciimath_text"/>
8318
8351
  <xsl:with-param name="mathml_content" select="$mathml_content"/>
8319
8352
  </xsl:call-template>
8320
8353
  </fo:basic-link>
@@ -8325,7 +8358,7 @@
8325
8358
  </xsl:call-template>
8326
8359
  </xsl:otherwise>
8327
8360
  </xsl:choose>
8328
- <!-- end BSI -->
8361
+ <!-- end BIPM -->
8329
8362
 
8330
8363
  </fo:inline>
8331
8364
  </xsl:template>
@@ -8347,14 +8380,57 @@
8347
8380
  <xsl:value-of select="$comment_text"/>
8348
8381
  </xsl:template>
8349
8382
 
8383
+ <xsl:template match="*[local-name() = 'asciimath']">
8384
+ <xsl:param name="process" select="'false'"/>
8385
+ <xsl:if test="$process = 'true'">
8386
+ <xsl:apply-templates/>
8387
+ </xsl:if>
8388
+ </xsl:template>
8389
+
8390
+ <xsl:template match="*[local-name() = 'latexmath']"/>
8391
+
8392
+ <xsl:template name="getMathml_asciimath_text">
8393
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
8394
+ <xsl:variable name="latexmath">
8395
+
8396
+ </xsl:variable>
8397
+ <xsl:variable name="asciimath_text_following">
8398
+ <xsl:choose>
8399
+ <xsl:when test="normalize-space($latexmath) != ''">
8400
+ <xsl:value-of select="$latexmath"/>
8401
+ </xsl:when>
8402
+ <xsl:when test="normalize-space($asciimath) != ''">
8403
+ <xsl:value-of select="$asciimath"/>
8404
+ </xsl:when>
8405
+ <xsl:otherwise>
8406
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
8407
+ </xsl:otherwise>
8408
+ </xsl:choose>
8409
+ </xsl:variable>
8410
+ <xsl:variable name="asciimath_text_">
8411
+ <xsl:choose>
8412
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
8413
+ <xsl:value-of select="$asciimath_text_following"/>
8414
+ </xsl:when>
8415
+ <xsl:otherwise>
8416
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
8417
+ </xsl:otherwise>
8418
+ </xsl:choose>
8419
+ </xsl:variable>
8420
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
8421
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
8422
+ <xsl:value-of select="$asciimath_text"/>
8423
+ </xsl:template>
8424
+
8350
8425
  <xsl:template name="mathml_instream_object">
8351
- <xsl:param name="comment_text"/>
8426
+ <xsl:param name="asciimath_text"/>
8352
8427
  <xsl:param name="mathml_content"/>
8353
8428
 
8354
- <xsl:variable name="comment_text_">
8429
+ <xsl:variable name="asciimath_text_">
8355
8430
  <xsl:choose>
8356
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
8357
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
8431
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
8432
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
8433
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
8358
8434
  </xsl:choose>
8359
8435
  </xsl:variable>
8360
8436
 
@@ -8378,10 +8454,10 @@
8378
8454
  </xsl:attribute>
8379
8455
 
8380
8456
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8381
- <xsl:if test="normalize-space($comment_text_) != ''">
8457
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8382
8458
  <!-- put Mathin Alternate Text -->
8383
8459
  <xsl:attribute name="fox:alt-text">
8384
- <xsl:value-of select="$comment_text_"/>
8460
+ <xsl:value-of select="$asciimath_text_"/>
8385
8461
  </xsl:attribute>
8386
8462
  </xsl:if>
8387
8463
  <!-- </xsl:if> -->
@@ -8454,6 +8530,33 @@
8454
8530
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8455
8531
  </xsl:template>
8456
8532
 
8533
+ <!-- Examples:
8534
+ <stem type="AsciiMath">x = 1</stem>
8535
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
8536
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
8537
+ -->
8538
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
8539
+ <fo:inline xsl:use-attribute-sets="mathml-style">
8540
+
8541
+ <xsl:if test="ancestor::*[local-name()='table']">
8542
+ <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
8543
+ </xsl:if>
8544
+
8545
+ <xsl:choose>
8546
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
8547
+ <xsl:otherwise>
8548
+ <xsl:apply-templates>
8549
+ <xsl:with-param name="process">true</xsl:with-param>
8550
+ </xsl:apply-templates>
8551
+ </xsl:otherwise>
8552
+ </xsl:choose>
8553
+
8554
+ </fo:inline>
8555
+ </xsl:template>
8556
+ <!-- ======================================= -->
8557
+ <!-- END: math -->
8558
+ <!-- ======================================= -->
8559
+
8457
8560
  <xsl:template match="*[local-name()='localityStack']"/>
8458
8561
 
8459
8562
  <xsl:template match="*[local-name()='link']" name="link">
@@ -9834,9 +9937,9 @@
9834
9937
  <xsl:apply-templates mode="contents_item"/>
9835
9938
  </xsl:template>
9836
9939
 
9837
- <!-- ====== -->
9838
- <!-- sourcecode -->
9839
- <!-- ====== -->
9940
+ <!-- =============== -->
9941
+ <!-- sourcecode -->
9942
+ <!-- =============== -->
9840
9943
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9841
9944
 
9842
9945
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -10133,8 +10236,22 @@
10133
10236
  </fo:block>
10134
10237
  </xsl:if>
10135
10238
  </xsl:template>
10136
- <!-- ====== -->
10137
- <!-- ====== -->
10239
+ <!-- =============== -->
10240
+ <!-- END sourcecode -->
10241
+ <!-- =============== -->
10242
+
10243
+ <!-- =============== -->
10244
+ <!-- pre -->
10245
+ <!-- =============== -->
10246
+ <xsl:template match="*[local-name()='pre']" name="pre">
10247
+ <fo:block xsl:use-attribute-sets="pre-style">
10248
+ <xsl:copy-of select="@id"/>
10249
+ <xsl:apply-templates/>
10250
+ </fo:block>
10251
+ </xsl:template>
10252
+ <!-- =============== -->
10253
+ <!-- pre -->
10254
+ <!-- =============== -->
10138
10255
 
10139
10256
  <!-- ========== -->
10140
10257
  <!-- permission -->
@@ -12690,13 +12807,14 @@
12690
12807
  </xsl:template>
12691
12808
 
12692
12809
  <xsl:template name="setId">
12810
+ <xsl:param name="prefix"/>
12693
12811
  <xsl:attribute name="id">
12694
12812
  <xsl:choose>
12695
12813
  <xsl:when test="@id">
12696
- <xsl:value-of select="@id"/>
12814
+ <xsl:value-of select="concat($prefix, @id)"/>
12697
12815
  </xsl:when>
12698
12816
  <xsl:otherwise>
12699
- <xsl:value-of select="generate-id()"/>
12817
+ <xsl:value-of select="concat($prefix, generate-id())"/>
12700
12818
  </xsl:otherwise>
12701
12819
  </xsl:choose>
12702
12820
  </xsl:attribute>
@@ -1058,7 +1058,7 @@
1058
1058
  <!-- <xsl:copy-of select="$contents"/> -->
1059
1059
 
1060
1060
  <xsl:if test="$contents/doc[@id = $docid]//item[@display='true']">
1061
- <fo:table table-layout="fixed" width="100%">
1061
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__toc_{generate-id()}">
1062
1062
  <fo:table-column column-width="127mm"/>
1063
1063
  <fo:table-column column-width="12mm"/>
1064
1064
  <fo:table-body>
@@ -2242,8 +2242,13 @@
2242
2242
  <!-- ====== -->
2243
2243
 
2244
2244
  <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]" priority="3">
2245
- <fo:table table-layout="fixed" width="173.5mm">
2245
+ <fo:block keep-with-next="always">
2246
2246
  <xsl:call-template name="setId"/>
2247
+ </fo:block>
2248
+ <fo:table table-layout="fixed" width="173.5mm">
2249
+ <xsl:call-template name="setId">
2250
+ <xsl:with-param name="prefix">__internal_layout__</xsl:with-param>
2251
+ </xsl:call-template>
2247
2252
  <fo:table-column column-width="137mm"/>
2248
2253
  <fo:table-column column-width="2.5mm"/>
2249
2254
  <fo:table-column column-width="34mm"/>
@@ -2386,11 +2391,16 @@
2386
2391
  </xsl:variable>
2387
2392
  <xsl:variable name="space-before-value" select="normalize-space($space-before)"/>
2388
2393
 
2394
+ <fo:block keep-with-next="always">
2395
+ <xsl:call-template name="setId"/>
2396
+ </fo:block>
2389
2397
  <fo:table table-layout="fixed" width="174mm" line-height="135%">
2390
2398
  <xsl:if test="@orientation = 'landscape'">
2391
2399
  <xsl:attribute name="width">261mm</xsl:attribute> <!-- 87 = (297 - 210) -->
2392
2400
  </xsl:if>
2393
- <xsl:call-template name="setId"/>
2401
+ <xsl:call-template name="setId">
2402
+ <xsl:with-param name="prefix">__internal_layout__</xsl:with-param>
2403
+ </xsl:call-template>
2394
2404
  <xsl:if test="$space-before-value != ''">
2395
2405
  <xsl:attribute name="space-before"><xsl:value-of select="$space-before-value"/></xsl:attribute>
2396
2406
  </xsl:if>
@@ -3743,7 +3753,7 @@
3743
3753
  </fo:block>
3744
3754
  </fo:block-container>
3745
3755
  <!-- grey opacity -->
3746
- <fo:block-container absolute-position="fixed" left="0" top="0">
3756
+ <fo:block-container absolute-position="fixed" left="0" top="0" id="{concat('__internal_layout__', 'Logo-BIPM-Metro_', generate-id())}">
3747
3757
  <fo:block>
3748
3758
  <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
3749
3759
  <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="215.9mm" height="279.4mm">
@@ -4215,6 +4225,12 @@
4215
4225
 
4216
4226
  </xsl:attribute-set>
4217
4227
 
4228
+ <xsl:attribute-set name="pre-style">
4229
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4230
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4231
+
4232
+ </xsl:attribute-set>
4233
+
4218
4234
  <xsl:attribute-set name="permission-style">
4219
4235
 
4220
4236
  </xsl:attribute-set>
@@ -4313,6 +4329,11 @@
4313
4329
  </xsl:variable>
4314
4330
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
4315
4331
 
4332
+ <xsl:variable name="table-cell-border_">
4333
+
4334
+ </xsl:variable>
4335
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
4336
+
4316
4337
  <xsl:attribute-set name="table-container-style">
4317
4338
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4318
4339
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4325,8 +4346,6 @@
4325
4346
  <xsl:attribute-set name="table-style">
4326
4347
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
4327
4348
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
4328
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4329
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4330
4349
 
4331
4350
  </xsl:attribute-set><!-- table-style -->
4332
4351
 
@@ -5459,6 +5478,12 @@
5459
5478
  <xsl:variable name="table_attributes">
5460
5479
 
5461
5480
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
5481
+
5482
+ <xsl:if test="$margin-side != 0">
5483
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5484
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5485
+ </xsl:if>
5486
+
5462
5487
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
5463
5488
 
5464
5489
  <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber]) and not(ancestor::*[local-name() = 'doccontrol'])">
@@ -6247,6 +6272,10 @@
6247
6272
  <xsl:template match="*[local-name()='tr']">
6248
6273
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6249
6274
 
6275
+ <xsl:if test="*[local-name() = 'th']">
6276
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
6277
+ </xsl:if>
6278
+
6250
6279
  <xsl:call-template name="setTableRowAttributes"/>
6251
6280
  <xsl:apply-templates/>
6252
6281
  </fo:table-row>
@@ -8269,6 +8298,9 @@
8269
8298
  <xsl:value-of select="substring($str, 2)"/>
8270
8299
  </xsl:template>
8271
8300
 
8301
+ <!-- ======================================= -->
8302
+ <!-- math -->
8303
+ <!-- ======================================= -->
8272
8304
  <xsl:template match="mathml:math">
8273
8305
  <xsl:variable name="isAdded" select="@added"/>
8274
8306
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8304,17 +8336,18 @@
8304
8336
  <xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
8305
8337
  <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
8306
8338
  <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
8307
- <xsl:variable name="comment_text">
8308
- <xsl:call-template name="getMathml_comment_text"/>
8339
+ <xsl:variable name="asciimath_text">
8340
+ <!-- <xsl:call-template name="getMathml_comment_text"/> -->
8341
+ <xsl:call-template name="getMathml_asciimath_text"/>
8309
8342
  </xsl:variable>
8310
- <xsl:if test="normalize-space($comment_text) != ''">
8343
+ <xsl:if test="normalize-space($asciimath_text) != ''">
8311
8344
  <!-- put Mathin Alternate Text -->
8312
8345
  <xsl:attribute name="fox:alt-text">
8313
- <xsl:value-of select="$comment_text"/>
8346
+ <xsl:value-of select="$asciimath_text"/>
8314
8347
  </xsl:attribute>
8315
8348
  </xsl:if>
8316
8349
  <xsl:call-template name="mathml_instream_object">
8317
- <xsl:with-param name="comment_text" select="$comment_text"/>
8350
+ <xsl:with-param name="asciimath_text" select="$asciimath_text"/>
8318
8351
  <xsl:with-param name="mathml_content" select="$mathml_content"/>
8319
8352
  </xsl:call-template>
8320
8353
  </fo:basic-link>
@@ -8325,7 +8358,7 @@
8325
8358
  </xsl:call-template>
8326
8359
  </xsl:otherwise>
8327
8360
  </xsl:choose>
8328
- <!-- end BSI -->
8361
+ <!-- end BIPM -->
8329
8362
 
8330
8363
  </fo:inline>
8331
8364
  </xsl:template>
@@ -8347,14 +8380,57 @@
8347
8380
  <xsl:value-of select="$comment_text"/>
8348
8381
  </xsl:template>
8349
8382
 
8383
+ <xsl:template match="*[local-name() = 'asciimath']">
8384
+ <xsl:param name="process" select="'false'"/>
8385
+ <xsl:if test="$process = 'true'">
8386
+ <xsl:apply-templates/>
8387
+ </xsl:if>
8388
+ </xsl:template>
8389
+
8390
+ <xsl:template match="*[local-name() = 'latexmath']"/>
8391
+
8392
+ <xsl:template name="getMathml_asciimath_text">
8393
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
8394
+ <xsl:variable name="latexmath">
8395
+
8396
+ </xsl:variable>
8397
+ <xsl:variable name="asciimath_text_following">
8398
+ <xsl:choose>
8399
+ <xsl:when test="normalize-space($latexmath) != ''">
8400
+ <xsl:value-of select="$latexmath"/>
8401
+ </xsl:when>
8402
+ <xsl:when test="normalize-space($asciimath) != ''">
8403
+ <xsl:value-of select="$asciimath"/>
8404
+ </xsl:when>
8405
+ <xsl:otherwise>
8406
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
8407
+ </xsl:otherwise>
8408
+ </xsl:choose>
8409
+ </xsl:variable>
8410
+ <xsl:variable name="asciimath_text_">
8411
+ <xsl:choose>
8412
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
8413
+ <xsl:value-of select="$asciimath_text_following"/>
8414
+ </xsl:when>
8415
+ <xsl:otherwise>
8416
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
8417
+ </xsl:otherwise>
8418
+ </xsl:choose>
8419
+ </xsl:variable>
8420
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
8421
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
8422
+ <xsl:value-of select="$asciimath_text"/>
8423
+ </xsl:template>
8424
+
8350
8425
  <xsl:template name="mathml_instream_object">
8351
- <xsl:param name="comment_text"/>
8426
+ <xsl:param name="asciimath_text"/>
8352
8427
  <xsl:param name="mathml_content"/>
8353
8428
 
8354
- <xsl:variable name="comment_text_">
8429
+ <xsl:variable name="asciimath_text_">
8355
8430
  <xsl:choose>
8356
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
8357
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
8431
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
8432
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
8433
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
8358
8434
  </xsl:choose>
8359
8435
  </xsl:variable>
8360
8436
 
@@ -8378,10 +8454,10 @@
8378
8454
  </xsl:attribute>
8379
8455
 
8380
8456
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8381
- <xsl:if test="normalize-space($comment_text_) != ''">
8457
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8382
8458
  <!-- put Mathin Alternate Text -->
8383
8459
  <xsl:attribute name="fox:alt-text">
8384
- <xsl:value-of select="$comment_text_"/>
8460
+ <xsl:value-of select="$asciimath_text_"/>
8385
8461
  </xsl:attribute>
8386
8462
  </xsl:if>
8387
8463
  <!-- </xsl:if> -->
@@ -8454,6 +8530,33 @@
8454
8530
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8455
8531
  </xsl:template>
8456
8532
 
8533
+ <!-- Examples:
8534
+ <stem type="AsciiMath">x = 1</stem>
8535
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
8536
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
8537
+ -->
8538
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
8539
+ <fo:inline xsl:use-attribute-sets="mathml-style">
8540
+
8541
+ <xsl:if test="ancestor::*[local-name()='table']">
8542
+ <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
8543
+ </xsl:if>
8544
+
8545
+ <xsl:choose>
8546
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
8547
+ <xsl:otherwise>
8548
+ <xsl:apply-templates>
8549
+ <xsl:with-param name="process">true</xsl:with-param>
8550
+ </xsl:apply-templates>
8551
+ </xsl:otherwise>
8552
+ </xsl:choose>
8553
+
8554
+ </fo:inline>
8555
+ </xsl:template>
8556
+ <!-- ======================================= -->
8557
+ <!-- END: math -->
8558
+ <!-- ======================================= -->
8559
+
8457
8560
  <xsl:template match="*[local-name()='localityStack']"/>
8458
8561
 
8459
8562
  <xsl:template match="*[local-name()='link']" name="link">
@@ -9834,9 +9937,9 @@
9834
9937
  <xsl:apply-templates mode="contents_item"/>
9835
9938
  </xsl:template>
9836
9939
 
9837
- <!-- ====== -->
9838
- <!-- sourcecode -->
9839
- <!-- ====== -->
9940
+ <!-- =============== -->
9941
+ <!-- sourcecode -->
9942
+ <!-- =============== -->
9840
9943
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9841
9944
 
9842
9945
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -10133,8 +10236,22 @@
10133
10236
  </fo:block>
10134
10237
  </xsl:if>
10135
10238
  </xsl:template>
10136
- <!-- ====== -->
10137
- <!-- ====== -->
10239
+ <!-- =============== -->
10240
+ <!-- END sourcecode -->
10241
+ <!-- =============== -->
10242
+
10243
+ <!-- =============== -->
10244
+ <!-- pre -->
10245
+ <!-- =============== -->
10246
+ <xsl:template match="*[local-name()='pre']" name="pre">
10247
+ <fo:block xsl:use-attribute-sets="pre-style">
10248
+ <xsl:copy-of select="@id"/>
10249
+ <xsl:apply-templates/>
10250
+ </fo:block>
10251
+ </xsl:template>
10252
+ <!-- =============== -->
10253
+ <!-- pre -->
10254
+ <!-- =============== -->
10138
10255
 
10139
10256
  <!-- ========== -->
10140
10257
  <!-- permission -->
@@ -12690,13 +12807,14 @@
12690
12807
  </xsl:template>
12691
12808
 
12692
12809
  <xsl:template name="setId">
12810
+ <xsl:param name="prefix"/>
12693
12811
  <xsl:attribute name="id">
12694
12812
  <xsl:choose>
12695
12813
  <xsl:when test="@id">
12696
- <xsl:value-of select="@id"/>
12814
+ <xsl:value-of select="concat($prefix, @id)"/>
12697
12815
  </xsl:when>
12698
12816
  <xsl:otherwise>
12699
- <xsl:value-of select="generate-id()"/>
12817
+ <xsl:value-of select="concat($prefix, generate-id())"/>
12700
12818
  </xsl:otherwise>
12701
12819
  </xsl:choose>
12702
12820
  </xsl:attribute>