metanorma-bipm 1.1.7 → 1.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bipm="https://www.metanorma.org/ns/bipm" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bipm="https://www.metanorma.org/ns/bipm" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -13,6 +13,10 @@
13
13
  <!-- param for second pass -->
14
14
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
15
15
 
16
+ <xsl:param name="add_math_as_text">true</xsl:param>
17
+
18
+ <xsl:param name="add_math_as_attachment">true</xsl:param>
19
+
16
20
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
17
21
 
18
22
  <xsl:variable name="pageWidth" select="210"/>
@@ -196,7 +200,9 @@
196
200
  <xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
197
201
  <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
198
202
  <xsl:apply-templates select="/*/bipm:annex" mode="contents"/>
199
- <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[not(@normative='true')]" mode="contents"/>
203
+ <xsl:if test="/*/bipm:bibliography/bipm:references[not(@normative='true')]/bipm:bibitem[not(contains(bipm:docidentifier, 'si-brochure-'))]">
204
+ <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[not(@normative='true')]" mode="contents"/>
205
+ </xsl:if>
200
206
 
201
207
  <!-- Index -->
202
208
  <!-- <xsl:apply-templates select="//bipm:clause[@type = 'index']" mode="contents"/> -->
@@ -206,6 +212,37 @@
206
212
  </xsl:template>
207
213
 
208
214
 
215
+ <xsl:variable name="mathml_attachments">
216
+ <xsl:if test="$add_math_as_attachment = 'true'">
217
+ <xsl:for-each select="//mathml:math">
218
+
219
+ <xsl:variable name="sequence_number"><xsl:number level="any" format="00001"/></xsl:variable>
220
+
221
+ <xsl:variable name="clause_title_number" select="ancestor-or-self::bipm:clause[bipm:title[bipm:tab]][1]/bipm:title/node()[1]"/>
222
+
223
+ <xsl:variable name="mathml_filename">
224
+ <xsl:text>math</xsl:text>
225
+ <xsl:if test="$clause_title_number != '' and translate($clause_title_number, '.123456789', '') = ''">
226
+ <xsl:text>_</xsl:text>
227
+ <xsl:value-of select="$clause_title_number"/>
228
+ <xsl:text>_</xsl:text>
229
+ </xsl:if>
230
+ <xsl:value-of select="$sequence_number"/>
231
+ <xsl:text>.mml</xsl:text>
232
+ </xsl:variable>
233
+
234
+ <xsl:variable name="mathml_content">
235
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
236
+ </xsl:variable>
237
+
238
+ <attachment filename="{$mathml_filename}">
239
+ <xsl:value-of select="$mathml_content"/>
240
+ </attachment>
241
+
242
+ </xsl:for-each>
243
+ </xsl:if>
244
+ </xsl:variable>
245
+
209
246
 
210
247
  <xsl:template match="/">
211
248
  <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
@@ -308,6 +345,24 @@
308
345
 
309
346
  <fo:declarations>
310
347
  <xsl:call-template name="addPDFUAmeta"/>
348
+
349
+ <xsl:if test="$add_math_as_attachment = 'true'">
350
+ <!-- DEBUG: mathml_attachments=<xsl:copy-of select="$mathml_attachments"/> -->
351
+ <xsl:for-each select="xalan:nodeset($mathml_attachments)//attachment">
352
+
353
+ <xsl:variable name="mathml_filename" select="@filename"/>
354
+ <xsl:variable name="mathml_content" select="."/>
355
+
356
+ <xsl:variable name="basepath" select="java:org.metanorma.fop.Util.saveFileToDisk($mathml_filename,$mathml_content)"/>
357
+
358
+ <xsl:variable name="url" select="concat('url(file:',$basepath, ')')"/>
359
+
360
+ <xsl:if test="normalize-space($url) != ''">
361
+ <pdf:embedded-file src="{$url}" filename="{$mathml_filename}"/>
362
+ </xsl:if>
363
+ </xsl:for-each>
364
+ </xsl:if>
365
+
311
366
  </fo:declarations>
312
367
 
313
368
  <xsl:call-template name="addBookmarks">
@@ -475,6 +530,10 @@
475
530
  <xsl:apply-templates select="@*|node()" mode="flatxml"/>
476
531
  </xsl:copy>
477
532
  </xsl:template>
533
+
534
+ <xsl:template match="mathml:math" mode="flatxml" priority="2">
535
+ <xsl:copy-of select="."/>
536
+ </xsl:template>
478
537
 
479
538
  <!-- enclosing starting elements annex/... in clause -->
480
539
  <xsl:template match="bipm:annex" mode="flatxml">
@@ -740,6 +799,10 @@
740
799
  </xsl:copy>
741
800
  </xsl:template>
742
801
 
802
+ <xsl:template match="mathml:math" mode="flatxml_list" priority="2">
803
+ <xsl:copy-of select="."/>
804
+ </xsl:template>
805
+
743
806
  <!-- copy 'ol' 'ul' properties to each 'li' -->
744
807
  <!-- OBSOLETE: move note for list (list level note) into latest 'li' -->
745
808
  <!-- NOW: move note for list (list level note) into first 'li' -->
@@ -1066,7 +1129,7 @@
1066
1129
  </fo:block-container>
1067
1130
 
1068
1131
  <fo:block-container font-size="18pt" font-weight="bold" text-align="center">
1069
- <fo:block>
1132
+ <fo:block role="H1">
1070
1133
  <xsl:value-of select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='cover']"/>
1071
1134
  </fo:block>
1072
1135
  </fo:block-container>
@@ -1165,7 +1228,7 @@
1165
1228
 
1166
1229
  <fo:block-container margin-left="-14mm" margin-right="0mm">
1167
1230
  <fo:block-container margin-left="0mm" margin-right="0mm">
1168
- <fo:block font-family="Arial" font-size="16pt" font-weight="bold" text-align-last="justify" margin-bottom="82pt">
1231
+ <fo:block font-family="Arial" font-size="16pt" font-weight="bold" text-align-last="justify" margin-bottom="82pt" role="H1">
1169
1232
  <!-- <fo:marker marker-class-name="header-title"><xsl:value-of select="$title-toc"/></fo:marker> -->
1170
1233
  <fo:inline><xsl:value-of select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='main']"/></fo:inline>
1171
1234
  <fo:inline keep-together.within-line="always">
