metanorma-csa 1.9.1 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,8 @@
6
6
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
+
10
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
9
11
 
10
12
  <xsl:variable name="pageWidth" select="215.9"/>
11
13
  <xsl:variable name="pageHeight" select="279.4"/>
@@ -214,7 +216,7 @@
214
216
  <fo:list-block>
215
217
  <xsl:attribute name="provisional-distance-between-starts">
216
218
  <xsl:choose>
217
- <xsl:when test="@level = 2">10mm</xsl:when>
219
+ <xsl:when test="@level &gt;= 2"><xsl:value-of select="(@level - 1) * 10"/>mm</xsl:when>
218
220
  <xsl:otherwise>3mm</xsl:otherwise>
219
221
  </xsl:choose>
220
222
  </xsl:attribute>
@@ -278,7 +280,7 @@
278
280
 
279
281
  <xsl:variable name="display">
280
282
  <xsl:choose>
281
- <xsl:when test="$level &gt;= 3">false</xsl:when>
283
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
282
284
  <xsl:otherwise>true</xsl:otherwise>
283
285
  </xsl:choose>
284
286
  </xsl:variable>
@@ -417,7 +419,7 @@
417
419
  </fo:block>
418
420
  </xsl:template>
419
421
 
420
- <xsl:template match="csa:title">
422
+ <xsl:template match="csa:title" name="title">
421
423
 
422
424
  <xsl:variable name="level">
423
425
  <xsl:call-template name="getLevel"/>
@@ -525,32 +527,6 @@
525
527
  </xsl:if>
526
528
  </xsl:template>
527
529
 
