metanorma-bipm 1.1.5 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -244,7 +244,7 @@
244
244
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'provenance']"/>
245
245
  </fo:block>
246
246
  <fo:block border-bottom="1pt solid black"> </fo:block>
247
- <fo:block font-size="16.5pt" margin-left="-0.5mm" padding-top="3.5mm" space-after="7mm" margin-right="7mm" line-height="105%">
247
+ <fo:block font-size="16.5pt" margin-left="-0.5mm" padding-top="3.5mm" space-after="7mm" margin-right="7mm" line-height="105%" role="H1">
248
248
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
249
249
  <xsl:variable name="title_part">
250
250
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
@@ -254,7 +254,7 @@
254
254
  <xsl:copy-of select="$title_part"/>
255
255
  </xsl:if>
256
256
  </fo:block>
257
- <fo:block font-size="12pt" font-style="italic" line-height="140%">
257
+ <fo:block font-size="12pt" font-style="italic" line-height="140%" role="H1">
258
258
  <xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
259
259
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
260
260
  <xsl:variable name="title_part">
@@ -293,7 +293,7 @@
293
293
  </fo:table-row>
294
294
  </fo:table-body>
295
295
  </fo:table>
296
- <fo:block font-size="18pt" space-before="70mm">
296
+ <fo:block font-size="18pt" space-before="70mm" role="H1">
297
297
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
298
298
  <xsl:variable name="title_part">
299
299
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
@@ -303,7 +303,7 @@
303
303
  <xsl:copy-of select="$title_part"/>
304
304
  </xsl:if>
305
305
  </fo:block>
306
- <fo:block font-size="13pt" space-before="35mm">
306
+ <fo:block font-size="13pt" space-before="35mm" role="H1">
307
307
  <xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
308
308
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
309
309
  <xsl:variable name="title_part">
@@ -346,41 +346,43 @@
346
346
 
347
347
  <!-- Table of Contents -->
348
348
  <fo:block-container>
349
- <fo:block text-align-last="justify">
350
- <fo:inline font-size="15pt" font-weight="bold">
351
- <xsl:call-template name="getLocalizedString">
352
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
353
- </xsl:call-template>
354
- </fo:inline>
355
- <fo:inline keep-together.within-line="always">
356
- <fo:leader leader-pattern="space"/>
349
+ <fo:block role="TOC">
350
+ <fo:block text-align-last="justify">
351
+ <fo:inline font-size="15pt" font-weight="bold" role="H1">
352
+ <xsl:call-template name="getLocalizedString">
353
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
354
+ </xsl:call-template>
355
+ </fo:inline>
356
+ <fo:inline keep-together.within-line="always">
357
+ <fo:leader leader-pattern="space"/>
358
+ <xsl:call-template name="getLocalizedString">
359
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
360
+ </xsl:call-template>
361
+ </fo:inline>
362
+ </fo:block>
363
+
364
+ <xsl:if test="$debug = 'true'">
365
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
366
+ DEBUG
367
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
368
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
369
+ </xsl:if>
370
+
371
+ <xsl:variable name="annexes_title">
357
372
  <xsl:call-template name="getLocalizedString">
358
- <xsl:with-param name="key">Page.sg</xsl:with-param>
373
+ <xsl:with-param name="key">Annex.pl</xsl:with-param>
359
374
  </xsl:call-template>
360
- </fo:inline>
375
+ </xsl:variable>
376
+
377
+ <xsl:for-each select="xalan:nodeset($contents)/doc[@id=$docid]//item[@display = 'true']"> <!-- and not (@type = 'annex') and not (@type = 'references') -->
378
+ <xsl:if test="@type = 'annex' and not(preceding-sibling::item[@display = 'true' and @type = 'annex'])">
379
+ <fo:block font-size="12pt" space-before="16pt" font-weight="bold" role="TOCI">
380
+ <xsl:value-of select="$annexes_title"/>
381
+ </fo:block>
382
+ </xsl:if>
383
+ <xsl:call-template name="print_JCGN_toc_item"/>
384
+ </xsl:for-each>
361
385
  </fo:block>
