metanorma-iho 0.2.2 → 0.2.3

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: 230c4f5b1dc54f38626964d1c566b3b7075de0242981bcb822df9bf8d2f3a520
4
- data.tar.gz: aa34f761d872455e1c0ce4110b305cb9502fa9a7c90d5f8e834f48dd7d8b1f16
3
+ metadata.gz: 1d513e582275fa2fbac4716c2367a85aefd6f5b26dd8e4f2f7d10608d98c6c96
4
+ data.tar.gz: 3e9150114684366020f5c8516cb737931c07c5973a0abe5a08120d9867c97f19
5
5
  SHA512:
6
- metadata.gz: e6e8f57daa7026e6b7c06a85af9265a7292ca1c57b9bda45d247f7575c02e281424fda42ee42be3d33ca99890bde00980307b64bc7b6244413508cc89c6e42c0
7
- data.tar.gz: 1e32207b9ea840768639bf095e87efd04e3ab5b2778bdc84f63c0a6676f925cceea42a5479ec6edbd26789c93b81ef65942aaebb6a17a3a76c2ca5561f6482a8
6
+ metadata.gz: e7c802926f806a98b5a9da05b1553c46ae56d827a11d0336afeb5faa87c029eb33f997dbfd4fc9c7d9f407d9e24075c85a6d0d6b5ddae2e61ec2385af47b5554
7
+ data.tar.gz: 0c9fe3c49478aa81331e460d5d2b1375c49c38c26ce647b3bec270c0f6b87fb79502d147790ba51c6ec608c6736a3203935f087698cb5745de4c3257c3cabd4a
@@ -158,7 +158,17 @@
158
158
  <data type="ID"/>
159
159
  </attribute>
160
160
  <oneOrMore>
161
- <ref name="paragraph"/>
161
+ <choice>
162
+ <ref name="formula"/>
163
+ <ref name="ul"/>
164
+ <ref name="ol"/>
165
+ <ref name="dl"/>
166
+ <ref name="quote"/>
167
+ <ref name="sourcecode"/>
168
+ <ref name="paragraph"/>
169
+ <ref name="table"/>
170
+ <ref name="figure"/>
171
+ </choice>
162
172
  </oneOrMore>
163
173
  </element>
164
174
  </define>
@@ -402,6 +412,16 @@
402
412
  </choice>
403
413
  </attribute>
404
414
  </optional>
415
+ <optional>
416
+ <attribute name="valign">
417
+ <choice>
418
+ <value>top</value>
419
+ <value>middle</value>
420
+ <value>bottom</value>
421
+ <value>baseline</value>
422
+ </choice>
423
+ </attribute>
424
+ </optional>
405
425
  <choice>
406
426
  <zeroOrMore>
407
427
  <ref name="TextElement"/>
@@ -429,6 +449,16 @@
429
449
  </choice>
430
450
  </attribute>
431
451
  </optional>
452
+ <optional>
453
+ <attribute name="valign">
454
+ <choice>
455
+ <value>top</value>
456
+ <value>middle</value>
457
+ <value>bottom</value>
458
+ <value>baseline</value>
459
+ </choice>
460
+ </attribute>
461
+ </optional>
432
462
  <choice>
433
463
  <zeroOrMore>
434
464
  <ref name="TextElement"/>
@@ -581,6 +581,8 @@
581
581
  <ref name="ol"/>
582
582
  <ref name="dl"/>
583
583
  <ref name="formula"/>
584
+ <ref name="quote"/>
585
+ <ref name="sourcecode"/>
584
586
  </choice>
585
587
  </oneOrMore>
586
588
  </element>
@@ -664,6 +666,16 @@
664
666
  </choice>
665
667
  </attribute>
666
668
  </optional>
669
+ <optional>
670
+ <attribute name="valign">
671
+ <choice>
672
+ <value>top</value>
673
+ <value>middle</value>
674
+ <value>bottom</value>
675
+ <value>baseline</value>
676
+ </choice>
677
+ </attribute>
678
+ </optional>
667
679
  <choice>
668
680
  <zeroOrMore>
669
681
  <choice>
@@ -700,6 +712,16 @@
700
712
  </choice>
701
713
  </attribute>
702
714
  </optional>
715
+ <optional>
716
+ <attribute name="valign">
717
+ <choice>
718
+ <value>top</value>
719
+ <value>middle</value>
720
+ <value>bottom</value>
721
+ <value>baseline</value>
722
+ </choice>
723
+ </attribute>
724
+ </optional>
703
725
  <choice>
704
726
  <zeroOrMore>
705
727
  <choice>
@@ -1052,14 +1074,17 @@
1052
1074
  <ref name="section-title"/>
1053
1075
  </optional>
1054
1076
  <group>
1055
- <group>
1056
- <zeroOrMore>
1057
- <ref name="BasicBlock"/>
1058
- </zeroOrMore>
1059
- <zeroOrMore>
1060
- <ref name="note"/>
1061
- </zeroOrMore>
1062
- </group>
1077
+ <choice>
1078
+ <group>
1079
+ <zeroOrMore>
1080
+ <ref name="BasicBlock"/>
1081
+ </zeroOrMore>
1082
+ <zeroOrMore>
1083
+ <ref name="note"/>
1084
+ </zeroOrMore>
1085
+ </group>
1086
+ <ref name="amend"/>
1087
+ </choice>
1063
1088
  <zeroOrMore>
1064
1089
  <choice>
1065
1090
  <ref name="clause-subsection"/>
@@ -1510,4 +1535,79 @@
1510
1535
  <ref name="CitationType"/>
1511
1536
  </element>
1512
1537
  </define>
1538
+ <define name="amend">
1539
+ <element name="amend">
1540
+ <optional>
1541
+ <attribute name="id">
1542
+ <data type="ID"/>
1543
+ </attribute>
1544
+ </optional>
1545
+ <attribute name="change">
1546
+ <choice>
1547
+ <value>add</value>
1548
+ <value>modify</value>
1549
+ <value>delete</value>
1550
+ </choice>
1551
+ </attribute>
1552
+ <optional>
1553
+ <attribute name="path"/>
1554
+ </optional>
1555
+ <optional>
1556
+ <attribute name="path_end"/>
1557
+ </optional>
1558
+ <optional>
1559
+ <attribute name="title"/>
1560
+ </optional>
1561
+ <optional>
1562
+ <element name="location">
1563
+ <zeroOrMore>
1564
+ <ref name="locality"/>
1565
+ </zeroOrMore>
1566
+ </element>
1567
+ </optional>
1568
+ <zeroOrMore>
1569
+ <ref name="autonumber"/>
1570
+ </zeroOrMore>
1571
+ <optional>
1572
+ <element name="description">
1573
+ <zeroOrMore>
1574
+ <ref name="BasicBlock"/>
1575
+ </zeroOrMore>
1576
+ </element>
1577
+ </optional>
1578
+ <optional>
1579
+ <element name="newcontent">
1580
+ <zeroOrMore>
1581
+ <ref name="BasicBlock"/>
1582
+ </zeroOrMore>
1583
+ </element>
1584
+ </optional>
1585
+ <optional>
1586
+ <element name="description">
1587
+ <zeroOrMore>
1588
+ <ref name="BasicBlock"/>
1589
+ </zeroOrMore>
1590
+ </element>
1591
+ </optional>
1592
+ </element>
1593
+ </define>
1594
+ <define name="autonumber">
1595
+ <element name="autonumber">
1596
+ <attribute name="type">
1597
+ <choice>
1598
+ <value>requirement</value>
1599
+ <value>recommendation</value>
1600
+ <value>permission</value>
1601
+ <value>table</value>
1602
+ <value>figure</value>
1603
+ <value>admonition</value>
1604
+ <value>formula</value>
1605
+ <value>sourcecode</value>
1606
+ <value>example</value>
1607
+ <value>note</value>
1608
+ </choice>
1609
+ </attribute>
1610
+ <text/>
1611
+ </element>
1612
+ </define>
1513
1613
  </grammar>