@@ -1179,7 +1242,7 @@
1179
1242
  </fo:block-container>
1180
1243
 
1181
1244
  <fo:block-container line-height="135%">
1182
- <fo:block>
1245
+ <fo:block role="TOC">
1183
1246
  <!-- <xsl:copy-of select="$contents"/> -->
1184
1247
 
1185
1248
  <xsl:if test="xalan:nodeset($contents)/doc[@id = $docid]//item[@display='true']">
@@ -1231,7 +1294,9 @@
1231
1294
  <xsl:apply-templates select="bipm:annex" mode="sections"/>
1232
1295
 
1233
1296
  <!-- Bibliography -->
1234
- <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1297
+ <xsl:if test="bipm:bibliography/bipm:references[not(@normative='true')]/bipm:bibitem[not(contains(bipm:docidentifier, 'si-brochure-'))]">
1298
+ <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1299
+ </xsl:if>
1235
1300
 
1236
1301
  <!-- Document Control -->
1237
1302
  <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
@@ -1280,7 +1345,7 @@
1280
1345
  </fo:block-container>
1281
1346
 
1282
1347
  <fo:block-container font-size="18pt" font-weight="bold" text-align="center">
1283
- <fo:block>
1348
+ <fo:block role="H1">
1284
1349
 
1285
1350
  <!-- <xsl:variable name="title"> -->
1286
1351
  <xsl:choose>
@@ -1315,7 +1380,7 @@
1315
1380
 
1316
1381
  <xsl:variable name="part_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:part)"/>
1317
1382
  <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']">
1318
- <fo:block>
1383
+ <fo:block role="H2">
1319
1384
  <xsl:if test="$part_num != ''">
1320
1385
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part_num)"/>
1321
1386
  </xsl:if>
@@ -1325,7 +1390,7 @@
1325
1390
  </xsl:if>
1326
1391
  <xsl:variable name="subpart_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:subpart)"/>
1327
1392
  <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart']">
1328
- <fo:block>
1393
+ <fo:block role="H3">
1329
1394
  <xsl:if test="$subpart_num != ''">
1330
1395
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang=$curr_lang]),'#',$subpart_num)"/>
1331
1396
  </xsl:if>
@@ -1397,8 +1462,9 @@
1397
1462
 
1398
1463
  <xsl:apply-templates select="bipm:annex" mode="sections"/>
1399
1464
 
1400
-
1401
- <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1465
+ <xsl:if test="bipm:bibliography/bipm:references[not(@normative='true')]/bipm:bibitem[not(contains(bipm:docidentifier, 'si-brochure-'))]">
1466
+ <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1467
+ </xsl:if>
1402
1468
 
1403
1469
  <!-- Document Control -->
1404
1470
  <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
@@ -1464,7 +1530,7 @@
1464
1530
  <xsl:otherwise>400</xsl:otherwise>
1465
1531
  </xsl:choose>
1466
1532
  </xsl:variable>
1467
- <fo:block>
1533
+ <fo:block role="H1">
1468
1534
  <xsl:if test="$title_num != 1">
1469
1535
  <xsl:attribute name="text-align">right</xsl:attribute>
1470
1536
  </xsl:if>
@@ -1504,8 +1570,8 @@
1504
1570
 
1505
1571
  <fo:block-container absolute-position="fixed" left="12.5mm" top="60mm">
1506
1572
 
1507
- <fo:block font-size="22.2pt" font-weight="{$weight-normal}"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'main']"/></fo:block>
1508
- <fo:block font-size="22.2pt" font-weight="{$weight-bold}" margin-top="1mm"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'main']"/></fo:block>
1573
+ <fo:block font-size="22.2pt" font-weight="{$weight-normal}" role="H1"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'main']"/></fo:block>
1574
+ <fo:block font-size="22.2pt" font-weight="{$weight-bold}" margin-top="1mm" role="H1"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'main']"/></fo:block>
1509
1575
 
1510
1576
  <xsl:variable name="edition_str">édition</xsl:variable>
1511
1577
  <!-- <xsl:choose>
@@ -1518,7 +1584,7 @@
1518
1584
 
1519
1585
  <!-- <fo:block-container height="98%" display-align="center"> -->
1520
1586
  <fo:block-container absolute-position="fixed" left="12.5mm" top="92mm" height="170mm" width="144mm" display-align="center">
1521
- <fo:block>
1587
+ <fo:block role="H1">
1522
1588
 
1523
1589
  <xsl:variable name="title_appendix_fr">
1524
1590
  <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'appendix']" mode="title"/>
@@ -1823,7 +1889,7 @@
1823
1889
  </xsl:call-template>
1824
1890
  </fo:block>
1825
1891
  <fo:block-container font-size="12pt" font-weight="bold" border-top="0.5pt solid black" padding-top="2mm" width="45mm">
1826
- <fo:block>
1892
+ <fo:block role="H1">
1827
1893
  <xsl:call-template name="add-letter-spacing">
1828
1894
  <xsl:with-param name="text" select="$title"/>
1829
1895
  <xsl:with-param name="letter-spacing" select="0.09"/>
@@ -1932,7 +1998,7 @@
1932
1998
  <xsl:if test="normalize-space($space-after) != ''">
1933
1999
  <xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
1934
2000
  </xsl:if>
1935
- <fo:block>
2001
+ <fo:block role="TOCI">
1936
2002
  <xsl:if test="@level = 1">
1937
2003
  <!-- <xsl:attribute name="space-after">6pt</xsl:attribute> -->
1938
2004
  <xsl:attribute name="font-family">Arial</xsl:attribute>
@@ -2247,7 +2313,10 @@
2247
2313
  </xsl:template>
2248
2314
 
2249
2315
  <xsl:template match="bipm:license-statement//bipm:title">
2250
- <fo:block text-decoration="underline" margin-bottom="6pt">
2316
+ <xsl:variable name="level">
2317
+ <xsl:call-template name="getLevel"/>
2318
+ </xsl:variable>
2319
+ <fo:block text-decoration="underline" margin-bottom="6pt" role="H{$level}">
2251
2320
  <xsl:apply-templates/>
2252
2321
  </fo:block>
2253
2322
  </xsl:template>
@@ -2305,8 +2374,10 @@
2305
2374
  <!-- <xsl:when test="$level = 1 and $independentAppendix != ''">11.5pt</xsl:when>