362
-
363
- <xsl:if test="$debug = 'true'">
364
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
365
- DEBUG
366
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
367
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
368
- </xsl:if>
369
-
370
- <xsl:variable name="annexes_title">
371
- <xsl:call-template name="getLocalizedString">
372
- <xsl:with-param name="key">Annex.pl</xsl:with-param>
373
- </xsl:call-template>
374
- </xsl:variable>
375
-
376
- <xsl:for-each select="xalan:nodeset($contents)/doc[@id=$docid]//item[@display = 'true']"> <!-- and not (@type = 'annex') and not (@type = 'references') -->
377
- <xsl:if test="@type = 'annex' and not(preceding-sibling::item[@display = 'true' and @type = 'annex'])">
378
- <fo:block font-size="12pt" space-before="16pt" font-weight="bold">
379
- <xsl:value-of select="$annexes_title"/>
380
- </fo:block>
381
- </xsl:if>
382
- <xsl:call-template name="print_JCGN_toc_item"/>
383
- </xsl:for-each>
384
386
  </fo:block-container>
385
387
 
386
388
  </xsl:for-each>
@@ -445,7 +447,7 @@
445
447
  <xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $curr_lang and @type = 'part']" mode="title"/>
446
448
  </xsl:variable>
447
449
 
448
- <fo:block>
450
+ <fo:block role="H1">
449
451
  <xsl:copy-of select="$title-main"/>
450
452
  <xsl:if test="normalize-space($title-main) != '' and normalize-space($title-part) != ''">
451
453
  <xsl:text> — </xsl:text>
@@ -910,8 +912,11 @@
910
912
  <xsl:call-template name="note"/>
911
913
  </xsl:template>
912
914
 
913
- <xsl:template match="*[local-name()='preferred']">
914
- <fo:block line-height="1.1">
915
+ <xsl:template match="*[local-name()='preferred']">
916
+ <xsl:variable name="level">
917
+ <xsl:call-template name="getLevel"/>
918
+ </xsl:variable>
919
+ <fo:block line-height="1.1" role="H{$level}">
915
920
  <fo:block font-weight="bold" keep-with-next="always">
916
921
  <xsl:apply-templates select="ancestor::*[local-name()='term']/*[local-name()='name']" mode="presentation"/>
917
922
  </fo:block>
@@ -922,7 +927,10 @@
922
927
  </xsl:template>
923
928
 
924
929
  <xsl:template match="*[local-name()='preferred'][not(parent::*[local-name()='term'])]">
925
- <fo:block line-height="1.1">
930
+ <xsl:variable name="levelTerm">
931
+ <xsl:call-template name="getLevelTermName"/>
932
+ </xsl:variable>
933
+ <fo:block line-height="1.1" role="H{$levelTerm}">
926
934
  <fo:block font-weight="bold" keep-with-next="always">
927
935
  <xsl:apply-templates select="preceding-sibling::*[local-name()='term_name'][1]" mode="presentation"/>
928
936
  </fo:block>
@@ -1251,14 +1259,14 @@
1251
1259
  </xsl:variable>
1252
1260
 
1253
1261
  <xsl:template name="insertHeaderFooter">
1254
- <fo:static-content flow-name="header-even-jcgm">
1262
+ <fo:static-content flow-name="header-even-jcgm" role="artifact">
1255
1263
  <fo:block-container height="98%">
1256
1264
  <fo:block font-size="13pt" font-weight="bold" padding-top="12mm">
1257
1265
  <xsl:value-of select="$header_text"/>
1258
1266
  </fo:block>
1259
1267
  </fo:block-container>
1260
1268
  </fo:static-content>
1261
- <fo:static-content flow-name="footer-even-jcgm">
1269
+ <fo:static-content flow-name="footer-even-jcgm" role="artifact">
1262
1270
  <fo:block-container height="98%">
1263
1271
  <fo:block text-align-last="justify">
1264
1272
  <fo:inline font-size="12pt" font-weight="bold"><fo:page-number/></fo:inline>
@@ -1269,14 +1277,14 @@
1269
1277
  </fo:block>
1270
1278
  </fo:block-container>
