metanorma-mpfa 0.7.0 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
- <xsl:key name="kfn" match="mpfd:p/mpfd:fn" use="@reference"/>
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
11
 
12
12
 
13
13
 
@@ -287,7 +287,7 @@
287
287
 
288
288
  <xsl:variable name="display">
289
289
  <xsl:choose>
290
- <xsl:when test="$level &gt;= 3">false</xsl:when>
290
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
291
291
  <xsl:otherwise>true</xsl:otherwise>
292
292
  </xsl:choose>
293
293
  </xsl:variable>
@@ -458,62 +458,7 @@
458
458
 
459
459
  </xsl:template>
460
460
 
461
- <!--
462
- <fn reference="1">
463
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
464
- </fn>
465
- -->
466
461
 
467
- <xsl:variable name="p_fn">
468
- <xsl:for-each select="//mpfd:p/mpfd:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
469
- <!-- copy unique fn -->
470
- <fn gen_id="{generate-id(.)}">
471
- <xsl:copy-of select="@*"/>
472
- <xsl:copy-of select="node()"/>
473
- </fn>
474
- </xsl:for-each>
475
- </xsl:variable>
476
-
477
- <xsl:template match="mpfd:p/mpfd:fn" priority="2">
478
- <xsl:variable name="gen_id" select="generate-id(.)"/>
479
- <xsl:variable name="reference" select="@reference"/>
480
- <xsl:variable name="number">
481
- <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
482
- </xsl:variable>
483
- <xsl:choose>
484
- <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
485
- <fo:footnote>
486
- <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
487
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
488
- <!-- <xsl:value-of select="@reference"/> -->
489
- <xsl:value-of select="$number + count(//mpfd:bibitem[ancestor::mpfd:references[@id='_normative_references' or not(preceding-sibling::mpfd:references)]]/mpfd:note)"/>
490
- </fo:basic-link>
491
- </fo:inline>
492
- <fo:footnote-body>
493
- <fo:block font-size="9pt" margin-bottom="12pt">
494
- <fo:inline font-size="6pt" id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" vertical-align="super" padding-right="1mm">
495
- <xsl:value-of select="$number + count(//mpfd:bibitem[ancestor::mpfd:references[@id='_normative_references' or not(preceding-sibling::mpfd:references)]]/mpfd:note)"/>
496
- </fo:inline>
497
- <xsl:for-each select="mpfd:p">
498
- <xsl:apply-templates/>
499
- </xsl:for-each>
500
- </fo:block>
501
- </fo:footnote-body>
502
- </fo:footnote>
503
- </xsl:when>
504
- <xsl:otherwise>
505
- <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
506
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
507
- <xsl:value-of select="$number + count(//mpfd:bibitem/mpfd:note)"/>
508
- </fo:basic-link>
509
- </fo:inline>
510
- </xsl:otherwise>
511
- </xsl:choose>
512
- </xsl:template>
513
-
514
-
515
-
516
-
517
462
 
518
463
  <xsl:template match="mpfd:bibitem">
519
464
  <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm"> <!-- 12 pt -->
@@ -615,6 +560,7 @@
615
560
 
616
561
  <xsl:template match="mpfd:preferred">
617
562
  <fo:inline font-weight="bold">
563
+ <xsl:call-template name="setStyle_preferred"/>
618
564
  <xsl:apply-templates/>
619
565
  </fo:inline>
620
566
  <xsl:if test="not(following-sibling::*[1][local-name() = 'preferred'])">
@@ -1316,6 +1262,78 @@
1316
1262
 
1317
1263
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1318
1264
  <xsl:attribute name="line-height">135%</xsl:attribute>
1265
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1266
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1267
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1268
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
1281
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1282
+
1283
+
1284
+
1285
+
1286
+
1287
+
1288
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1289
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1290
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1291
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1292
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+
1304
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1305
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1306
+
1307
+
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1315
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+ <xsl:attribute name="font-size">6pt</xsl:attribute>
1328
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1329
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1330
+
1331
+
1332
+
1333
+
1334
+
1335
+
1336
+
1319
1337
  </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">
