metanorma-iho 0.2.1 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,9 +12,129 @@ module IsoDoc
12
12
 
13
13
  def info(isoxml, out)
14
14
  @meta.series isoxml, out
15
- @meta.commentperiod isoxml, out
16
15
  super
17
16
  end
17
+
18
+ def std_bibitem_entry(list, b, ordinal, biblio)
19
+ list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
20
+ prefix_bracketed_ref(ref, "[#{ordinal}]")
21
+ standard_citation(ref, b)
22
+ end
23
+ end
24
+
25
+ def nodes_to_span(n)
26
+ noko do |xml|
27
+ xml.span do |s|
28
+ n&.children&.each { |x| parse(x, s) }
29
+ end
30
+ end.join("")
31
+ end
32
+
33
+ def multiplenames_and(names)
34
+ return "" if names.length == 0
35
+ return names[0] if names.length == 1
36
+ return "#{names[0]} and #{names[1]}" if names.length == 2
37
+ names[0..-2].join(", ") + " and #{names[-1]}"
38
+ end
39
+
40
+ def extract_publisher(b)
41
+ c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
42
+ abbrs = []
43
+ names = []
44
+ c&.each do |c1|
45
+ n = c1.at(ns("./organization/name")) or next
46
+ abbrs << (c1.at(ns("./organization/abbreviation")) || n)
47
+ names << nodes_to_span(n)
48
+ end
49
+ return [nil, nil] if names.empty?
50
+ return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
51
+ end
52
+
53
+ def inline_bibitem_ref_code(b)
54
+ id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
55
+ "or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
56
+ id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
57
+ return [nil, id, nil] if id
58
+ id = Nokogiri::XML::Node.new("docidentifier", b.document)
59
+ id << "(NO ID)"
60
+ [nil, id, nil]
61
+ end
62
+
63
+ def extract_edition(b)
64
+ b&.at(ns("./edition"))&.text
65
+ end
66
+
67
+ def extract_uri(b)
68
+ b.at(ns("./uri"))
69
+ end
70
+
71
+ def omit_docid_prefix(prefix)
72
+ return true if prefix == "IHO"
73
+ super
74
+ end
75
+
76
+ def render_identifier(id)
77
+ if !id[1].nil? and id[1]["type"] == "IHO"
78
+ id[1].children = id[1].text.sub(/^IHO /, "")
79
+ end
80
+ super
81
+ end
82
+
83
+ def extract_publisher(b)
84
+ c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
85
+ abbrs = []
86
+ names = []
87
+ c&.each do |c1|
88
+ n = c1.at(ns("./organization/name")) or next
89
+ abbrs << (c1.at(ns("./organization/abbreviation")) || n)
90
+ names << nodes_to_span(n)
91
+ end
92
+ return [nil, nil] if names.empty?
93
+ return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
94
+ end
95
+
96
+ def extract_author(b)
97
+ c = b.xpath(ns("./contributor[role/@type = 'author']"))
98
+ c = b.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
99
+ return extract_publisher(b)[0] if c.empty?
100
+ c.map do |c1|
101
+ c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
102
+ end.reject { |e| e.nil? || e.empty? }.join(", ")
103
+ end
104
+
105
+ def extract_person_name(b)
106
+ p = b.at(ns("./person/name")) or return
107
+ c = p.at(ns("./completename")) and return c.text
108
+ s = p&.at(ns("./surname"))&.text or return
109
+ i = p.xpath(ns("./initial")) and
110
+ front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join("")
111
+ i.empty? and f = p.xpath(ns("./forename")) and
112
+ front = f.map { |e| e.text[0].upcase }.join("")
113
+ front ? "#{s} #{front}" : s
114
+ end
115
+
116
+ def is_iho?(b)
117
+ extract_publisher(b)[1] == "IHO"
118
+ end
119
+
120
+ # [{number}] {docID} edition {edition}: {title}, {author/organization}
121
+ def standard_citation(out, b)
122
+ if ftitle = b.at(ns("./formattedref"))
123
+ ftitle&.children&.each { |n| parse(n, out) }
124
+ else
125
+ id = render_identifier(inline_bibitem_ref_code(b))
126
+ out << id[1] if id[1]
127
+ ed = extract_edition(b) if is_iho?(b)
128
+ out << " edition #{ed}" if ed
129
+ out << ": " if id[1] || ed
130
+ iso_title(b)&.children&.each { |n| parse(n, out) }
131
+ out << ", "
132
+ author = extract_author(b)
133
+ out << author
134
+ u = extract_uri(b)
135
+ out << " (<a href='#{u.text}'>#{u.text}</a>)" if u
136
+ end
137
+ end
18
138
  end
19
139
  end
20
140
  end
@@ -16,7 +16,7 @@ fieldset, form, label, legend,
16
16
  table, caption, tbody, tfoot, thead, tr, th, td,
17
17
  article, aside, canvas, details, embed,
18
18
  figure, figcaption, footer, header, hgroup,
19
- menu, nav, output, ruby, section, summary,
19
+ menu, output, ruby, section, summary,
20
20
  time, mark, audio, video {
21
21
  margin: 0;
22
22
  padding: 0; }
