metanorma-bipm 1.2.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,6 +17,8 @@
17
17
 
18
18
  <xsl:param name="add_math_as_attachment">true</xsl:param>
19
19
 
20
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
21
+
20
22
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
21
23
 
22
24
  <xsl:variable name="pageWidth" select="210"/>
@@ -247,33 +249,68 @@
247
249
  <xsl:template match="/">
248
250
  <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
249
251
  <fo:layout-master-set>
252
+
253
+ <!-- blank page -->
254
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
255
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
256
+ <fo:region-before region-name="header-blank" extent="{$marginTop}mm"/>
257
+ <fo:region-after region-name="footer-blank" extent="{$marginBottom}mm"/>
258
+ <fo:region-start region-name="left-region" extent="17mm"/>
259
+ <fo:region-end region-name="right-region" extent="26.5mm"/>
260
+ </fo:simple-page-master>
261
+
250
262
  <!-- Cover page -->
251
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
263
+ <fo:simple-page-master master-name="simple-cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
252
264
  <fo:region-body margin-top="36mm" margin-bottom="43mm" margin-left="49mm" margin-right="48mm"/>
253
- <fo:region-before extent="36mm"/>
265
+ <fo:region-before region-name="header" extent="36mm"/>
254
266
  <fo:region-after extent="43mm"/>
255
267
  <fo:region-start extent="49mm"/>
256
268
  <fo:region-end extent="48mm"/>
257
269
  </fo:simple-page-master>
258
270
 
271
+ <fo:page-sequence-master master-name="cover-page">
272
+ <fo:repeatable-page-master-alternatives>
273
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
274
+ <fo:conditional-page-master-reference master-reference="simple-cover-page" odd-or-even="odd"/>
275
+ <fo:conditional-page-master-reference master-reference="simple-cover-page" odd-or-even="even"/>
276
+ </fo:repeatable-page-master-alternatives>
277
+ </fo:page-sequence-master>
278
+
259
279
  <!-- Cover page -->
260
- <fo:simple-page-master master-name="cover-page-appendix" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
280
+ <fo:simple-page-master master-name="simple-cover-page-appendix" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
261
281
  <fo:region-body margin-top="90mm" margin-bottom="40mm" margin-left="12.5mm" margin-right="53mm"/>
262
- <fo:region-before extent="60mm"/>
282
+ <fo:region-before region-name="header" extent="60mm"/>
263
283
  <fo:region-after extent="40mm"/>
264
284
  <fo:region-start extent="12.5mm"/>
265
285
  <fo:region-end extent="53mm"/>
266
286
  </fo:simple-page-master>
267
287
 
288
+ <fo:page-sequence-master master-name="cover-page-appendix">
289
+ <fo:repeatable-page-master-alternatives>
290
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
291
+ <fo:conditional-page-master-reference master-reference="simple-cover-page-appendix" odd-or-even="odd"/>
292
+ <fo:conditional-page-master-reference master-reference="simple-cover-page-appendix" odd-or-even="even"/>
293
+ </fo:repeatable-page-master-alternatives>
294
+ </fo:page-sequence-master>
295
+
296
+
268
297
  <!-- Title page -->
269
- <fo:simple-page-master master-name="title-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
298
+ <fo:simple-page-master master-name="simple-title-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
270
299
  <fo:region-body margin-top="38mm" margin-bottom="25mm" margin-left="95mm" margin-right="12mm"/>
271
- <fo:region-before extent="38mm"/>
300
+ <fo:region-before region-name="header" extent="38mm"/>
272
301
  <fo:region-after extent="25mm"/>
273
302
  <fo:region-start extent="95mm"/>
274
303
  <fo:region-end extent="12mm"/>
275
304
  </fo:simple-page-master>
276
305
 
306
+ <fo:page-sequence-master master-name="title-page">
307
+ <fo:repeatable-page-master-alternatives>
308
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
309
+ <fo:conditional-page-master-reference master-reference="simple-title-page" odd-or-even="odd"/>
310
+ <fo:conditional-page-master-reference master-reference="simple-title-page" odd-or-even="even"/>
311
+ </fo:repeatable-page-master-alternatives>
312
+ </fo:page-sequence-master>
313
+
277
314
  <!-- Document pages -->
278
315
  <fo:simple-page-master master-name="document-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
279
316
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
@@ -291,6 +328,7 @@
291
328
  </fo:simple-page-master>
292
329
  <fo:page-sequence-master master-name="document">
293
330
  <fo:repeatable-page-master-alternatives>
331
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
294
332
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="document-even"/>
295
333
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="document-odd"/>
296
334
  </fo:repeatable-page-master-alternatives>
@@ -312,7 +350,8 @@
312
350
  <fo:region-end region-name="right-region" extent="26.5mm"/>
313
351
  </fo:simple-page-master>
314
352
  <fo:page-sequence-master master-name="document-landscape">
315
- <fo:repeatable-page-master-alternatives>
353
+ <fo:repeatable-page-master-alternatives>
354
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
316
355
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="document-landscape-even"/>
317
356
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="document-landscape-odd"/>
318
357
  </fo:repeatable-page-master-alternatives>
@@ -334,7 +373,8 @@
334
373
  <fo:region-end region-name="right-region" extent="26.5mm"/>
335
374
  </fo:simple-page-master>
336
375
  <fo:page-sequence-master master-name="index">
337
- <fo:repeatable-page-master-alternatives>
376
+ <fo:repeatable-page-master-alternatives>
377
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
338
378
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="index-even"/>
339
379
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="index-odd"/>
340
380
  </fo:repeatable-page-master-alternatives>
@@ -922,8 +962,11 @@
922
962
  <xsl:template name="setListItemLabel">
923
963
  <xsl:attribute name="label">
924
964
  <xsl:choose>
925
- <xsl:when test="local-name(..) = 'ul' and ../ancestor::bipm:ul">−</xsl:when> <!-- &#x2212; - minus sign. &#x2014; - dash -->
926
- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> <!-- &#x2014; dash -->
965
+ <xsl:when test="local-name(..) = 'ul'">
966
+ <xsl:call-template name="setULLabel"/>
967
+ </xsl:when>
968
+ <!-- <xsl:when test="local-name(..) = 'ul' and ../ancestor::bipm:ul">&#x2212;</xsl:when> --> <!-- &#x2212; - minus sign. &#x2014; - dash -->
969
+ <!-- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> --> <!-- &#x2014; dash -->
927
970
  <xsl:otherwise> <!-- for ordered lists -->
928
971
  <xsl:variable name="start_value">
929
972
  <xsl:choose>
@@ -1106,6 +1149,9 @@
1106
1149
  </xsl:if>
1107
1150
 
1108
1151
  <xsl:call-template name="insertFootnoteSeparator"/>
1152
+
1153
+ <xsl:call-template name="insertHeaderDraftWatermark"/>
1154
+
1109
1155
  <fo:flow flow-name="xsl-region-body" font-family="Arial">
1110
1156
 
1111
1157
  <fo:block-container font-size="12pt" font-weight="bold" border-top="1pt solid black" width="82mm" margin-top="2mm" padding-top="2mm">
@@ -1212,9 +1258,6 @@
1212
1258
 
1213
1259
  <xsl:variable name="title-toc">
1214
1260
  <fo:inline>
