metanorma-bipm 1.0.2 → 1.0.3

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: a0e8acf33a7fceea3050a35b6d104de2a50936c05f29a5e30025cad7fe45c835
4
- data.tar.gz: 5a7b43fd90b235369e3aa8456821d121ff994dec4a34e9133bdd1e64c5aea236
3
+ metadata.gz: 70abc01a43829c12c4870dc4072a2a5f919cd2a5a7d306e579b3fa619020f851
4
+ data.tar.gz: 7ef810393fb2f5d107554fd45195f0297a3421d4deb0d314b6d9820456fbe93d
5
5
  SHA512:
6
- metadata.gz: 38fed8bc9d7b0b7624d3924d9503d8073fef2fdea8fbb56975642160713d48a053e46073d4ec5a23ca22916cccd6c31d22d0e8a5dc5b9fe62624ecc1fd964adc
7
- data.tar.gz: 95b610c7b041e243c14a2c98dfa36aa8647798327b7fff5b8acb5ae6915dc6a0e82a5cdcced4f0b423ae08e351159393e7676f58ebf835a1913a0da4d55846ad
6
+ metadata.gz: cd67915975f6dc2107e1868bc62bb6942ba9f1fe4f6dcee81d48334d45b2e02053513d51f3fe792e439f66387208ac33d288713513015761b1e27a5dbae24329
7
+ data.tar.gz: ede610fd77af7ea69e3073e88fde59c0bd567699fbda50b51bfcb3fad47f4aad00a3bf1e59b4597fa9c2a0485e9ea69c1dcb5b5a7bf430794e78cbd1667a3dab
@@ -729,9 +729,11 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="to">
733
- <data type="IDREF"/>
734
- </attribute>
732
+ <optional>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
735
737
  <element name="primary">
736
738
  <oneOrMore>
737
739
  <ref name="PureTextElement"/>
@@ -0,0 +1,37 @@
1
+ <boilerplate>
2
+ <copyright-statement>
3
+ <clause>
4
+ <p> © JCGM {{ docyear }} </p>
5
+ <p>Copyright of this JCGM guidance document is shared jointly by the JCGM member organizations (BIPM, IEC,
6
+ IFCC, ILAC, ISO, IUPAC, IUPAP and OIML).</p>
7
+ </clause>
8
+ </copyright-statement>
9
+ <license-statement>
10
+ <clause>
11
+ <title>Copyright</title>
12
+ <p>Even if electronic versions are available free of charge on the website of one or more of the JCGM member organizations, economic and moral copyrights related to all JCGM publications are internationally protected. The JCGM does not, without its written authorisation, permit third parties to rewrite or re-brand issues, to sell copies to the public, or to broadcast or use on-line its publications. Equally, the JCGM also objects to distortion, augmentation or mutilation of its publications, including its titles, slogans and logos, and those of its member organizations.</p>
13
+ </clause>
14
+ <clause>
15
+ <title>Official versions and translations</title>
16
+ <p>The only official versions of documents are those published by the JCGM, in their original languages.</p>
17
+
18
+ <p>The JCGM’s publications may be translated into languages other than those in which the documents were originally published by the JCGM. Permission must be obtained from the JCGM before a translation can be made. All translations should respect the original and official format of the formulae and units (without any conversion to other formulae or units), and contain the following statement (to be translated into the chosen language):</p>
19
+
20
+ <quote>All JCGM’s products are internationally protected by copyright. This translation of the original JCGM document has been produced with the permission of the JCGM. The JCGM retains full internationally protected copyright on the design and content of this document and on the JCGM’s titles, slogan and logos. The member organizations of the JCGM also retain full internationally protected right on their titles, slogans and logos included in the JCGM’s publications. The only official version is the document published by the JCGM, in the original languages.</quote>
21
+
22
+ <p>The JCGM does not accept any liability for the relevance, accuracy, completeness or quality of the information and materials offered in any translation. A copy of the translation shall be provided to the JCGM at the time of publication.</p>
23
+ </clause>
24
+ <clause>
25
+ <title>Reproduction</title>
26
+ <p>The JCGM’s publications may be reproduced, provided written permission has been granted by the JCGM. A sample of any reproduced document shall be provided to the JCGM at the time of reproduction and contain the following statement:</p>
27
+ <quote>This document is reproduced with the permission of the JCGM, which retains full internationally protected copyright on the design and content of this document and on the JCGM’s titles, slogans and logos. The member organizations of the JCGM also retain full internationally protected right on their titles, slogans and logos included in the JCGM’s publications. The only official versions are the original versions of the documents published by the JCGM.</quote>
28
+ </clause>
29
+ </license-statement>
30
+ <legal-statement>
31
+ <clause>
32
+ <title>Disclaimer</title>
33
+ <p>The JCGM and its member organizations have published this document to enhance access to information about metrology. They endeavor to update it on a regular basis, but cannot guarantee the accuracy at all times and shall not be responsible for any direct or indirect damage that may result from its use. Any reference to commercial products of any kind (including but not restricted to any software, data or hardware) or links to websites, over which the JCGM and its member organizations have no control and for which they assume no responsibility, does not imply any approval, endorsement or recommendation by the JCGM and its member organizations.</p>
34
+ </clause>
35
+ </legal-statement>
36
+ </boilerplate>
37
+
@@ -104,8 +104,7 @@ module Asciidoctor
104
104
  ["en", "fr"].each do |lang|
