metanorma-bipm 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,6 +43,7 @@
43
43
  <xsl:variable name="current_document">
44
44
  <xsl:apply-templates select="." mode="change_id">
45
45
  <xsl:with-param name="lang" select="$lang"/>
46
+ <xsl:with-param name="ignoreReferenceFrom" select="'true'"/>
46
47
  </xsl:apply-templates>
47
48
  </xsl:variable>
48
49
  <xsl:for-each select="xalan:nodeset($current_document)">
@@ -89,6 +90,17 @@
89
90
 
90
91
  </xsl:variable>
91
92
 
93
+ <xsl:variable name="ids">
94
+ <xsl:for-each select="//*[@id]">
95
+ <id><xsl:value-of select="@id"/></id>
96
+ </xsl:for-each>
97
+ <xsl:for-each select="//bipm:locality[@type='anchor']/bipm:referenceFrom">
98
+ <referenceFrom><xsl:value-of select="."/></referenceFrom>
99
+ </xsl:for-each>
100
+ </xsl:variable>
101
+
102
+
103
+
92
104
  <xsl:variable name="independentAppendix" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:appendix)"/>
93
105
  <!-- <xsl:variable name="independentAppendix" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:title[@type = 'appendix'])"/> -->
94
106
 
@@ -96,8 +108,14 @@
96
108
 
97
109
  <xsl:template name="generateContents">
98
110
  <contents>
99
- <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
100
- <xsl:call-template name="processMainSectionsDefault_Contents"/>
111
+
112
+ <xsl:apply-templates select="/*/bipm:preface/*[position() &gt; 1]" mode="contents"/>
113
+
114
+ <xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
115
+ <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
116
+ <xsl:apply-templates select="/*/bipm:annex" mode="contents"/>
117
+ <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[not(@normative='true')]" mode="contents"/>
118
+
101
119
  </contents>
102
120
  </xsl:template>
103
121
 
@@ -230,6 +248,7 @@
230
248
  <xsl:variable name="current_document">
231
249
  <xsl:apply-templates select="." mode="change_id">
232
250
  <xsl:with-param name="lang" select="$lang"/>
251
+ <xsl:with-param name="ignoreReferenceFrom" select="'true'"/>
233
252
  </xsl:apply-templates>
234
253
  </xsl:variable>
235
254
 
@@ -382,8 +401,34 @@
382
401
  <xsl:apply-templates mode="flatxml"/>
383
402
  </xsl:template>
384
403
 
404
+
405
+ <!-- move note(s) inside element -->
406
+ <!-- but ignore quote, move inside element which before quote -->
407
+ <xsl:template match="bipm:clause/* [not(local-name() = 'quote')] [following-sibling::* [not(local-name()='quote')] [1][local-name() = 'note']]" mode="flatxml"> <!-- find element, which has next 'note' -->
408
+ <xsl:copy>
409
+ <xsl:apply-templates select="@*|node()" mode="flatxml"/>
410
+ <xsl:variable name="element-id" select="generate-id(.)"/>
411
+ <xsl:for-each select="following-sibling::bipm:note[generate-id(preceding-sibling::*[not(local-name()='note') and not(local-name()='quote')][1]) = $element-id]">
412
+ <xsl:call-template name="change_note_kind"/>
413
+ </xsl:for-each>
414
+
415
+ <!-- if current node is title level is 3 with notes, and next level is 4 -->
416
+ <xsl:if test="local-name() = 'title' and @depth = 3 and ../bipm:clause/bipm:title/@depth = 4 and count(following-sibling::*[1][local-name() = 'note']) &gt; 0">
417
+ <!-- then move here footnotes from clause level 4 -->
418
+ <xsl:for-each select="../bipm:clause//bipm:fn[ancestor::bipm:quote or not(ancestor::bipm:table)]">
419
+ <xsl:call-template name="fn_to_note_side"/>
420
+ </xsl:for-each>
421
+ </xsl:if>
422
+
423
+ </xsl:copy>
424
+ </xsl:template>
425
+
426
+ <!-- remove note(s), which was moved into element in previous template -->
427
+ <xsl:template match="bipm:clause/bipm:note" mode="flatxml" priority="2"/>
428
+
429
+
385
430
  <!-- move clause/note inside title, p, ul or ol -->
386
- <xsl:template match="bipm:clause/*[local-name() != 'quote' and local-name() != 'note' and local-name() != 'clause'][last()]" mode="flatxml">
431
+ <xsl:template match="bipm:clause2/*[local-name() != 'quote' and local-name() != 'note' and local-name() != 'clause'][last()]" mode="flatxml">
387
432
  <xsl:copy>
388
433
  <xsl:apply-templates select="@*|node()" mode="flatxml"/>