1215
- <!-- <xsl:call-template name="getTitle">
1216
- <xsl:with-param name="name" select="'title-toc'"/>
1217
- </xsl:call-template> -->
1218
1261
  <xsl:call-template name="getLocalizedString">
1219
1262
  <xsl:with-param name="key">table_of_contents</xsl:with-param>
1220
1263
  </xsl:call-template>
@@ -1303,7 +1346,9 @@
1303
1346
 
1304
1347
  <!-- Index -->
1305
1348
  <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1306
- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
1349
+ <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index">
1350
+ <xsl:with-param name="isDraft" select="normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet'))"/>
1351
+ </xsl:apply-templates>
1307
1352
 
1308
1353
  <!-- End Document Pages -->
1309
1354
 
@@ -1322,6 +1367,8 @@
1322
1367
 
1323
1368
  <fo:page-sequence master-reference="document" force-page-count="no-force">
1324
1369
 
1370
+ <xsl:call-template name="insertHeaderDraftWatermark"/>
1371
+
1325
1372
  <fo:flow flow-name="xsl-region-body" font-family="Arial">
1326
1373
 
1327
1374
  <fo:block-container font-size="12pt" font-weight="bold" border-top="1pt solid black" width="82mm" margin-top="2mm" padding-top="2mm">
@@ -1382,7 +1429,12 @@
1382
1429
  <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']">
1383
1430
  <fo:block role="H2">
1384
1431
  <xsl:if test="$part_num != ''">
1385
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part_num)"/>
1432
+ <xsl:call-template name="getLocalizedString">
1433
+ <xsl:with-param name="key">Part.sg</xsl:with-param>
1434
+ <xsl:with-param name="lang" select="$curr_lang"/>
1435
+ </xsl:call-template>
1436
+ <xsl:text> </xsl:text>
1437
+ <xsl:value-of select="$part_num"/>
1386
1438
  </xsl:if>
1387
1439
  <xsl:text>: </xsl:text>
1388
1440
  <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']" mode="title"/>
@@ -1471,7 +1523,9 @@
1471
1523
 
1472
1524
  <!-- Index -->
1473
1525
  <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1474
- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
1526
+ <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index">
1527
+ <xsl:with-param name="isDraft" select="normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet'))"/>
1528
+ </xsl:apply-templates>
1475
1529
 
1476
1530
  </xsl:otherwise>
1477
1531
  </xsl:choose>
@@ -1485,6 +1539,8 @@
1485
1539
 
1486
1540
  <fo:page-sequence master-reference="cover-page" force-page-count="even">
1487
1541
 
1542
+ <xsl:call-template name="insertHeaderDraftWatermark"/>
1543
+
1488
1544
  <fo:flow flow-name="xsl-region-body">
1489
1545
 
1490
1546
  <xsl:call-template name="insertCoverPageCommon"/>
@@ -1703,9 +1759,13 @@
1703
1759
  <xsl:if test="$part_num != ''">
1704
1760
  <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1705
1761
  <!-- Part -->
1706
- <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part_num)"/></fo:block>
1762
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}">
1763
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part_num)"/>
1764
+ </fo:block>
1707
1765
  <!-- Partie -->
1708
- <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part_num)"/></fo:block>
1766
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}">
1767
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part_num)"/>
1768
+ </fo:block>
1709
1769
  </xsl:if>
1710
1770
 
1711
1771
  <fo:block font-size="{$font-size-factor * 30.4}pt">
@@ -1820,6 +1880,8 @@
1820
1880
  </fo:block>
1821
1881
  </fo:block-container>
1822
1882
 
1883
+ <xsl:call-template name="insertDraftWatermark"/>
1884
+
1823
1885
  <!-- BIPM logo -->
1824
1886
  <fo:block-container absolute-position="fixed" left="12.8mm" top="12.2mm">
1825
1887
  <fo:block>
@@ -1844,6 +1906,8 @@
1844
1906
 
1845
1907
  <fo:page-sequence master-reference="title-page" format="1" initial-page-number="1" force-page-count="even">
1846
1908
 
1909
+ <xsl:call-template name="insertHeaderDraftWatermark"/>
1910
+
1847
1911
  <fo:flow flow-name="xsl-region-body" font-family="Arial">
1848
1912
 
1849
1913
  <xsl:variable name="languages">
@@ -2126,7 +2190,7 @@
2126
2190
 
2127
2191
  <xsl:variable name="display">
2128
2192
  <xsl:choose>
2129
- <xsl:when test="$level &gt;= 4">false</xsl:when>
2193
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
2130
2194
  <xsl:otherwise>true</xsl:otherwise>
2131
2195
  </xsl:choose>
2132
2196
  </xsl:variable>
@@ -2363,7 +2427,7 @@
2363
2427
  <!-- ====== -->
2364
2428
 
2365
2429
 
2366
- <xsl:template match="bipm:title" name="clause_title">
2430
+ <xsl:template match="bipm:title" name="title">
2367
2431
 
2368
2432
  <xsl:variable name="level">
2369
2433
  <xsl:call-template name="getLevel"/>
@@ -3036,35 +3100,6 @@
3036
3100
  </xsl:choose>
3037
3101
  </xsl:template>
3038
3102
 
