metanorma-ogc 1.5.1 → 1.5.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/lib/asciidoctor/ogc/boilerplate.xml +3 -3
  4. data/lib/asciidoctor/ogc/cleanup.rb +9 -0
  5. data/lib/asciidoctor/ogc/converter.rb +5 -3
  6. data/lib/asciidoctor/ogc/isodoc.rng +56 -17
  7. data/lib/asciidoctor/ogc/validate.rb +12 -0
  8. data/lib/isodoc/ogc/base_convert.rb +2 -1
  9. data/lib/isodoc/ogc/html/htmlstyle.css +6 -2
  10. data/lib/isodoc/ogc/html/htmlstyle.scss +6 -1
  11. data/lib/isodoc/ogc/html/ogc.css +0 -1
  12. data/lib/isodoc/ogc/html/ogc.scss +0 -1
  13. data/lib/isodoc/ogc/html/ogc_wp.css +0 -1
  14. data/lib/isodoc/ogc/html/ogc_wp.scss +0 -1
  15. data/lib/isodoc/ogc/html/scripts.html +0 -1
  16. data/lib/isodoc/ogc/html_convert.rb +1 -0
  17. data/lib/isodoc/ogc/i18n-en.yaml +10 -12
  18. data/lib/isodoc/ogc/metadata.rb +6 -2
  19. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +407 -117
  20. data/lib/isodoc/ogc/ogc.best-practice.xsl +407 -117
  21. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +407 -117
  22. data/lib/isodoc/ogc/ogc.community-practice.xsl +407 -117
  23. data/lib/isodoc/ogc/ogc.community-standard.xsl +407 -117
  24. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +407 -117
  25. data/lib/isodoc/ogc/ogc.engineering-report.xsl +407 -117
  26. data/lib/isodoc/ogc/ogc.other.xsl +407 -117
  27. data/lib/isodoc/ogc/ogc.policy.xsl +407 -117
  28. data/lib/isodoc/ogc/ogc.reference-model.xsl +407 -117
  29. data/lib/isodoc/ogc/ogc.release-notes.xsl +407 -117
  30. data/lib/isodoc/ogc/ogc.standard.xsl +407 -117
  31. data/lib/isodoc/ogc/ogc.test-suite.xsl +407 -117
  32. data/lib/isodoc/ogc/ogc.user-guide.xsl +407 -117
  33. data/lib/isodoc/ogc/ogc.white-paper.xsl +284 -94
  34. data/lib/isodoc/ogc/presentation_xml_convert.rb +39 -2
  35. data/lib/isodoc/ogc/reqt.rb +1 -1
  36. data/lib/isodoc/ogc/sections.rb +9 -2
  37. data/lib/isodoc/ogc/word_convert.rb +28 -4
  38. data/lib/isodoc/ogc/xref.rb +4 -2
  39. data/lib/metanorma/ogc/version.rb +1 -1
  40. data/metanorma-ogc.gemspec +1 -1
  41. metadata +8 -9
  42. data/README.adoc.old +0 -187
@@ -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
  <xsl:variable name="pageWidth" select="215.9"/>
11
13
  <xsl:variable name="pageHeight" select="279.4"/>
12
14
  <xsl:variable name="marginLeftRight1" select="25.4"/>
@@ -88,12 +90,13 @@
88
90
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
89
91
  <!-- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*" mode="contents"/> -->
90
92
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="contents"/>
93
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']" mode="contents"/>
91
94
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keyword']" mode="contents"/>
92
95
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="contents"/>
93
96
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="contents"/>
94
97
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']" mode="contents"/>
95
98
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters" mode="contents"/>
96
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'submitting_orgs') and not(@type = 'keyword')]" mode="contents"/>
99
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'submitting_orgs') and not(@type = 'keyword')]" mode="contents"/>
97
100
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements" mode="contents"/>
98
101
 
99
102
 
@@ -287,6 +290,7 @@
287
290
  <fo:block break-after="page"/>
288
291
  </xsl:if>
289
292
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract"/>
293
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']"/>
290
294
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keyword']"/>
291
295
  <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:foreword">
292
296
  <fo:block break-after="page"/>
@@ -299,7 +303,7 @@
299
303
 
