metanorma-cc 1.5.0 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0dd35d61e3b07c16de749842d94ba4db6b631161c959d3479ed41dda5120fb3
4
- data.tar.gz: 18c6b93d8c11b51bf18f8dbe4e3440ae761036b8d5e644c06290fe7eaa4652f2
3
+ metadata.gz: 941c50863de4016c3c72a513676f9e955e9afa7caf0bf09cfb01dc2176041e2f
4
+ data.tar.gz: 84c80743bd6df2db228c5289f6b95f174f2242c9747e5aed127bd77685c687c0
5
5
  SHA512:
6
- metadata.gz: aa81101b38172f9b85512624e80691981c0ba5bc86f4a6a00506e4a45d794c01ca0cd90e6ba66393382cac793e1cf8affbe820bf5afc60c068381d686a9dc6bf
7
- data.tar.gz: 462f9d6109b6c007c11a8ef10bad93ccd9b74aa7980101fcd818b42edf81137b43f695902e95d5b874a60fa02c18bef258fe1e5244d67327c060de3c3071b060
6
+ metadata.gz: 976210e1d2c6308cb2206a234a194d11f63b4b5924fc65e4e36461fe7417b978983a76909a3427bf25fd069fc6f56aebb16b2bdbf8740bbf30976bfc45ca826a
7
+ data.tar.gz: 89f6d272ce0827c1f083fe4c774be2b93f01cbc534b69e769f711832088a83740d35e2dcd91d4363d55e170950c585804def03825c1db4fcd23690647afaac97
@@ -402,6 +402,16 @@
402
402
  </choice>
403
403
  </attribute>
404
404
  </optional>
405
+ <optional>
406
+ <attribute name="valign">
407
+ <choice>
408
+ <value>top</value>
409
+ <value>middle</value>
410
+ <value>bottom</value>
411
+ <value>baseline</value>
412
+ </choice>
413
+ </attribute>
414
+ </optional>
405
415
  <choice>
406
416
  <zeroOrMore>
407
417
  <ref name="TextElement"/>
@@ -429,6 +439,16 @@
429
439
  </choice>
430
440
  </attribute>
431
441
  </optional>
442
+ <optional>
443
+ <attribute name="valign">
444
+ <choice>
445
+ <value>top</value>
446
+ <value>middle</value>
447
+ <value>bottom</value>
448
+ <value>baseline</value>
449
+ </choice>
450
+ </attribute>
451
+ </optional>
432
452
  <choice>
433
453
  <zeroOrMore>
434
454
  <ref name="TextElement"/>
@@ -998,6 +1018,9 @@
998
1018
  <value>alphabet_upper</value>
999
1019
  </choice>
1000
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1001
1024
  <oneOrMore>
1002
1025
  <ref name="li"/>
1003
1026
  </oneOrMore>
@@ -96,6 +96,13 @@
96
96
  </include>
97
97
  <define name="csd-standard">
98
98
  <element name="csd-standard">
99
+ <attribute name="version"/>
100
+ <attribute name="type">
101
+ <choice>
102
+ <value>semantic</value>
103
+ <value>presentation</value>
104
+ </choice>
105
+ </attribute>
99
106
  <ref name="bibdata"/>
100
107
  <zeroOrMore>
101
108
  <ref name="termdocsource"/>
@@ -4,26 +4,9 @@ require "fileutils"
4
4
 
5
5
  module Asciidoctor
6
6
  module CC
7
-
8
7
  class Converter < Standoc::Converter
9
-
10
- def metadata_author(node, xml)
11
- xml.contributor do |c|
12
- c.role **{ type: "author" }
13
- c.organization do |a|
14
- a.name "CalConnect"
15
- end
16
- end
17
- personal_author(node, xml)
18
- end
19
-
20
- def metadata_publisher(node, xml)
21
- xml.contributor do |c|
22
- c.role **{ type: "publisher" }
23
- c.organization do |a|
24
- a.name "CalConnect"
25
- end
26
- end
8
+ def default_publisher
9
+ "CalConnect"
27
10
  end
28
11
 
29
12
  def metadata_committee(node, xml)
@@ -50,7 +33,7 @@ module Asciidoctor
50
33
 
51
34
  def prefix_id(node)
52
35
  prefix = "CC"
53
- typesuffix = ::Metanorma::CC::DOCSUFFIX[node.attr("doctype")] || ""
36
+ typesuffix = ::Metanorma::CC::DOCSUFFIX[doctype(node)] || ""
54
37
  prefix += "/#{typesuffix}" unless typesuffix.empty?
55
38
  status = ::Metanorma::CC::DOCSTATUS[node.attr("status")] || ""
56
39
  prefix += "/#{status}" unless status.empty?
@@ -67,27 +50,18 @@ module Asciidoctor
67
50
  xml.docnumber node.attr("docnumber")
68
51
  end
69
52
 
53
+ @log_doctype = false
54
+
70
55
  def doctype(node)
71
- d = node.attr("doctype")
72
- unless ::Metanorma::CC::DOCSUFFIX.keys.include?(d)
56
+ d = super
57
+ unless ::Metanorma::CC::DOCSUFFIX.keys.include?(d) && !@log_doctype
73
58
  @log.add("Document Attributes", nil,
74
59
  "#{d} is not a legal document type: reverting to 'standard'")
60
+ @log_doctype = true
75
61
  d = "standard"
76
62
  end
77
63
  d
78
64
  end
79
-
80
- def metadata_copyright(node, xml)
81
- from = node.attr("copyright-year") || Date.today.year
82
- xml.copyright do |c|
83
- c.from from
84
- c.owner do |owner|
85
- owner.organization do |o|
86
- o.name "CalConnect"
87
- end
88
- end
89
- end
90
- end
91
65
  end
92
66
  end
93
67
  end
@@ -43,7 +43,9 @@
43
43
  <define name="xref">
44
44
  <element name="xref">
45
45
  <attribute name="target">
46
- <data type="IDREF"/>
46
+ <data type="string">
47
+ <param name="pattern">\i\c*|\c+#\c+</param>
48
+ </data>
47
49
  </attribute>
48
50
  <optional>
49
51
  <attribute name="type">
@@ -61,6 +63,11 @@
61
63
  </choice>
62
64
  </attribute>
63
65
  </optional>
66
+ <optional>
67
+ <attribute name="droploc">
68
+ <data type="boolean"/>
69
+ </attribute>
70
+ </optional>
64
71
  <text/>
65
72
  </element>
66
73
  </define>
@@ -578,6 +585,8 @@
578
585
  <ref name="ol"/>
579
586
  <ref name="dl"/>
580
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
581
590
  </choice>
582
591
  </oneOrMore>
583
592
  </element>
@@ -661,6 +670,16 @@
661
670
  </choice>
662
671
  </attribute>
663
672
  </optional>
673
+ <optional>
674
+ <attribute name="valign">
675
+ <choice>
676
+ <value>top</value>
677
+ <value>middle</value>
678
+ <value>bottom</value>
679
+ <value>baseline</value>
680
+ </choice>
681
+ </attribute>
682
+ </optional>
664
683
  <choice>
665
684
  <zeroOrMore>
666
685
  <choice>
@@ -697,6 +716,16 @@
697
716
  </choice>
698
717
  </attribute>
699
718
  </optional>
719
+ <optional>
720
+ <attribute name="valign">
721
+ <choice>
722
+ <value>top</value>
723
+ <value>middle</value>
724
+ <value>bottom</value>
725
+ <value>baseline</value>
726
+ </choice>
727
+ </attribute>
728
+ </optional>
700
729
  <choice>
701
730
  <zeroOrMore>
702
731
  <choice>
@@ -834,6 +863,13 @@
834
863
  </define>
835
864
  <define name="standard-document">
836
865
  <element name="standard-document">
866
+ <attribute name="version"/>
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>semantic</value>
870
+ <value>presentation</value>
871
+ </choice>
872
+ </attribute>
837
873
  <ref name="bibdata"/>
838
874
  <optional>
839
875
  <ref name="boilerplate"/>
@@ -855,7 +891,7 @@
855
891
  <oneOrMore>
856
892
  <choice>
857
893
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
859
895
  <ref name="foreword"/>
860
896
  <ref name="introduction"/>
861
897
  <ref name="acknowledgements"/>
@@ -1049,14 +1085,17 @@
1049
1085
  <ref name="section-title"/>
1050
1086
  </optional>
1051
1087
  <group>
1052
- <group>
1053
- <zeroOrMore>
1054
- <ref name="BasicBlock"/>
1055
- </zeroOrMore>
1056
- <zeroOrMore>
1057
- <ref name="note"/>
1058
- </zeroOrMore>
1059
- </group>
1088
+ <choice>
1089
+ <group>
1090
+ <zeroOrMore>
1091
+ <ref name="BasicBlock"/>
1092
+ </zeroOrMore>
1093
+ <zeroOrMore>
1094
+ <ref name="note"/>
1095
+ </zeroOrMore>
1096
+ </group>
1097
+ <ref name="amend"/>
1098
+ </choice>
1060
1099
  <zeroOrMore>
1061
1100
  <choice>
1062
1101
  <ref name="clause-subsection"/>
@@ -1453,11 +1492,6 @@
1453
1492
  </optional>
1454
1493
  </element>
1455
1494
  </define>
1456
- <define name="preface_abstract">
1457
- <element name="abstract">
1458
- <ref name="Basic-Section"/>
1459
- </element>
1460
- </define>
1461
1495
  <define name="term-clause">
1462
1496
  <element name="clause">
1463
1497
  <optional>
@@ -1507,4 +1541,79 @@
1507
1541
  <ref name="CitationType"/>
1508
1542
  </element>
1509
1543
  </define>