3039
- <!--
3040
- <fn reference="1">
3041
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
3042
- </fn>
3043
- -->
3044
- <xsl:template match="bipm:title//bipm:fn | bipm:name//bipm:fn | bipm:p/bipm:fn[not(ancestor::bipm:table)] | bipm:p/*/bipm:fn[not(ancestor::bipm:table)] | bipm:sourcecode/bipm:fn[not(ancestor::bipm:table)]" priority="2" name="fn">
3045
- <fo:footnote keep-with-previous.within-line="always">
3046
- <xsl:variable name="number"> <!-- select="@reference"/> -->
3047
- <xsl:number count="bipm:fn[not(ancestor::bipm:table)]" level="any"/>
3048
- </xsl:variable>
3049
- <xsl:variable name="gen_id" select="generate-id()"/>
3050
- <xsl:variable name="lang" select="ancestor::bipm:bipm-standard/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3051
- <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
3052
- <fo:basic-link internal-destination="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" fox:alt-text="footnote {@reference}">
3053
- <xsl:value-of select="$number"/><!-- + count(//bipm:bibitem/bipm:note) -->
3054
- </fo:basic-link>
3055
- </fo:inline>
3056
- <fo:footnote-body>
3057
- <fo:block font-size="9pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" line-height="124%" text-align="justify">
3058
- <fo:inline id="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super" padding-right="1mm"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
3059
- <xsl:value-of select="$number "/><!-- + count(//bipm:bibitem/bipm:note) -->
3060
- </fo:inline>
3061
- <xsl:for-each select="bipm:p">
3062
- <xsl:apply-templates/>
3063
- </xsl:for-each>
3064
- </fo:block>
3065
- </fo:footnote-body>
3066
- </fo:footnote>
3067
- </xsl:template>
3068
3103
 
3069
3104
  <xsl:template match="bipm:fn/bipm:p">
3070
3105
  <fo:block>
@@ -3311,11 +3346,13 @@
3311
3346
  <fo:table-body>
3312
3347
  <fo:table-row>
3313
3348
  <fo:table-cell>
3314
- <fo:block><xsl:apply-templates select="*[local-name()='name']" mode="presentation"/></fo:block>
3349
+ <fo:block>
3350
+ <xsl:apply-templates select="*[local-name()='name']"/>
3351
+ </fo:block>
3315
3352
  </fo:table-cell>
3316
3353
  <fo:table-cell>
3317
3354
  <fo:block>
3318
- <xsl:apply-templates/>
3355
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3319
3356
  </fo:block>
3320
3357
  </fo:table-cell>
3321
3358
  </fo:table-row>
@@ -3326,11 +3363,12 @@
3326
3363
 
3327
3364
  <xsl:template match="bipm:preferred">
3328
3365
  <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3366
+ <xsl:call-template name="setStyle_preferred"/>
3329
3367
  <xsl:if test="ancestor::bipm:term[1]/bipm:name">
3330
3368
  <xsl:variable name="level">
3331
3369
  <xsl:call-template name="getLevelTermName"/>
3332
3370
  </xsl:variable>
3333
- <fo:inline role="H{$level}">
3371
+ <fo:inline role="H{$level}" font-weight="bold">
3334
3372
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
3335
3373
  <xsl:apply-templates select="ancestor::bipm:term[1]/bipm:name" mode="presentation"/>
3336
3374
  </fo:inline>
@@ -3398,14 +3436,17 @@
3398
3436
  <fo:block>
3399
3437
  <fo:inline>
3400
3438
  <!-- <xsl:number format="1."/> -->
3401
- <xsl:choose>
3402
- <xsl:when test="bipm:docidentifier[@type='metanorma']">
3403
- <xsl:value-of select="bipm:docidentifier[@type='metanorma']"/>
3404
- </xsl:when>
3405
- <xsl:otherwise>
3406
- <xsl:number format="[1]"/>
3407
- </xsl:otherwise>
3408
- </xsl:choose>
3439
+ <xsl:value-of select="bipm:docidentifier[@type='metanorma-ordinal']"/>
3440
+ <xsl:if test="not(bipm:docidentifier[@type='metanorma-ordinal'])">
3441
+ <xsl:choose>
3442
+ <xsl:when test="bipm:docidentifier[@type='metanorma']">
3443
+ <xsl:value-of select="bipm:docidentifier[@type='metanorma']"/>
3444
+ </xsl:when>
3445
+ <xsl:otherwise>
3446
+ <xsl:number format="[1]"/>
3447
+ </xsl:otherwise>
3448
+ </xsl:choose>
3449
+ </xsl:if>
3409
3450
  </fo:inline>
3410
3451
  </fo:block>
3411
3452
  </fo:list-item-label>
@@ -3419,8 +3460,6 @@
3419
3460
  </fo:list-block>
3420
3461
  </xsl:template>
3421
3462
 
3422
-
3423
- <xsl:template match="bipm:references[not(@normative='true')]/bipm:bibitem" mode="contents"/>
3424
3463
 
3425
3464
  <xsl:template match="bipm:bibitem/bipm:title">
3426
3465
  <fo:inline font-style="italic">
@@ -3428,7 +3467,7 @@
3428
3467
  </fo:inline>
3429
3468
  </xsl:template>
3430
3469
 
3431
- <xsl:template match="bipm:references/bipm:bibitem/bipm:docidentifier[@type='metanorma' and ../bipm:formattedref]"/>
3470
+ <xsl:template match="bipm:references/bipm:bibitem/bipm:docidentifier[(@type='metanorma' or @type='metanorma-ordinal') and ../bipm:formattedref]"/>
3432
3471
 
3433
3472
 
3434
3473
  <xsl:template match="bipm:pagebreak">
@@ -3908,7 +3947,11 @@
3908
3947
  <xsl:template name="insertHeaderFooter">
3909
3948
  <xsl:param name="header-title"/>
3910
3949
  <xsl:param name="orientation"/>
3950
+ <xsl:param name="isDraft"/>
3911
3951
  <fo:static-content flow-name="header-odd" role="artifact">
3952
+ <xsl:call-template name="insertDraftWatermark">
3953
+ <xsl:with-param name="isDraft" select="$isDraft"/>
3954
+ </xsl:call-template>
3912
3955
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3913
3956
  <fo:block text-align="right">
3914
3957
  <xsl:copy-of select="$header-title"/>
@@ -3929,6 +3972,9 @@
3929
3972
  </fo:block-container>
3930
3973
  </fo:static-content>
3931
3974
  <fo:static-content flow-name="header-even" role="artifact">
3975
+ <xsl:call-template name="insertDraftWatermark">
3976
+ <xsl:with-param name="isDraft" select="$isDraft"/>
3977
+ </xsl:call-template>
3932
3978
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3933
3979
  <fo:block>
3934
3980
  <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
@@ -3944,7 +3990,74 @@
3944
3990
  <fo:block> </fo:block>
3945
3991
  </fo:block-container>
3946
3992
  </fo:block-container>
3947
- </fo:static-content>
3993
+ </fo:static-content>
3994
+ <fo:static-content flow-name="header-blank" role="artifact">
3995
+ <xsl:call-template name="insertDraftWatermark">
3996
+ <xsl:with-param name="isDraft" select="$isDraft"/>
3997
+ </xsl:call-template>
3998
+ <fo:block/>
3999
+ </fo:static-content>
4000
+ </xsl:template>
4001
+
4002
+ <xsl:template name="insertDraftWatermark">
4003
+ <xsl:param name="isDraft"/>
4004
+ <xsl:if test="$isDraft = 'true' or normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet')) = 'true'">
4005
+ <!-- DRAFT -->
4006
+ <xsl:variable name="draft_label">
4007
+ <xsl:call-template name="getLocalizedString">
4008
+ <xsl:with-param name="key">draft_label</xsl:with-param>
4009
+ </xsl:call-template>
4010
+ </xsl:variable>
4011
+ <fo:block-container absolute-position="fixed" left="0mm" top="30mm">
4012
+ <fo:block line-height="0">
4013
+ <fo:instream-foreign-object fox:alt-text="DRAFT">
4014
+ <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="200mm" height="250mm">
4015
+ <svg:g transform="rotate(-45) scale(0.6, 1)">
4016
+ <xsl:variable name="font-size">
4017
+ <xsl:choose>
4018
+ <xsl:when test="string-length($draft_label) &gt; 5">150</xsl:when>
4019
+ <xsl:otherwise>260</xsl:otherwise>
4020
+ </xsl:choose>
4021
+ </xsl:variable>
4022
+ <svg:text x="-175mm" y="205mm" style="font-family:Arial;font-size:{$font-size}pt;font-weight:normal;fill:rgb(223, 223, 223);">
4023
+ <xsl:if test="string-length($draft_label) &gt; 5">
4024
+ <xsl:attribute name="x">-175mm</xsl:attribute>
4025
+ <xsl:attribute name="y">180mm</xsl:attribute>
4026
+ </xsl:if>
4027
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($draft_label))"/>
4028
+ </svg:text>
4029
+ </svg:g>
4030
+ </svg:svg>
4031
+ </fo:instream-foreign-object>
4032
+ </fo:block>
4033
+ </fo:block-container>
4034
+ </xsl:if>
4035
+ </xsl:template>
4036
+
4037
+ <xsl:template name="insertHeaderDraftWatermark">
4038
+ <xsl:variable name="isDraft" select="normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet'))"/>
4039
+ <xsl:if test="$isDraft = 'true'">
4040
+ <fo:static-content flow-name="header-blank" role="artifact">
4041
+ <xsl:call-template name="insertDraftWatermark">
4042
+ <xsl:with-param name="isDraft" select="$isDraft"/>
4043
+ </xsl:call-template>
4044
+ </fo:static-content>
4045
+ <fo:static-content flow-name="header" role="artifact">
4046
+ <xsl:call-template name="insertDraftWatermark">
4047
+ <xsl:with-param name="isDraft" select="$isDraft"/>
4048
+ </xsl:call-template>
4049
+ </fo:static-content>
4050
+ <fo:static-content flow-name="header-odd" role="artifact">
4051
+ <xsl:call-template name="insertDraftWatermark">
4052
+ <xsl:with-param name="isDraft" select="$isDraft"/>
4053
+ </xsl:call-template>
4054
+ </fo:static-content>
4055
+ <fo:static-content flow-name="header-even" role="artifact">
4056
+ <xsl:call-template name="insertDraftWatermark">
4057
+ <xsl:with-param name="isDraft" select="$isDraft"/>
4058
+ </xsl:call-template>
4059
+ </fo:static-content>
4060
+ </xsl:if>
3948
4061
  </xsl:template>
3949
4062
 
3950
4063
  <!-- <xsl:template name="insertHeaderFooterAppendix">
@@ -4089,6 +4202,7 @@
4089
4202
  <!-- <xsl:template match="bipm:clause[@type = 'index']" mode="index"> -->
4090
4203
  <xsl:template match="bipm:indexsect"/>
4091
4204
  <xsl:template match="bipm:indexsect" mode="index">
4205
+ <xsl:param name="isDraft"/>
4092
4206
 
4093
4207
  <fo:page-sequence master-reference="index" force-page-count="no-force">
4094
4208
  <xsl:variable name="header-title">
@@ -4103,6 +4217,7 @@
4103
4217
  </xsl:variable>
4104
4218
  <xsl:call-template name="insertHeaderFooter">
4105
4219
  <xsl:with-param name="header-title" select="$header-title"/>
4220
+ <xsl:with-param name="isDraft" select="$isDraft"/>
4106
4221
  </xsl:call-template>
4107
4222
 
4108
4223
  <fo:flow flow-name="xsl-region-body">
@@ -4548,13 +4663,6 @@
4548
4663
 
4549
4664
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
4550
4665
 
4551
- <title-annex lang="en">Annex </title-annex>
4552
- <title-annex lang="fr">Annexe </title-annex>
4553
-
4554
- <title-annex lang="zh">Annex </title-annex>
4555
-
4556
-
4557
-
4558
4666
  <title-edition lang="en">
4559
4667
 
4560
4668
  <xsl:text>Edition </xsl:text>
@@ -4568,33 +4676,18 @@
4568
4676
 
4569
4677
  </title-edition>
4570
4678
 
4571
-
4679
+
4680
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
4572
4681
  <title-toc lang="en">
4573
4682
 
4574
- <xsl:text>Contents</xsl:text>
4575
-
4576
4683
 
4577
4684
 
4578
4685
  </title-toc>
4579
4686
  <title-toc lang="fr">
4580
4687
 
4581
-
4582
- <xsl:text>Table des matières</xsl:text>
4583
-
4584
- </title-toc>
4585
-
4586
- <title-toc lang="zh">Contents</title-toc>
4587
-
4588
-
4688
+ </title-toc>
4589
4689
 
4590
- <title-page lang="en">Page</title-page>
4591
- <title-page lang="fr">Page</title-page>
4592
4690
 
4593
- <title-key lang="en">Key</title-key>
4594
- <title-key lang="fr">Légende</title-key>
4595
-
4596
- <title-where lang="en">where</title-where>
4597
- <title-where lang="fr">où</title-where>
4598
4691
 
4599
4692
  <title-descriptors lang="en">Descriptors</title-descriptors>
4600
4693
 
@@ -4625,25 +4718,6 @@
4625
4718
 
4626
4719
  </title-subpart>
4627
4720
 
4628
- <title-modified lang="en">modified</title-modified>
4629
- <title-modified lang="fr">modifiée</title-modified>
4630
-
4631
- <title-modified lang="zh">modified</title-modified>
4632
-
4633
-
4634
-
4635
- <title-source lang="en">
4636
-
4637
- <xsl:text>SOURCE</xsl:text>
4638
-
4639
-
4640
- </title-source>
4641
-
4642
- <title-keywords lang="en">Keywords</title-keywords>
4643
-
4644
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
4645
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
4646
-
4647
4721
  <title-list-tables lang="en">List of Tables</title-list-tables>
4648
4722
 
4649
4723
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -4652,37 +4726,8 @@
4652
4726
 
4653
4727
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
4654
4728
 
4655
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
4656
-
4657
- <title-abstract lang="en">Abstract</title-abstract>
4658
-
4659
4729
  <title-summary lang="en">Summary</title-summary>
4660
4730
 
4661
- <title-in lang="en">in </title-in>
4662
-
4663
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
4664
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
4665
-
4666
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
4667
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
4668
-
4669
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
4670
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
4671
-
4672
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
4673
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
4674
-
4675
- <title-obligation-normative lang="en">normative</title-obligation-normative>
4676
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
4677
-
4678
- <title-caution lang="en">CAUTION</title-caution>
4679
- <title-caution lang="zh">注意</title-caution>
4680
-
4681
- <title-warning lang="en">WARNING</title-warning>
4682
- <title-warning lang="zh">警告</title-warning>
4683
-
4684
- <title-amendment lang="en">AMENDMENT</title-amendment>
4685
-
4686
4731
  <title-continued lang="en">(continued)</title-continued>
4687
4732
  <title-continued lang="fr">(continué)</title-continued>
4688
4733
 
@@ -4787,6 +4832,7 @@
4787
4832
 
4788
4833
 
4789
4834
 
4835
+
4790
4836
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
4791
4837
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4792
4838
 
@@ -4795,7 +4841,9 @@
4795
4841
 
4796
4842
 
4797
4843
 
4844
+
4798
4845
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
4846
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4799
4847
 
4800
4848
 
4801
4849
 
@@ -4830,6 +4878,7 @@
4830
4878
 
4831
4879
 
4832
4880
 
4881
+
4833
4882
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
4834
4883
 
4835
4884
 
@@ -5079,7 +5128,81 @@
5079
5128
 
5080
5129
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
5081
5130
  <xsl:attribute name="line-height">135%</xsl:attribute>
5082
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
5131
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
5132
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5133
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
5134
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5135
+
5136
+ <xsl:attribute name="font-size">65%</xsl:attribute>
5137
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5138
+
5139
+
5140
+
5141
+
5142
+
5143
+
5144
+
5145
+
5146
+
5147
+
5148
+
5149
+
5150
+
5151
+
5152
+
5153
+
5154
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
5155
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5156
+ <xsl:attribute name="font-style">normal</xsl:attribute>
5157
+ <xsl:attribute name="text-indent">0</xsl:attribute>
5158
+ <xsl:attribute name="start-indent">0</xsl:attribute>
5159
+
5160
+
5161
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
5162
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
5163
+ <xsl:attribute name="line-height">124%</xsl:attribute>
5164
+ <xsl:attribute name="text-align">justify</xsl:attribute>
5165
+
5166
+
5167
+
5168
+
5169
+
5170
+
5171
+
5172
+
5173
+
5174
+
5175
+
5176
+
5177
+
5178
+
5179
+
5180
+
5181
+
5182
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
5183
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
5184
+
5185
+ <xsl:attribute name="font-size">60%</xsl:attribute>
5186
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5187
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5188
+
5189
+
5190
+
5191
+
5192
+
5193
+
5194
+
5195
+
5196
+
5197
+
5198
+
5199
+
5200
+
5201
+
5202
+
5203
+
5204
+
5205
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
5083
5206
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
5084
5207
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
5085
5208
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -5104,7 +5227,8 @@
5104
5227
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
5105
5228
 
5106
5229
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5107
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5230
+
5231
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
5108
5232
  <xsl:sort select="@displayorder" data-type="number"/>
5109
5233
  <xsl:apply-templates select="." mode="contents"/>
5110
5234
  </xsl:for-each>
@@ -5114,7 +5238,7 @@
5114
5238
  <xsl:apply-templates select="." mode="contents"/>
5115
5239
  </xsl:for-each>
5116
5240
 
5117
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5241
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5118
5242
  <xsl:sort select="@displayorder" data-type="number"/>
5119
5243
  <xsl:apply-templates select="." mode="contents"/>
5120
5244
  </xsl:for-each>
@@ -6116,6 +6240,102 @@
6116
6240
 
6117
6241
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
6118
6242
  <xsl:apply-templates/>
6243
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
6244
+
6245
+ <!-- list of footnotes to calculate actual footnotes number -->
6246
+ <xsl:variable name="p_fn_">
6247
+ <xsl:choose>
6248
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
6249
+ <fn gen_id="{generate-id(.)}">
6250
+ <xsl:copy-of select="@*"/>
6251
+ <xsl:copy-of select="node()"/>
6252
+ </fn>
6253
+ </xsl:when>
6254
+ <xsl:otherwise>
6255
+ <!-- itetation for:
6256
+ footnotes in bibdata/title
6257
+ footnotes in bibliography
6258
+ footnotes in document's body (except table's head/body/foot and figure text)
6259
+ -->
6260
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
6261
+ <fn gen_id="{generate-id(.)}">
6262
+ <xsl:copy-of select="@*"/>
6263
+ <xsl:copy-of select="node()"/>
6264
+ </fn>
6265
+ </xsl:for-each>
6266
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
6267
+ <xsl:sort select="@displayorder" data-type="number"/>
6268
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6269
+ <!-- copy unique fn -->
6270
+ <fn gen_id="{generate-id(.)}">
6271
+ <xsl:copy-of select="@*"/>
6272
+ <xsl:copy-of select="node()"/>
6273
+ </fn>
6274
+ </xsl:for-each>
6275
+ </xsl:for-each>
6276
+ </xsl:otherwise>
6277
+ </xsl:choose>
6278
+ </xsl:variable>
6279
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
6280
+
6281
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
6282
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
6283
+ <xsl:variable name="reference" select="@reference"/>
6284
+ <!-- fn sequence number in document -->
6285
+ <xsl:variable name="current_fn_number">
6286
+ <xsl:choose>
6287
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
6288
+ <xsl:otherwise>
6289
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
6290
+ </xsl:otherwise>
6291
+ </xsl:choose>
6292
+ </xsl:variable>
6293
+ <xsl:variable name="current_fn_number_text">
6294
+ <xsl:value-of select="$current_fn_number"/>
6295
+
6296
+
6297
+ </xsl:variable>
6298
+
6299
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
6300
+ <xsl:variable name="footnote_inline">
6301
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
6302
+
6303
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6304
+ <xsl:value-of select="$current_fn_number_text"/>
6305
+ </fo:basic-link>
6306
+ </fo:inline>
6307
+ </xsl:variable>
6308
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
6309
+ gen_id=<xsl:value-of select="$gen_id"/> -->
6310
+ <xsl:choose>
6311
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
6312
+ <xsl:copy-of select="$footnote_inline"/>
6313
+ </xsl:when>
6314
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
6315
+ <fo:footnote xsl:use-attribute-sets="fn-style">
6316
+ <xsl:copy-of select="$footnote_inline"/>
6317
+ <fo:footnote-body>
6318
+
6319
+ <fo:block-container text-indent="0" start-indent="0">
6320
+
6321
+
6322
+ <fo:block xsl:use-attribute-sets="fn-body-style">
6323
+
6324
+
6325
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
6326
+
6327
+ <xsl:value-of select="$current_fn_number_text"/>
6328
+ </fo:inline>
6329
+ <xsl:apply-templates/>
6330
+ </fo:block>
6331
+ </fo:block-container>
6332
+ </fo:footnote-body>
6333
+ </fo:footnote>
6334
+ </xsl:when>
6335
+ <xsl:otherwise>
6336
+ <xsl:copy-of select="$footnote_inline"/>
6337
+ </xsl:otherwise>
6338
+ </xsl:choose>
6119
6339
  </xsl:template><xsl:template name="fn_display">