300
304
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']"/>
301
305
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters"/>
302
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'submitting_orgs') and not(@type = 'keyword')]"/>
306
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'submitting_orgs') and not(@type = 'keyword')]"/>
303
307
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements"/>
304
308
 
305
309
  </fo:flow>
@@ -382,7 +386,7 @@
382
386
 
383
387
  <xsl:variable name="display">
384
388
  <xsl:choose>
385
- <xsl:when test="$level &gt; 3">false</xsl:when>
389
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
386
390
  <xsl:otherwise>true</xsl:otherwise>
387
391
  </xsl:choose>
388
392
  </xsl:variable>
@@ -640,32 +644,6 @@
640
644
  </xsl:if>
641
645
  </xsl:template>
642
646
 
643
- <!--
644
- <fn reference="1">
645
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
646
- </fn>
647
- -->
648
- <xsl:template match="ogc:title//ogc:fn | ogc:name//ogc:fn | ogc:p/ogc:fn[not(ancestor::ogc:table)] | ogc:p/*/ogc:fn[not(ancestor::ogc:table)] | ogc:sourcecode/ogc:fn[not(ancestor::ogc:table)]" priority="2">
649
- <fo:footnote keep-with-previous.within-line="always">
650
- <xsl:variable name="number" select="@reference"/>
651
-
652
- <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
653
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
654
- <xsl:value-of select="$number"/><!-- + count(//ogc:bibitem/ogc:note) -->
655
- </fo:basic-link>
656
- </fo:inline>
657
- <fo:footnote-body>
658
- <fo:block font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="black" text-align="justify">
659
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
660
- <xsl:value-of select="$number "/><!-- + count(//ogc:bibitem/ogc:note) -->
661
- </fo:inline>
662
- <xsl:for-each select="ogc:p">
663
- <xsl:apply-templates/>
664
- </xsl:for-each>
665
- </fo:block>
666
- </fo:footnote-body>
667
- </fo:footnote>
668
- </xsl:template>
669
647
 
670
648
  <xsl:template match="ogc:fn/ogc:p">
671
649
  <fo:block>
@@ -798,6 +776,7 @@
798
776
  <xsl:apply-templates select="ancestor::ogc:term[1]/ogc:name" mode="presentation"/>
799
777
  </fo:block>
800
778
  <fo:block font-weight="bold" keep-with-next="always" line-height="1">
779
+ <xsl:call-template name="setStyle_preferred"/>
801
780
  <xsl:apply-templates/>
802
781
  </fo:block>
803
782
  </fo:block>
@@ -1593,6 +1572,79 @@
1593
1572
 
1594
1573
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1595
1574
  <xsl:attribute name="line-height">135%</xsl:attribute>
1575
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1576
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1577
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1578
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1579
+
1580
+
1581
+
1582
+
1583
+
1584
+
1585
+
1586
+
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+ <xsl:attribute name="font-size">65%</xsl:attribute>
1593
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1594
+
1595
+
1596
+
1597
+
1598
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1599
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1600
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1601
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1602
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1603
+
1604
+
1605
+
1606
+
1607
+
1608
+
1609
+
1610
+
1611
+
1612
+
1613
+
1614
+
1615
+
1616
+
1617
+
1618
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1619
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1620
+ <xsl:attribute name="color">black</xsl:attribute>
1621
+ <xsl:attribute name="text-align">justify</xsl:attribute>
1622
+
1623
+
1624
+
1625
+
1626
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1627
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1628
+
1629
+
1630
+
1631
+
1632
+
1633
+
1634
+
1635
+
1636
+
1637
+
1638
+
1639
+
1640
+
1641
+
1642
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1643
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1644
+
1645
+
1646
+
1647
+
1596
1648
  </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">
1597
1649
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1598
1650
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1618,7 +1670,8 @@
1618
1670
  <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"/>
1619
1671
 
1620
1672
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1621
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1673
+
1674
+ <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']]">
1622
1675
  <xsl:sort select="@displayorder" data-type="number"/>
1623
1676
  <xsl:apply-templates select="." mode="contents"/>
1624
1677
  </xsl:for-each>
@@ -1628,7 +1681,7 @@
1628
1681
  <xsl:apply-templates select="." mode="contents"/>
1629
1682
  </xsl:for-each>
1630
1683
 
1631
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1684
+ <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')]]">
1632
1685
  <xsl:sort select="@displayorder" data-type="number"/>
1633
1686
  <xsl:apply-templates select="." mode="contents"/>
1634
1687
  </xsl:for-each>
@@ -2543,6 +2596,102 @@
2543
2596
 
2544
2597
  </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">
2545
2598
  <xsl:apply-templates/>
2599
+ </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">
2600
+
2601
+ <!-- list of footnotes to calculate actual footnotes number -->
2602
+ <xsl:variable name="p_fn_">
2603
+ <xsl:choose>
2604
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2605
+ <fn gen_id="{generate-id(.)}">
2606
+ <xsl:copy-of select="@*"/>
2607
+ <xsl:copy-of select="node()"/>
2608
+ </fn>
2609
+ </xsl:when>
2610
+ <xsl:otherwise>
2611
+ <!-- itetation for:
2612
+ footnotes in bibdata/title
2613
+ footnotes in bibliography
2614
+ footnotes in document's body (except table's head/body/foot and figure text)
2615
+ -->
2616
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2617
+ <fn gen_id="{generate-id(.)}">
2618
+ <xsl:copy-of select="@*"/>
2619
+ <xsl:copy-of select="node()"/>
2620
+ </fn>
2621
+ </xsl:for-each>
2622
+ <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']/*">
2623
+ <xsl:sort select="@displayorder" data-type="number"/>
2624
+ <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])]">
2625
+ <!-- copy unique fn -->
2626
+ <fn gen_id="{generate-id(.)}">
2627
+ <xsl:copy-of select="@*"/>
2628
+ <xsl:copy-of select="node()"/>
2629
+ </fn>
2630
+ </xsl:for-each>
2631
+ </xsl:for-each>
2632
+ </xsl:otherwise>
2633
+ </xsl:choose>
2634
+ </xsl:variable>
2635
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2636
+
2637
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2638
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2639
+ <xsl:variable name="reference" select="@reference"/>
2640
+ <!-- fn sequence number in document -->
2641
+ <xsl:variable name="current_fn_number">
2642
+ <xsl:choose>
2643
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2644
+ <xsl:otherwise>
2645
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2646
+ </xsl:otherwise>
2647
+ </xsl:choose>
2648
+ </xsl:variable>
2649
+ <xsl:variable name="current_fn_number_text">
2650
+ <xsl:value-of select="$current_fn_number"/>
2651
+
2652
+
2653
+ </xsl:variable>
2654
+
2655
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2656
+ <xsl:variable name="footnote_inline">
2657
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2658
+
2659
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2660
+ <xsl:value-of select="$current_fn_number_text"/>
2661
+ </fo:basic-link>
2662
+ </fo:inline>
2663
+ </xsl:variable>
2664
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2665
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2666
+ <xsl:choose>
2667
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2668
+ <xsl:copy-of select="$footnote_inline"/>
2669
+ </xsl:when>
2670
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2671
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2672
+ <xsl:copy-of select="$footnote_inline"/>
2673
+ <fo:footnote-body>
2674
+
2675
+ <fo:block-container text-indent="0" start-indent="0">
2676
+
2677
+
2678
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2679
+
2680
+
2681
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2682
+
2683
+ <xsl:value-of select="$current_fn_number_text"/>
2684
+ </fo:inline>
2685
+ <xsl:apply-templates/>
2686
+ </fo:block>
2687
+ </fo:block-container>
2688
+ </fo:footnote-body>
2689
+ </fo:footnote>
2690
+ </xsl:when>
2691
+ <xsl:otherwise>
2692
+ <xsl:copy-of select="$footnote_inline"/>
2693
+ </xsl:otherwise>
2694
+ </xsl:choose>
2546
2695
  </xsl:template><xsl:template name="fn_display">