1271
1279
  </fo:static-content>
1272
- <fo:static-content flow-name="header-odd-jcgm">
1280
+ <fo:static-content flow-name="header-odd-jcgm" role="artifact">
1273
1281
  <fo:block-container height="98%">
1274
1282
  <fo:block font-size="13pt" font-weight="bold" text-align="right" padding-top="12mm">
1275
1283
  <xsl:value-of select="$header_text"/>
1276
1284
  </fo:block>
1277
1285
  </fo:block-container>
1278
1286
  </fo:static-content>
1279
- <fo:static-content flow-name="footer-odd-jcgm">
1287
+ <fo:static-content flow-name="footer-odd-jcgm" role="artifact">
1280
1288
  <fo:block-container height="98%">
1281
1289
  <fo:block text-align-last="justify">
1282
1290
  <fo:inline font-size="10pt"><xsl:value-of select="$copyrightText"/></fo:inline>
@@ -1350,7 +1358,9 @@
1350
1358
  <xsl:attribute name="text-align">center</xsl:attribute>
1351
1359
  <xsl:attribute name="line-height">130%</xsl:attribute>
1352
1360
  </xsl:if>
1361
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
1353
1362
  <xsl:apply-templates/>
1363
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
1354
1364
  </xsl:element>
1355
1365
 
1356
1366
  <xsl:if test="$element-name = 'fo:inline' and not(following-sibling::jcgm:p)">
@@ -1433,7 +1443,7 @@
1433
1443
  <fo:block id="{@id}" span="all">
1434
1444
  <xsl:apply-templates select="jcgm:title"/>
1435
1445
  </fo:block>
1436
- <fo:block>
1446
+ <fo:block role="Index">
1437
1447
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
1438
1448
  </fo:block>
1439
1449
  </fo:flow>
@@ -1442,7 +1452,7 @@
1442
1452
 
1443
1453
  <!-- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:title" priority="4"> -->
1444
1454
  <xsl:template match="jcgm:indexsect/jcgm:title" priority="4">
1445
- <fo:block font-weight="bold" span="all">
1455
+ <fo:block font-weight="bold" span="all" role="H1">
1446
1456
  <!-- Index -->
1447
1457
  <xsl:apply-templates/>
1448
1458
  </fo:block>
@@ -2177,8 +2187,9 @@
2177
2187
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2178
2188
  <xsl:attribute name="white-space">pre</xsl:attribute>
2179
2189
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
2190
+ <xsl:attribute name="role">Code</xsl:attribute>
2180
2191
 
2181
- <xsl:attribute name="font-family">Courier</xsl:attribute>
2192
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
2182
2193
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2183
2194
 
2184
2195
 
@@ -2201,8 +2212,13 @@
2201
2212
 
2202
2213
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
2203
2214
 
2204
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
2205
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
2215
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
2216
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
2217
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
2218
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
2219
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
2220
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
2221
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
2206
2222
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
2207
2223
 
2208
2224
 
@@ -2269,6 +2285,7 @@
2269
2285
 
2270
2286
 
2271
2287
 
2288
+
2272
2289
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2273
2290
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
2274
2291
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -2292,7 +2309,9 @@
2292
2309
 
2293
2310
 
2294
2311
 
2295
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2312
+ </xsl:attribute-set><xsl:variable name="table-border_">
2313
+
2314
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
2296
2315
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2297
2316
 
2298
2317
 
@@ -2422,7 +2441,8 @@
2422
2441
 
2423
2442
 
2424
2443
 
2425
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
2444
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
2445
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
2426
2446
 
2427
2447
 
2428
2448
 
@@ -2514,7 +2534,7 @@
2514
2534
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
2515
2535
 
2516
2536
 
2517
- <xsl:attribute name="font-family">Courier</xsl:attribute>
2537
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
2518
2538
 
2519
2539
 
2520
2540
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
@@ -2622,9 +2642,13 @@
2622
2642
  <fo:block>&#xA0;</fo:block>
2623
2643
  </xsl:if> -->
2624
2644
 
