metanorma-un 0.7.0 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,8 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
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"/>
11
+
10
12
 
11
13
 
12
14
 
@@ -217,7 +219,7 @@
217
219
  <xsl:attribute name="margin-left">20mm</xsl:attribute>
218
220
  </xsl:if>
219
221
  <xsl:if test="@level &gt;= 3 and @section != ''">
220
- <xsl:attribute name="margin-left">28mm</xsl:attribute>
222
+ <xsl:attribute name="margin-left"><xsl:value-of select="(@level - 2) * 28"/>mm</xsl:attribute>
221
223
  </xsl:if>
222
224
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
223
225
  <xsl:if test="@section != ''">
@@ -362,7 +364,7 @@
362
364
  <xsl:variable name="display">
363
365
  <xsl:choose>
364
366
  <xsl:when test="ancestor-or-self::un:annex and $level &gt;= 2">false</xsl:when>
365
- <xsl:when test="$level &gt; 3">false</xsl:when>
367
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
366
368
  <xsl:when test="@inline-header='true'">false</xsl:when>
367
369
  <xsl:otherwise>true</xsl:otherwise>
368
370
  </xsl:choose>
@@ -593,31 +595,6 @@
593
595
  </fo:block>
594
596
  </xsl:template>
595
597
 
596
-
597
- <!-- un:fn[not(ancestor::un:un-standard)] means fn element in virtual variable $title -->
598
- <xsl:template match="un:title//un:fn | un:p/un:fn[not(ancestor::un:table)]" priority="2">
599
- <fo:footnote keep-with-previous.within-line="always">
600
- <xsl:variable name="number">
601
- <xsl:number level="any" count="un:fn[not(ancestor::un:table)]"/>
602
- </xsl:variable>
603
- <fo:inline font-size="55%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% -->
604
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
605
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
606
- </fo:basic-link>
607
- </fo:inline>
608
- <fo:footnote-body>
609
- <fo:block font-size="9pt" line-height="125%" font-weight="normal" text-indent="0">
610
- <fo:inline id="footnote_{@reference}_{$number}" font-size="60%" padding-right="1mm" keep-with-next.within-line="always" vertical-align="super"> <!-- alignment-baseline="hanging" -->
611
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
612
- </fo:inline>
613
- <xsl:for-each select="un:p">
614
- <xsl:apply-templates/>
615
- </xsl:for-each>
616
- </fo:block>
617
- </fo:footnote-body>
618
- </fo:footnote>
619
- </xsl:template>
620
-
621
598
  <xsl:template match="un:fn/un:p">
622
599
  <fo:block>
623
600
  <xsl:apply-templates/>
@@ -1603,6 +1580,78 @@
1603
1580
 
1604
1581
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1605
1582
  <xsl:attribute name="line-height">135%</xsl:attribute>
1583
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1584
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1585
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1586
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+ <xsl:attribute name="font-size">55%</xsl:attribute>
1604
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1605
+
1606
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1607
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1608
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1609
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1610
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1611
+
1612
+
1613
+
1614
+
1615
+
1616
+
1617
+
1618
+
1619
+
1620
+
1621
+
1622
+
1623
+
1624
+
1625
+
1626
+
1627
+
1628
+
1629
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1630
+ <xsl:attribute name="line-height">125%</xsl:attribute>
1631
+
1632
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1633
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1634
+
1635
+
1636
+
1637
+
1638
+
1639
+
1640
+
1641
+
1642
+
1643
+
1644
+
1645
+
1646
+
1647
+
1648
+
1649
+
1650
+
1651
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1652
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1653
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1654
+
1606
1655
  </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">
1607
1656
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1608
1657
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1628,7 +1677,8 @@
1628
1677
  <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"/>
1629
1678
 
1630
1679
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1631
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1680
+
1681
+ <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']]">
1632
1682
  <xsl:sort select="@displayorder" data-type="number"/>
1633
1683
  <xsl:apply-templates select="." mode="contents"/>
1634
1684
  </xsl:for-each>
