metanorma-iso 1.10.3 → 1.10.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
12
+ <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"/>
13
13
 
14
14
  <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
15
15
 
@@ -1686,69 +1686,19 @@
1686
1686
  <xsl:template match="iso:li//iso:p//text()">
1687
1687
  <xsl:choose>
1688
1688
  <xsl:when test="contains(., '&#9;')">
1689
+ <!-- <fo:inline white-space="pre"><xsl:value-of select="translate(., $thinspace, ' ')"/></fo:inline> -->
1689
1690
  <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
1690
1691
  </xsl:when>
1691
1692
  <xsl:otherwise>
1693
+ <!-- <xsl:value-of select="translate(., $thinspace, ' ')"/> -->
1692
1694
  <xsl:value-of select="."/>
1693
1695
  </xsl:otherwise>
1694
1696
  </xsl:choose>
1695
1697
 
1696
1698
  </xsl:template>
1697
1699
 
1698
- <!--
1699
- <fn reference="1">
1700
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1701
- </fn>
1702
- -->
1703
1700
 
1704
- <xsl:variable name="p_fn">
1705
- <xsl:for-each select="//iso:p/iso:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
1706
- <!-- copy unique fn -->
1707
- <fn gen_id="{generate-id(.)}">
1708
- <xsl:copy-of select="@*"/>
1709
- <xsl:copy-of select="node()"/>
1710
- </fn>
1711
- </xsl:for-each>
1712
- </xsl:variable>
1713
1701
 
1714
- <xsl:template match="iso:p/iso:fn" priority="2">
1715
- <xsl:variable name="gen_id" select="generate-id(.)"/>
1716
- <xsl:variable name="reference" select="@reference"/>
1717
- <xsl:variable name="number">
1718
- <!-- <xsl:number level="any" count="iso:p/iso:fn"/> -->
1719
- <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
1720
- </xsl:variable>
1721
- <xsl:choose>
1722
- <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
1723
- <fo:footnote>
1724
- <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
1725
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1726
- <!-- <xsl:value-of select="@reference"/> -->
1727
- <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@normative='true']]/iso:note)"/><xsl:text>)</xsl:text>
1728
- </fo:basic-link>
1729
- </fo:inline>
1730
- <fo:footnote-body>
1731
- <fo:block font-size="10pt" margin-bottom="12pt">
1732
- <fo:inline id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
1733
- <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@normative='true']]/iso:note)"/><xsl:text>)</xsl:text>
1734
- </fo:inline>
1735
- <xsl:for-each select="iso:p">
1736
- <xsl:apply-templates/>
1737
- </xsl:for-each>
1738
- </fo:block>
1739
- </fo:footnote-body>
1740
- </fo:footnote>
1741
- </xsl:when>
1742
- <xsl:otherwise>
1743
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1744
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1745
- <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/>
1746
- </fo:basic-link>
1747
- </fo:inline>
1748
- </xsl:otherwise>
1749
- </xsl:choose>
1750
- </xsl:template>
1751
-
1752
1702
  <xsl:template match="iso:p/iso:fn/iso:p">
1753
1703
  <xsl:apply-templates/>
1754
1704
  </xsl:template>
@@ -2011,6 +1961,11 @@
2011
1961
  <!-- End of Index processing -->
2012
1962
  <!-- =================== -->
2013
1963
 
1964
+ <!-- <xsl:variable name="thinspace" select="'&#x2009;'"/>
1965
+ <xsl:template match="text()[contains(., $thinspace)]">
1966
+ <xsl:value-of select="translate(., $thinspace, ' ')"/>
1967
+ </xsl:template> -->
1968
+
2014
1969
 
2015
1970
  <xsl:template name="insertHeaderFooter">
2016
1971
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2741,6 +2696,76 @@
2741
2696
 
2742
2697
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2743
2698
  <xsl:attribute name="line-height">135%</xsl:attribute>
2699
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2700
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2701
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2702
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2703
+
2704
+
2705
+
2706
+
2707
+
2708
+
2709
+
2710
+
2711
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2712
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2713
+
2714
+
2715
+
2716
+
2717
+
2718
+
2719
+
2720
+
2721
+
2722
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2723
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2724
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2725
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2726
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2727
+
2728
+
2729
+
2730
+
2731
+
2732
+
2733
+
2734
+
2735
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2736
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2737
+
2738
+
2739
+
2740
+
2741
+
2742
+
2743
+
2744
+
2745
+
2746
+
2747
+
2748
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2749
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2750
+
2751
+
2752
+
2753
+
2754
+
2755
+
2756
+
2757
+
2758
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
2759
+
2760
+
2761
+
2762
+
2763
+
2764
+
2765
+
2766
+
2767
+
2768
+
2744
2769
  </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">
2745
2770
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2746
2771
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -3783,6 +3808,104 @@
3783
3808
 