389
434
  <!-- <xsl:copy-of select="following-sibling::*[local-name() = 'note']"/> -->
@@ -407,7 +452,7 @@
407
452
  </xsl:template> -->
408
453
 
409
454
  <!-- <xsl:template match="bipm:clause/bipm:note[count(following-sibling::*) = 0]" mode="flatxml"/> -->
410
- <xsl:template match="bipm:clause/bipm:note[count(following-sibling::*[local-name() != 'clause' and local-name() != 'note']) = 0]" mode="flatxml" priority="2"/>
455
+ <!-- <xsl:template match="bipm:clause/bipm:note[count(following-sibling::*[local-name() != 'clause' and local-name() != 'note']) = 0]" mode="flatxml" priority="2"/> -->
411
456
 
412
457
 
413
458
  <xsl:template match="bipm:note" name="change_note_kind" mode="flatxml">
@@ -1111,7 +1156,7 @@
1111
1156
  <xsl:call-template name="insertCoverPageCommon"/>
1112
1157
 
1113
1158
  <fo:block-container height="100%" display-align="center" border="0pt solid black"><!-- -->
1114
- <fo:block font-family="WorkSans" font-size="50pt" line-height="115%">
1159
+ <fo:block font-family="Work Sans" font-size="50pt" line-height="115%">
1115
1160
 
1116
1161
  <xsl:variable name="languages">
1117
1162
  <xsl:call-template name="getLanguages"/>
@@ -1182,7 +1227,7 @@
1182
1227
 
1183
1228
  <fo:page-sequence master-reference="cover-page-appendix" force-page-count="even" initial-page-number="1">
1184
1229
 
1185
- <fo:flow flow-name="xsl-region-body" font-family="WorkSans">
1230
+ <fo:flow flow-name="xsl-region-body" font-family="Work Sans">
1186
1231
 
1187
1232
  <xsl:call-template name="insertCoverPageCommon"/>
1188
1233
 
@@ -1316,7 +1361,7 @@
1316
1361
  </fo:block-container>
1317
1362
 
1318
1363
  <!-- <fo:block-container>
1319
- <fo:block font-family="WorkSans" font-size="16pt" line-height="120%" font-weight="400" margin-top="20mm">
1364
+ <fo:block font-family="Work Sans" font-size="16pt" line-height="120%" font-weight="400" margin-top="20mm">
1320
1365
  <fo:block>
1321
1366
  <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $lang]"/>
1322
1367
  <xsl:text> (</xsl:text>
@@ -1336,7 +1381,7 @@
1336
1381
  <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:appendix"/>
1337
1382
  </fo:block>
1338
1383
  </fo:block>
1339
- <fo:block font-family="WorkSans" font-size="36pt" font-weight="600" margin-top="15mm">
1384
+ <fo:block font-family="Work Sans" font-size="36pt" font-weight="600" margin-top="15mm">
1340
1385
  <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@type = 'appendix' and @language = $lang]"/>
1341
1386
  </fo:block>
1342
1387
  </fo:block-container> -->
@@ -1585,6 +1630,7 @@
1585
1630
  <fo:block>
1586
1631
  <xsl:if test="@level = 1 or (@level = 2 and not(@parent = 'annex'))">
1587
1632
  <xsl:value-of select="@section"/>
1633
+ <xsl:if test="normalize-space(@section) != '' and @type = 'annex'">.</xsl:if>
1588
1634
  </xsl:if>
1589
1635
  <!-- <fo:inline font-size="10pt" color="white">Z</fo:inline> --> <!-- for baseline alignment in string -->
1590
1636
  </fo:block>
@@ -1836,7 +1882,7 @@
1836
1882
  </fo:block>
1837
1883
  </xsl:template>
1838
1884
 
1839
- <xsl:template match="bipm:license-statement//bipm:link">
1885
+ <!-- <xsl:template match="bipm:license-statement//bipm:link">
1840
1886
  <fo:inline color="blue" text-decoration="underline">
1841
1887
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
1842
1888
  <xsl:choose>
@@ -1849,7 +1895,7 @@
1849
1895
  </xsl:choose>
1850
1896
  </fo:basic-link>
1851
1897
  </fo:inline>
1852
- </xsl:template>
1898
+ </xsl:template> -->
1853
1899
 
1854
1900
 
1855
1901
  <xsl:template match="bipm:feedback-statement">
@@ -2905,18 +2951,31 @@
2905
2951
  <xsl:template match="bipm:xref" priority="2">
2906
2952
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
2907
2953
  <xsl:choose>