6120
6340
  <xsl:variable name="references">
6121
6341
 
@@ -6326,6 +6546,8 @@
6326
6546
 
6327
6547
  </fo:basic-link>
6328
6548
  </fo:inline>
6549
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
6550
+ <fo:inline><xsl:value-of select="."/></fo:inline>
6329
6551
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
6330
6552
  <fo:inline>
6331
6553
  <xsl:apply-templates/>
@@ -6378,12 +6600,9 @@
6378
6600
  <fo:block margin-bottom="12pt" text-align="left">
6379
6601
 
6380
6602
  <xsl:variable name="title-where">
6381
-
6382
-
6383
- <xsl:call-template name="getTitle">
6384
- <xsl:with-param name="name" select="'title-where'"/>
6385
- </xsl:call-template>
6386
-
6603
+ <xsl:call-template name="getLocalizedString">
6604
+ <xsl:with-param name="key">where</xsl:with-param>
6605
+ </xsl:call-template>
6387
6606
  </xsl:variable>
6388
6607
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
6389
6608
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -6399,12 +6618,9 @@
6399
6618
 
6400
6619
 
6401
6620
  <xsl:variable name="title-where">
6402
-
6403
-
6404
- <xsl:call-template name="getTitle">
6405
- <xsl:with-param name="name" select="'title-where'"/>
6406
- </xsl:call-template>
6407
-
6621
+ <xsl:call-template name="getLocalizedString">
6622
+ <xsl:with-param name="key">where</xsl:with-param>
6623
+ </xsl:call-template>
6408
6624
  </xsl:variable>