105
105
  at = { language: lang, format: "text/plain" }
106
106
  xml.title **attr_code(at.merge(type: "main")) do |t1|
107
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(
108
- node.attr("title-#{lang}"))
107
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-#{lang}"))
109
108
  end
110
109
  %w(cover appendix annex part subpart).each do |w|
111
110
  typed_title(node, xml, lang, w)
@@ -117,7 +116,7 @@ module Asciidoctor
117
116
  at = { language: lang, format: "text/plain" }
118
117
  return unless title = node.attr("title-#{type}-#{lang}")
119
118
  xml.title **attr_code(at.merge(type: type)) do |t1|
120
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(title)
119
+ t1 << Metanorma::Utils::asciidoc_sub(title)
121
120
  end
122
121
  end
123
122
 
@@ -173,6 +172,11 @@ module Asciidoctor
173
172
  end
174
173
  end
175
174
 
175
+ def boilerplate_file(xmldoc)
176
+ return super unless xmldoc&.at("//bibdata/ext/editorialgroup/committee/@acronym")&.value == "JCGM"
177
+ baselocation("lib/asciidoctor/bipm/boilerplate-jcgm-en.xml")
178
+ end
179
+
176
180
  def mathml_mi_italics
177
181
  { uppergreek: false, upperroman: false,
178
182
  lowergreek: false, lowerroman: true }
@@ -789,6 +789,9 @@
789
789
  <attribute name="width"/>
790
790
  </element>
791
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
792
795
  <define name="TextElement" combine="choice">
793
796
  <ref name="concept"/>
794
797
  </define>
@@ -165,6 +165,12 @@
165
165
  </xsl:choose>
166
166
  </xsl:variable>
167
167
 
168
+ <xsl:variable name="bookmark_in_fn">
169
+ <xsl:for-each select="//bipm:bookmark[ancestor::bipm:fn]">
170
+ <bookmark><xsl:value-of select="@id"/></bookmark>
171
+ </xsl:for-each>
172
+ </xsl:variable>
173
+
168
174
  <xsl:variable name="dash" select="'–'"/>
169
175
 
170
176
  <xsl:variable name="ids">
@@ -3283,6 +3289,30 @@
3283
3289
  </mathml:mstyle>
3284
3290
  </xsl:template>
3285
3291
 