2908
- <xsl:when test="@pagenumber='true'"><!-- ToC in Appendix -->
2909
- <fo:inline font-weight="bold"><fo:page-number-citation ref-id="{@target}"/></fo:inline>
2954
+ <xsl:when test="@pagenumber='true'"><!-- ToC in Appendix, and page in references like this: « Le BIPM et la Convention du Mètre » (page 5). -->
2955
+ <fo:inline> <!-- font-weight="bold" -->
2956
+ <fo:page-number-citation ref-id="{@target}"/>
2957
+ </fo:inline>
2910
2958
  </xsl:when>
2911
2959
  <xsl:when test="starts-with(normalize-space(following-sibling::node()[1]), ')')">
2912
2960
  <!-- add , see p. N -->
2913
2961
  <!-- add , voir p. N -->
2914
2962
  <xsl:apply-templates/>
2915
2963
  <xsl:text>, </xsl:text>
2916
- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2917
- <xsl:value-of select="ancestor::bipm:bipm-standard/bipm:localized-strings/bipm:localized-string[@key='see' and @language=$curr_lang]"/>
2918
- <xsl:text> p. </xsl:text>
2919
- <fo:page-number-citation ref-id="{@target}"/>
2964
+
2965
+ <xsl:variable name="nosee" select="normalize-space(@nosee)"/>
2966
+ <xsl:if test="$nosee != 'true'">
2967
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2968
+ <fo:inline>
2969
+ <xsl:if test="ancestor::bipm:note_side">
2970
+ <xsl:attribute name="font-style">italic</xsl:attribute>
2971
+ </xsl:if>
2972
+ <xsl:value-of select="ancestor::bipm:bipm-standard/bipm:localized-strings/bipm:localized-string[@key='see' and @language=$curr_lang]"/>
2973
+ </fo:inline>
2974
+ <xsl:text> </xsl:text>
2975
+ </xsl:if>
2976
+
2977
+ <xsl:text>p. </xsl:text>
2978
+ <fo:page-number-citation ref-id="{@target}"/>
2920
2979
  </xsl:when>
2921
2980
  <xsl:otherwise>
2922
2981
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -2925,6 +2984,16 @@
2925
2984
  </fo:basic-link>
2926
2985
  </xsl:template>
2927
2986
 
2987
+ <xsl:template match="bipm:eref[.//bipm:locality[@type = 'anchor']]" priority="2">
2988
+ <xsl:variable name="target" select=".//bipm:locality[@type = 'anchor']/bipm:referenceFrom"/>
2989
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
2990
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'localityStack')]"/> -->
2991
+ <xsl:if test="xalan:nodeset($ids)//id = $target">
2992
+ <fo:page-number-citation ref-id="{$target}"/>
2993
+ </xsl:if>
2994
+ </fo:basic-link>
2995
+ </xsl:template>
2996
+
2928
2997
  <xsl:template match="bipm:note[not(ancestor::bipm:preface)]/bipm:name" priority="2" mode="presentation">
2929
2998
  <xsl:choose>
2930
2999
  <xsl:when test="not(../preceding-sibling::bipm:note) and not((../following-sibling::bipm:note))">
@@ -3491,31 +3560,58 @@
3491
3560
 
3492
3561
  <xsl:template match="node()" mode="change_id">
3493
3562
  <xsl:param name="lang"/>
3563
+ <xsl:param name="ignoreReferenceFrom"/>
3494
3564
  <xsl:copy>
3495
3565
  <xsl:apply-templates select="@*|node()" mode="change_id">
3496
3566
  <xsl:with-param name="lang" select="$lang"/>
3567
+ <xsl:with-param name="ignoreReferenceFrom" select="$ignoreReferenceFrom"/>
3568
+ </xsl:apply-templates>
3569
+ </xsl:copy>
3570
+ </xsl:template>
3571
+
3572
+ <xsl:template match="bipm:locality[@type='anchor']/bipm:referenceFrom " mode="change_id">
3573
+ <xsl:param name="lang"/>
3574
+ <xsl:param name="ignoreReferenceFrom"/>
3575
+ <xsl:copy>
3576
+ <xsl:apply-templates select="@*" mode="change_id">
3577
+ <xsl:with-param name="lang" select="$lang"/>
3578
+ <xsl:with-param name="ignoreReferenceFrom" select="$ignoreReferenceFrom"/>
3497
3579
  </xsl:apply-templates>
3580
+ <xsl:choose>
3581
+ <xsl:when test="$ignoreReferenceFrom = 'true'"><xsl:value-of select="."/></xsl:when>
3582
+ <xsl:otherwise><xsl:value-of select="."/>_<xsl:value-of select="$lang"/></xsl:otherwise>
3583
+ </xsl:choose>
3498
3584
  </xsl:copy>
3499
3585
  </xsl:template>
3500
3586
 
3501
3587
  <xsl:template match="@*" mode="change_id">
3502
3588
  <xsl:param name="lang"/>