1320
1338
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1321
1339
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1341,7 +1359,8 @@
1341
1359
  <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"/>
1342
1360
 
1343
1361
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1344
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1362
+
1363
+ <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']]">
1345
1364
  <xsl:sort select="@displayorder" data-type="number"/>
1346
1365
  <xsl:apply-templates select="." mode="contents"/>
1347
1366
  </xsl:for-each>
@@ -1351,7 +1370,7 @@
1351
1370
  <xsl:apply-templates select="." mode="contents"/>
1352
1371
  </xsl:for-each>
1353
1372
 
1354
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1373
+ <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')]]">
1355
1374
  <xsl:sort select="@displayorder" data-type="number"/>
1356
1375
  <xsl:apply-templates select="." mode="contents"/>
1357
1376
  </xsl:for-each>
@@ -2255,6 +2274,102 @@
2255
2274
 
2256
2275
  </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">
2257
2276
  <xsl:apply-templates/>
2277
+ </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">
2278
+
2279
+ <!-- list of footnotes to calculate actual footnotes number -->
2280
+ <xsl:variable name="p_fn_">
2281
+ <xsl:choose>
2282
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2283
+ <fn gen_id="{generate-id(.)}">
2284
+ <xsl:copy-of select="@*"/>
2285
+ <xsl:copy-of select="node()"/>
2286
+ </fn>
2287
+ </xsl:when>
2288
+ <xsl:otherwise>
2289
+ <!-- itetation for:
2290
+ footnotes in bibdata/title
2291
+ footnotes in bibliography
2292
+ footnotes in document's body (except table's head/body/foot and figure text)
2293
+ -->
2294
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2295
+ <fn gen_id="{generate-id(.)}">
2296
+ <xsl:copy-of select="@*"/>
2297
+ <xsl:copy-of select="node()"/>
2298
+ </fn>
2299
+ </xsl:for-each>
2300
+ <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']/*">
2301
+ <xsl:sort select="@displayorder" data-type="number"/>
2302
+ <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])]">
2303
+ <!-- copy unique fn -->
2304
+ <fn gen_id="{generate-id(.)}">
2305
+ <xsl:copy-of select="@*"/>
2306
+ <xsl:copy-of select="node()"/>
2307
+ </fn>
2308
+ </xsl:for-each>
2309
+ </xsl:for-each>
2310
+ </xsl:otherwise>
2311
+ </xsl:choose>
2312
+ </xsl:variable>
2313
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2314
+
2315
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2316
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2317
+ <xsl:variable name="reference" select="@reference"/>
2318
+ <!-- fn sequence number in document -->
2319
+ <xsl:variable name="current_fn_number">
2320
+ <xsl:choose>
2321
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2322
+ <xsl:otherwise>
2323
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2324
+ </xsl:otherwise>
2325
+ </xsl:choose>
2326
+ </xsl:variable>
2327
+ <xsl:variable name="current_fn_number_text">
2328
+ <xsl:value-of select="$current_fn_number"/>
2329
+
2330
+
2331
+ </xsl:variable>
2332
+
2333
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2334
+ <xsl:variable name="footnote_inline">
2335
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2336
+
2337
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2338
+ <xsl:value-of select="$current_fn_number_text"/>
2339
+ </fo:basic-link>
2340
+ </fo:inline>
2341
+ </xsl:variable>
2342
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2343
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2344
+ <xsl:choose>
2345
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2346
+ <xsl:copy-of select="$footnote_inline"/>
2347
+ </xsl:when>
2348
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2349
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2350
+ <xsl:copy-of select="$footnote_inline"/>
2351
+ <fo:footnote-body>
2352
+
2353
+ <fo:block-container text-indent="0" start-indent="0">
2354
+
2355
+
2356
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2357
+
2358
+
2359
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2360
+
2361
+ <xsl:value-of select="$current_fn_number_text"/>
2362
+ </fo:inline>
2363
+ <xsl:apply-templates/>
2364
+ </fo:block>
2365
+ </fo:block-container>
2366
+ </fo:footnote-body>
2367
+ </fo:footnote>
2368
+ </xsl:when>
2369
+ <xsl:otherwise>
2370
+ <xsl:copy-of select="$footnote_inline"/>
2371
+ </xsl:otherwise>
2372
+ </xsl:choose>
2258
2373
  </xsl:template><xsl:template name="fn_display">