1544
+ <define name="amend">
1545
+ <element name="amend">
1546
+ <optional>
1547
+ <attribute name="id">
1548
+ <data type="ID"/>
1549
+ </attribute>
1550
+ </optional>
1551
+ <attribute name="change">
1552
+ <choice>
1553
+ <value>add</value>
1554
+ <value>modify</value>
1555
+ <value>delete</value>
1556
+ </choice>
1557
+ </attribute>
1558
+ <optional>
1559
+ <attribute name="path"/>
1560
+ </optional>
1561
+ <optional>
1562
+ <attribute name="path_end"/>
1563
+ </optional>
1564
+ <optional>
1565
+ <attribute name="title"/>
1566
+ </optional>
1567
+ <optional>
1568
+ <element name="location">
1569
+ <zeroOrMore>
1570
+ <ref name="locality"/>
1571
+ </zeroOrMore>
1572
+ </element>
1573
+ </optional>
1574
+ <zeroOrMore>
1575
+ <ref name="autonumber"/>
1576
+ </zeroOrMore>
1577
+ <optional>
1578
+ <element name="description">
1579
+ <zeroOrMore>
1580
+ <ref name="BasicBlock"/>
1581
+ </zeroOrMore>
1582
+ </element>
1583
+ </optional>
1584
+ <optional>
1585
+ <element name="newcontent">
1586
+ <zeroOrMore>
1587
+ <ref name="BasicBlock"/>
1588
+ </zeroOrMore>
1589
+ </element>
1590
+ </optional>
1591
+ <optional>
1592
+ <element name="description">
1593
+ <zeroOrMore>
1594
+ <ref name="BasicBlock"/>
1595
+ </zeroOrMore>
1596
+ </element>
1597
+ </optional>
1598
+ </element>
1599
+ </define>
1600
+ <define name="autonumber">
1601
+ <element name="autonumber">
1602
+ <attribute name="type">
1603
+ <choice>
1604
+ <value>requirement</value>
1605
+ <value>recommendation</value>
1606
+ <value>permission</value>
1607
+ <value>table</value>
1608
+ <value>figure</value>
1609
+ <value>admonition</value>
1610
+ <value>formula</value>
1611
+ <value>sourcecode</value>
1612
+ <value>example</value>
1613
+ <value>note</value>
1614
+ </choice>
1615
+ </attribute>
1616
+ <text/>
1617
+ </element>
1618
+ </define>
1510
1619
  </grammar>
@@ -26,20 +26,8 @@
26
26
 
27
27
  <xsl:variable name="contents">
28
28
  <contents>
29
- <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()" mode="contents"/>
30
-
31
- <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]" mode="contents"/> <!-- [@id = '_scope'] -->
32
-
33
- <!-- Normative references -->
34
- <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]" mode="contents"/> <!-- [@id = '_normative_references'] -->
35
-
36
- <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]" mode="contents"/> <!-- @id != '_scope' -->
37
-
38
- <xsl:apply-templates select="/csd:csd-standard/csd:annex" mode="contents"/>
39
-
40
- <!-- Bibliography -->
41
- <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]" mode="contents"/> <!-- @id = '_bibliography' -->
42
-
29
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
30
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
43
31
  </contents>
44
32
  </xsl:variable>
45
33
 
@@ -49,7 +37,7 @@
49
37
 
50
38
  <xsl:template match="/">
51
39
  <xsl:call-template name="namespaceCheck"/>
52
- <fo:root font-family="SourceSansPro, STIX2Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
40
+ <fo:root font-family="SourceSansPro, STIX Two Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
53
41
  <fo:layout-master-set>
54
42
  <!-- Cover page -->
55
43
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
@@ -120,7 +108,10 @@
120
108
  </fo:layout-master-set>
121
109
 
122
110
  <xsl:call-template name="addPDFUAmeta"/>
123
-
111
+
112
+ <xsl:call-template name="addBookmarks">
113
+ <xsl:with-param name="contents" select="$contents"/>
114
+ </xsl:call-template>
124
115
 
125
116
  <!-- Cover Page -->
126
117
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -237,7 +228,7 @@
237
228
  </xsl:variable>
238
229
  <fo:block font-size="14pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block>
239
230
 
240
- <xsl:for-each select="xalan:nodeset($contents)//item"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
231
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
241
232
 
242
233
  <fo:block>
243
234
  <xsl:if test="@level = 1">
@@ -261,15 +252,8 @@
261
252
  </fo:list-item-label>
262
253
  <fo:list-item-body start-indent="body-start()">
263
254
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
264
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
265
- <!-- <xsl:if test="@section and @display-section = 'false'">
266
- <xsl:value-of select="@section"/><xsl:text> </xsl:text>
267
- </xsl:if>
268
- <xsl:if test="@addon != ''">
269
- <xsl:text>(</xsl:text><xsl:value-of select="@addon"/><xsl:text>)</xsl:text>
270
- </xsl:if>
271
- <xsl:text> </xsl:text><xsl:value-of select="text()"/> -->
272
- <xsl:apply-templates/>
255
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
256
+ <xsl:apply-templates select="title"/>
273
257
  <fo:inline keep-together.within-line="always">
274
258
  <fo:leader leader-pattern="dots"/>
275
259
  <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
@@ -283,8 +267,8 @@
283
267
  </xsl:for-each>
284
268
  </fo:block-container>
285
269
 
286
- <!-- Foreword, Introduction -->
287
- <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()"/>
270
+ <!-- Foreword, Introduction -->
271
+ <xsl:call-template name="processPrefaceSectionsDefault"/>
288
272
 
289
273
  </fo:flow>
290
274
  </fo:page-sequence>
@@ -303,19 +287,7 @@
303
287
  <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
304
288
  </fo:block>
305
289
  <fo:block>
306
- <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]"/> <!-- Scope -->
307
-
308
- <!-- Normative references -->
309
- <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]"/>
310
-
311
- <!-- Other Sections -->
312
- <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]"/>
313
-
314
- <xsl:apply-templates select="/csd:csd-standard/csd:annex"/>
315
-
316
- <!-- Bibliography -->
317
- <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]"/>
318
-
290
+ <xsl:call-template name="processMainSectionsDefault"/>
319
291
  </fo:block>
320
292
  </fo:flow>
321
293
  </fo:page-sequence>
@@ -346,14 +318,20 @@
346
318
 
347
319
  <xsl:variable name="display">
348
320
  <xsl:choose>
349
- <xsl:when test="ancestor-or-self::csd:bibitem">false</xsl:when>
350
- <xsl:when test="ancestor-or-self::csd:term">false</xsl:when>
351
321
  <xsl:when test="$level &gt; 2">false</xsl:when>
352
322
  <xsl:otherwise>true</xsl:otherwise>
353
323
  </xsl:choose>
354
324
  </xsl:variable>
355
325
 
356
- <xsl:if test="$display = 'true'">
326
+ <xsl:variable name="skip">
327
+ <xsl:choose>
328
+ <xsl:when test="ancestor-or-self::csd:bibitem">true</xsl:when>
329
+ <xsl:when test="ancestor-or-self::csd:term">true</xsl:when>
330
+ <xsl:otherwise>false</xsl:otherwise>
331
+ </xsl:choose>
332
+ </xsl:variable>
333
+
334
+ <xsl:if test="$skip = 'false'">
357
335
 
358
336
  <xsl:variable name="section">
359
337
  <xsl:call-template name="getSection"/>
@@ -363,10 +341,12 @@
363
341
  <xsl:call-template name="getName"/>
364
342
  </xsl:variable>
365
343
 
366
- <item id="{@id}" level="{$level}" section="{$section}">
367
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
344
+ <item id="{@id}" level="{$level}" section="{$section}" display="{$display}">
345
+ <title>
346
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
347
+ </title>
348
+ <xsl:apply-templates mode="contents"/>
368
349
  </item>
369
- <xsl:apply-templates mode="contents"/>
370
350
  </xsl:if>
371
351
 
372
352
  </xsl:template>
@@ -598,7 +578,7 @@
598
578
 
599
579
 
600
580
 
601
- <xsl:template match="csd:ul | csd:ol">
581
+ <xsl:template match="csd:ul | csd:ol" mode="ul_ol">
602
582
  <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt">
603
583
  <xsl:if test="ancestor::csd:ol">
604
584
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -662,7 +642,7 @@
662
642
 
663
643
 
664
644
  <!-- <xsl:template match="csd:references[@id = '_bibliography']"> -->
665
- <xsl:template match="csd:references[position() &gt; 1]">
645
+ <xsl:template match="csd:references[not(@normative='true')]">
666
646
  <fo:block break-after="page"/>
667
647
  <fo:block id="{@id}">
668
648
  <xsl:apply-templates/>
@@ -672,7 +652,7 @@
672
652
 
673
653
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
674
654
  <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem"> -->
675
- <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem">
655
+ <xsl:template match="csd:references[not(@normative='true')]/csd:bibitem">
676
656
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
677
657
  <fo:list-item>
678
658
  <fo:list-item-label end-indent="label-end()">
@@ -707,10 +687,10 @@
707
687
  </xsl:template>
708
688
 
709
689
  <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem" mode="contents"/> -->
710
- <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem" mode="contents"/>
690
+ <xsl:template match="csd:references[not(@normative='true')]/csd:bibitem" mode="contents"/>
711
691
 
712
692
  <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem/csd:title"> -->
713
- <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem/csd:title">
693
+ <xsl:template match="csd:references[not(@normative='true')]/csd:bibitem/csd:title">
714
694
  <fo:inline font-style="italic">
715
695
  <xsl:apply-templates/>
716
696
  </fo:inline>
@@ -834,6 +814,12 @@
834
814
 
835
815
  </title-edition>
836
816
 
817
+ <title-edition lang="fr">
818
+
819
+ <xsl:text>Édition </xsl:text>
820
+
821
+ </title-edition>
822
+
837
823
 
838
824
  <title-toc lang="en">
839
825
 
@@ -842,7 +828,12 @@
842
828
 
843
829
 
844
830
  </title-toc>
845
- <title-toc lang="fr">Sommaire</title-toc>
831
+ <title-toc lang="fr">
832
+
833
+ <xsl:text>Sommaire</xsl:text>
834
+
835
+
836
+ </title-toc>
846
837
 
847
838
  <title-toc lang="zh">Contents</title-toc>
848
839
 
@@ -876,7 +867,12 @@
876
867
 
877
868
 
878
869
 
