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.
@@ -10,6 +10,8 @@
10
10
  <!-- param for second pass -->
11
11
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
12
12
 
13
+ <xsl:param name="align-cross-elements"/>
14
+
13
15
 
14
16
 
15
17
  <xsl:key name="kfn" match="*[local-name()='p']/*[local-name()='fn']" use="@reference"/>
@@ -17,7 +19,14 @@
17
19
 
18
20
 
19
21
  <xsl:variable name="align_cross_elements_default">clause</xsl:variable>
20
- <xsl:variable name="align_cross_elements_doc" select="normalize-space((//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:ext/jcgm:parallel-align-element)"/>
22
+ <xsl:variable name="align_cross_elements_doc">
23
+ <xsl:choose>
24
+ <xsl:when test="normalize-space($align-cross-elements) != ''"><xsl:value-of select="$align-cross-elements"/></xsl:when>
25
+ <xsl:otherwise>
26
+ <xsl:value-of select="normalize-space((//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:ext/jcgm:parallel-align-element)"/>
27
+ </xsl:otherwise>
28
+ </xsl:choose>
29
+ </xsl:variable>
21
30
  <xsl:variable name="align_cross_elements_">
22
31
  <xsl:choose>
23
32
  <xsl:when test="$align_cross_elements_doc != ''">
@@ -244,7 +253,7 @@
244
253
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'provenance']"/>
245
254
  </fo:block>
246
255
  <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%">
256
+ <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
257
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
249
258
  <xsl:variable name="title_part">
250
259
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
@@ -254,7 +263,7 @@
254
263
  <xsl:copy-of select="$title_part"/>
255
264
  </xsl:if>
256
265
  </fo:block>
257
- <fo:block font-size="12pt" font-style="italic" line-height="140%">
266
+ <fo:block font-size="12pt" font-style="italic" line-height="140%" role="H1">
258
267
  <xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
259
268
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
260
269
  <xsl:variable name="title_part">
@@ -293,7 +302,7 @@
293
302
  </fo:table-row>
294
303
  </fo:table-body>
295
304
  </fo:table>
296
- <fo:block font-size="18pt" space-before="70mm">
305
+ <fo:block font-size="18pt" space-before="70mm" role="H1">
297
306
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
298
307
  <xsl:variable name="title_part">
299
308
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
@@ -303,7 +312,7 @@
303
312
  <xsl:copy-of select="$title_part"/>
304
313
  </xsl:if>
305
314
  </fo:block>
306
- <fo:block font-size="13pt" space-before="35mm">
315
+ <fo:block font-size="13pt" space-before="35mm" role="H1">
307
316
  <xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
308
317
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
309
318
  <xsl:variable name="title_part">
@@ -346,41 +355,43 @@
346
355
 
347
356
  <!-- Table of Contents -->
348
357
  <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"/>
358
+ <fo:block role="TOC">
359
+ <fo:block text-align-last="justify">
360
+ <fo:inline font-size="15pt" font-weight="bold" role="H1">
361
+ <xsl:call-template name="getLocalizedString">
362
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
363
+ </xsl:call-template>
364
+ </fo:inline>
365
+ <fo:inline keep-together.within-line="always">
366
+ <fo:leader leader-pattern="space"/>
367
+ <xsl:call-template name="getLocalizedString">
368
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
369
+ </xsl:call-template>
370
+ </fo:inline>
371
+ </fo:block>
372
+
373
+ <xsl:if test="$debug = 'true'">
374
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
375
+ DEBUG
376
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
377
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
378
+ </xsl:if>
379
+
380
+ <xsl:variable name="annexes_title">
357
381
  <xsl:call-template name="getLocalizedString">
358
- <xsl:with-param name="key">Page.sg</xsl:with-param>
382
+ <xsl:with-param name="key">Annex.pl</xsl:with-param>
359
383
  </xsl:call-template>