3292
+ <!-- Decrease space between ()
3293
+ from:
3294
+ <mfenced open="(" close=")">
3295
+ <mrow>
3296
+ <mtext>Cu</mtext>
3297
+ </mrow>
3298
+ </mfenced>
3299
+ to:
3300
+ <mrow>
3301
+ <mtext>(Cu)</mtext>
3302
+ </mrow> -->
3303
+ <xsl:template match="mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 0]] | mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 1] and */*/*[count(*) = 0]]" mode="mathml" priority="2">
3304
+ <xsl:apply-templates mode="mathml"/>
3305
+ </xsl:template>
3306
+
3307
+ <xsl:template match="mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0] | mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0]" mode="mathml" priority="2"> <!-- [not(following-sibling::*) and not(preceding-sibling::*)] -->
3308
+ <xsl:copy>
3309
+ <xsl:apply-templates select="@*" mode="mathml"/>
3310
+ <xsl:value-of select="ancestor::mathml:mfenced/@open"/>
3311
+ <xsl:value-of select="."/>
3312
+ <xsl:value-of select="ancestor::mathml:mfenced/@close"/>
3313
+ </xsl:copy>
3314
+ </xsl:template>
3315
+
3286
3316
  <xsl:template name="insertHeaderFooter">
3287
3317
  <xsl:param name="header-title"/>
3288
3318
  <fo:static-content flow-name="header-odd">
@@ -3409,7 +3439,12 @@
3409
3439
  <xsl:value-of select="concat($day, ' ', $monthStr, ' ', $year)"/>
3410
3440
  </xsl:when>
3411
3441
  <xsl:otherwise>
3412
- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/>
3442
+ <!-- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/> -->
3443
+ <xsl:value-of select="$monthStr"/>
3444
+ <xsl:text> </xsl:text>
3445
+ <xsl:value-of select="$day"/>
3446
+ <xsl:if test="$day != '' and $year != ''"><xsl:text>, </xsl:text></xsl:if>
3447
+ <xsl:value-of select="$year"/>
3413
3448
  </xsl:otherwise>
3414
3449
  </xsl:choose>
3415
3450
 
@@ -3502,12 +3537,15 @@
3502
3537
  <xsl:template match="bipm:clause[@type = 'index']//bipm:li/node()" mode="process_li_element" priority="2">
3503
3538
  <xsl:param name="element"/>
3504
3539
  <xsl:param name="remove" select="'false'"/>
3540
+ <xsl:param name="target"/>
3505
3541
  <!-- <node></node> -->
3506
3542
  <xsl:choose>
3507
3543
  <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
3508
3544
  <!-- skip text (i.e. remove it) and process next element -->
3509
3545
  <!-- [removed_<xsl:value-of select="."/>] -->
3510
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3546
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3547
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
3548
+ </xsl:apply-templates>
3511
3549
  </xsl:when>
3512
3550
  <xsl:when test="self::text()">
3513
3551
  <xsl:value-of select="."/>
@@ -3531,6 +3569,12 @@
3531
3569
 
3532
3570
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3533
3571
  <xsl:with-param name="remove">true</xsl:with-param>
3572
+ <xsl:with-param name="target">
3573
+ <xsl:choose>
3574
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
3575
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
3576
+ </xsl:choose>
3577
+ </xsl:with-param>
3534
3578
  </xsl:apply-templates>
3535
3579
  </xsl:when>
3536
3580
 
@@ -3542,7 +3586,9 @@
3542
3586
  </xsl:when>
3543
3587
 
3544
3588
  <xsl:otherwise>
3545
- <xsl:copy-of select="."/>
3589
+ <xsl:apply-templates select="." mode="xref_copy">
3590
+ <xsl:with-param name="target" select="$target"/>
3591
+ </xsl:apply-templates>
3546
3592
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3547
3593
  </xsl:otherwise>
3548
3594
  </xsl:choose>
@@ -3552,12 +3598,25 @@
3552
3598
  <xsl:apply-templates select="." mode="index_update"/>
3553
3599
  </xsl:when>
3554
3600
  <xsl:otherwise>