3589
+ <xsl:param name="ignoreReferenceFrom"/>
3503
3590
  <xsl:choose>
3504
- <xsl:when test="local-name() = 'id' or local-name() = 'bibitemid' or (local-name() = 'target' and local-name(..) = 'xref')">
3591
+ <xsl:when test="$ignoreReferenceFrom = 'true' and local-name() = 'id' and xalan:nodeset($ids)//referenceFrom = .">
3592
+ <xsl:attribute name="{local-name()}">
3593
+ <xsl:value-of select="."/>
3594
+ </xsl:attribute>
3595
+ </xsl:when>
3596
+ <xsl:when test="local-name() = 'id' or local-name() = 'bibitemid' or (local-name() = 'target' and local-name(..) = 'xref')">
3505
3597
  <xsl:attribute name="{local-name()}">
3506
3598
  <xsl:value-of select="."/>_<xsl:value-of select="$lang"/>
3507
3599
  </xsl:attribute>
3508
3600
  </xsl:when>
3509
- <xsl:otherwise>
3601
+ <xsl:otherwise>
3602
+ <!-- no change -->
3510
3603
  <xsl:copy>
3511
3604
  <xsl:apply-templates select="@*" mode="change_id">
3512
3605
  <xsl:with-param name="lang" select="$lang"/>
3606
+ <xsl:with-param name="ignoreReferenceFrom" select="$ignoreReferenceFrom"/>
3513
3607
  </xsl:apply-templates>
3514
3608
  </xsl:copy>
3515
3609
  </xsl:otherwise>
3516
3610
  </xsl:choose>
3517
3611
  </xsl:template>
3518
3612
 
3613
+
3614
+
3519
3615
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
3520
3616
 
3521
3617
  <title-annex lang="en">Annex </title-annex>
@@ -3679,11 +3775,14 @@
3679
3775
  </xsl:choose>
3680
3776
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
3681
3777
 
3682
- <xsl:attribute name="font-family">Times New Roman, STIX Two Math, HanSans</xsl:attribute>
3778
+ <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
3683
3779
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
3684
3780
 
3685
3781
  </xsl:attribute-set><xsl:attribute-set name="link-style">
3686
3782
 
3783
+ <xsl:attribute name="color">blue</xsl:attribute>
3784
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3785
+
3687
3786
 
3688
3787
 
3689
3788
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
@@ -3903,6 +4002,13 @@
3903
4002
  </xsl:attribute-set><xsl:attribute-set name="term-style">
3904
4003
 
3905
4004
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
4005
+
4006
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
4007
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4008
+ <xsl:attribute name="text-align">left</xsl:attribute>
4009
+ <xsl:attribute name="margin-left">19mm</xsl:attribute>
4010
+ <xsl:attribute name="text-indent">-19mm</xsl:attribute>
4011
+
3906
4012
 
3907
4013
 
3908
4014
 
@@ -5263,6 +5369,7 @@
5263
5369
  </fo:inline>
5264
5370
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
5265
5371
  <fo:inline font-weight="bold">
5372
+
5266
5373
  <xsl:apply-templates/>
5267
5374
  </fo:inline>
5268
5375
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -5671,6 +5778,7 @@
5671
5778
  </xsl:choose>
5672
5779
  </xsl:variable>
5673
5780
  <fo:inline xsl:use-attribute-sets="link-style">
5781
+
5674
5782
  <xsl:choose>
5675
5783
  <xsl:when test="$target = ''">
5676
5784
  <xsl:apply-templates/>
@@ -5891,7 +5999,12 @@
5891
5999
  </fo:inline>
5892
6000
  </xsl:if>
5893
6001
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
5894
- <fo:block-container id="{@id}">
6002
+ <fo:block-container id="{@id}">
6003
+
6004
+ <xsl:if test="*[local-name() = 'name']">
6005
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
6006
+ </xsl:if>
6007
+
5895
6008
  <fo:block>
5896
6009
  <xsl:apply-templates/>
5897
6010
  </fo:block>
@@ -5942,7 +6055,7 @@
5942
6055
  <xsl:apply-templates mode="bookmarks"/>
5943
6056
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5944
6057
  <xsl:apply-templates select="."/>
5945
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
6058
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5946
6059
  <xsl:apply-templates mode="bookmarks"/>
5947
6060
  </xsl:template><xsl:template name="addBookmarks">
5948
6061
  <xsl:param name="contents"/>
@@ -6680,7 +6793,7 @@
6680
6793
  <fo:block id="{@id}">
6681
6794
  <xsl:apply-templates/>
6682
6795
  </fo:block>
6683
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
6796
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/><xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
6684
6797
 
6685
6798
  <fo:block id="{@id}">
6686
6799
  <xsl:apply-templates/>