3784
3809
  </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">
3785
3810
  <xsl:apply-templates/>
3811
+ </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">
3812
+
3813
+ <!-- list of footnotes to calculate actual footnotes number -->
3814
+ <xsl:variable name="p_fn_">
3815
+ <xsl:choose>
3816
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3817
+ <fn gen_id="{generate-id(.)}">
3818
+ <xsl:copy-of select="@*"/>
3819
+ <xsl:copy-of select="node()"/>
3820
+ </fn>
3821
+ </xsl:when>
3822
+ <xsl:otherwise>
3823
+ <!-- itetation for:
3824
+ footnotes in bibdata/title
3825
+ footnotes in bibliography
3826
+ footnotes in document's body (except table's head/body/foot and figure text)
3827
+ -->
3828
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3829
+ <fn gen_id="{generate-id(.)}">
3830
+ <xsl:copy-of select="@*"/>
3831
+ <xsl:copy-of select="node()"/>
3832
+ </fn>
3833
+ </xsl:for-each>
3834
+ <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']/*">
3835
+ <xsl:sort select="@displayorder" data-type="number"/>
3836
+ <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])]">
3837
+ <!-- copy unique fn -->
3838
+ <fn gen_id="{generate-id(.)}">
3839
+ <xsl:copy-of select="@*"/>
3840
+ <xsl:copy-of select="node()"/>
3841
+ </fn>
3842
+ </xsl:for-each>
3843
+ </xsl:for-each>
3844
+ </xsl:otherwise>
3845
+ </xsl:choose>
3846
+ </xsl:variable>
3847
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3848
+
3849
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3850
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3851
+ <xsl:variable name="reference" select="@reference"/>
3852
+ <!-- fn sequence number in document -->
3853
+ <xsl:variable name="current_fn_number">
3854
+ <xsl:choose>
3855
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3856
+ <xsl:otherwise>
3857
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3858
+ </xsl:otherwise>
3859
+ </xsl:choose>
3860
+ </xsl:variable>
3861
+ <xsl:variable name="current_fn_number_text">
3862
+ <xsl:value-of select="$current_fn_number"/>
3863
+
3864
+
3865
+ <xsl:text>)</xsl:text>
3866
+
3867
+ </xsl:variable>
3868
+
3869
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3870
+ <xsl:variable name="footnote_inline">
3871
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3872
+
3873
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3874
+ <xsl:value-of select="$current_fn_number_text"/>
3875
+ </fo:basic-link>
3876
+ </fo:inline>
3877
+ </xsl:variable>
3878
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3879
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3880
+ <xsl:choose>
3881
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3882
+ <xsl:copy-of select="$footnote_inline"/>
3883
+ </xsl:when>
3884
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3885
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3886
+ <xsl:copy-of select="$footnote_inline"/>
3887
+ <fo:footnote-body>
3888
+
3889
+ <fo:block-container text-indent="0" start-indent="0">
3890
+
3891
+
3892
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3893
+
3894
+
3895
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3896
+
3897
+ <xsl:value-of select="$current_fn_number_text"/>
3898
+ </fo:inline>
3899
+ <xsl:apply-templates/>
3900
+ </fo:block>
3901
+ </fo:block-container>
3902
+ </fo:footnote-body>
3903
+ </fo:footnote>
3904
+ </xsl:when>
3905
+ <xsl:otherwise>
3906
+ <xsl:copy-of select="$footnote_inline"/>
3907
+ </xsl:otherwise>
3908
+ </xsl:choose>
3786
3909
  </xsl:template><xsl:template name="fn_display">
3787
3910
  <xsl:variable name="references">
3788
3911
 
@@ -3984,6 +4107,8 @@
3984
4107
 
3985
4108
  </fo:basic-link>
3986
4109
  </fo:inline>
4110
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4111
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3987
4112
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3988
4113
  <fo:inline>
3989
4114
  <xsl:apply-templates/>
@@ -4997,22 +5122,6 @@
4997
5122
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4998
5123
  <xsl:apply-templates/>
4999
5124
  </fo:inline>
5000
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
5001
- <xsl:variable name="title-modified">
5002
-
5003
- <xsl:call-template name="getLocalizedString">
5004
- <xsl:with-param name="key">modified</xsl:with-param>
5005
- </xsl:call-template>
5006
-
5007
-
5008
- </xsl:variable>
5009
-
5010
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5011
- <xsl:choose>
5012
- <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>
5013
- <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>
5014
- </xsl:choose>
5015
- <xsl:apply-templates/>
5016
5125
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5017
5126
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5018
5127
 
@@ -6253,60 +6362,69 @@
6253
6362
  <xsl:variable name="termsource_text">
6254
6363
  <xsl:apply-templates/>
6255
6364
  </xsl:variable>