2306
2375
  <xsl:when test="$level &gt;= 2 and $independentAppendix != ''">10.5pt</xsl:when> -->
2307
2376
  <xsl:when test="$level = 1">16pt</xsl:when>
2377
+ <xsl:when test="$level = 2 and ancestor::bipm:annex and ../@type = 'toc'">16pt</xsl:when>
2308
2378
  <xsl:when test="$level = 2 and ancestor::bipm:annex">10.5pt</xsl:when>
2309
2379
  <xsl:when test="$level = 2">14pt</xsl:when>
2380
+ <xsl:when test="$level &gt;= 3 and ancestor::bipm:annex and ../@type = 'toc'">9pt</xsl:when>
2310
2381
  <xsl:when test="$level = 3 and ancestor::bipm:annex">10pt</xsl:when>
2311
2382
  <xsl:when test="$level &gt;= 4 and ancestor::bipm:annex">9pt</xsl:when>
2312
2383
  <xsl:when test="$level = 3">12pt</xsl:when>
@@ -2330,6 +2401,7 @@
2330
2401
  <xsl:choose>
2331
2402
  <xsl:when test="$level = 1 and (parent::bipm:annex or ancestor::bipm:annex or parent::bipm:abstract or ancestor::bipm:preface)">84pt</xsl:when>
2332
2403
  <xsl:when test="$level = 1">6pt</xsl:when>
2404
+ <xsl:when test="$level = 2 and ancestor::bipm:annex and ../@type = 'toc'">29mm</xsl:when>
2333
2405
  <xsl:when test="$level = 2 and ancestor::bipm:annex">6pt</xsl:when> <!-- 6pt 12pt -->
2334
2406
  <!-- <xsl:when test="$level = 2 and $independentAppendix != ''">6pt</xsl:when> -->
2335
2407
  <xsl:when test="$level = 2">10pt</xsl:when>
@@ -2360,6 +2432,14 @@
2360
2432
  <xsl:attribute name="space-before">20pt</xsl:attribute>
2361
2433
  </xsl:if>
2362
2434
 
2435
+ <xsl:if test="$level &gt;= 3 and ancestor::bipm:annex and ../@type = 'toc'">
2436
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
2437
+ </xsl:if>
2438
+
2439
+ <xsl:if test="@type = 'quoted'">
2440
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2441
+ </xsl:if>
2442
+
2363
2443
  <fo:block-container margin-left="0mm">
2364
2444
 
2365
2445
  <!-- marker not working for math -->
@@ -2378,19 +2458,20 @@
2378
2458
 
2379
2459
  <xsl:choose>
2380
2460
  <xsl:when test="*[local-name() = 'tab'] and not(ancestor::bipm:annex) "><!-- split number and title --> <!-- and $independentAppendix = '' -->
2381
- <fo:table table-layout="fixed" width="100%">
2461
+ <fo:table table-layout="fixed" width="100%" role="H{$level}">
2382
2462
  <fo:table-column column-width="14mm"/>
2383
2463
  <fo:table-column column-width="136mm"/>
2384
2464
  <fo:table-body>
2385
2465
  <fo:table-row>
2386
2466
  <fo:table-cell>
2387
- <fo:block>
2467
+ <fo:block role="H{$level}">
2388
2468
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
2389
2469
  </fo:block>
2390
2470
  </fo:table-cell>
2391
2471
  <fo:table-cell>
2392
- <fo:block line-height-shift-adjustment="disregard-shifts">
2472
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="H{$level}">
2393
2473
  <xsl:call-template name="extractTitle"/>
2474
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2394
2475
  </fo:block>
2395
2476
  </fo:table-cell>
2396
2477
  </fo:table-row>
@@ -2398,7 +2479,7 @@
2398
2479
  </fo:table>
2399
2480
  </xsl:when>
2400
2481
  <xsl:otherwise>
2401
- <fo:block>
2482
+ <fo:block role="H{$level}">
2402
2483
  <!-- <xsl:if test="$independentAppendix != ''">
2403
2484
  <xsl:attribute name="margin-left">14mm</xsl:attribute>
2404
2485
  </xsl:if> -->
@@ -2407,24 +2488,24 @@
2407
2488
  <xsl:if test="$level &gt;= 3">
2408
2489
  <xsl:attribute name="margin-left">14mm</xsl:attribute>
2409
2490
  </xsl:if>
2410
- <xsl:if test="$level = 3">
2411
- <fo:inline padding-right="2.5mm" baseline-shift="15%">
2412
- <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
2413
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
2414
- <rect x="0" y="0" width="2" height="2" fill="black"/>
2415
- </svg>
2416
- </fo:instream-foreign-object>
2417
- </fo:inline>
2491
+ <xsl:if test="$level = 3 and not(../@type = 'toc')">
2492
+ <!-- <xsl:call-template name="blacksquare"/> -->
2418
2493
  </xsl:if>
2419
2494
  <xsl:if test="$level = 4">
2420
2495
  <xsl:attribute name="text-align">center</xsl:attribute>
2421
2496
  </xsl:if>
2422
- <xsl:call-template name="extractTitle"/>
2497
+ <xsl:if test="../@type = 'toc'">
2498
+ <xsl:attribute name="text-align">left</xsl:attribute>
2499
+ </xsl:if>
2500
+ <!-- <xsl:call-template name="extractTitle"/> -->
2501
+ <xsl:apply-templates/>
2502
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2423
2503
  </xsl:when>
2424
2504
  <xsl:otherwise>
2425
2505
  <!-- <xsl:choose>
2426
2506
  <xsl:when test="$independentAppendix = ''"> -->
2427
2507
  <xsl:apply-templates/>
2508
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2428
2509
  <!-- </xsl:when>
2429
2510
  <xsl:otherwise>
2430
2511
  <xsl:variable name="section" select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -2447,6 +2528,7 @@
2447
2528
 
2448
2529
  </xsl:template>
2449
2530
 
2531
+
2450
2532
  <xsl:template match="*" mode="header">
2451
2533
  <xsl:apply-templates mode="header"/>
2452
2534
  </xsl:template>
@@ -3039,6 +3121,7 @@
3039
3121
  <xsl:attribute name="font-family">Arial</xsl:attribute>
3040
3122
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3041
3123
  <xsl:attribute name="line-height">130%</xsl:attribute>
3124
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
3042
3125
  </xsl:if>
