metanorma-bipm 1.0.5 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,8 @@
35
35
  {% if partid_alt %}<span class="title-second">{{ partid_alt}}: {{ partsubtitle }}</span>{% endif %}
36
36
  {% if subparttitle %}<span class="title-first">{{ subparttitle }}</span><br/>{% endif %}
37
37
  {% if subpartsubtitle %}<span class="title-second">{{ subpartsubtitle }}</span><br/>{% endif %}
38
+ {% if provenancetitle %}<span class="title-first">{{ provenancetitle }}</span><br/>{% endif %}
39
+ {% if provenancesubtitle %}<span class="title-second">{{ provenancesubtitle }}</span><br/>{% endif %}
38
40
  {% if appendixid %}<span class="title-first">{{ appendixid}}: {{ appendixtitle }}</span><br/>{% endif %}
39
41
  {% if appendixid_alt %}<span class="title-second">{{ appendixid_alt}}: {{ appendixsubtitle }}</span>{% endif %}
40
42
  {% if annexid %}<span class="title-first">{{ annexid}}: {{ annextitle }}</span><br/>{% endif %}
@@ -116,6 +116,13 @@ a.FootnoteRef + a.FootnoteRef:before {
116
116
  content: ", ";
117
117
  vertical-align: super; }
118
118
 
119
+ .addition {
120
+ color: blue; }
121
+
122
+ .deletion {
123
+ color: red;
124
+ text-decoration: line-through; }
125
+
119
126
  #brochure-band {
120
127
  background-color: #0AC442; }
121
128
 
@@ -1,10 +1,21 @@
1
1
  annex: Appendix
2
2
  appendix: Annex
3
+ iso_annex: Annex
3
4
  see: see
4
5
  see_also: see also
5
6
  clause: Chapter
6
7
  subclause: Section
8
+ clause_jcgm: Clause
9
+ subclause_jcgm: Clause
7
10
  formula: Equation
8
11
  inequality: Inequality
9
12
  bibliography: References
10
13
  index: Index
14
+ norm_with_refs_pref:
15
+ The following referenced documents are indispensable for the application of this document.
16
+ For dated references, only the edition cited applies.
17
+ For undated references, the latest edition of the referenced
18
+ document (including any amendments) applies.
19
+ all_rights_reserved: All rights reserved
20
+ table_of_contents: Contents
21
+ source: Adapted from
@@ -1,9 +1,12 @@
1
1
  annex: Annexe
2
2
  appendix: Appendice
3
+ iso_annex: Annexe
3
4
  see: voir
4
5
  see_also: voir aussi
5
6
  clause: chapître
6
7
  subclause: section
8
+ clause_jcgm: Article
9
+ subclause_jcgm: Article
7
10
  formula: équation
8
11
  inequality: inégalité
9
12
  bibliography: Références
@@ -34,3 +37,8 @@ stage_dict:
34
37
  draft-development: projet-de-développement
35
38
  in-force: en-vigeur
36
39
  retired: retiré
40
+ norm_with_refs_pref:
41
+ Les documents suivants cités dans le texte sont indispensables pour l'application de ce document. Pour les références datées, seule l’édition citée s’applique. Pour les références non datées, la dernière édition du document de référence s’applique (y compris les éventuels amendements).
42
+ all_rights_reserved: Tous droits réservés
43
+ table_of_contents: Table des matières
44
+ source: Adapté de
@@ -4,19 +4,23 @@ require "sterile"
4
4
  module IsoDoc
5
5
  module BIPM
6
6
  class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
7
- def add_id
7
+ def add_id
8
8
  %(id="_#{UUIDTools::UUID.random_create}")
9
9
  end
10
10
 
11
11
  def index(docxml)
12
12
  unless docxml.at(ns("//index"))
13
- docxml.xpath(ns("//indexsect")).each { |i| i.remove }
13
+ docxml.xpath(ns("//indexsect")).each(&:remove)
14
14
  return
15
15
  end
16
16
  i = docxml.at(ns("//indexsect")) ||
17
- docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}</title></indexsect>").first
18
- index = sort_indexterms(docxml.xpath(ns("//index")), docxml.xpath(ns("//index-xref[@also = 'false']")),
19
- docxml.xpath(ns("//index-xref[@also = 'true']")))
17
+ docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}"\
18
+ "</title></indexsect>").first
19
+ index = sort_indexterms(
20
+ docxml.xpath(ns("//index")),
21
+ docxml.xpath(ns("//index-xref[@also = 'false']")),
22
+ docxml.xpath(ns("//index-xref[@also = 'true']"))
23
+ )
20
24
  index1(docxml, i, index)
21
25
  end
22
26
 
@@ -28,11 +32,12 @@ module IsoDoc
28
32
  c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
29
33
  end
30
34
  end
31
- @xrefs.bookmark_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
35
+ docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
36
+ @xrefs.bookmark_anchor_names(docxml)
32
37
  end
33
38
 
34
- def sortable(s)
35
- HTMLEntities.new.decode(Nokogiri::XML.fragment(s).text)
39
+ def sortable(str)
40
+ HTMLEntities.new.decode(Nokogiri::XML.fragment(str).text)
36
41
  end
37
42
 
38
43
  def index_entries_opt
@@ -40,8 +45,11 @@ module IsoDoc
40
45
  end
41
46
 
42
47
  def index_entries(words, index, primary)