@@ -43,6 +43,7 @@
43
43
  <xsl:variable name="current_document">
44
44
  <xsl:apply-templates select="." mode="change_id">
45
45
  <xsl:with-param name="lang" select="$lang"/>
46
+ <xsl:with-param name="ignoreReferenceFrom" select="'true'"/>
46
47
  </xsl:apply-templates>
47
48
  </xsl:variable>
48
49
  <xsl:for-each select="xalan:nodeset($current_document)">
@@ -89,6 +90,17 @@
89
90
 
90
91
  </xsl:variable>
91
92
 
93
+ <xsl:variable name="ids">
94
+ <xsl:for-each select="//*[@id]">
95
+ <id><xsl:value-of select="@id"/></id>
96
+ </xsl:for-each>
97
+ <xsl:for-each select="//bipm:locality[@type='anchor']/bipm:referenceFrom">
98
+ <referenceFrom><xsl:value-of select="."/></referenceFrom>
99
+ </xsl:for-each>
100
+ </xsl:variable>
101
+
102
+
103
+
92
104
  <xsl:variable name="independentAppendix" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:appendix)"/>
93
105
  <!-- <xsl:variable name="independentAppendix" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:title[@type = 'appendix'])"/> -->
94
106
 
@@ -96,8 +108,14 @@
96
108
 
97
109
  <xsl:template name="generateContents">
98
110
  <contents>
99
- <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
100
- <xsl:call-template name="processMainSectionsDefault_Contents"/>
111
+
112
+ <xsl:apply-templates select="/*/bipm:preface/*[position() &gt; 1]" mode="contents"/>
113
+
114
+ <xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
115
+ <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
116
+ <xsl:apply-templates select="/*/bipm:annex" mode="contents"/>
117
+ <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[not(@normative='true')]" mode="contents"/>
118
+
101
119
  </contents>
102
120
  </xsl:template>
103
121
 
@@ -230,6 +248,7 @@
230
248
  <xsl:variable name="current_document">
231
249
  <xsl:apply-templates select="." mode="change_id">
232
250
  <xsl:with-param name="lang" select="$lang"/>
251
+ <xsl:with-param name="ignoreReferenceFrom" select="'true'"/>
233
252
  </xsl:apply-templates>
234
253
  </xsl:variable>
235
254
 
@@ -382,8 +401,34 @@
382
401
  <xsl:apply-templates mode="flatxml"/>
383
402
  </xsl:template>
384
403
 
404
+
405
+ <!-- move note(s) inside element -->
406
+ <!-- but ignore quote, move inside element which before quote -->
407
+ <xsl:template match="bipm:clause/* [not(local-name() = 'quote')] [following-sibling::* [not(local-name()='quote')] [1][local-name() = 'note']]" mode="flatxml"> <!-- find element, which has next 'note' -->
408
+ <xsl:copy>
409
+ <xsl:apply-templates select="@*|node()" mode="flatxml"/>
410
+ <xsl:variable name="element-id" select="generate-id(.)"/>
411
+ <xsl:for-each select="following-sibling::bipm:note[generate-id(preceding-sibling::*[not(local-name()='note') and not(local-name()='quote')][1]) = $element-id]">
412
+ <xsl:call-template name="change_note_kind"/>
413
+ </xsl:for-each>
414
+
415
+ <!-- if current node is title level is 3 with notes, and next level is 4 -->
416
+ <xsl:if test="local-name() = 'title' and @depth = 3 and ../bipm:clause/bipm:title/@depth = 4 and count(following-sibling::*[1][local-name() = 'note']) &gt; 0">
417
+ <!-- then move here footnotes from clause level 4 -->
418
+ <xsl:for-each select="../bipm:clause//bipm:fn[ancestor::bipm:quote or not(ancestor::bipm:table)]">
419
+ <xsl:call-template name="fn_to_note_side"/>
420
+ </xsl:for-each>
421
+ </xsl:if>
422
+
423
+ </xsl:copy>
424
+ </xsl:template>
425
+
426
+ <!-- remove note(s), which was moved into element in previous template -->
427
+ <xsl:template match="bipm:clause/bipm:note" mode="flatxml" priority="2"/>
428
+
429
+
385
430
  <!-- move clause/note inside title, p, ul or ol -->
386
- <xsl:template match="bipm:clause/*[local-name() != 'quote' and local-name() != 'note' and local-name() != 'clause'][last()]" mode="flatxml">
431
+ <xsl:template match="bipm:clause2/*[local-name() != 'quote' and local-name() != 'note' and local-name() != 'clause'][last()]" mode="flatxml">
387
432
  <xsl:copy>
388
433
  <xsl:apply-templates select="@*|node()" mode="flatxml"/>