3043
3126
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
3044
3127
  <xsl:apply-templates/>
@@ -3083,6 +3166,7 @@
3083
3166
  <xsl:attribute name="font-family">Arial</xsl:attribute>
3084
3167
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3085
3168
  <xsl:attribute name="line-height">130%</xsl:attribute>
3169
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
3086
3170
  </xsl:if>
3087
3171
 
3088
3172
  <!-- last item -->
@@ -3240,16 +3324,19 @@
3240
3324
  </fo:block>
3241
3325
  </xsl:template>
3242
3326
 
3243
- <xsl:template match="bipm:preferred">
3244
- <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3245
- <xsl:if test="ancestor::bipm:term/bipm:name">
3246
- <fo:inline>
3247
- <xsl:attribute name="padding-right">2mm</xsl:attribute>
3248
- <xsl:apply-templates select="ancestor::bipm:term/bipm:name" mode="presentation"/>
3249
- </fo:inline>
3250
- </xsl:if>
3251
- <xsl:apply-templates/>
3252
- </fo:block>
3327
+ <xsl:template match="bipm:preferred">
3328
+ <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3329
+ <xsl:if test="ancestor::bipm:term/bipm:name">
3330
+ <xsl:variable name="level">
3331
+ <xsl:call-template name="getLevelTermName"/>
3332
+ </xsl:variable>
3333
+ <fo:inline role="H{$level}">
3334
+ <xsl:attribute name="padding-right">2mm</xsl:attribute>
3335
+ <xsl:apply-templates select="ancestor::bipm:term/bipm:name" mode="presentation"/>
3336
+ </fo:inline>
3337
+ </xsl:if>
3338
+ <xsl:apply-templates/>
3339
+ </fo:block>
3253
3340
  </xsl:template>
3254
3341
 
3255
3342
  <xsl:template match="bipm:bibitem">
@@ -3647,10 +3734,181 @@
3647
3734
  <xsl:value-of select="translate(., ' ', ' ')"/>
3648
3735
  </xsl:template>
3649
3736
 
3737
+ <xsl:template match="mathml:math" priority="2">
3738
+ <xsl:variable name="isAdded" select="@added"/>
3739
+ <xsl:variable name="isDeleted" select="@deleted"/>
3740
+
3741
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3742
+
3743
+ <xsl:if test="ancestor::*[local-name()='table']">
3744
+ <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
3745
+ </xsl:if>
3746
+
3747
+ <xsl:call-template name="setTrackChangesStyles">
3748
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3749
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3750
+ </xsl:call-template>
3751
+
3752
+ <xsl:if test="$add_math_as_text = 'true'">
3753
+ <!-- set unique font-size (fiction) -->
3754
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
3755
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal">​</fo:inline> <!-- zero width space -->
3756
+ </xsl:if>
3757
+
3758
+ <!-- <fo:wrapper role="artifact"> -->
3759
+
3760
+ <xsl:variable name="mathml_content">
3761
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3762
+ </xsl:variable>
3763
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
3764
+
3765
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3766
+ <xsl:variable name="comment_text_">
3767
+ <xsl:choose>
3768
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3769
+ <xsl:value-of select="$comment_text_following"/>
3770
+ </xsl:when>
3771
+ <xsl:otherwise>
3772
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3773
+ </xsl:otherwise>
3774
+ </xsl:choose>
3775
+ </xsl:variable>
3776
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3777
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
3778
+
3779
+ <xsl:variable name="filename" select="xalan:nodeset($mathml_attachments)//attachment[. = $mathml_content]/@filename"/>
3780
+ <xsl:choose>
3781
+ <xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
3782
+ <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
3783
+ <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
3784
+ <xsl:if test="normalize-space($comment_text) != ''">
3785
+ <!-- put Mathin Alternate Text -->
3786
+ <xsl:attribute name="fox:alt-text">
3787
+ <xsl:value-of select="$comment_text"/>
3788
+ </xsl:attribute>
3789
+ </xsl:if>
3790
+ <xsl:call-template name="mathml_instream_object">
3791
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
3792
+ <xsl:with-param name="comment_text" select="$comment_text"/>
3793
+ </xsl:call-template>
3794
+ </fo:basic-link>
3795
+ <!-- </xsl:if> -->
3796
+ </xsl:when>
3797
+ <xsl:otherwise>
3798
+ <xsl:call-template name="mathml_instream_object">
3799
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
3800
+ <xsl:with-param name="comment_text" select="$comment_text"/>
3801
+ </xsl:call-template>
3802
+ </xsl:otherwise>
3803
+ </xsl:choose>
3804
+ <!-- </fo:wrapper> -->
3805
+ </fo:inline>
3806
+ </xsl:template>
3807
+
3808
+ <xsl:template name="mathml_instream_object">
3809
+ <xsl:param name="mathml_content"/>
3810
+ <xsl:param name="comment_text"/>
3811
+
3812
+ <xsl:variable name="mathml">
3813
+ <xsl:apply-templates select="." mode="mathml"/>
3814
+ </xsl:variable>
3815
+
3816
+ <fo:instream-foreign-object fox:alt-text="Math">
3817
+
3818
+ <xsl:if test="local-name(../..) = 'formula'">
3819
+ <xsl:attribute name="width">95%</xsl:attribute>
3820
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3821
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3822
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3823
+ </xsl:if>
3824
+
3825
+ <!-- put MathML in Actual Text -->
3826
+ <xsl:attribute name="fox:actual-text">
3827
+ <xsl:value-of select="$mathml_content"/>
3828
+ </xsl:attribute>
3829
+
3830
+ <xsl:if test="$add_math_as_text = 'true'">
3831
+ <xsl:if test="normalize-space($comment_text) != ''">
3832
+ <!-- put Mathin Alternate Text -->
3833
+ <xsl:attribute name="fox:alt-text">
3834
+ <xsl:value-of select="$comment_text"/>
3835
+ </xsl:attribute>
3836
+ </xsl:if>
3837
+ </xsl:if>
3838
+
3839
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
3840
+ </fo:instream-foreign-object>
3841
+ </xsl:template>
3842
+
3843
+
3844
+ <!-- =================== -->
3845
+ <!-- Table of Contents (ToC) processing -->
3846
+ <!-- =================== -->
3847
+ <xsl:template match="bipm:clause[@type = 'toc']" priority="3">
3848
+ <fo:block role="TOC">
3849
+ <xsl:copy-of select="@id"/>
3850
+ <xsl:apply-templates select="bipm:title[1]"/>
3851
+
3852
+ <!-- create virtual table to determine column's width -->
3853
+ <xsl:variable name="toc_table_simple">
3854
+ <tbody>
3855
+ <xsl:apply-templates mode="toc_table_width"/>
3856
+ </tbody>
3857
+ </xsl:variable>
3858
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
3859
+ <xsl:variable name="colwidths">
3860
+ <xsl:call-template name="calculate-column-widths">
3861
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3862
+ <xsl:with-param name="table" select="$toc_table_simple"/>
3863
+ </xsl:call-template>
3864
+ </xsl:variable>
3865
+
3866
+ <fo:table width="100%" table-layout="fixed">
3867
+ <fo:table-column column-width="100%"/>
3868
+ <fo:table-header>
3869
+ <fo:table-row font-weight="bold">
3870
+ <fo:table-cell text-align="right" font-size="9pt" font-family="Arial">
3871
+ <fo:block>
3872
+ <xsl:variable name="page">
3873
+ <xsl:call-template name="getLocalizedString">
3874
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
3875
+ </xsl:call-template>
3876
+ </xsl:variable>
3877
+ <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($page))"/>
3878
+ </fo:block>
3879
+ </fo:table-cell>
3880
+ </fo:table-row>
3881
+ </fo:table-header>
3882
+ <fo:table-body>
3883
+ <fo:table-row>
3884
+ <fo:table-cell>
3885
+ <fo:block>
3886
+ <xsl:variable name="title_id" select="generate-id(bipm:title[1])"/>
3887
+ <xsl:apply-templates select="*[not(generate-id() = $title_id)]">
3888
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3889
+ </xsl:apply-templates>
3890
+ </fo:block>
3891
+ </fo:table-cell>
3892
+ </fo:table-row>
3893
+ </fo:table-body>
3894
+ </fo:table>
3895
+ </fo:block>
3896
+ </xsl:template>
3897
+
3898
+
3899
+ <!-- ignore section number before tab -->
3900
+ <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/text()[1][not(preceding-sibling::bipm:tab) and following-sibling::*[1][self::bipm:tab]]"/>
3901
+ <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/bipm:tab" priority="2"/>
3902
+
3903
+ <!-- =================== -->
3904
+ <!-- End Table of Contents (ToC) processing -->
3905
+ <!-- =================== -->
3906
+
3907
+
3650
3908
  <xsl:template name="insertHeaderFooter">