3555
- <xsl:copy-of select="."/>
3601
+ <xsl:apply-templates select="." mode="xref_copy">
3602
+ <xsl:with-param name="target" select="$target"/>
3603
+ </xsl:apply-templates>
3556
3604
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3557
3605
  </xsl:otherwise>
3558
3606
  </xsl:choose>
3559
3607
  </xsl:template>
3560
3608
 
3609
+ <xsl:template match="@*|node()" mode="xref_copy">
3610
+ <xsl:param name="target"/>
3611
+ <xsl:copy>
3612
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
3613
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
3614
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
3615
+ </xsl:if>
3616
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
3617
+ </xsl:copy>
3618
+ </xsl:template>
3619
+
3561
3620
 
3562
3621
  <xsl:template name="generateIndexXrefId">
3563
3622
  <xsl:variable name="level" select="count(ancestor::bipm:ul)"/>
@@ -3592,8 +3651,11 @@
3592
3651
  </xsl:call-template>
3593
3652
 
3594
3653
  <fo:flow flow-name="xsl-region-body">
3595
- <fo:block id="{@id}">
3596
- <xsl:apply-templates/>
3654
+ <fo:block id="{@id}" span="all">
3655
+ <xsl:apply-templates select="bipm:title"/>
3656
+ </fo:block>
3657
+ <fo:block>
3658
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
3597
3659
 
3598
3660
  <!-- TEST <xsl:variable name="alphabet" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
3599
3661
  <xsl:for-each select="(document('')//node())[position() &lt; 26]">
@@ -3617,7 +3679,7 @@
3617
3679
  </xsl:template>
3618
3680
 
3619
3681
  <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4">
3620
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" span="all">
3682
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm">
3621
3683
  <!-- Index -->
3622
3684
  <xsl:apply-templates/>
3623
3685
  </fo:block>
@@ -3653,6 +3715,10 @@
3653
3715
  <xsl:template match="bipm:bookmark">
3654
3716
  <fo:inline id="{@id}"/>
3655
3717
  </xsl:template>
3718
+
3719
+ <xsl:template match="*[local-name() = 'stem']/text()">
3720
+ <xsl:value-of select="normalize-space()"/>
3721
+ </xsl:template>
3656
3722
 
3657
3723
  <!-- =================== -->
3658
3724
  <!-- End of Index processing -->
@@ -4422,6 +4488,7 @@
4422
4488
 
4423
4489
 
4424
4490
 
4491
+
4425
4492
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
4426
4493
 
4427
4494
 
@@ -4548,7 +4615,7 @@
4548
4615
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
4549
4616
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
4550
4617
  <xsl:call-template name="add-zero-spaces-java"/>
4551
- </xsl:template><xsl:template match="*[local-name()='table']">
4618
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
4552
4619
 
4553
4620
  <xsl:variable name="simple-table">
4554
4621
  <xsl:call-template name="getSimpleTable"/>
@@ -5890,6 +5957,7 @@
5890
5957
 
5891
5958
 
5892
5959
 
5960
+
5893
5961
 
5894
5962
  </xsl:variable>
5895
5963
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -6498,7 +6566,7 @@
6498
6566
  </xsl:if> -->
6499
6567
  </fo:inline>
6500
6568
  </xsl:if>
6501
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
6569
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
6502
6570
  <fo:block-container id="{@id}">
6503
6571
 
6504
6572
  <xsl:if test="*[local-name() = 'name']">
@@ -6723,6 +6791,12 @@
6723
6791
  <!-- <xsl:text> </xsl:text> -->
6724
6792
  </xsl:template><xsl:template name="getSection">
6725
6793
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
6794
+ <!--
6795
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
6796
+ <xsl:value-of select="."/>
6797
+ </xsl:for-each>
6798
+ -->
6799
+
6726
6800
  </xsl:template><xsl:template name="getName">
6727
6801
  <xsl:choose>
6728
6802
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -6775,6 +6849,10 @@
6775
6849
  <xsl:copy>