2645
+
2646
+ <!-- Display table's name before table as standalone block -->
2625
2647
  <!-- $namespace = 'iso' or -->
2626
2648
 
2627
-
2649
+
2650
+
2651
+
2628
2652
 
2629
2653
 
2630
2654
 
@@ -2700,6 +2724,12 @@
2700
2724
 
2701
2725
 
2702
2726
 
2727
+
2728
+
2729
+
2730
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2731
+
2732
+
2703
2733
  <xsl:variable name="table_width">
2704
2734
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2705
2735
  100%
@@ -2723,6 +2753,7 @@
2723
2753
 
2724
2754
 
2725
2755
 
2756
+
2726
2757
  <attribute name="margin-left">0mm</attribute>
2727
2758
  <attribute name="margin-right">0mm</attribute>
2728
2759
 
@@ -2749,6 +2780,8 @@
2749
2780
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2750
2781
  </xsl:if>
2751
2782
 
2783
+
2784
+
2752
2785
  <xsl:choose>
2753
2786
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2754
2787
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -3044,9 +3077,13 @@
3044
3077
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3045
3078
  <xsl:with-param name="continued">true</xsl:with-param>
3046
3079
  </xsl:apply-templates>
3047
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3048
- <xsl:call-template name="fn_name_display"/>
3049
- </xsl:for-each>
3080
+
3081
+
3082
+ <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3083
+ <xsl:call-template name="fn_name_display"/>
3084
+ </xsl:for-each>
3085
+
3086
+
3050
3087
 
3051
3088
  <fo:block text-align="right" font-style="italic">
3052
3089
  <xsl:text> </xsl:text>
@@ -3135,7 +3172,11 @@
3135
3172
 
3136
3173
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3137
3174
 
3138
- <xsl:if test="$isNoteOrFnExist = 'true'">
3175
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
3176
+
3177
+ </xsl:variable>
3178
+
3179
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
3139
3180
 
3140
3181
  <xsl:variable name="cols-count">
3141
3182
  <xsl:choose>
@@ -3164,6 +3205,8 @@
3164
3205
  </xsl:choose>
3165
3206
  </xsl:for-each>
3166
3207
 
3208
+
3209
+
3167
3210
  <xsl:choose>
3168
3211
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
3169
3212
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -3202,6 +3245,7 @@
3202
3245
 
3203
3246
 
3204
3247
 
3248
+
3205
3249
  <!-- for BSI (not PAS) display Notes before footnotes -->
3206
3250
 
3207
3251
 
@@ -3278,21 +3322,29 @@
3278
3322
 
3279
3323
  <fo:table-body>
3280
3324
 
3281
- <xsl:variable name="title_continued">
3325
+ <xsl:variable name="title_continued_">
3282
3326
  <xsl:call-template name="getTitle">
3283
3327
  <xsl:with-param name="name" select="'title-continued'"/>
3284
3328
  </xsl:call-template>
3285
3329
  </xsl:variable>
3286
3330
 
3331
+ <xsl:variable name="title_continued">
3332
+ <xsl:value-of select="$title_continued_"/>
3333
+
3334
+ </xsl:variable>
3335
+
3287
3336
  <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3288
3337
  <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3289
3338
 
3290
3339
  <fo:table-row height="0" keep-with-next.within-page="always">
3291
3340
  <fo:table-cell>
3341
+
3342
+
3292
3343
 
3293
3344
 
3294
3345
  <fo:marker marker-class-name="table_continued"/>
3295
3346
 
3347
+
3296
3348
  <fo:block/>
3297
3349
  </fo:table-cell>
3298
3350
  </fo:table-row>
@@ -3312,6 +3364,19 @@
3312
3364
 
3313
3365
  </fo:table-body>
3314
3366
 
3367
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
3368
+ <xsl:choose>
3369
+ <xsl:when test="substring-after(., '—') != ''">
3370
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
3371
+ </xsl:when>
3372
+ <xsl:otherwise>
3373
+ <xsl:value-of select="."/>
3374
+ </xsl:otherwise>
3375
+ </xsl:choose>
3376
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
3377
+ <xsl:apply-templates mode="presentation_name"/>
3378
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
3379
+ <xsl:apply-templates select="."/>
3315
3380
  </xsl:template><xsl:template match="*[local-name()='tr']">