360
- </fo:inline>
384
+ </xsl:variable>
385
+
386
+ <xsl:for-each select="xalan:nodeset($contents)/doc[@id=$docid]//item[@display = 'true']"> <!-- and not (@type = 'annex') and not (@type = 'references') -->
387
+ <xsl:if test="@type = 'annex' and not(preceding-sibling::item[@display = 'true' and @type = 'annex'])">
388
+ <fo:block font-size="12pt" space-before="16pt" font-weight="bold" role="TOCI">
389
+ <xsl:value-of select="$annexes_title"/>
390
+ </fo:block>
391
+ </xsl:if>
392
+ <xsl:call-template name="print_JCGN_toc_item"/>
393
+ </xsl:for-each>
361
394
  </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
395
  </fo:block-container>
385
396
 
386
397
  </xsl:for-each>
@@ -445,7 +456,7 @@
445
456
  <xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $curr_lang and @type = 'part']" mode="title"/>
446
457
  </xsl:variable>
447
458
 
448
- <fo:block>
459
+ <fo:block role="H1">
449
460
  <xsl:copy-of select="$title-main"/>
450
461
  <xsl:if test="normalize-space($title-main) != '' and normalize-space($title-part) != ''">
451
462
  <xsl:text> — </xsl:text>
@@ -910,8 +921,11 @@
910
921
  <xsl:call-template name="note"/>
911
922
  </xsl:template>
912
923
 
913
- <xsl:template match="*[local-name()='preferred']">
914
- <fo:block line-height="1.1">
924
+ <xsl:template match="*[local-name()='preferred']">
925
+ <xsl:variable name="level">
926
+ <xsl:call-template name="getLevel"/>
927
+ </xsl:variable>
928
+ <fo:block line-height="1.1" role="H{$level}">
915
929
  <fo:block font-weight="bold" keep-with-next="always">
916
930
  <xsl:apply-templates select="ancestor::*[local-name()='term']/*[local-name()='name']" mode="presentation"/>
917
931
  </fo:block>
@@ -922,7 +936,10 @@
922
936
  </xsl:template>
923
937
 
924
938
  <xsl:template match="*[local-name()='preferred'][not(parent::*[local-name()='term'])]">
925
- <fo:block line-height="1.1">
939
+ <xsl:variable name="levelTerm">
940
+ <xsl:call-template name="getLevelTermName"/>
941
+ </xsl:variable>
942
+ <fo:block line-height="1.1" role="H{$levelTerm}">
926
943
  <fo:block font-weight="bold" keep-with-next="always">
927
944
  <xsl:apply-templates select="preceding-sibling::*[local-name()='term_name'][1]" mode="presentation"/>
928
945
  </fo:block>
@@ -1251,14 +1268,14 @@
1251
1268
  </xsl:variable>
1252
1269
 
1253
1270
  <xsl:template name="insertHeaderFooter">
1254
- <fo:static-content flow-name="header-even-jcgm">
1271
+ <fo:static-content flow-name="header-even-jcgm" role="artifact">
1255
1272
  <fo:block-container height="98%">
1256
1273
  <fo:block font-size="13pt" font-weight="bold" padding-top="12mm">
1257
1274
  <xsl:value-of select="$header_text"/>
1258
1275
  </fo:block>
1259
1276
  </fo:block-container>
1260
1277
  </fo:static-content>
1261
- <fo:static-content flow-name="footer-even-jcgm">
1278
+ <fo:static-content flow-name="footer-even-jcgm" role="artifact">
1262
1279
  <fo:block-container height="98%">
1263
1280
  <fo:block text-align-last="justify">
1264
1281
  <fo:inline font-size="12pt" font-weight="bold"><fo:page-number/></fo:inline>
@@ -1269,14 +1286,14 @@
1269
1286
  </fo:block>
1270
1287
  </fo:block-container>
1271
1288
  </fo:static-content>
1272
- <fo:static-content flow-name="header-odd-jcgm">
1289
+ <fo:static-content flow-name="header-odd-jcgm" role="artifact">
1273
1290
  <fo:block-container height="98%">
1274
1291
  <fo:block font-size="13pt" font-weight="bold" text-align="right" padding-top="12mm">
1275
1292
  <xsl:value-of select="$header_text"/>
1276
1293
  </fo:block>
1277
1294
  </fo:block-container>
1278
1295
  </fo:static-content>
1279
- <fo:static-content flow-name="footer-odd-jcgm">
1296
+ <fo:static-content flow-name="footer-odd-jcgm" role="artifact">
1280
1297
  <fo:block-container height="98%">