6409
6625
  <xsl:value-of select="$title-where"/>
6410
6626
  </fo:block>
@@ -6416,12 +6632,9 @@
6416
6632
 
6417
6633
 
6418
6634
  <xsl:variable name="title-key">
6419
-
6420
-
6421
- <xsl:call-template name="getTitle">
6422
- <xsl:with-param name="name" select="'title-key'"/>
6423
- </xsl:call-template>
6424
-
6635
+ <xsl:call-template name="getLocalizedString">
6636
+ <xsl:with-param name="key">key</xsl:with-param>
6637
+ </xsl:call-template>
6425
6638
  </xsl:variable>
6426
6639
  <xsl:value-of select="$title-key"/>
6427
6640
  </fo:block>
@@ -6690,6 +6903,7 @@
6690
6903
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
6691
6904
  <xsl:apply-templates/>
6692
6905
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
6906
+ <xsl:apply-templates select="@language"/>
6693
6907
  <xsl:apply-templates/>
6694
6908
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
6695
6909
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -6751,6 +6965,15 @@
6751
6965
  </fo:inline>
6752
6966
  </xsl:template><xsl:template match="*[local-name()='add']">
6753
6967
  <xsl:choose>
6968
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
6969
+ <fo:inline>
6970
+ <xsl:call-template name="insertTag">
6971
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
6972
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
6973
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
6974
+ </xsl:call-template>
6975
+ </fo:inline>
6976
+ </xsl:when>
6754
6977
  <xsl:when test="@amendment">