389
434
  <!-- <xsl:copy-of select="following-sibling::*[local-name() = 'note']"/> -->
@@ -407,7 +452,7 @@
407
452
  </xsl:template> -->
408
453
 
409
454
  <!-- <xsl:template match="bipm:clause/bipm:note[count(following-sibling::*) = 0]" mode="flatxml"/> -->
410
- <xsl:template match="bipm:clause/bipm:note[count(following-sibling::*[local-name() != 'clause' and local-name() != 'note']) = 0]" mode="flatxml" priority="2"/>
455
+ <!-- <xsl:template match="bipm:clause/bipm:note[count(following-sibling::*[local-name() != 'clause' and local-name() != 'note']) = 0]" mode="flatxml" priority="2"/> -->
411
456
 
412
457
 
413
458
  <xsl:template match="bipm:note" name="change_note_kind" mode="flatxml">
@@ -1111,7 +1156,7 @@
1111
1156
  <xsl:call-template name="insertCoverPageCommon"/>
1112
1157
 
1113
1158
  <fo:block-container height="100%" display-align="center" border="0pt solid black"><!-- -->
1114
- <fo:block font-family="WorkSans" font-size="50pt" line-height="115%">
1159
+ <fo:block font-family="Work Sans" font-size="50pt" line-height="115%">
1115
1160
 
1116
1161
  <xsl:variable name="languages">
1117
1162
  <xsl:call-template name="getLanguages"/>
@@ -1182,7 +1227,7 @@
1182
1227
 
1183
1228
  <fo:page-sequence master-reference="cover-page-appendix" force-page-count="even" initial-page-number="1">
1184
1229
 
1185
- <fo:flow flow-name="xsl-region-body" font-family="WorkSans">
1230
+ <fo:flow flow-name="xsl-region-body" font-family="Work Sans">
1186
1231
 
1187
1232
  <xsl:call-template name="insertCoverPageCommon"/>
1188
1233
 
@@ -1316,7 +1361,7 @@
1316
1361
  </fo:block-container>
1317
1362
 
1318
1363
  <!-- <fo:block-container>
1319
- <fo:block font-family="WorkSans" font-size="16pt" line-height="120%" font-weight="400" margin-top="20mm">
1364
+ <fo:block font-family="Work Sans" font-size="16pt" line-height="120%" font-weight="400" margin-top="20mm">
1320
1365
  <fo:block>
1321
1366
  <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $lang]"/>
1322
1367
  <xsl:text> (</xsl:text>
@@ -1336,7 +1381,7 @@
1336
1381
  <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:appendix"/>
1337
1382
  </fo:block>
1338
1383
  </fo:block>
1339
- <fo:block font-family="WorkSans" font-size="36pt" font-weight="600" margin-top="15mm">
1384
+ <fo:block font-family="Work Sans" font-size="36pt" font-weight="600" margin-top="15mm">
1340
1385
  <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@type = 'appendix' and @language = $lang]"/>
1341
1386
  </fo:block>
1342
1387
  </fo:block-container> -->
@@ -1585,6 +1630,7 @@
1585
1630
  <fo:block>
1586
1631
  <xsl:if test="@level = 1 or (@level = 2 and not(@parent = 'annex'))">
1587
1632
  <xsl:value-of select="@section"/>
1633
+ <xsl:if test="normalize-space(@section) != '' and @type = 'annex'">.</xsl:if>
1588
1634
  </xsl:if>
1589
1635
  <!-- <fo:inline font-size="10pt" color="white">Z</fo:inline> --> <!-- for baseline alignment in string -->
1590
1636
  </fo:block>
@@ -1836,7 +1882,7 @@
1836
1882
  </fo:block>
1837
1883
  </xsl:template>
1838
1884
 
1839
- <xsl:template match="bipm:license-statement//bipm:link">
1885
+ <!-- <xsl:template match="bipm:license-statement//bipm:link">
1840
1886
  <fo:inline color="blue" text-decoration="underline">
1841
1887
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
1842
1888
  <xsl:choose>
@@ -1849,7 +1895,7 @@
1849
1895
  </xsl:choose>
1850
1896
  </fo:basic-link>
1851
1897
  </fo:inline>
1852
- </xsl:template>
1898
+ </xsl:template> -->
1853
1899
 
1854
1900
 
1855
1901
  <xsl:template match="bipm:feedback-statement">
@@ -2905,18 +2951,31 @@
2905
2951
  <xsl:template match="bipm:xref" priority="2">
2906
2952
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
2907
2953
  <xsl:choose>