6776
6850
  <xsl:apply-templates mode="contents_item"/>
6777
6851
  </xsl:copy>
6852
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
6853
+ <xsl:copy>
6854
+ <xsl:apply-templates mode="contents_item"/>
6855
+ </xsl:copy>
6778
6856
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
6779
6857
  <xsl:text> </xsl:text>
6780
6858
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -6800,6 +6878,7 @@
6800
6878
 
6801
6879
 
6802
6880
 
6881
+
6803
6882
 
6804
6883
 
6805
6884
 
@@ -7338,6 +7417,7 @@
7338
7417
 
7339
7418
 
7340
7419
 
7420
+
7341
7421
 
7342
7422
 
7343
7423
 
@@ -7349,7 +7429,7 @@
7349
7429
 
7350
7430
 
7351
7431
 
7352
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
7432
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
7353
7433
  <fo:block break-after="page"/>
7354
7434
  <fo:block>
7355
7435
  <xsl:call-template name="setId"/>
@@ -7357,10 +7437,11 @@
7357
7437
  </fo:block>
7358
7438
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
7359
7439
  <fo:block>
7360
- <xsl:call-template name="setId"/>
7440
+ <xsl:call-template name="setId"/>
7361
7441
 
7362
7442
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
7363
7443
 
7444
+
7364
7445
  <xsl:apply-templates/>
7365
7446
  </fo:block>
7366
7447
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -7561,6 +7642,57 @@
7561
7642
  </xsl:variable>
7562
7643
  <xsl:variable name="result">
7563
7644
  <xsl:choose>
7645
+ <xsl:when test="$format = 'ddMMyyyy'">
7646
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7647
+ <xsl:text> </xsl:text>
7648
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
7649
+ </xsl:when>
7650
+ <xsl:when test="$format = 'ddMM'">
7651
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7652
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
7653
+ </xsl:when>
7654
+ <xsl:when test="$format = 'short' or $day = ''">
7655
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7656
+ </xsl:when>
7657
+ <xsl:otherwise>
7658
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
7659
+ </xsl:otherwise>
7660
+ </xsl:choose>
7661
+ </xsl:variable>
7662
+ <xsl:value-of select="$result"/>
7663
+ </xsl:template><xsl:template name="convertDateLocalized">
7664
+ <xsl:param name="date"/>
7665
+ <xsl:param name="format" select="'short'"/>
7666
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
7667
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
7668
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
7669
+ <xsl:variable name="monthStr">
7670
+ <xsl:choose>
7671
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
7672
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
7673
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
7674
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
7675
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
7676
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
7677
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
7678
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
7679
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
7680
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
7681
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
7682
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
7683
+ </xsl:choose>
7684
+ </xsl:variable>
7685
+ <xsl:variable name="result">
7686
+ <xsl:choose>
7687
+ <xsl:when test="$format = 'ddMMyyyy'">
7688
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7689
+ <xsl:text> </xsl:text>
7690
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
7691
+ </xsl:when>
7692
+ <xsl:when test="$format = 'ddMM'">
7693
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7694
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
7695
+ </xsl:when>
7564
7696
  <xsl:when test="$format = 'short' or $day = ''">
7565
7697
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7566
7698
  </xsl:when>
@@ -7757,6 +7889,7 @@
7757
7889
 
7758
7890
  <xsl:value-of select="document('')//*/namespace::bipm"/>
7759
7891
 
7892
+
7760
7893
  </xsl:variable>
7761
7894
  <xsl:if test="$documentNS != $XSLNS">
7762
7895
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -165,6 +165,12 @@
165
165
  </xsl:choose>
166
166
  </xsl:variable>
167
167
 
168
+ <xsl:variable name="bookmark_in_fn">
169
+ <xsl:for-each select="//bipm:bookmark[ancestor::bipm:fn]">
170
+ <bookmark><xsl:value-of select="@id"/></bookmark>
171
+ </xsl:for-each>
172
+ </xsl:variable>
173
+
168
174
  <xsl:variable name="dash" select="'–'"/>