2547
2696
  <xsl:variable name="references">
2548
2697
 
@@ -2751,6 +2900,8 @@
2751
2900
 
2752
2901
  </fo:basic-link>
2753
2902
  </fo:inline>
2903
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2904
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2754
2905
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2755
2906
  <fo:inline>
2756
2907
  <xsl:apply-templates/>
@@ -3149,7 +3300,7 @@
3149
3300
 
3150
3301
 
3151
3302
 
3152
- 10
3303
+ 9.5
3153
3304
 
3154
3305
 
3155
3306
  </xsl:variable>
@@ -3744,22 +3895,6 @@
3744
3895
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3745
3896
  <xsl:apply-templates/>
3746
3897
  </fo:inline>
3747
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3748
- <xsl:variable name="title-modified">
3749
-
3750
-
3751
- <xsl:call-template name="getTitle">
3752
- <xsl:with-param name="name" select="'title-modified'"/>
3753
- </xsl:call-template>
3754
-
3755
- </xsl:variable>
3756
-
3757
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3758
- <xsl:choose>
3759
- <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>
3760
- <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>
3761
- </xsl:choose>
3762
- <xsl:apply-templates/>
3763
3898
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3764
3899
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3765
3900
 
@@ -4330,12 +4465,12 @@
4330
4465
  </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">