@@ -1638,7 +1688,7 @@
1638
1688
  <xsl:apply-templates select="." mode="contents"/>
1639
1689
  </xsl:for-each>
1640
1690
 
1641
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1691
+ <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')]]">
1642
1692
  <xsl:sort select="@displayorder" data-type="number"/>
1643
1693
  <xsl:apply-templates select="." mode="contents"/>
1644
1694
  </xsl:for-each>
@@ -2576,6 +2626,102 @@
2576
2626
 
2577
2627
  </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">
2578
2628
  <xsl:apply-templates/>
2629
+ </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">
2630
+
2631
+ <!-- list of footnotes to calculate actual footnotes number -->
2632
+ <xsl:variable name="p_fn_">
2633
+ <xsl:choose>
2634
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2635
+ <fn gen_id="{generate-id(.)}">
2636
+ <xsl:copy-of select="@*"/>
2637
+ <xsl:copy-of select="node()"/>
2638
+ </fn>
2639
+ </xsl:when>
2640
+ <xsl:otherwise>
2641
+ <!-- itetation for:
2642
+ footnotes in bibdata/title
2643
+ footnotes in bibliography
2644
+ footnotes in document's body (except table's head/body/foot and figure text)
2645
+ -->
2646
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2647
+ <fn gen_id="{generate-id(.)}">
2648
+ <xsl:copy-of select="@*"/>
2649
+ <xsl:copy-of select="node()"/>
2650
+ </fn>
2651
+ </xsl:for-each>
2652
+ <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']/*">
2653
+ <xsl:sort select="@displayorder" data-type="number"/>
2654
+ <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])]">
2655
+ <!-- copy unique fn -->
2656
+ <fn gen_id="{generate-id(.)}">
2657
+ <xsl:copy-of select="@*"/>
2658
+ <xsl:copy-of select="node()"/>
2659
+ </fn>
2660
+ </xsl:for-each>
2661
+ </xsl:for-each>
2662
+ </xsl:otherwise>
2663
+ </xsl:choose>
2664
+ </xsl:variable>
2665
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2666
+
2667
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2668
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2669
+ <xsl:variable name="reference" select="@reference"/>
2670
+ <!-- fn sequence number in document -->
2671
+ <xsl:variable name="current_fn_number">
2672
+ <xsl:choose>
2673
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2674
+ <xsl:otherwise>
2675
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2676
+ </xsl:otherwise>
2677
+ </xsl:choose>
2678
+ </xsl:variable>
2679
+ <xsl:variable name="current_fn_number_text">
2680
+ <xsl:value-of select="$current_fn_number"/>
2681
+
2682
+
2683
+ </xsl:variable>
2684
+
2685
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2686
+ <xsl:variable name="footnote_inline">
2687
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2688
+
2689
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2690
+ <xsl:value-of select="$current_fn_number_text"/>
2691
+ </fo:basic-link>
2692
+ </fo:inline>
2693
+ </xsl:variable>
2694
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2695
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2696
+ <xsl:choose>
2697
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2698
+ <xsl:copy-of select="$footnote_inline"/>
2699
+ </xsl:when>
2700
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2701
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2702
+ <xsl:copy-of select="$footnote_inline"/>
2703
+ <fo:footnote-body>
2704
+
2705
+ <fo:block-container text-indent="0" start-indent="0">
2706
+
2707
+
2708
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2709
+
2710
+
2711
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2712
+
2713
+ <xsl:value-of select="$current_fn_number_text"/>
2714
+ </fo:inline>
2715
+ <xsl:apply-templates/>
2716
+ </fo:block>
2717
+ </fo:block-container>
2718
+ </fo:footnote-body>
2719
+ </fo:footnote>
2720
+ </xsl:when>
2721
+ <xsl:otherwise>
2722
+ <xsl:copy-of select="$footnote_inline"/>
2723
+ </xsl:otherwise>
2724
+ </xsl:choose>
2579
2725
  </xsl:template><xsl:template name="fn_display">
2580
2726
  <xsl:variable name="references">
2581
2727
 