879
- <title-source lang="en">SOURCE</title-source>
870
+ <title-source lang="en">
871
+
872
+ <xsl:text>SOURCE</xsl:text>
873
+
874
+
875
+ </title-source>
880
876
 
881
877
  <title-keywords lang="en">Keywords</title-keywords>
882
878
 
@@ -919,12 +915,25 @@
919
915
  <title-warning lang="zh">警告</title-warning>
920
916
 
921
917
  <title-amendment lang="en">AMENDMENT</title-amendment>
918
+
919
+ <title-continued lang="en">(continued)</title-continued>
920
+ <title-continued lang="fr">(continué)</title-continued>
921
+
922
922
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
923
923
  <xsl:param name="name"/>
924
- <xsl:variable name="lang">
925
- <xsl:call-template name="getLang"/>
924
+ <xsl:param name="lang"/>
925
+ <xsl:variable name="lang_">
926
+ <xsl:choose>
927
+ <xsl:when test="$lang != ''">
928
+ <xsl:value-of select="$lang"/>
929
+ </xsl:when>
930
+ <xsl:otherwise>
931
+ <xsl:call-template name="getLang"/>
932
+ </xsl:otherwise>
933
+ </xsl:choose>
926
934
  </xsl:variable>
927
- <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
935
+ <xsl:variable name="language" select="normalize-space($lang_)"/>
936
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $language]"/>
928
937
  <xsl:choose>
929
938
  <xsl:when test="normalize-space($title_) != ''">
930
939
  <xsl:value-of select="$title_"/>
@@ -933,20 +942,22 @@
933
942
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
934
943
  </xsl:otherwise>
935
944
  </xsl:choose>
936
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
945
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
946
+
947
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
937
948
 
938
949
  <xsl:attribute name="color">blue</xsl:attribute>
939
950
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
940
951
 
941
952
 
953
+
942
954
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
943
955
  <xsl:attribute name="white-space">pre</xsl:attribute>
944
956
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
945
957
 
946
958
 
947
959
 
948
- <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
949
- <xsl:attribute name="font-size">10pt</xsl:attribute>
960
+ <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
950
961
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
951
962
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
952
963
 
@@ -955,6 +966,7 @@
955
966
 
956
967
 
957
968
 
969
+
958
970
  </xsl:attribute-set><xsl:attribute-set name="permission-style">
959
971
 
960
972
  </xsl:attribute-set><xsl:attribute-set name="permission-name-style">
@@ -1001,11 +1013,13 @@
1001
1013
 
1002
1014
 
1003
1015
 
1016
+
1004
1017
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1005
1018
 
1006
1019
 
1007
1020
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
1008
1021
 
1022
+
1009
1023
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1010
1024
 
1011
1025
 
@@ -1025,6 +1039,9 @@
1025
1039
 
1026
1040
 
1027
1041
 
1042
+
1043
+
1044
+
1028
1045
 
1029
1046
  </xsl:attribute-set><xsl:attribute-set name="example-p-style">
1030
1047
 
@@ -1040,6 +1057,8 @@
1040
1057
 
1041
1058
 
1042
1059
 
1060
+
1061
+
1043
1062
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1044
1063
 
1045
1064
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1063,6 +1082,8 @@
1063
1082
 
1064
1083
 
1065
1084
 
1085
+
1086
+
1066
1087
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1067
1088
 
1068
1089
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1082,7 +1103,8 @@
1082
1103
 
1083
1104
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
1084
1105
 
1085
-
1106
+
1107
+
1086
1108
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1087
1109
 
1088
1110
 
@@ -1090,6 +1112,7 @@
1090
1112
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1091
1113
 
1092
1114
 
1115
+
1093
1116
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1094
1117
 
1095
1118
 
@@ -1107,12 +1130,13 @@
1107
1130
 
1108
1131
 
1109
1132
 
1133
+ </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
1134
+
1110
1135
 
1136
+ <xsl:attribute name="padding-right">6mm</xsl:attribute>
1111
1137
 
1112
- </xsl:attribute-set><xsl:attribute-set name="note-name-style">
1113
1138
 
1114
1139
 
1115
- <xsl:attribute name="padding-right">6mm</xsl:attribute>
1116
1140
 
1117
1141
 
1118
1142
 
@@ -1120,7 +1144,6 @@
1120
1144
 
1121
1145
 
1122
1146
 
1123
-
1124
1147
 
1125
1148
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1126
1149
 
@@ -1147,6 +1170,8 @@
1147
1170
 
1148
1171
 
1149
1172
 
1173
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1174
+
1150
1175
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1151
1176
 
1152
1177
 
@@ -1176,12 +1201,14 @@
1176
1201
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1177
1202
 
1178
1203
 
1204
+
1179
1205
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1180
1206
 
1181
1207
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1182
1208
 
1183
1209
 
1184
1210
 
1211
+
1185
1212
 
1186
1213
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1187
1214
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1200,7 +1227,7 @@
1200
1227
 
1201
1228
 
1202
1229
 
1203
-
1230
+
1204
1231
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
1205
1232
 
1206
1233
  </xsl:attribute-set><xsl:attribute-set name="image-style">
@@ -1224,8 +1251,8 @@
1224
1251
 
1225
1252
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1226
1253
 
1227
- <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
1228
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1254
+ <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
1255
+
1229
1256
 
1230
1257
 
1231
1258
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
@@ -1233,6 +1260,8 @@
1233
1260
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1234
1261
  <xsl:attribute name="text-align">center</xsl:attribute>
1235
1262
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1263
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1264
+
1236
1265
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1237
1266
 
1238
1267
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1245,7 +1274,43 @@
1245
1274
 
1246
1275
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1247
1276
 
1248
- </xsl:attribute-set><xsl:template match="text()">
1277
+ </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1278
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1279
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1280
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1281
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1282
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1283
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1284
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1285
+
1286
+ <!-- Normative references -->
1287
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1288
+ <!-- Terms and definitions -->
1289
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
1290
+ <!-- Another main sections -->
1291
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
1292
+ <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1293
+ <!-- Bibliography -->
1294
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1295
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1296
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1297
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1298
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1299
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1300
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1301
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1302
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1303
+
1304
+ <!-- Normative references -->
1305
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']"/>
1306
+ <!-- Terms and definitions -->
1307
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]"/>
1308
+ <!-- Another main sections -->
1309
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]"/>
1310
+ <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1311
+ <!-- Bibliography -->
1312
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1313
+ </xsl:template><xsl:template match="text()">
1249
1314
  <xsl:value-of select="."/>
1250
1315
  </xsl:template><xsl:template match="*[local-name()='br']">
1251
1316
  <xsl:value-of select="$linebreak"/>
@@ -1262,6 +1327,10 @@
1262
1327
 
1263
1328
 
1264
1329
 
1330
+
1331
+
1332
+ <!-- $namespace = 'iso' or -->
1333
+
1265
1334
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1266
1335
 
1267
1336
 
@@ -1297,6 +1366,7 @@
1297
1366
  <xsl:with-param name="table" select="$simple-table"/>
1298
1367
  </xsl:call-template>
1299
1368
  </xsl:variable>
1369
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1300
1370
 
1301
1371
  <!-- <xsl:variable name="colwidths2">
1302
1372
  <xsl:call-template name="calculate-column-widths">
@@ -1317,26 +1387,52 @@
1317
1387
 
1318
1388
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1319
1389
 
1390
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1320
1391
 
1321
1392
 
1393
+
1394
+
1395
+
1322
1396
 
1323
1397
 
1398
+
1324
1399
 
1325
1400
 
1326
1401
 
1327
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
1328
-
1329
-
1330
-
1402
+
1403
+
1404
+
1405
+
1406
+ <xsl:variable name="table_attributes">
1407
+ <attribute name="table-layout">fixed</attribute>
1408
+ <attribute name="width">100%</attribute>
1409
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1410
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1331
1411
 
1332
1412
 
1333
1413
 
1334
1414
 
1415
+
1416
+
1417
+
1335
1418
 
1419
+
1336
1420
 
1337
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1421
+ </xsl:variable>
1422
+
1423
+
1424
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1338
1425
 
1426
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1427
+ <xsl:attribute name="{@name}">
1428
+ <xsl:value-of select="."/>
1429
+ </xsl:attribute>
1430
+ </xsl:for-each>
1339
1431
 
1432
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1433
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1434
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1435
+ </xsl:if>
1340
1436
 
1341
1437
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
1342
1438
  <xsl:choose>
@@ -1360,6 +1456,33 @@
1360
1456
 
1361
1457
  </fo:table>
1362
1458
 
1459
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1460
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1461
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1462
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1463
+ </xsl:call-template>
1464
+ </xsl:for-each>
1465
+
1466
+ <!-- insert footer as table -->
1467
+ <!-- <fo:table>
1468
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1469
+ <xsl:attribute name="{@name}">
1470
+ <xsl:value-of select="."/>
1471
+ </xsl:attribute>
1472
+ </xsl:for-each>
1473
+
1474
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1475
+ <xsl:choose>
1476
+ <xsl:when test=". = 1 or . = 0">
1477
+ <fo:table-column column-width="proportional-column-width(2)"/>
1478
+ </xsl:when>
1479
+ <xsl:otherwise>
1480
+ <fo:table-column column-width="proportional-column-width({.})"/>
1481
+ </xsl:otherwise>
1482
+ </xsl:choose>
1483
+ </xsl:for-each>
1484
+ </fo:table>-->
1485
+
1363
1486
 
1364
1487
 
1365
1488
 
@@ -1368,8 +1491,9 @@
1368
1491
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1369
1492
  <xsl:if test="normalize-space() != ''">
1370
1493
  <fo:block xsl:use-attribute-sets="table-name-style">
1371
- <xsl:apply-templates/>
1372
- </fo:block>
1494
+
1495
+ <xsl:apply-templates/>
1496
+ </fo:block>
1373
1497
  </xsl:if>
1374
1498
  </xsl:template><xsl:template name="calculate-columns-numbers">
1375
1499
  <xsl:param name="table-row"/>