@@ -111,6 +111,10 @@ b, strong {
111
111
  div.document-stage-band, div.document-type-band {
112
112
  background-color: #333333; }
113
113
 
114
+ a.FootnoteRef + a.FootnoteRef:before {
115
+ content: ", ";
116
+ vertical-align: super; }
117
+
114
118
  #standard-band {
115
119
  background-color: #0AC442; }
116
120
 
@@ -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
@@ -15,6 +15,7 @@ module IsoDoc
15
15
  def make_body3(body, docxml)
16
16
  body.div **{ class: "main-section" } do |div3|
17
17
  boilerplate docxml, div3
18
+ preface_block docxml, div3
18
19
  abstract docxml, div3
19
20
  foreword docxml, div3
20
21
  introduction docxml, div3
@@ -0,0 +1,2 @@
1
+ clause: Chapter
2
+ subclause: Section
@@ -111,6 +111,10 @@
111
111
 
112
112
  <xsl:call-template name="addPDFUAmeta"/>
113
113
 
114
+ <xsl:call-template name="addBookmarks">
115
+ <xsl:with-param name="contents" select="$contents"/>
116
+ </xsl:call-template>
117
+
114
118
  <!-- =========================== -->
115
119
  <!-- Cover Page -->
116
120
  <fo:page-sequence master-reference="cover">
@@ -217,7 +221,7 @@
217
221
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
218
222
  </xsl:if>
219
223
 
220
- <xsl:for-each select="xalan:nodeset($contents)//item"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
224
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
221
225
  <fo:block>
222
226
  <xsl:if test="@level = 1">
223
227
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -243,8 +247,8 @@
243
247
  </fo:list-item-label>
244
248
  <fo:list-item-body start-indent="body-start()">
245
249
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
246
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
247
- <xsl:apply-templates/>
250
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
251
+ <xsl:apply-templates select="title"/>
248
252
  <fo:inline keep-together.within-line="always">
249
253
  <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
250
254
  <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
@@ -361,15 +365,21 @@
361
365
  </xsl:variable>
362
366
 
363
367
  <xsl:variable name="display">
364
- <xsl:choose>
365
- <xsl:when test="ancestor-or-self::iho:bibitem">false</xsl:when>
366
- <xsl:when test="ancestor-or-self::iho:term">false</xsl:when>
368
+ <xsl:choose>
367
369
  <xsl:when test="$level &lt;= 2">true</xsl:when>
368
370
  <xsl:otherwise>false</xsl:otherwise>
369
371
  </xsl:choose>
370
372
  </xsl:variable>
371
373
 
372
- <xsl:if test="$display = 'true'">
374
+ <xsl:variable name="skip">
375
+ <xsl:choose>
376
+ <xsl:when test="ancestor-or-self::iho:bibitem">true</xsl:when>
377
+ <xsl:when test="ancestor-or-self::iho:term">true</xsl:when>
378
+ <xsl:otherwise>false</xsl:otherwise>
379
+ </xsl:choose>
380
+ </xsl:variable>
381
+
382
+ <xsl:if test="$skip = 'false'">
373
383
 
374
384
  <xsl:variable name="section">
375
385
  <xsl:call-template name="getSection"/>
@@ -388,10 +398,13 @@
388
398
  <xsl:if test="ancestor-or-self::iho:annex">annex</xsl:if>
389
399
  </xsl:variable>
390
400
 
391
- <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}">
392
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
401
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
402
+ <title>
403
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
404
+ </title>
405
+ <xsl:apply-templates mode="contents"/>
393
406
  </item>
394
- <xsl:apply-templates mode="contents"/>
407
+
395
408
  </xsl:if>
396
409
 
397
410
  </xsl:template>
@@ -608,7 +621,7 @@
608
621
  </xsl:template>
609
622
 
610
623
 
611
- <xsl:template match="iho:ul | iho:ol">
624
+ <xsl:template match="iho:ul | iho:ol" mode="ul_ol">
612
625
  <fo:list-block provisional-distance-between-starts="6mm">
613
626
  <xsl:apply-templates/>
614
627
  </fo:list-block>
@@ -624,13 +637,16 @@
624
637
  <xsl:apply-templates mode="process"/>
625
638
  </fo:block>
626
639
  </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">
640
+ <xsl:template match="iho:ul//iho:note/iho:name | iho:ol//iho:note/iho:name" mode="process" priority="2"/>
641
+ <xsl:template match="iho:ul//iho:note/iho:p | iho:ol//iho:note/iho:p" mode="process" priority="2">
629
642
  <fo:block font-size="11pt" margin-top="4pt">
630
643
  <xsl:apply-templates/>
631
644
  </fo:block>
632
645
  </xsl:template>
633
646
 
647
+ <xsl:template match="iho:ul//iho:note/* | iho:ol//iho:note/*" mode="process">
648
+ <xsl:apply-templates select="."/>
649
+ </xsl:template>
634
650
 
635
651
 
636
652
  <xsl:template match="iho:li">
@@ -690,7 +706,13 @@
690
706
  </fo:block>
691
707
  </xsl:template>
692
708
 
693
- <!-- Example: [1] IHO S-100, Universal Hydrographic Data Model v4.0.0, December 2018 (Encoding, Feature Catalogue) -->
709
+
710
+ <!-- IHO documents:
711
+ "[1] S57 edition 3.1: IHO Transfer Standard for Digital Hydrographic Data, International Hydrographic Organization (www.iho.int)”
712
+ [{number}] {docID} edition {edition}: {title}, {author/organization}
713
+
714
+ Non-IHO documents:
715
+ Provide title and publisher -->
694
716
  <xsl:template match="iho:bibitem">
695
717
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm" line-height="115%">
696
718
  <fo:list-item>
@@ -703,38 +725,34 @@
703
725
  </fo:list-item-label>
704
726
  <fo:list-item-body start-indent="body-start()">
705
727
  <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"/>
728
+ <xsl:call-template name="processBibitem"/>
726
729
  </fo:block>
727
730
  </fo:list-item-body>
728
731
  </fo:list-item>
729
732
  </fo:list-block>
730
733
  </xsl:template>
731
734
 
735
+ <xsl:template match="iho:bibitem/iho:edition">
736
+ <xsl:text> edition </xsl:text>
737
+ <xsl:value-of select="."/>
738
+ </xsl:template>
739
+
732
740
  <xsl:template match="iho:bibitem/iho:title">
733
741
  <fo:inline font-style="italic">
734
742
  <xsl:apply-templates/>
735
743
  </fo:inline>
736
744
  </xsl:template>
737
745
 
746
+ <xsl:template match="iho:bibitem/iho:uri">
747
+ <xsl:text> (</xsl:text>
748
+ <fo:inline xsl:use-attribute-sets="link-style">
749
+ <fo:basic-link external-destination="." fox:alt-text=".">
750
+ <xsl:value-of select="."/>
751
+ </fo:basic-link>
752
+ </fo:inline>
753
+ <xsl:text>)</xsl:text>
754
+ </xsl:template>
755
+
738
756
  <xsl:template match="iho:bibitem/iho:note" priority="2">
739
757
  <fo:footnote>
740
758
  <xsl:variable name="number">
@@ -949,6 +967,12 @@
949
967
 
950
968
  </title-edition>
951
969
 
970
+ <title-edition lang="fr">
971
+
972
+ <xsl:text>Édition </xsl:text>
973
+
974
+ </title-edition>
975
+
952
976
 
953
977
  <title-toc lang="en">
954
978
 
@@ -957,7 +981,12 @@
957
981
 
958
982
 
959
983
  </title-toc>
960
- <title-toc lang="fr">Sommaire</title-toc>
984
+ <title-toc lang="fr">
985
+
986
+ <xsl:text>Sommaire</xsl:text>
987
+
988
+
989
+ </title-toc>
961
990
 
962
991
  <title-toc lang="zh">Contents</title-toc>
963
992
 
@@ -991,7 +1020,12 @@
991
1020
 
992
1021
 
993
1022
 
994
- <title-source lang="en">SOURCE</title-source>
1023
+ <title-source lang="en">
1024
+
1025
+ <xsl:text>SOURCE</xsl:text>
1026
+
1027
+
1028
+ </title-source>
995
1029
 
996
1030
  <title-keywords lang="en">Keywords</title-keywords>
997
1031
 
@@ -1034,12 +1068,25 @@
1034
1068
  <title-warning lang="zh">警告</title-warning>
1035
1069
 
1036
1070
  <title-amendment lang="en">AMENDMENT</title-amendment>
1071
+
1072
+ <title-continued lang="en">(continued)</title-continued>
1073
+ <title-continued lang="fr">(continué)</title-continued>
1074
+
1037
1075
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1038
1076
  <xsl:param name="name"/>
1039
- <xsl:variable name="lang">
1040
- <xsl:call-template name="getLang"/>
1077
+ <xsl:param name="lang"/>
1078
+ <xsl:variable name="lang_">
1079
+ <xsl:choose>
1080
+ <xsl:when test="$lang != ''">
1081
+ <xsl:value-of select="$lang"/>
1082
+ </xsl:when>
1083
+ <xsl:otherwise>
1084
+ <xsl:call-template name="getLang"/>
1085
+ </xsl:otherwise>
1086
+ </xsl:choose>
1041
1087
  </xsl:variable>
1042
- <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
1088
+ <xsl:variable name="language" select="normalize-space($lang_)"/>
1089
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $language]"/>
1043
1090
  <xsl:choose>
1044
1091
  <xsl:when test="normalize-space($title_) != ''">
1045
1092
  <xsl:value-of select="$title_"/>
@@ -1048,12 +1095,15 @@
1048
1095
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1049
1096
  </xsl:otherwise>
1050
1097
  </xsl:choose>
1051
- </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">
1098
+ </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">
1099
+
1100
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
1052
1101
 
1053
1102
  <xsl:attribute name="color">blue</xsl:attribute>
1054
1103
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1055
1104
 
1056
1105
 
1106
+
1057
1107
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1058
1108
  <xsl:attribute name="white-space">pre</xsl:attribute>
1059
1109
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1065,8 +1115,8 @@
1065
1115
 
1066
1116
 
1067
1117
 
1068
- <xsl:attribute name="font-family">SFMono-Regular</xsl:attribute>
1069
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1118
+
1119
+ <xsl:attribute name="font-family">SFMono-Regular</xsl:attribute>
1070
1120
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1071
1121
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1072
1122
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -1121,6 +1171,7 @@
1121
1171
 
1122
1172
 
1123
1173
 
1174
+
1124
1175
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1125
1176
 
1126
1177
 
@@ -1142,6 +1193,7 @@
1142
1193
 
1143
1194
 
1144
1195
 
1196
+
1145
1197
 
1146
1198
 
1147
1199
 
@@ -1188,6 +1240,7 @@
1188
1240
 
1189
1241
 
1190
1242
 
1243
+
1191
1244
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1192
1245
 
1193
1246
 
@@ -1201,11 +1254,13 @@
1201
1254
 
1202
1255
  <xsl:attribute name="color">blue</xsl:attribute>
1203
1256
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1204
-
1257
+
1258
+
1205
1259
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1206
1260
 
1207
1261
 
1208
1262
 
1263
+
1209
1264
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1210
1265
 
1211
1266
 
@@ -1226,8 +1281,7 @@
1226
1281
 
1227
1282
 
1228
1283
 
1229
-
1230
- </xsl:attribute-set><xsl:attribute-set name="note-name-style">
1284
+ </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
1285
 
1232
1286
 
1233
1287
 
@@ -1239,7 +1293,9 @@
1239
1293
 
1240
1294
 
1241
1295
 
1242
-
1296
+
1297
+
1298
+
1243
1299
 
1244
1300
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1245
1301
 
@@ -1269,6 +1325,8 @@
1269
1325
 
1270
1326
 
1271
1327
 
1328
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1329
+
1272
1330
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1273
1331
 
1274
1332
 
@@ -1299,6 +1357,7 @@
1299
1357
  <xsl:attribute name="color">blue</xsl:attribute>
1300
1358
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1301
1359
 
1360
+
1302
1361
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1303
1362
 
1304
1363
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1310,6 +1369,7 @@
1310
1369
 
1311
1370
 
1312
1371
 
1372
+
1313
1373
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1314
1374
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1315
1375
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1351,14 +1411,16 @@
1351
1411
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1352
1412
 
1353
1413
 
1354
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1355
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1414
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
1415
+
1356
1416
 
1357
1417
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
1358
1418
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1359
1419
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1360
1420
  <xsl:attribute name="text-align">center</xsl:attribute>
1361
1421
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1422
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1423
+
1362
1424
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1363
1425
 
1364
1426
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1424,6 +1486,10 @@
1424
1486
 
1425
1487
 
1426
1488
 
1489
+
1490
+
1491
+ <!-- $namespace = 'iso' or -->
1492
+
1427
1493
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1428
1494
 
1429
1495
 
@@ -1459,6 +1525,7 @@
1459
1525
  <xsl:with-param name="table" select="$simple-table"/>
1460
1526
  </xsl:call-template>
1461
1527
  </xsl:variable>
1528
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1462
1529
 
1463
1530
  <!-- <xsl:variable name="colwidths2">