169
175
 
170
176
  <xsl:variable name="ids">
@@ -3283,6 +3289,30 @@
3283
3289
  </mathml:mstyle>
3284
3290
  </xsl:template>
3285
3291
 
3292
+ <!-- Decrease space between ()
3293
+ from:
3294
+ <mfenced open="(" close=")">
3295
+ <mrow>
3296
+ <mtext>Cu</mtext>
3297
+ </mrow>
3298
+ </mfenced>
3299
+ to:
3300
+ <mrow>
3301
+ <mtext>(Cu)</mtext>
3302
+ </mrow> -->
3303
+ <xsl:template match="mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 0]] | mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 1] and */*/*[count(*) = 0]]" mode="mathml" priority="2">
3304
+ <xsl:apply-templates mode="mathml"/>
3305
+ </xsl:template>
3306
+
3307
+ <xsl:template match="mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0] | mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0]" mode="mathml" priority="2"> <!-- [not(following-sibling::*) and not(preceding-sibling::*)] -->
3308
+ <xsl:copy>
3309
+ <xsl:apply-templates select="@*" mode="mathml"/>
3310
+ <xsl:value-of select="ancestor::mathml:mfenced/@open"/>
3311
+ <xsl:value-of select="."/>
3312
+ <xsl:value-of select="ancestor::mathml:mfenced/@close"/>
3313
+ </xsl:copy>
3314
+ </xsl:template>
3315
+
3286
3316
  <xsl:template name="insertHeaderFooter">
3287
3317
  <xsl:param name="header-title"/>
3288
3318
  <fo:static-content flow-name="header-odd">
@@ -3409,7 +3439,12 @@
3409
3439
  <xsl:value-of select="concat($day, ' ', $monthStr, ' ', $year)"/>
3410
3440
  </xsl:when>
3411
3441
  <xsl:otherwise>
3412
- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/>
3442
+ <!-- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/> -->
3443
+ <xsl:value-of select="$monthStr"/>
3444
+ <xsl:text> </xsl:text>
3445
+ <xsl:value-of select="$day"/>
3446
+ <xsl:if test="$day != '' and $year != ''"><xsl:text>, </xsl:text></xsl:if>
3447
+ <xsl:value-of select="$year"/>
3413
3448
  </xsl:otherwise>
3414
3449
  </xsl:choose>
3415
3450
 
@@ -3502,12 +3537,15 @@
3502
3537
  <xsl:template match="bipm:clause[@type = 'index']//bipm:li/node()" mode="process_li_element" priority="2">
3503
3538
  <xsl:param name="element"/>
3504
3539
  <xsl:param name="remove" select="'false'"/>
3540
+ <xsl:param name="target"/>
3505
3541
  <!-- <node></node> -->
3506
3542
  <xsl:choose>
3507
3543
  <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
3508
3544
  <!-- skip text (i.e. remove it) and process next element -->
3509
3545
  <!-- [removed_<xsl:value-of select="."/>] -->
3510
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3546
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3547
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
3548
+ </xsl:apply-templates>
3511
3549
  </xsl:when>
3512
3550
  <xsl:when test="self::text()">
3513
3551
  <xsl:value-of select="."/>
@@ -3531,6 +3569,12 @@
3531
3569
 
3532
3570
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3533
3571
  <xsl:with-param name="remove">true</xsl:with-param>
3572
+ <xsl:with-param name="target">
3573
+ <xsl:choose>
3574
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
3575
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
3576
+ </xsl:choose>
3577
+ </xsl:with-param>
3534
3578
  </xsl:apply-templates>
3535
3579
  </xsl:when>
3536
3580
 
@@ -3542,7 +3586,9 @@
3542
3586
  </xsl:when>
3543
3587
 
3544
3588
  <xsl:otherwise>
