metanorma-iec 1.4.3 → 1.4.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
  <xsl:param name="additionalXMLs" select="''"/> <!-- iec-rice.fr.xml -->
@@ -137,6 +139,7 @@
137
139
  <contents>
138
140
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
139
141
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
142
+ <xsl:apply-templates select="//iec:indexsect" mode="contents"/>
140
143
  <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name']]">
141
144
  <figure id="{@id}">
142
145
  <title><xsl:value-of select="*[local-name() = 'name']/text()"/></title>
@@ -157,6 +160,8 @@
157
160
  <xsl:call-template name="getLang"/>
158
161
  </xsl:variable>
159
162
 
163
+ <xsl:variable name="isIEV" select="normalize-space((//iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-main'] = 'International Electrotechnical Vocabulary') and 1 = 1)"/>
164
+
160
165
  <xsl:template match="/">
161
166
  <xsl:call-template name="namespaceCheck"/>
162
167
  <!-- https://stackoverflow.com/questions/25261949/xsl-fo-letter-spacing-with-text-align -->
@@ -1088,6 +1093,9 @@
1088
1093
  <xsl:if test="$num = '1'">
1089
1094
  <xsl:attribute name="initial-page-number">2</xsl:attribute>
1090
1095
  </xsl:if>
1096
+ <xsl:if test="$isIEV = 'true'">
1097
+ <xsl:attribute name="format">I</xsl:attribute>
1098
+ </xsl:if>
1091
1099
 
1092
1100
  <xsl:call-template name="insertHeaderFooter"/>
1093
1101
  <fo:flow flow-name="xsl-region-body">
@@ -1445,9 +1453,12 @@
1445
1453
  <xsl:if test="@level = 2">
1446
1454
  <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
1447
1455
  </xsl:if>
1448
- <xsl:if test="@level = 3">
1456
+ <xsl:if test="@level &gt;= 3">
1449
1457
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1450
1458
  </xsl:if>
1459
+ <xsl:if test="@type = 'indexsect'">
1460
+ <xsl:attribute name="space-before">16pt</xsl:attribute>
1461
+ </xsl:if>
1451
1462
  <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
1452
1463
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
1453
1464
  </xsl:if> -->
@@ -1458,7 +1469,7 @@
1458
1469
  <xsl:attribute name="margin-left">
1459
1470
  <xsl:choose>
1460
1471
  <xsl:when test="@level = 2">8mm</xsl:when>
1461
- <xsl:when test="@level = 3">23mm</xsl:when>
1472
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1462
1473
  <xsl:otherwise>0mm</xsl:otherwise>
1463
1474
  </xsl:choose>
1464
1475
  </xsl:attribute>
@@ -1467,7 +1478,7 @@
1467
1478
  <xsl:when test="@section = ''">0mm</xsl:when>
1468
1479
  <xsl:when test="@level = 1">8mm</xsl:when>
1469
1480
  <xsl:when test="@level = 2">15mm</xsl:when>
1470
- <xsl:when test="@level = 3">19mm</xsl:when>
1481
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 19"/>mm</xsl:when>
1471
1482
  <xsl:otherwise>0mm</xsl:otherwise>
1472
1483
  </xsl:choose>
1473
1484
  </xsl:attribute>
@@ -1570,7 +1581,10 @@
1570
1581
  <xsl:template name="insertBodypages">
1571
1582
  <xsl:param name="lang" select="'en'"/>
1572
1583
  <!-- BODY -->
1573
- <fo:page-sequence master-reference="document" force-page-count="no-force">
1584
+ <fo:page-sequence master-reference="document" force-page-count="no-force">
1585
+ <xsl:if test="$isIEV = 'true'">
1586
+ <xsl:attribute name="initial-page-number">1</xsl:attribute>
1587
+ </xsl:if>
1574
1588
  <fo:static-content flow-name="xsl-footnote-separator">
1575
1589
  <fo:block>
1576
1590
  <fo:leader leader-pattern="rule" leader-length="30%"/>
@@ -1612,6 +1626,10 @@
1612
1626
 