1281
1298
  <fo:block text-align-last="justify">
1282
1299
  <fo:inline font-size="10pt"><xsl:value-of select="$copyrightText"/></fo:inline>
@@ -1350,7 +1367,9 @@
1350
1367
  <xsl:attribute name="text-align">center</xsl:attribute>
1351
1368
  <xsl:attribute name="line-height">130%</xsl:attribute>
1352
1369
  </xsl:if>
1370
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
1353
1371
  <xsl:apply-templates/>
1372
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
1354
1373
  </xsl:element>
1355
1374
 
1356
1375
  <xsl:if test="$element-name = 'fo:inline' and not(following-sibling::jcgm:p)">
@@ -1433,7 +1452,7 @@
1433
1452
  <fo:block id="{@id}" span="all">
1434
1453
  <xsl:apply-templates select="jcgm:title"/>
1435
1454
  </fo:block>
1436
- <fo:block>
1455
+ <fo:block role="Index">
1437
1456
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
1438
1457
  </fo:block>
1439
1458
  </fo:flow>
@@ -1442,7 +1461,7 @@
1442
1461
 
1443
1462
  <!-- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:title" priority="4"> -->
1444
1463
  <xsl:template match="jcgm:indexsect/jcgm:title" priority="4">
1445
- <fo:block font-weight="bold" span="all">
1464
+ <fo:block font-weight="bold" span="all" role="H1">
1446
1465
  <!-- Index -->
1447
1466
  <xsl:apply-templates/>
1448
1467
  </fo:block>
@@ -2177,6 +2196,7 @@
2177
2196
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2178
2197
  <xsl:attribute name="white-space">pre</xsl:attribute>
2179
2198
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
2199
+ <xsl:attribute name="role">Code</xsl:attribute>
2180
2200
 
2181
2201
  <xsl:attribute name="font-family">Courier New</xsl:attribute>
2182
2202
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2201,8 +2221,13 @@
2201
2221
 
2202
2222
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
2203
2223
 
2204
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
2205
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
2224
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
2225
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
2226
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
2227
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
2228
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
2229
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
2230
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
2206
2231
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
2207
2232
 
2208
2233
 
@@ -2390,6 +2415,11 @@
2390
2415
 
2391
2416
 
2392
2417
 
2418
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
2419
+
2420
+
2421
+
2422
+
2393
2423
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
2394
2424
 
2395
2425
 
@@ -2425,7 +2455,8 @@
2425
2455
 
2426
2456
 
2427
2457
 
2428
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
2458
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
2459
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
2429
2460
 
2430
2461
 
2431
2462
 
@@ -2564,13 +2595,20 @@
2564
2595
 
2565
2596
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2566
2597
 
2567
- </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">
2598
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
2599
+ <xsl:attribute name="line-height">135%</xsl:attribute>
2600
+ </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">
2568
2601
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2569
2602
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2570
2603
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
2571
2604
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
2572
2605
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
2573
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2606
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
2607
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2608
+ <xsl:sort select="@displayorder" data-type="number"/>
2609
+ <xsl:apply-templates select="." mode="contents"/>
2610
+ </xsl:for-each>
2611
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
2574
2612
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
2575
2613
 
2576
2614
  <!-- Normative references -->
@@ -2583,13 +2621,33 @@
2583
2621
  <!-- Bibliography -->
2584
2622
  <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"/>
2585
2623
 
2586
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2624
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2625
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2626
+ <xsl:sort select="@displayorder" data-type="number"/>
2627
+ <xsl:apply-templates select="." mode="contents"/>
2628
+ </xsl:for-each>
2629
+
2630
+ <xsl:for-each select="/*/*[local-name()='annex']">
2631
+ <xsl:sort select="@displayorder" data-type="number"/>
2632
+ <xsl:apply-templates select="." mode="contents"/>
2633
+ </xsl:for-each>
2634
+
2635
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2636
+ <xsl:sort select="@displayorder" data-type="number"/>
2637
+ <xsl:apply-templates select="." mode="contents"/>
2638
+ </xsl:for-each>
2639
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
2587
2640
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
2588
2641
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
2589
2642
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
2590
2643
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
2591
2644
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
2592
- </xsl:template><xsl:template name="processMainSectionsDefault">
2645
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2646
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2647
+ <xsl:sort select="@displayorder" data-type="number"/>
2648
+ <xsl:apply-templates select="."/>
2649
+ </xsl:for-each>
2650
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
2593
2651
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
2594
2652
 