@@ -2768,6 +2914,8 @@
2768
2914
 
2769
2915
  </fo:basic-link>
2770
2916
  </fo:inline>
2917
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2918
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2771
2919
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2772
2920
  <fo:inline>
2773
2921
  <xsl:apply-templates/>
@@ -3067,6 +3215,7 @@
3067
3215
  <fo:table-cell>
3068
3216
 
3069
3217
  <fo:block margin-top="6pt">
3218
+ <xsl:copy-of select="@id"/>
3070
3219
 
3071
3220
 
3072
3221
  <xsl:if test="normalize-space($key_iso) = 'true'">
@@ -3757,22 +3906,6 @@
3757
3906
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3758
3907
  <xsl:apply-templates/>
3759
3908
  </fo:inline>
3760
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3761
- <xsl:variable name="title-modified">
3762
-
3763
-
3764
- <xsl:call-template name="getTitle">
3765
- <xsl:with-param name="name" select="'title-modified'"/>
3766
- </xsl:call-template>
3767
-
3768
- </xsl:variable>
3769
-
3770
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3771
- <xsl:choose>
3772
- <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>
3773
- <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>
3774
- </xsl:choose>
3775
- <xsl:apply-templates/>
3776
3909
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3777
3910
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3778
3911
 
@@ -3919,14 +4052,18 @@
3919
4052
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
3920
4053
  <fo:inline><xsl:apply-templates/></fo:inline>
3921
4054
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
4055
+ <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
3922
4056
  <fo:block id="{@id}">
3923
4057
  <xsl:apply-templates/>
3924
4058
  </fo:block>
3925
4059
  </xsl:template><xsl:template match="*[local-name() = 'term']">
4060
+ <!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
3926
4061
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
3927
4062
 
3928
4063
 
3929
-
4064
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
4065
+
4066
+ </xsl:if>
3930
4067
  <xsl:apply-templates/>
3931
4068
  </fo:block>
3932
4069
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
@@ -4355,12 +4492,12 @@
4355
4492
  </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">
4356
4493
  <xsl:apply-templates mode="contents"/>
4357
4494
  <xsl:text> </xsl:text>
4358
- </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">
4495
+ </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">
4359
4496
  <xsl:apply-templates mode="bookmarks"/>
4360
4497
  <xsl:text> </xsl:text>
4361
4498
  </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">
4362
4499
  <xsl:value-of select="."/>
4363
- </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">
4500
+ </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">
4364
4501
  <xsl:value-of select="."/>
4365
4502
  </xsl:template><xsl:template match="node()" mode="contents">
4366
4503
  <xsl:apply-templates mode="contents"/>
@@ -4630,6 +4767,8 @@
4630
4767
 
4631
4768
 
4632
4769
 
4770
+
4771
+
4633
4772
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4634
4773
  <xsl:variable name="_font-size">
4635
4774
 
@@ -4663,13 +4802,17 @@
4663
4802
 
4664
4803
 
4665
4804
 
4805
+
4806
+
4666
4807
  <xsl:apply-templates/>
4667
4808
  </fo:block>
4668
-
4809
+
4669
4810
 
4670
4811
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4671
4812
 
4672
4813
 
4814
+
4815
+
4673
4816
  </fo:block-container>
4674
4817
  </fo:block-container>
4675
4818
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4905,7 +5048,8 @@
4905
5048
  </fo:block>
4906
5049
  </fo:table-cell>
4907
5050
  </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
4908
- <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
5051
+ <fo:block font-size="11pt">
5052
+
4909
5053
  <xsl:apply-templates/>
4910
5054
  </fo:block>
4911
5055
  </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
@@ -5020,43 +5164,69 @@
5020
5164
  <xsl:variable name="termsource_text">
5021
5165
  <xsl:apply-templates/>
5022
5166
  </xsl:variable>
5023
-
5024
- <xsl:choose>
5167
+ <xsl:copy-of select="$termsource_text"/>
5168
+ <!-- <xsl:choose>
5025
5169
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5026
- <!-- <xsl:apply-templates /> -->
5027
5170
  <xsl:copy-of select="$termsource_text"/>