3651
3909
  <xsl:param name="header-title"/>
3652
3910
  <xsl:param name="orientation"/>
3653
- <fo:static-content flow-name="header-odd">
3911
+ <fo:static-content flow-name="header-odd" role="artifact">
3654
3912
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3655
3913
  <fo:block text-align="right">
3656
3914
  <xsl:copy-of select="$header-title"/>
@@ -3670,7 +3928,7 @@
3670
3928
  <fo:block> </fo:block>
3671
3929
  </fo:block-container>
3672
3930
  </fo:static-content>
3673
- <fo:static-content flow-name="header-even">
3931
+ <fo:static-content flow-name="header-even" role="artifact">
3674
3932
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3675
3933
  <fo:block>
3676
3934
  <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
@@ -3851,7 +4109,7 @@
3851
4109
  <fo:block id="{@id}" span="all">
3852
4110
  <xsl:apply-templates select="bipm:title"/>
3853
4111
  </fo:block>
3854
- <fo:block>
4112
+ <fo:block role="Index">
3855
4113
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
3856
4114
 
3857
4115
  <!-- TEST <xsl:variable name="alphabet" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
@@ -3877,7 +4135,7 @@
3877
4135
 
3878
4136
  <!-- <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4"> -->
3879
4137
  <xsl:template match="bipm:indexsect/bipm:title" priority="4">
3880
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm">
4138
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" role="H1">
3881
4139
  <!-- Index -->
3882
4140
  <xsl:apply-templates/>
3883
4141
  </fo:block>
@@ -4470,6 +4728,7 @@
4470
4728
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
4471
4729
  <xsl:attribute name="white-space">pre</xsl:attribute>
4472
4730
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4731
+ <xsl:attribute name="role">Code</xsl:attribute>
4473
4732
 
4474
4733
 
4475
4734
 
@@ -4491,8 +4750,13 @@
4491
4750
 
4492
4751
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
4493
4752
 
4494
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
4495
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
4753
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
4754
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
4755
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
4756
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
4757
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
4758
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
4759
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
4496
4760
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
4497
4761
 
4498
4762
 
@@ -4651,6 +4915,13 @@
4651
4915
 
4652
4916
 
4653
4917
 
4918
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
4919
+
4920
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4921
+
4922
+
4923
+
4924
+
4654
4925
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
4655
4926
 
4656
4927
 
@@ -4682,7 +4953,8 @@
4682
4953
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4683
4954
 
4684
4955
 
4685
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
4956
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
4957
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
4686
4958
 
4687
4959
 
4688
4960
 
@@ -4803,13 +5075,20 @@
4803
5075
 
4804
5076
  </xsl:attribute-set><xsl:attribute-set name="list-style">
4805
5077
 
4806
- </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="processPrefaceSectionsDefault_Contents">
5078
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
5079
+ <xsl:attribute name="line-height">135%</xsl:attribute>
5080
+ </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">
4807
5081
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
4808
5082
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
4809
5083
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
4810
5084
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
4811
5085
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
4812
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5086
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
5087
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
5088
+ <xsl:sort select="@displayorder" data-type="number"/>
5089
+ <xsl:apply-templates select="." mode="contents"/>
5090
+ </xsl:for-each>
5091
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
4813
5092
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
4814
5093
 
4815
5094
  <!-- Normative references -->
@@ -4822,13 +5101,33 @@
4822
5101
  <!-- Bibliography -->
4823
5102
  <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"/>
4824
5103
 