1613
1627
  </fo:flow>
1614
1628
  </fo:page-sequence>
1629
+
1630
+ <!-- Index -->
1631
+ <xsl:apply-templates select="//iec:indexsect" mode="index"/>
1632
+
1615
1633
  </xsl:template>
1616
1634
 
1617
1635
 
@@ -1712,7 +1730,7 @@
1712
1730
 
1713
1731
  <xsl:variable name="display">
1714
1732
  <xsl:choose>
1715
- <xsl:when test="$level &gt; 3">false</xsl:when>
1733
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
1716
1734
  <xsl:when test="$section = '' and $type = 'clause'">false</xsl:when><!-- don't show clause with number only in title -->
1717
1735
  <xsl:otherwise>true</xsl:otherwise>
1718
1736
  </xsl:choose>
@@ -1737,9 +1755,15 @@
1737
1755
  <xsl:if test="$type ='appendix'">
1738
1756
  <xsl:attribute name="section"/>
1739
1757
  </xsl:if>
1758
+ <xsl:if test="$type ='indexsect'">
1759
+ <xsl:attribute name="level">1</xsl:attribute>
1760
+ </xsl:if>
1740
1761
  <title>
1741
1762
  <xsl:choose>
1742
- <xsl:when test="$type = 'foreword' or $type = 'introduction'">
1763
+ <!-- <xsl:when test="$type = 'foreword' or $type = 'introduction'">
1764
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title))"/>
1765
+ </xsl:when> -->
1766
+ <xsl:when test="$type = 'indexsect'">
1743
1767
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title))"/>
1744
1768
  </xsl:when>
1745
1769
  <xsl:when test="$type = 'appendix'">
@@ -1750,7 +1774,9 @@
1750
1774
  </xsl:otherwise>
1751
1775
  </xsl:choose>
1752
1776
  </title>
1753
- <xsl:apply-templates mode="contents"/>
1777
+ <xsl:if test="$type != 'indexsect'">
1778
+ <xsl:apply-templates mode="contents"/>
1779
+ </xsl:if>
1754
1780
  </item>
1755
1781
 
1756
1782
  </xsl:if>
@@ -1850,7 +1876,8 @@
1850
1876
  <xsl:template match="iec:iec-standard/iec:preface/iec:foreword" priority="3">
1851
1877
  <fo:block id="{@id}" margin-bottom="12pt" font-size="12pt" text-align="center">
1852
1878
  <xsl:call-template name="addLetterSpacing">
1853
- <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(iec:title))"/>
1879
+ <!-- <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(iec:title))"/> -->
1880
+ <xsl:with-param name="text" select="iec:title"/>
1854
1881
  </xsl:call-template>
1855
1882
  </fo:block>
1856
1883
  <fo:block font-size="8.2pt" text-align="justify"> <!-- margin-left="6.3mm" -->
@@ -1910,7 +1937,8 @@
1910
1937
  </xsl:template>
1911
1938
  <xsl:template match="iec:introduction/iec:title/text()">
1912
1939
  <xsl:call-template name="addLetterSpacing">
1913
- <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(.))"/>
1940
+ <!-- <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(.))"/> -->
1941
+ <xsl:with-param name="text" select="."/>
1914
1942
  </xsl:call-template>
1915
1943
  </xsl:template>
1916
1944
 
@@ -2052,37 +2080,6 @@
2052
2080
  </xsl:if> -->
2053
2081
  </xsl:template>
2054
2082
 