2908
- <xsl:when test="@pagenumber='true'"><!-- ToC in Appendix -->
2909
- <fo:inline font-weight="bold"><fo:page-number-citation ref-id="{@target}"/></fo:inline>
2954
+ <xsl:when test="@pagenumber='true'"><!-- ToC in Appendix, and page in references like this: « Le BIPM et la Convention du Mètre » (page 5). -->
2955
+ <fo:inline> <!-- font-weight="bold" -->
2956
+ <fo:page-number-citation ref-id="{@target}"/>
2957
+ </fo:inline>
2910
2958
  </xsl:when>
2911
2959
  <xsl:when test="starts-with(normalize-space(following-sibling::node()[1]), ')')">
2912
2960
  <!-- add , see p. N -->
2913
2961
  <!-- add , voir p. N -->
2914
2962
  <xsl:apply-templates/>
2915
2963
  <xsl:text>, </xsl:text>
2916
- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2917
- <xsl:value-of select="ancestor::bipm:bipm-standard/bipm:localized-strings/bipm:localized-string[@key='see' and @language=$curr_lang]"/>
2918
- <xsl:text> p. </xsl:text>
2919
- <fo:page-number-citation ref-id="{@target}"/>
2964
+
2965
+ <xsl:variable name="nosee" select="normalize-space(@nosee)"/>
2966
+ <xsl:if test="$nosee != 'true'">
2967
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2968
+ <fo:inline>
2969
+ <xsl:if test="ancestor::bipm:note_side">
2970
+ <xsl:attribute name="font-style">italic</xsl:attribute>
2971
+ </xsl:if>
2972
+ <xsl:value-of select="ancestor::bipm:bipm-standard/bipm:localized-strings/bipm:localized-string[@key='see' and @language=$curr_lang]"/>
2973
+ </fo:inline>
2974
+ <xsl:text> </xsl:text>
2975
+ </xsl:if>
2976
+
2977
+ <xsl:text>p. </xsl:text>
2978
+ <fo:page-number-citation ref-id="{@target}"/>
2920
2979
  </xsl:when>
2921
2980
  <xsl:otherwise>
2922
2981
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -2925,6 +2984,16 @@
2925
2984
  </fo:basic-link>
2926
2985
  </xsl:template>
2927
2986
 
2987
+ <xsl:template match="bipm:eref[.//bipm:locality[@type = 'anchor']]" priority="2">
2988
+ <xsl:variable name="target" select=".//bipm:locality[@type = 'anchor']/bipm:referenceFrom"/>
2989
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
2990
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'localityStack')]"/> -->
2991
+ <xsl:if test="xalan:nodeset($ids)//id = $target">
2992
+ <fo:page-number-citation ref-id="{$target}"/>
2993
+ </xsl:if>
2994
+ </fo:basic-link>
2995
+ </xsl:template>
2996
+
2928
2997
  <xsl:template match="bipm:note[not(ancestor::bipm:preface)]/bipm:name" priority="2" mode="presentation">
2929
2998
  <xsl:choose>
2930
2999
  <xsl:when test="not(../preceding-sibling::bipm:note) and not((../following-sibling::bipm:note))">
@@ -3491,31 +3560,58 @@
3491
3560
 
3492
3561
  <xsl:template match="node()" mode="change_id">
3493
3562
  <xsl:param name="lang"/>
3563
+ <xsl:param name="ignoreReferenceFrom"/>
3494
3564
  <xsl:copy>
3495
3565
  <xsl:apply-templates select="@*|node()" mode="change_id">
3496
3566
  <xsl:with-param name="lang" select="$lang"/>
3567
+ <xsl:with-param name="ignoreReferenceFrom" select="$ignoreReferenceFrom"/>
3568
+ </xsl:apply-templates>
3569
+ </xsl:copy>
3570
+ </xsl:template>
3571
+
3572
+ <xsl:template match="bipm:locality[@type='anchor']/bipm:referenceFrom " mode="change_id">
3573
+ <xsl:param name="lang"/>
3574
+ <xsl:param name="ignoreReferenceFrom"/>
3575
+ <xsl:copy>
3576
+ <xsl:apply-templates select="@*" mode="change_id">
3577
+ <xsl:with-param name="lang" select="$lang"/>
3578
+ <xsl:with-param name="ignoreReferenceFrom" select="$ignoreReferenceFrom"/>
3497
3579
  </xsl:apply-templates>
3580
+ <xsl:choose>
3581
+ <xsl:when test="$ignoreReferenceFrom = 'true'"><xsl:value-of select="."/></xsl:when>
3582
+ <xsl:otherwise><xsl:value-of select="."/>_<xsl:value-of select="$lang"/></xsl:otherwise>
3583
+ </xsl:choose>
3498
3584
  </xsl:copy>
3499
3585
  </xsl:template>
3500
3586
 
3501
3587
  <xsl:template match="@*" mode="change_id">
3502
3588
  <xsl:param name="lang"/>
