metanorma-bipm 1.0.2 → 1.0.3

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.
@@ -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>