6755
6978
  <fo:inline>
6756
6979
  <xsl:call-template name="insertTag">
@@ -6785,7 +7008,6 @@
6785
7008
  </fo:inline>
6786
7009
  </xsl:otherwise>
6787
7010
  </xsl:choose>
6788
-
6789
7011
  </xsl:template><xsl:template name="insertTag">
6790
7012
  <xsl:param name="type"/>
6791
7013
  <xsl:param name="kind"/>
@@ -6801,14 +7023,14 @@
6801
7023
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6802
7024
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
6803
7025
  <g>
6804
- <xsl:if test="$type = 'closing'">
7026
+ <xsl:if test="$type = 'closing' or $type = 'end'">
6805
7027
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
6806
7028
  </xsl:if>
6807
7029
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
6808
7030
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
6809
7031
  </g>
6810
7032
  <text font-family="Arial" x="15" y="57" font-size="40pt">
6811
- <xsl:if test="$type = 'closing'">
7033
+ <xsl:if test="$type = 'closing' or $type = 'end'">
6812
7034
  <xsl:attribute name="x">25</xsl:attribute>
6813
7035
  </xsl:if>
6814
7036
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -7329,9 +7551,9 @@
7329
7551
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
7330
7552
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
7331
7553
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
7332
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
7554
+ <xsl:apply-templates select="*[local-name()='name']"/>
7333
7555
  </fo:block>
7334
- <xsl:apply-templates/>
7556
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
7335
7557
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
7336
7558
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
7337
7559
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -7351,22 +7573,6 @@
7351
7573
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
7352
7574
  <xsl:apply-templates/>
7353
7575
  </fo:inline>
7354
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
7355
- <xsl:variable name="title-modified">
7356
-
7357
-
7358
- <xsl:call-template name="getTitle">
7359
- <xsl:with-param name="name" select="'title-modified'"/>
7360
- </xsl:call-template>
7361
-
7362
- </xsl:variable>
7363
-
7364
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
7365
- <xsl:choose>
7366
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
7367
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
7368
- </xsl:choose>
7369
- <xsl:apply-templates/>
7370
7576
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
7371
7577
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7372
7578
 
@@ -7951,20 +8157,67 @@
7951
8157
  </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
7952
8158
  <xsl:apply-templates mode="contents"/>
7953
8159
  <xsl:text> </xsl:text>
7954
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
8160
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
7955
8161
  <xsl:apply-templates mode="bookmarks"/>
7956
8162
  <xsl:text> </xsl:text>
7957
8163
  </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
7958
8164
  <xsl:value-of select="."/>
7959
- </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
8165
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
7960
8166
  <xsl:value-of select="."/>
7961
8167
  </xsl:template><xsl:template match="node()" mode="contents">
7962
8168
  <xsl:apply-templates mode="contents"/>
8169
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
8170
+ <xsl:variable name="level">
8171
+ <xsl:call-template name="getLevel">
8172
+ <xsl:with-param name="depth" select="@depth"/>
8173
+ </xsl:call-template>
8174
+ </xsl:variable>
8175
+
8176
+ <xsl:variable name="section">
8177
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8178
+ </xsl:variable>
8179
+
8180
+ <xsl:variable name="type">floating-title</xsl:variable>
8181
+
8182
+ <xsl:variable name="display">
8183
+ <xsl:choose>
8184
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
8185
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
8186
+ <xsl:otherwise>false</xsl:otherwise>
8187
+ </xsl:choose>
8188
+ </xsl:variable>
8189
+
8190
+ <xsl:variable name="skip">false</xsl:variable>
8191
+
8192
+ <xsl:if test="$skip = 'false'">
8193
+
8194
+ <xsl:variable name="title">
8195
+ <xsl:choose>
8196
+ <xsl:when test="*[local-name() = 'tab']">
8197
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
8198
+ </xsl:when>
8199
+ <xsl:otherwise>
8200
+ <xsl:copy-of select="node()"/>
8201
+ </xsl:otherwise>
8202
+ </xsl:choose>
8203
+ </xsl:variable>
8204
+
8205
+ <xsl:variable name="root">
8206
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
8207
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
8208
+ </xsl:variable>
8209
+
8210
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
8211
+ <title>
8212
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
8213
+ </title>
8214
+ </item>
8215
+ </xsl:if>
7963
8216
  </xsl:template><xsl:template match="node()" mode="bookmarks">
7964
8217
  <xsl:apply-templates mode="bookmarks"/>
7965
8218
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
7966
8219
  <xsl:apply-templates select="."/>
7967
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
8220
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
7968
8221
  <xsl:apply-templates mode="bookmarks"/>
7969
8222
  </xsl:template><xsl:template name="addBookmarks">
7970
8223
  <xsl:param name="contents"/>
@@ -8149,7 +8402,10 @@
8149
8402
  </fo:block>
8150
8403
  </xsl:if>
8151
8404
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/><xsl:template match="*[local-name() = 'title']" mode="contents_item">
8152
- <xsl:apply-templates mode="contents_item"/>
8405
+ <xsl:param name="mode">bookmarks</xsl:param>
8406
+ <xsl:apply-templates mode="contents_item">
8407
+ <xsl:with-param name="mode" select="$mode"/>
8408
+ </xsl:apply-templates>
8153
8409
  <!-- <xsl:text> </xsl:text> -->
8154
8410
  </xsl:template><xsl:template name="getSection">
8155
8411
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -8222,6 +8478,18 @@
8222
8478
  <xsl:copy-of select="."/>
8223
8479
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
8224
8480
  <xsl:text> </xsl:text>
8481
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
8482
+ <xsl:param name="mode">bookmarks</xsl:param>
8483
+ <xsl:apply-templates mode="contents_item">
8484
+ <xsl:with-param name="mode" select="$mode"/>
8485
+ </xsl:apply-templates>
8486
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
8487
+ <xsl:param name="mode">bookmarks</xsl:param>
8488
+ <xsl:if test="$mode = 'contents'">
8489
+ <xsl:copy>
8490
+ <xsl:apply-templates mode="contents_item"/>
8491
+ </xsl:copy>
8492
+ </xsl:if>
8225
8493
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
8226
8494
 
8227
8495
  <fo:block-container margin-left="0mm">
@@ -8240,6 +8508,8 @@
8240
8508
 
8241
8509
 
8242
8510
 