@@ -1423,6 +1547,13 @@
1423
1547
  <xsl:for-each select="xalan:nodeset($table)//tr">
1424
1548
  <xsl:variable name="td_text">
1425
1549
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1550
+
1551
+ <!-- <xsl:if test="$namespace = 'bipm'">
1552
+ <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']">
1553
+ <word><xsl:value-of select="normalize-space(.)"/></word>
1554
+ </xsl:for-each>
1555
+ </xsl:if> -->
1556
+
1426
1557
  </xsl:variable>
1427
1558
  <xsl:variable name="words">
1428
1559
  <xsl:variable name="string_with_added_zerospaces">
@@ -1482,13 +1613,31 @@
1482
1613
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
1483
1614
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1484
1615
  <xsl:value-of select="@target"/>
1616
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1617
+ <xsl:variable name="math_text" select="normalize-space(.)"/>
1618
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1485
1619
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1486
1620
  <xsl:param name="cols-count"/>
1487
1621
  <!-- font-weight="bold" -->
1488
- <fo:table-header>
1622
+ <fo:table-header>
1489
1623
 
1490
1624
  <xsl:apply-templates/>
1491
1625
  </fo:table-header>
1626
+ </xsl:template><xsl:template name="table-header-title">
1627
+ <xsl:param name="cols-count"/>
1628
+ <!-- row for title -->
1629
+ <fo:table-row>
1630
+ <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
1631
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1632
+ <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1633
+ <xsl:call-template name="fn_name_display"/>
1634
+ </xsl:for-each>
1635
+ <fo:block text-align="right" font-style="italic">
1636
+ <xsl:text> </xsl:text>
1637
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1638
+ </fo:block>
1639
+ </fo:table-cell>
1640
+ </fo:table-row>
1492
1641
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
1493
1642
  <fo:table-body>
1494
1643
  <xsl:apply-templates/>
@@ -1496,6 +1645,13 @@
1496
1645
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
1497
1646
  <xsl:apply-templates/>
1498
1647
  </xsl:template><xsl:template name="insertTableFooter">
1648
+ <xsl:param name="cols-count"/>
1649
+ <xsl:if test="../*[local-name()='tfoot']">
1650
+ <fo:table-footer>
1651
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
1652
+ </fo:table-footer>
1653
+ </xsl:if>
1654
+ </xsl:template><xsl:template name="insertTableFooter2">
1499
1655
  <xsl:param name="cols-count"/>
1500
1656
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1501
1657
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -1517,11 +1673,15 @@
1517
1673
  <!-- fn will be processed inside 'note' processing -->
1518
1674
 
1519
1675
 
1520
- <!-- except gb -->
1676
+
1677
+ <!-- except gb and bipm -->
1521
1678
 
1522
1679
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1523
1680
 
1524
1681
 
1682
+
1683
+
1684
+
1525
1685
  <!-- horizontal row separator -->
1526
1686
 
1527
1687
 
@@ -1535,6 +1695,84 @@
1535
1695
  </fo:table-footer>
1536
1696
 
1537
1697
  </xsl:if>
1698
+ </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1699
+ <xsl:param name="table_attributes"/>
1700
+ <xsl:param name="colwidths"/>
1701
+
1702
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1703
+
1704
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1705
+
1706
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1707
+
1708
+ <fo:table keep-with-previous="always">
1709
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1710
+ <xsl:choose>
1711
+ <xsl:when test="@name = 'border-top'">
1712
+ <xsl:attribute name="{@name}">0pt solid black</xsl:attribute>
1713
+ </xsl:when>
1714
+ <xsl:when test="@name = 'border'">
1715
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1716
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
1717
+ </xsl:when>
1718
+ <xsl:otherwise>
1719
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1720
+ </xsl:otherwise>
1721
+ </xsl:choose>
1722
+ </xsl:for-each>
1723
+
1724
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1725
+ <xsl:choose>
1726
+ <xsl:when test=". = 1 or . = 0">
1727
+ <fo:table-column column-width="proportional-column-width(2)"/>
1728
+ </xsl:when>
1729
+ <xsl:otherwise>
1730
+ <fo:table-column column-width="proportional-column-width({.})"/>
1731
+ </xsl:otherwise>
1732
+ </xsl:choose>
1733
+ </xsl:for-each>
1734
+
1735
+ <fo:table-body>
1736
+ <fo:table-row>
1737
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
1738
+
1739
+
1740
+
1741
+ <!-- fn will be processed inside 'note' processing -->
1742
+
1743
+
1744
+
1745
+ <!-- except gb and bipm -->
1746
+
1747
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1748
+
1749
+
1750
+ <!-- <xsl:if test="$namespace = 'bipm'">
1751
+ <xsl:choose>
1752
+ <xsl:when test="ancestor::*[local-name()='preface']">
1753
+ show Note under table in preface (ex. abstract) sections
1754
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1755
+ </xsl:when>
1756
+ <xsl:otherwise>
1757
+ empty, because notes show at page side in main sections
1758
+ <fo:block/>
1759
+ </xsl:otherwise>
1760
+ </xsl:choose>
1761
+ </xsl:if> -->
1762
+
1763
+
1764
+ <!-- horizontal row separator -->
1765
+
1766
+
1767
+ <!-- fn processing -->
1768
+ <xsl:call-template name="fn_display"/>
1769
+
1770
+ </fo:table-cell>
1771
+ </fo:table-row>
1772
+ </fo:table-body>
1773
+
1774
+ </fo:table>
1775
+ </xsl:if>
1538
1776
  </xsl:template><xsl:template match="*[local-name()='tbody']">
1539
1777
 
1540
1778
  <xsl:variable name="cols-count">
@@ -1552,6 +1790,8 @@
1552
1790
  </xsl:choose>
1553
1791
  </xsl:variable>
1554
1792
 
1793
+
1794
+
1555
1795
  <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
1556
1796
  <xsl:with-param name="cols-count" select="$cols-count"/>
1557
1797
  </xsl:apply-templates>
@@ -1561,6 +1801,8 @@
1561
1801
  </xsl:call-template>
1562
1802
 
1563
1803
  <fo:table-body>
1804
+
1805
+
1564
1806
  <xsl:apply-templates/>
1565
1807
  <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
1566
1808
 
@@ -1584,10 +1826,23 @@
1584
1826
  </xsl:if>
1585
1827
 
1586
1828
 
1829
+
1830
+
1587
1831
  <xsl:apply-templates/>
1588
1832
  </fo:table-row>
1589
1833
  </xsl:template><xsl:template match="*[local-name()='th']">
1590
1834
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
1835
+ <xsl:attribute name="text-align">
1836
+ <xsl:choose>
1837
+ <xsl:when test="@align">
1838
+ <xsl:value-of select="@align"/>
1839
+ </xsl:when>
1840
+ <xsl:otherwise>center</xsl:otherwise>
1841
+ </xsl:choose>
1842
+ </xsl:attribute>
1843
+
1844
+
1845
+
1591
1846
 
1592
1847
 
1593
1848
 
@@ -1606,16 +1861,38 @@
1606
1861
  <xsl:value-of select="@rowspan"/>
1607
1862
  </xsl:attribute>
1608
1863
  </xsl:if>
1864
+ <xsl:call-template name="display-align"/>
1609
1865
  <fo:block>
1610
1866
  <xsl:apply-templates/>
1611
1867
  </fo:block>
1612
1868
  </fo:table-cell>
1869
+ </xsl:template><xsl:template name="display-align">
1870
+ <xsl:if test="@valign">
1871
+ <xsl:attribute name="display-align">
1872
+ <xsl:choose>
1873
+ <xsl:when test="@valign = 'top'">before</xsl:when>
1874
+ <xsl:when test="@valign = 'middle'">center</xsl:when>
1875
+ <xsl:when test="@valign = 'bottom'">after</xsl:when>
1876
+ <xsl:otherwise>before</xsl:otherwise>
1877
+ </xsl:choose>
1878
+ </xsl:attribute>
1879
+ </xsl:if>
1613
1880
  </xsl:template><xsl:template match="*[local-name()='td']">
1614
1881
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
1882
+ <xsl:attribute name="text-align">
1883
+ <xsl:choose>
1884
+ <xsl:when test="@align">
1885
+ <xsl:value-of select="@align"/>
1886
+ </xsl:when>
1887
+ <xsl:otherwise>left</xsl:otherwise>
1888
+ </xsl:choose>
1889
+ </xsl:attribute>
1890
+
1891
+
1892
+
1615
1893
 
1616
1894
 
1617
1895
 
1618
-
1619
1896
 
1620
1897
 
1621
1898
 
@@ -1631,8 +1908,8 @@
1631
1908
  <xsl:value-of select="@rowspan"/>
1632
1909
  </xsl:attribute>
1633
1910
  </xsl:if>
1634
- <fo:block>
1635
-
1911
+ <xsl:call-template name="display-align"/>
1912
+ <fo:block>
1636
1913
  <xsl:apply-templates/>
1637
1914
  </fo:block>
1638
1915
  </fo:table-cell>
@@ -1644,14 +1921,17 @@
1644
1921
 
1645
1922
 
1646
1923
 
1924
+
1925
+
1647
1926
  <fo:inline padding-right="2mm">
1648
1927
 
1649
1928
 
1650
1929
 
1651
-
1930
+
1652
1931
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
1653
1932
 
1654
1933
  </fo:inline>
1934
+
1655
1935
  <xsl:apply-templates mode="process"/>
1656
1936
  </fo:block>
1657
1937
 
@@ -1675,6 +1955,7 @@
1675
1955
 
1676
1956
 
1677
1957
 
1958
+
1678
1959
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
1679
1960
 
1680
1961
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -1684,12 +1965,15 @@
1684
1965
 
1685
1966
 
1686
1967
 
1968
+
1687
1969
  <xsl:value-of select="@reference"/>
1688
1970
 
1971
+
1689
1972
  </fo:inline>
1690
1973
  <fo:inline>
1691
1974
 
1692
- <xsl:apply-templates/>
1975
+ <!-- <xsl:apply-templates /> -->
1976
+ <xsl:copy-of select="./node()"/>
1693
1977
  </fo:inline>