2055
- <!--
2056
- <fn reference="1">
2057
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
2058
- </fn>
2059
- -->
2060
- <xsl:template match="iec:p/iec:fn" priority="2">
2061
- <fo:footnote>
2062
- <xsl:variable name="number">
2063
- <xsl:number level="any" count="iec:p/iec:fn"/>
2064
- </xsl:variable>
2065
- <xsl:variable name="lang">
2066
- <xsl:call-template name="getLang"/>
2067
- </xsl:variable>
2068
- <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="15%"> <!-- font-size="80%" vertical-align="super"-->
2069
- <fo:basic-link internal-destination="{$lang}_footnote_{@reference}" fox:alt-text="footnote {@reference}">
2070
- <!-- <xsl:value-of select="@reference"/> -->
2071
- <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
2072
- </fo:basic-link>
2073
- </fo:inline>
2074
- <fo:footnote-body>
2075
- <fo:block font-size="8pt" margin-bottom="5pt">
2076
- <fo:inline id="{$lang}_footnote_{@reference}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"> <!-- padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
2077
- <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
2078
- </fo:inline>
2079
- <!-- <xsl:for-each select="iec:p"> -->
2080
- <xsl:apply-templates/>
2081
- <!-- </xsl:for-each> -->
2082
- </fo:block>
2083
- </fo:footnote-body>
2084
- </fo:footnote>
2085
- </xsl:template>
2086
2083
 
2087
2084
  <xsl:template match="iec:p/iec:fn/iec:p">
2088
2085
  <xsl:apply-templates/>
@@ -2222,9 +2219,11 @@
2222
2219
  <xsl:call-template name="getLevelTermName"/>
2223
2220
  </xsl:variable>
2224
2221
  <fo:block line-height="1.1" space-before="14pt" role="H{$levelTerm}">
2225
- <fo:block font-weight="bold" keep-with-next="always">
2226
- <xsl:apply-templates select="ancestor::iec:term[1]/iec:name" mode="presentation"/>
2227
- </fo:block>
2222
+ <xsl:if test="parent::iec:term">
2223
+ <fo:block font-weight="bold" keep-with-next="always">
2224
+ <xsl:apply-templates select="ancestor::iec:term[1]/iec:name" mode="presentation"/>
2225
+ </fo:block>
2226
+ </xsl:if>
2228
2227
  <fo:block font-weight="bold" keep-with-next="always">
2229
2228
  <xsl:call-template name="setStyle_preferred"/>
2230
2229
  <xsl:apply-templates/>
@@ -2336,7 +2335,63 @@
2336
2335
  </fo:block>
2337
2336
  </xsl:template>
2338
2337
 
2338
+ <!-- =================== -->
2339
+ <!-- Index processing -->
2340
+ <!-- =================== -->
2341
+
2342
+ <xsl:template match="iec:indexsect"/>
2343
+ <xsl:template match="iec:indexsect" mode="index">
2344
+
2345
+ <fo:page-sequence master-reference="document" force-page-count="no-force">
2346
+ <xsl:call-template name="insertHeaderFooter"/>
2347
+ <fo:flow flow-name="xsl-region-body">
2348
+ <fo:block id="{@id}" span="all">
2349
+ <xsl:apply-templates select="iec:title"/>
2350
+ </fo:block>
2351
+ <fo:block role="Index">
2352
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2353
+ </fo:block>
2354
+ </fo:flow>
2355
+ </fo:page-sequence>
2356
+ </xsl:template>
2357
+
2358
+ <xsl:template match="iec:indexsect/iec:title" priority="4">
2359
+ <fo:block font-size="12pt" font-weight="bold" margin-bottom="84pt" role="H1">
2360
+ <!-- Index -->
2361
+ <xsl:apply-templates/>
2362
+ </fo:block>
2363
+ </xsl:template>
2364
+
2365
+ <xsl:template match="iec:indexsect/iec:title/text()" priority="4">
2366
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
2367
+ </xsl:template>
2339
2368
 
2369
+ <xsl:template match="iec:indexsect/iec:clause/iec:title" priority="4">
2370
+ <!-- Letter A, B, C, ... -->
2371
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2372
+ <xsl:apply-templates/>
2373
+ </fo:block>
2374
+ </xsl:template>
2375
+
2376
+ <xsl:template match="iec:indexsect//iec:li/text()">
2377
+ <!-- to split by '_' and other chars -->
2378
+ <xsl:call-template name="add-zero-spaces-java"/>
2379
+ </xsl:template>
2380
+
2381
+ <xsl:template match="iec:xref[@pagenumber = 'true']" priority="2">
2382
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2383
+ <fo:inline>
2384
+ <xsl:if test="@id">
2385
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2386
+ </xsl:if>
2387
+ <fo:page-number-citation ref-id="{@target}"/>
2388
+ </fo:inline>
2389
+ </fo:basic-link>
2390
+ </xsl:template>
2391
+
2392
+ <!-- =================== -->
2393
+ <!-- End of Index processing -->
2394
+ <!-- =================== -->
2340
2395
 