2259
2374
  <xsl:variable name="references">
2260
2375
 
@@ -2445,6 +2560,8 @@
2445
2560
 
2446
2561
  </fo:basic-link>
2447
2562
  </fo:inline>
2563
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2564
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2448
2565
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2449
2566
  <fo:inline>
2450
2567
  <xsl:apply-templates/>
@@ -2744,6 +2861,7 @@
2744
2861
  <fo:table-cell>
2745
2862
 
2746
2863
  <fo:block margin-top="6pt">
2864
+ <xsl:copy-of select="@id"/>
2747
2865
 
2748
2866
 
2749
2867
  <xsl:if test="normalize-space($key_iso) = 'true'">
@@ -3434,22 +3552,6 @@
3434
3552
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3435
3553
  <xsl:apply-templates/>
3436
3554
  </fo:inline>
3437
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3438
- <xsl:variable name="title-modified">
3439
-
3440
-
3441
- <xsl:call-template name="getTitle">
3442
- <xsl:with-param name="name" select="'title-modified'"/>
3443
- </xsl:call-template>
3444
-
3445
- </xsl:variable>
3446
-
3447
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3448
- <xsl:choose>
3449
- <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>
3450
- <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>
3451
- </xsl:choose>
3452
- <xsl:apply-templates/>
3453
3555
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3454
3556
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3455
3557
 
@@ -3579,14 +3681,18 @@
3579
3681
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
3580
3682
  <fo:inline><xsl:apply-templates/></fo:inline>
3581
3683
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
3684
+ <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
3582
3685
  <fo:block id="{@id}">
3583
3686
  <xsl:apply-templates/>
3584
3687
  </fo:block>
3585
3688
  </xsl:template><xsl:template match="*[local-name() = 'term']">
3689
+ <!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
3586
3690
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
3587
3691
 
3588
3692
 
3589
-
3693
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
3694
+
3695
+ </xsl:if>
3590
3696
  <xsl:apply-templates/>
3591
3697
  </fo:block>
3592
3698
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
@@ -4010,12 +4116,12 @@
4010
4116
  </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">
4011
4117
  <xsl:apply-templates mode="contents"/>
4012
4118
  <xsl:text> </xsl:text>
4013
- </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">
4119
+ </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">
4014
4120
  <xsl:apply-templates mode="bookmarks"/>
4015
4121
  <xsl:text> </xsl:text>
4016
4122
  </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">
4017
4123
  <xsl:value-of select="."/>
4018
- </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">
4124
+ </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">
4019
4125
  <xsl:value-of select="."/>
4020
4126
  </xsl:template><xsl:template match="node()" mode="contents">
4021
4127
  <xsl:apply-templates mode="contents"/>
@@ -4285,6 +4391,8 @@
4285
4391
 
4286
4392
 
4287
4393
 
4394
+
4395
+
4288
4396
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4289
4397
  <xsl:variable name="_font-size">
4290
4398
 
@@ -4318,13 +4426,17 @@
4318
4426
 
4319
4427
 
4320
4428
 
4429
+
4430
+
4321
4431
  <xsl:apply-templates/>
4322
4432
  </fo:block>
4323
-
4433
+
4324
4434
 
4325
4435
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4326
4436
 
4327
4437
 
4438
+
4439
+
4328
4440
  </fo:block-container>
4329
4441
  </fo:block-container>
4330
4442
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4560,7 +4672,8 @@
4560
4672
  </fo:block>
4561
4673
  </fo:table-cell>
4562
4674
  </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
4563
- <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
4675
+ <fo:block font-size="11pt">
4676
+
4564
4677
  <xsl:apply-templates/>
4565
4678
  </fo:block>