43
- ret = index_entries_head(words[primary], index.dig(words[primary], nil, nil), index_entries_opt)
44
- words2 = index[words[primary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
48
+ ret = index_entries_head(words[primary],
49
+ index.dig(words[primary], nil, nil),
50
+ index_entries_opt)
51
+ words2 = index[words[primary]]&.keys&.compact
52
+ &.each_with_object({}) { |w, v| v[w.downcase] = w }
45
53
  unless words2.empty?
46
54
  ret += "<ul>"
47
55
  words2.keys.localize(@lang.to_sym).sort.to_a.each do |w|
@@ -49,12 +57,15 @@ module IsoDoc
49
57
  end
50
58
  ret += "</ul>"
51
59
  end
52
- ret + "</li>"
60
+ "#{ret}</li>"
53
61
  end
54
62
 
55
63
  def index_entries2(words, index, secondary)
56
- ret = index_entries_head(words[secondary], index.dig(words[secondary], nil), index_entries_opt)
57
- words3 = index[words[secondary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
64
+ ret = index_entries_head(words[secondary],
65
+ index.dig(words[secondary], nil),
66
+ index_entries_opt)
67
+ words3 = index[words[secondary]]&.keys&.reject { |k| k.nil? }
68
+ &.each_with_object({}) { |w, v| v[w.downcase] = w }
58
69
  unless words3.empty?
59
70
  ret += "<ul>"
60
71
  words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
@@ -62,7 +73,7 @@ module IsoDoc
62
73
  end
63
74
  ret += "</ul>"
64
75
  end
65
- ret + "</li>"
76
+ "#{ret}</li>"
66
77
  end
67
78
 
68
79
  def index_entries_head(head, entries, opt)
@@ -110,8 +121,9 @@ module IsoDoc
110
121
  end
111
122
  end
112
123
 
113
- def xml_encode_attr(s)
114
- HTMLEntities.new.encode(s, :basic, :hexadecimal).gsub(/\&#x([^;]+);/) { |x| "&#x#{$1.upcase};" }
124
+ def xml_encode_attr(str)
125
+ HTMLEntities.new.encode(str, :basic, :hexadecimal)
126
+ .gsub(/&#x([^;]+);/) { |_x| "&#x#{$1.upcase};" }
115
127
  end
116
128
 
117
129
  # attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
@@ -130,10 +142,10 @@ module IsoDoc
130
142
  end
131
143
  end
132
144
 
133
- def index2bookmark(t)
134
- t.name = "bookmark"
135
- t.children.each { |x| x.remove }
136
- t["id"] = "_#{UUIDTools::UUID.random_create}"
145
+ def index2bookmark(node)
146
+ node.name = "bookmark"
147
+ node.children.each(&:remove)
148
+ node["id"] = "_#{UUIDTools::UUID.random_create}"
137
149
  end
138
150
  end
139
151
  end
@@ -10,7 +10,7 @@ module IsoDoc
10
10
  @meta = Metadata.new(lang, script, labels)
11
11
  end
12
12
 
13
- def xref_init(lang, script, klass, labels, options)
13
+ def xref_init(lang, script, _klass, labels, options)
14
14
  html = HtmlConvert.new(language: lang, script: script)
15
15
  @xrefs = Xref.new(lang, script, html, labels, options)
16
16
  end
@@ -21,4 +21,3 @@ module IsoDoc
21
21
  end
22
22
  end
23
23
  end
24
-
@@ -4,11 +4,11 @@
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
6
  <xsl:variable name="images" select="document($svg_images)"/>
7
+ <xsl:param name="basepath"/>
7
8
 
8
9
  <!-- <item id="#">N_page</item> -->
9
10
  <!-- param for second pass -->
10
11
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
11
- <xsl:variable name="index" select="document($external_index)"/>
12
12
 
13
13
 
14
14
 
@@ -16,7 +16,18 @@
16
16
 
17
17
 
18
18
 
19
- <xsl:variable name="align_cross_elements_">clause note title terms term termsource</xsl:variable>
19
+ <xsl:variable name="align_cross_elements_default">clause</xsl:variable>
20
+ <xsl:variable name="align_cross_elements_doc" select="normalize-space((//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:ext/jcgm:parallel-align-element)"/>
21
+ <xsl:variable name="align_cross_elements_">
22
+ <xsl:choose>
23
+ <xsl:when test="$align_cross_elements_doc != ''">
24
+ <xsl:value-of select="$align_cross_elements_doc"/>
25
+ </xsl:when>
26
+ <xsl:otherwise>
27
+ <xsl:value-of select="$align_cross_elements_default"/>
28
+ </xsl:otherwise>
29
+ </xsl:choose>
30
+ </xsl:variable>
20
31
  <xsl:variable name="align_cross_elements">
21
32
  <xsl:text>#</xsl:text><xsl:value-of select="translate(normalize-space($align_cross_elements_), ' ', '#')"/><xsl:text>#</xsl:text>
22
33
  </xsl:variable>
@@ -97,7 +108,8 @@
97
108
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
98
109
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
99
110
  <!-- Index -->
100
- <xsl:apply-templates select="//jcgm:clause[@type = 'index']" mode="contents"/>
111
+ <!-- <xsl:apply-templates select="//jcgm:clause[@type = 'index']" mode="contents"/> -->
112
+ <xsl:apply-templates select="//jcgm:indexsect" mode="contents"/>
101
113
  </contents>
102
114
  </doc>
103
115
  </xsl:for-each>
@@ -120,7 +132,8 @@
120
132
 
121
133
  <!-- add id to xref and split xref with @to into two xref -->
122
134
  <xsl:variable name="current_document_index_id">
123
- <xsl:apply-templates select=".//jcgm:clause[@type = 'index']" mode="index_add_id"/>
135
+ <!-- <xsl:apply-templates select=".//jcgm:clause[@type = 'index']" mode="index_add_id"/> -->
136
+ <xsl:apply-templates select=".//jcgm:indexsect" mode="index_add_id"/>
124
137
  </xsl:variable>
125
138
 
126
139
  <xsl:variable name="current_document_index">
@@ -138,8 +151,6 @@
138
151
  </xsl:for-each>
139
152
 
140
153
  </xsl:variable>
141
-
142
- <xsl:variable name="dash" select="'–'"/>
143
154
 
144
155
 
145
156
  <xsl:variable name="lang">
@@ -188,7 +199,9 @@
188
199
  </fo:page-sequence-master>
189
200
  </fo:layout-master-set>
190
201
 
191
- <xsl:call-template name="addPDFUAmeta"/>
202
+ <fo:declarations>
203
+ <xsl:call-template name="addPDFUAmeta"/>
204
+ </fo:declarations>
192
205
 
193
206
  <xsl:call-template name="addBookmarks">
194
207
  <xsl:with-param name="contents" select="$contents"/>
@@ -201,7 +214,7 @@
201
214
  <xsl:call-template name="printEdition"/>
202
215
  <xsl:text>  </xsl:text>
203
216
  <xsl:call-template name="convertDate">
204
- <xsl:with-param name="date" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:version/jcgm:revision-date"/>
217
+ <xsl:with-param name="date" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:date[@type = 'published']/jcgm:on"/>
205
218
  </xsl:call-template>
206
219
  </fo:block>
207
220
  <!-- Example © JCGM 2009 -->
@@ -215,13 +228,16 @@
215
228
  <fo:flow flow-name="xsl-region-body">
216
229
  <xsl:call-template name="insert_Logo-BIPM-Metro"/>
217
230
  <fo:block-container font-weight="bold">
218
- <fo:block font-size="16.5pt" space-after="24.5mm">
231
+ <fo:block font-size="16.5pt">
219
232
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:ext/jcgm:editorialgroup/jcgm:committee/@acronym"/>
220
233
  <xsl:text> </xsl:text>
221
234
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:docnumber"/>
222
235
  <fo:inline font-weight="normal">:</fo:inline>
223
236
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:copyright/jcgm:from"/>
224
237
  </fo:block>
238
+ <fo:block font-size="13pt" font-weight="normal" space-after="19.5mm">
239
+ <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'provenance']"/>
240
+ </fo:block>
225
241
  <fo:block border-bottom="1pt solid black"> </fo:block>
226
242
  <fo:block font-size="16.5pt" margin-left="-0.5mm" padding-top="3.5mm" space-after="7mm" margin-right="7mm" line-height="105%">
227
243
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
@@ -499,7 +515,8 @@
499
515
 
500
516
  <!-- indexes=<xsl:copy-of select="$indexes"/> -->
501
517
  <!-- Index -->
502
- <xsl:apply-templates select="xalan:nodeset($indexes)/doc//jcgm:clause[@type = 'index']" mode="index"/>
518
+ <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc//jcgm:clause[@type = 'index']" mode="index" /> -->
519
+ <xsl:apply-templates select="xalan:nodeset($indexes)/doc//jcgm:indexsect" mode="index"/>
503
520
 
504
521
  </fo:root>
505
522
  </xsl:template>
@@ -532,6 +549,7 @@
532
549
  <xsl:variable name="type">
533
550
  <xsl:choose>
534
551
  <xsl:when test="@type = 'index'">index</xsl:when>
552
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
535
553
  <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
536
554
  </xsl:choose>
537
555
  </xsl:variable>
@@ -583,7 +601,7 @@
583
601
 
584
602
  <xsl:template name="getListItemFormat">
585
603
  <xsl:choose>
586
- <xsl:when test="local-name(..) = 'ul' and ../ancestor::bipm:ul">−</xsl:when> <!-- &#x2212; - minus sign. &#x2014; - dash -->
604
+ <xsl:when test="local-name(..) = 'ul' and ../ancestor::jcgm:ul">−</xsl:when> <!-- &#x2212; - minus sign. &#x2014; - dash -->
587
605
  <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- &#x2014; dash -->
588
606
  <xsl:otherwise> <!-- for ordered lists -->
589
607
  <xsl:variable name="start_value">
@@ -793,6 +811,42 @@
793
811
  </fo:footnote>
794
812
  </xsl:template>
795
813
 
814
+
815
+ <!--
816
+ <fn reference="1">
817
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
818
+ </fn>
819
+ -->
820
+ <xsl:template match="jcgm:title//jcgm:fn | jcgm:name//jcgm:fn | jcgm:p/jcgm:fn[not(ancestor::jcgm:table)] | jcgm:p/*/jcgm:fn[not(ancestor::jcgm:table)] | jcgm:sourcecode/jcgm:fn[not(ancestor::jcgm:table)]" priority="2" name="fn">
821
+ <fo:footnote keep-with-previous.within-line="always">
822
+ <xsl:variable name="number">
823
+ <xsl:number count="jcgm:fn[not(ancestor::jcgm:table)]" level="any"/>
824
+ </xsl:variable>
825
+ <xsl:variable name="gen_id" select="generate-id()"/>
826
+ <xsl:variable name="lang" select="ancestor::jcgm:bipm-standard/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
827
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
828
+ <fo:basic-link internal-destination="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" fox:alt-text="footnote {@reference}">
829
+ <xsl:value-of select="$number"/>
830
+ </fo:basic-link>
831
+ </fo:inline>
832
+ <fo:footnote-body>
833
+ <fo:block font-size="9pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" line-height="124%" text-align="justify">
834
+ <fo:inline id="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super" padding-right="1mm"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
835
+ <xsl:value-of select="$number "/>
836
+ </fo:inline>
837
+ <xsl:for-each select="jcgm:p">
838
+ <xsl:apply-templates/>
839
+ </xsl:for-each>
840
+ </fo:block>
841
+ </fo:footnote-body>
842
+ </fo:footnote>
843
+ </xsl:template>
844
+
845
+ <xsl:template match="jcgm:fn/jcgm:p">
846
+ <fo:block>
847
+ <xsl:apply-templates/>
848
+ </fo:block>
849
+ </xsl:template>
796
850
 
797
851
 
798
852
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="ul_ol">
@@ -968,13 +1022,97 @@
968
1022
  <xsl:apply-templates select="." mode="mathml"/>
969
1023
  </xsl:variable>
970
1024
  <fo:instream-foreign-object fox:alt-text="Math">
1025
+ <xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
1026
+ <xsl:attribute name="width">95%</xsl:attribute>
1027
+ <xsl:attribute name="content-height">100%</xsl:attribute>
1028
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
1029
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
1030
+ </xsl:if>
971
1031
  <!-- <xsl:copy-of select="."/> -->
972
1032
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
973
1033
  </fo:instream-foreign-object>
974
1034
  </fo:inline>
975
1035
  </xsl:template>
976
1036
 
1037
+ <!-- for chemical expressions, when prefix superscripted -->
1038
+ <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and mathml:mtext and (mathml:mtext/text() = '' or not(mathml:mtext/text()))]/mathml:mtext" mode="mathml" priority="2">
1039
+ <mathml:mspace height="1ex"/>
1040
+ </xsl:template>
1041
+ <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and mathml:mtext and (mathml:mtext/text() = ' ' or mathml:mtext/text() = ' ')]/mathml:mtext" mode="mathml" priority="2">
1042
+ <mathml:mspace width="1ex" height="1ex"/>
1043
+ </xsl:template>
1044
+
1045
+ <!-- set height for sup -->
1046
+ <!-- <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and mathml:mtext and (mathml:mtext/text() != '' and mathml:mtext/text() != ' ' and mathml:mtext/text() != '&#xa0;')]/mathml:mtext" mode="mtext"> -->
1047
+ <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1]/*" mode="mathml" priority="2">
1048
+ <xsl:copy>
1049
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
1050
+ </xsl:copy>
1051
+ <!-- <xsl:copy-of select="."/> -->
1052
+ <mathml:mspace height="1.47ex"/>
1053
+ </xsl:template>
1054
+
1055
+ <!-- set script minimal font-size -->
1056
+ <xsl:template match="mathml:math" mode="mathml" priority="2">
1057
+ <xsl:copy>
1058
+ <xsl:apply-templates select="@*" mode="mathml"/>
1059
+ <mathml:mstyle scriptminsize="6pt">
1060
+ <xsl:apply-templates select="node()" mode="mathml"/>
1061
+ </mathml:mstyle>
1062
+ </xsl:copy>
1063
+ </xsl:template>
1064
+
1065
+ <!-- issue 'over bar above equation with sub' fixing -->
1066
+ <xsl:template match="mathml:msub/mathml:mrow[1][mathml:mover and count(following-sibling::*) = 1 and following-sibling::mathml:mrow]" mode="mathml" priority="2">
1067
+ <mathml:mstyle>
1068
+ <xsl:copy-of select="."/>
1069
+ </mathml:mstyle>
1070
+ </xsl:template>
1071
+
1072
+ <!-- Decrease space between ()
1073
+ from:
1074
+ <mfenced open="(" close=")">
1075
+ <mrow>
1076
+ <mtext>Cu</mtext>
1077
+ </mrow>
1078
+ </mfenced>
1079
+ to:
1080
+ <mrow>
1081
+ <mtext>(Cu)</mtext>
1082
+ </mrow> -->
1083
+ <xsl:template match="mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 0]] | mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 1] and */*/*[count(*) = 0]]" mode="mathml" priority="2">
1084
+ <xsl:apply-templates mode="mathml"/>
1085
+ </xsl:template>
1086
+
1087
+ <xsl:template match="mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0] | mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0]" mode="mathml" priority="2"> <!-- [not(following-sibling::*) and not(preceding-sibling::*)] -->
1088
+ <xsl:copy>
1089
+ <xsl:apply-templates select="@*" mode="mathml"/>
1090
+ <xsl:value-of select="ancestor::mathml:mfenced/@open"/>
1091
+ <xsl:value-of select="."/>
1092
+ <xsl:value-of select="ancestor::mathml:mfenced/@close"/>
1093
+ </xsl:copy>
1094
+ </xsl:template>
977
1095
 
1096
+ <!-- Decrease height of / and | -->
1097
+ <xsl:template match="mathml:mo[normalize-space(text()) = '/' or normalize-space(text()) = '|']" mode="mathml" priority="2">
1098
+ <xsl:copy>
1099
+ <xsl:apply-templates select="@*" mode="mathml"/>
1100
+ <xsl:if test="not(@stretchy)">
1101
+ <xsl:attribute name="stretchy">false</xsl:attribute>
1102
+ </xsl:if>
1103
+ <xsl:apply-templates mode="mathml"/>
1104
+ </xsl:copy>
1105
+ </xsl:template>
1106
+
1107
+ <xsl:template match="mathml:mi[string-length(normalize-space()) &gt; 1]" mode="mathml" priority="2">
1108
+ <xsl:if test="preceding-sibling::* and preceding-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
1109
+ <mathml:mspace width="0.3em"/>
1110
+ </xsl:if>
1111
+ <xsl:copy-of select="."/>
1112
+ <xsl:if test="following-sibling::* and following-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
1113
+ <mathml:mspace width="0.3em"/>
1114
+ </xsl:if>
1115
+ </xsl:template>
978
1116
 
979
1117
  <xsl:template match="*[local-name()='admonition']">
980
1118
  <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
@@ -990,6 +1128,17 @@
990
1128
  </xsl:template>
991
1129
 
992
1130
 
1131
+ <xsl:template match="*[local-name()='td' or local-name()='th']/*[local-name()='formula']/*[local-name()='stem']" priority="2">
1132
+ <fo:block>
1133
+ <xsl:if test="ancestor::*[local-name()='td' or local-name()='th'][1][@align]">
1134
+ <xsl:attribute name="text-align">
1135
+ <xsl:value-of select="ancestor::*[local-name()='td' or local-name()='th'][1]/@align"/>
1136
+ </xsl:attribute>
1137
+ </xsl:if>
1138
+ <xsl:apply-templates/>
1139
+ </fo:block>
1140
+ </xsl:template>
1141
+
993
1142
  <xsl:template match="*[local-name()='formula']/*[local-name()='stem']">
994
1143
  <fo:block margin-top="6pt" margin-bottom="12pt">
995
1144
  <fo:table table-layout="fixed" width="100%">
@@ -1228,6 +1377,7 @@
1228
1377
  <xsl:variable name="font-size">
1229
1378
  <xsl:choose>
1230
1379
  <xsl:when test="ancestor::jcgm:preface">15pt</xsl:when>
1380
+ <xsl:when test="parent::jcgm:annex">15pt</xsl:when>
1231
1381
  <xsl:when test="../@inline-header = 'true' or @inline-header = 'true'">10.5pt</xsl:when>
1232
1382
  <xsl:when test="$level = 2">11.5pt</xsl:when>
1233
1383
  <xsl:when test="$level &gt;= 3">10.5pt</xsl:when>
@@ -1259,6 +1409,8 @@
1259
1409
  <xsl:attribute name="space-after">
1260
1410
  <xsl:choose>
1261
1411
  <xsl:when test="ancestor::jcgm:preface">12pt</xsl:when>
1412
+ <xsl:when test="parent::jcgm:annex">30pt</xsl:when>
1413
+ <xsl:when test="following-sibling::*[1][local-name() = 'admitted']">0pt</xsl:when>
1262
1414
  <!-- <xsl:otherwise>12pt</xsl:otherwise> -->
1263
1415
  <xsl:otherwise>12pt</xsl:otherwise>
1264
1416
  </xsl:choose>
@@ -1272,6 +1424,10 @@
1272
1424
  </xsl:choose>
1273
1425
  </xsl:attribute>
1274
1426
  </xsl:if>
1427
+ <xsl:if test="parent::jcgm:annex">
1428
+ <xsl:attribute name="text-align">center</xsl:attribute>
1429
+ <xsl:attribute name="line-height">130%</xsl:attribute>
1430
+ </xsl:if>
1275
1431
  <xsl:apply-templates/>
1276
1432
  </xsl:element>
1277
1433
 
@@ -1288,41 +1444,43 @@
1288
1444
  <xsl:param name="font-size" select="'65%'"/>
1289
1445
  <xsl:param name="baseline-shift" select="'30%'"/>
1290
1446
  <xsl:param name="curr_lang" select="'fr'"/>
1291
- <fo:inline>
1292
- <xsl:variable name="title-edition">
1293
- <xsl:call-template name="getTitle">
1294
- <xsl:with-param name="name" select="'title-edition'"/>
1295
- <xsl:with-param name="lang" select="$curr_lang"/>
1296
- </xsl:call-template>
1297
- </xsl:variable>
1298
- <xsl:value-of select="."/>
1299
- <fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
1300
- <xsl:if test="$curr_lang = 'en'">
1301
- <xsl:attribute name="baseline-shift">0%</xsl:attribute>
1302
- <xsl:attribute name="font-size">100%</xsl:attribute>
1303
- </xsl:if>
1304
- <xsl:choose>
1305
- <xsl:when test="$curr_lang = 'fr'">
1306
- <xsl:choose>
1307
- <xsl:when test=". = '1'">re</xsl:when>
1308
- <xsl:otherwise>e</xsl:otherwise>
1309
- </xsl:choose>
1310
- </xsl:when>
1311
- <xsl:otherwise>
1312
- <xsl:choose>
1313
- <xsl:when test=". = '1'">st</xsl:when>
1314
- <xsl:when test=". = '2'">nd</xsl:when>
1315
- <xsl:when test=". = '3'">rd</xsl:when>
1316
- <xsl:otherwise>th</xsl:otherwise>
1317
- </xsl:choose>
1318
- </xsl:otherwise>
1319
- </xsl:choose>
1320
-
1447
+ <xsl:if test="normalize-space (.) != '1'">
1448
+ <fo:inline>
1449
+ <xsl:variable name="title-edition">
1450
+ <xsl:call-template name="getTitle">
1451
+ <xsl:with-param name="name" select="'title-edition'"/>
1452
+ <xsl:with-param name="lang" select="$curr_lang"/>
1453
+ </xsl:call-template>
1454
+ </xsl:variable>
1455
+ <xsl:value-of select="."/>
1456
+ <fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
1457
+ <xsl:if test="$curr_lang = 'en'">
1458
+ <xsl:attribute name="baseline-shift">0%</xsl:attribute>
1459
+ <xsl:attribute name="font-size">100%</xsl:attribute>
1460
+ </xsl:if>
1461
+ <xsl:choose>
1462
+ <xsl:when test="$curr_lang = 'fr'">
1463
+ <xsl:choose>
1464
+ <xsl:when test=". = '1'">re</xsl:when>
1465
+ <xsl:otherwise>e</xsl:otherwise>
1466
+ </xsl:choose>
1467
+ </xsl:when>
1468
+ <xsl:otherwise>
1469
+ <xsl:choose>
1470
+ <xsl:when test=". = '1'">st</xsl:when>
1471
+ <xsl:when test=". = '2'">nd</xsl:when>
1472
+ <xsl:when test=". = '3'">rd</xsl:when>
1473
+ <xsl:otherwise>th</xsl:otherwise>
1474
+ </xsl:choose>
1475
+ </xsl:otherwise>
1476
+ </xsl:choose>
1477
+
1478
+ </fo:inline>
1479
+ <xsl:text> </xsl:text>
1480
+ <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/>
1481
+ <xsl:text/>
1321
1482
  </fo:inline>
1322
- <xsl:text> </xsl:text>
1323
- <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/>
1324
- <xsl:text/>
1325
- </fo:inline>
1483
+ </xsl:if>
1326
1484
  </xsl:template>
1327
1485
 
1328
1486
 
@@ -1330,177 +1488,58 @@
1330
1488
  <!-- Index processing -->
1331
1489
  <!-- =================== -->
1332
1490
 
1333
- <xsl:template match="@*|node()" mode="index_add_id">
1334
- <xsl:copy>
1335
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
1336
- </xsl:copy>
1337
- </xsl:template>
1338
-
1339
- <xsl:template match="jcgm:xref" mode="index_add_id">
1340
- <xsl:variable name="id">
1341
- <xsl:call-template name="generateIndexXrefId"/>
1342
- </xsl:variable>
1343
- <xsl:copy> <!-- add id to xref -->
1344
- <xsl:apply-templates select="@*" mode="index_add_id"/>
1345
- <xsl:attribute name="id">
1346
- <xsl:value-of select="$id"/>
1347
- </xsl:attribute>
1348
- <xsl:apply-templates mode="index_add_id"/>
1349
- </xsl:copy>
1350
- <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
1351
- <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
1352
- <xsl:if test="@to">
1353
- <xsl:value-of select="$dash"/>
1354
- <xsl:copy>
1355
- <xsl:copy-of select="@*"/>
1356
- <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
1357
- <xsl:attribute name="id">
1358
- <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
1359
- </xsl:attribute>
1360
- <xsl:apply-templates mode="index_add_id"/>
1361
- </xsl:copy>
1362
- </xsl:if>
1363
- </xsl:template>
1364
-
1365
- <xsl:template match="@*|node()" mode="index_update">
1366
- <xsl:copy>
1367
- <xsl:apply-templates select="@*|node()" mode="index_update"/>
1368
- </xsl:copy>
1369
- </xsl:template>
1370
-
1371
- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:li" mode="index_update">
1372
- <xsl:copy>
1373
- <xsl:apply-templates select="@*" mode="index_update"/>
1374
- <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
1375
- </xsl:copy>
1376
- </xsl:template>
1491
+ <!-- <xsl:template match="jcgm:clause[@type = 'index']" />
1492
+ <xsl:template match="jcgm:clause[@type = 'index']" mode="index"> -->
1493
+ <xsl:template match="jcgm:indexsect"/>
1494
+ <xsl:template match="jcgm:indexsect" mode="index">
1377
1495
 
1378
- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:li/node()" mode="process_li_element" priority="2">
1379
- <xsl:param name="element"/>
1380
- <xsl:param name="remove" select="'false'"/>
1381
- <!-- <node></node> -->
1382
- <xsl:choose>
1383
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
1384
- <!-- skip text (i.e. remove it) and process next element -->
1385
- <!-- [removed_<xsl:value-of select="."/>] -->
1386
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1387
- </xsl:when>
1388
- <xsl:when test="self::text()">
1389
- <xsl:value-of select="."/>
1390
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1391
- </xsl:when>
1392
- <xsl:when test="self::* and local-name(.) = 'xref'">
1393
- <xsl:variable name="id" select="@id"/>
1394
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
1395
- <xsl:variable name="id_next" select="following-sibling::jcgm:xref[1]/@id"/>
1396
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
1397
-
1398
- <xsl:variable name="id_prev" select="preceding-sibling::jcgm:xref[1]/@id"/>
1399
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
1400
-
1496
+ <fo:page-sequence master-reference="document-jcgm" force-page-count="no-force">
1497
+ <xsl:variable name="header-title">
1401
1498
  <xsl:choose>
1402
- <!-- 2nd pass -->
1403
- <!-- if page is equal to page for next and page is not the end of range -->
1404
- <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
1405
- <!-- skip element (i.e. remove it) and remove next text ',' -->
1406
- <!-- [removed_xref] -->
1407
-
1408
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
1409
- <xsl:with-param name="remove">true</xsl:with-param>
1410
- </xsl:apply-templates>
1411
- </xsl:when>
1412
-
1413
- <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
1414
- <!-- remove xref -->
1415
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
1416
- <xsl:with-param name="remove">true</xsl:with-param>
1417
- </xsl:apply-templates>
1499
+ <xsl:when test="./jcgm:title[1]/*[local-name() = 'tab']">
1500
+ <xsl:apply-templates select="./jcgm:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
1418
1501
  </xsl:when>
1419
-
1420
1502
  <xsl:otherwise>
1421
- <xsl:copy-of select="."/>
1422
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1503
+ <xsl:apply-templates select="./jcgm:title[1]" mode="header"/>
1423
1504
  </xsl:otherwise>
1424
1505
  </xsl:choose>
1425
- </xsl:when>
1426
- <xsl:when test="self::* and local-name(.) = 'ul'">
1427
- <!-- ul -->
1428
- <xsl:apply-templates select="." mode="index_update"/>
1429
- </xsl:when>
1430
- <xsl:otherwise>
1431
- <xsl:copy-of select="."/>
1432
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1433
- </xsl:otherwise>
1434
- </xsl:choose>
1435
- </xsl:template>
1436
-
1437
-
1438
- <xsl:template name="generateIndexXrefId">
1439
- <xsl:variable name="level" select="count(ancestor::jcgm:ul)"/>
1440
- <!-- <xsl:variable name="parent_ul_id" select="generate-id(ancestor::jcgm:ul[1])"/>
1441
- <xsl:variable name="item_number" select="count(ancestor::jcgm:li[ancestor::jcgm:ul[generate-id() = $parent_ul_id]])"/> -->
1442
- <xsl:variable name="docid">
1443
- <xsl:call-template name="getDocumentId"/>
1444
- </xsl:variable>
1445
- <xsl:variable name="item_number">
1446
- <xsl:number count="jcgm:li[ancestor::jcgm:clause[@type = 'index']]" level="any"/>
1447
- </xsl:variable>
1448
- <xsl:variable name="xref_number"><xsl:number count="jcgm:xref"/></xsl:variable>
1449
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
1450
- </xsl:template>
1451
-
1452
- <xsl:template match="jcgm:clause[@type = 'index']"/>
1453
- <xsl:template match="jcgm:clause[@type = 'index']" mode="index">
1454
-
1455
- <fo:page-sequence master-reference="document-jcgm" force-page-count="no-force">
1506
+ </xsl:variable>
1456
1507
 
1457
1508
  <xsl:call-template name="insertHeaderFooter"/>
1458
1509
 
1459
1510
  <fo:flow flow-name="xsl-region-body">
1460
- <fo:block id="{@id}">
1461
- <xsl:apply-templates/>
1511
+ <fo:block id="{@id}" span="all">
1512
+ <xsl:apply-templates select="jcgm:title"/>
1513
+ </fo:block>
1514
+ <fo:block>
1515
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
1462
1516
  </fo:block>
1463
1517
  </fo:flow>
1464
1518
  </fo:page-sequence>
1465
1519
  </xsl:template>
1466
1520
 
1467
- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:title" priority="4">
1521
+ <!-- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:title" priority="4"> -->
1522
+ <xsl:template match="jcgm:indexsect/jcgm:title" priority="4">
1468
1523
  <fo:block font-weight="bold" span="all">
1469
1524
  <!-- Index -->
1470
1525
  <xsl:apply-templates/>
1471
1526
  </fo:block>
1472
1527
  </xsl:template>
1473
1528
 
1474
- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:clause" priority="4">
1475
- <xsl:apply-templates/>
1476
- <fo:block>
1477
- <xsl:if test="following-sibling::jcgm:clause">
1478
- <fo:block> </fo:block>
1479
- </xsl:if>
1480
- </fo:block>
1481
- </xsl:template>
1482
-
1483
- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:clause/jcgm:title" priority="4">
1529
+
1530
+ <!-- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:clause/jcgm:title" priority="4"> -->
1531
+ <xsl:template match="jcgm:indexsect/jcgm:clause/jcgm:title" priority="4">
1484
1532
  <!-- Letter A, B, C, ... -->
1485
1533
  <fo:block font-weight="bold" margin-left="25mm" keep-with-next="always">
1486
1534
  <xsl:apply-templates/>
1487
1535
  </fo:block>
1488
1536
  </xsl:template>
1489
1537
 
1490
- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:ul" priority="4">
1538
+ <!-- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:ul" priority="4"> -->
1539
+ <xsl:template match="jcgm:indexsect//jcgm:ul" priority="4">
1491
1540
  <xsl:apply-templates/>
1492
1541
  </xsl:template>
1493
-
1494
- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:li" priority="4">
1495
- <xsl:variable name="level" select="count(ancestor::jcgm:ul)"/>
1496
- <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
1497
- <xsl:apply-templates/>
1498
- </fo:block>
1499
- </xsl:template>
1500
-
1501
- <xsl:template match="jcgm:bookmark">
1502
- <fo:inline id="{@id}"/>
1503
- </xsl:template>
1542
+
1504
1543
 
1505
1544
  <!-- =================== -->
1506
1545
  <!-- End of Index processing -->
@@ -1577,36 +1616,36 @@
1577
1616
  <xsl:apply-templates/>
1578
1617
  </xsl:template>
1579
1618
 
1580
- <!-- no display table/figure from slave documents if common=true or span=true -->
1581
- <xsl:template match="*[@slave]//*[local-name()='table'][@common = 'true']" priority="2"/>
1582
- <xsl:template match="*[@slave]//*[local-name()='table'][@span = 'true']" priority="2"/>
1583
- <xsl:template match="*[@slave]//*[local-name()='figure'][@common = 'true']" priority="2"/>
1584
- <xsl:template match="*[@slave]//*[local-name()='figure'][@span = 'true']" priority="2"/>
1619
+ <!-- no display table/figure from slave documents if @multilingual-rendering="common" or @multilingual-rendering = 'all-columns' -->
1620
+ <xsl:template match="*[@slave]//*[local-name()='table'][@multilingual-rendering= 'common']" priority="2"/>
1621
+ <xsl:template match="*[@slave]//*[local-name()='table'][@multilingual-rendering = 'all-columns']" priority="2"/>
1622
+ <xsl:template match="*[@slave]//*[local-name()='figure'][@multilingual-rendering = 'common']" priority="2"/>
1623
+ <xsl:template match="*[@slave]//*[local-name()='figure'][@multilingual-rendering = 'all-columns']" priority="2"/>
1585
1624
 
1586
- <!-- for table and figure with @common='true' -->
1625
+ <!-- for table and figure with @multilingual-rendering="common" -->
1587
1626
  <!-- display only element from first document -->
1588
- <xsl:template match="*[@first]//*[local-name() = 'cross-align'][@common = 'true']" mode="multi_columns">
1627
+ <xsl:template match="*[@first]//*[local-name() = 'cross-align'][@multilingual-rendering = 'common']" mode="multi_columns">
1589
1628
  <fo:block>
1590
1629
  <xsl:apply-templates/>
1591
1630
  </fo:block>
1592
1631
  </xsl:template>
1593
1632
 
1594
- <!-- for table and figure with @span='true' -->
1633
+ <!-- for table and figure with @multilingual-rendering = 'all-columns' -->
1595
1634
  <!-- display element from first document, then (after) from 2nd one, then 3rd, etc. -->
1596
- <xsl:template match="*[@first]//*[local-name() = 'cross-align'][@span = 'true']" mode="multi_columns">
1635
+ <xsl:template match="*[@first]//*[local-name() = 'cross-align'][@multilingual-rendering = 'all-columns']" mode="multi_columns">
1597
1636
  <xsl:variable name="element-number" select="@element-number"/>
1598
1637
  <fo:block>
1599
1638
  <xsl:apply-templates/>
1600
1639
  <fo:block> </fo:block>
1601
1640
  <xsl:choose>
1602
- <xsl:when test="local-name(*[@span = 'true']) = 'table'">
1641
+ <xsl:when test="local-name(*[@multilingual-rendering = 'all-columns']) = 'table'">
1603
1642
  <xsl:for-each select="xalan:nodeset($docs_slave)/*">
1604
1643
  <xsl:for-each select=".//*[local-name() = 'table' and @element-number=$element-number]">
1605
1644
  <xsl:call-template name="table"/>
1606
1645
  </xsl:for-each>
1607
1646
  </xsl:for-each>
1608
1647
  </xsl:when>
1609
- <xsl:when test="local-name(*[@span = 'true']) = 'figure'">
1648
+ <xsl:when test="local-name(*[@multilingual-rendering = 'all-columns']) = 'figure'">
1610
1649
  <xsl:for-each select="xalan:nodeset($docs_slave)/*">
1611
1650
  <xsl:for-each select=".//*[local-name() = 'figure' and @element-number=$element-number]">
1612
1651
  <xsl:call-template name="figure"/>
@@ -1924,7 +1963,7 @@
1924
1963
  Elements that should be aligned:
1925
1964
  - name of element presents in field align-cross-elements="clause note"
1926
1965
  - marked with attribute name
1927
- - table/figure with attribute common="true" or span="true"
1966
+ - table/figure with attribute @multilingual-rendering = 'common' or @multilingual-rendering = 'all-columns'
1928
1967
  - marked with attribute cross-align
1929
1968
  -->
1930
1969
  <xsl:template name="isCrossAligned">
@@ -1933,10 +1972,10 @@
1933
1972
  <!-- if element`s name is presents in array align_cross_elements -->
1934
1973
  <xsl:when test="contains($align_cross_elements, concat('#',$element_name,'#'))">true</xsl:when>
1935
1974
  <!-- if element has attribute name/bookmark -->
1936
- <xsl:when test="normalize-space(@name) != ''">true</xsl:when>
1937
- <xsl:when test="($element_name = 'table' or $element_name = 'figure') and (@common = 'true' or @span = 'true')">true</xsl:when>
1975
+ <xsl:when test="normalize-space(@name) != '' and @multilingual-rendering = 'name'">true</xsl:when>
1976
+ <xsl:when test="($element_name = 'table' or $element_name = 'figure') and (@multilingual-rendering = 'common' or @multilingual-rendering = 'all-columns')">true</xsl:when>
1938
1977
  <!-- element marked as cross-align -->
1939
- <xsl:when test="@cross-align='true'">true</xsl:when>
1978
+ <xsl:when test="@multilingual-rendering='parallel'">true</xsl:when>
1940
1979
  <xsl:otherwise>false</xsl:otherwise>
1941
1980
  </xsl:choose>
1942
1981
  </xsl:template>
@@ -1946,7 +1985,7 @@
1946
1985
  <xsl:variable name="element-number">
1947
1986
  <xsl:choose>
1948
1987
  <!-- if name set, then use it -->
1949
- <xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
1988
+ <xsl:when test="@name and @multilingual-rendering = 'name'"><xsl:value-of select="@name"/></xsl:when>
1950
1989
  <xsl:otherwise>
1951
1990
  <xsl:for-each select="ancestor-or-self::*[ancestor-or-self::*[local-name() = 'sections' or local-name() = 'annex']]">
1952
1991
  <xsl:value-of select="local-name()"/>
@@ -1977,13 +2016,12 @@
1977
2016
  </xsl:copy>
1978
2017
  </xsl:template>
1979
2018
 
1980
- <!-- enclose elements after table/figure with common=true and span=true in a separate element cross-align -->
1981
- <xsl:template match="*[@common='true' or @span='true']" mode="flatxml_step2" priority="2">
2019
+ <!-- enclose elements after table/figure with @multilingual-rendering = 'common' and @multilingual-rendering = 'all-columns' in a separate element cross-align -->
2020
+ <xsl:template match="*[@multilingual-rendering = 'common' or @multilingual-rendering = 'all-columns']" mode="flatxml_step2" priority="2">
1982
2021
  <xsl:variable name="curr_id" select="generate-id()"/>
1983
2022
  <xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
1984
2023
  <xsl:copy-of select="@element-number"/>
1985
- <xsl:copy-of select="@common"/>
1986
- <xsl:copy-of select="@span"/>
2024
+ <xsl:copy-of select="@multilingual-rendering"/>
1987
2025
  <xsl:copy-of select="."/>
1988
2026
  </xsl:element>
1989
2027
  <xsl:if test="following-sibling::*[(not(@cross-align) or not(@cross-align='true')) and preceding-sibling::*[@cross-align='true'][1][generate-id() = $curr_id]]">
@@ -2009,8 +2047,7 @@
2009
2047
  <xsl:if test="local-name() = 'title'">
2010
2048
  <xsl:copy-of select="@keep-with-next"/>
2011
2049
  </xsl:if>
2012
- <xsl:copy-of select="@common"/>
2013
- <xsl:copy-of select="@span"/>
2050
+ <xsl:copy-of select="@multilingual-rendering"/>
2014
2051
  <xsl:copy-of select="."/>
2015
2052
 
2016
2053
  <!-- copy next elements until next element with cross-align=true -->
@@ -2202,6 +2239,7 @@
2202
2239
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
2203
2240
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
2204
2241
 
2242
+
2205
2243
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2206
2244
 
2207
2245
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -2284,6 +2322,7 @@
2284
2322
 
2285
2323
 
2286
2324
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2325
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2287
2326
 
2288
2327
 
2289
2328
 
@@ -2318,6 +2357,7 @@
2318
2357
 
2319
2358
 
2320
2359
 
2360
+
2321
2361
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2322
2362
 
2323
2363
 
@@ -2539,7 +2579,9 @@
2539
2579
 
2540
2580
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2541
2581
 
2542
-
2582
+
2583
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2584
+
2543
2585
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2544
2586
 
2545
2587
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -2547,7 +2589,25 @@
2547
2589
 
2548
2590
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2549
2591
 
2550
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2592
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2593
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2594
+ </xsl:variable><xsl:attribute-set name="add-style">
2595
+ <xsl:attribute name="color">red</xsl:attribute>
2596
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2597
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2598
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2599
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2600
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2601
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2602
+ <xsl:text>red</xsl:text>
2603
+ </xsl:variable><xsl:attribute-set name="del-style">
2604
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2605
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2606
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2607
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2608
+
2609
+
2610
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2551
2611
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2552
2612
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2553
2613
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2592,16 +2652,17 @@
2592
2652
  <xsl:call-template name="add-zero-spaces-java"/>
2593
2653
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2594
2654
 
2655
+ <xsl:variable name="table-preamble">
2656
+
2657
+
2658
+ </xsl:variable>
2659
+
2595
2660
  <xsl:variable name="table">
2596
2661
 
2597
2662
  <xsl:variable name="simple-table">
2598
2663
  <xsl:call-template name="getSimpleTable"/>
2599
2664
  </xsl:variable>
2600
2665
 
2601
-
2602
-
2603
-
2604
-
2605
2666
  <!-- <xsl:if test="$namespace = 'bipm'">
2606
2667
  <fo:block>&#xA0;</fo:block>
2607
2668
  </xsl:if> -->
@@ -2612,7 +2673,7 @@
2612
2673
 
2613
2674
 
2614
2675
 
2615
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2676
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2616
2677
 
2617
2678
  <!-- <xsl:variable name="cols-count">
2618
2679
  <xsl:choose>
@@ -2631,8 +2692,6 @@
2631
2692
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2632
2693
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2633
2694
 
2634
-
2635
-
2636
2695
  <xsl:variable name="colwidths">
2637
2696
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2638
2697
  <xsl:call-template name="calculate-column-widths">
@@ -2660,6 +2719,7 @@
2660
2719
  </xsl:choose>
2661
2720
  </xsl:variable>
2662
2721
 
2722
+
2663
2723
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2664
2724
 
2665
2725
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -2703,6 +2763,7 @@
2703
2763
 
2704
2764
 
2705
2765
 
2766
+
2706
2767
  <attribute name="margin-left">0mm</attribute>
2707
2768
  <attribute name="margin-right">0mm</attribute>
2708
2769
 
@@ -2795,7 +2856,8 @@
2795
2856
  </fo:block-container>
2796
2857
  </xsl:variable>
2797
2858
 
2798
-
2859
+ <xsl:variable name="isAdded" select="@added"/>
2860
+ <xsl:variable name="isDeleted" select="@deleted"/>
2799
2861
 
2800
2862
  <xsl:choose>
2801
2863
  <xsl:when test="@width">
@@ -2809,7 +2871,14 @@
2809
2871
  <fo:table-body>
2810
2872
  <fo:table-row>
2811
2873
  <fo:table-cell column-number="2">
2812
- <fo:block><xsl:copy-of select="$table"/></fo:block>
2874
+ <xsl:copy-of select="$table-preamble"/>
2875
+ <fo:block>
2876
+ <xsl:call-template name="setTrackChangesStyles">
2877
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2878
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2879
+ </xsl:call-template>
2880
+ <xsl:copy-of select="$table"/>
2881
+ </fo:block>
2813
2882
  </fo:table-cell>
2814
2883
  </fo:table-row>
2815
2884
  </fo:table-body>
@@ -2820,7 +2889,22 @@
2820
2889
 
2821
2890
  </xsl:when>
2822
2891
  <xsl:otherwise>
2823
- <xsl:copy-of select="$table"/>
2892
+ <xsl:choose>
2893
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
2894
+ <xsl:copy-of select="$table-preamble"/>
2895
+ <fo:block>
2896
+ <xsl:call-template name="setTrackChangesStyles">
2897
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2898
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2899
+ </xsl:call-template>
2900
+ <xsl:copy-of select="$table"/>
2901
+ </fo:block>
2902
+ </xsl:when>
2903
+ <xsl:otherwise>
2904
+ <xsl:copy-of select="$table-preamble"/>
2905
+ <xsl:copy-of select="$table"/>
2906
+ </xsl:otherwise>
2907
+ </xsl:choose>
2824
2908
  </xsl:otherwise>
2825
2909
  </xsl:choose>
2826
2910
 
@@ -2883,7 +2967,7 @@
2883
2967
  </xsl:for-each>
2884
2968
  </xsl:when>
2885
2969
  <xsl:otherwise>
2886
- <xsl:for-each select="xalan:nodeset($table)//tr">
2970
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2887
2971
  <xsl:variable name="td_text">
2888
2972
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2889
2973
 
@@ -2953,7 +3037,15 @@
2953
3037
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2954
3038
  <xsl:value-of select="@target"/>
2955
3039
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2956
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3040
+ <xsl:variable name="mathml">
3041
+ <xsl:for-each select="*">
3042
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3043
+ <xsl:copy-of select="."/>
3044
+ </xsl:if>
3045
+ </xsl:for-each>
3046
+ </xsl:variable>
3047
+
3048
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2957
3049
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2958
3050
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2959
3051
  <xsl:param name="cols-count"/>
@@ -3273,7 +3365,8 @@
3273
3365
  <xsl:attribute name="text-align">
3274
3366
  <xsl:choose>
3275
3367
  <xsl:when test="@align">
3276
- <xsl:value-of select="@align"/>
3368
+ <xsl:call-template name="setAlignment"/>
3369
+ <!-- <xsl:value-of select="@align"/> -->
3277
3370
  </xsl:when>
3278
3371
  <xsl:otherwise>center</xsl:otherwise>
3279
3372
  </xsl:choose>
@@ -3291,6 +3384,9 @@
3291
3384
 
3292
3385
 
3293
3386
 
3387
+ <xsl:if test="$lang = 'ar'">
3388
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3389
+ </xsl:if>
3294
3390
  <xsl:if test="@colspan">
3295
3391
  <xsl:attribute name="number-columns-spanned">
3296
3392
  <xsl:value-of select="@colspan"/>
@@ -3322,15 +3418,24 @@
3322
3418
  <xsl:attribute name="text-align">
3323
3419
  <xsl:choose>
3324
3420
  <xsl:when test="@align">
3325
- <xsl:value-of select="@align"/>
3421
+ <xsl:call-template name="setAlignment"/>
3422
+ <!-- <xsl:value-of select="@align"/> -->
3326
3423
  </xsl:when>
3327
3424
  <xsl:otherwise>left</xsl:otherwise>
3328
3425
  </xsl:choose>
3329
3426
  </xsl:attribute>
3427
+ <xsl:if test="$lang = 'ar'">
3428
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3429
+ </xsl:if>
3330
3430
  <!-- and ancestor::*[local-name() = 'thead'] -->
3331
3431
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3332
3432
 
3333
3433
 
3434
+ <xsl:if test="count(*) = 1 and (local-name(*[1]) = 'stem' or local-name(*[1]) = 'figure')">
3435
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
3436
+ </xsl:if>
3437
+
3438
+
3334
3439
 
3335
3440
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3336
3441
  <xsl:attribute name="border">solid black 0</xsl:attribute>
@@ -3344,6 +3449,9 @@
3344
3449
 
3345
3450
 
3346
3451
 
3452
+ <xsl:if test=".//*[local-name() = 'table']">
3453
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3454
+ </xsl:if>
3347
3455
  <xsl:if test="@colspan">
3348
3456
  <xsl:attribute name="number-columns-spanned">
3349
3457
  <xsl:value-of select="@colspan"/>
@@ -3477,13 +3585,13 @@
3477
3585
  </xsl:choose>
3478
3586
  </xsl:variable>
3479
3587
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3480
- <xsl:element name="{$ns}:table">
3588
+ <!-- <xsl:element name="{$ns}:table"> -->
3481
3589
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3482
3590
  <tbody>
3483
3591
  <xsl:apply-templates mode="dl"/>
3484
3592
  </tbody>
3485
3593
  </xsl:for-each>
3486
- </xsl:element>
3594
+ <!-- </xsl:element> -->
3487
3595
  </xsl:variable>
3488
3596
 
3489
3597
  <xsl:call-template name="calculate-column-widths">
@@ -3580,6 +3688,8 @@
3580
3688
  <xsl:apply-templates/>
3581
3689
  </fo:inline>
3582
3690
  </xsl:template><xsl:template match="*[local-name()='dl']">
3691
+ <xsl:variable name="isAdded" select="@added"/>
3692
+ <xsl:variable name="isDeleted" select="@deleted"/>
3583
3693
  <fo:block-container>
3584
3694
 
3585
3695
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3596,6 +3706,12 @@
3596
3706
  </xsl:attribute>
3597
3707
 
3598
3708
  </xsl:if>
3709
+
3710
+ <xsl:call-template name="setTrackChangesStyles">
3711
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3712
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3713
+ </xsl:call-template>
3714
+
3599
3715
  <fo:block-container>
3600
3716
 
3601
3717
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3717,11 +3833,11 @@
3717
3833
  </xsl:choose>
3718
3834
  </xsl:variable>
3719
3835
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3720
- <xsl:element name="{$ns}:table">
3836
+ <!-- <xsl:element name="{$ns}:table"> -->
3721
3837
  <tbody>
3722
3838
  <xsl:apply-templates mode="dl"/>
3723
3839
  </tbody>
3724
- </xsl:element>
3840
+ <!-- </xsl:element> -->
3725
3841
  </xsl:variable>
3726
3842
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3727
3843
  <xsl:variable name="colwidths">
@@ -3990,8 +4106,78 @@
3990
4106
  <fo:inline text-decoration="underline">
3991
4107
  <xsl:apply-templates/>
3992
4108
  </fo:inline>
4109
+ </xsl:template><xsl:template match="*[local-name()='add']">
4110
+ <xsl:choose>
4111
+ <xsl:when test="@amendment">
4112
+ <fo:inline>
4113
+ <xsl:call-template name="insertTag">
4114
+ <xsl:with-param name="kind">A</xsl:with-param>
4115
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4116
+ </xsl:call-template>
4117
+ <xsl:apply-templates/>
4118
+ <xsl:call-template name="insertTag">
4119
+ <xsl:with-param name="type">closing</xsl:with-param>
4120
+ <xsl:with-param name="kind">A</xsl:with-param>
4121
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4122
+ </xsl:call-template>
4123
+ </fo:inline>
4124
+ </xsl:when>
4125
+ <xsl:when test="@corrigenda">
4126
+ <fo:inline>
4127
+ <xsl:call-template name="insertTag">
4128
+ <xsl:with-param name="kind">C</xsl:with-param>
4129
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4130
+ </xsl:call-template>
4131
+ <xsl:apply-templates/>
4132
+ <xsl:call-template name="insertTag">
4133
+ <xsl:with-param name="type">closing</xsl:with-param>
4134
+ <xsl:with-param name="kind">C</xsl:with-param>
4135
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4136
+ </xsl:call-template>
4137
+ </fo:inline>
4138
+ </xsl:when>
4139
+ <xsl:otherwise>
4140
+ <fo:inline xsl:use-attribute-sets="add-style">
4141
+ <xsl:apply-templates/>
4142
+ </fo:inline>
4143
+ </xsl:otherwise>
4144
+ </xsl:choose>
4145
+
4146
+ </xsl:template><xsl:template name="insertTag">
4147
+ <xsl:param name="type"/>
4148
+ <xsl:param name="kind"/>
4149
+ <xsl:param name="value"/>
4150
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4151
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4152
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4153
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4154
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4155
+ <xsl:attribute name="height">5mm</xsl:attribute>
4156
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4157
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4158
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4159
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4160
+ <g>
4161
+ <xsl:if test="$type = 'closing'">
4162
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4163
+ </xsl:if>
4164
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4165
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4166
+ </g>
4167
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4168
+ <xsl:if test="$type = 'closing'">
4169
+ <xsl:attribute name="x">25</xsl:attribute>
4170
+ </xsl:if>
4171
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4172
+ </text>
4173
+ </svg>
4174
+ </fo:instream-foreign-object>
3993
4175
  </xsl:template><xsl:template match="*[local-name()='del']">
3994
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4176
+ <fo:inline xsl:use-attribute-sets="del-style">
4177
+ <xsl:apply-templates/>
4178
+ </fo:inline>
4179
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4180
+ <fo:inline background-color="yellow">
3995
4181
  <xsl:apply-templates/>
3996
4182
  </fo:inline>
3997
4183
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4328,12 +4514,23 @@
4328
4514
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4329
4515
  <xsl:value-of select="substring($str, 2)"/>
4330
4516
  </xsl:template><xsl:template match="mathml:math">
4331
- <fo:inline font-family="STIX Two Math"> <!-- -->
4517
+ <xsl:variable name="isAdded" select="@added"/>
4518
+ <xsl:variable name="isDeleted" select="@deleted"/>
4519
+
4520
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4521
+
4522
+
4523
+ <xsl:call-template name="setTrackChangesStyles">
4524
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4525
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4526
+ </xsl:call-template>
4332
4527
 
4333
4528
  <xsl:variable name="mathml">
4334
4529
  <xsl:apply-templates select="." mode="mathml"/>
4335
4530
  </xsl:variable>
4336
4531
  <fo:instream-foreign-object fox:alt-text="Math">
4532
+
4533
+
4337
4534
  <!-- <xsl:copy-of select="."/> -->
4338
4535
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4339
4536
  </fo:instream-foreign-object>
@@ -4352,7 +4549,7 @@
4352
4549
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4353
4550
  </xsl:copy>
4354
4551
  <mathml:mspace width="0.5ex"/>
4355
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4552
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4356
4553
  <xsl:variable name="target">
4357
4554
  <xsl:choose>
4358
4555
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4386,8 +4583,6 @@
4386
4583
  </xsl:otherwise>
4387
4584
  </xsl:choose>
4388
4585
  </fo:inline>
4389
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4390
- <fo:inline id="{@id}"/>
4391
4586
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4392
4587
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4393
4588
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4581,8 +4776,15 @@
4581
4776
  </fo:inline>
4582
4777
  </xsl:if>
4583
4778
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4779
+ <xsl:variable name="isAdded" select="@added"/>
4780
+ <xsl:variable name="isDeleted" select="@deleted"/>
4584
4781
  <fo:block-container id="{@id}">
4585
4782
 
4783
+ <xsl:call-template name="setTrackChangesStyles">
4784
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4785
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4786
+ </xsl:call-template>
4787
+
4586
4788
  <fo:block>
4587
4789
  <xsl:apply-templates/>
4588
4790
  </fo:block>
@@ -4596,27 +4798,113 @@
4596
4798
  <fo:block id="{@id}">
4597
4799
  <xsl:apply-templates/>
4598
4800
  </fo:block>
4801
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4599
4802
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4600
4803
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4601
4804
  <xsl:apply-templates/>
4602
4805
  </fo:block>
4603
4806
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4604
- <fo:block xsl:use-attribute-sets="image-style">
4605
-
4606
-
4607
- <xsl:variable name="src">
4608
- <xsl:choose>
4609
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4610
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4611
- </xsl:when>
4612
- <xsl:otherwise>
4613
- <xsl:value-of select="@src"/>
4614
- </xsl:otherwise>
4615
- </xsl:choose>
4616
- </xsl:variable>
4617
-
4618
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4619
- </fo:block>
4807
+ <xsl:variable name="isAdded" select="../@added"/>
4808
+ <xsl:variable name="isDeleted" select="../@deleted"/>
4809
+ <xsl:choose>
4810
+ <xsl:when test="ancestor::*[local-name() = 'title']">
4811
+ <fo:inline padding-left="1mm" padding-right="1mm">
4812
+ <xsl:variable name="src">
4813
+ <xsl:call-template name="image_src"/>
4814
+ </xsl:variable>
4815
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
4816
+ </fo:inline>
4817
+ </xsl:when>
4818
+ <xsl:otherwise>
4819
+ <fo:block xsl:use-attribute-sets="image-style">
4820
+
4821
+ <xsl:variable name="src">
4822
+ <xsl:call-template name="image_src"/>
4823
+ </xsl:variable>
4824
+
4825
+ <xsl:choose>
4826
+ <xsl:when test="$isDeleted = 'true'">
4827
+ <!-- enclose in svg -->
4828
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
4829
+ <xsl:attribute name="width">100%</xsl:attribute>
4830
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4831
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4832
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4833
+
4834
+
4835
+ <xsl:apply-templates select="." mode="cross_image"/>
4836
+
4837
+ </fo:instream-foreign-object>
4838
+ </xsl:when>
4839
+ <xsl:otherwise>
4840
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4841
+ </xsl:otherwise>
4842
+ </xsl:choose>
4843
+
4844
+ </fo:block>
4845
+ </xsl:otherwise>
4846
+ </xsl:choose>
4847
+ </xsl:template><xsl:template name="image_src">
4848
+ <xsl:choose>
4849
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4850
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4851
+ </xsl:when>
4852
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4853
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4854
+ </xsl:when>
4855
+ <xsl:otherwise>
4856
+ <xsl:value-of select="@src"/>
4857
+ </xsl:otherwise>
4858
+ </xsl:choose>
4859
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
4860
+ <xsl:choose>
4861
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4862
+ <xsl:variable name="src">
4863
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4864
+ </xsl:variable>
4865
+ <xsl:variable name="width" select="document($src)/@width"/>
4866
+ <xsl:variable name="height" select="document($src)/@height"/>
4867
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4868
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4869
+ </svg>
4870
+ </xsl:when>
4871
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4872
+ <xsl:variable name="src">
4873
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4874
+ </xsl:variable>
4875
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
4876
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
4877
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4878
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4879
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4880
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4881
+ </svg>
4882
+ </xsl:when>
4883
+ <xsl:otherwise>
4884
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
4885
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
4886
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
4887
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
4888
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
4889
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4890
+ <!-- width=<xsl:value-of select="$width"/> -->
4891
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4892
+ <!-- height=<xsl:value-of select="$height"/> -->
4893
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4894
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
4895
+ <xsl:call-template name="svg_cross">
4896
+ <xsl:with-param name="width" select="$width"/>
4897
+ <xsl:with-param name="height" select="$height"/>
4898
+ </xsl:call-template>
4899
+ </svg>
4900
+ </xsl:otherwise>
4901
+ </xsl:choose>
4902
+
4903
+ </xsl:template><xsl:template name="svg_cross">
4904
+ <xsl:param name="width"/>
4905
+ <xsl:param name="height"/>
4906
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4907
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4620
4908
  </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">
4621
4909
  <xsl:apply-templates mode="contents"/>
4622
4910
  <xsl:text> </xsl:text>
@@ -5135,8 +5423,8 @@
5135
5423
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5136
5424
 
5137
5425
  <xsl:variable name="element">
5138
- block
5139
-
5426
+
5427
+ inline
5140
5428
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5141
5429
  </xsl:variable>
5142
5430
 
@@ -5159,6 +5447,7 @@
5159
5447
  <xsl:variable name="element">
5160
5448
 
5161
5449
  inline
5450
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5162
5451
  </xsl:variable>
5163
5452
  <xsl:choose>
5164
5453
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5166,7 +5455,7 @@
5166
5455
  <xsl:apply-templates/>
5167
5456
  </fo:inline>
5168
5457
  </xsl:when>
5169
- <xsl:when test="normalize-space($element) = 'block'">
5458
+ <xsl:when test="contains(normalize-space($element), 'block')">
5170
5459
  <fo:block xsl:use-attribute-sets="example-name-style">
5171
5460
  <xsl:apply-templates/>
5172
5461
  </fo:block>
@@ -5179,9 +5468,15 @@
5179
5468
  </xsl:choose>
5180
5469
 
5181
5470
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5182
-
5471
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5183
5472
  <xsl:variable name="element">
5184
- block
5473
+
5474
+
5475
+ <xsl:choose>
5476
+ <xsl:when test="$num = 1">inline</xsl:when>
5477
+ <xsl:otherwise>block</xsl:otherwise>
5478
+ </xsl:choose>
5479
+
5185
5480
 
5186
5481
  </xsl:variable>
5187
5482
  <xsl:choose>
@@ -5296,29 +5591,47 @@
5296
5591
  <xsl:text>— </xsl:text>
5297
5592
  <xsl:apply-templates/>
5298
5593
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5299
- <fo:inline xsl:use-attribute-sets="eref-style">
5300
- <xsl:if test="@type = 'footnote'">
5301
-
5302
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5303
- <xsl:attribute name="font-size">80%</xsl:attribute>
5304
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5305
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5306
-
5307
-
5308
- </xsl:if>
5309
-
5310
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5311
-
5312
- <xsl:if test="@type = 'inline'">
5313
-
5314
-
5315
-
5316
- </xsl:if>
5317
-
5318
-
5319
- <xsl:apply-templates/>
5320
- </fo:basic-link>
5321
- </fo:inline>
5594
+
5595
+ <xsl:variable name="bibitemid">
5596
+ <xsl:choose>
5597
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5598
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5599
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5600
+ </xsl:choose>
5601
+ </xsl:variable>
5602
+
5603
+ <xsl:choose>
5604
+ <xsl:when test="normalize-space($bibitemid) != ''">
5605
+ <fo:inline xsl:use-attribute-sets="eref-style">
5606
+ <xsl:if test="@type = 'footnote'">
5607
+
5608
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5609
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5610
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5611
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5612
+
5613
+
5614
+ </xsl:if>
5615
+
5616
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5617
+ <xsl:if test="normalize-space(@citeas) = ''">
5618
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5619
+ </xsl:if>
5620
+ <xsl:if test="@type = 'inline'">
5621
+
5622
+
5623
+
5624
+ </xsl:if>
5625
+
5626
+ <xsl:apply-templates/>
5627
+ </fo:basic-link>
5628
+
5629
+ </fo:inline>
5630
+ </xsl:when>
5631
+ <xsl:otherwise>
5632
+ <fo:inline><xsl:apply-templates/></fo:inline>
5633
+ </xsl:otherwise>
5634
+ </xsl:choose>
5322
5635
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5323
5636
  <!-- zero-space char -->
5324
5637
  <xsl:variable name="depth">
@@ -5376,7 +5689,8 @@
5376
5689
  </fo:inline>
5377
5690
  </xsl:when>
5378
5691
  <xsl:otherwise>
5379
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
5692
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
5693
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5380
5694
  </xsl:otherwise>
5381
5695
  </xsl:choose>
5382
5696
 
@@ -5452,6 +5766,10 @@
5452
5766
  <xsl:call-template name="setId"/>
5453
5767
 
5454
5768
 
5769
+ <xsl:if test="@inline-header='true'">
5770
+ <xsl:attribute name="text-align">justify</xsl:attribute>
5771
+ </xsl:if>
5772
+
5455
5773
  <xsl:apply-templates/>
5456
5774
  </fo:block>
5457
5775
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -5501,6 +5819,153 @@
5501
5819
  </fo:block>
5502
5820
  </xsl:otherwise>
5503
5821
  </xsl:choose>
5822
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5823
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5824
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5825
+ </xsl:for-each>
5826
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5827
+ <xsl:copy>
5828
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5829
+ </xsl:copy>
5830
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5831
+ <xsl:variable name="id">
5832
+ <xsl:call-template name="generateIndexXrefId"/>
5833
+ </xsl:variable>
5834
+ <xsl:copy> <!-- add id to xref -->
5835
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5836
+ <xsl:attribute name="id">
5837
+ <xsl:value-of select="$id"/>
5838
+ </xsl:attribute>
5839
+ <xsl:apply-templates mode="index_add_id"/>
5840
+ </xsl:copy>
5841
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5842
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5843
+ <xsl:if test="@to">
5844
+ <xsl:value-of select="$dash"/>
5845
+ <xsl:copy>
5846
+ <xsl:copy-of select="@*"/>
5847
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5848
+ <xsl:attribute name="id">
5849
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5850
+ </xsl:attribute>
5851
+ <xsl:apply-templates mode="index_add_id"/>
5852
+ </xsl:copy>
5853
+ </xsl:if>
5854
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
5855
+ <xsl:copy>
5856
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
5857
+ </xsl:copy>
5858
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
5859
+ <xsl:copy>
5860
+ <xsl:apply-templates select="@*" mode="index_update"/>
5861
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
5862
+ </xsl:copy>
5863
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
5864
+ <xsl:param name="element"/>
5865
+ <xsl:param name="remove" select="'false'"/>
5866
+ <xsl:param name="target"/>
5867
+ <!-- <node></node> -->
5868
+ <xsl:choose>
5869
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5870
+ <!-- skip text (i.e. remove it) and process next element -->
5871
+ <!-- [removed_<xsl:value-of select="."/>] -->
5872
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5873
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
5874
+ </xsl:apply-templates>
5875
+ </xsl:when>
5876
+ <xsl:when test="self::text()">
5877
+ <xsl:value-of select="."/>
5878
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5879
+ </xsl:when>
5880
+ <xsl:when test="self::* and local-name(.) = 'xref'">
5881
+ <xsl:variable name="id" select="@id"/>
5882
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
5883
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
5884
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
5885
+
5886
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
5887
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
5888
+
5889
+ <xsl:choose>
5890
+ <!-- 2nd pass -->
5891
+ <!-- if page is equal to page for next and page is not the end of range -->
5892
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
5893
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
5894
+ <!-- [removed_xref] -->
5895
+
5896
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5897
+ <xsl:with-param name="remove">true</xsl:with-param>
5898
+ <xsl:with-param name="target">
5899
+ <xsl:choose>
5900
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
5901
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
5902
+ </xsl:choose>
5903
+ </xsl:with-param>
5904
+ </xsl:apply-templates>
5905
+ </xsl:when>
5906
+
5907
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
5908
+ <!-- remove xref -->
5909
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5910
+ <xsl:with-param name="remove">true</xsl:with-param>
5911
+ </xsl:apply-templates>
5912
+ </xsl:when>
5913
+
5914
+ <xsl:otherwise>
5915
+ <xsl:apply-templates select="." mode="xref_copy">
5916
+ <xsl:with-param name="target" select="$target"/>
5917
+ </xsl:apply-templates>
5918
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5919
+ </xsl:otherwise>
5920
+ </xsl:choose>
5921
+ </xsl:when>
5922
+ <xsl:when test="self::* and local-name(.) = 'ul'">
5923
+ <!-- ul -->
5924
+ <xsl:apply-templates select="." mode="index_update"/>
5925
+ </xsl:when>
5926
+ <xsl:otherwise>
5927
+ <xsl:apply-templates select="." mode="xref_copy">
5928
+ <xsl:with-param name="target" select="$target"/>
5929
+ </xsl:apply-templates>
5930
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5931
+ </xsl:otherwise>
5932
+ </xsl:choose>
5933
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
5934
+ <xsl:param name="target"/>
5935
+ <xsl:copy>
5936
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
5937
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
5938
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
5939
+ </xsl:if>
5940
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
5941
+ </xsl:copy>
5942
+ </xsl:template><xsl:template name="generateIndexXrefId">
5943
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5944
+
5945
+ <xsl:variable name="docid">
5946
+ <xsl:call-template name="getDocumentId"/>
5947
+ </xsl:variable>
5948
+ <xsl:variable name="item_number">
5949
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
5950
+ </xsl:variable>
5951
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5952
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
5953
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5954
+ <xsl:apply-templates/>
5955
+ <fo:block>
5956
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
5957
+ <fo:block> </fo:block>
5958
+ </xsl:if>
5959
+ </fo:block>
5960
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5961
+ <xsl:apply-templates/>
5962
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5963
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5964
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5965
+ <xsl:apply-templates/>
5966
+ </fo:block>
5967
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5968
+ <fo:inline id="{@id}" font-size="1pt"/>
5504
5969
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5505
5970
  <!-- <row>
5506
5971
  <date>05-07-2013</date>
@@ -5598,6 +6063,70 @@
5598
6063
  <xsl:value-of select="substring(.,1,1)"/>
5599
6064
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5600
6065
  <fo:inline><xsl:apply-templates/></fo:inline>
6066
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6067
+ <fo:block>
6068
+ <xsl:apply-templates/>
6069
+ </fo:block>
6070
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6071
+ <fo:inline><xsl:apply-templates/></fo:inline>
6072
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6073
+ <fo:inline>
6074
+ <xsl:call-template name="text_input"/>
6075
+ </fo:inline>
6076
+ </xsl:template><xsl:template name="text_input">
6077
+ <xsl:variable name="count">
6078
+ <xsl:choose>
6079
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6080
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6081
+ <xsl:otherwise>10</xsl:otherwise>
6082
+ </xsl:choose>
6083
+ </xsl:variable>
6084
+ <xsl:call-template name="repeat">
6085
+ <xsl:with-param name="char" select="'_'"/>
6086
+ <xsl:with-param name="count" select="$count"/>
6087
+ </xsl:call-template>
6088
+ <xsl:text> </xsl:text>
6089
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6090
+ <xsl:variable name="caption">
6091
+ <xsl:choose>
6092
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6093
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6094
+ </xsl:choose>
6095
+ </xsl:variable>
6096
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6097
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6098
+ <fo:inline padding-right="1mm">
6099
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6100
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6101
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6102
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6103
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6104
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6105
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6106
+ </svg>
6107
+ </fo:instream-foreign-object>
6108
+ </fo:inline>
6109
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6110
+ <fo:inline padding-right="1mm">
6111
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6112
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6113
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6114
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6115
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6116
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6117
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6118
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6119
+ </svg>
6120
+ </fo:instream-foreign-object>
6121
+ </fo:inline>
6122
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6123
+ <fo:inline>
6124
+ <xsl:call-template name="text_input"/>
6125
+ </fo:inline>
6126
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6127
+ <fo:block-container border="1pt solid black" width="50%">
6128
+ <fo:block> </fo:block>
6129
+ </fo:block-container>
5601
6130
  </xsl:template><xsl:template name="convertDate">
5602
6131
  <xsl:param name="date"/>
5603
6132
  <xsl:param name="format" select="'short'"/>
@@ -5717,67 +6246,65 @@
5717
6246
  <xsl:variable name="lang">
5718
6247
  <xsl:call-template name="getLang"/>
5719
6248
  </xsl:variable>
5720
- <fo:declarations>
5721
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5722
- <pdf:dictionary type="normal" key="ViewerPreferences">
5723
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5724
- </pdf:dictionary>
5725
- </pdf:catalog>
5726
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5727
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5728
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5729
- <!-- Dublin Core properties go here -->
5730
- <dc:title>
5731
- <xsl:variable name="title">
5732
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5733
-
5734
-
5735
-
5736
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'part']"/>
5737
-
5738
-
5739
-
5740
-
5741
- </xsl:for-each>
5742
- </xsl:variable>
5743
- <xsl:choose>
5744
- <xsl:when test="normalize-space($title) != ''">
5745
- <xsl:value-of select="$title"/>
5746
- </xsl:when>
5747
- <xsl:otherwise>
5748
- <xsl:text> </xsl:text>
5749
- </xsl:otherwise>
5750
- </xsl:choose>
5751
- </dc:title>
5752
- <dc:creator>
6249
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6250
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6251
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6252
+ </pdf:dictionary>
6253
+ </pdf:catalog>
6254
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6255
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6256
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6257
+ <!-- Dublin Core properties go here -->
6258
+ <dc:title>
6259
+ <xsl:variable name="title">
5753
6260
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5754
6261
 
5755
6262
 
5756
- <xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
5757
-
5758
6263
 
5759
- </xsl:for-each>
5760
- </dc:creator>
5761
- <dc:description>
5762
- <xsl:variable name="abstract">
6264
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'part']"/>
5763
6265
 
5764
6266
 
5765
- <xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5766
6267
 
5767
- </xsl:variable>
5768
- <xsl:value-of select="normalize-space($abstract)"/>
5769
- </dc:description>
5770
- <pdf:Keywords>
5771
- <xsl:call-template name="insertKeywords"/>
5772
- </pdf:Keywords>
5773
- </rdf:Description>
5774
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5775
- <!-- XMP properties go here -->
5776
- <xmp:CreatorTool/>
5777
- </rdf:Description>
5778
- </rdf:RDF>
5779
- </x:xmpmeta>
5780
- </fo:declarations>
6268
+
6269
+ </xsl:for-each>
6270
+ </xsl:variable>
6271
+ <xsl:choose>
6272
+ <xsl:when test="normalize-space($title) != ''">
6273
+ <xsl:value-of select="$title"/>
6274
+ </xsl:when>
6275
+ <xsl:otherwise>
6276
+ <xsl:text> </xsl:text>
6277
+ </xsl:otherwise>
6278
+ </xsl:choose>
6279
+ </dc:title>
6280
+ <dc:creator>
6281
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6282
+
6283
+
6284
+ <xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
6285
+
6286
+
6287
+ </xsl:for-each>
6288
+ </dc:creator>
6289
+ <dc:description>
6290
+ <xsl:variable name="abstract">
6291
+
6292
+
6293
+ <xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
6294
+
6295
+ </xsl:variable>
6296
+ <xsl:value-of select="normalize-space($abstract)"/>
6297
+ </dc:description>
6298
+ <pdf:Keywords>
6299
+ <xsl:call-template name="insertKeywords"/>
6300
+ </pdf:Keywords>
6301
+ </rdf:Description>
6302
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6303
+ <!-- XMP properties go here -->
6304
+ <xmp:CreatorTool/>
6305
+ </rdf:Description>
6306
+ </rdf:RDF>
6307
+ </x:xmpmeta>
5781
6308
  </xsl:template><xsl:template name="getId">
5782
6309
  <xsl:choose>
5783
6310
  <xsl:when test="../@id">
@@ -5941,4 +6468,44 @@
5941
6468
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5942
6469
  </xsl:choose>
5943
6470
 
6471
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6472
+ <xsl:param name="isAdded"/>
6473
+ <xsl:param name="isDeleted"/>
6474
+ <xsl:choose>
6475
+ <xsl:when test="local-name() = 'math'">
6476
+ <xsl:if test="$isAdded = 'true'">
6477
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6478
+ </xsl:if>
6479
+ <xsl:if test="$isDeleted = 'true'">
6480
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6481
+ </xsl:if>
6482
+ </xsl:when>
6483
+ <xsl:otherwise>
6484
+ <xsl:if test="$isAdded = 'true'">
6485
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6486
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6487
+ </xsl:if>
6488
+ <xsl:if test="$isDeleted = 'true'">
6489
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6490
+ <xsl:if test="local-name() = 'table'">
6491
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6492
+ </xsl:if>
6493
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6494
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6495
+ </xsl:if>
6496
+ </xsl:otherwise>
6497
+ </xsl:choose>
6498
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6499
+ <xsl:if test="$lang = 'ar'">
6500
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6501
+ </xsl:if>
6502
+ </xsl:template><xsl:template name="setAlignment">
6503
+ <xsl:param name="align" select="normalize-space(@align)"/>
6504
+ <xsl:choose>
6505
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6506
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6507
+ <xsl:when test="$align != ''">
6508
+ <xsl:value-of select="$align"/>
6509
+ </xsl:when>
6510
+ </xsl:choose>
5944
6511
  </xsl:template></xsl:stylesheet>