3316
3381
  <xsl:variable name="parent-name" select="local-name(..)"/>
3317
3382
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -3339,6 +3404,8 @@
3339
3404
 
3340
3405
 
3341
3406
 
3407
+
3408
+
3342
3409
  </xsl:if>
3343
3410
  <xsl:if test="$parent-name = 'tfoot'">
3344
3411
 
@@ -3357,6 +3424,8 @@
3357
3424
 
3358
3425
 
3359
3426
 
3427
+
3428
+
3360
3429
  <!-- <xsl:if test="$namespace = 'bipm'">
3361
3430
  <xsl:attribute name="height">8mm</xsl:attribute>
3362
3431
  </xsl:if> -->
@@ -3514,14 +3583,12 @@
3514
3583
  <xsl:apply-templates/>
3515
3584
  </xsl:template><xsl:template name="fn_display">
3516
3585
  <xsl:variable name="references">
3586
+
3517
3587
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3518
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3519
-
3520
-
3521
- <xsl:apply-templates/>
3522
- </fn>
3588
+ <xsl:call-template name="create_fn"/>
3523
3589
  </xsl:for-each>
3524
3590
  </xsl:variable>
3591
+
3525
3592
  <xsl:for-each select="xalan:nodeset($references)//fn">
3526
3593
  <xsl:variable name="reference" select="@reference"/>
3527
3594
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
@@ -3560,6 +3627,12 @@
3560
3627
  </fo:block>
3561
3628
  </xsl:if>
3562
3629
  </xsl:for-each>
3630
+ </xsl:template><xsl:template name="create_fn">
3631
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3632
+
3633
+
3634
+ <xsl:apply-templates/>
3635
+ </fn>
3563
3636
  </xsl:template><xsl:template name="fn_name_display">
3564
3637
  <!-- <xsl:variable name="references">
3565
3638
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -3688,7 +3761,7 @@
3688
3761
 
3689
3762
 
3690
3763
 
3691
- <xsl:if test="ancestor::*[local-name()='td']">
3764
+ <xsl:if test="ancestor::*[local-name()='table']">
3692
3765
  <xsl:attribute name="font-weight">normal</xsl:attribute>
3693
3766
  <!-- <xsl:attribute name="alignment-baseline">hanging</xsl:attribute> -->
3694
3767
  <xsl:attribute name="baseline-shift">15%</xsl:attribute>
@@ -4561,16 +4634,68 @@
4561
4634
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4562
4635
  </xsl:call-template>
4563
4636
 
4637
+
4638
+
4564
4639
  <xsl:variable name="mathml">
4565
4640
  <xsl:apply-templates select="." mode="mathml"/>
4566
4641
  </xsl:variable>
4567
4642
  <fo:instream-foreign-object fox:alt-text="Math">
4568
4643
 
4569
4644
 
4645
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4646
+ <xsl:variable name="comment_text_">
4647
+ <xsl:choose>
4648
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4649
+ <xsl:value-of select="$comment_text_following"/>
4650
+ </xsl:when>
4651
+ <xsl:otherwise>
4652
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4653
+ </xsl:otherwise>
4654
+ </xsl:choose>
4655
+ </xsl:variable>
4656
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4657
+
4658
+ <xsl:if test="normalize-space($comment_text) != ''">
4659
+ <!-- put Mathin Alternate Text -->
4660
+ <xsl:attribute name="fox:alt-text">
4661
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4662
+ </xsl:attribute>
4663
+ </xsl:if>
4664
+
4665
+ <xsl:variable name="mathml_content">
4666
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4667
+ </xsl:variable>
4668
+ <!-- put MathML in Actual Text -->
4669
+ <xsl:attribute name="fox:actual-text">
4670
+ <xsl:value-of select="$mathml_content"/>
4671
+ </xsl:attribute>
4672
+
4673
+
4570
4674
  <!-- <xsl:copy-of select="."/> -->
4571
4675
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4572
4676
  </fo:instream-foreign-object>