1464
1531
  <xsl:call-template name="calculate-column-widths">
@@ -1480,9 +1547,12 @@
1480
1547
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1481
1548
 
1482
1549
 
1550
+
1551
+
1552
+
1483
1553
 
1484
1554
 
1485
-
1555
+
1486
1556
 
1487
1557
 
1488
1558
 
@@ -1491,21 +1561,42 @@
1491
1561
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
1492
1562
 
1493
1563
 
1494
- <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">
1495
-
1496
-
1497
-
1564
+
1565
+
1566
+
1567
+ <xsl:variable name="table_attributes">
1568
+ <attribute name="table-layout">fixed</attribute>
1569
+ <attribute name="width">100%</attribute>
1570
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1571
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1498
1572
 
1499
1573
 
1500
1574
 
1501
1575
 
1576
+
1577
+
1578
+
1579
+
1580
+ <attribute name="margin-left">0mm</attribute>
1581
+ <attribute name="margin-right">0mm</attribute>
1502
1582
 
1583
+
1503
1584
 
1585
+ </xsl:variable>
1586
+
1587
+
1588
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1504
1589
 
1505
-
1506
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1507
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1590
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1591
+ <xsl:attribute name="{@name}">
1592
+ <xsl:value-of select="."/>
1593
+ </xsl:attribute>
1594
+ </xsl:for-each>
1508
1595
 
1596
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1597
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1598
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1599
+ </xsl:if>
1509
1600
 
1510
1601
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
1511
1602
  <xsl:choose>
@@ -1529,6 +1620,33 @@
1529
1620
 
1530
1621
  </fo:table>
1531
1622
 
1623
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1624
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1625
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1626
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1627
+ </xsl:call-template>
1628
+ </xsl:for-each>
1629
+
1630
+ <!-- insert footer as table -->
1631
+ <!-- <fo:table>
1632
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1633
+ <xsl:attribute name="{@name}">
1634
+ <xsl:value-of select="."/>
1635
+ </xsl:attribute>
1636
+ </xsl:for-each>
1637
+
1638
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1639
+ <xsl:choose>
1640
+ <xsl:when test=". = 1 or . = 0">
1641
+ <fo:table-column column-width="proportional-column-width(2)"/>
1642
+ </xsl:when>
1643
+ <xsl:otherwise>
1644
+ <fo:table-column column-width="proportional-column-width({.})"/>
1645
+ </xsl:otherwise>
1646
+ </xsl:choose>
1647
+ </xsl:for-each>
1648
+ </fo:table>-->
1649
+
1532
1650
 
1533
1651
 
1534
1652
 
@@ -1537,8 +1655,9 @@
1537
1655
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1538
1656
  <xsl:if test="normalize-space() != ''">
1539
1657
  <fo:block xsl:use-attribute-sets="table-name-style">
1540
- <xsl:apply-templates/>
1541
- </fo:block>
1658
+
1659
+ <xsl:apply-templates/>
1660
+ </fo:block>
1542
1661
  </xsl:if>
1543
1662
  </xsl:template><xsl:template name="calculate-columns-numbers">
1544
1663
  <xsl:param name="table-row"/>
@@ -1592,6 +1711,13 @@
1592
1711
  <xsl:for-each select="xalan:nodeset($table)//tr">
1593
1712
  <xsl:variable name="td_text">
1594
1713
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1714
+
1715
+ <!-- <xsl:if test="$namespace = 'bipm'">
1716
+ <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']">
1717
+ <word><xsl:value-of select="normalize-space(.)"/></word>
1718
+ </xsl:for-each>
1719
+ </xsl:if> -->
1720
+
1595
1721
  </xsl:variable>
1596
1722
  <xsl:variable name="words">
1597
1723
  <xsl:variable name="string_with_added_zerospaces">
@@ -1651,13 +1777,31 @@
1651
1777
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
1652
1778
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1653
1779
  <xsl:value-of select="@target"/>
1780
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1781
+ <xsl:variable name="math_text" select="normalize-space(.)"/>
1782
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1654
1783
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1655
1784
  <xsl:param name="cols-count"/>
1656
1785
  <!-- font-weight="bold" -->
1657
- <fo:table-header>
1786
+ <fo:table-header>
1658
1787
 
1659
1788
  <xsl:apply-templates/>
1660
1789
  </fo:table-header>
1790
+ </xsl:template><xsl:template name="table-header-title">
1791
+ <xsl:param name="cols-count"/>
1792
+ <!-- row for title -->
1793
+ <fo:table-row>
1794
+ <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">
1795
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1796
+ <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1797
+ <xsl:call-template name="fn_name_display"/>
1798
+ </xsl:for-each>
1799
+ <fo:block text-align="right" font-style="italic">
1800
+ <xsl:text> </xsl:text>
1801
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1802
+ </fo:block>
1803
+ </fo:table-cell>
1804
+ </fo:table-row>
1661
1805
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
1662
1806
  <fo:table-body>
1663
1807
  <xsl:apply-templates/>
@@ -1665,6 +1809,13 @@
1665
1809
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
1666
1810
  <xsl:apply-templates/>
1667
1811
  </xsl:template><xsl:template name="insertTableFooter">
1812
+ <xsl:param name="cols-count"/>
1813
+ <xsl:if test="../*[local-name()='tfoot']">
1814
+ <fo:table-footer>
1815
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
1816
+ </fo:table-footer>
1817
+ </xsl:if>
1818
+ </xsl:template><xsl:template name="insertTableFooter2">
1668
1819
  <xsl:param name="cols-count"/>
1669
1820
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1670
1821
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -1686,11 +1837,29 @@
1686
1837
  <!-- fn will be processed inside 'note' processing -->
1687
1838
 
1688
1839
 
1840
+
1841
+
1842
+
1843
+
1689
1844
  <!-- except gb -->
1690
1845
 
1691
1846
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1692
1847
 
1693
1848
 
1849
+ <!-- show Note under table in preface (ex. abstract) sections -->
1850
+ <!-- empty, because notes show at page side in main sections -->
1851
+ <!-- <xsl:if test="$namespace = 'bipm'">
1852
+ <xsl:choose>
1853
+ <xsl:when test="ancestor::*[local-name()='preface']">
1854
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1855
+ </xsl:when>
1856
+ <xsl:otherwise>
1857
+ <fo:block/>
1858
+ </xsl:otherwise>
1859
+ </xsl:choose>
1860
+ </xsl:if> -->
1861
+
1862
+
1694
1863
  <!-- horizontal row separator -->
1695
1864
 
1696
1865
 
@@ -1704,6 +1873,88 @@
1704
1873
  </fo:table-footer>
1705
1874
 
1706
1875
  </xsl:if>
1876
+ </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1877
+ <xsl:param name="table_attributes"/>
1878
+ <xsl:param name="colwidths"/>
1879
+
1880
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1881
+
1882
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1883
+
1884
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1885
+
1886
+ <fo:table keep-with-previous="always">
1887
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1888
+ <xsl:choose>
1889
+ <xsl:when test="@name = 'border-top'">
1890
+ <xsl:attribute name="{@name}">0pt solid black</xsl:attribute>
1891
+ </xsl:when>
1892
+ <xsl:when test="@name = 'border'">
1893
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1894
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
1895
+ </xsl:when>
1896
+ <xsl:otherwise>
1897
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1898
+ </xsl:otherwise>
1899
+ </xsl:choose>
1900
+ </xsl:for-each>
1901
+
1902
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1903
+ <xsl:choose>
1904
+ <xsl:when test=". = 1 or . = 0">
1905
+ <fo:table-column column-width="proportional-column-width(2)"/>
1906
+ </xsl:when>
1907
+ <xsl:otherwise>
1908
+ <fo:table-column column-width="proportional-column-width({.})"/>
1909
+ </xsl:otherwise>
1910
+ </xsl:choose>
1911
+ </xsl:for-each>
1912
+
1913
+ <fo:table-body>
1914
+ <fo:table-row>
1915
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
1916
+
1917
+
1918
+
1919
+ <!-- fn will be processed inside 'note' processing -->
1920
+
1921
+
1922
+
1923
+
1924
+
1925
+
1926
+
1927
+ <!-- except gb -->
1928
+
1929
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1930
+
1931
+
1932
+ <!-- <xsl:if test="$namespace = 'bipm'">
1933
+ <xsl:choose>
1934
+ <xsl:when test="ancestor::*[local-name()='preface']">
1935
+ show Note under table in preface (ex. abstract) sections
1936
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1937
+ </xsl:when>
1938
+ <xsl:otherwise>
1939
+ empty, because notes show at page side in main sections
1940
+ <fo:block/>
1941
+ </xsl:otherwise>
1942
+ </xsl:choose>
1943
+ </xsl:if> -->
1944
+
1945
+
1946
+ <!-- horizontal row separator -->
1947
+
1948
+
1949
+ <!-- fn processing -->
1950
+ <xsl:call-template name="fn_display"/>
1951
+
1952
+ </fo:table-cell>
1953
+ </fo:table-row>
1954
+ </fo:table-body>
1955
+
1956
+ </fo:table>
1957
+ </xsl:if>
1707
1958
  </xsl:template><xsl:template match="*[local-name()='tbody']">