3589
+ <xsl:param name="ignoreReferenceFrom"/>
3503
3590
  <xsl:choose>
3504
- <xsl:when test="local-name() = 'id' or local-name() = 'bibitemid' or (local-name() = 'target' and local-name(..) = 'xref')">
3591
+ <xsl:when test="$ignoreReferenceFrom = 'true' and local-name() = 'id' and xalan:nodeset($ids)//referenceFrom = .">
3592
+ <xsl:attribute name="{local-name()}">
3593
+ <xsl:value-of select="."/>
3594
+ </xsl:attribute>
3595
+ </xsl:when>
3596
+ <xsl:when test="local-name() = 'id' or local-name() = 'bibitemid' or (local-name() = 'target' and local-name(..) = 'xref')">
3505
3597
  <xsl:attribute name="{local-name()}">
3506
3598
  <xsl:value-of select="."/>_<xsl:value-of select="$lang"/>
3507
3599
  </xsl:attribute>
3508
3600
  </xsl:when>
3509
- <xsl:otherwise>
3601
+ <xsl:otherwise>
3602
+ <!-- no change -->
3510
3603
  <xsl:copy>
3511
3604
  <xsl:apply-templates select="@*" mode="change_id">
3512
3605
  <xsl:with-param name="lang" select="$lang"/>
3606
+ <xsl:with-param name="ignoreReferenceFrom" select="$ignoreReferenceFrom"/>
3513
3607
  </xsl:apply-templates>
3514
3608
  </xsl:copy>
3515
3609
  </xsl:otherwise>
3516
3610
  </xsl:choose>
3517
3611
  </xsl:template>
3518
3612
 
3613
+
3614
+
3519
3615
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
3520
3616
 
3521
3617
  <title-annex lang="en">Annex </title-annex>
@@ -3679,11 +3775,14 @@
3679
3775
  </xsl:choose>
3680
3776
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
3681
3777
 
3682
- <xsl:attribute name="font-family">Times New Roman, STIX Two Math, HanSans</xsl:attribute>
3778
+ <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
3683
3779
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
3684
3780
 
3685
3781
  </xsl:attribute-set><xsl:attribute-set name="link-style">
3686
3782
 
3783
+ <xsl:attribute name="color">blue</xsl:attribute>
3784
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3785
+
3687
3786
 
3688
3787
 
3689
3788
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
@@ -3903,6 +4002,13 @@
3903
4002
  </xsl:attribute-set><xsl:attribute-set name="term-style">
3904
4003
 
3905
4004
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
4005
+
4006
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
4007
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4008
+ <xsl:attribute name="text-align">left</xsl:attribute>
4009
+ <xsl:attribute name="margin-left">19mm</xsl:attribute>
4010
+ <xsl:attribute name="text-indent">-19mm</xsl:attribute>
4011
+
3906
4012
 
3907
4013
 
3908
4014
 
@@ -5263,6 +5369,7 @@
5263
5369
  </fo:inline>
5264
5370
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
5265
5371
  <fo:inline font-weight="bold">
5372
+
5266
5373
  <xsl:apply-templates/>
5267
5374
  </fo:inline>
5268
5375
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -5671,6 +5778,7 @@
5671
5778
  </xsl:choose>
5672
5779
  </xsl:variable>
5673
5780
  <fo:inline xsl:use-attribute-sets="link-style">
5781
+
5674
5782
  <xsl:choose>
5675
5783
  <xsl:when test="$target = ''">
5676
5784
  <xsl:apply-templates/>
@@ -5891,7 +5999,12 @@
5891
5999
  </fo:inline>
5892
6000
  </xsl:if>
5893
6001
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
5894
- <fo:block-container id="{@id}">
6002
+ <fo:block-container id="{@id}">
6003
+
6004
+ <xsl:if test="*[local-name() = 'name']">
6005
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
6006
+ </xsl:if>
6007
+
5895
6008
  <fo:block>
5896
6009
  <xsl:apply-templates/>
5897
6010
  </fo:block>
@@ -5942,7 +6055,7 @@
5942
6055
  <xsl:apply-templates mode="bookmarks"/>
5943
6056
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5944
6057
  <xsl:apply-templates select="."/>
5945
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
6058
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5946
6059
  <xsl:apply-templates mode="bookmarks"/>
5947
6060
  </xsl:template><xsl:template name="addBookmarks">
5948
6061
  <xsl:param name="contents"/>
@@ -6680,7 +6793,7 @@
6680
6793
  <fo:block id="{@id}">
6681
6794
  <xsl:apply-templates/>
6682
6795
  </fo:block>
6683
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
6796
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/><xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
6684
6797
 
6685
6798
  <fo:block id="{@id}">
6686
6799
  <xsl:apply-templates/>