metanorma-bipm 2.2.4 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,7 @@
32
32
  <xsl:variable name="doc_first">
33
33
  <xsl:if test="*[local-name()='metanorma-collection']">
34
34
  <xsl:variable name="doc_first_step1">
35
- <xsl:apply-templates select="(/*[local-name()='metanorma-collection']//*[contains(local-name(), '-standard')])[1]" mode="flatxml_step1">
35
+ <xsl:apply-templates select="(/*[local-name()='metanorma-collection']//*[local-name() = 'bipm-standard'])[1]" mode="flatxml_step1">
36
36
  <xsl:with-param name="num" select="'first'"/>
37
37
  </xsl:apply-templates>
38
38
  </xsl:variable>
@@ -44,7 +44,7 @@
44
44
  </xsl:variable>
45
45
  <xsl:variable name="docs_slave">
46
46
  <xsl:if test="*[local-name()='metanorma-collection']">
47
- <xsl:for-each select="(/*[local-name()='metanorma-collection']//*[contains(local-name(), '-standard')])[position() &gt; 1]">
47
+ <xsl:for-each select="(/*[local-name()='metanorma-collection']//*[local-name() = 'bipm-standard'])[position() &gt; 1]">
48
48
  <xsl:variable name="doc_first_step1">
49
49
  <xsl:apply-templates select="." mode="flatxml_step1">
50
50
  <xsl:with-param name="num" select="'slave'"/>
@@ -63,7 +63,7 @@
63
63
  <xsl:variable name="docs_count">
64
64
  <xsl:choose>
65
65
  <xsl:when test="/*[local-name()='metanorma-collection']">
66
- <xsl:value-of select="count(/*[local-name()='metanorma-collection']//*[contains(local-name(), '-standard')])"/>
66
+ <xsl:value-of select="count(/*[local-name()='metanorma-collection']//*[local-name() = 'bipm-standard'])"/>
67
67
  </xsl:when>
68
68
  <xsl:otherwise>1</xsl:otherwise>
69
69
  </xsl:choose>
@@ -88,7 +88,7 @@
88
88
  -->
89
89
  <xsl:variable name="contents_">
90
90
 
91
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
91
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
92
92
  <xsl:variable name="lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
93
93
  <xsl:variable name="current_document">
94
94
  <xsl:copy-of select="."/>
@@ -332,12 +332,12 @@
332
332
  <fo:flow flow-name="xsl-region-body" line-height="115%">
333
333
 
334
334
  <!-- Copyright -->
335
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
335
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
336
336
  <xsl:apply-templates select="./*[local-name()='boilerplate']/*"/>
337
337
  <fo:block break-after="page"/>
338
338
  </xsl:for-each>
339
339
 
340
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
340
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
341
341
  <xsl:variable name="current_document">
342
342
  <xsl:copy-of select="."/>
343
343
  </xsl:variable>
@@ -417,23 +417,23 @@
417
417
 
418
418
  <!-- Foreword, Introduction -->
419
419
  <!-- <xsl:call-template name="processPrefaceSectionsDefault"/> -->
420
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
420
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
421
421
  <fo:block break-after="page"/>
422
422
  <xsl:apply-templates select="./*[local-name()='preface']/*[local-name()='abstract']"/>
423
423
  </xsl:for-each>
424
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
424
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
425
425
  <fo:block break-after="page"/>
426
426
  <xsl:apply-templates select="./*[local-name()='preface']/*[local-name()='foreword']"/>
427
427
  </xsl:for-each>
428
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
428
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
429
429
  <fo:block break-after="page"/>
430
430
  <xsl:apply-templates select="./*[local-name()='preface']/*[local-name()='introduction']"/>
431
431
  </xsl:for-each>
432
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
432
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
433
433
  <fo:block break-after="page"/>
434
434
  <xsl:apply-templates select="./*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']"/>
435
435
  </xsl:for-each>
436
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
436
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
437
437
  <fo:block break-after="page"/>
438
438
  <xsl:apply-templates select="./*[local-name()='preface']/*[local-name()='acknowledgements']"/>
439
439
  </xsl:for-each>
@@ -456,7 +456,7 @@
456
456
  <!-- Show title -->