1708
1959
 
1709
1960
  <xsl:variable name="cols-count">
@@ -1721,6 +1972,8 @@
1721
1972
  </xsl:choose>
1722
1973
  </xsl:variable>
1723
1974
 
1975
+
1976
+
1724
1977
  <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
1725
1978
  <xsl:with-param name="cols-count" select="$cols-count"/>
1726
1979
  </xsl:apply-templates>
@@ -1730,6 +1983,8 @@
1730
1983
  </xsl:call-template>
1731
1984
 
1732
1985
  <fo:table-body>
1986
+
1987
+
1733
1988
  <xsl:apply-templates/>
1734
1989
  <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
1735
1990
 
@@ -1753,6 +2008,11 @@
1753
2008
  </xsl:if>
1754
2009
 
1755
2010
 
2011
+
2012
+ <!-- <xsl:if test="$namespace = 'bipm'">
2013
+ <xsl:attribute name="height">8mm</xsl:attribute>
2014
+ </xsl:if> -->
2015
+
1756
2016
  <xsl:apply-templates/>
1757
2017
  </fo:table-row>
1758
2018
  </xsl:template><xsl:template match="*[local-name()='th']">
@@ -1774,6 +2034,8 @@
1774
2034
 
1775
2035
 
1776
2036
 
2037
+
2038
+
1777
2039
  <xsl:if test="@colspan">
1778
2040
  <xsl:attribute name="number-columns-spanned">
1779
2041
  <xsl:value-of select="@colspan"/>
@@ -1784,10 +2046,22 @@
1784
2046
  <xsl:value-of select="@rowspan"/>
1785
2047
  </xsl:attribute>
1786
2048
  </xsl:if>
2049
+ <xsl:call-template name="display-align"/>
1787
2050
  <fo:block>
1788
2051
  <xsl:apply-templates/>
1789
2052
  </fo:block>
1790
2053
  </fo:table-cell>
2054
+ </xsl:template><xsl:template name="display-align">
2055
+ <xsl:if test="@valign">
2056
+ <xsl:attribute name="display-align">
2057
+ <xsl:choose>
2058
+ <xsl:when test="@valign = 'top'">before</xsl:when>
2059
+ <xsl:when test="@valign = 'middle'">center</xsl:when>
2060
+ <xsl:when test="@valign = 'bottom'">after</xsl:when>
2061
+ <xsl:otherwise>before</xsl:otherwise>
2062
+ </xsl:choose>
2063
+ </xsl:attribute>
2064
+ </xsl:if>
1791
2065
  </xsl:template><xsl:template match="*[local-name()='td']">
1792
2066
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
1793
2067
  <xsl:attribute name="text-align">
@@ -1803,7 +2077,9 @@
1803
2077
 
1804
2078
 
1805
2079
 
1806
-
2080
+
2081
+
2082
+
1807
2083
 
1808
2084
 
1809
2085
 
@@ -1819,8 +2095,8 @@
1819
2095
  <xsl:value-of select="@rowspan"/>
1820
2096
  </xsl:attribute>
1821
2097
  </xsl:if>
1822
- <fo:block>
1823
-
2098
+ <xsl:call-template name="display-align"/>
2099
+ <fo:block>
1824
2100
  <xsl:apply-templates/>
1825
2101
  </fo:block>
1826
2102
  </fo:table-cell>
@@ -1834,6 +2110,8 @@
1834
2110
 
1835
2111
  <xsl:attribute name="font-size">12pt</xsl:attribute>
1836
2112
 
2113
+
2114
+
1837
2115
  <fo:inline padding-right="2mm">
1838
2116
 
1839
2117
 
@@ -1841,10 +2119,11 @@
1841
2119
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
1842
2120
 
1843
2121
 
1844
-
2122
+
1845
2123
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
1846
2124
 
1847
2125
  </fo:inline>
2126
+
1848
2127
  <xsl:apply-templates mode="process"/>
1849
2128
  </fo:block>
1850
2129
 
@@ -1868,6 +2147,7 @@
1868
2147
 
1869
2148
 
1870
2149
 
2150
+
1871
2151
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
1872
2152
 
1873
2153
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -1877,12 +2157,15 @@
1877
2157
 
1878
2158
 
1879
2159
 
2160
+
1880
2161
  <xsl:value-of select="@reference"/>
1881
2162
 
2163
+
1882
2164
  </fo:inline>
1883
2165
  <fo:inline>
1884
2166
 
1885
- <xsl:apply-templates/>
2167
+ <!-- <xsl:apply-templates /> -->
2168
+ <xsl:copy-of select="./node()"/>
1886
2169
  </fo:inline>
1887
2170
  </fo:block>
1888
2171
  </xsl:if>
@@ -1919,7 +2202,20 @@
1919
2202
  <xsl:variable name="following_dl_colwidths">
1920
2203
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
1921
2204
  <xsl:variable name="html-table">
1922
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2205
+ <xsl:variable name="doc_ns">
2206
+
2207
+ </xsl:variable>
2208
+ <xsl:variable name="ns">
2209
+ <xsl:choose>
2210
+ <xsl:when test="normalize-space($doc_ns) != ''">
2211
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2212
+ </xsl:when>
2213
+ <xsl:otherwise>
2214
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2215
+ </xsl:otherwise>
2216
+ </xsl:choose>
2217
+ </xsl:variable>
2218
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
1923
2219
  <xsl:element name="{$ns}:table">
1924
2220
  <xsl:for-each select="*[local-name() = 'dl'][1]">
1925
2221
  <tbody>
@@ -1984,7 +2280,8 @@
1984
2280
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
1985
2281
  </xsl:if>
1986
2282
 
1987
- <xsl:apply-templates/>
2283
+ <!-- <xsl:apply-templates /> -->
2284
+ <xsl:copy-of select="./node()"/>
1988
2285
  </fo:block>
1989
2286
  </fo:table-cell>
1990
2287
  </fo:table-row>
@@ -2002,9 +2299,13 @@
2002
2299
 
2003
2300
 
2004
2301
 
2302
+
2303
+
2005
2304
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2006
2305
 
2306
+
2007
2307
  <xsl:value-of select="@reference"/>
2308
+
2008
2309
  </fo:basic-link>
2009
2310
  </fo:inline>
2010
2311
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2012,119 +2313,146 @@
2012
2313
  <xsl:apply-templates/>
2013
2314
  </fo:inline>
2014
2315
  </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 -->
2316
+ <fo:block-container margin-left="0mm">
2317
+ <xsl:if test="parent::*[local-name() = 'note']">
2318
+ <xsl:attribute name="margin-left">
2319
+ <xsl:choose>
2320
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
2321
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
2322
+ </xsl:choose>
2323
+ </xsl:attribute>
2023
2324
 
2325
+ </xsl:if>
2326
+ <fo:block-container margin-left="0mm">
2327
+
2328
+ <xsl:variable name="parent" select="local-name(..)"/>
2024
2329
 
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>
2330
+ <xsl:variable name="key_iso">
2331
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2332
+ </xsl:variable>
2037
2333
 
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
-
2072
-
2073
-
2074
-
2075
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
2334
+ <xsl:choose>
2335
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2336
+
2337
+
2338
+ <fo:block margin-bottom="12pt" text-align="left">
2339
+
2340
+ <xsl:variable name="title-where">
2341
+ <xsl:call-template name="getTitle">
2342
+ <xsl:with-param name="name" select="'title-where'"/>
2343
+ </xsl:call-template>
2344
+ </xsl:variable>
2345
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2346
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2347
+ <xsl:text/>
2348
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2349
+ </fo:block>
2350
+
2351
+ </xsl:when>
2352
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2353
+ <fo:block margin-bottom="12pt" text-align="left">
2354
+
2355
+
2356
+
2357
+
2358
+ <xsl:variable name="title-where">
2359
+ <xsl:call-template name="getTitle">
2360
+ <xsl:with-param name="name" select="'title-where'"/>
2361
+ </xsl:call-template>
2362
+ </xsl:variable>
2363
+ <xsl:value-of select="$title-where"/>
2364
+ </fo:block>
2365
+ </xsl:when>
2366
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2367
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2368
+
2369
+
2370
+
2371
+ <xsl:variable name="title-key">
2372
+ <xsl:call-template name="getTitle">
2373
+ <xsl:with-param name="name" select="'title-key'"/>
2374
+ </xsl:call-template>
2375
+ </xsl:variable>
2376
+ <xsl:value-of select="$title-key"/>
2377
+ </fo:block>
2378
+ </xsl:when>
2379
+ </xsl:choose>
2076
2380
 
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">
2381
+ <!-- a few components -->
2382
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2383
+ <fo:block>
2085
2384
 
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>
2385
+
2386
+
2387
+
2388
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2389
+
2390
+ <fo:block>
2391
+
2392
+
2393
+
2394
+ <xsl:attribute name="margin-left">-3.5mm</xsl:attribute>
2395
+
2396
+
2397
+ <fo:table width="95%" table-layout="fixed">
2092
2398
 
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>
2399
+ <xsl:choose>
2400
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2401
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2402
+ </xsl:when>
2403
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2404
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2405
+
2406
+ </xsl:when>
2407
+ </xsl:choose>
2408
+ <!-- create virtual html table for dl/[dt and dd] -->
2409
+ <xsl:variable name="html-table">
2410
+ <xsl:variable name="doc_ns">
2411
+
2412
+ </xsl:variable>
2413
+ <xsl:variable name="ns">
2414
+ <xsl:choose>
2415
+ <xsl:when test="normalize-space($doc_ns) != ''">
2416
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2417
+ </xsl:when>
2418
+ <xsl:otherwise>
2419
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2420
+ </xsl:otherwise>
2421
+ </xsl:choose>
2422
+ </xsl:variable>
2423
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2424
+ <xsl:element name="{$ns}:table">
2425
+ <tbody>
2426
+ <xsl:apply-templates mode="dl"/>
2427
+ </tbody>
2428
+ </xsl:element>
2429
+ </xsl:variable>
2430
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2431
+ <xsl:variable name="colwidths">
2432
+ <xsl:call-template name="calculate-column-widths">
2433
+ <xsl:with-param name="cols-count" select="2"/>
2434
+ <xsl:with-param name="table" select="$html-table"/>
2435
+ </xsl:call-template>
2436
+ </xsl:variable>
2437
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2438
+ <xsl:variable name="maxlength_dt">
2439
+ <xsl:call-template name="getMaxLength_dt"/>
2440
+ </xsl:variable>
2441
+ <xsl:call-template name="setColumnWidth_dl">
2442
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2443
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2444
+ </xsl:call-template>
2445
+ <fo:table-body>
2446
+ <xsl:apply-templates>
2447
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2448
+ </xsl:apply-templates>
2449
+ </fo:table-body>
2450
+ </fo:table>
2451
+ </fo:block>
2452
+ </fo:block>
2453
+ </xsl:if>
2454
+ </fo:block-container>
2455
+ </fo:block-container>
2128
2456
  </xsl:template><xsl:template name="setColumnWidth_dl">