4573
4677
  </fo:inline>
4678
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4679
+ <!-- <xsl:text>a+b</xsl:text> -->
4680
+ <xsl:text>&lt;</xsl:text>
4681
+ <xsl:value-of select="local-name()"/>
4682
+ <xsl:if test="local-name() = 'math'">
4683
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
4684
+ </xsl:if>
4685
+ <xsl:for-each select="@*">
4686
+ <xsl:text> </xsl:text>
4687
+ <xsl:value-of select="local-name()"/>
4688
+ <xsl:text>="</xsl:text>
4689
+ <xsl:value-of select="."/>
4690
+ <xsl:text>"</xsl:text>
4691
+ </xsl:for-each>
4692
+ <xsl:text>&gt;</xsl:text>
4693
+ <xsl:apply-templates mode="mathml_actual_text"/>
4694
+ <xsl:text>&lt;/</xsl:text>
4695
+ <xsl:value-of select="local-name()"/>
4696
+ <xsl:text>&gt;</xsl:text>
4697
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
4698
+ <xsl:value-of select="normalize-space()"/>
4574
4699
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
4575
4700
  <xsl:copy>
4576
4701
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -4580,19 +4705,6 @@
4580
4705
  <!-- replace start and end spaces to non-break space -->
4581
4706
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4582
4707
  </xsl:copy>
4583
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4584
- <xsl:copy>
4585
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
4586
- </xsl:copy>
4587
- <xsl:choose>
4588
- <!-- if in msub, then don't add space -->
4589
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
4590
- <!-- if next char in digit, don't add space -->
4591
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
4592
- <xsl:otherwise>
4593
- <mathml:mspace width="0.5ex"/>
4594
- </xsl:otherwise>
4595
- </xsl:choose>
4596
4708
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4597
4709
  <xsl:variable name="target">
4598
4710
  <xsl:choose>
@@ -4645,7 +4757,10 @@
4645
4757
  </fo:block>
4646
4758
  <xsl:apply-templates/>
4647
4759
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4648
- <fo:inline><xsl:apply-templates/></fo:inline>
4760
+ <xsl:variable name="level">
4761
+ <xsl:call-template name="getLevel"/>
4762
+ </xsl:variable>
4763
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4649
4764
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4650
4765
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4651
4766
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4680,9 +4795,10 @@
4680
4795
 
4681
4796
  </xsl:variable>
4682
4797
 
4798
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4683
4799
  <xsl:choose>
4684
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4685
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4800
+ <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>
4801
+ <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>
4686
4802
  </xsl:choose>
4687
4803
  <xsl:apply-templates/>
4688
4804
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -4828,7 +4944,10 @@
4828
4944
  </fo:block>
4829
4945
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
4830
4946
  <xsl:if test="normalize-space() != ''">
4831
- <fo:inline>
4947
+ <xsl:variable name="level">
4948
+ <xsl:call-template name="getLevelTermName"/>
4949
+ </xsl:variable>
4950
+ <fo:inline role="H{$level}">
4832
4951
  <xsl:apply-templates/>
4833
4952
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
4834
4953
  <xsl:text>.</xsl:text>
@@ -4901,7 +5020,24 @@
4901
5020
  </fo:instream-foreign-object>
4902
5021
  </xsl:when>
4903
5022
  <xsl:otherwise>
4904
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5023
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
5024
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
5025
+
5026
+ <xsl:variable name="img_src">
5027
+ <xsl:choose>
5028
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
5029
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
5030
+ </xsl:choose>
5031
+ </xsl:variable>
5032
+
5033
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5034
+ <xsl:if test="number($scale) &lt; 100">
5035
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5036
+ </xsl:if>
5037
+
5038
+ </xsl:if>
5039
+
5040
+ </fo:external-graphic>
4905
5041
  </xsl:otherwise>
4906
5042
  </xsl:choose>
4907
5043
 
@@ -5072,11 +5208,13 @@
5072
5208
  <xsl:attribute name="width">100%</xsl:attribute>
5073
5209
  <xsl:attribute name="content-height">100%</xsl:attribute>