2595
2653
  <!-- Normative references -->
@@ -2601,6 +2659,22 @@
2601
2659
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
2602
2660
  <!-- Bibliography -->
2603
2661
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
2662
+ </xsl:template><xsl:template name="processMainSectionsDefault">
2663
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2664
+ <xsl:sort select="@displayorder" data-type="number"/>
2665
+ <xsl:apply-templates select="."/>
2666
+
2667
+ </xsl:for-each>
2668
+
2669
+ <xsl:for-each select="/*/*[local-name()='annex']">
2670
+ <xsl:sort select="@displayorder" data-type="number"/>
2671
+ <xsl:apply-templates select="."/>
2672
+ </xsl:for-each>
2673
+
2674
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2675
+ <xsl:sort select="@displayorder" data-type="number"/>
2676
+ <xsl:apply-templates select="."/>
2677
+ </xsl:for-each>
2604
2678
  </xsl:template><xsl:template match="text()">
2605
2679
  <xsl:value-of select="."/>
2606
2680
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -2629,7 +2703,9 @@
2629
2703
  <!-- Display table's name before table as standalone block -->
2630
2704
  <!-- $namespace = 'iso' or -->
2631
2705
 
2632
-
2706
+
2707
+
2708
+
2633
2709
 
2634
2710
 
2635
2711
 
@@ -3544,9 +3620,8 @@
3544
3620
 
3545
3621
  <!-- Table's note name (NOTE, for example) -->
3546
3622
 
3547
- <fo:inline padding-right="2mm">
3623
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
3548
3624
 
3549
-
3550
3625
 
3551
3626
 
3552
3627
 
@@ -4181,6 +4256,8 @@
4181
4256
  <xsl:if test="$font-size != ''">
4182
4257
  <xsl:attribute name="font-size">
4183
4258
  <xsl:choose>
4259
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4260
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4184
4261
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4185
4262
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4186
4263
  </xsl:choose>
@@ -4615,16 +4692,68 @@
4615
4692
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4616
4693
  </xsl:call-template>
4617
4694
 
4695
+
4696
+
4618
4697
  <xsl:variable name="mathml">
4619
4698
  <xsl:apply-templates select="." mode="mathml"/>
4620
4699
  </xsl:variable>
4621
4700
  <fo:instream-foreign-object fox:alt-text="Math">
4622
4701
 
4623
4702
 
4703
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4704
+ <xsl:variable name="comment_text_">
4705
+ <xsl:choose>
4706
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4707
+ <xsl:value-of select="$comment_text_following"/>
4708
+ </xsl:when>
4709
+ <xsl:otherwise>
4710
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4711
+ </xsl:otherwise>
4712
+ </xsl:choose>
4713
+ </xsl:variable>
4714
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4715
+
4716
+ <xsl:if test="normalize-space($comment_text) != ''">
4717
+ <!-- put Mathin Alternate Text -->
4718
+ <xsl:attribute name="fox:alt-text">
4719
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4720
+ </xsl:attribute>
4721
+ </xsl:if>
4722
+
4723
+ <xsl:variable name="mathml_content">
4724
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4725
+ </xsl:variable>
4726
+ <!-- put MathML in Actual Text -->
4727
+ <xsl:attribute name="fox:actual-text">
4728
+ <xsl:value-of select="$mathml_content"/>
4729
+ </xsl:attribute>
4730
+
4731
+
4624
4732
  <!-- <xsl:copy-of select="."/> -->
4625
4733
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4626
4734
  </fo:instream-foreign-object>
4627
4735
  </fo:inline>