4331
4466
  <xsl:apply-templates mode="contents"/>
4332
4467
  <xsl:text> </xsl:text>
4333
- </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">
4468
+ </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">
4334
4469
  <xsl:apply-templates mode="bookmarks"/>
4335
4470
  <xsl:text> </xsl:text>
4336
4471
  </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">
4337
4472
  <xsl:value-of select="."/>
4338
- </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">
4473
+ </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">
4339
4474
  <xsl:value-of select="."/>
4340
4475
  </xsl:template><xsl:template match="node()" mode="contents">
4341
4476
  <xsl:apply-templates mode="contents"/>
@@ -4638,6 +4773,8 @@
4638
4773
 
4639
4774
 
4640
4775
 
4776
+
4777
+
4641
4778
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4642
4779
  <xsl:variable name="_font-size">
4643
4780
 
@@ -4653,7 +4790,7 @@
4653
4790
 
4654
4791
 
4655
4792
 
4656
- 10
4793
+ 9.5
4657
4794
 
4658
4795
 
4659
4796
  </xsl:variable>
@@ -4671,13 +4808,17 @@
4671
4808
 
4672
4809
 
4673
4810
 
4811
+
4812
+
4674
4813
  <xsl:apply-templates/>
4675
4814
  </fo:block>
4676
-
4815
+
4677
4816
 
4678
4817
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4679
4818
 
4680
4819
 
4820
+
4821
+
4681
4822
  </fo:block-container>
4682
4823
  </fo:block-container>
4683
4824
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5034,62 +5175,69 @@
5034
5175
  <xsl:variable name="termsource_text">
5035
5176
  <xsl:apply-templates/>
5036
5177
  </xsl:variable>
5037
-
5038
- <xsl:choose>
5178
+ <xsl:copy-of select="$termsource_text"/>
5179
+ <!-- <xsl:choose>
5039
5180
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5040
- <!-- <xsl:apply-templates /> -->
5041
5181
  <xsl:copy-of select="$termsource_text"/>
5042
5182
  </xsl:when>
5043
5183
  <xsl:otherwise>
5044
-
5045
-
5184
+ <xsl:if test="$namespace = 'bsi'">
5185
+ <xsl:choose>
5186
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
5187
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
5188
+ </xsl:choose>
5189
+ </xsl:if>
5190
+ <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'">
5046
5191
  <xsl:text>[</xsl:text>
5047
-
5048
- <!-- <xsl:apply-templates /> -->
5192
+ </xsl:if>
5049
5193
  <xsl:copy-of select="$termsource_text"/>
5050
-
5051
-
5194
+ <xsl:if test="$namespace = 'bsi'">
5195
+ <xsl:choose>
5196
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
5197
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
5198
+ </xsl:choose>
5199
+ </xsl:if>
5200
+ <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'">
5052
5201
  <xsl:text>]</xsl:text>
5053
-
5202
+ </xsl:if>
5054
5203
  </xsl:otherwise>
5055
- </xsl:choose>
5204
+ </xsl:choose> -->
5056
5205
  </fo:block>
5057
5206
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5058
5207
  <xsl:if test="normalize-space() != ''">
5059
5208
  <xsl:value-of select="."/>