8511
+
8512
+
8243
8513
  <fo:block xsl:use-attribute-sets="sourcecode-style">
8244
8514
  <xsl:variable name="_font-size">
8245
8515
 
@@ -8273,13 +8543,17 @@
8273
8543
 
8274
8544
 
8275
8545
 
8546
+
8547
+
8276
8548
  <xsl:apply-templates/>
8277
8549
  </fo:block>
8278
-
8550
+
8279
8551
 
8280
8552
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
8281
8553
 
8282
8554
 
8555
+
8556
+
8283
8557
  </fo:block-container>
8284
8558
  </fo:block-container>
8285
8559
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -8552,42 +8826,48 @@
8552
8826
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
8553
8827
 
8554
8828
 
8555
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
8556
-
8557
- <xsl:variable name="element">
8829
+ <xsl:variable name="fo_element">
8830
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
8558
8831
  block
8559
8832
 
8560
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
8833
+
8561
8834
  </xsl:variable>
8562
8835
 
8836
+ <!-- display 'EXAMPLE' -->
8837
+ <xsl:apply-templates select="*[local-name()='name']">
8838
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8839
+ </xsl:apply-templates>
8840
+
8563
8841
  <xsl:choose>
8564
- <xsl:when test="contains(normalize-space($element), 'block')">
8565
- <fo:block xsl:use-attribute-sets="example-body-style">
8566
- <xsl:apply-templates/>
8567
- </fo:block>
8842
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
8843
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
8844
+ <fo:block-container margin-left="0mm" margin-right="0mm">
8845
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8846
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8847
+ </xsl:apply-templates>
8848
+ </fo:block-container>
8849
+ </fo:block-container>
8568
8850
  </xsl:when>
8569
8851
  <xsl:otherwise>
8570
8852
  <fo:inline>
8571
- <xsl:apply-templates/>
8853
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8854
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8855
+ </xsl:apply-templates>
8572
8856
  </fo:inline>
8573
8857
  </xsl:otherwise>
8574
8858
  </xsl:choose>
8575
8859
 
8576
8860
  </fo:block>
8577
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
8578
-
8579
- <xsl:variable name="element">
8580
- block
8581
-
8582
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
8583
- </xsl:variable>
8861
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
8862
+ <xsl:param name="fo_element">block</xsl:param>
8863
+
8584
8864
  <xsl:choose>
8585
8865
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
8586
8866
  <fo:inline>
8587
8867
  <xsl:apply-templates/>
8588
8868
  </fo:inline>
8589
8869
  </xsl:when>
8590
- <xsl:when test="contains(normalize-space($element), 'block')">
8870
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
8591
8871
  <fo:block xsl:use-attribute-sets="example-name-style">
8592
8872
  <xsl:apply-templates/>
8593
8873
  </fo:block>
@@ -8600,14 +8880,15 @@
8600
8880
  </xsl:choose>
8601
8881
 
8602
8882
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
8883
+ <xsl:param name="fo_element">block</xsl:param>
8884
+
8603
8885
  <xsl:variable name="num"><xsl:number/></xsl:variable>
8604
8886
  <xsl:variable name="element">
8605
- block
8606
-
8607
8887
 
8888
+ <xsl:value-of select="$fo_element"/>
8608
8889
  </xsl:variable>
8609
8890
  <xsl:choose>
8610
- <xsl:when test="normalize-space($element) = 'block'">
8891
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
8611
8892
  <fo:block xsl:use-attribute-sets="example-p-style">
8612
8893
 
8613
8894
  <xsl:apply-templates/>
@@ -8626,60 +8907,66 @@
8626
8907
  <xsl:variable name="termsource_text">
8627
8908
  <xsl:apply-templates/>
8628
8909
  </xsl:variable>
8629
-
8630
- <xsl:choose>
8910
+ <xsl:copy-of select="$termsource_text"/>
8911
+ <!-- <xsl:choose>
8631
8912
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
8632
- <!-- <xsl:apply-templates /> -->
8633
8913
  <xsl:copy-of select="$termsource_text"/>
8634
8914
  </xsl:when>
8635
8915
  <xsl:otherwise>
8636
-
8637
-
8916
+ <xsl:if test="$namespace = 'bsi'">
8917
+ <xsl:choose>
8918
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
8919
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
8920
+ </xsl:choose>
8921
+ </xsl:if>
8922
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
8638
8923
  <xsl:text>[</xsl:text>
8639
-
8640
- <!-- <xsl:apply-templates /> -->
8924
+ </xsl:if>
8641
8925
  <xsl:copy-of select="$termsource_text"/>
8642
-
8643
-
8926
+ <xsl:if test="$namespace = 'bsi'">
8927
+ <xsl:choose>
8928
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
8929
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
8930
+ </xsl:choose>
8931
+ </xsl:if>
8932
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
8644
8933
  <xsl:text>]</xsl:text>
8645
-
8934
+ </xsl:if>
8646
8935
  </xsl:otherwise>
8647
- </xsl:choose>
8936
+ </xsl:choose> -->
8648
8937
  </fo:block>
8649
8938
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
8650
8939
  <xsl:if test="normalize-space() != ''">
8651
8940
  <xsl:value-of select="."/>
8652
8941
  </xsl:if>
8653
- </xsl:template><xsl:variable name="localized.source">
8654
- <xsl:call-template name="getLocalizedString">
8655
- <xsl:with-param name="key">source</xsl:with-param>
8656
- </xsl:call-template>
8657
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
8942
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
8943
+ <fo:inline>
8944
+
8945
+
8946
+ <xsl:value-of select="."/>
8947
+ </fo:inline>
8948
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
8658
8949
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8659
8950
  <xsl:if test="normalize-space(@citeas) = ''">
8660
8951
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8661
8952
  </xsl:if>
8662
-
8663
-
8664
- <fo:inline>
8665
-
8666
-
8667
-
8668
-
8669
-
8670
-
8671
- <xsl:value-of select="$localized.source"/>
8672
- <xsl:text> </xsl:text>
8673
-
8674
-
8675
-
8676
- </fo:inline>
8677
-
8678
8953
  <fo:inline xsl:use-attribute-sets="origin-style">
8679
8954
  <xsl:apply-templates/>
8680
8955
  </fo:inline>
8681
-
8682
- </fo:basic-link>
8956
+ </fo:basic-link>
8957
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
8958
+ <xsl:variable name="title-modified">
8959
+ <xsl:call-template name="getLocalizedString">
8960
+ <xsl:with-param name="key">modified</xsl:with-param>
8961
+ </xsl:call-template>
8962
+ </xsl:variable>
8963
+
8964
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
8965
+ <xsl:choose>
8966
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
8967
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
8968
+ </xsl:choose>
8969
+ <xsl:apply-templates/>
8683
8970
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
8684
8971
  <fo:inline><xsl:apply-templates/></fo:inline>
8685
8972
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -8869,25 +9156,29 @@
8869
9156
  </fo:block>
8870
9157
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
8871
9158
  <xsl:variable name="title-deprecated">
8872
-
8873
-
8874
- <xsl:call-template name="getTitle">
8875
- <xsl:with-param name="name" select="'title-deprecated'"/>
8876
- </xsl:call-template>
8877
-
9159
+ <xsl:call-template name="getLocalizedString">
9160
+ <xsl:with-param name="key">deprecated</xsl:with-param>
9161
+ </xsl:call-template>
8878
9162
  </xsl:variable>