4566
4679
  </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
@@ -4670,56 +4783,69 @@
4670
4783
  <xsl:variable name="termsource_text">
4671
4784
  <xsl:apply-templates/>
4672
4785
  </xsl:variable>
4673
-
4674
- <xsl:choose>
4786
+ <xsl:copy-of select="$termsource_text"/>
4787
+ <!-- <xsl:choose>
4675
4788
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4676
- <!-- <xsl:apply-templates /> -->
4677
4789
  <xsl:copy-of select="$termsource_text"/>
4678
4790
  </xsl:when>
4679
- <xsl:otherwise>
4680
-
4681
- <!-- <xsl:apply-templates /> -->
4791
+ <xsl:otherwise>
4792
+ <xsl:if test="$namespace = 'bsi'">
4793
+ <xsl:choose>
4794
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
4795
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
4796
+ </xsl:choose>
4797
+ </xsl:if>
4798
+ <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'">
4799
+ <xsl:text>[</xsl:text>
4800
+ </xsl:if>
4682
4801
  <xsl:copy-of select="$termsource_text"/>
4683
-
4802
+ <xsl:if test="$namespace = 'bsi'">
4803
+ <xsl:choose>
4804
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
4805
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
4806
+ </xsl:choose>
4807
+ </xsl:if>
4808
+ <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'">
4809
+ <xsl:text>]</xsl:text>
4810
+ </xsl:if>
4684
4811
  </xsl:otherwise>
4685
- </xsl:choose>
4812
+ </xsl:choose> -->
4686
4813
  </fo:block>
4687
4814
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
4688
4815
  <xsl:if test="normalize-space() != ''">
4689
4816
  <xsl:value-of select="."/>
4690
4817
  </xsl:if>
4691
- </xsl:template><xsl:variable name="localized.source">
4692
- <xsl:call-template name="getLocalizedString">
4693
- <xsl:with-param name="key">source</xsl:with-param>
4694
- </xsl:call-template>
4695
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4818
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
4819
+ <fo:inline>
4820
+
4821
+
4822
+ <xsl:value-of select="."/>
4823
+ </fo:inline>
4824
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
4696
4825
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4697
4826
  <xsl:if test="normalize-space(@citeas) = ''">
4698
4827
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4699
4828
  </xsl:if>
4700
-
4701
-
4702
- <fo:inline>
4703
-
4704
-
4705
-
4706
-
4707
-
4708
-
4709
-
4710
- <xsl:call-template name="getTitle">
4711
- <xsl:with-param name="name" select="'title-source'"/>
4712
- </xsl:call-template>
4713
- <xsl:text>: </xsl:text>
4714
-
4715
-
4716
- </fo:inline>
4717
-
4718
4829
  <fo:inline xsl:use-attribute-sets="origin-style">
4719
4830
  <xsl:apply-templates/>
4720
4831
  </fo:inline>
4832
+ </fo:basic-link>
4833
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4834
+ <xsl:variable name="title-modified">
4721
4835
 
4722
- </fo:basic-link>
4836
+
4837
+ <xsl:call-template name="getTitle">
4838
+ <xsl:with-param name="name" select="'title-modified'"/>
4839
+ </xsl:call-template>
4840
+
4841
+ </xsl:variable>
4842
+
4843
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4844
+ <xsl:choose>
4845
+ <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>
4846
+ <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>
4847
+ </xsl:choose>
4848
+ <xsl:apply-templates/>
4723
4849
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4724
4850
  <fo:inline><xsl:apply-templates/></fo:inline>
4725
4851
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -4762,12 +4888,20 @@
4762
4888
  </xsl:template><xsl:template match="*[local-name() = 'author']">
4763
4889
  <xsl:text>— </xsl:text>
4764
4890
  <xsl:apply-templates/>
4765
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
4891
+ </xsl:template><xsl:variable name="bibitem_hidden_">
4892
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
4893
+ <xsl:copy-of select="."/>
4894
+ </xsl:for-each>
4895
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
4896
+ <xsl:copy-of select="."/>
4897
+ </xsl:for-each>
4898
+ </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
4766
4899
 