4825
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5104
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5105
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5106
+ <xsl:sort select="@displayorder" data-type="number"/>
5107
+ <xsl:apply-templates select="." mode="contents"/>
5108
+ </xsl:for-each>
5109
+
5110
+ <xsl:for-each select="/*/*[local-name()='annex']">
5111
+ <xsl:sort select="@displayorder" data-type="number"/>
5112
+ <xsl:apply-templates select="." mode="contents"/>
5113
+ </xsl:for-each>
5114
+
5115
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5116
+ <xsl:sort select="@displayorder" data-type="number"/>
5117
+ <xsl:apply-templates select="." mode="contents"/>
5118
+ </xsl:for-each>
5119
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
4826
5120
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
4827
5121
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
4828
5122
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
4829
5123
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
4830
5124
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
4831
- </xsl:template><xsl:template name="processMainSectionsDefault">
5125
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5126
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
5127
+ <xsl:sort select="@displayorder" data-type="number"/>
5128
+ <xsl:apply-templates select="."/>
5129
+ </xsl:for-each>
5130
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
4832
5131
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
4833
5132
 
4834
5133
  <!-- Normative references -->
@@ -4840,6 +5139,22 @@
4840
5139
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
4841
5140
  <!-- Bibliography -->
4842
5141
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
5142
+ </xsl:template><xsl:template name="processMainSectionsDefault">
5143
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5144
+ <xsl:sort select="@displayorder" data-type="number"/>
5145
+ <xsl:apply-templates select="."/>
5146
+
5147
+ </xsl:for-each>
5148
+
5149
+ <xsl:for-each select="/*/*[local-name()='annex']">
5150
+ <xsl:sort select="@displayorder" data-type="number"/>
5151
+ <xsl:apply-templates select="."/>
5152
+ </xsl:for-each>
5153
+
5154
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5155
+ <xsl:sort select="@displayorder" data-type="number"/>
5156
+ <xsl:apply-templates select="."/>
5157
+ </xsl:for-each>
4843
5158
  </xsl:template><xsl:template match="text()">
4844
5159
  <xsl:value-of select="."/>
4845
5160
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -4870,7 +5185,9 @@
4870
5185
 
4871
5186
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4872
5187
 
4873
-
5188
+
5189
+
5190
+
4874
5191
 
4875
5192
  <xsl:call-template name="fn_name_display"/>
4876
5193
 
@@ -5772,18 +6089,16 @@
5772
6089
 
5773
6090
  <!-- Table's note name (NOTE, for example) -->
5774
6091
 
5775
- <fo:inline padding-right="2mm">
6092
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
5776
6093
 
5777
-
5778
6094
 
5779
6095
 
5780
6096
 
5781
-
5782
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5783
6097
  <xsl:if test="ancestor::bipm:preface">
5784
6098
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
5785
6099
  </xsl:if>
5786
6100
 
6101
+
5787
6102
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5788
6103
 
5789
6104
  </fo:inline>
@@ -6418,6 +6733,8 @@
6418
6733
  <xsl:if test="$font-size != ''">
6419
6734
  <xsl:attribute name="font-size">
6420
6735
  <xsl:choose>
6736
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6737
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6421
6738
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6422
6739
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6423
6740
  </xsl:choose>
@@ -6856,6 +7173,12 @@
6856
7173
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
6857
7174
  </xsl:call-template>
6858
7175
 
7176
+ <!-- insert helper tag -->
7177
+ <xsl:if test="$add_math_as_text = 'true'">
7178
+ <fo:inline color="white" font-size="1pt" font-style="normal" font-weight="normal">​</fo:inline> <!-- zero width space -->
7179
+ </xsl:if>
7180
+
7181
+
6859
7182
  <xsl:variable name="mathml">
6860
7183
  <xsl:apply-templates select="." mode="mathml"/>
6861
7184
  </xsl:variable>
@@ -6867,15 +7190,75 @@
6867
7190
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6868
7191
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6869
7192
  </xsl:if>
6870
- <!-- <xsl:attribute name="fox:alt-text">
6871
- put AsciiMath/LaTeX math
6872
- </xsl:attribute> -->
7193
+
7194
+ <xsl:if test="$add_math_as_text = 'true'">
7195
+ <!-- <xsl:variable name="comment_text" select="following-sibling::node()[1][self::comment()]"/> -->
7196
+ <xsl:variable name="comment_text" select="normalize-space(translate(.,' ⁢',' '))"/>
7197
+ <!-- <xsl:variable name="comment_text" select="normalize-space(.)"/> -->
7198
+ <xsl:if test="normalize-space($comment_text) != ''">
7199
+ <!-- put Mathin Alternate Text -->
7200
+ <xsl:attribute name="fox:alt-text">
7201
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
7202
+ <!-- <xsl:value-of select="$comment_text"/> -->
7203
+ </xsl:attribute>
7204
+ </xsl:if>
7205
+ </xsl:if>
7206
+
7207
+
7208
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
7209
+ <xsl:variable name="comment_text_">
7210
+ <xsl:choose>
7211
+ <xsl:when test="normalize-space($comment_text_following) != ''">
7212
+ <xsl:value-of select="$comment_text_following"/>
7213
+ </xsl:when>
7214
+ <xsl:otherwise>
7215
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
7216
+ </xsl:otherwise>
7217
+ </xsl:choose>
7218
+ </xsl:variable>
7219
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
7220
+
7221
+ <xsl:if test="normalize-space($comment_text) != ''">
7222
+ <!-- put Mathin Alternate Text -->
7223
+ <xsl:attribute name="fox:alt-text">
7224
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
7225
+ </xsl:attribute>
7226
+ </xsl:if>
7227
+
7228
+ <xsl:variable name="mathml_content">
7229
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
7230
+ </xsl:variable>
7231
+ <!-- put MathML in Actual Text -->
7232
+ <xsl:attribute name="fox:actual-text">
7233
+ <xsl:value-of select="$mathml_content"/>
7234
+ </xsl:attribute>
6873
7235
 
6874
7236
 
6875
7237
  <!-- <xsl:copy-of select="."/> -->
6876
7238
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6877
7239
  </fo:instream-foreign-object>
6878
7240
  </fo:inline>