5074
5210
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5211
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
5212
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
5075
5213
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5076
5214
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5077
5215
  <!-- effective height / width = 1.48, 1.4 - with title -->
5078
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
5079
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
5216
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
5217
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
5080
5218
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5081
5219
  </xsl:if>
5082
5220
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -5093,6 +5231,23 @@
5093
5231
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
5094
5232
  <xsl:value-of select="."/>
5095
5233
  </xsl:attribute>
5234
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
5235
+ <xsl:copy>
5236
+ <xsl:apply-templates select="@*" mode="svg_update"/>
5237
+ <xsl:variable name="viewbox">
5238
+ <xsl:call-template name="split">
5239
+ <xsl:with-param name="pText" select="@viewBox"/>
5240
+ <xsl:with-param name="sep" select="' '"/>
5241
+ </xsl:call-template>
5242
+ </xsl:variable>
5243
+ <xsl:attribute name="width">
5244
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5245
+ </xsl:attribute>
5246
+ <xsl:attribute name="height">
5247
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5248
+ </xsl:attribute>
5249
+ <xsl:apply-templates mode="svg_update"/>
5250
+ </xsl:copy>
5096
5251
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5097
5252
  <xsl:variable name="svg_content" select="document(@src)"/>
5098
5253
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5423,6 +5578,7 @@
5423
5578
  </xsl:when>
5424
5579
  <xsl:otherwise>
5425
5580
  <xsl:apply-templates/>
5581
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
5426
5582
  </xsl:otherwise>
5427
5583
  </xsl:choose>
5428
5584
  </fo:block>
@@ -5563,14 +5719,6 @@
5563
5719
  <fo:block>
5564
5720
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
5565
5721
  </fo:block>
5566
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5567
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
5568
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5569
- </fo:block>
5570
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
5571
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
5572
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5573
- </fo:block>
5574
5722
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
5575
5723
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
5576
5724
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -5587,6 +5735,38 @@
5587
5735
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
5588
5736
  <xsl:apply-templates/>
5589
5737
  </fo:block>
5738
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5739
+ <fo:block xsl:use-attribute-sets="subject-style">
5740
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5741
+ </fo:block>
5742
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
5743
+ <fo:block xsl:use-attribute-sets="subject-style">
5744
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5745
+ </fo:block>
5746
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
5747
+ <fo:block xsl:use-attribute-sets="inherit-style">
5748
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5749
+ </fo:block>
5750
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
5751
+ <fo:block xsl:use-attribute-sets="description-style">
5752
+ <xsl:apply-templates/>
5753
+ </fo:block>
5754
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
5755
+ <fo:block xsl:use-attribute-sets="specification-style">
5756
+ <xsl:apply-templates/>
5757
+ </fo:block>
5758
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
5759
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
5760
+ <xsl:apply-templates/>
5761
+ </fo:block>
5762
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
5763
+ <fo:block xsl:use-attribute-sets="verification-style">
5764
+ <xsl:apply-templates/>
5765
+ </fo:block>
5766
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
5767
+ <fo:block xsl:use-attribute-sets="import-style">
5768
+ <xsl:apply-templates/>
5769
+ </fo:block>
5590
5770
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
5591
5771
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
5592
5772
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -5738,7 +5918,19 @@
5738
5918
  </fo:inline>
5739
5919
  </xsl:if>
5740
5920
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
5741
- <fo:inline><xsl:apply-templates/></fo:inline>
5921
+ <xsl:variable name="element">inline
5922
+
5923
+ </xsl:variable>
5924
+ <xsl:choose>
5925
+ <xsl:when test="contains($element, 'block')">
5926
+ <fo:block xsl:use-attribute-sets="example-p-style">
5927
+ <xsl:apply-templates/>
5928
+ </fo:block>
5929
+ </xsl:when>
5930
+ <xsl:otherwise>
5931
+ <fo:inline><xsl:apply-templates/></fo:inline>
5932
+ </xsl:otherwise>
5933
+ </xsl:choose>
5742
5934
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5743
5935
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5744
5936
 