@@ -15,6 +15,127 @@ module IsoDoc
15
15
  @meta.commentperiod isoxml, out
16
16
  super
17
17
  end
18
+
19
+ def std_bibitem_entry(list, b, ordinal, biblio)
20
+ list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
21
+ prefix_bracketed_ref(ref, "[#{ordinal}]")
22
+ standard_citation(ref, b)
23
+ end
24
+ end
25
+
26
+ def nodes_to_span(n)
27
+ noko do |xml|
28
+ xml.span do |s|
29
+ n&.children&.each { |x| parse(x, s) }
30
+ end
31
+ end.join("")
32
+ end
33
+
34
+ def multiplenames_and(names)
35
+ return "" if names.length == 0
36
+ return names[0] if names.length == 1
37
+ return "#{names[0]} and #{names[1]}" if names.length == 2
38
+ names[0..-2].join(", ") + " and #{names[-1]}"
39
+ end
40
+
41
+ def extract_publisher(b)
42
+ c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
43
+ abbrs = []
44
+ names = []
45
+ c&.each do |c1|
46
+ n = c1.at(ns("./organization/name")) or next
47
+ abbrs << (c1.at(ns("./organization/abbreviation")) || n)
48
+ names << nodes_to_span(n)
49
+ end
50
+ return [nil, nil] if names.empty?
51
+ return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
52
+ end
53
+
54
+ def inline_bibitem_ref_code(b)
55
+ id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
56
+ "or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
57
+ id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
58
+ return [nil, id, nil] if id
59
+ id = Nokogiri::XML::Node.new("docidentifier", b.document)
60
+ id << "(NO ID)"
61
+ [nil, id, nil]
62
+ end
63
+
64
+ def extract_edition(b)
65
+ b&.at(ns("./edition"))&.text
66
+ end
67
+
68
+ def extract_uri(b)
69
+ b.at(ns("./uri"))
70
+ end
71
+
72
+ def omit_docid_prefix(prefix)
73
+ return true if prefix == "IHO"
74
+ super
75
+ end
76
+
77
+ def render_identifier(id)
78
+ if !id[1].nil? and id[1]["type"] == "IHO"
79
+ id[1].children = id[1].text.sub(/^IHO /, "")
80
+ end
81
+ super
82
+ end
83
+
84
+ def extract_publisher(b)
85
+ c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
86
+ abbrs = []
87
+ names = []
88
+ c&.each do |c1|
89
+ n = c1.at(ns("./organization/name")) or next
90
+ abbrs << (c1.at(ns("./organization/abbreviation")) || n)
91
+ names << nodes_to_span(n)
92
+ end
93
+ return [nil, nil] if names.empty?
94
+ return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
95
+ end
96
+
97
+ def extract_author(b)
98
+ c = b.xpath(ns("./contributor[role/@type = 'author']"))
99
+ c = b.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
100
+ return extract_publisher(b)[0] if c.empty?
101
+ c.map do |c1|
102
+ c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
103
+ end.reject { |e| e.nil? || e.empty? }.join(", ")
104
+ end
105
+
106
+ def extract_person_name(b)
107
+ p = b.at(ns("./person/name")) or return
108
+ c = p.at(ns("./completename")) and return c.text
109
+ s = p&.at(ns("./surname"))&.text or return
110
+ i = p.xpath(ns("./initial")) and
111
+ front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join("")
112
+ i.empty? and f = p.xpath(ns("./forename")) and
113
+ front = f.map { |e| e.text[0].upcase }.join("")
114
+ front ? "#{s} #{front}" : s
115
+ end
116
+
117
+ def is_iho?(b)
118
+ extract_publisher(b)[1] == "IHO"
119
+ end
120
+
121
+ # [{number}] {docID} edition {edition}: {title}, {author/organization}
122
+ def standard_citation(out, b)
123
+ if ftitle = b.at(ns("./formattedref"))
124
+ ftitle&.children&.each { |n| parse(n, out) }
125
+ else
126
+ id = render_identifier(inline_bibitem_ref_code(b))
127
+ out << id[1] if id[1]
128
+ ed = extract_edition(b) if is_iho?(b)
129
+ out << " edition #{ed}" if ed
130
+ out << ": " if id[1] || ed
131
+ iso_title(b)&.children&.each { |n| parse(n, out) }
132
+ out << ", "
133
+ author = extract_author(b)
134
+ out << author
135
+ u = extract_uri(b)
136
+ out << " (<a href='#{u.text}'>#{u.text}</a>)" if u
137
+ end
138
+ end
18
139
  end
19
140
  end
20
141
  end