1694
1978
  </fo:block>
1695
1979
  </xsl:if>
@@ -1726,7 +2010,20 @@
1726
2010
  <xsl:variable name="following_dl_colwidths">
1727
2011
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
1728
2012
  <xsl:variable name="html-table">
1729
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2013
+ <xsl:variable name="doc_ns">
2014
+
2015
+ </xsl:variable>
2016
+ <xsl:variable name="ns">
2017
+ <xsl:choose>
2018
+ <xsl:when test="normalize-space($doc_ns) != ''">
2019
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2020
+ </xsl:when>
2021
+ <xsl:otherwise>
2022
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2023
+ </xsl:otherwise>
2024
+ </xsl:choose>
2025
+ </xsl:variable>
2026
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
1730
2027
  <xsl:element name="{$ns}:table">
1731
2028
  <xsl:for-each select="*[local-name() = 'dl'][1]">
1732
2029
  <tbody>
@@ -1791,7 +2088,8 @@
1791
2088
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
1792
2089
  </xsl:if>
1793
2090
 
1794
- <xsl:apply-templates/>
2091
+ <!-- <xsl:apply-templates /> -->
2092
+ <xsl:copy-of select="./node()"/>
1795
2093
  </fo:block>
1796
2094
  </fo:table-cell>
1797
2095
  </fo:table-row>
@@ -1809,9 +2107,13 @@
1809
2107
 
1810
2108
 
1811
2109
 
2110
+
2111
+
1812
2112
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
1813
2113
 
2114
+
1814
2115
  <xsl:value-of select="@reference"/>
2116
+
1815
2117
  </fo:basic-link>
1816
2118
  </fo:inline>
1817
2119
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -1819,115 +2121,142 @@
1819
2121
  <xsl:apply-templates/>
1820
2122
  </fo:inline>
1821
2123
  </xsl:template><xsl:template match="*[local-name()='dl']">
1822
- <xsl:variable name="parent" select="local-name(..)"/>
1823
-
1824
- <xsl:variable name="key_iso">
1825
- <!-- and (not(../@class) or ../@class !='pseudocode') -->
1826
- </xsl:variable>
1827
-
1828
- <xsl:choose>
1829
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
1830
-
1831
-
1832
- <fo:block margin-bottom="12pt" text-align="left">
1833
-
1834
- <xsl:variable name="title-where">
1835
- <xsl:call-template name="getTitle">
1836
- <xsl:with-param name="name" select="'title-where'"/>
1837
- </xsl:call-template>
1838
- </xsl:variable>
1839
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
1840
- <xsl:apply-templates select="*[local-name()='dt']/*"/>
1841
- <xsl:text/>
1842
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
1843
- </fo:block>
1844
-
1845
- </xsl:when>
1846
- <xsl:when test="$parent = 'formula'"> <!-- a few components -->
1847
- <fo:block margin-bottom="12pt" text-align="left">
1848
-
1849
-
1850
-
1851
-
1852
- <xsl:variable name="title-where">
1853
- <xsl:call-template name="getTitle">
1854
- <xsl:with-param name="name" select="'title-where'"/>
1855
- </xsl:call-template>
1856
- </xsl:variable>
1857
- <xsl:value-of select="$title-where"/>
1858
- </fo:block>
1859
- </xsl:when>
1860
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
1861
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
1862
-
1863
-
1864
-
1865
- <xsl:variable name="title-key">
1866
- <xsl:call-template name="getTitle">
1867
- <xsl:with-param name="name" select="'title-key'"/>
1868
- </xsl:call-template>
1869
- </xsl:variable>
1870
- <xsl:value-of select="$title-key"/>
1871
- </fo:block>
1872
- </xsl:when>
1873
- </xsl:choose>
1874
-
1875
- <!-- a few components -->
1876
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
1877
- <fo:block>
2124
+ <fo:block-container margin-left="0mm">
2125
+ <xsl:if test="parent::*[local-name() = 'note']">
2126
+ <xsl:attribute name="margin-left">
2127
+ <xsl:choose>
2128
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
2129
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
2130
+ </xsl:choose>
2131
+ </xsl:attribute>
1878
2132
 
2133
+ </xsl:if>
2134
+ <fo:block-container margin-left="0mm">
2135
+
2136
+ <xsl:variable name="parent" select="local-name(..)"/>
1879
2137
 
2138
+ <xsl:variable name="key_iso">
2139
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2140
+ </xsl:variable>
1880
2141
 
2142
+ <xsl:choose>
2143
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2144
+
2145
+
2146
+ <fo:block margin-bottom="12pt" text-align="left">
2147
+
2148
+ <xsl:variable name="title-where">
2149
+ <xsl:call-template name="getTitle">
2150
+ <xsl:with-param name="name" select="'title-where'"/>
2151
+ </xsl:call-template>
2152
+ </xsl:variable>
2153
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2154
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2155
+ <xsl:text/>
2156
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2157
+ </fo:block>
2158
+
2159
+ </xsl:when>
2160
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2161
+ <fo:block margin-bottom="12pt" text-align="left">
2162
+
2163
+
2164
+
2165
+
2166
+ <xsl:variable name="title-where">
2167
+ <xsl:call-template name="getTitle">
2168
+ <xsl:with-param name="name" select="'title-where'"/>
2169
+ </xsl:call-template>
2170
+ </xsl:variable>
2171
+ <xsl:value-of select="$title-where"/>
2172
+ </fo:block>
2173
+ </xsl:when>
2174
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2175
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2176
+
2177
+
2178
+
2179
+ <xsl:variable name="title-key">
2180
+ <xsl:call-template name="getTitle">
2181
+ <xsl:with-param name="name" select="'title-key'"/>
2182
+ </xsl:call-template>
2183
+ </xsl:variable>
2184
+ <xsl:value-of select="$title-key"/>
2185
+ </fo:block>
2186
+ </xsl:when>
2187
+ </xsl:choose>
1881
2188
 
1882
- <fo:block>
1883
-
1884
-
1885
-
1886
-
1887
- <fo:table width="95%" table-layout="fixed">
2189
+ <!-- a few components -->
2190
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2191
+ <fo:block>
1888
2192
 
1889
- <xsl:choose>
1890
- <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
1891
- <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
1892
- </xsl:when>
1893
- <xsl:when test="normalize-space($key_iso) = 'true'">
1894
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2193
+
2194
+
2195
+
2196
+ <fo:block>
2197
+
2198
+
2199
+
2200
+
2201
+ <fo:table width="95%" table-layout="fixed">
1895
2202
 
1896
- </xsl:when>
1897
- </xsl:choose>
1898
- <!-- create virtual html table for dl/[dt and dd] -->
1899
- <xsl:variable name="html-table">
1900
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
1901
- <xsl:element name="{$ns}:table">
1902
- <tbody>
1903
- <xsl:apply-templates mode="dl"/>
1904
- </tbody>
1905
- </xsl:element>
1906
- </xsl:variable>
1907
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
1908
- <xsl:variable name="colwidths">
1909
- <xsl:call-template name="calculate-column-widths">
1910
- <xsl:with-param name="cols-count" select="2"/>
1911
- <xsl:with-param name="table" select="$html-table"/>
1912
- </xsl:call-template>
1913
- </xsl:variable>
1914
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
1915
- <xsl:variable name="maxlength_dt">
1916
- <xsl:call-template name="getMaxLength_dt"/>
1917
- </xsl:variable>
1918
- <xsl:call-template name="setColumnWidth_dl">
1919
- <xsl:with-param name="colwidths" select="$colwidths"/>
1920
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
1921
- </xsl:call-template>
1922
- <fo:table-body>
1923
- <xsl:apply-templates>
1924
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
1925
- </xsl:apply-templates>
1926
- </fo:table-body>
1927
- </fo:table>
1928
- </fo:block>
1929
- </fo:block>
1930
- </xsl:if>
2203
+ <xsl:choose>
2204
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2205
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2206
+ </xsl:when>
2207
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2208
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2209
+
2210
+ </xsl:when>
2211
+ </xsl:choose>
2212
+ <!-- create virtual html table for dl/[dt and dd] -->
2213
+ <xsl:variable name="html-table">
2214
+ <xsl:variable name="doc_ns">
2215
+
2216
+ </xsl:variable>
2217
+ <xsl:variable name="ns">
2218
+ <xsl:choose>
2219
+ <xsl:when test="normalize-space($doc_ns) != ''">
2220
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2221
+ </xsl:when>
2222
+ <xsl:otherwise>
2223
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2224
+ </xsl:otherwise>
2225
+ </xsl:choose>
2226
+ </xsl:variable>
2227
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2228
+ <xsl:element name="{$ns}:table">
2229
+ <tbody>
2230
+ <xsl:apply-templates mode="dl"/>
2231
+ </tbody>
2232
+ </xsl:element>
2233
+ </xsl:variable>
2234
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2235
+ <xsl:variable name="colwidths">
2236
+ <xsl:call-template name="calculate-column-widths">
2237
+ <xsl:with-param name="cols-count" select="2"/>
2238
+ <xsl:with-param name="table" select="$html-table"/>
2239
+ </xsl:call-template>
2240
+ </xsl:variable>
2241
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2242
+ <xsl:variable name="maxlength_dt">
2243
+ <xsl:call-template name="getMaxLength_dt"/>
2244
+ </xsl:variable>
2245
+ <xsl:call-template name="setColumnWidth_dl">
2246
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2247
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2248
+ </xsl:call-template>
2249
+ <fo:table-body>
2250
+ <xsl:apply-templates>
2251
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2252
+ </xsl:apply-templates>
2253
+ </fo:table-body>
2254
+ </fo:table>
2255
+ </fo:block>
2256
+ </fo:block>
2257
+ </xsl:if>
2258
+ </fo:block-container>
2259
+ </fo:block-container>
1931
2260
  </xsl:template><xsl:template name="setColumnWidth_dl">
1932
2261
  <xsl:param name="colwidths"/>
1933
2262
  <xsl:param name="maxlength_dt"/>
@@ -2024,6 +2353,7 @@
2024
2353
  <xsl:param name="key_iso"/>