2129
2457
  <xsl:param name="colwidths"/>
2130
2458
  <xsl:param name="maxlength_dt"/>
@@ -2221,6 +2549,7 @@
2221
2549
  <xsl:param name="key_iso"/>
2222
2550
 
2223
2551
  <fo:table-row>
2552
+
2224
2553
  <fo:table-cell>
2225
2554
 
2226
2555
  <fo:block margin-top="6pt">
@@ -2238,6 +2567,7 @@
2238
2567
 
2239
2568
 
2240
2569
 
2570
+
2241
2571
  <xsl:apply-templates/>
2242
2572
  <!-- <xsl:if test="$namespace = 'gb'">
2243
2573
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2249,14 +2579,36 @@
2249
2579
  <fo:table-cell>
2250
2580
  <fo:block>
2251
2581
 
2252
-
2582
+ <!-- <xsl:if test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
2583
+ <xsl:if test="local-name(*[1]) != 'stem'">
2584
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2585
+ </xsl:if>
2586
+ </xsl:if> -->
2253
2587
 
2254
2588
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2255
2589
 
2256
2590
  </fo:block>
2257
2591
  </fo:table-cell>
2258
2592
  </fo:table-row>
2259
-
2593
+ <!-- <xsl:if test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
2594
+ <xsl:if test="local-name(*[1]) = 'stem'">
2595
+ <fo:table-row>
2596
+ <fo:table-cell>
2597
+ <fo:block margin-top="6pt">
2598
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2599
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2600
+ </xsl:if>
2601
+ <xsl:text>&#xA0;</xsl:text>
2602
+ </fo:block>
2603
+ </fo:table-cell>
2604
+ <fo:table-cell>
2605
+ <fo:block>
2606
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2607
+ </fo:block>
2608
+ </fo:table-cell>
2609
+ </fo:table-row>
2610
+ </xsl:if>
2611
+ </xsl:if> -->
2260
2612
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2261
2613
  <xsl:apply-templates/>
2262
2614
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
@@ -2281,6 +2633,31 @@
2281
2633
  </fo:inline>
2282
2634
  </xsl:template><xsl:template match="*[local-name()='tt']">
2283
2635
  <fo:inline xsl:use-attribute-sets="tt-style">
2636
+ <xsl:variable name="_font-size">
2637
+
2638
+
2639
+
2640
+
2641
+ 10
2642
+
2643
+
2644
+
2645
+
2646
+
2647
+
2648
+
2649
+
2650
+
2651
+ </xsl:variable>
2652
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
2653
+ <xsl:if test="$font-size != ''">
2654
+ <xsl:attribute name="font-size">
2655
+ <xsl:choose>
2656
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
2657
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
2658
+ </xsl:choose>
2659
+ </xsl:attribute>
2660
+ </xsl:if>
2284
2661
  <xsl:apply-templates/>
2285
2662
  </fo:inline>
2286
2663
  </xsl:template><xsl:template match="*[local-name()='del']">
@@ -2606,11 +2983,24 @@
2606
2983
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2607
2984
  <xsl:value-of select="substring($str, 2)"/>
2608
2985
  </xsl:template><xsl:template match="mathml:math">
2609
- <fo:inline font-family="STIX2Math">
2610
- <fo:instream-foreign-object fox:alt-text="Math">
2611
- <xsl:copy-of select="."/>
2612
- </fo:instream-foreign-object>
2986
+ <fo:inline font-family="STIX Two Math"> <!-- -->
2987
+ <xsl:variable name="mathml">
2988
+ <xsl:apply-templates select="." mode="mathml"/>
2989
+ </xsl:variable>
2990
+ <fo:instream-foreign-object fox:alt-text="Math">
2991
+ <!-- <xsl:copy-of select="."/> -->
2992
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
2993
+ </fo:instream-foreign-object>
2613
2994
  </fo:inline>
2995
+ </xsl:template><xsl:template match="@*|node()" mode="mathml">
2996
+ <xsl:copy>
2997
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
2998
+ </xsl:copy>
2999
+ </xsl:template><xsl:template match="mathml:mtext" mode="mathml">
3000
+ <xsl:copy>
3001
+ <!-- replace start and end spaces to non-break space -->
3002
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3003
+ </xsl:copy>
2614
3004
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
2615
3005
  <xsl:variable name="target">
2616
3006
  <xsl:choose>
@@ -2687,13 +3077,26 @@
2687
3077
  <xsl:apply-templates/>
2688
3078
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
2689
3079
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2690
-
3080
+
2691
3081
  <xsl:apply-templates/>
2692
3082
  </fo:basic-link>