2341
2396
  <xsl:template name="insertHeaderFooter">
2342
2397
  <fo:static-content flow-name="header-even" role="artifact">
@@ -3059,6 +3114,77 @@
3059
3114
 
3060
3115
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
3061
3116
  <xsl:attribute name="line-height">135%</xsl:attribute>
3117
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
3118
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3119
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
3120
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3121
+
3122
+
3123
+
3124
+
3125
+
3126
+
3127
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
3128
+ <xsl:attribute name="baseline-shift">15%</xsl:attribute>
3129
+
3130
+
3131
+
3132
+
3133
+
3134
+
3135
+
3136
+
3137
+
3138
+
3139
+
3140
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
3141
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
3142
+ <xsl:attribute name="font-style">normal</xsl:attribute>
3143
+ <xsl:attribute name="text-indent">0</xsl:attribute>
3144
+ <xsl:attribute name="start-indent">0</xsl:attribute>
3145
+
3146
+
3147
+
3148
+
3149
+
3150
+
3151
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
3152
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
3153
+
3154
+
3155
+
3156
+
3157
+
3158
+
3159
+
3160
+
3161
+
3162
+
3163
+
3164
+
3165
+
3166
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
3167
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
3168
+
3169
+
3170
+
3171
+
3172
+
3173
+
3174
+ <xsl:attribute name="baseline-shift">15%</xsl:attribute>
3175
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
3176
+
3177
+
3178
+
3179
+
3180
+
3181
+
3182
+
3183
+
3184
+
3185
+
3186
+
3187
+
3062
3188
  </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">
3063
3189
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3064
3190
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -4049,6 +4175,102 @@
4049
4175
 
4050
4176
  </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">
4051
4177
  <xsl:apply-templates/>