2025
2354
 
2026
2355
  <fo:table-row>
2356
+
2027
2357
  <fo:table-cell>
2028
2358
 
2029
2359
  <fo:block margin-top="6pt">
@@ -2040,6 +2370,7 @@
2040
2370
 
2041
2371
 
2042
2372
 
2373
+
2043
2374
  <xsl:apply-templates/>
2044
2375
  <!-- <xsl:if test="$namespace = 'gb'">
2045
2376
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2051,14 +2382,36 @@
2051
2382
  <fo:table-cell>
2052
2383
  <fo:block>
2053
2384
 
2054
-
2385
+ <!-- <xsl:if test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
2386
+ <xsl:if test="local-name(*[1]) != 'stem'">
2387
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2388
+ </xsl:if>
2389
+ </xsl:if> -->
2055
2390
 
2056
2391
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2057
2392
 
2058
2393
  </fo:block>
2059
2394
  </fo:table-cell>
2060
2395
  </fo:table-row>
2061
-
2396
+ <!-- <xsl:if test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
2397
+ <xsl:if test="local-name(*[1]) = 'stem'">
2398
+ <fo:table-row>
2399
+ <fo:table-cell>
2400
+ <fo:block margin-top="6pt">
2401
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2402
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2403
+ </xsl:if>
2404
+ <xsl:text>&#xA0;</xsl:text>
2405
+ </fo:block>
2406
+ </fo:table-cell>
2407
+ <fo:table-cell>
2408
+ <fo:block>
2409
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2410
+ </fo:block>
2411
+ </fo:table-cell>
2412
+ </fo:table-row>
2413
+ </xsl:if>
2414
+ </xsl:if> -->
2062
2415
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2063
2416
  <xsl:apply-templates/>
2064
2417
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
@@ -2083,6 +2436,31 @@
2083
2436
  </fo:inline>
2084
2437
  </xsl:template><xsl:template match="*[local-name()='tt']">
2085
2438
  <fo:inline xsl:use-attribute-sets="tt-style">
2439
+ <xsl:variable name="_font-size">
2440
+
2441
+ 10
2442
+
2443
+
2444
+
2445
+
2446
+
2447
+
2448
+
2449
+
2450
+
2451
+
2452
+
2453
+
2454
+ </xsl:variable>
2455
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
2456
+ <xsl:if test="$font-size != ''">
2457
+ <xsl:attribute name="font-size">
2458
+ <xsl:choose>
2459
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
2460
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
2461
+ </xsl:choose>
2462
+ </xsl:attribute>
2463
+ </xsl:if>
2086
2464
  <xsl:apply-templates/>
2087
2465
  </fo:inline>
2088
2466
  </xsl:template><xsl:template match="*[local-name()='del']">
@@ -2408,11 +2786,24 @@
2408
2786
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2409
2787
  <xsl:value-of select="substring($str, 2)"/>
2410
2788
  </xsl:template><xsl:template match="mathml:math">
2411
- <fo:inline font-family="STIX2Math">
2412
- <fo:instream-foreign-object fox:alt-text="Math">
2413
- <xsl:copy-of select="."/>
2414
- </fo:instream-foreign-object>
2789
+ <fo:inline font-family="STIX Two Math"> <!-- -->
2790
+ <xsl:variable name="mathml">
2791
+ <xsl:apply-templates select="." mode="mathml"/>
2792
+ </xsl:variable>
2793
+ <fo:instream-foreign-object fox:alt-text="Math">
2794
+ <!-- <xsl:copy-of select="."/> -->
2795
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
2796
+ </fo:instream-foreign-object>
2415
2797
  </fo:inline>
2798
+ </xsl:template><xsl:template match="@*|node()" mode="mathml">
2799
+ <xsl:copy>
2800
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
2801
+ </xsl:copy>
2802
+ </xsl:template><xsl:template match="mathml:mtext" mode="mathml">
2803
+ <xsl:copy>
2804
+ <!-- replace start and end spaces to non-break space -->
2805
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
2806
+ </xsl:copy>
2416
2807
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
2417
2808
  <xsl:variable name="target">
2418
2809
  <xsl:choose>
@@ -2489,13 +2880,26 @@
2489
2880
  <xsl:apply-templates/>
2490
2881
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
2491
2882
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2492
-
2883
+
2493
2884
  <xsl:apply-templates/>
2494
2885
  </fo:basic-link>