2693
3083
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
2694
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
2695
- <xsl:apply-templates/>
2696
- </fo:block>
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
+ <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
3096
+ <xsl:apply-templates/>
3097
+ </fo:block>
3098
+ </fo:block-container>
3099
+ </fo:block-container>
2697
3100
  </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'dt']/*[local-name() = 'stem']">
2698
3101
  <fo:inline>
2699
3102
  <xsl:apply-templates/>
@@ -2731,6 +3134,8 @@
2731
3134
 
2732
3135
 
2733
3136
 
3137
+
3138
+
2734
3139
  <fo:inline xsl:use-attribute-sets="note-name-style">
2735
3140
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2736
3141
  </fo:inline>
@@ -2757,7 +3162,9 @@
2757
3162
  </xsl:choose>
2758
3163
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
2759
3164
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
2760
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3165
+ <fo:inline xsl:use-attribute-sets="termnote-name-style">
3166
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3167
+ </fo:inline>
2761
3168
  <xsl:apply-templates/>
2762
3169
  </fo:block>
2763
3170
  </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">
@@ -2852,15 +3259,109 @@
2852
3259
 
2853
3260
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
2854
3261
  </fo:block>
2855
- </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">
3262
+ </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">
2856
3263
  <xsl:apply-templates mode="contents"/>
2857
3264
  <xsl:text> </xsl:text>
2858
- </xsl:template><xsl:template match="text()" mode="contents">
3265
+ </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">
3266
+ <xsl:apply-templates mode="bookmarks"/>
3267
+ <xsl:text> </xsl:text>
3268
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
2859
3269
  <xsl:value-of select="."/>
2860
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3270
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3271
+ <xsl:value-of select="."/>
3272
+ </xsl:template><xsl:template match="node()" mode="contents">
3273
+ <xsl:apply-templates mode="contents"/>
3274
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
3275
+ <xsl:apply-templates mode="bookmarks"/>
3276
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3277
+ <xsl:apply-templates select="."/>
3278
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3279
+ <xsl:apply-templates mode="bookmarks"/>
3280
+ </xsl:template><xsl:template name="addBookmarks">
3281
+ <xsl:param name="contents"/>
3282
+ <xsl:if test="xalan:nodeset($contents)//item">
3283
+ <fo:bookmark-tree>
3284
+ <xsl:choose>
3285
+ <xsl:when test="xalan:nodeset($contents)/doc">
3286
+ <xsl:choose>
3287
+ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3288
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3289
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3290
+ <fo:bookmark-title>
3291
+ <xsl:variable name="bookmark-title_">
3292
+ <xsl:call-template name="getLangVersion">
3293
+ <xsl:with-param name="lang" select="@lang"/>
3294
+ </xsl:call-template>
3295
+ </xsl:variable>
3296
+ <xsl:choose>
3297
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3298
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3299
+ </xsl:when>
3300
+ <xsl:otherwise>
3301
+ <xsl:choose>
3302
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3303
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3304
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3305
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3306
+ </xsl:choose>
3307
+ </xsl:otherwise>
3308
+ </xsl:choose>
3309
+ </fo:bookmark-title>
3310
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3311
+ </fo:bookmark>
3312
+
3313
+ </xsl:for-each>
3314
+ </xsl:when>
3315
+ <xsl:otherwise>
3316
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3317
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3318
+ </xsl:for-each>
3319
+ </xsl:otherwise>
3320
+ </xsl:choose>
3321
+ </xsl:when>
3322
+ <xsl:otherwise>
3323
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
3324
+ </xsl:otherwise>
3325
+ </xsl:choose>
3326
+
3327
+
3328
+
3329
+
3330
+
3331
+
3332
+
3333
+
3334
+ </fo:bookmark-tree>
3335
+ </xsl:if>
3336
+ </xsl:template><xsl:template name="getLangVersion">
3337
+ <xsl:param name="lang"/>
3338
+ <xsl:choose>
3339
+ <xsl:when test="$lang = 'en'">
3340
+
3341
+
3342
+ </xsl:when>
3343
+ <xsl:when test="$lang = 'fr'">
3344
+
3345
+
3346
+ </xsl:when>
3347
+ <xsl:when test="$lang = 'de'">Deutsche</xsl:when>
3348
+ <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3349
+ </xsl:choose>
3350
+ </xsl:template><xsl:template match="item" mode="bookmark">
3351
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
3352
+ <fo:bookmark-title>
3353
+ <xsl:if test="@section != ''">
3354
+ <xsl:value-of select="@section"/>
3355
+ <xsl:text> </xsl:text>
3356
+ </xsl:if>
3357
+ <xsl:value-of select="normalize-space(title)"/>
3358
+ </fo:bookmark-title>
3359
+ <xsl:apply-templates mode="bookmark"/>
3360
+ </fo:bookmark>
3361
+ </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">
2861
3362
  <xsl:if test="normalize-space() != ''">
2862
3363
  <fo:block xsl:use-attribute-sets="figure-name-style">
2863
-
3364
+
2864
3365
  <xsl:apply-templates/>
2865
3366
  </fo:block>
2866
3367
  </xsl:if>
@@ -2915,7 +3416,7 @@
2915
3416
  <xsl:apply-templates/>
2916
3417
  </xsl:otherwise>
2917
3418
  </xsl:choose>
2918
- </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">
3419
+ </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">
2919
3420
  <xsl:text> </xsl:text>
2920
3421
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
2921
3422
  <xsl:copy>
@@ -2924,21 +3425,61 @@
2924
3425
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
2925
3426
  <xsl:text> </xsl:text>
2926
3427
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
2927
- <fo:block xsl:use-attribute-sets="sourcecode-style">
2928
- <xsl:apply-templates/>
2929
- </fo:block>
2930
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2931
- </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()">
3428
+
3429
+ <fo:block-container margin-left="0mm">
3430
+ <xsl:if test="parent::*[local-name() = 'note']">
3431
+ <xsl:attribute name="margin-left">
3432
+ <xsl:choose>
3433
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3434
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3435
+ </xsl:choose>
3436
+ </xsl:attribute>
3437
+
3438
+ </xsl:if>
3439
+ <fo:block-container margin-left="0mm">
3440
+
3441
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3442
+ <xsl:variable name="_font-size">
3443
+
3444
+
3445
+
3446
+
3447
+ 10
3448
+
3449
+
3450
+
3451
+
3452
+
3453
+
3454
+
3455
+
3456
+
3457
+ </xsl:variable>
3458
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
3459
+ <xsl:if test="$font-size != ''">
3460
+ <xsl:attribute name="font-size">
3461
+ <xsl:choose>
3462
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3463
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3464
+ </xsl:choose>
3465
+ </xsl:attribute>
3466
+ </xsl:if>
3467
+ <xsl:apply-templates/>
3468
+ </fo:block>
3469
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3470
+
3471
+ </fo:block-container>
3472
+ </fo:block-container>
3473
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
2932
3474
  <xsl:variable name="text">
2933
3475
  <xsl:call-template name="add-zero-spaces-equal"/>
2934
3476
  </xsl:variable>
2935
- <xsl:call-template name="add-zero-spaces">
3477
+ <xsl:call-template name="add-zero-spaces-java">
2936
3478
  <xsl:with-param name="text" select="$text"/>
2937
3479
  </xsl:call-template>
2938
3480
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="presentation">
2939
3481
  <xsl:if test="normalize-space() != ''">
2940
- <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2941
-
3482
+ <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2942
3483
  <xsl:apply-templates/>
2943
3484
  </fo:block>
2944
3485
  </xsl:if>
@@ -3008,22 +3549,30 @@
3008
3549
  </fo:block>
3009
3550
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3010
3551
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
3552
+ <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3553
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3554
+ </xsl:if>
3011
3555
  <fo:block-container margin-left="0mm" margin-right="0mm">
3012
- <fo:table id="{@id}" table-layout="fixed" width="100%" border="0pt solid black">
3556
+ <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
3557
+ <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3558
+ <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
3559
+ </xsl:if>
3013
3560
  <xsl:variable name="simple-table">
3014
3561
  <xsl:call-template name="getSimpleTable"/>
3015
3562
  </xsl:variable>
3016
3563
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3017
3564
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
3018
- <fo:table-column column-width="35mm"/>
3019
- <fo:table-column column-width="115mm"/>
3565
+ <!-- <fo:table-column column-width="35mm"/>
3566
+ <fo:table-column column-width="115mm"/> -->
3567
+ <fo:table-column column-width="30%"/>
3568
+ <fo:table-column column-width="70%"/>
3020
3569
  </xsl:if>
3021
3570
  <xsl:apply-templates mode="requirement"/>
3022
3571
  </fo:table>
3023
3572
  <!-- fn processing -->
3024
3573
  <xsl:if test=".//*[local-name() = 'fn']">
3025
3574
  <xsl:for-each select="*[local-name() = 'tbody']">
3026
- <fo:block font-size="90%" border-bottom="1.pt solid black">
3575
+ <fo:block font-size="90%" border-bottom="1pt solid black">
3027
3576
  <xsl:call-template name="fn_display"/>
3028
3577
  </fo:block>
3029
3578
  </xsl:for-each>
@@ -3039,17 +3588,27 @@
3039
3588
  <xsl:apply-templates mode="requirement"/>
3040
3589
  </fo:table-body>
3041
3590
  </xsl:template><xsl:template match="*[local-name()='tr']" mode="requirement">
3042
- <fo:table-row>
3591
+ <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
3592
+ <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
3593
+ <!-- <xsl:attribute name="border">1pt solid black</xsl:attribute> -->
3594
+ <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
3595
+ </xsl:if>
3596
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
3597
+ <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
3598
+ </xsl:if>
3599
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
3600
+ <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
3601
+ </xsl:if>
3043
3602
  <xsl:apply-templates mode="requirement"/>
3044
3603
  </fo:table-row>
3045
3604
  </xsl:template><xsl:template match="*[local-name()='th']" mode="requirement">
3046
- <fo:table-cell text-align="{@align}">
3605
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3047
3606
  <xsl:attribute name="text-align">
3048
3607
  <xsl:choose>
3049
3608
  <xsl:when test="@align">
3050
3609
  <xsl:value-of select="@align"/>
3051
3610
  </xsl:when>
3052
- <xsl:otherwise>center</xsl:otherwise>
3611
+ <xsl:otherwise>left</xsl:otherwise>
3053
3612
  </xsl:choose>
3054
3613
  </xsl:attribute>
3055
3614
  <xsl:if test="@colspan">
@@ -3062,22 +3621,27 @@
3062
3621
  <xsl:value-of select="@rowspan"/>
3063
3622
  </xsl:attribute>
3064
3623
  </xsl:if>
3624
+ <xsl:call-template name="display-align"/>
3065
3625
 
3066
- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3626
+ <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3067
3627
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3068
3628
  <xsl:attribute name="background-color">rgb(165, 165, 165)</xsl:attribute>
3069
3629
  </xsl:if>
3070
3630
  <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommendtest'">
3071
3631
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3072
3632
  <xsl:attribute name="background-color">rgb(201, 201, 201)</xsl:attribute>
3073
- </xsl:if>
3633
+ </xsl:if> -->
3074
3634
 
3075
3635
  <fo:block>
3076
3636
  <xsl:apply-templates/>
3077
3637
  </fo:block>
3078
3638
  </fo:table-cell>
3079
3639
  </xsl:template><xsl:template match="*[local-name()='td']" mode="requirement">
3080
- <fo:table-cell text-align="{@align}">
3640
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3641
+ <xsl:if test="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3642
+ <xsl:attribute name="padding">0mm</xsl:attribute>
3643
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
3644
+ </xsl:if>
3081
3645
  <xsl:attribute name="text-align">
3082
3646
  <xsl:choose>
3083
3647
  <xsl:when test="@align">
@@ -3086,6 +3650,9 @@
3086
3650
  <xsl:otherwise>left</xsl:otherwise>
3087
3651
  </xsl:choose>
3088
3652
  </xsl:attribute>
3653
+ <xsl:if test="following-sibling::*[local-name()='td'] and not(preceding-sibling::*[local-name()='td'])">
3654
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3655
+ </xsl:if>
3089
3656
  <xsl:if test="@colspan">
3090
3657
  <xsl:attribute name="number-columns-spanned">
3091
3658
  <xsl:value-of select="@colspan"/>
@@ -3096,25 +3663,27 @@
3096
3663
  <xsl:value-of select="@rowspan"/>
3097
3664
  </xsl:attribute>
3098
3665
  </xsl:if>
3666
+ <xsl:call-template name="display-align"/>
3099
3667
 
3100
- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3668
+ <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3101
3669
  <xsl:attribute name="padding-left">0.5mm</xsl:attribute>
3102
- <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3103
- <xsl:if test="parent::*[local-name()='tr']/preceding-sibling::*[local-name()='tr'] and not(*[local-name()='table'])"> <!-- 2nd line and below -->
3670
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3671
+ <xsl:if test="parent::*[local-name()='tr']/preceding-sibling::*[local-name()='tr'] and not(*[local-name()='table'])">
3104
3672
  <xsl:attribute name="background-color">rgb(201, 201, 201)</xsl:attribute>
3105
3673
  </xsl:if>
3106
- </xsl:if>
3674
+ </xsl:if> -->
3675
+ <!-- 2nd line and below -->
3107
3676
 
3108
3677
  <fo:block>
3109
3678
  <xsl:apply-templates/>
3110
3679
  </fo:block>
3111
3680
  </fo:table-cell>
3112
3681
  </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
3113
- <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="4pt">
3682
+ <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
3114
3683
  <xsl:apply-templates/>
3115
3684
  </fo:block>
3116
- </xsl:template><xsl:template match="*[local-name() = 'p'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
3117
- <fo:block margin-bottom="10pt">
3685
+ </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
3686
+ <fo:block> <!-- margin-bottom="10pt" -->
3118
3687
  <xsl:apply-templates/>
3119
3688
  </fo:block>
3120
3689
  </xsl:template><xsl:template match="*[local-name() = 'termexample']">
@@ -3136,12 +3705,13 @@
3136
3705
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3137
3706
 
3138
3707
  <xsl:variable name="element">
3139
- block
3708
+ block
3140
3709
 
3710
+ <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
3141
3711
  </xsl:variable>
3142
3712
 
3143
3713
  <xsl:choose>
3144
- <xsl:when test="normalize-space($element) = 'block'">
3714
+ <xsl:when test="contains(normalize-space($element), 'block')">
3145
3715
  <fo:block xsl:use-attribute-sets="example-body-style">
3146
3716
  <xsl:apply-templates/>
3147
3717
  </fo:block>
@@ -3178,25 +3748,44 @@
3178
3748
  </xsl:otherwise>
3179
3749
  </xsl:choose>
3180
3750
 
3181
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3182
- <fo:block xsl:use-attribute-sets="example-p-style">
3751
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3752
+
3753
+ <xsl:variable name="element">
3754
+ block
3183
3755
 
3184
- <xsl:apply-templates/>
3185
- </fo:block>
3756
+ </xsl:variable>
3757
+ <xsl:choose>
3758
+ <xsl:when test="normalize-space($element) = 'block'">
3759
+ <fo:block xsl:use-attribute-sets="example-p-style">
3760
+
3761
+ <xsl:apply-templates/>
3762
+ </fo:block>
3763
+ </xsl:when>
3764
+ <xsl:otherwise>
3765
+ <fo:inline xsl:use-attribute-sets="example-p-style">
3766
+ <xsl:apply-templates/>
3767
+ </fo:inline>
3768
+ </xsl:otherwise>
3769
+ </xsl:choose>
3186
3770
  </xsl:template><xsl:template match="*[local-name() = 'termsource']">
3187
3771
  <fo:block xsl:use-attribute-sets="termsource-style">
3188
3772
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
3189
3773
  <xsl:variable name="termsource_text">
3190
3774
  <xsl:apply-templates/>
3191
3775
  </xsl:variable>
3776
+
3192
3777
  <xsl:choose>
3193
3778
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
3194
3779
  <xsl:apply-templates/>
3195
3780
  </xsl:when>
3196
- <xsl:otherwise>
3197
- <xsl:text>[</xsl:text>
3198
- <xsl:apply-templates/>
3199
- <xsl:text>]</xsl:text>
3781
+ <xsl:otherwise>
3782
+
3783
+ <xsl:text>[</xsl:text>
3784
+
3785
+ <xsl:apply-templates/>
3786
+
3787
+ <xsl:text>]</xsl:text>
3788
+
3200
3789
  </xsl:otherwise>
3201
3790
  </xsl:choose>
3202
3791
  </fo:block>
@@ -3207,10 +3796,13 @@
3207
3796
  </xsl:template><xsl:template match="*[local-name() = 'origin']">
3208
3797
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3209
3798
 
3210
- <xsl:call-template name="getTitle">
3211
- <xsl:with-param name="name" select="'title-source'"/>
3212
- </xsl:call-template>
3213
- <xsl:text>: </xsl:text>
3799
+ <fo:inline>
3800
+
3801
+ <xsl:call-template name="getTitle">
3802
+ <xsl:with-param name="name" select="'title-source'"/>
3803
+ </xsl:call-template>
3804
+ <xsl:text>: </xsl:text>
3805
+ </fo:inline>
3214
3806
 
3215
3807
  <fo:inline xsl:use-attribute-sets="origin-style">
3216
3808
  <xsl:apply-templates/>
@@ -3222,18 +3814,29 @@
3222
3814
  <xsl:if test="normalize-space() != ''">
3223
3815
  <xsl:value-of select="."/>
3224
3816
  </xsl:if>
3225
- </xsl:template><xsl:template match="*[local-name() = 'quote']">
3817
+ </xsl:template><xsl:template match="*[local-name() = 'quote']">
3818
+ <fo:block-container margin-left="0mm">
3819
+ <xsl:if test="parent::*[local-name() = 'note']">
3820
+ <xsl:if test="not(ancestor::*[local-name() = 'table'])">
3821
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
3822
+ </xsl:if>
3823
+ </xsl:if>
3824
+
3825
+ <fo:block-container margin-left="0mm">
3226
3826
 
3227
- <fo:block xsl:use-attribute-sets="quote-style">
3228
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3229
- </fo:block>
3230
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3231
- <fo:block xsl:use-attribute-sets="quote-source-style">
3232
- <!-- — ISO, ISO 7301:2011, Clause 1 -->
3233
- <xsl:apply-templates select="*[local-name() = 'author']"/>
3234
- <xsl:apply-templates select="*[local-name() = 'source']"/>
3235
- </fo:block>
3236
- </xsl:if>
3827
+ <fo:block xsl:use-attribute-sets="quote-style">
3828
+ <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3829
+ </fo:block>
3830
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3831
+ <fo:block xsl:use-attribute-sets="quote-source-style">
3832
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
3833
+ <xsl:apply-templates select="*[local-name() = 'author']"/>
3834
+ <xsl:apply-templates select="*[local-name() = 'source']"/>
3835
+ </fo:block>
3836
+ </xsl:if>
3837
+
3838
+ </fo:block-container>
3839
+ </fo:block-container>
3237
3840
  </xsl:template><xsl:template match="*[local-name() = 'source']">
3238
3841
  <xsl:if test="../*[local-name() = 'author']">
3239
3842
  <xsl:text>, </xsl:text>
@@ -3264,6 +3867,7 @@
3264
3867
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
3265
3868
 
3266
3869
 
3870
+
3267
3871
  </xsl:if>
3268
3872
 
3269
3873
 
@@ -3302,6 +3906,7 @@
3302
3906
 
3303
3907
 
3304
3908
 
3909
+
3305
3910
  </xsl:variable>
3306
3911
 
3307
3912
  <xsl:variable name="padding-right">
@@ -3392,6 +3997,7 @@
3392
3997
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
3393
3998
  <fo:block>
3394
3999
  <xsl:call-template name="setId"/>
4000
+
3395
4001
  <xsl:apply-templates/>
3396
4002
  </fo:block>
3397
4003
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -3416,6 +4022,31 @@
3416
4022
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
3417
4023
  <!-- 0xA0 to space replacement -->
3418
4024
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4025
+ </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4026
+ <xsl:choose>
4027
+ <xsl:when test="parent::*[local-name() = 'note']">
4028
+ <fo:block-container>
4029
+ <xsl:attribute name="margin-left">
4030
+ <xsl:choose>
4031
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
4032
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
4033
+ </xsl:choose>
4034
+ </xsl:attribute>
4035
+
4036
+
4037
+ <fo:block-container margin-left="0mm">
4038
+ <fo:block>
4039
+ <xsl:apply-templates select="." mode="ul_ol"/>
4040
+ </fo:block>
4041
+ </fo:block-container>
4042
+ </fo:block-container>
4043
+ </xsl:when>
4044
+ <xsl:otherwise>
4045
+ <fo:block>
4046
+ <xsl:apply-templates select="." mode="ul_ol"/>
4047
+ </fo:block>
4048
+ </xsl:otherwise>
4049
+ </xsl:choose>
3419
4050
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3420
4051
  <!-- <row>
3421
4052
  <date>05-07-2013</date>
@@ -3447,6 +4078,164 @@
3447
4078
  <fo:table-cell border="1pt solid black" padding-left="1mm" padding-top="0.5mm">
3448
4079
  <fo:block><xsl:apply-templates/></fo:block>
3449
4080
  </fo:table-cell>
4081
+ </xsl:template><xsl:template name="processBibitem">
4082
+
4083
+
4084
+
4085
+
4086
+ <!-- start IHO bibtem processing -->
4087
+ <xsl:choose>
4088
+ <xsl:when test="iho:formattedref">
4089
+ <xsl:apply-templates select="iho:formattedref"/>
4090
+ </xsl:when>
4091
+ <xsl:otherwise>
4092
+ <xsl:choose>
4093
+ <!-- IHO documents -->
4094
+ <!-- {docID} edition {edition}: {title}, {author/organization} -->
4095
+ <xsl:when test="iho:docidentifier[1]/@type='IHO'">
4096
+ <xsl:value-of select="iho:docidentifier[1]"/>
4097
+ <xsl:apply-templates select="iho:edition"/>
4098
+ <xsl:if test="iho:title or iho:contributor or iho:url">
4099
+ <xsl:text>: </xsl:text>
4100
+ </xsl:if>
4101
+ </xsl:when>
4102
+
4103
+ <!-- Non-IHO documents -->
4104
+ <!-- title and publisher -->
4105
+ <xsl:otherwise>
4106
+ <xsl:variable name="docID">
4107
+ <xsl:call-template name="processBibitemDocId"/>
4108
+ </xsl:variable>
4109
+ <xsl:value-of select="normalize-space($docID)"/>
4110
+ <xsl:if test="normalize-space($docID) != ''"><xsl:text>: </xsl:text></xsl:if>
4111
+ </xsl:otherwise>
4112
+ </xsl:choose>
4113
+
4114
+ <xsl:choose>
4115
+ <xsl:when test="iho:title[@type = 'main' and @language = 'en']">
4116
+ <xsl:apply-templates select="iho:title[@type = 'main' and @language = 'en']"/>
4117
+ </xsl:when>
4118
+ <xsl:otherwise>
4119
+ <xsl:apply-templates select="iho:title"/>
4120
+ </xsl:otherwise>
4121
+ </xsl:choose>
4122
+
4123
+ <xsl:if test="iho:title and iho:contributor">
4124
+ <xsl:text>, </xsl:text>
4125
+ </xsl:if>
4126
+
4127
+ <xsl:variable name="authors">
4128
+ <xsl:choose>
4129
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4130
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4131
+ <xsl:copy-of select="."/>
4132
+ </xsl:for-each>
4133
+ </xsl:when>
4134
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
4135
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
4136
+ <xsl:copy-of select="."/>
4137
+ </xsl:for-each>
4138
+ </xsl:when>
4139
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
4140
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
4141
+ <xsl:copy>
4142
+ <xsl:choose>
4143
+ <xsl:when test="position() != 1 and position() != last()">, </xsl:when>
4144
+ <xsl:when test="position() != 1 and position() = last()"> and </xsl:when>
4145
+ </xsl:choose>
4146
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4147
+ </xsl:copy>
4148
+ </xsl:for-each>
4149
+ </xsl:when>
4150
+ </xsl:choose>
4151
+ </xsl:variable>
4152
+
4153
+ <xsl:for-each select="xalan:nodeset($authors)/*">
4154
+ <xsl:choose>
4155
+ <xsl:when test="not(*[local-name() = 'role'])"><!-- publisher organisation -->
4156
+ <xsl:value-of select="."/>
4157
+ </xsl:when>
4158
+ <xsl:otherwise> <!-- author, editor -->
4159
+ <xsl:choose>
4160
+ <xsl:when test="*[local-name() = 'organization']/*[local-name() = 'name']">
4161
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4162
+ </xsl:when>
4163
+ <xsl:otherwise>
4164
+ <xsl:for-each select="*[local-name() = 'person']">
4165
+ <xsl:variable name="author">
4166
+ <xsl:call-template name="processPersonalAuthor"/>
4167
+ </xsl:variable>
4168
+ <xsl:value-of select="xalan:nodeset($author)/author"/>
4169
+ </xsl:for-each>
4170
+ </xsl:otherwise>
4171
+ </xsl:choose>
4172
+ </xsl:otherwise>
4173
+ </xsl:choose>
4174
+ <xsl:if test="*[local-name() = 'organization']/*[local-name() = 'name'] and position() != last()">
4175
+ <xsl:text>, </xsl:text>
4176
+ </xsl:if>
4177
+ </xsl:for-each>
4178
+
4179
+ <xsl:apply-templates select="*[local-name() = 'uri'][1]"/>
4180
+
4181
+ </xsl:otherwise>
4182
+ </xsl:choose>
4183
+ <!-- end IHO bibitem processing -->
4184
+
4185
+ </xsl:template><xsl:template name="processBibitemDocId">
4186
+ <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')]"/>
4187
+ <xsl:choose>
4188
+ <xsl:when test="normalize-space($_doc_ident) != ''">
4189
+ <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"/>
4190
+ <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4191
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4192
+ </xsl:if>
4193
+ <xsl:value-of select="$_doc_ident"/>
4194
+ </xsl:when>
4195
+ <xsl:otherwise>
4196
+ <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4197
+ <xsl:if test="$type != ''">
4198
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4199
+ </xsl:if>
4200
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4201
+ </xsl:otherwise>
4202
+ </xsl:choose>
4203
+ </xsl:template><xsl:template name="processPersonalAuthor">
4204
+ <xsl:choose>
4205
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
4206
+ <author>
4207
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
4208
+ </author>
4209
+ </xsl:when>
4210
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
4211
+ <author>
4212
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
4213
+ <xsl:text> </xsl:text>
4214
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
4215
+ </author>
4216
+ </xsl:when>
4217
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
4218
+ <author>
4219
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
4220
+ <xsl:text> </xsl:text>
4221
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
4222
+ </author>
4223
+ </xsl:when>
4224
+ <xsl:otherwise>
4225
+ <xsl:apply-templates/>
4226
+ </xsl:otherwise>
4227
+ </xsl:choose>
4228
+ </xsl:template><xsl:template name="renderDate">
4229
+ <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
4230
+ <xsl:value-of select="*[local-name() = 'on']"/>
4231
+ </xsl:if>
4232
+ <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
4233
+ <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
4234
+ </xsl:if>
4235
+ </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
4236
+ <xsl:value-of select="translate(.,'. ','')"/>
4237
+ </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4238
+ <xsl:value-of select="substring(.,1,1)"/>
3450
4239
  </xsl:template><xsl:template name="convertDate">
3451
4240
  <xsl:param name="date"/>
3452
4241
  <xsl:param name="format" select="'short'"/>
@@ -3525,6 +4314,7 @@
3525
4314
  <dc:title>
3526
4315
  <xsl:variable name="title">
3527
4316
 
4317
+
3528
4318
 
3529
4319
  <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3530
4320
 
@@ -3545,6 +4335,7 @@
3545
4335
  <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
3546
4336
 
3547
4337
 
4338
+
3548
4339
  </dc:creator>
3549
4340
  <dc:description>
3550
4341
  <xsl:variable name="abstract">
@@ -3554,6 +4345,7 @@
3554
4345
 
3555
4346
 
3556
4347
 
4348
+
3557
4349
  </xsl:variable>
3558
4350
  <xsl:value-of select="normalize-space($abstract)"/>
3559
4351
  </dc:description>
@@ -3654,6 +4446,7 @@
3654
4446
 
3655
4447
 
3656
4448
 
4449
+
3657
4450
  </xsl:variable>
3658
4451
  <xsl:if test="$documentNS != $XSLNS">
3659
4452
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -3679,4 +4472,21 @@
3679
4472
  </xsl:otherwise>
3680
4473
  </xsl:choose>
3681
4474
  </xsl:attribute>
4475
+ </xsl:template><xsl:template name="add-letter-spacing">
4476
+ <xsl:param name="text"/>
4477
+ <xsl:param name="letter-spacing" select="'0.15'"/>
4478
+ <xsl:if test="string-length($text) &gt; 0">
4479
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
4480
+ <fo:inline padding-right="{$letter-spacing}mm">
4481
+ <xsl:if test="$char = '®'">
4482
+ <xsl:attribute name="font-size">58%</xsl:attribute>
4483
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
4484
+ </xsl:if>
4485
+ <xsl:value-of select="$char"/>
4486
+ </fo:inline>
4487
+ <xsl:call-template name="add-letter-spacing">
4488
+ <xsl:with-param name="text" select="substring($text, 2)"/>
4489
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4490
+ </xsl:call-template>
4491
+ </xsl:if>
3682
4492
  </xsl:template></xsl:stylesheet>