3545
- <xsl:copy-of select="."/>
3589
+ <xsl:apply-templates select="." mode="xref_copy">
3590
+ <xsl:with-param name="target" select="$target"/>
3591
+ </xsl:apply-templates>
3546
3592
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3547
3593
  </xsl:otherwise>
3548
3594
  </xsl:choose>
@@ -3552,12 +3598,25 @@
3552
3598
  <xsl:apply-templates select="." mode="index_update"/>
3553
3599
  </xsl:when>
3554
3600
  <xsl:otherwise>
3555
- <xsl:copy-of select="."/>
3601
+ <xsl:apply-templates select="." mode="xref_copy">
3602
+ <xsl:with-param name="target" select="$target"/>
3603
+ </xsl:apply-templates>
3556
3604
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3557
3605
  </xsl:otherwise>
3558
3606
  </xsl:choose>
3559
3607
  </xsl:template>
3560
3608
 
3609
+ <xsl:template match="@*|node()" mode="xref_copy">
3610
+ <xsl:param name="target"/>
3611
+ <xsl:copy>
3612
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
3613
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
3614
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
3615
+ </xsl:if>
3616
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
3617
+ </xsl:copy>
3618
+ </xsl:template>
3619
+
3561
3620
 
3562
3621
  <xsl:template name="generateIndexXrefId">
3563
3622
  <xsl:variable name="level" select="count(ancestor::bipm:ul)"/>
@@ -3592,8 +3651,11 @@
3592
3651
  </xsl:call-template>
3593
3652
 
3594
3653
  <fo:flow flow-name="xsl-region-body">
3595
- <fo:block id="{@id}">
3596
- <xsl:apply-templates/>
3654
+ <fo:block id="{@id}" span="all">
3655
+ <xsl:apply-templates select="bipm:title"/>
3656
+ </fo:block>
3657
+ <fo:block>
3658
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
3597
3659
 
3598
3660
  <!-- TEST <xsl:variable name="alphabet" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
3599
3661
  <xsl:for-each select="(document('')//node())[position() &lt; 26]">
@@ -3617,7 +3679,7 @@
3617
3679
  </xsl:template>
3618
3680
 
3619
3681
  <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4">
3620
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" span="all">
3682
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm">
3621
3683
  <!-- Index -->
3622
3684
  <xsl:apply-templates/>
3623
3685
  </fo:block>
@@ -3653,6 +3715,10 @@
3653
3715
  <xsl:template match="bipm:bookmark">
3654
3716
  <fo:inline id="{@id}"/>
3655
3717
  </xsl:template>
3718
+
3719
+ <xsl:template match="*[local-name() = 'stem']/text()">
3720
+ <xsl:value-of select="normalize-space()"/>
3721
+ </xsl:template>
3656
3722
 
3657
3723
  <!-- =================== -->
3658
3724
  <!-- End of Index processing -->
@@ -4422,6 +4488,7 @@
4422
4488
 
4423
4489
 
4424
4490
 
4491
+
4425
4492
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
4426
4493
 
4427
4494
 
@@ -4548,7 +4615,7 @@
4548
4615
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
4549
4616
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
4550
4617
  <xsl:call-template name="add-zero-spaces-java"/>
4551
- </xsl:template><xsl:template match="*[local-name()='table']">
4618
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
4552
4619
 
4553
4620
  <xsl:variable name="simple-table">
4554
4621
  <xsl:call-template name="getSimpleTable"/>
@@ -5890,6 +5957,7 @@
5890
5957
 
5891
5958
 
5892
5959
 
5960
+
5893
5961
 
5894
5962
  </xsl:variable>
5895
5963
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -6498,7 +6566,7 @@
6498
6566
  </xsl:if> -->
6499
6567
  </fo:inline>
6500
6568
  </xsl:if>
6501
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
6569
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
6502
6570
  <fo:block-container id="{@id}">
6503
6571
 
6504
6572
  <xsl:if test="*[local-name() = 'name']">
@@ -6723,6 +6791,12 @@
6723
6791
  <!-- <xsl:text> </xsl:text> -->