@@ -6338,7 +6530,6 @@
6338
6530
  </xsl:template><xsl:template name="processBibitem">
6339
6531
 
6340
6532
 
6341
- <!-- end BIPM bibitem processing-->
6342
6533
 
6343
6534
 
6344
6535
 
@@ -6468,6 +6659,9 @@
6468
6659
  <fo:block-container border="1pt solid black" width="50%">
6469
6660
  <fo:block> </fo:block>
6470
6661
  </fo:block-container>
6662
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6663
+ <fo:inline padding-right="5mm"> </fo:inline>
6664
+ <fo:inline><xsl:apply-templates/></fo:inline>
6471
6665
  </xsl:template><xsl:template name="convertDate">
6472
6666
  <xsl:param name="date"/>
6473
6667
  <xsl:param name="format" select="'short'"/>
@@ -6703,6 +6897,26 @@
6703
6897
  <xsl:value-of select="$level"/>
6704
6898
  </xsl:otherwise>
6705
6899
  </xsl:choose>
6900
+ </xsl:template><xsl:template name="getLevelTermName">
6901
+ <xsl:choose>
6902
+ <xsl:when test="normalize-space(../@depth) != ''">
6903
+ <xsl:value-of select="../@depth"/>
6904
+ </xsl:when>
6905
+ <xsl:otherwise>
6906
+ <xsl:variable name="title_level_">
6907
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
6908
+ <xsl:call-template name="getLevel"/>
6909
+ </xsl:for-each>
6910
+ </xsl:variable>
6911
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
6912
+ <xsl:choose>
6913
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
6914
+ <xsl:otherwise>
6915
+ <xsl:call-template name="getLevel"/>
6916
+ </xsl:otherwise>
6917
+ </xsl:choose>
6918
+ </xsl:otherwise>
6919
+ </xsl:choose>
6706
6920
  </xsl:template><xsl:template name="split">
6707
6921
  <xsl:param name="pText" select="."/>
6708
6922
  <xsl:param name="sep" select="','"/>
@@ -6800,20 +7014,40 @@
6800
7014
  </xsl:call-template>
6801
7015
  </xsl:if>
6802
7016
  </xsl:template><xsl:template name="getLocalizedString">
6803
- <xsl:param name="key"/>
7017
+ <xsl:param name="key"/>
7018
+ <xsl:param name="formatted">false</xsl:param>
6804
7019
 
6805
7020
  <xsl:variable name="curr_lang">
6806
7021
  <xsl:call-template name="getLang"/>
6807
7022
  </xsl:variable>
6808
7023
 
6809
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
7024
+ <xsl:variable name="data_value">
7025
+ <xsl:choose>
7026
+ <xsl:when test="$formatted = 'true'">
7027
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
7028
+ </xsl:when>
7029
+ <xsl:otherwise>
7030
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
7031
+ </xsl:otherwise>
7032
+ </xsl:choose>
7033
+ </xsl:variable>
6810
7034
 
6811
7035
  <xsl:choose>
6812
- <xsl:when test="$data_value != ''">
6813
- <xsl:value-of select="$data_value"/>
7036
+ <xsl:when test="normalize-space($data_value) != ''">
7037
+ <xsl:choose>
7038
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
7039
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
7040
+ </xsl:choose>
6814
7041
  </xsl:when>
6815
7042
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6816
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
7043
+ <xsl:choose>
7044
+ <xsl:when test="$formatted = 'true'">
7045
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
7046
+ </xsl:when>
7047
+ <xsl:otherwise>
7048
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
7049
+ </xsl:otherwise>
7050
+ </xsl:choose>
6817
7051
  </xsl:when>
6818
7052
  <xsl:otherwise>
6819
7053
  <xsl:variable name="key_">
@@ -6824,7 +7058,7 @@
6824
7058
  <xsl:value-of select="$key_"/>
6825
7059
  </xsl:otherwise>
6826
7060
  </xsl:choose>
6827
-
7061
+
6828
7062
  </xsl:template><xsl:template name="setTrackChangesStyles">
6829
7063
  <xsl:param name="isAdded"/>
6830
7064
  <xsl:param name="isDeleted"/>