4178
+ </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">
4179
+
4180
+ <!-- list of footnotes to calculate actual footnotes number -->
4181
+ <xsl:variable name="p_fn_">
4182
+ <xsl:choose>
4183
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4184
+ <fn gen_id="{generate-id(.)}">
4185
+ <xsl:copy-of select="@*"/>
4186
+ <xsl:copy-of select="node()"/>
4187
+ </fn>
4188
+ </xsl:when>
4189
+ <xsl:otherwise>
4190
+ <!-- itetation for:
4191
+ footnotes in bibdata/title
4192
+ footnotes in bibliography
4193
+ footnotes in document's body (except table's head/body/foot and figure text)
4194
+ -->
4195
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4196
+ <fn gen_id="{generate-id(.)}">
4197
+ <xsl:copy-of select="@*"/>
4198
+ <xsl:copy-of select="node()"/>
4199
+ </fn>
4200
+ </xsl:for-each>
4201
+ <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']/*">
4202
+ <xsl:sort select="@displayorder" data-type="number"/>
4203
+ <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])]">
4204
+ <!-- copy unique fn -->
4205
+ <fn gen_id="{generate-id(.)}">
4206
+ <xsl:copy-of select="@*"/>
4207
+ <xsl:copy-of select="node()"/>
4208
+ </fn>
4209
+ </xsl:for-each>
4210
+ </xsl:for-each>
4211
+ </xsl:otherwise>
4212
+ </xsl:choose>
4213
+ </xsl:variable>
4214
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4215
+
4216
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
4217
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4218
+ <xsl:variable name="reference" select="@reference"/>
4219
+ <!-- fn sequence number in document -->
4220
+ <xsl:variable name="current_fn_number">
4221
+ <xsl:choose>
4222
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
4223
+ <xsl:otherwise>
4224
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
4225
+ </xsl:otherwise>
4226
+ </xsl:choose>
4227
+ </xsl:variable>
4228
+ <xsl:variable name="current_fn_number_text">
4229
+ <xsl:value-of select="$current_fn_number"/>
4230
+
4231
+
4232
+ </xsl:variable>
4233
+
4234
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4235
+ <xsl:variable name="footnote_inline">
4236
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
4237
+
4238
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4239
+ <xsl:value-of select="$current_fn_number_text"/>
4240
+ </fo:basic-link>
4241
+ </fo:inline>
4242
+ </xsl:variable>
4243
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
4244
+ gen_id=<xsl:value-of select="$gen_id"/> -->
4245
+ <xsl:choose>
4246
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4247
+ <xsl:copy-of select="$footnote_inline"/>
4248
+ </xsl:when>
4249
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4250
+ <fo:footnote xsl:use-attribute-sets="fn-style">
4251
+ <xsl:copy-of select="$footnote_inline"/>
4252
+ <fo:footnote-body>
4253
+
4254
+ <fo:block-container text-indent="0" start-indent="0">
4255
+
4256
+
4257
+ <fo:block xsl:use-attribute-sets="fn-body-style">
4258
+
4259
+
4260
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
4261
+
4262
+ <xsl:value-of select="$current_fn_number_text"/>
4263
+ </fo:inline>
4264
+ <xsl:apply-templates/>
4265
+ </fo:block>
4266
+ </fo:block-container>
4267
+ </fo:footnote-body>
4268
+ </fo:footnote>
4269
+ </xsl:when>
4270
+ <xsl:otherwise>
4271
+ <xsl:copy-of select="$footnote_inline"/>
4272
+ </xsl:otherwise>
4273
+ </xsl:choose>
4052
4274
  </xsl:template><xsl:template name="fn_display">
4053
4275
  <xsl:variable name="references">
4054
4276
 
@@ -4262,6 +4484,8 @@
4262
4484
 
4263
4485
  </fo:basic-link>
4264
4486
  </fo:inline>
4487
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4488
+ <fo:inline><xsl:value-of select="."/></fo:inline>
4265
4489
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
4266
4490
  <fo:inline>
4267
4491
  <xsl:apply-templates/>
@@ -5276,22 +5500,6 @@
5276
5500
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
5277
5501
  <xsl:apply-templates/>
5278
5502
  </fo:inline>
5279
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
5280
- <xsl:variable name="title-modified">
5281
-
5282
-
5283
- <xsl:call-template name="getTitle">
5284
- <xsl:with-param name="name" select="'title-modified'"/>
5285
- </xsl:call-template>
5286
-
5287
- </xsl:variable>
5288
-
5289
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5290
- <xsl:choose>
5291
- <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>
5292
- <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>
5293
- </xsl:choose>
5294
- <xsl:apply-templates/>
5295
5503
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5296
5504
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5297
5505
 
@@ -6525,62 +6733,69 @@
6525
6733
  <xsl:variable name="termsource_text">
6526
6734
  <xsl:apply-templates/>
6527
6735
  </xsl:variable>
6528
-
6529
- <xsl:choose>
6736
+ <xsl:copy-of select="$termsource_text"/>
6737
+ <!-- <xsl:choose>
6530
6738
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6531
- <!-- <xsl:apply-templates /> -->
6532
6739
  <xsl:copy-of select="$termsource_text"/>
6533
6740
  </xsl:when>
6534
6741
  <xsl:otherwise>
6535
-
6536
-
6742
+ <xsl:if test="$namespace = 'bsi'">
6743
+ <xsl:choose>
6744
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6745
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6746
+ </xsl:choose>
6747
+ </xsl:if>
6748
+ <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'">
6537
6749
  <xsl:text>[</xsl:text>
6538
-
6539
- <!-- <xsl:apply-templates /> -->
6750
+ </xsl:if>
6540
6751
  <xsl:copy-of select="$termsource_text"/>
6541
-
6542
-
6752
+ <xsl:if test="$namespace = 'bsi'">
6753
+ <xsl:choose>
6754
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6755
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6756
+ </xsl:choose>
6757
+ </xsl:if>
6758
+ <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'">
6543
6759
  <xsl:text>]</xsl:text>