5028
5171
  </xsl:when>
5029
- <xsl:otherwise>
5030
-
5172
+ <xsl:otherwise>
5173
+ <xsl:if test="$namespace = 'bsi'">
5174
+ <xsl:choose>
5175
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
5176
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
5177
+ </xsl:choose>
5178
+ </xsl:if>
5179
+ <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'">
5031
5180
  <xsl:text>[</xsl:text>
5032
-
5033
- <!-- <xsl:apply-templates /> -->
5181
+ </xsl:if>
5034
5182
  <xsl:copy-of select="$termsource_text"/>
5035
-
5183
+ <xsl:if test="$namespace = 'bsi'">
5184
+ <xsl:choose>
5185
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
5186
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
5187
+ </xsl:choose>
5188
+ </xsl:if>
5189
+ <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'">
5036
5190
  <xsl:text>]</xsl:text>
5037
-
5191
+ </xsl:if>
5038
5192
  </xsl:otherwise>
5039
- </xsl:choose>
5193
+ </xsl:choose> -->
5040
5194
  </fo:block>
5041
5195
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5042
5196
  <xsl:if test="normalize-space() != ''">
5043
5197
  <xsl:value-of select="."/>
5044
5198
  </xsl:if>
5045
- </xsl:template><xsl:variable name="localized.source">
5046
- <xsl:call-template name="getLocalizedString">
5047
- <xsl:with-param name="key">source</xsl:with-param>
5048
- </xsl:call-template>
5049
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5199
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
5200
+ <fo:inline>
5201
+
5202
+
5203
+ <xsl:value-of select="."/>
5204
+ </fo:inline>
5205
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
5050
5206
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5051
5207
  <xsl:if test="normalize-space(@citeas) = ''">
5052
5208
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5053
5209
  </xsl:if>
5054
-
5055
5210
  <fo:inline xsl:use-attribute-sets="origin-style">
5056
5211
  <xsl:apply-templates/>
5057
5212
  </fo:inline>
5213
+ </fo:basic-link>
5214
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5215
+ <xsl:variable name="title-modified">
5058
5216
 
5059
- </fo:basic-link>
5217
+
5218
+ <xsl:call-template name="getTitle">
5219
+ <xsl:with-param name="name" select="'title-modified'"/>
5220
+ </xsl:call-template>
5221
+
5222
+ </xsl:variable>
5223
+
5224
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5225
+ <xsl:choose>
5226
+ <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>
5227
+ <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>
5228
+ </xsl:choose>
5229
+ <xsl:apply-templates/>
5060
5230
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5061
5231
  <fo:inline><xsl:apply-templates/></fo:inline>
5062
5232
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5099,12 +5269,20 @@
5099
5269
  </xsl:template><xsl:template match="*[local-name() = 'author']">
5100
5270
  <xsl:text>— </xsl:text>
5101
5271
  <xsl:apply-templates/>
5102
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
5272
+ </xsl:template><xsl:variable name="bibitem_hidden_">
5273
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
5274
+ <xsl:copy-of select="."/>
5275
+ </xsl:for-each>
5276
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
5277
+ <xsl:copy-of select="."/>
5278
+ </xsl:for-each>
5279
+ </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
5103
5280
 
5104
5281
  <xsl:variable name="bibitemid">
5105
5282
  <xsl:choose>
5106
- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5107
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5283
+ <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
5284
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
5285
+ <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5108
5286
  <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5109
5287
  </xsl:choose>
5110
5288
  </xsl:variable>
@@ -5193,10 +5371,10 @@
5193
5371
  </xsl:choose>
5194
5372
  </xsl:variable>
5195
5373
 
5196
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5374
+ <!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
5197
5375
 
5198
5376
  <xsl:choose>
5199
- <xsl:when test="$language = 'zh'">
5377
+ <xsl:when test="$lang = 'zh'">
5200
5378
  <fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
5201
5379
  </xsl:when>
5202
5380
  <xsl:when test="../../@inline-header = 'true'">