457
457
  <!-- Example: Evaluation of measurement data — An introduction to the `Guide to the expression of uncertainty in measurement' and related documents -->
458
458
 
459
- <xsl:for-each select="//*[contains(local-name(), '-standard')]">
459
+ <xsl:for-each select="//*[local-name() = 'bipm-standard']">
460
460
  <fo:block font-size="20pt" font-weight="bold" margin-bottom="20pt" space-before="36pt" line-height="1.1">
461
461
  <xsl:variable name="curr_lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
462
462
 
@@ -492,7 +492,7 @@
492
492
  <!-- Clause(s) -->
493
493
  <fo:block>
494
494
  <xsl:choose>
495
- <xsl:when test="count(//*[contains(local-name(), '-standard')]) = 1 ">
495
+ <xsl:when test="count(//*[local-name() = 'bipm-standard']) = 1 ">
496
496
  <xsl:call-template name="processMainSectionsDefault"/>
497
497
  </xsl:when>
498
498
  <xsl:otherwise>
@@ -1376,7 +1376,7 @@
1376
1376
  </xsl:copy>
1377
1377
  </xsl:template>
1378
1378
 
1379
- <xsl:template match="*[contains(local-name(), '-standard')]" mode="flatxml_step1">
1379
+ <xsl:template match="*[local-name() = 'bipm-standard']" mode="flatxml_step1">
1380
1380
  <xsl:param name="num"/>
1381
1381
  <xsl:copy>
1382
1382
  <xsl:apply-templates select="@*" mode="flatxml_step1"/>
@@ -2280,21 +2280,21 @@
2280
2280
 
2281
2281
  <xsl:attribute-set name="table-header-cell-style">
2282
2282
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2283
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2284
2283
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2285
2284
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2286
2285
  <xsl:attribute name="display-align">center</xsl:attribute>
2287
2286
 
2287
+ <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2288
2288
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
2289
2289
 
2290
2290
  </xsl:attribute-set> <!-- table-header-cell-style -->
2291
2291
 
2292
2292
  <xsl:attribute-set name="table-cell-style">
2293
2293
  <xsl:attribute name="display-align">center</xsl:attribute>
2294
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2295
2294
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2296
2295
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2297
2296
 
2297
+ <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2298
2298
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2299
2299
 
2300
2300
  </xsl:attribute-set> <!-- table-cell-style -->
@@ -3047,7 +3047,7 @@
3047
3047
  <xsl:apply-templates select="." mode="contents"/>
3048
3048
  </xsl:for-each>
3049
3049
 
3050
- <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')]]">
3050
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0]">
3051
3051
  <xsl:sort select="@displayorder" data-type="number"/>
3052
3052
  <xsl:apply-templates select="." mode="contents"/>
3053
3053
  </xsl:for-each>
@@ -3486,7 +3486,7 @@
3486
3486
  <xsl:variable name="isDeleted" select="@deleted"/>
3487
3487
 
3488
3488
  <xsl:choose>
3489
- <xsl:when test="@width">
3489
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
3490
3490
 
3491
3491
  <!-- centered table when table name is centered (see table-name-style) -->
3492
3492
 
@@ -3813,6 +3813,7 @@
3813
3813
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3814
3814
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
3815
3815
  <!-- difference between the available space and the minimum table width -->
3816
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
3816
3817
  <xsl:variable name="W" select="$page_width - @width_min"/>
3817
3818
  <W><xsl:value-of select="$W"/></W>
3818
3819
  <!-- difference between maximum and minimum width of the table -->
@@ -3989,6 +3990,10 @@
3989
3990
  </xsl:choose>
3990
3991
  </xsl:variable>
3991
3992
 
3993
+ <xsl:variable name="table_fn_block">
3994
+ <xsl:call-template name="table_fn_display"/>
3995
+ </xsl:variable>
3996
+
3992
3997
  <xsl:variable name="tableWithNotesAndFootnotes">
3993
3998
 
3994
3999
  <fo:table keep-with-previous="always">
@@ -4036,11 +4041,25 @@
4036
4041
 
4037
4042
  <xsl:apply-templates select="../*[local-name()='note']"/>
4038
4043
 
4044
+ <xsl:variable name="isDisplayRowSeparator">
4045
+
4046
+ </xsl:variable>
4047
+
4039
4048
  <!-- horizontal row separator -->
4049
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4050
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
4051
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4052
+
4053
+ <xsl:call-template name="setBordersTableArray"/>
4054
+ <fo:block font-size="1pt"> </fo:block>
4055
+ </fo:block-container>
4056
+ </xsl:if>
4057
+ </xsl:if>
4040
4058
 
4041
4059
  <!-- fn processing -->
4042
4060
 
4043
- <xsl:call-template name="table_fn_display"/>
4061
+ <!-- <xsl:call-template name="table_fn_display" /> -->
4062
+ <xsl:copy-of select="$table_fn_block"/>
4044
4063
 
4045
4064
  <!-- for PAS display Notes after footnotes -->
4046
4065
 
@@ -4209,6 +4228,28 @@
4209
4228
  </fo:table-row>
4210
4229
  </xsl:template>
4211
4230
 
4231
+ <xsl:template name="setBorderUnderRow">
4232
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
4233
+ <xsl:choose>
4234
+ <xsl:when test="$border_under_row_ != ''">
4235
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
4236
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
4237
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
4238
+ <xsl:variable name="border_under_row">
4239
+ <xsl:call-template name="split">
4240
+ <xsl:with-param name="pText" select="$border_under_row_"/>
4241
+ </xsl:call-template>
4242
+ </xsl:variable>
4243
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
4244
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4245
+ </xsl:if>
4246
+ </xsl:when>
4247
+ <xsl:otherwise>
4248
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4249
+ </xsl:otherwise>
4250
+ </xsl:choose>
4251
+ </xsl:template>
4252
+
4212
4253
  <!-- row in table footer (tfoot) -->
4213
4254
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4214
4255
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -4502,17 +4543,20 @@
4502
4543
  <xsl:for-each select="xalan:nodeset($references)//fn">
4503
4544
  <xsl:variable name="reference" select="@reference"/>
4504
4545
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4505
- <fo:block xsl:use-attribute-sets="table-fn-style">
4506
4546
 
4507
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4547
+ <fo:block xsl:use-attribute-sets="table-fn-style">
4508
4548
 
4509
- <xsl:value-of select="@reference"/>
4549
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4550
+
4551
+ <xsl:value-of select="@reference"/>
4552
+
4553
+ </fo:inline>
4554
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4555
+ <xsl:copy-of select="./node()"/>
4556
+ </fo:inline>
4557
+
4558
+ </fo:block>
4510
4559
 
4511
- </fo:inline>
4512
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4513
- <xsl:copy-of select="./node()"/>
4514
- </fo:inline>
4515
- </fo:block>
4516
4560
  </xsl:if>
4517
4561
  </xsl:for-each>
4518
4562
  </xsl:template>
@@ -4541,8 +4585,16 @@
4541
4585
  <!-- figure's footnotes rendering -->
4542
4586
  <xsl:template name="fn_display_figure">
4543
4587
 
4588
+ <!-- current figure id -->
4589
+ <xsl:variable name="figure_id_">
4590
+ <xsl:value-of select="@id"/>
4591
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4592
+ </xsl:variable>
4593
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4594
+
4595
+ <!-- all footnotes relates to the current figure -->
4544
4596
  <xsl:variable name="references">
4545
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
4597
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4546
4598
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4547
4599
  <xsl:apply-templates/>
4548
4600
  </fn>
@@ -4555,91 +4607,93 @@
4555
4607
  true
4556
4608
  </xsl:variable>
4557
4609
 
4558
- <!-- current hierarchy is 'figure' element -->
4559
- <xsl:variable name="following_dl_colwidths">
4560
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4561
- <xsl:variable name="simple-table">
4562
- <!-- <xsl:variable name="doc_ns">
4563
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4610
+ <fo:block>
4611
+
4612
+ <!-- current hierarchy is 'figure' element -->
4613
+ <xsl:variable name="following_dl_colwidths">
4614
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4615
+ <xsl:variable name="simple-table">
4616
+ <!-- <xsl:variable name="doc_ns">
4617
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4618
+ </xsl:variable>
4619
+ <xsl:variable name="ns">
4620
+ <xsl:choose>
4621
+ <xsl:when test="normalize-space($doc_ns) != ''">
4622
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4623
+ </xsl:when>
4624
+ <xsl:otherwise>
4625
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4626
+ </xsl:otherwise>
4627
+ </xsl:choose>
4628
+ </xsl:variable> -->
4629
+
4630
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4631
+ <tbody>
4632
+ <xsl:apply-templates mode="dl"/>
4633
+ </tbody>
4634
+ </xsl:for-each>
4635
+ </xsl:variable>
4636
+
4637
+ <xsl:call-template name="calculate-column-widths">
4638
+ <xsl:with-param name="cols-count" select="2"/>
4639
+ <xsl:with-param name="table" select="$simple-table"/>
4640
+ </xsl:call-template>
4641
+
4642
+ </xsl:if>
4643
+ </xsl:variable>
4644
+
4645
+ <xsl:variable name="maxlength_dt">
4646
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4647
+ <xsl:call-template name="getMaxLength_dt"/>
4648
+ </xsl:for-each>
4564
4649
  </xsl:variable>
4565
- <xsl:variable name="ns">
4650
+
4651
+ <fo:table width="95%" table-layout="fixed">
4652
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4653
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4654
+
4655
+ </xsl:if>
4566
4656
  <xsl:choose>
4567
- <xsl:when test="normalize-space($doc_ns) != ''">
4568
- <xsl:value-of select="normalize-space($doc_ns)"/>
4657
+ <!-- if there 'dl', then set same columns width -->
4658
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4659
+ <xsl:call-template name="setColumnWidth_dl">
4660
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4661
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4662
+ </xsl:call-template>
4569
4663
  </xsl:when>
4570
4664
  <xsl:otherwise>
4571
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4665
+ <fo:table-column column-width="5%"/>
4666
+ <fo:table-column column-width="95%"/>
4572
4667
  </xsl:otherwise>
4573
4668
  </xsl:choose>
4574
- </xsl:variable> -->
4575
-
4576
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4577
- <tbody>
4578
- <xsl:apply-templates mode="dl"/>
4579
- </tbody>
4580
- </xsl:for-each>
4581
- </xsl:variable>
4582
-
4583
- <xsl:call-template name="calculate-column-widths">
4584
- <xsl:with-param name="cols-count" select="2"/>
4585
- <xsl:with-param name="table" select="$simple-table"/>
4586
- </xsl:call-template>
4587
-
4588
- </xsl:if>
4589
- </xsl:variable>
4669
+ <fo:table-body>
4670
+ <xsl:for-each select="xalan:nodeset($references)//fn">
4671
+ <xsl:variable name="reference" select="@reference"/>
4672
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4673
+ <fo:table-row>
4674
+ <fo:table-cell>
4675
+ <fo:block>
4676
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4677
+ <xsl:value-of select="@reference"/>
4678
+ </fo:inline>
4679
+ </fo:block>
4680
+ </fo:table-cell>
4681
+ <fo:table-cell>
4682
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4683
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4590
4684
 
4591
- <xsl:variable name="maxlength_dt">
4592
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4593
- <xsl:call-template name="getMaxLength_dt"/>
4594
- </xsl:for-each>
4595
- </xsl:variable>
4685
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4596
4686
 
4597
- <fo:block>
4598
- <fo:table width="95%" table-layout="fixed">
4599
- <xsl:if test="normalize-space($key_iso) = 'true'">
4600
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4601
-
4602
- </xsl:if>
4603
- <xsl:choose>
4604
- <!-- if there 'dl', then set same columns width -->
4605
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4606
- <xsl:call-template name="setColumnWidth_dl">
4607
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4608
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4609
- </xsl:call-template>
4610
- </xsl:when>
4611
- <xsl:otherwise>
4612
- <fo:table-column column-width="15%"/>
4613
- <fo:table-column column-width="85%"/>
4614
- </xsl:otherwise>
4615
- </xsl:choose>
4616
- <fo:table-body>
4617
- <xsl:for-each select="xalan:nodeset($references)//fn">
4618
- <xsl:variable name="reference" select="@reference"/>
4619
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4620
- <fo:table-row>
4621
- <fo:table-cell>
4622
- <fo:block>
4623
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4624
- <xsl:value-of select="@reference"/>
4625
- </fo:inline>
4626
- </fo:block>
4627
- </fo:table-cell>
4628
- <fo:table-cell>
4629
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4630
- <xsl:if test="normalize-space($key_iso) = 'true'">
4631
-
4632
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4687
+ </xsl:if>
4688
+ <xsl:copy-of select="./node()"/>
4689
+ </fo:block>
4690
+ </fo:table-cell>
4691
+ </fo:table-row>
4692
+ </xsl:if>
4693
+ </xsl:for-each>
4694
+ </fo:table-body>
4695
+ </fo:table>
4633
4696
 
4634
- </xsl:if>
4635
- <xsl:copy-of select="./node()"/>
4636
- </fo:block>
4637
- </fo:table-cell>
4638
- </fo:table-row>
4639
- </xsl:if>
4640
- </xsl:for-each>
4641
- </fo:table-body>
4642
- </fo:table>
4643
4697
  </fo:block>
4644
4698
  </xsl:if>
4645
4699
 
@@ -4711,7 +4765,7 @@
4711
4765
 
4712
4766
  <xsl:variable name="key_iso">
4713
4767
 
4714
- <xsl:if test="$parent = 'figure' or $parent = 'formula'">true</xsl:if>
4768
+ <xsl:if test="$parent = 'figure' or $parent = 'formula' or ../@key = 'true'">true</xsl:if>
4715
4769
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
4716
4770
  </xsl:variable>
4717
4771
 
@@ -4724,12 +4778,14 @@
4724
4778
 
4725
4779
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
4726
4780
 
4727
- <xsl:variable name="title-where">
4781
+ <!-- <xsl:variable name="title-where">
4728
4782
  <xsl:call-template name="getLocalizedString">
4729
4783
  <xsl:with-param name="key">where</xsl:with-param>
4730
4784
  </xsl:call-template>
4731
4785
  </xsl:variable>
4732
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4786
+ <xsl:value-of select="$title-where"/> -->
4787
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4788
+ <xsl:text> </xsl:text>
4733
4789
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4734
4790
  <xsl:text/>
4735
4791
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -4741,12 +4797,14 @@
4741
4797
 
4742
4798
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4743
4799
 
4744
- <xsl:variable name="title-where">
4800
+ <!-- <xsl:variable name="title-where">
4745
4801
  <xsl:call-template name="getLocalizedString">
4746
4802
  <xsl:with-param name="key">where</xsl:with-param>
4747
4803
  </xsl:call-template>
4748
4804
  </xsl:variable>
4749
- <xsl:value-of select="$title-where"/>
4805
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
4806
+ <!-- preceding 'p' with word 'where' -->
4807
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4750
4808
  </fo:block>
4751
4809
  </xsl:when> <!-- END: a few components -->
4752
4810
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -4937,6 +4995,9 @@
4937
4995
 
4938
4996
  </xsl:template> <!-- END: dl -->
4939
4997
 
4998
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4999
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5000
+
4940
5001
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4941
5002
  <xsl:param name="process">false</xsl:param>
4942
5003
  <xsl:if test="$process = 'true'">
@@ -5470,12 +5531,12 @@
5470
5531
  <xsl:param name="value"/>
5471
5532
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
5472
5533
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
5473
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
5474
- <xsl:attribute name="height">5mm</xsl:attribute>
5534
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
5535
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
5475
5536
  <xsl:attribute name="content-width">100%</xsl:attribute>
5476
5537
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5477
5538
  <xsl:attribute name="scaling">uniform</xsl:attribute>
5478
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5539
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5479
5540
  <g>
5480
5541
  <xsl:if test="$type = 'closing' or $type = 'end'">
5481
5542
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -5489,6 +5550,27 @@
5489
5550
  </xsl:if>
5490
5551
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
5491
5552
  </text>
5553
+ </svg> -->
5554
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5555
+ <g>
5556
+ <xsl:if test="$type = 'closing' or $type = 'end'">
5557
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
5558
+ </xsl:if>
5559
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
5560
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
5561
+ </g>
5562
+ <xsl:variable name="text_x">
5563
+ <xsl:choose>
5564
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
5565
+ <xsl:otherwise>22</xsl:otherwise>
5566
+ </xsl:choose>
5567
+ </xsl:variable>
5568
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
5569
+ <xsl:value-of select="$kind"/>
5570
+ </text>
5571
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
5572
+ <xsl:value-of select="$value"/>
5573
+ </text>
5492
5574
  </svg>
5493
5575
  </fo:instream-foreign-object>
5494
5576
  </xsl:template>
@@ -5743,18 +5825,34 @@
5743
5825
 
5744
5826
  <xsl:template name="add-zero-spaces-java">
5745
5827
  <xsl:param name="text" select="."/>
5746
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
5747
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
5828
+
5829
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
5830
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
5831
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
5832
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
5833
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
5834
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
5748
5835
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
5749
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
5836
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
5750
5837
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
5751
- <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
5838
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
5752
5839
  <!-- add zero-width space (#x200B) before character: { -->
5753
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5840
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5754
5841
  <!-- add zero-width space (#x200B) after character: , -->
5755
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
5842
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
5843
+ <!-- add zero-width space (#x200B) after character: '/' -->
5844
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
5756
5845
 
5757
- <xsl:value-of select="$text5"/>
5846
+ <xsl:variable name="text9">
5847
+ <xsl:choose>
5848
+ <xsl:when test="$isGenerateTableIF = 'true'">
5849
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
5850
+ </xsl:when>
5851
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
5852
+ </xsl:choose>
5853
+ </xsl:variable>
5854
+
5855
+ <xsl:value-of select="$text9"/>
5758
5856
  </xsl:template>
5759
5857
 
5760
5858
  <xsl:template name="add-zero-spaces-link-java">
@@ -5762,8 +5860,10 @@
5762
5860
 
5763
5861
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
5764
5862
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
5765
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5766
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
5863
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
5864
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
5865
+ <!-- remove zero-width space at the end -->
5866
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
5767
5867
  </xsl:template>
5768
5868
 
5769
5869
  <!-- add zero space after dash character (for table's entries) -->
@@ -5900,7 +6000,7 @@
5900
6000
  </xsl:copy>
5901
6001
  </xsl:template>
5902
6002
 
5903
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
6003
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
5904
6004
  <xsl:copy>
5905
6005
  <xsl:copy-of select="@*"/>
5906
6006
  <p>
@@ -5976,6 +6076,14 @@
5976
6076
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
5977
6077
  </xsl:template>
5978
6078
 
6079
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
6080
+ <xsl:apply-templates mode="table-without-br"/>
6081
+ </xsl:template>
6082
+
6083
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
6084
+ <xsl:apply-templates mode="table-without-br"/>
6085
+ </xsl:template>
6086
+
5979
6087
  <!-- mode="table-without-br" -->
5980
6088
  <!-- ================================== -->
5981
6089
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -6108,9 +6216,28 @@
6108
6216
  </xsl:variable>
6109
6217
  <xsl:copy-of select="$newRow"/>
6110
6218
 
6111
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6112
- <xsl:with-param name="previousRow" select="$newRow"/>
6113
- </xsl:apply-templates>
6219
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
6220
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
6221
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
6222
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
6223
+ <xsl:choose>
6224
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
6225
+ <xsl:copy-of select="following-sibling::tr"/>
6226
+ </xsl:when>
6227
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
6228
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
6229
+
6230
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6231
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
6232
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6233
+ </xsl:apply-templates>
6234
+ </xsl:when> -->
6235
+ <xsl:otherwise>
6236
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6237
+ <xsl:with-param name="previousRow" select="$newRow"/>
6238
+ </xsl:apply-templates>
6239
+ </xsl:otherwise>
6240
+ </xsl:choose>
6114
6241
  </xsl:template>
6115
6242
  <!-- End mode simple-table-rowspan -->
6116
6243
 
@@ -6273,6 +6400,27 @@
6273
6400
  </xsl:call-template>
6274
6401
  </xsl:template>
6275
6402
 
6403
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
6404
+ <xsl:variable name="link">
6405
+ <link_updated>
6406
+ <xsl:variable name="target_text">
6407
+ <xsl:choose>
6408
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
6409
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
6410
+ </xsl:when>
6411
+ <xsl:otherwise>
6412
+ <xsl:value-of select="normalize-space(@target)"/>
6413
+ </xsl:otherwise>
6414
+ </xsl:choose>
6415
+ </xsl:variable>
6416
+ <xsl:value-of select="$target_text"/>
6417
+ </link_updated>
6418
+ </xsl:variable>
6419
+ <xsl:for-each select="xalan:nodeset($link)/*">
6420
+ <xsl:apply-templates mode="td_text_with_formatting"/>
6421
+ </xsl:for-each>
6422
+ </xsl:template>
6423
+
6276
6424
  <xsl:template name="getFormattingTags">
6277
6425
  <tags>
6278
6426
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -6621,7 +6769,7 @@
6621
6769
  </xsl:variable>
6622
6770
  <fo:inline xsl:use-attribute-sets="link-style">
6623
6771
 
6624
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
6772
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
6625
6773
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6626
6774
  </xsl:if>
6627
6775
 
@@ -6796,7 +6944,7 @@
6796
6944
 
6797
6945
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
6798
6946
 
6799
- <fo:block-container margin-left="0mm">
6947
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6800
6948
 
6801
6949
  <fo:block>
6802
6950
 
@@ -6972,13 +7120,16 @@
6972
7120
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
6973
7121
  </xsl:call-template>
6974
7122
 
7123
+ <!-- Example: Dimensions in millimeters -->
7124
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
7125
+
6975
7126
  <fo:block xsl:use-attribute-sets="figure-style">
6976
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7127
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
6977
7128
  </fo:block>
6978
- <xsl:call-template name="fn_display_figure"/>
6979
- <xsl:for-each select="*[local-name() = 'note']">
7129
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
6980
7130
  <xsl:call-template name="note"/>
6981
7131
  </xsl:for-each>
7132
+ <xsl:call-template name="fn_display_figure"/>
6982
7133
 
6983
7134
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
6984
7135
 
@@ -7041,7 +7192,13 @@
7041
7192
  </xsl:choose>
7042
7193
  </xsl:variable>
7043
7194
 
7044
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7195
+ <xsl:variable name="image_width_effective">
7196
+
7197
+ <xsl:value-of select="$width_effective"/>
7198
+
7199
+ </xsl:variable>
7200
+
7201
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7045
7202
  <xsl:if test="number($scale) &lt; 100">
7046
7203
 
7047
7204
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -7233,24 +7390,47 @@
7233
7390
 
7234
7391
  </xsl:when>
7235
7392
  <xsl:otherwise>
7236
- <fo:block xsl:use-attribute-sets="image-style">
7237
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7238
- <xsl:attribute name="width">100%</xsl:attribute>
7239
- <xsl:attribute name="content-height">100%</xsl:attribute>
7240
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7241
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7242
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7243
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7244
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7245
- <!-- effective height / width = 1.48, 1.4 - with title -->
7246
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7247
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7248
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7249
- </xsl:if>
7250
- <xsl:attribute name="scaling">uniform</xsl:attribute>
7251
- <xsl:copy-of select="$svg_content"/>
7252
- </fo:instream-foreign-object>
7253
- </fo:block>
7393
+
7394
+ <xsl:variable name="element">
7395
+ <xsl:choose>
7396
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
7397
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
7398
+ </xsl:when>
7399
+ <xsl:otherwise>
7400
+ <fo:block xsl:use-attribute-sets="image-style">
7401
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
7402
+ <xsl:attribute name="text-align">left</xsl:attribute>
7403
+ </xsl:if>
7404
+ </fo:block>
7405
+ </xsl:otherwise>
7406
+ </xsl:choose>
7407
+ </xsl:variable>
7408
+
7409
+ <xsl:for-each select="xalan:nodeset($element)/*">
7410
+ <xsl:copy>
7411
+ <xsl:copy-of select="@*"/>
7412
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
7413
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7414
+ <xsl:if test="$isGenerateTableIF = 'false'">
7415
+ <xsl:attribute name="width">100%</xsl:attribute>
7416
+ </xsl:if>
7417
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7418
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7419
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7420
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7421
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7422
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7423
+ <!-- effective height / width = 1.48, 1.4 - with title -->
7424
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7425
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7426
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7427
+ </xsl:if>
7428
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7429
+ <xsl:copy-of select="$svg_content"/>
7430
+ </fo:instream-foreign-object>
7431
+ <!-- </fo:block> -->
7432
+ </xsl:copy>
7433
+ </xsl:for-each>
7254
7434
  </xsl:otherwise>
7255
7435
  </xsl:choose>
7256
7436
  </xsl:template>
@@ -7342,6 +7522,13 @@
7342
7522
  </xsl:for-each>
7343
7523
  </xsl:template>
7344
7524
 
7525
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
7526
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7527
+ <xsl:for-each select="*[local-name() = 'svg']">
7528
+ <xsl:call-template name="image_svg"/>
7529
+ </xsl:for-each>
7530
+ </xsl:template>
7531
+
7345
7532
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7346
7533
  <xsl:variable name="svg_content" select="document(@src)"/>
7347
7534
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7480,6 +7667,8 @@
7480
7667
  <xsl:value-of select="."/>
7481
7668
  </xsl:template>
7482
7669
 
7670
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
7671
+
7483
7672
  <xsl:template match="node()" mode="contents">
7484
7673
  <xsl:apply-templates mode="contents"/>
7485
7674
  </xsl:template>
@@ -7596,6 +7785,13 @@
7596
7785
  <xsl:when test="$contents_nodes/doc">
7597
7786
  <xsl:choose>
7598
7787
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
7788
+
7789
+ <xsl:if test="$contents_nodes/collection">
7790
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
7791
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
7792
+ </fo:bookmark>
7793
+ </xsl:if>
7794
+
7599
7795
  <xsl:for-each select="$contents_nodes/doc">
7600
7796
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7601
7797
  <xsl:if test="@bundle = 'true'">
@@ -7787,7 +7983,15 @@
7787
7983
  <xsl:value-of select="@section"/>
7788
7984
  <xsl:text> </xsl:text>
7789
7985
  </xsl:if>
7790
- <xsl:value-of select="normalize-space(title)"/>
7986
+ <xsl:variable name="title">
7987
+ <xsl:for-each select="title/node()">
7988
+ <xsl:choose>
7989
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
7990
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7991
+ </xsl:choose>
7992
+ </xsl:for-each>
7993
+ </xsl:variable>
7994
+ <xsl:value-of select="normalize-space($title)"/>
7791
7995
  </fo:bookmark-title>
7792
7996
  <xsl:apply-templates mode="bookmark"/>
7793
7997
  </fo:bookmark>
@@ -7813,6 +8017,12 @@
7813
8017
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
7814
8018
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
7815
8019
 
8020
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
8021
+ <fo:block text-align="right" keep-with-next="always">
8022
+ <xsl:apply-templates/>
8023
+ </fo:block>
8024
+ </xsl:template>
8025
+
7816
8026
  <!-- ====== -->
7817
8027
  <!-- ====== -->
7818
8028
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -7962,6 +8172,10 @@
7962
8172
  </xsl:for-each>
7963
8173
  </xsl:template>
7964
8174
 
8175
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
8176
+ <xsl:value-of select="."/>
8177
+ </xsl:template>
8178
+
7965
8179
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
7966
8180
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
7967
8181
  <xsl:apply-templates mode="contents_item"/>
@@ -9470,6 +9684,44 @@
9470
9684
 
9471
9685
  <fo:list-block xsl:use-attribute-sets="list-style">
9472
9686
 
9687
+ <xsl:variable name="provisional_distance_between_starts_">
9688
+ <attributes xsl:use-attribute-sets="list-style">
9689
+
9690
+ </attributes>
9691
+ </xsl:variable>
9692
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
9693
+ <xsl:if test="$provisional_distance_between_starts != ''">
9694
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
9695
+ </xsl:if>
9696
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
9697
+
9698
+ <!-- increase provisional-distance-between-starts for long lists -->
9699
+ <xsl:if test="local-name() = 'ol'">
9700
+ <!-- Examples: xiii), xviii), xxviii) -->
9701
+ <xsl:variable name="item_numbers">
9702
+ <xsl:for-each select="*[local-name() = 'li']">
9703
+ <item><xsl:call-template name="getListItemFormat"/></item>
9704
+ </xsl:for-each>
9705
+ </xsl:variable>
9706
+
9707
+ <xsl:variable name="max_length">
9708
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
9709
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
9710
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
9711
+ </xsl:for-each>
9712
+ </xsl:variable>
9713
+
9714
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
9715
+ <xsl:variable name="addon" select="$max_length - 4"/>
9716
+ <xsl:if test="$addon &gt; 0">
9717
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
9718
+ </xsl:if>
9719
+ <!-- DEBUG -->
9720
+ <!-- <xsl:copy-of select="$item_numbers"/>
9721
+ <max_length><xsl:value-of select="$max_length"/></max_length>
9722
+ <addon><xsl:value-of select="$addon"/></addon> -->
9723
+ </xsl:if>
9724
+
9473
9725
  <xsl:if test="*[local-name() = 'name']">
9474
9726
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9475
9727
  </xsl:if>
@@ -10201,7 +10453,6 @@
10201
10453
  <xsl:if test="@type = 'editorial'">
10202
10454
  <xsl:attribute name="color">green</xsl:attribute>
10203
10455
  <xsl:attribute name="font-weight">normal</xsl:attribute>
10204
-
10205
10456
  <!-- <xsl:variable name="note-style">
10206
10457
  <style xsl:use-attribute-sets="note-style"></style>
10207
10458
  </xsl:variable>
@@ -10433,7 +10684,7 @@
10433
10684
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10434
10685
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10435
10686
  <!-- add &lt; and &gt; to \S -->
10436
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
10687
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
10437
10688
  <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
10438
10689
  <xsl:variable name="text3">
10439
10690
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -10455,7 +10706,8 @@
10455
10706
  <xsl:choose>
10456
10707
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
10457
10708
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10458
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
10709
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
10710
+ <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
10459
10711
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
10460
10712
  <xsl:choose>
10461
10713
  <xsl:when test="self::text()">
@@ -11055,6 +11307,23 @@
11055
11307
  </xsl:if>
11056
11308
  </xsl:template>
11057
11309
 
11310
+ <xsl:template name="setBlockAttributes">
11311
+ <xsl:param name="text_align_default">left</xsl:param>
11312
+ <xsl:call-template name="setTextAlignment">
11313
+ <xsl:with-param name="default" select="$text_align_default"/>
11314
+ </xsl:call-template>
11315
+
11316
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
11317
+ <!-- Example: keep-lines-together="true" -->
11318
+ <xsl:if test="@keep-lines-together = 'true'">
11319
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
11320
+ </xsl:if>
11321
+ <!-- Example: keep-with-next="true" -->
11322
+ <xsl:if test="@keep-with-next = 'true'">
11323
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11324
+ </xsl:if>
11325
+ </xsl:template>
11326
+
11058
11327
  <xsl:template name="number-to-words">
11059
11328
  <xsl:param name="number"/>
11060
11329
  <xsl:param name="first"/>