528
- <!--
529
- <fn reference="1">
530
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
531
- </fn>
532
- -->
533
- <xsl:template match="csa:title/csa:fn | csa:p/csa:fn[not(ancestor::csa:table)]" priority="2">
534
- <fo:footnote keep-with-previous.within-line="always">
535
- <xsl:variable name="number" select="@reference"/>
536
-
537
- <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
538
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
539
- <xsl:value-of select="$number"/><!-- + count(//csa:bibitem/csa:note) -->
540
- </fo:basic-link>
541
- </fo:inline>
542
- <fo:footnote-body>
543
- <fo:block font-family="Azo Sans Lt" font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="rgb(168, 170, 173)" text-align="left">
544
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super">
545
- <xsl:value-of select="$number "/><!-- + count(//csa:bibitem/csa:note) -->
546
- </fo:inline>
547
- <xsl:for-each select="csa:p">
548
- <xsl:apply-templates/>
549
- </xsl:for-each>
550
- </fo:block>
551
- </fo:footnote-body>
552
- </fo:footnote>
553
- </xsl:template>
554
530
 
555
531
  <xsl:template match="csa:fn/csa:p">
556
532
  <fo:block>
@@ -675,8 +651,11 @@
675
651
  <fo:list-item-label end-indent="label-end()">
676
652
  <fo:block>
677
653
  <xsl:choose>
678
- <xsl:when test="local-name(..) = 'ul' and (../ancestor::csa:ul or ../ancestor::csa:ol)">-</xsl:when> <!-- &#x2014; dash -->
679
- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> <!-- &#x2014; dash -->
654
+ <xsl:when test="local-name(..) = 'ul'">
655
+ <xsl:call-template name="setULLabel"/>
656
+ </xsl:when>
657
+ <!-- <xsl:when test="local-name(..) = 'ul' and (../ancestor::csa:ul or ../ancestor::csa:ol)">-</xsl:when> --> <!-- &#x2014; dash -->
658
+ <!-- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> --> <!-- &#x2014; dash -->
680
659
  <xsl:otherwise> <!-- for ordered lists -->
681
660
  <xsl:choose>
682
661
  <xsl:when test="../@type = 'arabic'">
@@ -738,6 +717,7 @@
738
717
  <xsl:apply-templates select="ancestor::csa:term[1]/csa:name" mode="presentation"/>
739
718
  </fo:block>
740
719
  <fo:block font-weight="bold" keep-with-next="always" line-height="1">
720
+ <xsl:call-template name="setStyle_preferred"/>
741
721
  <xsl:apply-templates/>
742
722
  </fo:block>
743
723
  </fo:block>
@@ -1458,6 +1438,80 @@
1458
1438
 
1459
1439
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1460
1440
  <xsl:attribute name="line-height">135%</xsl:attribute>
1441
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1442
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1443
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1444
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1445
+
1446
+
1447
+
1448
+ <xsl:attribute name="font-size">65%</xsl:attribute>
1449
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+
1457
+
1458
+
1459
+
1460
+
1461
+
1462
+
1463
+
1464
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1465
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1466
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1467
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1468
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1469
+
1470
+
1471
+
1472
+ <xsl:attribute name="font-family">Azo Sans Lt</xsl:attribute>
1473
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1474
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1475
+ <xsl:attribute name="color">rgb(168, 170, 173)</xsl:attribute>
1476
+ <xsl:attribute name="text-align">left</xsl:attribute>
1477
+
1478
+
1479
+
1480
+
1481
+
1482
+
1483
+
1484
+
1485
+
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+
1492
+
1493
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1494
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1495
+
1496
+
1497
+
1498
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1499
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1500
+
1501
+
1502
+
1503
+
1504
+
1505
+
1506
+
1507
+
1508
+
1509
+
1510
+
1511
+
1512
+
1513
+
1514
+
1461
1515
  </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">
1462
1516
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1463
1517
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1483,7 +1537,8 @@
1483
1537
  <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"/>
1484
1538
 
1485
1539
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1486
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1540
+
1541
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
1487
1542
  <xsl:sort select="@displayorder" data-type="number"/>
1488
1543
  <xsl:apply-templates select="." mode="contents"/>
1489
1544
  </xsl:for-each>
@@ -1493,7 +1548,7 @@
1493
1548
  <xsl:apply-templates select="." mode="contents"/>
1494
1549
  </xsl:for-each>
1495
1550
 
1496
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1551
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1497
1552
  <xsl:sort select="@displayorder" data-type="number"/>
1498
1553
  <xsl:apply-templates select="." mode="contents"/>
1499
1554
  </xsl:for-each>
@@ -2385,6 +2440,102 @@
2385
2440
 
2386
2441
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2387
2442
  <xsl:apply-templates/>
2443
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
2444
+
2445
+ <!-- list of footnotes to calculate actual footnotes number -->
2446
+ <xsl:variable name="p_fn_">
2447
+ <xsl:choose>
2448
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2449
+ <fn gen_id="{generate-id(.)}">
2450
+ <xsl:copy-of select="@*"/>
2451
+ <xsl:copy-of select="node()"/>
2452
+ </fn>
2453
+ </xsl:when>
2454
+ <xsl:otherwise>
2455
+ <!-- itetation for:
2456
+ footnotes in bibdata/title
2457
+ footnotes in bibliography
2458
+ footnotes in document's body (except table's head/body/foot and figure text)
2459
+ -->
2460
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2461
+ <fn gen_id="{generate-id(.)}">
2462
+ <xsl:copy-of select="@*"/>
2463
+ <xsl:copy-of select="node()"/>
2464
+ </fn>
2465
+ </xsl:for-each>
2466
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
2467
+ <xsl:sort select="@displayorder" data-type="number"/>
2468
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
2469
+ <!-- copy unique fn -->
2470
+ <fn gen_id="{generate-id(.)}">
2471
+ <xsl:copy-of select="@*"/>
2472
+ <xsl:copy-of select="node()"/>
2473
+ </fn>
2474
+ </xsl:for-each>
2475
+ </xsl:for-each>
2476
+ </xsl:otherwise>
2477
+ </xsl:choose>
2478
+ </xsl:variable>
2479
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2480
+
2481
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2482
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2483
+ <xsl:variable name="reference" select="@reference"/>
2484
+ <!-- fn sequence number in document -->
2485
+ <xsl:variable name="current_fn_number">
2486
+ <xsl:choose>
2487
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2488
+ <xsl:otherwise>
2489
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2490
+ </xsl:otherwise>
2491
+ </xsl:choose>
2492
+ </xsl:variable>
2493
+ <xsl:variable name="current_fn_number_text">
2494
+ <xsl:value-of select="$current_fn_number"/>
2495
+
2496
+
2497
+ </xsl:variable>
2498
+
2499
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2500
+ <xsl:variable name="footnote_inline">
2501
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2502
+
2503
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2504
+ <xsl:value-of select="$current_fn_number_text"/>
2505
+ </fo:basic-link>
2506
+ </fo:inline>
2507
+ </xsl:variable>
2508
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2509
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2510
+ <xsl:choose>
2511
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2512
+ <xsl:copy-of select="$footnote_inline"/>
2513
+ </xsl:when>
2514
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2515
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2516
+ <xsl:copy-of select="$footnote_inline"/>
2517
+ <fo:footnote-body>
2518
+
2519
+ <fo:block-container text-indent="0" start-indent="0">
2520
+
2521
+
2522
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2523
+
2524
+
2525
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2526
+
2527
+ <xsl:value-of select="$current_fn_number_text"/>
2528
+ </fo:inline>
2529
+ <xsl:apply-templates/>
2530
+ </fo:block>
2531
+ </fo:block-container>
2532
+ </fo:footnote-body>
2533
+ </fo:footnote>
2534
+ </xsl:when>
2535
+ <xsl:otherwise>
2536
+ <xsl:copy-of select="$footnote_inline"/>
2537
+ </xsl:otherwise>
2538
+ </xsl:choose>
2388
2539
  </xsl:template><xsl:template name="fn_display">
2389
2540
  <xsl:variable name="references">
2390
2541
 
@@ -2575,6 +2726,8 @@
2575
2726
 
2576
2727
  </fo:basic-link>
2577
2728
  </fo:inline>
2729
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2730
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2578
2731
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2579
2732
  <fo:inline>
2580
2733
  <xsl:apply-templates/>
@@ -2932,6 +3085,7 @@
2932
3085
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2933
3086
  <xsl:apply-templates/>
2934
3087
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3088
+ <xsl:apply-templates select="@language"/>
2935
3089
  <xsl:apply-templates/>
2936
3090
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2937
3091
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -3565,22 +3719,6 @@
3565
3719
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3566
3720
  <xsl:apply-templates/>
3567
3721
  </fo:inline>
3568
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3569
- <xsl:variable name="title-modified">
3570
-
3571
-
3572
- <xsl:call-template name="getTitle">
3573
- <xsl:with-param name="name" select="'title-modified'"/>
3574
- </xsl:call-template>
3575
-
3576
- </xsl:variable>
3577
-
3578
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3579
- <xsl:choose>
3580
- <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>
3581
- <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>
3582
- </xsl:choose>
3583
- <xsl:apply-templates/>
3584
3722
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3585
3723
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3586
3724
 
@@ -4149,12 +4287,12 @@
4149
4287
  </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">
4150
4288
  <xsl:apply-templates mode="contents"/>
4151
4289
  <xsl:text> </xsl:text>
4152
- </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">
4290
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
4153
4291
  <xsl:apply-templates mode="bookmarks"/>
4154
4292
  <xsl:text> </xsl:text>
4155
4293
  </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
4156
4294
  <xsl:value-of select="."/>
4157
- </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
4295
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
4158
4296
  <xsl:value-of select="."/>
4159
4297
  </xsl:template><xsl:template match="node()" mode="contents">
4160
4298
  <xsl:apply-templates mode="contents"/>
@@ -4424,6 +4562,8 @@
4424
4562
 
4425
4563
 
4426
4564
 
4565
+
4566
+
4427
4567
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4428
4568
  <xsl:variable name="_font-size">
4429
4569
  10
@@ -4457,13 +4597,17 @@
4457
4597
 
4458
4598
 
4459
4599
 
4600
+
4601
+
4460
4602
  <xsl:apply-templates/>
4461
4603
  </fo:block>
4462
-
4604
+
4463
4605
 
4464
4606
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4465
4607
 
4466
4608
 
4609
+
4610
+
4467
4611
  </fo:block-container>
4468
4612
  </fo:block-container>
4469
4613
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4810,62 +4954,69 @@
4810
4954
  <xsl:variable name="termsource_text">
4811
4955
  <xsl:apply-templates/>
4812
4956
  </xsl:variable>
4813
-
4814
- <xsl:choose>
4957
+ <xsl:copy-of select="$termsource_text"/>
4958
+ <!-- <xsl:choose>
4815
4959
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4816
- <!-- <xsl:apply-templates /> -->
4817
4960
  <xsl:copy-of select="$termsource_text"/>
4818
4961
  </xsl:when>
4819
4962
  <xsl:otherwise>
4820
-
4821
-
4963
+ <xsl:if test="$namespace = 'bsi'">
4964
+ <xsl:choose>
4965
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
4966
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
4967
+ </xsl:choose>
4968
+ </xsl:if>
4969
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
4822
4970
  <xsl:text>[</xsl:text>
4823
-
4824
- <!-- <xsl:apply-templates /> -->
4971
+ </xsl:if>
4825
4972
  <xsl:copy-of select="$termsource_text"/>
4826
-
4827
-
4973
+ <xsl:if test="$namespace = 'bsi'">
4974
+ <xsl:choose>
4975
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
4976
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
4977
+ </xsl:choose>
4978
+ </xsl:if>
4979
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
4828
4980
  <xsl:text>]</xsl:text>
4829
-
4981
+ </xsl:if>
4830
4982
  </xsl:otherwise>
4831
- </xsl:choose>
4983
+ </xsl:choose> -->
4832
4984
  </fo:block>
4833
4985
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
4834
4986
  <xsl:if test="normalize-space() != ''">
4835
4987
  <xsl:value-of select="."/>
4836
4988
  </xsl:if>
4837
- </xsl:template><xsl:variable name="localized.source">
4838
- <xsl:call-template name="getLocalizedString">
4839
- <xsl:with-param name="key">source</xsl:with-param>
4840
- </xsl:call-template>
4841
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4989
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
4990
+ <fo:inline>
4991
+
4992
+
4993
+ <xsl:value-of select="."/>
4994
+ </fo:inline>
4995
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
4842
4996
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4843
4997
  <xsl:if test="normalize-space(@citeas) = ''">
4844
4998
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4845
4999
  </xsl:if>
4846
-
4847
-
4848
- <fo:inline>
4849
-
4850
-
4851
-
4852
-
4853
-
4854
-
4855
-
4856
- <xsl:call-template name="getTitle">
4857
- <xsl:with-param name="name" select="'title-source'"/>
4858
- </xsl:call-template>
4859
- <xsl:text>: </xsl:text>
4860
-
4861
-
4862
- </fo:inline>
4863
-
4864
5000
  <fo:inline xsl:use-attribute-sets="origin-style">
4865
5001
  <xsl:apply-templates/>
4866
5002
  </fo:inline>
5003
+ </fo:basic-link>
5004
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5005
+ <xsl:variable name="title-modified">
4867
5006
 
4868
- </fo:basic-link>
5007
+
5008
+ <xsl:call-template name="getTitle">
5009
+ <xsl:with-param name="name" select="'title-modified'"/>
5010
+ </xsl:call-template>
5011
+
5012
+ </xsl:variable>
5013
+
5014
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5015
+ <xsl:choose>
5016
+ <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>
5017
+ <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>
5018
+ </xsl:choose>
5019
+ <xsl:apply-templates/>
4869
5020
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4870
5021
  <fo:inline><xsl:apply-templates/></fo:inline>
4871
5022
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5042,24 +5193,29 @@
5042
5193
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5043
5194
  <xsl:variable name="title-deprecated">
5044
5195
 
5045
-
5046
- <xsl:call-template name="getTitle">
5047
- <xsl:with-param name="name" select="'title-deprecated'"/>
5196
+ <xsl:call-template name="getLocalizedString">
5197
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5048
5198
  </xsl:call-template>
5049
5199
 
5200
+
5050
5201
  </xsl:variable>
5051
5202
  <fo:block xsl:use-attribute-sets="deprecates-style">
5052
5203
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
5053
5204
  </fo:block>
5205
+ </xsl:template><xsl:template name="setStyle_preferred">
5206
+ <xsl:if test="*[local-name() = 'strong']">
5207
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5208
+ </xsl:if>
5054
5209
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5055
5210
  <fo:block xsl:use-attribute-sets="definition-style">
5056
5211
  <xsl:apply-templates/>
5057
5212
  </fo:block>
5058
5213
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
5059
5214
  <xsl:apply-templates/>
5060
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5215
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
5061
5216
  <fo:inline> <xsl:apply-templates/></fo:inline>
5062
- <fo:block> </fo:block>
5217
+ <!-- <fo:block>&#xA0;</fo:block> -->
5218
+ <fo:block/>
5063
5219
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
5064
5220
 
5065
5221
  <fo:block>
@@ -5120,6 +5276,53 @@
5120
5276
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
5121
5277
  <!-- 0xA0 to space replacement -->
5122
5278
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5279
+ </xsl:template><xsl:variable name="ul_labels_">
5280
+
5281
+
5282
+
5283
+ <label level="1">•</label>
5284
+ <label level="2">-</label><!-- minus -->
5285
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
5286
+
5287
+
5288
+
5289
+
5290
+
5291
+
5292
+
5293
+
5294
+
5295
+
5296
+
5297
+
5298
+
5299
+
5300
+
5301
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5302
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5303
+ <xsl:variable name="list_level">
5304
+ <xsl:choose>
5305
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
5306
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
5307
+ </xsl:choose>
5308
+ </xsl:variable>
5309
+ <xsl:choose>
5310
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
5311
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
5312
+ </xsl:when>
5313
+ <xsl:when test="$list_level mod 3 = 0">
5314
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
5315
+ </xsl:when>
5316
+ <xsl:when test="$list_level mod 2 = 0">
5317
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
5318
+ </xsl:when>
5319
+ <xsl:otherwise>
5320
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
5321
+ </xsl:otherwise>
5322
+ </xsl:choose>
5323
+ </xsl:template><xsl:template match="label" mode="ul_labels">
5324
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5325
+ <xsl:value-of select="."/>
5123
5326
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5124
5327
  <xsl:choose>
5125
5328
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5458,7 +5661,31 @@
5458
5661
  <fo:block-container border="1pt solid black" width="50%">
5459
5662
  <fo:block> </fo:block>
5460
5663
  </fo:block-container>
5461
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5664
+ </xsl:template><xsl:variable name="toc_level">
5665
+ <xsl:choose>
5666
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5667
+ <xsl:otherwise><!-- default value -->
5668
+
5669
+
5670
+ 2
5671
+
5672
+
5673
+
5674
+
5675
+
5676
+
5677
+
5678
+
5679
+
5680
+
5681
+
5682
+
5683
+
5684
+
5685
+
5686
+ </xsl:otherwise>
5687
+ </xsl:choose>
5688
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5462
5689
  <xsl:param name="colwidths"/>
5463
5690
  <xsl:variable name="colwidths_">
5464
5691
  <xsl:choose>
@@ -5549,6 +5776,10 @@
5549
5776
  </svg>
5550
5777
  </fo:instream-foreign-object>
5551
5778
  </fo:inline>
5779
+ </xsl:template><xsl:template match="@language">
5780
+ <xsl:copy-of select="."/>
5781
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
5782
+ <xsl:call-template name="title"/>
5552
5783
  </xsl:template><xsl:template name="convertDate">
5553
5784
  <xsl:param name="date"/>
5554
5785
  <xsl:param name="format" select="'short'"/>
@@ -5993,12 +6224,15 @@
5993
6224
  <xsl:param name="default">left</xsl:param>
5994
6225
  <xsl:attribute name="text-align">
5995
6226
  <xsl:choose>
5996
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
6227
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
5997
6228
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5998
6229
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5999
6230
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
6000
6231
  </xsl:choose>
6001
6232
  </xsl:attribute>
6233
+ <xsl:if test="@align = 'indent'">
6234
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
6235
+ </xsl:if>
6002
6236
  </xsl:template><xsl:template name="number-to-words">
6003
6237
  <xsl:param name="number"/>
6004
6238
  <xsl:param name="first"/>
@@ -6095,4 +6329,14 @@
6095
6329
  </xsl:otherwise>
6096
6330
  </xsl:choose>
6097
6331
  </xsl:if>
6332
+ </xsl:template><xsl:template name="setAltText">
6333
+ <xsl:param name="value"/>
6334
+ <xsl:attribute name="fox:alt-text">
6335
+ <xsl:choose>
6336
+ <xsl:when test="normalize-space($value) != ''">
6337
+ <xsl:value-of select="$value"/>
6338
+ </xsl:when>
6339
+ <xsl:otherwise>_</xsl:otherwise>
6340
+ </xsl:choose>
6341
+ </xsl:attribute>
6098
6342
  </xsl:template></xsl:stylesheet>
@@ -309,7 +309,6 @@ p.Terms, li.Terms, div.Terms {
309
309
  mso-fareast-font-family: {{headerfont}};
310
310
  mso-bidi-font-family: {{headerfont}};
311
311
  mso-ansi-language: EN-GB;
312
- font-weight: bold;
313
312
  mso-bidi-font-weight: normal; }
314
313
 
315
314
  p.AltTerms, li.AltTerms, div.AltTerms {
@@ -296,7 +296,6 @@ p.Terms, li.Terms, div.Terms
296
296
  mso-fareast-font-family:$headerfont;
297
297
  mso-bidi-font-family:$headerfont;
298
298
  mso-ansi-language:EN-GB;
299
- font-weight:bold;
300
299
  mso-bidi-font-weight:normal;}
301
300
  p.AltTerms, li.AltTerms, div.AltTerms
302
301
  {mso-style-name:"AltTerm\(s\)";