6544
-
6760
+ </xsl:if>
6545
6761
  </xsl:otherwise>
6546
- </xsl:choose>
6762
+ </xsl:choose> -->
6547
6763
  </fo:block>
6548
6764
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6549
6765
  <xsl:if test="normalize-space() != ''">
6550
6766
  <xsl:value-of select="."/>
6551
6767
  </xsl:if>
6552
- </xsl:template><xsl:variable name="localized.source">
6553
- <xsl:call-template name="getLocalizedString">
6554
- <xsl:with-param name="key">source</xsl:with-param>
6555
- </xsl:call-template>
6556
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6768
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6769
+ <fo:inline>
6770
+
6771
+
6772
+ <xsl:value-of select="."/>
6773
+ </fo:inline>
6774
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6557
6775
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6558
6776
  <xsl:if test="normalize-space(@citeas) = ''">
6559
6777
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6560
6778
  </xsl:if>
6561
-
6562
-
6563
- <fo:inline>
6564
-
6565
-
6566
-
6567
-
6568
-
6569
-
6570
-
6571
- <xsl:call-template name="getTitle">
6572
- <xsl:with-param name="name" select="'title-source'"/>
6573
- </xsl:call-template>
6574
- <xsl:text>: </xsl:text>
6575
-
6576
-
6577
- </fo:inline>
6578
-
6579
6779
  <fo:inline xsl:use-attribute-sets="origin-style">
6580
6780
  <xsl:apply-templates/>
6581
6781
  </fo:inline>
6782
+ </fo:basic-link>
6783
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6784
+ <xsl:variable name="title-modified">
6582
6785
 
6583
- </fo:basic-link>
6786
+
6787
+ <xsl:call-template name="getTitle">
6788
+ <xsl:with-param name="name" select="'title-modified'"/>
6789
+ </xsl:call-template>
6790
+
6791
+ </xsl:variable>
6792
+
6793
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6794
+ <xsl:choose>
6795
+ <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>
6796
+ <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>
6797
+ </xsl:choose>
6798
+ <xsl:apply-templates/>
6584
6799
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6585
6800
  <fo:inline><xsl:apply-templates/></fo:inline>
6586
6801
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -7180,7 +7395,31 @@
7180
7395
  <fo:block-container border="1pt solid black" width="50%">
7181
7396
  <fo:block> </fo:block>
7182
7397
  </fo:block-container>
7183
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
7398
+ </xsl:template><xsl:variable name="toc_level">
7399
+ <xsl:choose>
7400
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
7401
+ <xsl:otherwise><!-- default value -->
7402
+
7403
+
7404
+
7405
+
7406
+
7407
+ 3
7408
+
7409
+
7410
+
7411
+
7412
+
7413
+
7414
+
7415
+
7416
+
7417
+
7418
+
7419
+
7420
+ </xsl:otherwise>
7421
+ </xsl:choose>
7422
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
7184
7423
  <xsl:param name="colwidths"/>
7185
7424
  <xsl:variable name="colwidths_">
7186
7425
  <xsl:choose>
@@ -7820,4 +8059,14 @@
7820
8059
  </xsl:otherwise>
7821
8060
  </xsl:choose>
7822
8061
  </xsl:if>
8062
+ </xsl:template><xsl:template name="setAltText">
8063
+ <xsl:param name="value"/>
8064
+ <xsl:attribute name="fox:alt-text">
8065
+ <xsl:choose>
8066
+ <xsl:when test="normalize-space($value) != ''">
8067
+ <xsl:value-of select="$value"/>
8068
+ </xsl:when>
8069
+ <xsl:otherwise>_</xsl:otherwise>
8070
+ </xsl:choose>
8071
+ </xsl:attribute>
7823
8072
  </xsl:template></xsl:stylesheet>