7241
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
7242
+ <!-- <xsl:text>a+b</xsl:text> -->
7243
+ <xsl:text>&lt;</xsl:text>
7244
+ <xsl:value-of select="local-name()"/>
7245
+ <xsl:if test="local-name() = 'math'">
7246
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
7247
+ </xsl:if>
7248
+ <xsl:for-each select="@*">
7249
+ <xsl:text> </xsl:text>
7250
+ <xsl:value-of select="local-name()"/>
7251
+ <xsl:text>="</xsl:text>
7252
+ <xsl:value-of select="."/>
7253
+ <xsl:text>"</xsl:text>
7254
+ </xsl:for-each>
7255
+ <xsl:text>&gt;</xsl:text>
7256
+ <xsl:apply-templates mode="mathml_actual_text"/>
7257
+ <xsl:text>&lt;/</xsl:text>
7258
+ <xsl:value-of select="local-name()"/>
7259
+ <xsl:text>&gt;</xsl:text>
7260
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
7261
+ <xsl:value-of select="normalize-space()"/>
6879
7262
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
6880
7263
  <xsl:copy>
6881
7264
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -6937,7 +7320,10 @@
6937
7320
  </fo:block>
6938
7321
  <xsl:apply-templates/>
6939
7322
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
6940
- <fo:inline><xsl:apply-templates/></fo:inline>
7323
+ <xsl:variable name="level">
7324
+ <xsl:call-template name="getLevel"/>
7325
+ </xsl:variable>
7326
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
6941
7327
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
6942
7328
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
6943
7329
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -6972,9 +7358,10 @@
6972
7358
 
6973
7359
  </xsl:variable>
6974
7360
 
7361
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6975
7362
  <xsl:choose>
6976
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
6977
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
7363
+ <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>
7364
+ <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>
6978
7365
  </xsl:choose>
6979
7366
  <xsl:apply-templates/>
6980
7367
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -7134,7 +7521,10 @@
7134
7521
  </fo:block>
7135
7522
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
7136
7523
  <xsl:if test="normalize-space() != ''">
7137
- <fo:inline>
7524
+ <xsl:variable name="level">
7525
+ <xsl:call-template name="getLevelTermName"/>
7526
+ </xsl:variable>
7527
+ <fo:inline role="H{$level}">
7138
7528
  <xsl:apply-templates/>
7139
7529
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
7140
7530
  <xsl:text>.</xsl:text>
@@ -7439,6 +7829,13 @@
7439
7829
  </xsl:attribute>
7440
7830
  <xsl:apply-templates mode="svg_update"/>
7441
7831
  </xsl:copy>
7832
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7833
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
7834
+ <xsl:for-each select="*[local-name() = 'svg']">
7835
+ <xsl:call-template name="image_svg">
7836
+ <xsl:with-param name="name" select="$name"/>
7837
+ </xsl:call-template>
7838
+ </xsl:for-each>
7442
7839
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7443
7840
  <xsl:variable name="svg_content" select="document(@src)"/>
7444
7841
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7543,7 +7940,7 @@
7543
7940
  </fo:basic-link>
7544
7941
  </fo:block>
7545
7942
  </fo:block-container>
7546
- </xsl:template><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">
7943
+ </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">
7547
7944
  <xsl:apply-templates mode="contents"/>
7548
7945
  <xsl:text> </xsl:text>
7549
7946
  </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">
@@ -7783,6 +8180,7 @@
7783
8180
  </xsl:when>
7784
8181
  <xsl:otherwise>
7785
8182
  <xsl:apply-templates/>
8183
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
7786
8184
  </xsl:otherwise>
7787
8185
  </xsl:choose>
7788
8186
  </fo:block>
@@ -7855,12 +8253,16 @@
7855
8253
  <xsl:if test="$font-size != ''">
7856
8254
  <xsl:attribute name="font-size">
7857
8255
  <xsl:choose>
8256
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
8257
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7858
8258
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7859
8259
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7860
8260
  </xsl:choose>
7861
8261
  </xsl:attribute>
7862
8262
  </xsl:if>
7863
8263
 
8264
+
8265
+
7864
8266
  <xsl:apply-templates/>
7865
8267
  </fo:block>
7866
8268
 
@@ -7923,14 +8325,6 @@
7923
8325
  <fo:block>
7924
8326
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
7925
8327
  </fo:block>
7926
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
7927
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
7928
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
7929
- </fo:block>
7930
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
7931
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
7932
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
7933
- </fo:block>
7934
8328
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
7935
8329
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
7936
8330
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -7947,6 +8341,38 @@
7947
8341
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
7948
8342
  <xsl:apply-templates/>
7949
8343
  </fo:block>
8344
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
8345
+ <fo:block xsl:use-attribute-sets="subject-style">
8346
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
8347
+ </fo:block>
8348
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
8349
+ <fo:block xsl:use-attribute-sets="subject-style">
8350
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
8351
+ </fo:block>
8352
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
8353
+ <fo:block xsl:use-attribute-sets="inherit-style">
8354
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
8355
+ </fo:block>
8356
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
8357
+ <fo:block xsl:use-attribute-sets="description-style">
8358
+ <xsl:apply-templates/>
8359
+ </fo:block>
8360
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
8361
+ <fo:block xsl:use-attribute-sets="specification-style">
8362
+ <xsl:apply-templates/>
8363
+ </fo:block>
8364
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
8365
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
8366
+ <xsl:apply-templates/>
8367
+ </fo:block>
8368
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
8369
+ <fo:block xsl:use-attribute-sets="verification-style">
8370
+ <xsl:apply-templates/>
8371
+ </fo:block>
8372
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
8373
+ <fo:block xsl:use-attribute-sets="import-style">
8374
+ <xsl:apply-templates/>
8375
+ </fo:block>
7950
8376
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
7951
8377
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
7952
8378
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -8212,20 +8638,22 @@
8212
8638
  </xsl:if>
8213
8639
  </xsl:template><xsl:variable name="localized.source">
8214
8640
  <xsl:call-template name="getLocalizedString">
8215
- <xsl:with-param name="key">source</xsl:with-param>
8216
- </xsl:call-template>
8641
+ <xsl:with-param name="key">source</xsl:with-param>
8642
+ </xsl:call-template>
8217
8643
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
8218
8644
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8219
8645
  <xsl:if test="normalize-space(@citeas) = ''">
8220
8646
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8221
8647
  </xsl:if>
8222
8648
 
8649
+
8223
8650
  <fo:inline>
8224
8651
 
8225
8652
 
8226
8653
 
8227
8654
 
8228
8655
 
8656
+
8229
8657
  <xsl:value-of select="$localized.source"/>
8230
8658
  <xsl:text> </xsl:text>
8231
8659
 
@@ -8236,6 +8664,7 @@
8236
8664
  <fo:inline xsl:use-attribute-sets="origin-style">