8879
9163
  <fo:block xsl:use-attribute-sets="deprecates-style">
8880
9164
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8881
9165
  </fo:block>
9166
+ </xsl:template><xsl:template name="setStyle_preferred">
9167
+ <xsl:if test="*[local-name() = 'strong']">
9168
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
9169
+ </xsl:if>
9170
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
9171
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
8882
9172
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
8883
9173
  <fo:block xsl:use-attribute-sets="definition-style">
8884
9174
  <xsl:apply-templates/>
8885
9175
  </fo:block>
8886
9176
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
8887
9177
  <xsl:apply-templates/>
8888
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
9178
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
8889
9179
  <fo:inline> <xsl:apply-templates/></fo:inline>
8890
- <fo:block> </fo:block>
9180
+ <!-- <fo:block>&#xA0;</fo:block> -->
9181
+ <fo:block/>
8891
9182
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
8892
9183
 
8893
9184
  <fo:block>
@@ -8945,6 +9236,53 @@
8945
9236
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
8946
9237
  <!-- 0xA0 to space replacement -->
8947
9238
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
9239
+ </xsl:template><xsl:variable name="ul_labels_">
9240
+
9241
+ <label level="1" font-size="15pt">•</label>
9242
+ <label level="2">−</label><!-- &#x2212; - minus sign. &#x2014; - en dash -->
9243
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
9244
+
9245
+
9246
+
9247
+
9248
+
9249
+
9250
+
9251
+
9252
+
9253
+
9254
+
9255
+
9256
+
9257
+
9258
+
9259
+
9260
+
9261
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
9262
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9263
+ <xsl:variable name="list_level">
9264
+ <xsl:choose>
9265
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
9266
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
9267
+ </xsl:choose>
9268
+ </xsl:variable>
9269
+ <xsl:choose>
9270
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
9271
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
9272
+ </xsl:when>
9273
+ <xsl:when test="$list_level mod 3 = 0">
9274
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
9275
+ </xsl:when>
9276
+ <xsl:when test="$list_level mod 2 = 0">
9277
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
9278
+ </xsl:when>
9279
+ <xsl:otherwise>
9280
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
9281
+ </xsl:otherwise>
9282
+ </xsl:choose>
9283
+ </xsl:template><xsl:template match="label" mode="ul_labels">
9284
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
9285
+ <xsl:value-of select="."/>
8948
9286
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
8949
9287
  <xsl:choose>
8950
9288
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -9162,7 +9500,7 @@
9162
9500
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
9163
9501
  </xsl:when>
9164
9502
  <xsl:otherwise>
9165
- <xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
9503
+ <xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
9166
9504
 
9167
9505
  <xsl:value-of select="$docidentifier"/>
9168
9506
  <xsl:if test="$docidentifier != '' and *[local-name() = 'title']">, </xsl:if>
@@ -9186,16 +9524,30 @@
9186
9524
  <!-- end BIPM bibitem processing-->
9187
9525
 
9188
9526
 
9189
-
9527
+
9528
+
9529
+
9530
+
9531
+
9532
+
9190
9533
 
9191
9534
 
9192
9535
 
9193
9536
 
9194
9537
 
9538
+
9539
+
9540
+
9541
+
9542
+ <!-- end MPFD bibitem processing -->
9543
+
9544
+ <!-- start M3D bibitem processing -->
9545
+
9195
9546
 
9547
+
9196
9548
 
9197
9549
  </xsl:template><xsl:template name="processBibitemDocId">
9198
- <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
9550
+ <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
9199
9551
  <xsl:choose>
9200
9552
  <xsl:when test="normalize-space($_doc_ident) != ''">
9201
9553
  <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
@@ -9209,7 +9561,7 @@
9209
9561
  <xsl:if test="$type != ''">
9210
9562
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9211
9563
  </xsl:if> -->
9212
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
9564
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
9213
9565
  </xsl:otherwise>
9214
9566
  </xsl:choose>
9215
9567
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -9314,7 +9666,35 @@
9314
9666
  <fo:block-container border="1pt solid black" width="50%">
9315
9667
  <fo:block> </fo:block>
9316
9668
  </fo:block-container>
9317
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
9669
+ </xsl:template><xsl:variable name="toc_level">
9670
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
9671
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
9672
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
9673
+ <xsl:choose>
9674
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
9675
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
9676
+ <xsl:otherwise><!-- default value -->
9677
+ 3
9678
+
9679
+
9680
+
9681
+
9682
+
9683
+
9684
+
9685
+
9686
+
9687
+
9688
+
9689
+
9690
+
9691
+
9692
+
9693
+
9694
+
9695
+ </xsl:otherwise>
9696
+ </xsl:choose>
9697
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
9318
9698
  <xsl:param name="colwidths"/>
9319
9699
  <xsl:variable name="colwidths_">
9320
9700
  <xsl:choose>
@@ -9394,7 +9774,7 @@
9394
9774
  </td>
9395
9775
  </xsl:for-each>
9396
9776
  <td>333</td> <!-- page number, just for fill -->
9397
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9777
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9398
9778
  <fo:inline padding-right="5mm"> </fo:inline>
9399
9779
  <fo:inline><xsl:apply-templates/></fo:inline>
9400
9780
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -9405,6 +9785,10 @@
9405
9785
  </svg>
9406
9786
  </fo:instream-foreign-object>
9407
9787
  </fo:inline>
9788
+ </xsl:template><xsl:template match="@language">
9789
+ <xsl:copy-of select="."/>
9790
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
9791
+ <xsl:call-template name="title"/>
9408
9792
  </xsl:template><xsl:template name="convertDate">
9409
9793
  <xsl:param name="date"/>
9410
9794
  <xsl:param name="format" select="'short'"/>
@@ -9762,9 +10146,15 @@
9762
10146
  </xsl:template><xsl:template name="getLocalizedString">
9763
10147
  <xsl:param name="key"/>
9764
10148
  <xsl:param name="formatted">false</xsl:param>
10149
+ <xsl:param name="lang"/>
9765
10150
 
9766
10151
  <xsl:variable name="curr_lang">
9767
- <xsl:call-template name="getLang"/>
10152
+ <xsl:choose>
10153
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
10154
+ <xsl:otherwise>
10155
+ <xsl:call-template name="getLang"/>
10156
+ </xsl:otherwise>
10157
+ </xsl:choose>
9768
10158
  </xsl:variable>
9769
10159
 
9770
10160
  <xsl:variable name="data_value">
@@ -9954,4 +10344,14 @@
9954
10344
  </xsl:otherwise>
9955
10345
  </xsl:choose>
9956
10346
  </xsl:if>
10347
+ </xsl:template><xsl:template name="setAltText">
10348
+ <xsl:param name="value"/>
10349
+ <xsl:attribute name="fox:alt-text">
10350
+ <xsl:choose>
10351
+ <xsl:when test="normalize-space($value) != ''">
10352
+ <xsl:value-of select="$value"/>
10353
+ </xsl:when>
10354
+ <xsl:otherwise>_</xsl:otherwise>
10355
+ </xsl:choose>
10356
+ </xsl:attribute>
9957
10357
  </xsl:template></xsl:stylesheet>