4736
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4737
+ <!-- <xsl:text>a+b</xsl:text> -->
4738
+ <xsl:text>&lt;</xsl:text>
4739
+ <xsl:value-of select="local-name()"/>
4740
+ <xsl:if test="local-name() = 'math'">
4741
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
4742
+ </xsl:if>
4743
+ <xsl:for-each select="@*">
4744
+ <xsl:text> </xsl:text>
4745
+ <xsl:value-of select="local-name()"/>
4746
+ <xsl:text>="</xsl:text>
4747
+ <xsl:value-of select="."/>
4748
+ <xsl:text>"</xsl:text>
4749
+ </xsl:for-each>
4750
+ <xsl:text>&gt;</xsl:text>
4751
+ <xsl:apply-templates mode="mathml_actual_text"/>
4752
+ <xsl:text>&lt;/</xsl:text>
4753
+ <xsl:value-of select="local-name()"/>
4754
+ <xsl:text>&gt;</xsl:text>
4755
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
4756
+ <xsl:value-of select="normalize-space()"/>
4628
4757
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
4629
4758
  <xsl:copy>
4630
4759
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -4686,7 +4815,10 @@
4686
4815
  </fo:block>
4687
4816
  <xsl:apply-templates/>
4688
4817
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4689
- <fo:inline><xsl:apply-templates/></fo:inline>
4818
+ <xsl:variable name="level">
4819
+ <xsl:call-template name="getLevel"/>
4820
+ </xsl:variable>
4821
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4690
4822
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4691
4823
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4692
4824
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4721,9 +4853,10 @@
4721
4853
 
4722
4854
  </xsl:variable>
4723
4855
 
4856
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4724
4857
  <xsl:choose>
4725
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4726
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4858
+ <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>
4859
+ <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>
4727
4860
  </xsl:choose>
4728
4861
  <xsl:apply-templates/>
4729
4862
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -4869,7 +5002,10 @@
4869
5002
  </fo:block>
4870
5003
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
4871
5004
  <xsl:if test="normalize-space() != ''">
4872
- <fo:inline>
5005
+ <xsl:variable name="level">
5006
+ <xsl:call-template name="getLevelTermName"/>
5007
+ </xsl:variable>
5008
+ <fo:inline role="H{$level}">
4873
5009
  <xsl:apply-templates/>
4874
5010
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
4875
5011
  <xsl:text>.</xsl:text>
@@ -5170,6 +5306,13 @@
5170
5306
  </xsl:attribute>
5171
5307
  <xsl:apply-templates mode="svg_update"/>
5172
5308
  </xsl:copy>
5309
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
5310
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
5311
+ <xsl:for-each select="*[local-name() = 'svg']">
5312
+ <xsl:call-template name="image_svg">
5313
+ <xsl:with-param name="name" select="$name"/>
5314
+ </xsl:call-template>
5315
+ </xsl:for-each>
5173
5316
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5174
5317
  <xsl:variable name="svg_content" select="document(@src)"/>
5175
5318
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5274,7 +5417,7 @@
5274
5417
  </fo:basic-link>
5275
5418
  </fo:block>
5276
5419
  </fo:block-container>
5277
- </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">
5420
+ </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">
5278
5421
  <xsl:apply-templates mode="contents"/>
5279
5422
  <xsl:text> </xsl:text>
5280
5423
  </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">
@@ -5500,6 +5643,7 @@
5500
5643
  </xsl:when>
5501
5644
  <xsl:otherwise>
5502
5645
  <xsl:apply-templates/>
5646
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
5503
5647
  </xsl:otherwise>
5504
5648
  </xsl:choose>
5505
5649
  </fo:block>
@@ -5572,12 +5716,16 @@
5572
5716
  <xsl:if test="$font-size != ''">
5573
5717
  <xsl:attribute name="font-size">
5574
5718
  <xsl:choose>
5719
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
5720
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
5575
5721
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
5576
5722
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
5577
5723
  </xsl:choose>
5578
5724
  </xsl:attribute>
5579
5725
  </xsl:if>
5580
5726
 
5727
+
5728
+
5581
5729
  <xsl:apply-templates/>
5582
5730
  </fo:block>
5583
5731
 
@@ -5640,14 +5788,6 @@
5640
5788
  <fo:block>
5641
5789
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
5642
5790
  </fo:block>