5060
5209
  </xsl:if>
5061
- </xsl:template><xsl:variable name="localized.source">
5062
- <xsl:call-template name="getLocalizedString">
5063
- <xsl:with-param name="key">source</xsl:with-param>
5064
- </xsl:call-template>
5065
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5210
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
5211
+ <fo:inline>
5212
+
5213
+
5214
+ <xsl:value-of select="."/>
5215
+ </fo:inline>
5216
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
5066
5217
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5067
5218
  <xsl:if test="normalize-space(@citeas) = ''">
5068
5219
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5069
5220
  </xsl:if>
5070
-
5071
-
5072
- <fo:inline>
5073
-
5074
-
5075
-
5076
-
5077
-
5078
-
5079
-
5080
- <xsl:call-template name="getTitle">
5081
- <xsl:with-param name="name" select="'title-source'"/>
5082
- </xsl:call-template>
5083
- <xsl:text>: </xsl:text>
5084
-
5085
-
5086
- </fo:inline>
5087
-
5088
5221
  <fo:inline xsl:use-attribute-sets="origin-style">
5089
5222
  <xsl:apply-templates/>
5090
5223
  </fo:inline>
5224
+ </fo:basic-link>
5225
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5226
+ <xsl:variable name="title-modified">
5091
5227
 
5092
- </fo:basic-link>
5228
+
5229
+ <xsl:call-template name="getTitle">
5230
+ <xsl:with-param name="name" select="'title-modified'"/>
5231
+ </xsl:call-template>
5232
+
5233
+ </xsl:variable>
5234
+
5235
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5236
+ <xsl:choose>
5237
+ <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>
5238
+ <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>
5239
+ </xsl:choose>
5240
+ <xsl:apply-templates/>
5093
5241
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5094
5242
  <fo:inline><xsl:apply-templates/></fo:inline>
5095
5243
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5278,24 +5426,29 @@
5278
5426
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5279
5427
  <xsl:variable name="title-deprecated">
5280
5428
 
5281
-
5282
- <xsl:call-template name="getTitle">
5283
- <xsl:with-param name="name" select="'title-deprecated'"/>
5429
+ <xsl:call-template name="getLocalizedString">
5430
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5284
5431
  </xsl:call-template>
5285
5432
 
5433
+
5286
5434
  </xsl:variable>
5287
5435
  <fo:block xsl:use-attribute-sets="deprecates-style">
5288
5436
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
5289
5437
  </fo:block>
5438
+ </xsl:template><xsl:template name="setStyle_preferred">
5439
+ <xsl:if test="*[local-name() = 'strong']">
5440
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5441
+ </xsl:if>
5290
5442
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5291
5443
  <fo:block xsl:use-attribute-sets="definition-style">
5292
5444
  <xsl:apply-templates/>
5293
5445
  </fo:block>
5294
5446
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
5295
5447
  <xsl:apply-templates/>
5296
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5448
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
5297
5449
  <fo:inline> <xsl:apply-templates/></fo:inline>
5298
- <fo:block> </fo:block>
5450
+ <!-- <fo:block>&#xA0;</fo:block> -->
5451
+ <fo:block/>
5299
5452
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
5300
5453
 
5301
5454
  <fo:block>
@@ -5834,7 +5987,31 @@
5834
5987
  <fo:block-container border="1pt solid black" width="50%">
5835
5988
  <fo:block> </fo:block>
5836
5989
  </fo:block-container>
5837
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5990
+ </xsl:template><xsl:variable name="toc_level">
5991
+ <xsl:choose>
5992
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5993
+ <xsl:otherwise><!-- default value -->
5994
+
5995
+
5996
+
5997
+
5998
+
5999
+
6000
+
6001
+
6002
+
6003
+
6004
+
6005
+
6006
+
6007
+
6008
+ 3
6009
+
6010
+
6011
+
6012
+ </xsl:otherwise>
6013
+ </xsl:choose>
6014
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5838
6015
  <xsl:param name="colwidths"/>
5839
6016
  <xsl:variable name="colwidths_">
5840
6017
  <xsl:choose>
@@ -6369,12 +6546,15 @@
6369
6546
  <xsl:param name="default">left</xsl:param>
6370
6547
  <xsl:attribute name="text-align">