@@ -5239,15 +5417,20 @@
5239
5417
  <fo:block xsl:use-attribute-sets="deprecates-style">
5240
5418
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
5241
5419
  </fo:block>
5420
+ </xsl:template><xsl:template name="setStyle_preferred">
5421
+ <xsl:if test="*[local-name() = 'strong']">
5422
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5423
+ </xsl:if>
5242
5424
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5243
5425
  <fo:block xsl:use-attribute-sets="definition-style">
5244
5426
  <xsl:apply-templates/>
5245
5427
  </fo:block>
5246
5428
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
5247
5429
  <xsl:apply-templates/>
5248
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5430
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
5249
5431
  <fo:inline> <xsl:apply-templates/></fo:inline>
5250
- <fo:block> </fo:block>
5432
+ <!-- <fo:block>&#xA0;</fo:block> -->
5433
+ <fo:block/>
5251
5434
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
5252
5435
 
5253
5436
  <fo:block break-after="page"/>
@@ -5653,7 +5836,31 @@
5653
5836
  <fo:block-container border="1pt solid black" width="50%">
5654
5837
  <fo:block> </fo:block>
5655
5838
  </fo:block-container>
5656
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5839
+ </xsl:template><xsl:variable name="toc_level">
5840
+ <xsl:choose>
5841
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5842
+ <xsl:otherwise><!-- default value -->
5843
+
5844
+
5845
+
5846
+
5847
+
5848
+
5849
+
5850
+
5851
+
5852
+
5853
+
5854
+
5855
+
5856
+
5857
+
5858
+
5859
+
5860
+ 3
5861
+ </xsl:otherwise>
5862
+ </xsl:choose>
5863
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5657
5864
  <xsl:param name="colwidths"/>
5658
5865
  <xsl:variable name="colwidths_">
5659
5866
  <xsl:choose>
@@ -6188,12 +6395,15 @@
6188
6395
  <xsl:param name="default">left</xsl:param>
6189
6396
  <xsl:attribute name="text-align">
6190
6397
  <xsl:choose>
6191
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
6398
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
6192
6399
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
6193
6400
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
6194
6401
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
6195
6402
  </xsl:choose>
6196
6403
  </xsl:attribute>
6404
+ <xsl:if test="@align = 'indent'">
6405
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
6406
+ </xsl:if>
6197
6407
  </xsl:template><xsl:template name="number-to-words">
6198
6408
  <xsl:param name="number"/>
6199
6409
  <xsl:param name="first"/>
@@ -6290,4 +6500,14 @@
6290
6500
  </xsl:otherwise>
6291
6501
  </xsl:choose>
6292
6502
  </xsl:if>
6503
+ </xsl:template><xsl:template name="setAltText">
6504
+ <xsl:param name="value"/>
6505
+ <xsl:attribute name="fox:alt-text">
6506
+ <xsl:choose>
6507
+ <xsl:when test="normalize-space($value) != ''">
6508
+ <xsl:value-of select="$value"/>
6509
+ </xsl:when>
6510
+ <xsl:otherwise>_</xsl:otherwise>
6511
+ </xsl:choose>
6512
+ </xsl:attribute>
6293
6513
  </xsl:template></xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.7.0".freeze
3
+ VERSION = "0.7.4".freeze
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency "metanorma-standoc", "~> 1.11.0"
34
34
 
35
- spec.add_development_dependency "byebug", "~> 9.1"
35
+ spec.add_development_dependency "debug"
36
36
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
37
37
  spec.add_development_dependency "guard", "~> 2.14"
38
38
  spec.add_development_dependency "guard-rspec", "~> 4.7"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2021-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.11.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: byebug
70
+ name: debug
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '9.1'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '9.1'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: equivalent-xml
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
292
  - !ruby/object:Gem::Version
293
293
  version: '0'
294
294
  requirements: []
295
- rubygems_version: 3.2.22
295
+ rubygems_version: 3.2.32
296
296
  signing_key:
297
297
  specification_version: 4
298
298
  summary: Metanorma for UN.