6724
6792
  </xsl:template><xsl:template name="getSection">
6725
6793
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
6794
+ <!--
6795
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
6796
+ <xsl:value-of select="."/>
6797
+ </xsl:for-each>
6798
+ -->
6799
+
6726
6800
  </xsl:template><xsl:template name="getName">
6727
6801
  <xsl:choose>
6728
6802
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -6775,6 +6849,10 @@
6775
6849
  <xsl:copy>
6776
6850
  <xsl:apply-templates mode="contents_item"/>
6777
6851
  </xsl:copy>
6852
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
6853
+ <xsl:copy>
6854
+ <xsl:apply-templates mode="contents_item"/>
6855
+ </xsl:copy>
6778
6856
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
6779
6857
  <xsl:text> </xsl:text>
6780
6858
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -6800,6 +6878,7 @@
6800
6878
 
6801
6879
 
6802
6880
 
6881
+
6803
6882
 
6804
6883
 
6805
6884
 
@@ -7338,6 +7417,7 @@
7338
7417
 
7339
7418
 
7340
7419
 
7420
+
7341
7421
 
7342
7422
 
7343
7423
 
@@ -7349,7 +7429,7 @@
7349
7429
 
7350
7430
 
7351
7431
 
7352
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
7432
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
7353
7433
  <fo:block break-after="page"/>
7354
7434
  <fo:block>
7355
7435
  <xsl:call-template name="setId"/>
@@ -7357,10 +7437,11 @@
7357
7437
  </fo:block>
7358
7438
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
7359
7439
  <fo:block>
7360
- <xsl:call-template name="setId"/>
7440
+ <xsl:call-template name="setId"/>
7361
7441
 
7362
7442
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
7363
7443
 
7444
+
7364
7445
  <xsl:apply-templates/>
7365
7446
  </fo:block>
7366
7447
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -7561,6 +7642,57 @@
7561
7642
  </xsl:variable>
7562
7643
  <xsl:variable name="result">
7563
7644
  <xsl:choose>
7645
+ <xsl:when test="$format = 'ddMMyyyy'">
7646
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7647
+ <xsl:text> </xsl:text>
7648
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
7649
+ </xsl:when>
7650
+ <xsl:when test="$format = 'ddMM'">
7651
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7652
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
7653
+ </xsl:when>
7654
+ <xsl:when test="$format = 'short' or $day = ''">
7655
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7656
+ </xsl:when>
7657
+ <xsl:otherwise>
7658
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
7659
+ </xsl:otherwise>
7660
+ </xsl:choose>
7661
+ </xsl:variable>
7662
+ <xsl:value-of select="$result"/>
7663
+ </xsl:template><xsl:template name="convertDateLocalized">
7664
+ <xsl:param name="date"/>
7665
+ <xsl:param name="format" select="'short'"/>
7666
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
7667
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
7668
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
7669
+ <xsl:variable name="monthStr">
7670
+ <xsl:choose>
7671
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
7672
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
7673
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
7674
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
7675
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
7676
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
7677
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
7678
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
7679
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
7680
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
7681
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
7682
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
7683
+ </xsl:choose>
7684
+ </xsl:variable>
7685
+ <xsl:variable name="result">
7686
+ <xsl:choose>
7687
+ <xsl:when test="$format = 'ddMMyyyy'">
7688
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7689
+ <xsl:text> </xsl:text>
7690
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
7691
+ </xsl:when>
7692
+ <xsl:when test="$format = 'ddMM'">
7693
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7694
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
7695
+ </xsl:when>
7564
7696
  <xsl:when test="$format = 'short' or $day = ''">
7565
7697
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7566
7698
  </xsl:when>
@@ -7757,6 +7889,7 @@
7757
7889
 
7758
7890
  <xsl:value-of select="document('')//*/namespace::bipm"/>
7759
7891
 
7892
+
7760
7893
  </xsl:variable>
7761
7894
  <xsl:if test="$documentNS != $XSLNS">
7762
7895
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>