6256
-
6257
- <xsl:choose>
6365
+ <xsl:copy-of select="$termsource_text"/>
6366
+ <!-- <xsl:choose>
6258
6367
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6259
- <!-- <xsl:apply-templates /> -->
6260
6368
  <xsl:copy-of select="$termsource_text"/>
6261
6369
  </xsl:when>
6262
6370
  <xsl:otherwise>
6263
-
6264
-
6371
+ <xsl:if test="$namespace = 'bsi'">
6372
+ <xsl:choose>
6373
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6374
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6375
+ </xsl:choose>
6376
+ </xsl:if>
6377
+ <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'">
6265
6378
  <xsl:text>[</xsl:text>
6266
-
6267
- <!-- <xsl:apply-templates /> -->
6379
+ </xsl:if>
6268
6380
  <xsl:copy-of select="$termsource_text"/>
6269
-
6270
-
6381
+ <xsl:if test="$namespace = 'bsi'">
6382
+ <xsl:choose>
6383
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6384
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6385
+ </xsl:choose>
6386
+ </xsl:if>
6387
+ <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'">
6271
6388
  <xsl:text>]</xsl:text>
6272
-
6389
+ </xsl:if>
6273
6390
  </xsl:otherwise>
6274
- </xsl:choose>
6391
+ </xsl:choose> -->
6275
6392
  </fo:block>
6276
6393
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6277
6394
  <xsl:if test="normalize-space() != ''">
6278
6395
  <xsl:value-of select="."/>
6279
6396
  </xsl:if>
6280
- </xsl:template><xsl:variable name="localized.source">
6281
- <xsl:call-template name="getLocalizedString">
6282
- <xsl:with-param name="key">source</xsl:with-param>
6283
- </xsl:call-template>
6284
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6397
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6398
+ <fo:inline>
6399
+
6400
+
6401
+ <xsl:value-of select="."/>
6402
+ </fo:inline>
6403
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6285
6404
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6286
6405
  <xsl:if test="normalize-space(@citeas) = ''">
6287
6406
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6288
6407
  </xsl:if>
6289
-
6290
-
6291
- <fo:inline>
6292
-
6293
-
6294
-
6295
-
6296
-
6297
- <xsl:value-of select="$localized.source"/>
6298
- <xsl:text>: </xsl:text>
6299
-
6300
-
6301
-
6302
-
6303
- </fo:inline>
6304
-
6305
6408
  <fo:inline xsl:use-attribute-sets="origin-style">
6306
6409
  <xsl:apply-templates/>
6307
6410
  </fo:inline>
6411
+ </fo:basic-link>
6412
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6413
+ <xsl:variable name="title-modified">
6308
6414
 
6309
- </fo:basic-link>
6415
+ <xsl:call-template name="getLocalizedString">
6416
+ <xsl:with-param name="key">modified</xsl:with-param>
6417
+ </xsl:call-template>
6418
+
6419
+
6420
+ </xsl:variable>
6421
+
6422
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6423
+ <xsl:choose>
6424
+ <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>
6425
+ <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>
6426
+ </xsl:choose>
6427
+ <xsl:apply-templates/>
6310
6428
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6311
6429
  <fo:inline><xsl:apply-templates/></fo:inline>
6312
6430
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6935,7 +7053,31 @@
6935
7053
  <fo:block-container border="1pt solid black" width="50%">
6936
7054
  <fo:block> </fo:block>
6937
7055
  </fo:block-container>
6938
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
7056
+ </xsl:template><xsl:variable name="toc_level">
7057
+ <xsl:choose>
7058
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
7059
+ <xsl:otherwise><!-- default value -->
7060
+
7061
+
7062
+
7063
+
7064
+
7065
+
7066
+
7067
+
7068
+
7069
+
7070
+
7071
+
7072
+
7073
+
7074
+
7075
+
7076
+
7077
+
7078
+ </xsl:otherwise>
7079
+ </xsl:choose>
7080
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6939
7081
  <xsl:param name="colwidths"/>
6940
7082
  <xsl:variable name="colwidths_">
6941
7083
  <xsl:choose>
@@ -7575,4 +7717,14 @@
7575
7717
  </xsl:otherwise>
7576
7718
  </xsl:choose>
7577
7719
  </xsl:if>
7720
+ </xsl:template><xsl:template name="setAltText">
7721
+ <xsl:param name="value"/>
7722
+ <xsl:attribute name="fox:alt-text">
7723
+ <xsl:choose>
7724
+ <xsl:when test="normalize-space($value) != ''">
7725
+ <xsl:value-of select="$value"/>
7726
+ </xsl:when>
7727
+ <xsl:otherwise>_</xsl:otherwise>
7728
+ </xsl:choose>
7729
+ </xsl:attribute>
7578
7730
  </xsl:template></xsl:stylesheet>