2495
2886
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
2496
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
2497
- <xsl:apply-templates/>
2498
- </fo:block>
2887
+ <fo:block-container margin-left="0mm">
2888
+ <xsl:if test="parent::*[local-name() = 'note']">
2889
+ <xsl:attribute name="margin-left">
2890
+ <xsl:choose>
2891
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
2892
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
2893
+ </xsl:choose>
2894
+ </xsl:attribute>
2895
+
2896
+ </xsl:if>
2897
+ <fo:block-container margin-left="0mm">
2898
+ <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
2899
+ <xsl:apply-templates/>
2900
+ </fo:block>
2901
+ </fo:block-container>
2902
+ </fo:block-container>
2499
2903
  </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'dt']/*[local-name() = 'stem']">
2500
2904
  <fo:inline>
2501
2905
  <xsl:apply-templates/>
@@ -2555,7 +2959,9 @@
2555
2959
  </xsl:choose>
2556
2960
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
2557
2961
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
2558
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2962
+ <fo:inline xsl:use-attribute-sets="termnote-name-style">
2963
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2964
+ </fo:inline>
2559
2965
  <xsl:apply-templates/>
2560
2966
  </fo:block>
2561
2967
  </xsl:template><xsl:template match="*[local-name() = 'note']/*[local-name() = 'name'] | *[local-name() = 'termnote']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']" mode="presentation">
@@ -2650,15 +3056,109 @@
2650
3056
 
2651
3057
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
2652
3058
  </fo:block>
2653
- </xsl:template><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">
3059
+ </xsl:template><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">
2654
3060
  <xsl:apply-templates mode="contents"/>
2655
3061
  <xsl:text> </xsl:text>
2656
- </xsl:template><xsl:template match="text()" mode="contents">
3062
+ </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">
3063
+ <xsl:apply-templates mode="bookmarks"/>
3064
+ <xsl:text> </xsl:text>
3065
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3066
+ <xsl:value-of select="."/>
3067
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
2657
3068
  <xsl:value-of select="."/>
2658
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3069
+ </xsl:template><xsl:template match="node()" mode="contents">
3070
+ <xsl:apply-templates mode="contents"/>
3071
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
3072
+ <xsl:apply-templates mode="bookmarks"/>
3073
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3074
+ <xsl:apply-templates select="."/>
3075
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3076
+ <xsl:apply-templates mode="bookmarks"/>
3077
+ </xsl:template><xsl:template name="addBookmarks">
3078
+ <xsl:param name="contents"/>
3079
+ <xsl:if test="xalan:nodeset($contents)//item">
3080
+ <fo:bookmark-tree>
3081
+ <xsl:choose>
3082
+ <xsl:when test="xalan:nodeset($contents)/doc">
3083
+ <xsl:choose>
3084
+ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3085
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3086
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3087
+ <fo:bookmark-title>
3088
+ <xsl:variable name="bookmark-title_">
3089
+ <xsl:call-template name="getLangVersion">
3090
+ <xsl:with-param name="lang" select="@lang"/>
3091
+ </xsl:call-template>
3092
+ </xsl:variable>
3093
+ <xsl:choose>
3094
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3095
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3096
+ </xsl:when>
3097
+ <xsl:otherwise>
3098
+ <xsl:choose>
3099
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3100
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3101
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3102
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3103
+ </xsl:choose>
3104
+ </xsl:otherwise>
3105
+ </xsl:choose>
3106
+ </fo:bookmark-title>
3107
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3108
+ </fo:bookmark>
3109
+
3110
+ </xsl:for-each>
3111
+ </xsl:when>
3112
+ <xsl:otherwise>
3113
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3114
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3115
+ </xsl:for-each>
3116
+ </xsl:otherwise>
3117
+ </xsl:choose>
3118
+ </xsl:when>
3119
+ <xsl:otherwise>
3120
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
3121
+ </xsl:otherwise>
3122
+ </xsl:choose>
3123
+
3124
+
3125
+
3126
+
3127
+
3128
+
3129
+
3130
+
3131
+ </fo:bookmark-tree>
3132
+ </xsl:if>
3133
+ </xsl:template><xsl:template name="getLangVersion">
3134
+ <xsl:param name="lang"/>
3135
+ <xsl:choose>
3136
+ <xsl:when test="$lang = 'en'">
3137
+
3138
+
3139
+ </xsl:when>
3140
+ <xsl:when test="$lang = 'fr'">
3141
+
3142
+
3143
+ </xsl:when>
3144
+ <xsl:when test="$lang = 'de'">Deutsche</xsl:when>
3145
+ <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3146
+ </xsl:choose>
3147
+ </xsl:template><xsl:template match="item" mode="bookmark">
3148
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
3149
+ <fo:bookmark-title>
3150
+ <xsl:if test="@section != ''">
3151
+ <xsl:value-of select="@section"/>
3152
+ <xsl:text> </xsl:text>
3153
+ </xsl:if>
3154
+ <xsl:value-of select="normalize-space(title)"/>
3155
+ </fo:bookmark-title>
3156
+ <xsl:apply-templates mode="bookmark"/>
3157
+ </fo:bookmark>
3158
+ </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
2659
3159
  <xsl:if test="normalize-space() != ''">
2660
3160
  <fo:block xsl:use-attribute-sets="figure-name-style">
2661
-
3161
+
2662
3162
  <xsl:apply-templates/>
2663
3163
  </fo:block>
2664
3164
  </xsl:if>
@@ -2713,7 +3213,7 @@
2713
3213
  <xsl:apply-templates/>
2714
3214
  </xsl:otherwise>
2715
3215
  </xsl:choose>
2716
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3216
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
2717
3217
  <xsl:text> </xsl:text>
2718
3218
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
2719
3219
  <xsl:copy>
@@ -2722,21 +3222,61 @@
2722
3222
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
2723
3223
  <xsl:text> </xsl:text>
2724
3224
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
2725
- <fo:block xsl:use-attribute-sets="sourcecode-style">
2726
- <xsl:apply-templates/>
2727
- </fo:block>
2728
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2729
- </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()">
3225
+
3226
+ <fo:block-container margin-left="0mm">
3227
+ <xsl:if test="parent::*[local-name() = 'note']">
3228
+ <xsl:attribute name="margin-left">
3229
+ <xsl:choose>
3230
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3231
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3232
+ </xsl:choose>
3233
+ </xsl:attribute>
3234
+
3235
+ </xsl:if>
3236
+ <fo:block-container margin-left="0mm">
3237
+
3238
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3239
+ <xsl:variable name="_font-size">
3240
+
3241
+ 10
3242
+
3243
+
3244
+
3245
+
3246
+
3247
+
3248
+
3249
+
3250
+
3251
+
3252
+
3253
+
3254
+ </xsl:variable>
3255
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
3256
+ <xsl:if test="$font-size != ''">
3257
+ <xsl:attribute name="font-size">
3258
+ <xsl:choose>
3259
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3260
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3261
+ </xsl:choose>
3262
+ </xsl:attribute>
3263
+ </xsl:if>
3264
+ <xsl:apply-templates/>
3265
+ </fo:block>
3266
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3267
+
3268
+ </fo:block-container>
3269
+ </fo:block-container>
3270
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
2730
3271
  <xsl:variable name="text">
2731
3272
  <xsl:call-template name="add-zero-spaces-equal"/>
2732
3273
  </xsl:variable>
2733
- <xsl:call-template name="add-zero-spaces">
3274
+ <xsl:call-template name="add-zero-spaces-java">
2734
3275
  <xsl:with-param name="text" select="$text"/>
2735
3276
  </xsl:call-template>
2736
3277
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="presentation">
2737
3278
  <xsl:if test="normalize-space() != ''">
2738
- <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2739
-
3279
+ <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2740
3280
  <xsl:apply-templates/>
2741
3281
  </fo:block>
2742
3282
  </xsl:if>
@@ -2804,6 +3344,145 @@
2804
3344
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
2805
3345
  <xsl:apply-templates/>
2806
3346
  </fo:block>
3347
+ </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3348
+ <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
3349
+ <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3350
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3351
+ </xsl:if>
3352
+ <fo:block-container margin-left="0mm" margin-right="0mm">
3353
+ <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
3354
+ <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3355
+ <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
3356
+ </xsl:if>
3357
+ <xsl:variable name="simple-table">
3358
+ <xsl:call-template name="getSimpleTable"/>
3359
+ </xsl:variable>
3360
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3361
+ <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
3362
+ <!-- <fo:table-column column-width="35mm"/>
3363
+ <fo:table-column column-width="115mm"/> -->
3364
+ <fo:table-column column-width="30%"/>
3365
+ <fo:table-column column-width="70%"/>
3366
+ </xsl:if>
3367
+ <xsl:apply-templates mode="requirement"/>
3368
+ </fo:table>
3369
+ <!-- fn processing -->
3370
+ <xsl:if test=".//*[local-name() = 'fn']">
3371
+ <xsl:for-each select="*[local-name() = 'tbody']">
3372
+ <fo:block font-size="90%" border-bottom="1pt solid black">
3373
+ <xsl:call-template name="fn_display"/>
3374
+ </fo:block>
3375
+ </xsl:for-each>
3376
+ </xsl:if>
3377
+ </fo:block-container>
3378
+ </fo:block-container>
3379
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="requirement">
3380
+ <fo:table-header>
3381
+ <xsl:apply-templates mode="requirement"/>
3382
+ </fo:table-header>
3383
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="requirement">
3384
+ <fo:table-body>
3385
+ <xsl:apply-templates mode="requirement"/>
3386
+ </fo:table-body>
3387
+ </xsl:template><xsl:template match="*[local-name()='tr']" mode="requirement">
3388
+ <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
3389
+ <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
3390
+ <!-- <xsl:attribute name="border">1pt solid black</xsl:attribute> -->
3391
+ <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
3392
+ </xsl:if>
3393
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
3394
+ <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
3395
+ </xsl:if>
3396
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
3397
+ <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
3398
+ </xsl:if>
3399
+ <xsl:apply-templates mode="requirement"/>
3400
+ </fo:table-row>
3401
+ </xsl:template><xsl:template match="*[local-name()='th']" mode="requirement">
3402
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3403
+ <xsl:attribute name="text-align">
3404
+ <xsl:choose>
3405
+ <xsl:when test="@align">
3406
+ <xsl:value-of select="@align"/>
3407
+ </xsl:when>
3408
+ <xsl:otherwise>left</xsl:otherwise>
3409
+ </xsl:choose>
3410
+ </xsl:attribute>
3411
+ <xsl:if test="@colspan">
3412
+ <xsl:attribute name="number-columns-spanned">
3413
+ <xsl:value-of select="@colspan"/>
3414
+ </xsl:attribute>
3415
+ </xsl:if>
3416
+ <xsl:if test="@rowspan">
3417
+ <xsl:attribute name="number-rows-spanned">
3418
+ <xsl:value-of select="@rowspan"/>
3419
+ </xsl:attribute>
3420
+ </xsl:if>
3421
+ <xsl:call-template name="display-align"/>
3422
+
3423
+ <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3424
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3425
+ <xsl:attribute name="background-color">rgb(165, 165, 165)</xsl:attribute>
3426
+ </xsl:if>
3427
+ <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommendtest'">
3428
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3429
+ <xsl:attribute name="background-color">rgb(201, 201, 201)</xsl:attribute>
3430
+ </xsl:if> -->
3431
+
3432
+ <fo:block>
3433
+ <xsl:apply-templates/>
3434
+ </fo:block>
3435
+ </fo:table-cell>
3436
+ </xsl:template><xsl:template match="*[local-name()='td']" mode="requirement">
3437
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3438
+ <xsl:if test="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3439
+ <xsl:attribute name="padding">0mm</xsl:attribute>
3440
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
3441
+ </xsl:if>
3442
+ <xsl:attribute name="text-align">
3443
+ <xsl:choose>
3444
+ <xsl:when test="@align">
3445
+ <xsl:value-of select="@align"/>
3446
+ </xsl:when>
3447
+ <xsl:otherwise>left</xsl:otherwise>
3448
+ </xsl:choose>
3449
+ </xsl:attribute>
3450
+ <xsl:if test="following-sibling::*[local-name()='td'] and not(preceding-sibling::*[local-name()='td'])">
3451
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3452
+ </xsl:if>
3453
+ <xsl:if test="@colspan">
3454
+ <xsl:attribute name="number-columns-spanned">
3455
+ <xsl:value-of select="@colspan"/>
3456
+ </xsl:attribute>
3457
+ </xsl:if>
3458
+ <xsl:if test="@rowspan">
3459
+ <xsl:attribute name="number-rows-spanned">
3460
+ <xsl:value-of select="@rowspan"/>
3461
+ </xsl:attribute>
3462
+ </xsl:if>
3463
+ <xsl:call-template name="display-align"/>
3464
+
3465
+ <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3466
+ <xsl:attribute name="padding-left">0.5mm</xsl:attribute>
3467
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3468
+ <xsl:if test="parent::*[local-name()='tr']/preceding-sibling::*[local-name()='tr'] and not(*[local-name()='table'])">
3469
+ <xsl:attribute name="background-color">rgb(201, 201, 201)</xsl:attribute>
3470
+ </xsl:if>
3471
+ </xsl:if> -->
3472
+ <!-- 2nd line and below -->
3473
+
3474
+ <fo:block>
3475
+ <xsl:apply-templates/>
3476
+ </fo:block>
3477
+ </fo:table-cell>
3478
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
3479
+ <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
3480
+ <xsl:apply-templates/>
3481
+ </fo:block>
3482
+ </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
3483
+ <fo:block> <!-- margin-bottom="10pt" -->
3484
+ <xsl:apply-templates/>
3485
+ </fo:block>
2807
3486
  </xsl:template><xsl:template match="*[local-name() = 'termexample']">
2808
3487
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
2809
3488
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -2823,12 +3502,13 @@
2823
3502
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2824
3503
 
2825
3504
  <xsl:variable name="element">
2826
- block
3505
+ block
2827
3506
 
3507
+ <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
2828
3508
  </xsl:variable>
2829
3509
 
2830
3510
  <xsl:choose>
2831
- <xsl:when test="normalize-space($element) = 'block'">
3511
+ <xsl:when test="contains(normalize-space($element), 'block')">
2832
3512
  <fo:block xsl:use-attribute-sets="example-body-style">
2833
3513
  <xsl:apply-templates/>
2834
3514
  </fo:block>
@@ -2865,25 +3545,44 @@
2865
3545
  </xsl:otherwise>
2866
3546
  </xsl:choose>
2867
3547
 
2868
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
2869
- <fo:block xsl:use-attribute-sets="example-p-style">
3548
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3549
+
3550
+ <xsl:variable name="element">
3551
+ block
2870
3552
 
2871
- <xsl:apply-templates/>
2872
- </fo:block>
3553
+ </xsl:variable>
3554
+ <xsl:choose>
3555
+ <xsl:when test="normalize-space($element) = 'block'">
3556
+ <fo:block xsl:use-attribute-sets="example-p-style">
3557
+
3558
+ <xsl:apply-templates/>
3559
+ </fo:block>
3560
+ </xsl:when>
3561
+ <xsl:otherwise>
3562
+ <fo:inline xsl:use-attribute-sets="example-p-style">
3563
+ <xsl:apply-templates/>
3564
+ </fo:inline>
3565
+ </xsl:otherwise>
3566
+ </xsl:choose>
2873
3567
  </xsl:template><xsl:template match="*[local-name() = 'termsource']">
2874
3568
  <fo:block xsl:use-attribute-sets="termsource-style">
2875
3569
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
2876
3570
  <xsl:variable name="termsource_text">
2877
3571
  <xsl:apply-templates/>
2878
3572
  </xsl:variable>
3573
+
2879
3574
  <xsl:choose>
2880
3575
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
2881
3576
  <xsl:apply-templates/>
2882
3577
  </xsl:when>
2883
- <xsl:otherwise>
2884
- <xsl:text>[</xsl:text>
2885
- <xsl:apply-templates/>
2886
- <xsl:text>]</xsl:text>
3578
+ <xsl:otherwise>
3579
+
3580
+ <xsl:text>[</xsl:text>
3581
+
3582
+ <xsl:apply-templates/>
3583
+
3584
+ <xsl:text>]</xsl:text>
3585
+
2887
3586
  </xsl:otherwise>
2888
3587
  </xsl:choose>
2889
3588
  </fo:block>
@@ -2894,10 +3593,13 @@
2894
3593
  </xsl:template><xsl:template match="*[local-name() = 'origin']">
2895
3594
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
2896
3595
 
2897
- <xsl:call-template name="getTitle">
2898
- <xsl:with-param name="name" select="'title-source'"/>
2899
- </xsl:call-template>
2900
- <xsl:text>: </xsl:text>
3596
+ <fo:inline>
3597
+
3598
+ <xsl:call-template name="getTitle">
3599
+ <xsl:with-param name="name" select="'title-source'"/>
3600
+ </xsl:call-template>
3601
+ <xsl:text>: </xsl:text>
3602
+ </fo:inline>
2901
3603
 
2902
3604
  <fo:inline xsl:use-attribute-sets="origin-style">
2903
3605
  <xsl:apply-templates/>
@@ -2909,18 +3611,29 @@
2909
3611
  <xsl:if test="normalize-space() != ''">
2910
3612
  <xsl:value-of select="."/>
2911
3613
  </xsl:if>
2912
- </xsl:template><xsl:template match="*[local-name() = 'quote']">
3614
+ </xsl:template><xsl:template match="*[local-name() = 'quote']">
3615
+ <fo:block-container margin-left="0mm">
3616
+ <xsl:if test="parent::*[local-name() = 'note']">
3617
+ <xsl:if test="not(ancestor::*[local-name() = 'table'])">
3618
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
3619
+ </xsl:if>
3620
+ </xsl:if>
3621
+
3622
+ <fo:block-container margin-left="0mm">
2913
3623
 
2914
- <fo:block xsl:use-attribute-sets="quote-style">
2915
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
2916
- </fo:block>
2917
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
2918
- <fo:block xsl:use-attribute-sets="quote-source-style">
2919
- <!-- — ISO, ISO 7301:2011, Clause 1 -->
2920
- <xsl:apply-templates select="*[local-name() = 'author']"/>
2921
- <xsl:apply-templates select="*[local-name() = 'source']"/>
2922
- </fo:block>
2923
- </xsl:if>
3624
+ <fo:block xsl:use-attribute-sets="quote-style">
3625
+ <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3626
+ </fo:block>
3627
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3628
+ <fo:block xsl:use-attribute-sets="quote-source-style">
3629
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
3630
+ <xsl:apply-templates select="*[local-name() = 'author']"/>
3631
+ <xsl:apply-templates select="*[local-name() = 'source']"/>
3632
+ </fo:block>
3633
+ </xsl:if>
3634
+
3635
+ </fo:block-container>
3636
+ </fo:block-container>
2924
3637
  </xsl:template><xsl:template match="*[local-name() = 'source']">
2925
3638
  <xsl:if test="../*[local-name() = 'author']">
2926
3639
  <xsl:text>, </xsl:text>
@@ -2951,6 +3664,7 @@
2951
3664
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2952
3665
 
2953
3666
 
3667
+
2954
3668
  </xsl:if>
2955
3669
 
2956
3670
 
@@ -2989,6 +3703,7 @@
2989
3703
 
2990
3704
 
2991
3705
 
3706
+
2992
3707
  </xsl:variable>
2993
3708
 
2994
3709
  <xsl:variable name="padding-right">
@@ -3084,13 +3799,14 @@
3084
3799
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
3085
3800
  <fo:block>
3086
3801
  <xsl:call-template name="setId"/>
3802
+
3087
3803
  <xsl:apply-templates/>
3088
3804
  </fo:block>
3089
3805
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
3090
3806
  <fo:block id="{@id}">
3091
3807
  <xsl:apply-templates/>
3092
3808
  </fo:block>
3093
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@id = '_normative_references' or @id = '_references']">
3809
+ </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
3094
3810
 
3095
3811
  <fo:block id="{@id}">
3096
3812
  <xsl:apply-templates/>
@@ -3108,6 +3824,31 @@
3108
3824
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
3109
3825
  <!-- 0xA0 to space replacement -->
3110
3826
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
3827
+ </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
3828
+ <xsl:choose>
3829
+ <xsl:when test="parent::*[local-name() = 'note']">
3830
+ <fo:block-container>
3831
+ <xsl:attribute name="margin-left">
3832
+ <xsl:choose>
3833
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3834
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3835
+ </xsl:choose>
3836
+ </xsl:attribute>
3837
+
3838
+
3839
+ <fo:block-container margin-left="0mm">
3840
+ <fo:block>
3841
+ <xsl:apply-templates select="." mode="ul_ol"/>
3842
+ </fo:block>
3843
+ </fo:block-container>
3844
+ </fo:block-container>
3845
+ </xsl:when>
3846
+ <xsl:otherwise>
3847
+ <fo:block>
3848
+ <xsl:apply-templates select="." mode="ul_ol"/>
3849
+ </fo:block>
3850
+ </xsl:otherwise>
3851
+ </xsl:choose>
3111
3852
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3112
3853
  <!-- <row>
3113
3854
  <date>05-07-2013</date>
@@ -3139,6 +3880,65 @@
3139
3880
  <fo:table-cell border="1pt solid black" padding-left="1mm" padding-top="0.5mm">
3140
3881
  <fo:block><xsl:apply-templates/></fo:block>
3141
3882
  </fo:table-cell>
3883
+ </xsl:template><xsl:template name="processBibitem">
3884
+
3885
+
3886
+
3887
+
3888
+ </xsl:template><xsl:template name="processBibitemDocId">
3889
+ <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
3890
+ <xsl:choose>
3891
+ <xsl:when test="normalize-space($_doc_ident) != ''">
3892
+ <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
3893
+ <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
3894
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
3895
+ </xsl:if>
3896
+ <xsl:value-of select="$_doc_ident"/>
3897
+ </xsl:when>
3898
+ <xsl:otherwise>
3899
+ <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
3900
+ <xsl:if test="$type != ''">
3901
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
3902
+ </xsl:if>
3903
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
3904
+ </xsl:otherwise>
3905
+ </xsl:choose>
3906
+ </xsl:template><xsl:template name="processPersonalAuthor">
3907
+ <xsl:choose>
3908
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
3909
+ <author>
3910
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
3911
+ </author>
3912
+ </xsl:when>
3913
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
3914
+ <author>
3915
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
3916
+ <xsl:text> </xsl:text>
3917
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
3918
+ </author>
3919
+ </xsl:when>
3920
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
3921
+ <author>
3922
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
3923
+ <xsl:text> </xsl:text>
3924
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
3925
+ </author>
3926
+ </xsl:when>
3927
+ <xsl:otherwise>
3928
+ <xsl:apply-templates/>
3929
+ </xsl:otherwise>
3930
+ </xsl:choose>
3931
+ </xsl:template><xsl:template name="renderDate">
3932
+ <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
3933
+ <xsl:value-of select="*[local-name() = 'on']"/>
3934
+ </xsl:if>
3935
+ <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
3936
+ <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
3937
+ </xsl:if>
3938
+ </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
3939
+ <xsl:value-of select="translate(.,'. ','')"/>
3940
+ </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
3941
+ <xsl:value-of select="substring(.,1,1)"/>
3142
3942
  </xsl:template><xsl:template name="convertDate">
3143
3943
  <xsl:param name="date"/>
3144
3944
  <xsl:param name="format" select="'short'"/>
@@ -3217,6 +4017,7 @@
3217
4017
  <dc:title>
3218
4018
  <xsl:variable name="title">
3219
4019
 
4020
+
3220
4021
 
3221
4022
  <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3222
4023
 
@@ -3235,6 +4036,7 @@
3235
4036
  <dc:creator>
3236
4037
 
3237
4038
 
4039
+
3238
4040
  </dc:creator>
3239
4041
  <dc:description>
3240
4042
  <xsl:variable name="abstract">
@@ -3244,6 +4046,7 @@
3244
4046
 
3245
4047
 
3246
4048
 
4049
+
3247
4050
  </xsl:variable>
3248
4051
  <xsl:value-of select="normalize-space($abstract)"/>
3249
4052
  </dc:description>
@@ -3342,7 +4145,9 @@
3342
4145
 
3343
4146
 
3344
4147
 
3345
-
4148
+
4149
+
4150
+
3346
4151
  </xsl:variable>
3347
4152
  <xsl:if test="$documentNS != $XSLNS">
3348
4153
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -3368,4 +4173,21 @@
3368
4173
  </xsl:otherwise>
3369
4174
  </xsl:choose>
3370
4175
  </xsl:attribute>
4176
+ </xsl:template><xsl:template name="add-letter-spacing">
4177
+ <xsl:param name="text"/>
4178
+ <xsl:param name="letter-spacing" select="'0.15'"/>
4179
+ <xsl:if test="string-length($text) &gt; 0">
4180
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
4181
+ <fo:inline padding-right="{$letter-spacing}mm">
4182
+ <xsl:if test="$char = '®'">
4183
+ <xsl:attribute name="font-size">58%</xsl:attribute>
4184
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
4185
+ </xsl:if>
4186
+ <xsl:value-of select="$char"/>
4187
+ </fo:inline>
4188
+ <xsl:call-template name="add-letter-spacing">
4189
+ <xsl:with-param name="text" select="substring($text, 2)"/>
4190
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4191
+ </xsl:call-template>
4192
+ </xsl:if>
3371
4193
  </xsl:template></xsl:stylesheet>