@@ -667,7 +667,7 @@ div.WordSection2 {
667
667
  div.WordSection3 {
668
668
  page: WordSection3; }
669
669
 
670
- table.MsoISOTable {
670
+ table.MsoISOTable, table.MsoISOTableBig {
671
671
  mso-style-name: "Table ISO";
672
672
  mso-tstyle-rowband-size: 0;
673
673
  mso-tstyle-colband-size: 0;
@@ -688,17 +688,17 @@ table.MsoISOTable {
688
688
  font-size: 12.0pt;
689
689
  font-family: {{bodyfont}}; }
690
690
 
691
- table.MsoISOTable th {
691
+ table.MsoISOTable th, table.MsoISOTableBig th {
692
692
  border: solid windowtext 1pt;
693
693
  mso-border-alt: solid windowtext 1pt;
694
694
  padding: 0cm 2.85pt 0cm 2.85pt; }
695
695
 
696
- table.MsoISOTable td {
696
+ table.MsoISOTable td, table.MsoISOTableBig td {
697
697
  border: solid windowtext 1pt;
698
698
  mso-border-alt: solid windowtext 1pt;
699
699
  padding: 0cm 2.85pt 0cm 2.85pt; }
700
700
 
701
- table.MsoISOTable p {
701
+ table.MsoISOTable p, table.MsoISOTableBig p {
702
702
  font-size: 12.0pt; }
703
703
 
704
704
  table.MsoTableGrid {
@@ -785,8 +785,20 @@ div.example p.MsoListParagraph {
785
785
  font-size: 11.0pt; }
786
786
 
787
787
  div.Note p.MsoListParagraph {
788
+ font-size: 11.0pt;
789
+ margin-left: 1.0cm; }
790
+
791
+ div.Note span.stem {
788
792
  font-size: 11.0pt; }
789
793
 
794
+ div.Note p.Sourcecode, div.Note pre.Sourcecode {
795
+ font-size: 9.0pt;
796
+ margin-left: 1.0cm; }
797
+
798
+ div.Note table.dl {
799
+ font-size: 11.0pt;
800
+ margin-left: 1.0cm; }
801
+
790
802
  span.note_label, span.example_label, td.example_label, td.note_label {
791
803
  font-size: 11.0pt;
792
804
  font-family: {{bodyfont}}; }
@@ -630,7 +630,7 @@ div.WordSection2
630
630
  mso-paper-source:0;}
631
631
  div.WordSection3
632
632
  {page:WordSection3;}
633
- table.MsoISOTable
633
+ table.MsoISOTable, table.MsoISOTableBig
634
634
  {mso-style-name:"Table ISO";
635
635
  mso-tstyle-rowband-size:0;
636
636
  mso-tstyle-colband-size:0;
@@ -650,15 +650,15 @@ table.MsoISOTable
650
650
  mso-border-insidev:.75pt solid windowtext;
651
651
  font-size:12.0pt;
652
652
  font-family:$bodyfont;}
653
- table.MsoISOTable th
653
+ table.MsoISOTable th, table.MsoISOTableBig th
654
654
  {border:solid windowtext 1pt;
655
655
  mso-border-alt:solid windowtext 1pt;
656
656
  padding:0cm 2.85pt 0cm 2.85pt;}
657
- table.MsoISOTable td
657
+ table.MsoISOTable td, table.MsoISOTableBig td
658
658
  {border:solid windowtext 1pt;
659
659
  mso-border-alt:solid windowtext 1pt;
660
660
  padding:0cm 2.85pt 0cm 2.85pt;}
661
- table.MsoISOTable p
661
+ table.MsoISOTable p, table.MsoISOTableBig p
662
662
  {font-size:12.0pt; }
663
663
  table.MsoTableGrid
664
664
  {mso-style-name:"Table Grid";
@@ -744,6 +744,20 @@ div.example p.MsoListParagraph {
744
744
 
745
745
  div.Note p.MsoListParagraph {
746
746
  font-size: 11.0pt;
747
+ margin-left: 1.0cm;
748
+ }
749
+
750
+ div.Note span.stem {
751
+ font-size: 11.0pt; }
752
+
753
+ div.Note p.Sourcecode, div.Note pre.Sourcecode {
754
+ font-size: 9.0pt;
755
+ margin-left: 1.0cm;
756
+ }
757
+
758
+ div.Note table.dl {
759
+ font-size: 11.0pt;
760
+ margin-left: 1.0cm;
747
761
  }
748
762
 
749
763
  span.note_label, span.example_label, td.example_label, td.note_label
@@ -0,0 +1,2 @@
1
+ clause: Chapter
2
+ subclause: Section
@@ -608,7 +608,7 @@
608
608
  </xsl:template>
609
609
 
610
610
 
611
- <xsl:template match="iho:ul | iho:ol">
611
+ <xsl:template match="iho:ul | iho:ol" mode="ul_ol">
612
612
  <fo:list-block provisional-distance-between-starts="6mm">
613
613
  <xsl:apply-templates/>
614
614
  </fo:list-block>
@@ -624,13 +624,16 @@
624
624
  <xsl:apply-templates mode="process"/>
625
625
  </fo:block>
626
626
  </xsl:template>
627
- <xsl:template match="iho:ul//iho:note/iho:name | iho:ol//iho:note/iho:name" mode="process"/>
628
- <xsl:template match="iho:ul//iho:note/iho:p | iho:ol//iho:note/iho:p" mode="process">
627
+ <xsl:template match="iho:ul//iho:note/iho:name | iho:ol//iho:note/iho:name" mode="process" priority="2"/>
628
+ <xsl:template match="iho:ul//iho:note/iho:p | iho:ol//iho:note/iho:p" mode="process" priority="2">
629
629
  <fo:block font-size="11pt" margin-top="4pt">
630
630
  <xsl:apply-templates/>
631
631
  </fo:block>
632
632
  </xsl:template>
633
633
 
634
+ <xsl:template match="iho:ul//iho:note/* | iho:ol//iho:note/*" mode="process">
635
+ <xsl:apply-templates select="."/>
636
+ </xsl:template>
634
637
 
635
638
 
636
639
  <xsl:template match="iho:li">
@@ -690,7 +693,13 @@
690
693
  </fo:block>
691
694
  </xsl:template>
692
695
 
693
- <!-- Example: [1] IHO S-100, Universal Hydrographic Data Model v4.0.0, December 2018 (Encoding, Feature Catalogue) -->
696
+
697
+ <!-- IHO documents:
698
+ "[1] S57 edition 3.1: IHO Transfer Standard for Digital Hydrographic Data, International Hydrographic Organization (www.iho.int)”
699
+ [{number}] {docID} edition {edition}: {title}, {author/organization}
700
+
701
+ Non-IHO documents:
702
+ Provide title and publisher -->
694
703
  <xsl:template match="iho:bibitem">
695
704
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm" line-height="115%">
696
705
  <fo:list-item>
@@ -703,38 +712,34 @@
703
712
  </fo:list-item-label>
704
713
  <fo:list-item-body start-indent="body-start()">
705
714
  <fo:block>
706
- <xsl:variable name="docidentifier">
707
- <xsl:if test="iho:docidentifier">
708
- <xsl:choose>
709
- <xsl:when test="iho:docidentifier/@type = 'metanorma'"/>
710
- <xsl:otherwise><xsl:value-of select="iho:docidentifier"/></xsl:otherwise>
711
- </xsl:choose>
712
- </xsl:if>
713
- </xsl:variable>
714
- <xsl:value-of select="$docidentifier"/>
715
- <xsl:apply-templates select="iho:note"/>
716
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
717
- <xsl:choose>
718
- <xsl:when test="iho:title[@type = 'main' and @language = 'en']">
719
- <xsl:apply-templates select="iho:title[@type = 'main' and @language = 'en']"/>
720
- </xsl:when>
721
- <xsl:otherwise>
722
- <xsl:apply-templates select="iho:title"/>
723
- </xsl:otherwise>
724
- </xsl:choose>
725
- <xsl:apply-templates select="iho:formattedref"/>
715
+ <xsl:call-template name="processBibitem"/>
726
716
  </fo:block>
727
717
  </fo:list-item-body>
728
718
  </fo:list-item>
729
719
  </fo:list-block>
730
720
  </xsl:template>
731
721
 
722
+ <xsl:template match="iho:bibitem/iho:edition">
723
+ <xsl:text> edition </xsl:text>
724
+ <xsl:value-of select="."/>
725
+ </xsl:template>
726
+
732
727
  <xsl:template match="iho:bibitem/iho:title">
733
728
  <fo:inline font-style="italic">
734
729
  <xsl:apply-templates/>
735
730
  </fo:inline>
736
731
  </xsl:template>
737
732
 
733
+ <xsl:template match="iho:bibitem/iho:uri">
734
+ <xsl:text> (</xsl:text>
735
+ <fo:inline xsl:use-attribute-sets="link-style">
736
+ <fo:basic-link external-destination="." fox:alt-text=".">
737
+ <xsl:value-of select="."/>
738
+ </fo:basic-link>
739
+ </fo:inline>
740
+ <xsl:text>)</xsl:text>
741
+ </xsl:template>
742
+
738
743
  <xsl:template match="iho:bibitem/iho:note" priority="2">
739
744
  <fo:footnote>
740
745
  <xsl:variable name="number">
@@ -991,7 +996,12 @@
991
996
 
992
997
 
993
998
 
994
- <title-source lang="en">SOURCE</title-source>
999
+ <title-source lang="en">
1000
+
1001
+ <xsl:text>SOURCE</xsl:text>
1002
+
1003
+
1004
+ </title-source>
995
1005
 
996
1006
  <title-keywords lang="en">Keywords</title-keywords>
997
1007
 
@@ -1034,6 +1044,10 @@
1034
1044
  <title-warning lang="zh">警告</title-warning>
1035
1045
 
1036
1046
  <title-amendment lang="en">AMENDMENT</title-amendment>
1047
+
1048
+ <title-continued lang="en">(continued)</title-continued>
1049
+ <title-continued lang="fr">(continué)</title-continued>
1050
+
1037
1051
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1038
1052
  <xsl:param name="name"/>
1039
1053
  <xsl:variable name="lang">
@@ -1054,6 +1068,7 @@
1054
1068
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1055
1069
 
1056
1070
 
1071
+
1057
1072
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1058
1073
  <xsl:attribute name="white-space">pre</xsl:attribute>
1059
1074
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1065,8 +1080,8 @@
1065
1080
 
1066
1081
 
1067
1082
 
1068
- <xsl:attribute name="font-family">SFMono-Regular</xsl:attribute>
1069
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1083
+
1084
+ <xsl:attribute name="font-family">SFMono-Regular</xsl:attribute>
1070
1085
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1071
1086
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1072
1087
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -1121,6 +1136,7 @@
1121
1136
 
1122
1137
 
1123
1138
 
1139
+
1124
1140
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1125
1141
 
1126
1142
 
@@ -1142,6 +1158,7 @@
1142
1158
 
1143
1159
 
1144
1160
 
1161
+
1145
1162
 
1146
1163
 
1147
1164
 
@@ -1201,11 +1218,13 @@
1201
1218
 
1202
1219
  <xsl:attribute name="color">blue</xsl:attribute>
1203
1220
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1204
-
1221
+
1222
+
1205
1223
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1206
1224
 
1207
1225
 
1208
1226
 
1227
+
1209
1228
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1210
1229
 
1211
1230
 
@@ -1225,9 +1244,7 @@
1225
1244
 
1226
1245
 
1227
1246
 
1228
-
1229
-
1230
- </xsl:attribute-set><xsl:attribute-set name="note-name-style">
1247
+ </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">
1231
1248
 
1232
1249
 
1233
1250
 
@@ -1239,7 +1256,9 @@
1239
1256
 
1240
1257
 
1241
1258
 
1242
-
1259
+
1260
+
1261
+
1243
1262
 
1244
1263
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1245
1264
 
@@ -1269,6 +1288,8 @@
1269
1288
 
1270
1289
 
1271
1290
 
1291
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1292
+
1272
1293
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1273
1294
 
1274
1295
 
@@ -1299,6 +1320,7 @@
1299
1320
  <xsl:attribute name="color">blue</xsl:attribute>
1300
1321
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1301
1322
 
1323
+
1302
1324
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1303
1325
 
1304
1326
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1310,6 +1332,7 @@
1310
1332
 
1311
1333
 
1312
1334
 
1335
+
1313
1336
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1314
1337
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1315
1338
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1351,14 +1374,16 @@
1351
1374
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1352
1375
 
1353
1376
 
1354
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1355
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1377
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
1378
+
1356
1379
 
1357
1380
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
1358
1381
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1359
1382
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1360
1383
  <xsl:attribute name="text-align">center</xsl:attribute>
1361
1384
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1385
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1386
+
1362
1387
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1363
1388
 
1364
1389
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1424,6 +1449,8 @@
1424
1449
 
1425
1450
 
1426
1451
 
1452
+ <!-- $namespace = 'iso' or -->
1453
+
1427
1454
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1428
1455
 
1429
1456
 
@@ -1483,7 +1510,7 @@
1483
1510
 
1484
1511
 
1485
1512
 
1486
-
1513
+
1487
1514
 
1488
1515
 
1489
1516
  <xsl:attribute name="space-after">18pt</xsl:attribute>
@@ -1502,11 +1529,13 @@
1502
1529
 
1503
1530
 
1504
1531
 
1532
+
1505
1533
 
1506
1534
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1507
1535
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
1508
1536
 
1509
1537
 
1538
+
1510
1539
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
1511
1540
  <xsl:choose>
1512
1541
  <xsl:when test=". = 1 or . = 0">
@@ -1537,8 +1566,9 @@
1537
1566
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1538
1567
  <xsl:if test="normalize-space() != ''">
1539
1568
  <fo:block xsl:use-attribute-sets="table-name-style">
1540
- <xsl:apply-templates/>
1541
- </fo:block>
1569
+
1570
+ <xsl:apply-templates/>
1571
+ </fo:block>
1542
1572
  </xsl:if>
1543
1573
  </xsl:template><xsl:template name="calculate-columns-numbers">
1544
1574
  <xsl:param name="table-row"/>
@@ -1654,10 +1684,25 @@
1654
1684
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1655
1685
  <xsl:param name="cols-count"/>
1656
1686
  <!-- font-weight="bold" -->
1657
- <fo:table-header>
1658
-
1687
+ <fo:table-header>
1688
+
1659
1689
  <xsl:apply-templates/>
1660
1690
  </fo:table-header>
1691
+ </xsl:template><xsl:template name="table-header-title">
1692
+ <xsl:param name="cols-count"/>
1693
+ <!-- row for title -->
1694
+ <fo:table-row>
1695
+ <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">
1696
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1697
+ <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1698
+ <xsl:call-template name="fn_name_display"/>
1699
+ </xsl:for-each>
1700
+ <fo:block text-align="right" font-style="italic">
1701
+ <xsl:text> </xsl:text>
1702
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1703
+ </fo:block>
1704
+ </fo:table-cell>
1705
+ </fo:table-row>
1661
1706
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
1662
1707
  <fo:table-body>
1663
1708
  <xsl:apply-templates/>
@@ -1721,6 +1766,8 @@
1721
1766
  </xsl:choose>
1722
1767
  </xsl:variable>
1723
1768
 
1769
+
1770
+
1724
1771
  <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
1725
1772
  <xsl:with-param name="cols-count" select="$cols-count"/>
1726
1773
  </xsl:apply-templates>
@@ -1730,6 +1777,8 @@
1730
1777
  </xsl:call-template>
1731
1778
 
1732
1779
  <fo:table-body>
1780
+
1781
+
1733
1782
  <xsl:apply-templates/>
1734
1783
  <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
1735
1784
 
@@ -1752,6 +1801,8 @@
1752
1801
 
1753
1802
  </xsl:if>
1754
1803
 
1804
+
1805
+
1755
1806
 
1756
1807
  <xsl:apply-templates/>
1757
1808
  </fo:table-row>
@@ -1774,6 +1825,7 @@
1774
1825
 
1775
1826
 
1776
1827
 
1828
+
1777
1829
  <xsl:if test="@colspan">
1778
1830
  <xsl:attribute name="number-columns-spanned">
1779
1831
  <xsl:value-of select="@colspan"/>
@@ -1784,10 +1836,22 @@
1784
1836
  <xsl:value-of select="@rowspan"/>
1785
1837
  </xsl:attribute>
1786
1838
  </xsl:if>
1839
+ <xsl:call-template name="display-align"/>
1787
1840
  <fo:block>
1788
1841
  <xsl:apply-templates/>
1789
1842
  </fo:block>
1790
1843
  </fo:table-cell>
1844
+ </xsl:template><xsl:template name="display-align">
1845
+ <xsl:if test="@valign">
1846
+ <xsl:attribute name="display-align">
1847
+ <xsl:choose>
1848
+ <xsl:when test="@valign = 'top'">before</xsl:when>
1849
+ <xsl:when test="@valign = 'middle'">center</xsl:when>
1850
+ <xsl:when test="@valign = 'bottom'">after</xsl:when>
1851
+ <xsl:otherwise>before</xsl:otherwise>
1852
+ </xsl:choose>
1853
+ </xsl:attribute>
1854
+ </xsl:if>
1791
1855
  </xsl:template><xsl:template match="*[local-name()='td']">
1792
1856
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
1793
1857
  <xsl:attribute name="text-align">
@@ -1809,6 +1873,7 @@
1809
1873
 
1810
1874
 
1811
1875
 
1876
+
1812
1877
  <xsl:if test="@colspan">
1813
1878
  <xsl:attribute name="number-columns-spanned">
1814
1879
  <xsl:value-of select="@colspan"/>
@@ -1819,8 +1884,8 @@
1819
1884
  <xsl:value-of select="@rowspan"/>
1820
1885
  </xsl:attribute>
1821
1886
  </xsl:if>
1822
- <fo:block>
1823
-
1887
+ <xsl:call-template name="display-align"/>
1888
+ <fo:block>
1824
1889
  <xsl:apply-templates/>
1825
1890
  </fo:block>
1826
1891
  </fo:table-cell>
@@ -2002,6 +2067,7 @@
2002
2067
 
2003
2068
 
2004
2069
 
2070
+
2005
2071
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2006
2072
 
2007
2073
  <xsl:value-of select="@reference"/>
@@ -2012,119 +2078,133 @@
2012
2078
  <xsl:apply-templates/>
2013
2079
  </fo:inline>
2014
2080
  </xsl:template><xsl:template match="*[local-name()='dl']">
2015
- <xsl:variable name="parent" select="local-name(..)"/>
2016
-
2017
- <xsl:variable name="key_iso">
2018
- <!-- and (not(../@class) or ../@class !='pseudocode') -->
2019
- </xsl:variable>
2020
-
2021
- <xsl:choose>
2022
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2023
-
2024
-
2025
- <fo:block margin-bottom="12pt" text-align="left">
2026
-
2027
- <xsl:variable name="title-where">
2028
- <xsl:call-template name="getTitle">
2029
- <xsl:with-param name="name" select="'title-where'"/>
2030
- </xsl:call-template>
2031
- </xsl:variable>
2032
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2033
- <xsl:apply-templates select="*[local-name()='dt']/*"/>
2034
- <xsl:text/>
2035
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2036
- </fo:block>
2037
-
2038
- </xsl:when>
2039
- <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2040
- <fo:block margin-bottom="12pt" text-align="left">
2041
-
2042
-
2043
-
2044
-
2045
- <xsl:variable name="title-where">
2046
- <xsl:call-template name="getTitle">
2047
- <xsl:with-param name="name" select="'title-where'"/>
2048
- </xsl:call-template>
2049
- </xsl:variable>
2050
- <xsl:value-of select="$title-where"/>
2051
- </fo:block>
2052
- </xsl:when>
2053
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2054
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2055
-
2056
-
2057
-
2058
- <xsl:variable name="title-key">
2059
- <xsl:call-template name="getTitle">
2060
- <xsl:with-param name="name" select="'title-key'"/>
2061
- </xsl:call-template>
2062
- </xsl:variable>
2063
- <xsl:value-of select="$title-key"/>
2064
- </fo:block>
2065
- </xsl:when>
2066
- </xsl:choose>
2067
-
2068
- <!-- a few components -->
2069
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2070
- <fo:block>
2071
-
2081
+ <fo:block-container margin-left="0mm">
2082
+ <xsl:if test="parent::*[local-name() = 'note']">
2083
+ <xsl:attribute name="margin-left">
2084
+ <xsl:choose>
2085
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
2086
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
2087
+ </xsl:choose>
2088
+ </xsl:attribute>
2072
2089
 
2090
+ </xsl:if>
2091
+ <fo:block-container margin-left="0mm">
2092
+
2093
+ <xsl:variable name="parent" select="local-name(..)"/>
2073
2094
 
2095
+ <xsl:variable name="key_iso">
2096
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2097
+ </xsl:variable>
2074
2098
 
2075
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
2099
+ <xsl:choose>
2100
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2101
+
2102
+
2103
+ <fo:block margin-bottom="12pt" text-align="left">
2104
+
2105
+ <xsl:variable name="title-where">
2106
+ <xsl:call-template name="getTitle">
2107
+ <xsl:with-param name="name" select="'title-where'"/>
2108
+ </xsl:call-template>
2109
+ </xsl:variable>
2110
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2111
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2112
+ <xsl:text/>
2113
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2114
+ </fo:block>
2115
+
2116
+ </xsl:when>
2117
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2118
+ <fo:block margin-bottom="12pt" text-align="left">
2119
+
2120
+
2121
+
2122
+
2123
+ <xsl:variable name="title-where">
2124
+ <xsl:call-template name="getTitle">
2125
+ <xsl:with-param name="name" select="'title-where'"/>
2126
+ </xsl:call-template>
2127
+ </xsl:variable>
2128
+ <xsl:value-of select="$title-where"/>
2129
+ </fo:block>
2130
+ </xsl:when>
2131
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2132
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2133
+
2134
+
2135
+
2136
+ <xsl:variable name="title-key">
2137
+ <xsl:call-template name="getTitle">
2138
+ <xsl:with-param name="name" select="'title-key'"/>
2139
+ </xsl:call-template>
2140
+ </xsl:variable>
2141
+ <xsl:value-of select="$title-key"/>
2142
+ </fo:block>
2143
+ </xsl:when>
2144
+ </xsl:choose>
2076
2145
 
2077
- <fo:block>
2078
-
2079
-
2080
-
2081
- <xsl:attribute name="margin-left">-3.5mm</xsl:attribute>
2082
-
2083
-
2084
- <fo:table width="95%" table-layout="fixed">
2146
+ <!-- a few components -->
2147
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2148
+ <fo:block>
2085
2149
 
2086
- <xsl:choose>
2087
- <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2088
- <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2089
- </xsl:when>
2090
- <xsl:when test="normalize-space($key_iso) = 'true'">
2091
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2150
+
2151
+
2152
+
2153
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2154
+
2155
+ <fo:block>
2156
+
2157
+
2158
+
2159
+ <xsl:attribute name="margin-left">-3.5mm</xsl:attribute>
2160
+
2161
+
2162
+ <fo:table width="95%" table-layout="fixed">
2092
2163
 
2093
- </xsl:when>
2094
- </xsl:choose>
2095
- <!-- create virtual html table for dl/[dt and dd] -->
2096
- <xsl:variable name="html-table">
2097
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2098
- <xsl:element name="{$ns}:table">
2099
- <tbody>
2100
- <xsl:apply-templates mode="dl"/>
2101
- </tbody>
2102
- </xsl:element>
2103
- </xsl:variable>
2104
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
2105
- <xsl:variable name="colwidths">
2106
- <xsl:call-template name="calculate-column-widths">
2107
- <xsl:with-param name="cols-count" select="2"/>
2108
- <xsl:with-param name="table" select="$html-table"/>
2109
- </xsl:call-template>
2110
- </xsl:variable>
2111
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2112
- <xsl:variable name="maxlength_dt">
2113
- <xsl:call-template name="getMaxLength_dt"/>
2114
- </xsl:variable>
2115
- <xsl:call-template name="setColumnWidth_dl">
2116
- <xsl:with-param name="colwidths" select="$colwidths"/>
2117
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2118
- </xsl:call-template>
2119
- <fo:table-body>
2120
- <xsl:apply-templates>
2121
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2122
- </xsl:apply-templates>
2123
- </fo:table-body>
2124
- </fo:table>
2125
- </fo:block>
2126
- </fo:block>
2127
- </xsl:if>
2164
+ <xsl:choose>
2165
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2166
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2167
+ </xsl:when>
2168
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2169
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2170
+
2171
+ </xsl:when>
2172
+ </xsl:choose>
2173
+ <!-- create virtual html table for dl/[dt and dd] -->
2174
+ <xsl:variable name="html-table">
2175
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2176
+ <xsl:element name="{$ns}:table">
2177
+ <tbody>
2178
+ <xsl:apply-templates mode="dl"/>
2179
+ </tbody>
2180
+ </xsl:element>
2181
+ </xsl:variable>
2182
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2183
+ <xsl:variable name="colwidths">
2184
+ <xsl:call-template name="calculate-column-widths">
2185
+ <xsl:with-param name="cols-count" select="2"/>
2186
+ <xsl:with-param name="table" select="$html-table"/>
2187
+ </xsl:call-template>
2188
+ </xsl:variable>
2189
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2190
+ <xsl:variable name="maxlength_dt">
2191
+ <xsl:call-template name="getMaxLength_dt"/>
2192
+ </xsl:variable>
2193
+ <xsl:call-template name="setColumnWidth_dl">
2194
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2195
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2196
+ </xsl:call-template>
2197
+ <fo:table-body>
2198
+ <xsl:apply-templates>
2199
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2200
+ </xsl:apply-templates>
2201
+ </fo:table-body>
2202
+ </fo:table>
2203
+ </fo:block>
2204
+ </fo:block>
2205
+ </xsl:if>
2206
+ </fo:block-container>
2207
+ </fo:block-container>
2128
2208
  </xsl:template><xsl:template name="setColumnWidth_dl">
2129
2209
  <xsl:param name="colwidths"/>
2130
2210
  <xsl:param name="maxlength_dt"/>
@@ -2221,6 +2301,7 @@
2221
2301
  <xsl:param name="key_iso"/>
2222
2302
 
2223
2303
  <fo:table-row>
2304
+
2224
2305
  <fo:table-cell>
2225
2306
 
2226
2307
  <fo:block margin-top="6pt">
@@ -2303,6 +2384,31 @@
2303
2384
  </fo:inline>
2304
2385
  </xsl:template><xsl:template match="*[local-name()='tt']">
2305
2386
  <fo:inline xsl:use-attribute-sets="tt-style">
2387
+ <xsl:variable name="_font-size">
2388
+
2389
+
2390
+
2391
+
2392
+ 10
2393
+
2394
+
2395
+
2396
+
2397
+
2398
+
2399
+
2400
+
2401
+
2402
+ </xsl:variable>
2403
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
2404
+ <xsl:if test="$font-size != ''">
2405
+ <xsl:attribute name="font-size">
2406
+ <xsl:choose>
2407
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
2408
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
2409
+ </xsl:choose>
2410
+ </xsl:attribute>
2411
+ </xsl:if>
2306
2412
  <xsl:apply-templates/>
2307
2413
  </fo:inline>
2308
2414
  </xsl:template><xsl:template match="*[local-name()='del']">
@@ -2629,10 +2735,23 @@
2629
2735
  <xsl:value-of select="substring($str, 2)"/>
2630
2736
  </xsl:template><xsl:template match="mathml:math">
2631
2737
  <fo:inline font-family="STIX2Math">
2632
- <fo:instream-foreign-object fox:alt-text="Math">
2633
- <xsl:copy-of select="."/>
2634
- </fo:instream-foreign-object>
2738
+ <xsl:variable name="mathml">
2739
+ <xsl:apply-templates select="." mode="mathml"/>
2740
+ </xsl:variable>
2741
+ <fo:instream-foreign-object fox:alt-text="Math">
2742
+ <!-- <xsl:copy-of select="."/> -->
2743
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
2744
+ </fo:instream-foreign-object>
2635
2745
  </fo:inline>
2746
+ </xsl:template><xsl:template match="@*|node()" mode="mathml">
2747
+ <xsl:copy>
2748
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
2749
+ </xsl:copy>
2750
+ </xsl:template><xsl:template match="mathml:mtext" mode="mathml">
2751
+ <xsl:copy>
2752
+ <!-- replace start and end spaces to non-break space -->
2753
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
2754
+ </xsl:copy>
2636
2755
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
2637
2756
  <xsl:variable name="target">
2638
2757
  <xsl:choose>
@@ -2713,9 +2832,22 @@
2713
2832
  <xsl:apply-templates/>
2714
2833
  </fo:basic-link>
2715
2834
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
2716
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
2717
- <xsl:apply-templates/>
2718
- </fo:block>
2835
+ <fo:block-container margin-left="0mm">
2836
+ <xsl:if test="parent::*[local-name() = 'note']">
2837
+ <xsl:attribute name="margin-left">
2838
+ <xsl:choose>
2839
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
2840
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
2841
+ </xsl:choose>
2842
+ </xsl:attribute>
2843
+
2844
+ </xsl:if>
2845
+ <fo:block-container margin-left="0mm">
2846
+ <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
2847
+ <xsl:apply-templates/>
2848
+ </fo:block>
2849
+ </fo:block-container>
2850
+ </fo:block-container>
2719
2851
  </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'dt']/*[local-name() = 'stem']">
2720
2852
  <fo:inline>
2721
2853
  <xsl:apply-templates/>
@@ -2779,7 +2911,9 @@
2779
2911
  </xsl:choose>
2780
2912
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
2781
2913
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
2782
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2914
+ <fo:inline xsl:use-attribute-sets="termnote-name-style">
2915
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2916
+ </fo:inline>
2783
2917
  <xsl:apply-templates/>
2784
2918
  </fo:block>
2785
2919
  </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">
@@ -2946,21 +3080,61 @@
2946
3080
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
2947
3081
  <xsl:text> </xsl:text>
2948
3082
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
2949
- <fo:block xsl:use-attribute-sets="sourcecode-style">
2950
- <xsl:apply-templates/>
2951
- </fo:block>
2952
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2953
- </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()">
3083
+
3084
+ <fo:block-container margin-left="0mm">
3085
+ <xsl:if test="parent::*[local-name() = 'note']">
3086
+ <xsl:attribute name="margin-left">
3087
+ <xsl:choose>
3088
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3089
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3090
+ </xsl:choose>
3091
+ </xsl:attribute>
3092
+
3093
+ </xsl:if>
3094
+ <fo:block-container margin-left="0mm">
3095
+
3096
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3097
+ <xsl:variable name="_font-size">
3098
+
3099
+
3100
+
3101
+
3102
+ 10
3103
+
3104
+
3105
+
3106
+
3107
+
3108
+
3109
+
3110
+
3111
+
3112
+ </xsl:variable>
3113
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
3114
+ <xsl:if test="$font-size != ''">
3115
+ <xsl:attribute name="font-size">
3116
+ <xsl:choose>
3117
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3118
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3119
+ </xsl:choose>
3120
+ </xsl:attribute>
3121
+ </xsl:if>
3122
+ <xsl:apply-templates/>
3123
+ </fo:block>
3124
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3125
+
3126
+ </fo:block-container>
3127
+ </fo:block-container>
3128
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
2954
3129
  <xsl:variable name="text">
2955
3130
  <xsl:call-template name="add-zero-spaces-equal"/>
2956
3131
  </xsl:variable>
2957
- <xsl:call-template name="add-zero-spaces">
3132
+ <xsl:call-template name="add-zero-spaces-java">
2958
3133
  <xsl:with-param name="text" select="$text"/>
2959
3134
  </xsl:call-template>
2960
3135
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="presentation">
2961
3136
  <xsl:if test="normalize-space() != ''">
2962
- <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2963
-
3137
+ <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2964
3138
  <xsl:apply-templates/>
2965
3139
  </fo:block>
2966
3140
  </xsl:if>
@@ -3034,9 +3208,9 @@
3034
3208
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3035
3209
  </xsl:if>
3036
3210
  <fo:block-container margin-left="0mm" margin-right="0mm">
3037
- <fo:table id="{@id}" table-layout="fixed" width="100%" border="1pt solid black">
3211
+ <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
3038
3212
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3039
- <xsl:attribute name="border">0.5pt solid black</xsl:attribute>
3213
+ <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
3040
3214
  </xsl:if>
3041
3215
  <xsl:variable name="simple-table">
3042
3216
  <xsl:call-template name="getSimpleTable"/>
@@ -3045,8 +3219,8 @@
3045
3219
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
3046
3220
  <!-- <fo:table-column column-width="35mm"/>
3047
3221
  <fo:table-column column-width="115mm"/> -->
3048
- <fo:table-column column-width="25%"/>
3049
- <fo:table-column column-width="75%"/>
3222
+ <fo:table-column column-width="30%"/>
3223
+ <fo:table-column column-width="70%"/>
3050
3224
  </xsl:if>
3051
3225
  <xsl:apply-templates mode="requirement"/>
3052
3226
  </fo:table>
@@ -3069,14 +3243,21 @@
3069
3243
  <xsl:apply-templates mode="requirement"/>
3070
3244
  </fo:table-body>
3071
3245
  </xsl:template><xsl:template match="*[local-name()='tr']" mode="requirement">
3072
- <fo:table-row height="7mm">
3073
- <xsl:if test="parent::*[local-name()='thead'] and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission'])">
3074
- <xsl:attribute name="border">1pt solid black</xsl:attribute>
3246
+ <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
3247
+ <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
3248
+ <!-- <xsl:attribute name="border">1pt solid black</xsl:attribute> -->
3249
+ <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
3250
+ </xsl:if>
3251
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
3252
+ <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
3253
+ </xsl:if>
3254
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
3255
+ <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
3075
3256
  </xsl:if>
3076
3257
  <xsl:apply-templates mode="requirement"/>
3077
3258
  </fo:table-row>
3078
3259
  </xsl:template><xsl:template match="*[local-name()='th']" mode="requirement">
3079
- <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm" border="0.5pt solid black">
3260
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3080
3261
  <xsl:attribute name="text-align">
3081
3262
  <xsl:choose>
3082
3263
  <xsl:when test="@align">
@@ -3095,6 +3276,7 @@
3095
3276
  <xsl:value-of select="@rowspan"/>
3096
3277
  </xsl:attribute>
3097
3278
  </xsl:if>
3279
+ <xsl:call-template name="display-align"/>
3098
3280
 
3099
3281
  <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3100
3282
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
@@ -3110,7 +3292,7 @@
3110
3292
  </fo:block>
3111
3293
  </fo:table-cell>
3112
3294
  </xsl:template><xsl:template match="*[local-name()='td']" mode="requirement">
3113
- <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm" border="0.5pt solid black">
3295
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3114
3296
  <xsl:if test="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3115
3297
  <xsl:attribute name="padding">0mm</xsl:attribute>
3116
3298
  <xsl:attribute name="padding-left">0mm</xsl:attribute>
@@ -3123,6 +3305,9 @@
3123
3305
  <xsl:otherwise>left</xsl:otherwise>
3124
3306
  </xsl:choose>
3125
3307
  </xsl:attribute>
3308
+ <xsl:if test="following-sibling::*[local-name()='td'] and not(preceding-sibling::*[local-name()='td'])">
3309
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3310
+ </xsl:if>
3126
3311
  <xsl:if test="@colspan">
3127
3312
  <xsl:attribute name="number-columns-spanned">
3128
3313
  <xsl:value-of select="@colspan"/>
@@ -3133,6 +3318,7 @@
3133
3318
  <xsl:value-of select="@rowspan"/>
3134
3319
  </xsl:attribute>
3135
3320
  </xsl:if>
3321
+ <xsl:call-template name="display-align"/>
3136
3322
 
3137
3323
  <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3138
3324
  <xsl:attribute name="padding-left">0.5mm</xsl:attribute>
@@ -3148,7 +3334,7 @@
3148
3334
  </fo:block>
3149
3335
  </fo:table-cell>
3150
3336
  </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
3151
- <fo:block font-size="11pt" font-weight="bold"> <!-- margin-bottom="4pt" text-align="center" -->
3337
+ <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
3152
3338
  <xsl:apply-templates/>
3153
3339
  </fo:block>
3154
3340
  </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
@@ -3174,12 +3360,13 @@
3174
3360
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3175
3361
 
3176
3362
  <xsl:variable name="element">
3177
- block
3363
+ block
3178
3364
 
3365
+ <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
3179
3366
  </xsl:variable>
3180
3367
 
3181
3368
  <xsl:choose>
3182
- <xsl:when test="normalize-space($element) = 'block'">
3369
+ <xsl:when test="contains(normalize-space($element), 'block')">
3183
3370
  <fo:block xsl:use-attribute-sets="example-body-style">
3184
3371
  <xsl:apply-templates/>
3185
3372
  </fo:block>
@@ -3216,25 +3403,44 @@
3216
3403
  </xsl:otherwise>
3217
3404
  </xsl:choose>
3218
3405
 
3219
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3220
- <fo:block xsl:use-attribute-sets="example-p-style">
3406
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3407
+
3408
+ <xsl:variable name="element">
3409
+ block
3221
3410
 
3222
- <xsl:apply-templates/>
3223
- </fo:block>
3411
+ </xsl:variable>
3412
+ <xsl:choose>
3413
+ <xsl:when test="normalize-space($element) = 'block'">
3414
+ <fo:block xsl:use-attribute-sets="example-p-style">
3415
+
3416
+ <xsl:apply-templates/>
3417
+ </fo:block>
3418
+ </xsl:when>
3419
+ <xsl:otherwise>
3420
+ <fo:inline xsl:use-attribute-sets="example-p-style">
3421
+ <xsl:apply-templates/>
3422
+ </fo:inline>
3423
+ </xsl:otherwise>
3424
+ </xsl:choose>
3224
3425
  </xsl:template><xsl:template match="*[local-name() = 'termsource']">
3225
3426
  <fo:block xsl:use-attribute-sets="termsource-style">
3226
3427
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
3227
3428
  <xsl:variable name="termsource_text">
3228
3429
  <xsl:apply-templates/>
3229
3430
  </xsl:variable>
3431
+
3230
3432
  <xsl:choose>
3231
3433
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
3232
3434
  <xsl:apply-templates/>
3233
3435
  </xsl:when>
3234
- <xsl:otherwise>
3235
- <xsl:text>[</xsl:text>
3236
- <xsl:apply-templates/>
3237
- <xsl:text>]</xsl:text>
3436
+ <xsl:otherwise>
3437
+
3438
+ <xsl:text>[</xsl:text>
3439
+
3440
+ <xsl:apply-templates/>
3441
+
3442
+ <xsl:text>]</xsl:text>
3443
+
3238
3444
  </xsl:otherwise>
3239
3445
  </xsl:choose>
3240
3446
  </fo:block>
@@ -3245,10 +3451,13 @@
3245
3451
  </xsl:template><xsl:template match="*[local-name() = 'origin']">
3246
3452
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3247
3453
 
3248
- <xsl:call-template name="getTitle">
3249
- <xsl:with-param name="name" select="'title-source'"/>
3250
- </xsl:call-template>
3251
- <xsl:text>: </xsl:text>
3454
+ <fo:inline>
3455
+
3456
+ <xsl:call-template name="getTitle">
3457
+ <xsl:with-param name="name" select="'title-source'"/>
3458
+ </xsl:call-template>
3459
+ <xsl:text>: </xsl:text>
3460
+ </fo:inline>
3252
3461
 
3253
3462
  <fo:inline xsl:use-attribute-sets="origin-style">
3254
3463
  <xsl:apply-templates/>
@@ -3260,18 +3469,29 @@
3260
3469
  <xsl:if test="normalize-space() != ''">
3261
3470
  <xsl:value-of select="."/>
3262
3471
  </xsl:if>
3263
- </xsl:template><xsl:template match="*[local-name() = 'quote']">
3472
+ </xsl:template><xsl:template match="*[local-name() = 'quote']">
3473
+ <fo:block-container margin-left="0mm">
3474
+ <xsl:if test="parent::*[local-name() = 'note']">
3475
+ <xsl:if test="not(ancestor::*[local-name() = 'table'])">
3476
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
3477
+ </xsl:if>
3478
+ </xsl:if>
3479
+
3480
+ <fo:block-container margin-left="0mm">
3264
3481
 
3265
- <fo:block xsl:use-attribute-sets="quote-style">
3266
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3267
- </fo:block>
3268
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3269
- <fo:block xsl:use-attribute-sets="quote-source-style">
3270
- <!-- — ISO, ISO 7301:2011, Clause 1 -->
3271
- <xsl:apply-templates select="*[local-name() = 'author']"/>
3272
- <xsl:apply-templates select="*[local-name() = 'source']"/>
3273
- </fo:block>
3274
- </xsl:if>
3482
+ <fo:block xsl:use-attribute-sets="quote-style">
3483
+ <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3484
+ </fo:block>
3485
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3486
+ <fo:block xsl:use-attribute-sets="quote-source-style">
3487
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
3488
+ <xsl:apply-templates select="*[local-name() = 'author']"/>
3489
+ <xsl:apply-templates select="*[local-name() = 'source']"/>
3490
+ </fo:block>
3491
+ </xsl:if>
3492
+
3493
+ </fo:block-container>
3494
+ </fo:block-container>
3275
3495
  </xsl:template><xsl:template match="*[local-name() = 'source']">
3276
3496
  <xsl:if test="../*[local-name() = 'author']">
3277
3497
  <xsl:text>, </xsl:text>
@@ -3302,6 +3522,7 @@
3302
3522
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
3303
3523
 
3304
3524
 
3525
+
3305
3526
  </xsl:if>
3306
3527
 
3307
3528
 
@@ -3340,6 +3561,7 @@
3340
3561
 
3341
3562
 
3342
3563
 
3564
+
3343
3565
  </xsl:variable>
3344
3566
 
3345
3567
  <xsl:variable name="padding-right">
@@ -3454,6 +3676,21 @@
3454
3676
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
3455
3677
  <!-- 0xA0 to space replacement -->
3456
3678
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
3679
+ </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
3680
+ <fo:block-container margin-left="0mm">
3681
+ <xsl:if test="parent::*[local-name() = 'note']">
3682
+ <xsl:attribute name="margin-left">
3683
+ <xsl:choose>
3684
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3685
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3686
+ </xsl:choose>
3687
+ </xsl:attribute>
3688
+
3689
+ </xsl:if>
3690
+ <fo:block-container margin-left="0mm">
3691
+ <xsl:apply-templates select="." mode="ul_ol"/>
3692
+ </fo:block-container>
3693
+ </fo:block-container>
3457
3694
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3458
3695
  <!-- <row>
3459
3696
  <date>05-07-2013</date>
@@ -3486,7 +3723,127 @@
3486
3723
  <fo:block><xsl:apply-templates/></fo:block>
3487
3724
  </fo:table-cell>
3488
3725
  </xsl:template><xsl:template name="processBibitem">
3726
+
3727
+
3728
+
3489
3729
 
3730
+ <!-- start IHO bibtem processing -->
3731
+ <xsl:choose>
3732
+ <xsl:when test="iho:formattedref">
3733
+ <xsl:apply-templates select="iho:formattedref"/>
3734
+ </xsl:when>
3735
+ <xsl:otherwise>
3736
+ <xsl:choose>
3737
+ <!-- IHO documents -->
3738
+ <!-- {docID} edition {edition}: {title}, {author/organization} -->
3739
+ <xsl:when test="iho:docidentifier[1]/@type='IHO'">
3740
+ <xsl:value-of select="iho:docidentifier[1]"/>
3741
+ <xsl:apply-templates select="iho:edition"/>
3742
+ <xsl:if test="iho:title or iho:contributor or iho:url">
3743
+ <xsl:text>: </xsl:text>
3744
+ </xsl:if>
3745
+ </xsl:when>
3746
+
3747
+ <!-- Non-IHO documents -->
3748
+ <!-- title and publisher -->
3749
+ <xsl:otherwise>
3750
+ <xsl:variable name="docID">
3751
+ <xsl:call-template name="processBibitemDocId"/>
3752
+ </xsl:variable>
3753
+ <xsl:value-of select="normalize-space($docID)"/>
3754
+ <xsl:if test="normalize-space($docID) != ''"><xsl:text>: </xsl:text></xsl:if>
3755
+ </xsl:otherwise>
3756
+ </xsl:choose>
3757
+
3758
+ <xsl:choose>
3759
+ <xsl:when test="iho:title[@type = 'main' and @language = 'en']">
3760
+ <xsl:apply-templates select="iho:title[@type = 'main' and @language = 'en']"/>
3761
+ </xsl:when>
3762
+ <xsl:otherwise>
3763
+ <xsl:apply-templates select="iho:title"/>
3764
+ </xsl:otherwise>
3765
+ </xsl:choose>
3766
+
3767
+ <xsl:if test="iho:title and iho:contributor">
3768
+ <xsl:text>, </xsl:text>
3769
+ </xsl:if>
3770
+
3771
+ <xsl:variable name="authors">
3772
+ <xsl:choose>
3773
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
3774
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
3775
+ <xsl:copy-of select="."/>
3776
+ </xsl:for-each>
3777
+ </xsl:when>
3778
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
3779
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
3780
+ <xsl:copy-of select="."/>
3781
+ </xsl:for-each>
3782
+ </xsl:when>
3783
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
3784
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
3785
+ <xsl:copy>
3786
+ <xsl:choose>
3787
+ <xsl:when test="position() != 1 and position() != last()">, </xsl:when>
3788
+ <xsl:when test="position() != 1 and position() = last()"> and </xsl:when>
3789
+ </xsl:choose>
3790
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
3791
+ </xsl:copy>
3792
+ </xsl:for-each>
3793
+ </xsl:when>
3794
+ </xsl:choose>
3795
+ </xsl:variable>
3796
+
3797
+ <xsl:for-each select="xalan:nodeset($authors)/*">
3798
+ <xsl:choose>
3799
+ <xsl:when test="not(*[local-name() = 'role'])"><!-- publisher organisation -->
3800
+ <xsl:value-of select="."/>
3801
+ </xsl:when>
3802
+ <xsl:otherwise> <!-- author, editor -->
3803
+ <xsl:choose>
3804
+ <xsl:when test="*[local-name() = 'organization']/*[local-name() = 'name']">
3805
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
3806
+ </xsl:when>
3807
+ <xsl:otherwise>
3808
+ <xsl:for-each select="*[local-name() = 'person']">
3809
+ <xsl:variable name="author">
3810
+ <xsl:call-template name="processPersonalAuthor"/>
3811
+ </xsl:variable>
3812
+ <xsl:value-of select="xalan:nodeset($author)/author"/>
3813
+ </xsl:for-each>
3814
+ </xsl:otherwise>
3815
+ </xsl:choose>
3816
+ </xsl:otherwise>
3817
+ </xsl:choose>
3818
+ <xsl:if test="*[local-name() = 'organization']/*[local-name() = 'name'] and position() != last()">
3819
+ <xsl:text>, </xsl:text>
3820
+ </xsl:if>
3821
+ </xsl:for-each>
3822
+
3823
+ <xsl:apply-templates select="*[local-name() = 'uri'][1]"/>
3824
+
3825
+ </xsl:otherwise>
3826
+ </xsl:choose>
3827
+ <!-- end IHO bibitem processing -->
3828
+
3829
+ </xsl:template><xsl:template name="processBibitemDocId">
3830
+ <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')]"/>
3831
+ <xsl:choose>
3832
+ <xsl:when test="normalize-space($_doc_ident) != ''">
3833
+ <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"/>
3834
+ <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
3835
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
3836
+ </xsl:if>
3837
+ <xsl:value-of select="$_doc_ident"/>
3838
+ </xsl:when>
3839
+ <xsl:otherwise>
3840
+ <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
3841
+ <xsl:if test="$type != ''">
3842
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
3843
+ </xsl:if>
3844
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
3845
+ </xsl:otherwise>
3846
+ </xsl:choose>
3490
3847
  </xsl:template><xsl:template name="processPersonalAuthor">
3491
3848
  <xsl:choose>
3492
3849
  <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">