6371
6548
  <xsl:choose>
6372
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
6549
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
6373
6550
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
6374
6551
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
6375
6552
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
6376
6553
  </xsl:choose>
6377
6554
  </xsl:attribute>
6555
+ <xsl:if test="@align = 'indent'">
6556
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
6557
+ </xsl:if>
6378
6558
  </xsl:template><xsl:template name="number-to-words">
6379
6559
  <xsl:param name="number"/>
6380
6560
  <xsl:param name="first"/>
@@ -6471,4 +6651,14 @@
6471
6651
  </xsl:otherwise>
6472
6652
  </xsl:choose>
6473
6653
  </xsl:if>
6654
+ </xsl:template><xsl:template name="setAltText">
6655
+ <xsl:param name="value"/>
6656
+ <xsl:attribute name="fox:alt-text">
6657
+ <xsl:choose>
6658
+ <xsl:when test="normalize-space($value) != ''">
6659
+ <xsl:value-of select="$value"/>
6660
+ </xsl:when>
6661
+ <xsl:otherwise>_</xsl:otherwise>
6662
+ </xsl:choose>
6663
+ </xsl:attribute>
6474
6664
  </xsl:template></xsl:stylesheet>
@@ -13,9 +13,10 @@ module IsoDoc
13
13
  end
14
14
 
15
15
  def insert_preface_sections(docxml)
16
- insert_keywords(docxml)
16
+ insert_executivesummary(docxml)
17
17
  insert_submitting_orgs(docxml)
18
18
  insert_security(docxml)
19
+ insert_keywords(docxml)
19
20
  end
20
21
 
21
22
  def preface_init_insert_pt(docxml)
@@ -42,6 +43,17 @@ module IsoDoc
42
43
  end
43
44
  end
44
45
 
46
+ def insert_executivesummary(docxml)
47
+ s = docxml&.at(ns("//preface/clause[@type = 'executivesummary']"))
48
+ &.remove or return
49
+ if a = docxml.at(ns("//preface/abstract"))
50
+ a.next = s
51
+ else
52
+ preface_init_insert_pt(docxml)&.children&.first
53
+ &.add_previous_sibling(s)
54
+ end
55
+ end
56
+
45
57
  def insert_submitting_orgs(docxml)
46
58
  orgs = docxml.xpath(ns(submittingorgs_path))
47
59
  .each_with_object([]) do |org, m|
@@ -81,7 +93,9 @@ module IsoDoc
81
93
  def insert_keywords(docxml)
82
94
  kw = @meta.get[:keywords]
83
95
  kw.empty? and return
84
- if abstract = docxml.at(ns("//preface/abstract"))
96
+ if abstract =
97
+ docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
98
+ docxml.at(ns("//preface/abstract"))
85
99
  abstract.next = keyword_clause(kw)
86
100
  else
87
101
  preface_init_insert_pt(docxml)&.children&.first
@@ -157,6 +171,7 @@ module IsoDoc
157
171
  def block(docxml)
158
172
  super
159
173
  recommendation_to_table(docxml)
174
+ ol docxml
160
175
  end
161
176
 
162
177
  def section(docxml)
@@ -184,6 +199,28 @@ module IsoDoc
184
199
  super
185
200
  end
186
201
 
202
+ def ol(docxml)
203
+ docxml.xpath(ns("//ol")).each do |f|
204
+ ol1(f)
205
+ end
206
+ end
207
+
208
+ def ol1(elem)
209
+ return unless elem["class"] == "steps"
210
+
211
+ idx = elem.xpath("./ancestor-or-self::xmlns:ol[@class = 'steps']").size
212
+ elem["type"] = %w(arabic alphabet roman alphabet_upper
213
+ roman_upper)[(idx - 1) % 5]
214
+ end
215
+
216
+ def termsource1(elem)
217
+ while elem&.next_element&.name == "termsource"
218
+ elem << "; #{elem.next_element.remove.children.to_xml}"
219
+ end
220
+ elem.children = l10n("[<strong>#{@i18n.source}:</strong> "\
221
+ "#{elem.children.to_xml.strip}]")
222
+ end
223
+
187
224
  include Init
188
225
  end
189
226
  end