8237
8665
  <xsl:apply-templates/>
8238
8666
  </fo:inline>
8667
+
8239
8668
  </fo:basic-link>
8240
8669
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
8241
8670
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -8302,6 +8731,9 @@
8302
8731
 
8303
8732
  </xsl:if>
8304
8733
 
8734
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8735
+ <xsl:variable name="text" select="normalize-space()"/>
8736
+
8305
8737
 
8306
8738
 
8307
8739
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -8323,7 +8755,9 @@
8323
8755
 
8324
8756
 
8325
8757
  </xsl:if>
8326
-
8758
+
8759
+
8760
+
8327
8761
  <xsl:apply-templates/>
8328
8762
  </fo:basic-link>
8329
8763
 
@@ -8660,6 +9094,7 @@
8660
9094
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
8661
9095
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
8662
9096
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
9097
+
8663
9098
  <xsl:apply-templates/>
8664
9099
  </fo:block>
8665
9100
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -8857,6 +9292,97 @@
8857
9292
  <fo:block-container border="1pt solid black" width="50%">
8858
9293
  <fo:block> </fo:block>
8859
9294
  </fo:block-container>
9295
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
9296
+ <xsl:param name="colwidths"/>
9297
+ <xsl:variable name="colwidths_">
9298
+ <xsl:choose>
9299
+ <xsl:when test="not($colwidths)">
9300
+ <xsl:variable name="toc_table_simple">
9301
+ <tbody>
9302
+ <xsl:apply-templates mode="toc_table_width"/>
9303
+ </tbody>
9304
+ </xsl:variable>
9305
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
9306
+ <xsl:call-template name="calculate-column-widths">
9307
+ <xsl:with-param name="cols-count" select="$cols-count"/>
9308
+ <xsl:with-param name="table" select="$toc_table_simple"/>
9309
+ </xsl:call-template>
9310
+ </xsl:when>
9311
+ <xsl:otherwise>
9312
+ <xsl:copy-of select="$colwidths"/>
9313
+ </xsl:otherwise>
9314
+ </xsl:choose>
9315
+ </xsl:variable>
9316
+ <fo:block role="TOCI" space-after="16pt">
9317
+ <fo:table width="100%" table-layout="fixed">
9318
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
9319
+ <fo:table-column column-width="proportional-column-width({.})"/>
9320
+ </xsl:for-each>
9321
+ <fo:table-body>
9322
+ <xsl:apply-templates/>
9323
+ </fo:table-body>
9324
+ </fo:table>
9325
+ </fo:block>
9326
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
9327
+ <fo:table-row min-height="5mm">
9328
+ <xsl:apply-templates/>
9329
+ </fo:table-row>
9330
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
9331
+ <xsl:apply-templates/>
9332
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
9333
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9334
+ <xsl:variable name="target" select="@target"/>
9335
+ <xsl:for-each select="*[local-name() = 'tab']">
9336
+ <xsl:variable name="current_id" select="generate-id()"/>
9337
+ <fo:table-cell>
9338
+ <fo:block>
9339
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9340
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9341
+ <xsl:choose>
9342
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9343
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9344
+ </xsl:choose>
9345
+ </xsl:for-each>
9346
+ </fo:basic-link>
9347
+ </fo:block>
9348
+ </fo:table-cell>
9349
+ </xsl:for-each>
9350
+ <!-- last column - for page numbers -->
9351
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9352
+ <fo:block>
9353
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9354
+ <fo:page-number-citation ref-id="{$target}"/>
9355
+ </fo:basic-link>
9356
+ </fo:block>
9357
+ </fo:table-cell>
9358
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
9359
+ <xsl:apply-templates mode="toc_table_width"/>
9360
+ </xsl:template><xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'clause'][not(@type = 'toc')]/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'li']" mode="toc_table_width">
9361
+ <tr>
9362
+ <xsl:apply-templates mode="toc_table_width"/>
9363
+ </tr>
9364
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
9365
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9366
+ <xsl:for-each select="*[local-name() = 'tab']">
9367
+ <xsl:variable name="current_id" select="generate-id()"/>
9368
+ <td>
9369
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9370
+ <xsl:copy-of select="."/>
9371
+ </xsl:for-each>
9372
+ </td>
9373
+ </xsl:for-each>
9374
+ <td>333</td> <!-- page number, just for fill -->
9375
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9376
+ <fo:inline padding-right="5mm"> </fo:inline>
9377
+ <fo:inline><xsl:apply-templates/></fo:inline>
9378
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
9379
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
9380
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
9381
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
9382
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
9383
+ </svg>
9384
+ </fo:instream-foreign-object>
9385
+ </fo:inline>
8860
9386
  </xsl:template><xsl:template name="convertDate">
8861
9387
  <xsl:param name="date"/>
8862
9388
  <xsl:param name="format" select="'short'"/>
@@ -8976,7 +9502,7 @@
8976
9502
  <xsl:variable name="lang">
8977
9503
  <xsl:call-template name="getLang"/>
8978
9504
  </xsl:variable>
8979
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
9505
+ <pdf:catalog>
8980
9506
  <pdf:dictionary type="normal" key="ViewerPreferences">
8981
9507
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
8982
9508
  </pdf:dictionary>
@@ -9095,6 +9621,26 @@
9095
9621
  <xsl:value-of select="$level"/>
9096
9622
  </xsl:otherwise>
9097
9623
  </xsl:choose>
9624
+ </xsl:template><xsl:template name="getLevelTermName">
9625
+ <xsl:choose>
9626
+ <xsl:when test="normalize-space(../@depth) != ''">
9627
+ <xsl:value-of select="../@depth"/>
9628
+ </xsl:when>
9629
+ <xsl:otherwise>
9630
+ <xsl:variable name="title_level_">
9631
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
9632
+ <xsl:call-template name="getLevel"/>
9633
+ </xsl:for-each>
9634
+ </xsl:variable>
9635
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
9636
+ <xsl:choose>
9637
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
9638
+ <xsl:otherwise>
9639
+ <xsl:call-template name="getLevel"/>
9640
+ </xsl:otherwise>
9641
+ </xsl:choose>
9642
+ </xsl:otherwise>
9643
+ </xsl:choose>
9098
9644
  </xsl:template><xsl:template name="split">
9099
9645
  <xsl:param name="pText" select="."/>
9100
9646
  <xsl:param name="sep" select="','"/>