5643
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5644
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
5645
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5646
- </fo:block>
5647
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
5648
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
5649
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5650
- </fo:block>
5651
5791
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
5652
5792
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
5653
5793
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -5664,6 +5804,38 @@
5664
5804
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
5665
5805
  <xsl:apply-templates/>
5666
5806
  </fo:block>
5807
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5808
+ <fo:block xsl:use-attribute-sets="subject-style">
5809
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5810
+ </fo:block>
5811
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
5812
+ <fo:block xsl:use-attribute-sets="subject-style">
5813
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5814
+ </fo:block>
5815
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
5816
+ <fo:block xsl:use-attribute-sets="inherit-style">
5817
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5818
+ </fo:block>
5819
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
5820
+ <fo:block xsl:use-attribute-sets="description-style">
5821
+ <xsl:apply-templates/>
5822
+ </fo:block>
5823
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
5824
+ <fo:block xsl:use-attribute-sets="specification-style">
5825
+ <xsl:apply-templates/>
5826
+ </fo:block>
5827
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
5828
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
5829
+ <xsl:apply-templates/>
5830
+ </fo:block>
5831
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
5832
+ <fo:block xsl:use-attribute-sets="verification-style">
5833
+ <xsl:apply-templates/>
5834
+ </fo:block>
5835
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
5836
+ <fo:block xsl:use-attribute-sets="import-style">
5837
+ <xsl:apply-templates/>
5838
+ </fo:block>
5667
5839
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
5668
5840
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
5669
5841
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -5934,20 +6106,22 @@
5934
6106
  </xsl:if>
5935
6107
  </xsl:template><xsl:variable name="localized.source">
5936
6108
  <xsl:call-template name="getLocalizedString">
5937
- <xsl:with-param name="key">source</xsl:with-param>
5938
- </xsl:call-template>
6109
+ <xsl:with-param name="key">source</xsl:with-param>
6110
+ </xsl:call-template>
5939
6111
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5940
6112
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5941
6113
  <xsl:if test="normalize-space(@citeas) = ''">
5942
6114
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5943
6115
  </xsl:if>
5944
6116
 
6117
+
5945
6118
  <fo:inline>
5946
6119
 
5947
6120
 
5948
6121
 
5949
6122
 
5950
6123
 
6124
+
5951
6125
  <xsl:value-of select="$localized.source"/>
5952
6126
  <xsl:text> </xsl:text>
5953
6127
 
@@ -5958,6 +6132,7 @@
5958
6132
  <fo:inline xsl:use-attribute-sets="origin-style">
5959
6133
  <xsl:apply-templates/>
5960
6134
  </fo:inline>
6135
+
5961
6136
  </fo:basic-link>
5962
6137
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5963
6138
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -6034,6 +6209,9 @@
6034
6209
 
6035
6210
  </xsl:if>
6036
6211
 
6212
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
6213
+ <xsl:variable name="text" select="normalize-space()"/>
6214
+
6037
6215
 
6038
6216
 
6039
6217
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -6046,7 +6224,9 @@
6046
6224
 
6047
6225
 
6048
6226
  </xsl:if>
6049
-
6227
+
6228
+
6229
+
6050
6230
  <xsl:apply-templates/>
6051
6231
  </fo:basic-link>
6052
6232
 
@@ -6388,6 +6568,7 @@
6388
6568
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6389
6569
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6390
6570
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6571
+
6391
6572
  <xsl:apply-templates/>
6392
6573
  </fo:block>
6393
6574
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -6556,6 +6737,97 @@
6556
6737
  <fo:block-container border="1pt solid black" width="50%">
6557
6738
  <fo:block> </fo:block>
6558
6739
  </fo:block-container>