4767
4900
  <xsl:variable name="bibitemid">
4768
4901
  <xsl:choose>
4769
- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4770
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4902
+ <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
4903
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
4904
+ <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4771
4905
  <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4772
4906
  </xsl:choose>
4773
4907
  </xsl:variable>
@@ -4854,10 +4988,10 @@
4854
4988
  </xsl:choose>
4855
4989
  </xsl:variable>
4856
4990
 
4857
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4991
+ <!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
4858
4992
 
4859
4993
  <xsl:choose>
4860
- <xsl:when test="$language = 'zh'">
4994
+ <xsl:when test="$lang = 'zh'">
4861
4995
  <fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
4862
4996
  </xsl:when>
4863
4997
  <xsl:when test="../../@inline-header = 'true'">
@@ -4900,15 +5034,20 @@
4900
5034
  <fo:block xsl:use-attribute-sets="deprecates-style">
4901
5035
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
4902
5036
  </fo:block>
5037
+ </xsl:template><xsl:template name="setStyle_preferred">
5038
+ <xsl:if test="*[local-name() = 'strong']">
5039
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5040
+ </xsl:if>
4903
5041
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
4904
5042
  <fo:block xsl:use-attribute-sets="definition-style">
4905
5043
  <xsl:apply-templates/>
4906
5044
  </fo:block>
4907
5045
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
4908
5046
  <xsl:apply-templates/>
4909
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5047
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
4910
5048
  <fo:inline> <xsl:apply-templates/></fo:inline>
4911
- <fo:block> </fo:block>
5049
+ <!-- <fo:block>&#xA0;</fo:block> -->
5050
+ <fo:block/>
4912
5051
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
4913
5052
 
4914
5053
  <fo:block>
@@ -5302,7 +5441,31 @@
5302
5441
  <fo:block-container border="1pt solid black" width="50%">
5303
5442
  <fo:block> </fo:block>
5304
5443
  </fo:block-container>
5305
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5444
+ </xsl:template><xsl:variable name="toc_level">
5445
+ <xsl:choose>
5446
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5447
+ <xsl:otherwise><!-- default value -->
5448
+
5449
+
5450
+
5451
+
5452
+
5453
+
5454
+
5455
+
5456
+
5457
+
5458
+ 2
5459
+
5460
+
5461
+
5462
+
5463
+
5464
+
5465
+
5466
+ </xsl:otherwise>
5467
+ </xsl:choose>
5468
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5306
5469
  <xsl:param name="colwidths"/>
5307
5470
  <xsl:variable name="colwidths_">
5308
5471
  <xsl:choose>
@@ -5830,12 +5993,15 @@
5830
5993
  <xsl:param name="default">left</xsl:param>
5831
5994
  <xsl:attribute name="text-align">
5832
5995
  <xsl:choose>
5833
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5996
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
5834
5997
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5835
5998
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5836
5999
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5837
6000
  </xsl:choose>
5838
6001
  </xsl:attribute>
6002
+ <xsl:if test="@align = 'indent'">
6003
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
6004
+ </xsl:if>
5839
6005
  </xsl:template><xsl:template name="number-to-words">
5840
6006
  <xsl:param name="number"/>
5841
6007
  <xsl:param name="first"/>
@@ -5932,4 +6098,14 @@
5932
6098
  </xsl:otherwise>
5933
6099
  </xsl:choose>
5934
6100
  </xsl:if>
6101
+ </xsl:template><xsl:template name="setAltText">
6102
+ <xsl:param name="value"/>
6103
+ <xsl:attribute name="fox:alt-text">
6104
+ <xsl:choose>
6105
+ <xsl:when test="normalize-space($value) != ''">
6106
+ <xsl:value-of select="$value"/>
6107
+ </xsl:when>
6108
+ <xsl:otherwise>_</xsl:otherwise>
6109
+ </xsl:choose>
6110
+ </xsl:attribute>
5935
6111
  </xsl:template></xsl:stylesheet>