6740
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
6741
+ <xsl:param name="colwidths"/>
6742
+ <xsl:variable name="colwidths_">
6743
+ <xsl:choose>
6744
+ <xsl:when test="not($colwidths)">
6745
+ <xsl:variable name="toc_table_simple">
6746
+ <tbody>
6747
+ <xsl:apply-templates mode="toc_table_width"/>
6748
+ </tbody>
6749
+ </xsl:variable>
6750
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
6751
+ <xsl:call-template name="calculate-column-widths">
6752
+ <xsl:with-param name="cols-count" select="$cols-count"/>
6753
+ <xsl:with-param name="table" select="$toc_table_simple"/>
6754
+ </xsl:call-template>
6755
+ </xsl:when>
6756
+ <xsl:otherwise>
6757
+ <xsl:copy-of select="$colwidths"/>
6758
+ </xsl:otherwise>
6759
+ </xsl:choose>
6760
+ </xsl:variable>
6761
+ <fo:block role="TOCI" space-after="16pt">
6762
+ <fo:table width="100%" table-layout="fixed">
6763
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
6764
+ <fo:table-column column-width="proportional-column-width({.})"/>
6765
+ </xsl:for-each>
6766
+ <fo:table-body>
6767
+ <xsl:apply-templates/>
6768
+ </fo:table-body>
6769
+ </fo:table>
6770
+ </fo:block>
6771
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
6772
+ <fo:table-row min-height="5mm">
6773
+ <xsl:apply-templates/>
6774
+ </fo:table-row>
6775
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
6776
+ <xsl:apply-templates/>
6777
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
6778
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
6779
+ <xsl:variable name="target" select="@target"/>
6780
+ <xsl:for-each select="*[local-name() = 'tab']">
6781
+ <xsl:variable name="current_id" select="generate-id()"/>
6782
+ <fo:table-cell>
6783
+ <fo:block>
6784
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
6785
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
6786
+ <xsl:choose>
6787
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6788
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
6789
+ </xsl:choose>
6790
+ </xsl:for-each>
6791
+ </fo:basic-link>
6792
+ </fo:block>
6793
+ </fo:table-cell>
6794
+ </xsl:for-each>
6795
+ <!-- last column - for page numbers -->
6796
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
6797
+ <fo:block>
6798
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
6799
+ <fo:page-number-citation ref-id="{$target}"/>
6800
+ </fo:basic-link>
6801
+ </fo:block>
6802
+ </fo:table-cell>
6803
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
6804
+ <xsl:apply-templates mode="toc_table_width"/>
6805
+ </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">
6806
+ <tr>
6807
+ <xsl:apply-templates mode="toc_table_width"/>
6808
+ </tr>
6809
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
6810
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
6811
+ <xsl:for-each select="*[local-name() = 'tab']">
6812
+ <xsl:variable name="current_id" select="generate-id()"/>
6813
+ <td>
6814
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
6815
+ <xsl:copy-of select="."/>
6816
+ </xsl:for-each>
6817
+ </td>
6818
+ </xsl:for-each>
6819
+ <td>333</td> <!-- page number, just for fill -->
6820
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6821
+ <fo:inline padding-right="5mm"> </fo:inline>
6822
+ <fo:inline><xsl:apply-templates/></fo:inline>
6823
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
6824
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
6825
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
6826
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
6827
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
6828
+ </svg>
6829
+ </fo:instream-foreign-object>
6830
+ </fo:inline>
6559
6831
  </xsl:template><xsl:template name="convertDate">
6560
6832
  <xsl:param name="date"/>
6561
6833
  <xsl:param name="format" select="'short'"/>
@@ -6791,6 +7063,26 @@
6791
7063
  <xsl:value-of select="$level"/>
6792
7064
  </xsl:otherwise>
6793
7065
  </xsl:choose>
7066
+ </xsl:template><xsl:template name="getLevelTermName">
7067
+ <xsl:choose>
7068
+ <xsl:when test="normalize-space(../@depth) != ''">
7069
+ <xsl:value-of select="../@depth"/>
7070
+ </xsl:when>
7071
+ <xsl:otherwise>
7072
+ <xsl:variable name="title_level_">
7073
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
7074
+ <xsl:call-template name="getLevel"/>
7075
+ </xsl:for-each>
7076
+ </xsl:variable>
7077
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
7078
+ <xsl:choose>
7079
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
7080
+ <xsl:otherwise>
7081
+ <xsl:call-template name="getLevel"/>
7082
+ </xsl:otherwise>
7083
+ </xsl:choose>
7084
+ </xsl:otherwise>
7085
+ </xsl:choose>
6794
7086
  </xsl:template><xsl:template name="split">
6795
7087
  <xsl:param name="pText" select="."/>
6796
7088
  <xsl:param name="sep" select="','"/>