metanorma-bipm 1.0.4 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
 
5
5
  <div class="document-type-band" id="{{ doctype | downcase | replace: ' ', '-' }}-band">
6
- <p class="document-type">BIPM {{ doctype_display }}</p>
6
+ <p class="document-type">{{org_abbrev}} {{ doctype_display }}</p>
7
7
  </div>
8
8
 
9
9
 
@@ -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 %}
@@ -82,7 +84,7 @@
82
84
 
83
85
  <div class="WordSection11">
84
86
  <div class="coverpage-stage-block" >
85
- <span class="coverpage-stage" id="{{ doctype | replace: ' ', '-' | downcase }}">BIPM {{ doctype_display }}</span>
87
+ <span class="coverpage-stage" id="{{ doctype | replace: ' ', '-' | downcase }}">{{org_abbrev}} {{ doctype_display }}</span>
86
88
  </div>
87
89
 
88
90
  <div class="coverpage-stage-block" >
@@ -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
 
@@ -4,7 +4,16 @@ see: see
4
4
  see_also: see also
5
5
  clause: Chapter
6
6
  subclause: Section
7
+ clause_jcgm: Clause
8
+ subclause_jcgm: Clause
7
9
  formula: Equation
8
10
  inequality: Inequality
9
11
  bibliography: References
10
12
  index: Index
13
+ norm_with_refs_pref:
14
+ The following referenced documents are indispensable for the application of this document.
15
+ For dated references, only the edition cited applies.
16
+ For undated references, the latest edition of the referenced
17
+ document (including any amendments) applies.
18
+ all_rights_reserved: All rights reserved
19
+ table_of_contents: Contents
@@ -4,6 +4,8 @@ see: voir
4
4
  see_also: voir aussi
5
5
  clause: chapître
6
6
  subclause: section
7
+ clause_jcgm: Article
8
+ subclause_jcgm: Article
7
9
  formula: équation
8
10
  inequality: inégalité
9
11
  bibliography: Références
@@ -34,3 +36,7 @@ stage_dict:
34
36
  draft-development: projet-de-développement
35
37
  in-force: en-vigeur
36
38
  retired: retiré
39
+ norm_with_refs_pref:
40
+ 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).
41
+ all_rights_reserved: Tous droits réservés
42
+ table_of_contents: Table des matières
@@ -4,27 +4,33 @@ 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
- return unless docxml.at(ns("//index"))
13
- i = docxml.root.add_child "<clause type='index' #{add_id}><title>#{@i18n.index}</title></clause>"
14
- index = sort_indexterms(docxml.xpath(ns("//index")), docxml.xpath(ns("//index-xref[@also = 'false']")),
12
+ unless docxml.at(ns("//index"))
13
+ docxml.xpath(ns("//indexsect")).each { |i| i.remove }
14
+ return
15
+ end
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")),
19
+ docxml.xpath(ns("//index-xref[@also = 'false']")),
15
20
  docxml.xpath(ns("//index-xref[@also = 'true']")))
16
21
  index1(docxml, i, index)
17
22
  end
18
23
 
19
24
  def index1(docxml, i, index)
20
25
  index.keys.sort.each do |k|
21
- c = i.first.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
26
+ c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
22
27
  words = index[k].keys.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
23
28
  words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
24
29
  c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
25
30
  end
26
31
  end
27
- @xrefs.bookmark_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
32
+ docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
33
+ @xrefs.bookmark_anchor_names(docxml)
28
34
  end
29
35
 
30
36
  def sortable(s)
@@ -36,8 +42,11 @@ module IsoDoc
36
42
  end
37
43
 
38
44
  def index_entries(words, index, primary)
39
- ret = index_entries_head(words[primary], index.dig(words[primary], nil, nil), index_entries_opt)
40
- words2 = index[words[primary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
45
+ ret = index_entries_head(words[primary],
46
+ index.dig(words[primary], nil, nil),
47
+ index_entries_opt)
48
+ words2 = index[words[primary]]&.keys&.reject { |k| k.nil? }
49
+ &.each_with_object({}) { |w, v| v[w.downcase] = w }
41
50
  unless words2.empty?
42
51
  ret += "<ul>"
43
52
  words2.keys.localize(@lang.to_sym).sort.to_a.each do |w|
@@ -49,8 +58,11 @@ module IsoDoc
49
58
  end
50
59
 
51
60
  def index_entries2(words, index, secondary)
52
- ret = index_entries_head(words[secondary], index.dig(words[secondary], nil), index_entries_opt)
53
- words3 = index[words[secondary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
61
+ ret = index_entries_head(words[secondary],
62
+ index.dig(words[secondary], nil),
63
+ index_entries_opt)
64
+ words3 = index[words[secondary]]&.keys&.reject { |k| k.nil? }
65
+ &.each_with_object({}) { |w, v| v[w.downcase] = w }
54
66
  unless words3.empty?
55
67
  ret += "<ul>"
56
68
  words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
@@ -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'">
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%">
@@ -1137,6 +1286,7 @@
1137
1286
  <!-- skip 0 section without subsections -->
1138
1287
  <xsl:when test="@level = 2"><xsl:value-of select="$margin-left * 1.6"/>mm</xsl:when>
1139
1288
  <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.8"/>mm</xsl:when>
1289
+ <xsl:when test="@level = 1 and @type = 'annex' and @section != ''"><xsl:value-of select="$margin-left + string-length(@section) * 1.7"/>mm</xsl:when>
1140
1290
  <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1141
1291
  <xsl:otherwise>0mm</xsl:otherwise>
1142
1292
  </xsl:choose>
@@ -1227,6 +1377,7 @@
1227
1377
  <xsl:variable name="font-size">
1228
1378
  <xsl:choose>
1229
1379
  <xsl:when test="ancestor::jcgm:preface">15pt</xsl:when>
1380
+ <xsl:when test="parent::jcgm:annex">15pt</xsl:when>
1230
1381
  <xsl:when test="../@inline-header = 'true' or @inline-header = 'true'">10.5pt</xsl:when>
1231
1382
  <xsl:when test="$level = 2">11.5pt</xsl:when>
1232
1383
  <xsl:when test="$level &gt;= 3">10.5pt</xsl:when>
@@ -1258,6 +1409,8 @@
1258
1409
  <xsl:attribute name="space-after">
1259
1410
  <xsl:choose>
1260
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>
1261
1414
  <!-- <xsl:otherwise>12pt</xsl:otherwise> -->
1262
1415
  <xsl:otherwise>12pt</xsl:otherwise>
1263
1416
  </xsl:choose>
@@ -1271,6 +1424,10 @@
1271
1424
  </xsl:choose>
1272
1425
  </xsl:attribute>
1273
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>
1274
1431
  <xsl:apply-templates/>
1275
1432
  </xsl:element>
1276
1433
 
@@ -1287,41 +1444,43 @@
1287
1444
  <xsl:param name="font-size" select="'65%'"/>
1288
1445
  <xsl:param name="baseline-shift" select="'30%'"/>
1289
1446
  <xsl:param name="curr_lang" select="'fr'"/>
1290
- <fo:inline>
1291
- <xsl:variable name="title-edition">
1292
- <xsl:call-template name="getTitle">
1293
- <xsl:with-param name="name" select="'title-edition'"/>
1294
- <xsl:with-param name="lang" select="$curr_lang"/>
1295
- </xsl:call-template>
1296
- </xsl:variable>
1297
- <xsl:value-of select="."/>
1298
- <fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
1299
- <xsl:if test="$curr_lang = 'en'">
1300
- <xsl:attribute name="baseline-shift">0%</xsl:attribute>
1301
- <xsl:attribute name="font-size">100%</xsl:attribute>
1302
- </xsl:if>
1303
- <xsl:choose>
1304
- <xsl:when test="$curr_lang = 'fr'">
1305
- <xsl:choose>
1306
- <xsl:when test=". = '1'">re</xsl:when>
1307
- <xsl:otherwise>e</xsl:otherwise>
1308
- </xsl:choose>
1309
- </xsl:when>
1310
- <xsl:otherwise>
1311
- <xsl:choose>
1312
- <xsl:when test=". = '1'">st</xsl:when>
1313
- <xsl:when test=". = '2'">nd</xsl:when>
1314
- <xsl:when test=". = '3'">rd</xsl:when>
1315
- <xsl:otherwise>th</xsl:otherwise>
1316
- </xsl:choose>
1317
- </xsl:otherwise>
1318
- </xsl:choose>
1319
-
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/>
1320
1482
  </fo:inline>
1321
- <xsl:text> </xsl:text>
1322
- <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/>
1323
- <xsl:text/>
1324
- </fo:inline>
1483
+ </xsl:if>
1325
1484
  </xsl:template>
1326
1485
 
1327
1486
 
@@ -1329,177 +1488,58 @@
1329
1488
  <!-- Index processing -->
1330
1489
  <!-- =================== -->
1331
1490
 
1332
- <xsl:template match="@*|node()" mode="index_add_id">
1333
- <xsl:copy>
1334
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
1335
- </xsl:copy>
1336
- </xsl:template>
1337
-
1338
- <xsl:template match="jcgm:xref" mode="index_add_id">
1339
- <xsl:variable name="id">
1340
- <xsl:call-template name="generateIndexXrefId"/>
1341
- </xsl:variable>
1342
- <xsl:copy> <!-- add id to xref -->
1343
- <xsl:apply-templates select="@*" mode="index_add_id"/>
1344
- <xsl:attribute name="id">
1345
- <xsl:value-of select="$id"/>
1346
- </xsl:attribute>
1347
- <xsl:apply-templates mode="index_add_id"/>
1348
- </xsl:copy>
1349
- <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
1350
- <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
1351
- <xsl:if test="@to">
1352
- <xsl:value-of select="$dash"/>
1353
- <xsl:copy>
1354
- <xsl:copy-of select="@*"/>
1355
- <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
1356
- <xsl:attribute name="id">
1357
- <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
1358
- </xsl:attribute>
1359
- <xsl:apply-templates mode="index_add_id"/>
1360
- </xsl:copy>
1361
- </xsl:if>
1362
- </xsl:template>
1363
-
1364
- <xsl:template match="@*|node()" mode="index_update">
1365
- <xsl:copy>
1366
- <xsl:apply-templates select="@*|node()" mode="index_update"/>
1367
- </xsl:copy>
1368
- </xsl:template>
1369
-
1370
- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:li" mode="index_update">
1371
- <xsl:copy>
1372
- <xsl:apply-templates select="@*" mode="index_update"/>
1373
- <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
1374
- </xsl:copy>
1375
- </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">
1376
1495
 
1377
- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:li/node()" mode="process_li_element" priority="2">
1378
- <xsl:param name="element"/>
1379
- <xsl:param name="remove" select="'false'"/>
1380
- <!-- <node></node> -->
1381
- <xsl:choose>
1382
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
1383
- <!-- skip text (i.e. remove it) and process next element -->
1384
- <!-- [removed_<xsl:value-of select="."/>] -->
1385
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1386
- </xsl:when>
1387
- <xsl:when test="self::text()">
1388
- <xsl:value-of select="."/>
1389
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1390
- </xsl:when>
1391
- <xsl:when test="self::* and local-name(.) = 'xref'">
1392
- <xsl:variable name="id" select="@id"/>
1393
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
1394
- <xsl:variable name="id_next" select="following-sibling::jcgm:xref[1]/@id"/>
1395
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
1396
-
1397
- <xsl:variable name="id_prev" select="preceding-sibling::jcgm:xref[1]/@id"/>
1398
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
1399
-
1496
+ <fo:page-sequence master-reference="document-jcgm" force-page-count="no-force">
1497
+ <xsl:variable name="header-title">
1400
1498
  <xsl:choose>
1401
- <!-- 2nd pass -->
1402
- <!-- if page is equal to page for next and page is not the end of range -->
1403
- <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
1404
- <!-- skip element (i.e. remove it) and remove next text ',' -->
1405
- <!-- [removed_xref] -->
1406
-
1407
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
1408
- <xsl:with-param name="remove">true</xsl:with-param>
1409
- </xsl:apply-templates>
1410
- </xsl:when>
1411
-
1412
- <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
1413
- <!-- remove xref -->
1414
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
1415
- <xsl:with-param name="remove">true</xsl:with-param>
1416
- </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"/>
1417
1501
  </xsl:when>
1418
-
1419
1502
  <xsl:otherwise>
1420
- <xsl:copy-of select="."/>
1421
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1503
+ <xsl:apply-templates select="./jcgm:title[1]" mode="header"/>
1422
1504
  </xsl:otherwise>
1423
1505
  </xsl:choose>
1424
- </xsl:when>
1425
- <xsl:when test="self::* and local-name(.) = 'ul'">
1426
- <!-- ul -->
1427
- <xsl:apply-templates select="." mode="index_update"/>
1428
- </xsl:when>
1429
- <xsl:otherwise>
1430
- <xsl:copy-of select="."/>
1431
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
1432
- </xsl:otherwise>
1433
- </xsl:choose>
1434
- </xsl:template>
1435
-
1436
-
1437
- <xsl:template name="generateIndexXrefId">
1438
- <xsl:variable name="level" select="count(ancestor::jcgm:ul)"/>
1439
- <!-- <xsl:variable name="parent_ul_id" select="generate-id(ancestor::jcgm:ul[1])"/>
1440
- <xsl:variable name="item_number" select="count(ancestor::jcgm:li[ancestor::jcgm:ul[generate-id() = $parent_ul_id]])"/> -->
1441
- <xsl:variable name="docid">
1442
- <xsl:call-template name="getDocumentId"/>
1443
- </xsl:variable>
1444
- <xsl:variable name="item_number">
1445
- <xsl:number count="jcgm:li[ancestor::jcgm:clause[@type = 'index']]" level="any"/>
1446
- </xsl:variable>
1447
- <xsl:variable name="xref_number"><xsl:number count="jcgm:xref"/></xsl:variable>
1448
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
1449
- </xsl:template>
1450
-
1451
- <xsl:template match="jcgm:clause[@type = 'index']"/>
1452
- <xsl:template match="jcgm:clause[@type = 'index']" mode="index">
1453
-
1454
- <fo:page-sequence master-reference="document-jcgm" force-page-count="no-force">
1506
+ </xsl:variable>
1455
1507
 
1456
1508
  <xsl:call-template name="insertHeaderFooter"/>
1457
1509
 
1458
1510
  <fo:flow flow-name="xsl-region-body">
1459
- <fo:block id="{@id}">
1460
- <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')]"/>
1461
1516
  </fo:block>
1462
1517
  </fo:flow>
1463
1518
  </fo:page-sequence>
1464
1519
  </xsl:template>
1465
1520
 
1466
- <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">
1467
1523
  <fo:block font-weight="bold" span="all">
1468
1524
  <!-- Index -->
1469
1525
  <xsl:apply-templates/>
1470
1526
  </fo:block>
1471
1527
  </xsl:template>
1472
1528
 
1473
- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:clause" priority="4">
1474
- <xsl:apply-templates/>
1475
- <fo:block>
1476
- <xsl:if test="following-sibling::jcgm:clause">
1477
- <fo:block> </fo:block>
1478
- </xsl:if>
1479
- </fo:block>
1480
- </xsl:template>
1481
-
1482
- <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">
1483
1532
  <!-- Letter A, B, C, ... -->
1484
1533
  <fo:block font-weight="bold" margin-left="25mm" keep-with-next="always">
1485
1534
  <xsl:apply-templates/>
1486
1535
  </fo:block>
1487
1536
  </xsl:template>
1488
1537
 
1489
- <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">
1490
1540
  <xsl:apply-templates/>
1491
1541
  </xsl:template>
1492
-
1493
- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:li" priority="4">
1494
- <xsl:variable name="level" select="count(ancestor::jcgm:ul)"/>
1495
- <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
1496
- <xsl:apply-templates/>
1497
- </fo:block>
1498
- </xsl:template>
1499
-
1500
- <xsl:template match="jcgm:bookmark">
1501
- <fo:inline id="{@id}"/>
1502
- </xsl:template>
1542
+
1503
1543
 
1504
1544
  <!-- =================== -->
1505
1545
  <!-- End of Index processing -->
@@ -1576,36 +1616,36 @@
1576
1616
  <xsl:apply-templates/>
1577
1617
  </xsl:template>
1578
1618
 
1579
- <!-- no display table/figure from slave documents if common=true or span=true -->
1580
- <xsl:template match="*[@slave]//*[local-name()='table'][@common = 'true']" priority="2"/>
1581
- <xsl:template match="*[@slave]//*[local-name()='table'][@span = 'true']" priority="2"/>
1582
- <xsl:template match="*[@slave]//*[local-name()='figure'][@common = 'true']" priority="2"/>
1583
- <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"/>
1584
1624
 
1585
- <!-- for table and figure with @common='true' -->
1625
+ <!-- for table and figure with @multilingual-rendering="common" -->
1586
1626
  <!-- display only element from first document -->
1587
- <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">
1588
1628
  <fo:block>
1589
1629
  <xsl:apply-templates/>
1590
1630
  </fo:block>
1591
1631
  </xsl:template>
1592
1632
 
1593
- <!-- for table and figure with @span='true' -->
1633
+ <!-- for table and figure with @multilingual-rendering = 'all-columns' -->
1594
1634
  <!-- display element from first document, then (after) from 2nd one, then 3rd, etc. -->
1595
- <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">
1596
1636
  <xsl:variable name="element-number" select="@element-number"/>
1597
1637
  <fo:block>
1598
1638
  <xsl:apply-templates/>
1599
1639
  <fo:block> </fo:block>
1600
1640
  <xsl:choose>
1601
- <xsl:when test="local-name(*[@span = 'true']) = 'table'">
1641
+ <xsl:when test="local-name(*[@multilingual-rendering = 'all-columns']) = 'table'">
1602
1642
  <xsl:for-each select="xalan:nodeset($docs_slave)/*">
1603
1643
  <xsl:for-each select=".//*[local-name() = 'table' and @element-number=$element-number]">
1604
1644
  <xsl:call-template name="table"/>
1605
1645
  </xsl:for-each>
1606
1646
  </xsl:for-each>
1607
1647
  </xsl:when>
1608
- <xsl:when test="local-name(*[@span = 'true']) = 'figure'">
1648
+ <xsl:when test="local-name(*[@multilingual-rendering = 'all-columns']) = 'figure'">
1609
1649
  <xsl:for-each select="xalan:nodeset($docs_slave)/*">
1610
1650
  <xsl:for-each select=".//*[local-name() = 'figure' and @element-number=$element-number]">
1611
1651
  <xsl:call-template name="figure"/>
@@ -1923,7 +1963,7 @@
1923
1963
  Elements that should be aligned:
1924
1964
  - name of element presents in field align-cross-elements="clause note"
1925
1965
  - marked with attribute name
1926
- - table/figure with attribute common="true" or span="true"
1966
+ - table/figure with attribute @multilingual-rendering = 'common' or @multilingual-rendering = 'all-columns'
1927
1967
  - marked with attribute cross-align
1928
1968
  -->
1929
1969
  <xsl:template name="isCrossAligned">
@@ -1932,10 +1972,10 @@
1932
1972
  <!-- if element`s name is presents in array align_cross_elements -->
1933
1973
  <xsl:when test="contains($align_cross_elements, concat('#',$element_name,'#'))">true</xsl:when>
1934
1974
  <!-- if element has attribute name/bookmark -->
1935
- <xsl:when test="normalize-space(@name) != ''">true</xsl:when>
1936
- <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>
1937
1977
  <!-- element marked as cross-align -->
1938
- <xsl:when test="@cross-align='true'">true</xsl:when>
1978
+ <xsl:when test="@multilingual-rendering='parallel'">true</xsl:when>
1939
1979
  <xsl:otherwise>false</xsl:otherwise>
1940
1980
  </xsl:choose>
1941
1981
  </xsl:template>
@@ -1945,7 +1985,7 @@
1945
1985
  <xsl:variable name="element-number">
1946
1986
  <xsl:choose>
1947
1987
  <!-- if name set, then use it -->
1948
- <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>
1949
1989
  <xsl:otherwise>
1950
1990
  <xsl:for-each select="ancestor-or-self::*[ancestor-or-self::*[local-name() = 'sections' or local-name() = 'annex']]">
1951
1991
  <xsl:value-of select="local-name()"/>
@@ -1976,13 +2016,12 @@
1976
2016
  </xsl:copy>
1977
2017
  </xsl:template>
1978
2018
 
1979
- <!-- enclose elements after table/figure with common=true and span=true in a separate element cross-align -->
1980
- <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">
1981
2021
  <xsl:variable name="curr_id" select="generate-id()"/>
1982
2022
  <xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
1983
2023
  <xsl:copy-of select="@element-number"/>
1984
- <xsl:copy-of select="@common"/>
1985
- <xsl:copy-of select="@span"/>
2024
+ <xsl:copy-of select="@multilingual-rendering"/>
1986
2025
  <xsl:copy-of select="."/>
1987
2026
  </xsl:element>
1988
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]]">
@@ -2008,8 +2047,7 @@
2008
2047
  <xsl:if test="local-name() = 'title'">
2009
2048
  <xsl:copy-of select="@keep-with-next"/>
2010
2049
  </xsl:if>
2011
- <xsl:copy-of select="@common"/>
2012
- <xsl:copy-of select="@span"/>
2050
+ <xsl:copy-of select="@multilingual-rendering"/>
2013
2051
  <xsl:copy-of select="."/>
2014
2052
 
2015
2053
  <!-- copy next elements until next element with cross-align=true -->
@@ -2201,6 +2239,7 @@
2201
2239
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
2202
2240
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
2203
2241
 
2242
+
2204
2243
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2205
2244
 
2206
2245
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -2283,6 +2322,7 @@
2283
2322
 
2284
2323
 
2285
2324
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2325
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2286
2326
 
2287
2327
 
2288
2328
 
@@ -2317,6 +2357,7 @@
2317
2357
 
2318
2358
 
2319
2359
 
2360
+
2320
2361
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2321
2362
 
2322
2363
 
@@ -2538,7 +2579,9 @@
2538
2579
 
2539
2580
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2540
2581
 
2541
-
2582
+
2583
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2584
+
2542
2585
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2543
2586
 
2544
2587
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -2546,7 +2589,25 @@
2546
2589
 
2547
2590
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2548
2591
 
2549
- </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">
2550
2611
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2551
2612
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2552
2613
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2591,16 +2652,17 @@
2591
2652
  <xsl:call-template name="add-zero-spaces-java"/>
2592
2653
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2593
2654
 
2655
+ <xsl:variable name="table-preamble">
2656
+
2657
+
2658
+ </xsl:variable>
2659
+
2594
2660
  <xsl:variable name="table">
2595
2661
 
2596
2662
  <xsl:variable name="simple-table">
2597
2663
  <xsl:call-template name="getSimpleTable"/>
2598
2664
  </xsl:variable>
2599
2665
 
2600
-
2601
-
2602
-
2603
-
2604
2666
  <!-- <xsl:if test="$namespace = 'bipm'">
2605
2667
  <fo:block>&#xA0;</fo:block>
2606
2668
  </xsl:if> -->
@@ -2611,7 +2673,7 @@
2611
2673
 
2612
2674
 
2613
2675
 
2614
- <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)"/>
2615
2677
 
2616
2678
  <!-- <xsl:variable name="cols-count">
2617
2679
  <xsl:choose>
@@ -2630,8 +2692,6 @@
2630
2692
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2631
2693
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2632
2694
 
2633
-
2634
-
2635
2695
  <xsl:variable name="colwidths">
2636
2696
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2637
2697
  <xsl:call-template name="calculate-column-widths">
@@ -2659,6 +2719,7 @@
2659
2719
  </xsl:choose>
2660
2720
  </xsl:variable>
2661
2721
 
2722
+
2662
2723
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2663
2724
 
2664
2725
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -2702,6 +2763,7 @@
2702
2763
 
2703
2764
 
2704
2765
 
2766
+
2705
2767
  <attribute name="margin-left">0mm</attribute>
2706
2768
  <attribute name="margin-right">0mm</attribute>
2707
2769
 
@@ -2794,7 +2856,8 @@
2794
2856
  </fo:block-container>
2795
2857
  </xsl:variable>
2796
2858
 
2797
-
2859
+ <xsl:variable name="isAdded" select="@added"/>
2860
+ <xsl:variable name="isDeleted" select="@deleted"/>
2798
2861
 
2799
2862
  <xsl:choose>
2800
2863
  <xsl:when test="@width">
@@ -2808,7 +2871,14 @@
2808
2871
  <fo:table-body>
2809
2872
  <fo:table-row>
2810
2873
  <fo:table-cell column-number="2">
2811
- <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>
2812
2882
  </fo:table-cell>
2813
2883
  </fo:table-row>
2814
2884
  </fo:table-body>
@@ -2819,7 +2889,22 @@
2819
2889
 
2820
2890
  </xsl:when>
2821
2891
  <xsl:otherwise>
2822
- <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>
2823
2908
  </xsl:otherwise>
2824
2909
  </xsl:choose>
2825
2910
 
@@ -2882,7 +2967,7 @@
2882
2967
  </xsl:for-each>
2883
2968
  </xsl:when>
2884
2969
  <xsl:otherwise>
2885
- <xsl:for-each select="xalan:nodeset($table)//tr">
2970
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2886
2971
  <xsl:variable name="td_text">
2887
2972
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2888
2973
 
@@ -2952,7 +3037,15 @@
2952
3037
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2953
3038
  <xsl:value-of select="@target"/>
2954
3039
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2955
- <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))"/>
2956
3049
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2957
3050
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2958
3051
  <xsl:param name="cols-count"/>
@@ -3272,7 +3365,8 @@
3272
3365
  <xsl:attribute name="text-align">
3273
3366
  <xsl:choose>
3274
3367
  <xsl:when test="@align">
3275
- <xsl:value-of select="@align"/>
3368
+ <xsl:call-template name="setAlignment"/>
3369
+ <!-- <xsl:value-of select="@align"/> -->
3276
3370
  </xsl:when>
3277
3371
  <xsl:otherwise>center</xsl:otherwise>
3278
3372
  </xsl:choose>
@@ -3290,6 +3384,9 @@
3290
3384
 
3291
3385
 
3292
3386
 
3387
+ <xsl:if test="$lang = 'ar'">
3388
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3389
+ </xsl:if>
3293
3390
  <xsl:if test="@colspan">
3294
3391
  <xsl:attribute name="number-columns-spanned">
3295
3392
  <xsl:value-of select="@colspan"/>
@@ -3321,11 +3418,15 @@
3321
3418
  <xsl:attribute name="text-align">
3322
3419
  <xsl:choose>
3323
3420
  <xsl:when test="@align">
3324
- <xsl:value-of select="@align"/>
3421
+ <xsl:call-template name="setAlignment"/>
3422
+ <!-- <xsl:value-of select="@align"/> -->
3325
3423
  </xsl:when>
3326
3424
  <xsl:otherwise>left</xsl:otherwise>
3327
3425
  </xsl:choose>
3328
3426
  </xsl:attribute>
3427
+ <xsl:if test="$lang = 'ar'">
3428
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3429
+ </xsl:if>
3329
3430
  <!-- and ancestor::*[local-name() = 'thead'] -->
3330
3431
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3331
3432
 
@@ -3343,6 +3444,9 @@
3343
3444
 
3344
3445
 
3345
3446
 
3447
+ <xsl:if test=".//*[local-name() = 'table']">
3448
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3449
+ </xsl:if>
3346
3450
  <xsl:if test="@colspan">
3347
3451
  <xsl:attribute name="number-columns-spanned">
3348
3452
  <xsl:value-of select="@colspan"/>
@@ -3476,13 +3580,13 @@
3476
3580
  </xsl:choose>
3477
3581
  </xsl:variable>
3478
3582
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3479
- <xsl:element name="{$ns}:table">
3583
+ <!-- <xsl:element name="{$ns}:table"> -->
3480
3584
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3481
3585
  <tbody>
3482
3586
  <xsl:apply-templates mode="dl"/>
3483
3587
  </tbody>
3484
3588
  </xsl:for-each>
3485
- </xsl:element>
3589
+ <!-- </xsl:element> -->
3486
3590
  </xsl:variable>
3487
3591
 
3488
3592
  <xsl:call-template name="calculate-column-widths">
@@ -3579,6 +3683,8 @@
3579
3683
  <xsl:apply-templates/>
3580
3684
  </fo:inline>
3581
3685
  </xsl:template><xsl:template match="*[local-name()='dl']">
3686
+ <xsl:variable name="isAdded" select="@added"/>
3687
+ <xsl:variable name="isDeleted" select="@deleted"/>
3582
3688
  <fo:block-container>
3583
3689
 
3584
3690
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3595,6 +3701,12 @@
3595
3701
  </xsl:attribute>
3596
3702
 
3597
3703
  </xsl:if>
3704
+
3705
+ <xsl:call-template name="setTrackChangesStyles">
3706
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3707
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3708
+ </xsl:call-template>
3709
+
3598
3710
  <fo:block-container>
3599
3711
 
3600
3712
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3716,11 +3828,11 @@
3716
3828
  </xsl:choose>
3717
3829
  </xsl:variable>
3718
3830
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3719
- <xsl:element name="{$ns}:table">
3831
+ <!-- <xsl:element name="{$ns}:table"> -->
3720
3832
  <tbody>
3721
3833
  <xsl:apply-templates mode="dl"/>
3722
3834
  </tbody>
3723
- </xsl:element>
3835
+ <!-- </xsl:element> -->
3724
3836
  </xsl:variable>
3725
3837
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3726
3838
  <xsl:variable name="colwidths">
@@ -3989,8 +4101,78 @@
3989
4101
  <fo:inline text-decoration="underline">
3990
4102
  <xsl:apply-templates/>
3991
4103
  </fo:inline>
4104
+ </xsl:template><xsl:template match="*[local-name()='add']">
4105
+ <xsl:choose>
4106
+ <xsl:when test="@amendment">
4107
+ <fo:inline>
4108
+ <xsl:call-template name="insertTag">
4109
+ <xsl:with-param name="kind">A</xsl:with-param>
4110
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4111
+ </xsl:call-template>
4112
+ <xsl:apply-templates/>
4113
+ <xsl:call-template name="insertTag">
4114
+ <xsl:with-param name="type">closing</xsl:with-param>
4115
+ <xsl:with-param name="kind">A</xsl:with-param>
4116
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4117
+ </xsl:call-template>
4118
+ </fo:inline>
4119
+ </xsl:when>
4120
+ <xsl:when test="@corrigenda">
4121
+ <fo:inline>
4122
+ <xsl:call-template name="insertTag">
4123
+ <xsl:with-param name="kind">C</xsl:with-param>
4124
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4125
+ </xsl:call-template>
4126
+ <xsl:apply-templates/>
4127
+ <xsl:call-template name="insertTag">
4128
+ <xsl:with-param name="type">closing</xsl:with-param>
4129
+ <xsl:with-param name="kind">C</xsl:with-param>
4130
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4131
+ </xsl:call-template>
4132
+ </fo:inline>
4133
+ </xsl:when>
4134
+ <xsl:otherwise>
4135
+ <fo:inline xsl:use-attribute-sets="add-style">
4136
+ <xsl:apply-templates/>
4137
+ </fo:inline>
4138
+ </xsl:otherwise>
4139
+ </xsl:choose>
4140
+
4141
+ </xsl:template><xsl:template name="insertTag">
4142
+ <xsl:param name="type"/>
4143
+ <xsl:param name="kind"/>
4144
+ <xsl:param name="value"/>
4145
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4146
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4147
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4148
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4149
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4150
+ <xsl:attribute name="height">5mm</xsl:attribute>
4151
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4152
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4153
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4154
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4155
+ <g>
4156
+ <xsl:if test="$type = 'closing'">
4157
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4158
+ </xsl:if>
4159
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4160
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4161
+ </g>
4162
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4163
+ <xsl:if test="$type = 'closing'">
4164
+ <xsl:attribute name="x">25</xsl:attribute>
4165
+ </xsl:if>
4166
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4167
+ </text>
4168
+ </svg>
4169
+ </fo:instream-foreign-object>
3992
4170
  </xsl:template><xsl:template match="*[local-name()='del']">
3993
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4171
+ <fo:inline xsl:use-attribute-sets="del-style">
4172
+ <xsl:apply-templates/>
4173
+ </fo:inline>
4174
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4175
+ <fo:inline background-color="yellow">
3994
4176
  <xsl:apply-templates/>
3995
4177
  </fo:inline>
3996
4178
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4327,12 +4509,23 @@
4327
4509
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4328
4510
  <xsl:value-of select="substring($str, 2)"/>
4329
4511
  </xsl:template><xsl:template match="mathml:math">
4330
- <fo:inline font-family="STIX Two Math"> <!-- -->
4512
+ <xsl:variable name="isAdded" select="@added"/>
4513
+ <xsl:variable name="isDeleted" select="@deleted"/>
4514
+
4515
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4516
+
4517
+
4518
+ <xsl:call-template name="setTrackChangesStyles">
4519
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4520
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4521
+ </xsl:call-template>
4331
4522
 
4332
4523
  <xsl:variable name="mathml">
4333
4524
  <xsl:apply-templates select="." mode="mathml"/>
4334
4525
  </xsl:variable>
4335
4526
  <fo:instream-foreign-object fox:alt-text="Math">
4527
+
4528
+
4336
4529
  <!-- <xsl:copy-of select="."/> -->
4337
4530
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4338
4531
  </fo:instream-foreign-object>
@@ -4351,7 +4544,7 @@
4351
4544
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4352
4545
  </xsl:copy>
4353
4546
  <mathml:mspace width="0.5ex"/>
4354
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4547
+ </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">
4355
4548
  <xsl:variable name="target">
4356
4549
  <xsl:choose>
4357
4550
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4385,8 +4578,6 @@
4385
4578
  </xsl:otherwise>
4386
4579
  </xsl:choose>
4387
4580
  </fo:inline>
4388
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4389
- <fo:inline id="{@id}"/>
4390
4581
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4391
4582
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4392
4583
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4580,8 +4771,15 @@
4580
4771
  </fo:inline>
4581
4772
  </xsl:if>
4582
4773
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4774
+ <xsl:variable name="isAdded" select="@added"/>
4775
+ <xsl:variable name="isDeleted" select="@deleted"/>
4583
4776
  <fo:block-container id="{@id}">
4584
4777
 
4778
+ <xsl:call-template name="setTrackChangesStyles">
4779
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4780
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4781
+ </xsl:call-template>
4782
+
4585
4783
  <fo:block>
4586
4784
  <xsl:apply-templates/>
4587
4785
  </fo:block>
@@ -4595,27 +4793,113 @@
4595
4793
  <fo:block id="{@id}">
4596
4794
  <xsl:apply-templates/>
4597
4795
  </fo:block>
4796
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4598
4797
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4599
4798
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4600
4799
  <xsl:apply-templates/>
4601
4800
  </fo:block>
4602
4801
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4603
- <fo:block xsl:use-attribute-sets="image-style">
4604
-
4605
-
4606
- <xsl:variable name="src">
4607
- <xsl:choose>
4608
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4609
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4610
- </xsl:when>
4611
- <xsl:otherwise>
4612
- <xsl:value-of select="@src"/>
4613
- </xsl:otherwise>
4614
- </xsl:choose>
4615
- </xsl:variable>
4616
-
4617
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4618
- </fo:block>
4802
+ <xsl:variable name="isAdded" select="../@added"/>
4803
+ <xsl:variable name="isDeleted" select="../@deleted"/>
4804
+ <xsl:choose>
4805
+ <xsl:when test="ancestor::*[local-name() = 'title']">
4806
+ <fo:inline padding-left="1mm" padding-right="1mm">
4807
+ <xsl:variable name="src">
4808
+ <xsl:call-template name="image_src"/>
4809
+ </xsl:variable>
4810
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
4811
+ </fo:inline>
4812
+ </xsl:when>
4813
+ <xsl:otherwise>
4814
+ <fo:block xsl:use-attribute-sets="image-style">
4815
+
4816
+ <xsl:variable name="src">
4817
+ <xsl:call-template name="image_src"/>
4818
+ </xsl:variable>
4819
+
4820
+ <xsl:choose>
4821
+ <xsl:when test="$isDeleted = 'true'">
4822
+ <!-- enclose in svg -->
4823
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
4824
+ <xsl:attribute name="width">100%</xsl:attribute>
4825
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4826
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4827
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4828
+
4829
+
4830
+ <xsl:apply-templates select="." mode="cross_image"/>
4831
+
4832
+ </fo:instream-foreign-object>
4833
+ </xsl:when>
4834
+ <xsl:otherwise>
4835
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4836
+ </xsl:otherwise>
4837
+ </xsl:choose>
4838
+
4839
+ </fo:block>
4840
+ </xsl:otherwise>
4841
+ </xsl:choose>
4842
+ </xsl:template><xsl:template name="image_src">
4843
+ <xsl:choose>
4844
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4845
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4846
+ </xsl:when>
4847
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4848
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4849
+ </xsl:when>
4850
+ <xsl:otherwise>
4851
+ <xsl:value-of select="@src"/>
4852
+ </xsl:otherwise>
4853
+ </xsl:choose>
4854
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
4855
+ <xsl:choose>
4856
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4857
+ <xsl:variable name="src">
4858
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4859
+ </xsl:variable>
4860
+ <xsl:variable name="width" select="document($src)/@width"/>
4861
+ <xsl:variable name="height" select="document($src)/@height"/>
4862
+ <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">
4863
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4864
+ </svg>
4865
+ </xsl:when>
4866
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4867
+ <xsl:variable name="src">
4868
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4869
+ </xsl:variable>
4870
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
4871
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
4872
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4873
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4874
+ <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">
4875
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4876
+ </svg>
4877
+ </xsl:when>
4878
+ <xsl:otherwise>
4879
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
4880
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
4881
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
4882
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
4883
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
4884
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4885
+ <!-- width=<xsl:value-of select="$width"/> -->
4886
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4887
+ <!-- height=<xsl:value-of select="$height"/> -->
4888
+ <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">
4889
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
4890
+ <xsl:call-template name="svg_cross">
4891
+ <xsl:with-param name="width" select="$width"/>
4892
+ <xsl:with-param name="height" select="$height"/>
4893
+ </xsl:call-template>
4894
+ </svg>
4895
+ </xsl:otherwise>
4896
+ </xsl:choose>
4897
+
4898
+ </xsl:template><xsl:template name="svg_cross">
4899
+ <xsl:param name="width"/>
4900
+ <xsl:param name="height"/>
4901
+ <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; "/>
4902
+ <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; "/>
4619
4903
  </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">
4620
4904
  <xsl:apply-templates mode="contents"/>
4621
4905
  <xsl:text> </xsl:text>
@@ -5134,8 +5418,8 @@
5134
5418
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5135
5419
 
5136
5420
  <xsl:variable name="element">
5137
- block
5138
-
5421
+
5422
+ inline
5139
5423
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5140
5424
  </xsl:variable>
5141
5425
 
@@ -5158,6 +5442,7 @@
5158
5442
  <xsl:variable name="element">
5159
5443
 
5160
5444
  inline
5445
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5161
5446
  </xsl:variable>
5162
5447
  <xsl:choose>
5163
5448
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5165,7 +5450,7 @@
5165
5450
  <xsl:apply-templates/>
5166
5451
  </fo:inline>
5167
5452
  </xsl:when>
5168
- <xsl:when test="normalize-space($element) = 'block'">
5453
+ <xsl:when test="contains(normalize-space($element), 'block')">
5169
5454
  <fo:block xsl:use-attribute-sets="example-name-style">
5170
5455
  <xsl:apply-templates/>
5171
5456
  </fo:block>
@@ -5178,9 +5463,15 @@
5178
5463
  </xsl:choose>
5179
5464
 
5180
5465
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5181
-
5466
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5182
5467
  <xsl:variable name="element">
5183
- block
5468
+
5469
+
5470
+ <xsl:choose>
5471
+ <xsl:when test="$num = 1">inline</xsl:when>
5472
+ <xsl:otherwise>block</xsl:otherwise>
5473
+ </xsl:choose>
5474
+
5184
5475
 
5185
5476
  </xsl:variable>
5186
5477
  <xsl:choose>
@@ -5295,29 +5586,47 @@
5295
5586
  <xsl:text>— </xsl:text>
5296
5587
  <xsl:apply-templates/>
5297
5588
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5298
- <fo:inline xsl:use-attribute-sets="eref-style">
5299
- <xsl:if test="@type = 'footnote'">
5300
-
5301
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5302
- <xsl:attribute name="font-size">80%</xsl:attribute>
5303
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5304
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5305
-
5306
-
5307
- </xsl:if>
5308
-
5309
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5310
-
5311
- <xsl:if test="@type = 'inline'">
5312
-
5313
-
5314
-
5315
- </xsl:if>
5316
-
5317
-
5318
- <xsl:apply-templates/>
5319
- </fo:basic-link>
5320
- </fo:inline>
5589
+
5590
+ <xsl:variable name="bibitemid">
5591
+ <xsl:choose>
5592
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5593
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5594
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5595
+ </xsl:choose>
5596
+ </xsl:variable>
5597
+
5598
+ <xsl:choose>
5599
+ <xsl:when test="normalize-space($bibitemid) != ''">
5600
+ <fo:inline xsl:use-attribute-sets="eref-style">
5601
+ <xsl:if test="@type = 'footnote'">
5602
+
5603
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5604
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5605
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5606
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5607
+
5608
+
5609
+ </xsl:if>
5610
+
5611
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5612
+ <xsl:if test="normalize-space(@citeas) = ''">
5613
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5614
+ </xsl:if>
5615
+ <xsl:if test="@type = 'inline'">
5616
+
5617
+
5618
+
5619
+ </xsl:if>
5620
+
5621
+ <xsl:apply-templates/>
5622
+ </fo:basic-link>
5623
+
5624
+ </fo:inline>
5625
+ </xsl:when>
5626
+ <xsl:otherwise>
5627
+ <fo:inline><xsl:apply-templates/></fo:inline>
5628
+ </xsl:otherwise>
5629
+ </xsl:choose>
5321
5630
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5322
5631
  <!-- zero-space char -->
5323
5632
  <xsl:variable name="depth">
@@ -5375,7 +5684,8 @@
5375
5684
  </fo:inline>
5376
5685
  </xsl:when>
5377
5686
  <xsl:otherwise>
5378
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
5687
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
5688
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5379
5689
  </xsl:otherwise>
5380
5690
  </xsl:choose>
5381
5691
 
@@ -5500,6 +5810,153 @@
5500
5810
  </fo:block>
5501
5811
  </xsl:otherwise>
5502
5812
  </xsl:choose>
5813
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5814
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5815
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5816
+ </xsl:for-each>
5817
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5818
+ <xsl:copy>
5819
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5820
+ </xsl:copy>
5821
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5822
+ <xsl:variable name="id">
5823
+ <xsl:call-template name="generateIndexXrefId"/>
5824
+ </xsl:variable>
5825
+ <xsl:copy> <!-- add id to xref -->
5826
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5827
+ <xsl:attribute name="id">
5828
+ <xsl:value-of select="$id"/>
5829
+ </xsl:attribute>
5830
+ <xsl:apply-templates mode="index_add_id"/>
5831
+ </xsl:copy>
5832
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5833
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5834
+ <xsl:if test="@to">
5835
+ <xsl:value-of select="$dash"/>
5836
+ <xsl:copy>
5837
+ <xsl:copy-of select="@*"/>
5838
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5839
+ <xsl:attribute name="id">
5840
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5841
+ </xsl:attribute>
5842
+ <xsl:apply-templates mode="index_add_id"/>
5843
+ </xsl:copy>
5844
+ </xsl:if>
5845
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
5846
+ <xsl:copy>
5847
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
5848
+ </xsl:copy>
5849
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
5850
+ <xsl:copy>
5851
+ <xsl:apply-templates select="@*" mode="index_update"/>
5852
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
5853
+ </xsl:copy>
5854
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
5855
+ <xsl:param name="element"/>
5856
+ <xsl:param name="remove" select="'false'"/>
5857
+ <xsl:param name="target"/>
5858
+ <!-- <node></node> -->
5859
+ <xsl:choose>
5860
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5861
+ <!-- skip text (i.e. remove it) and process next element -->
5862
+ <!-- [removed_<xsl:value-of select="."/>] -->
5863
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5864
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
5865
+ </xsl:apply-templates>
5866
+ </xsl:when>
5867
+ <xsl:when test="self::text()">
5868
+ <xsl:value-of select="."/>
5869
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5870
+ </xsl:when>
5871
+ <xsl:when test="self::* and local-name(.) = 'xref'">
5872
+ <xsl:variable name="id" select="@id"/>
5873
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
5874
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
5875
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
5876
+
5877
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
5878
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
5879
+
5880
+ <xsl:choose>
5881
+ <!-- 2nd pass -->
5882
+ <!-- if page is equal to page for next and page is not the end of range -->
5883
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
5884
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
5885
+ <!-- [removed_xref] -->
5886
+
5887
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5888
+ <xsl:with-param name="remove">true</xsl:with-param>
5889
+ <xsl:with-param name="target">
5890
+ <xsl:choose>
5891
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
5892
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
5893
+ </xsl:choose>
5894
+ </xsl:with-param>
5895
+ </xsl:apply-templates>
5896
+ </xsl:when>
5897
+
5898
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
5899
+ <!-- remove xref -->
5900
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5901
+ <xsl:with-param name="remove">true</xsl:with-param>
5902
+ </xsl:apply-templates>
5903
+ </xsl:when>
5904
+
5905
+ <xsl:otherwise>
5906
+ <xsl:apply-templates select="." mode="xref_copy">
5907
+ <xsl:with-param name="target" select="$target"/>
5908
+ </xsl:apply-templates>
5909
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5910
+ </xsl:otherwise>
5911
+ </xsl:choose>
5912
+ </xsl:when>
5913
+ <xsl:when test="self::* and local-name(.) = 'ul'">
5914
+ <!-- ul -->
5915
+ <xsl:apply-templates select="." mode="index_update"/>
5916
+ </xsl:when>
5917
+ <xsl:otherwise>
5918
+ <xsl:apply-templates select="." mode="xref_copy">
5919
+ <xsl:with-param name="target" select="$target"/>
5920
+ </xsl:apply-templates>
5921
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5922
+ </xsl:otherwise>
5923
+ </xsl:choose>
5924
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
5925
+ <xsl:param name="target"/>
5926
+ <xsl:copy>
5927
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
5928
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
5929
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
5930
+ </xsl:if>
5931
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
5932
+ </xsl:copy>
5933
+ </xsl:template><xsl:template name="generateIndexXrefId">
5934
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5935
+
5936
+ <xsl:variable name="docid">
5937
+ <xsl:call-template name="getDocumentId"/>
5938
+ </xsl:variable>
5939
+ <xsl:variable name="item_number">
5940
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
5941
+ </xsl:variable>
5942
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5943
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
5944
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5945
+ <xsl:apply-templates/>
5946
+ <fo:block>
5947
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
5948
+ <fo:block> </fo:block>
5949
+ </xsl:if>
5950
+ </fo:block>
5951
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5952
+ <xsl:apply-templates/>
5953
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5954
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5955
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5956
+ <xsl:apply-templates/>
5957
+ </fo:block>
5958
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5959
+ <fo:inline id="{@id}" font-size="1pt"/>
5503
5960
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5504
5961
  <!-- <row>
5505
5962
  <date>05-07-2013</date>
@@ -5716,67 +6173,65 @@
5716
6173
  <xsl:variable name="lang">
5717
6174
  <xsl:call-template name="getLang"/>
5718
6175
  </xsl:variable>
5719
- <fo:declarations>
5720
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5721
- <pdf:dictionary type="normal" key="ViewerPreferences">
5722
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5723
- </pdf:dictionary>
5724
- </pdf:catalog>
5725
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5726
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5727
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5728
- <!-- Dublin Core properties go here -->
5729
- <dc:title>
5730
- <xsl:variable name="title">
5731
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5732
-
5733
-
5734
-
5735
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'part']"/>
5736
-
5737
-
5738
-
5739
-
5740
- </xsl:for-each>
5741
- </xsl:variable>
5742
- <xsl:choose>
5743
- <xsl:when test="normalize-space($title) != ''">
5744
- <xsl:value-of select="$title"/>
5745
- </xsl:when>
5746
- <xsl:otherwise>
5747
- <xsl:text> </xsl:text>
5748
- </xsl:otherwise>
5749
- </xsl:choose>
5750
- </dc:title>
5751
- <dc:creator>
6176
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6177
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6178
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6179
+ </pdf:dictionary>
6180
+ </pdf:catalog>
6181
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6182
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6183
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6184
+ <!-- Dublin Core properties go here -->
6185
+ <dc:title>
6186
+ <xsl:variable name="title">
5752
6187
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5753
6188
 
5754
6189
 
5755
- <xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
5756
6190
 
6191
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'part']"/>
5757
6192
 
5758
- </xsl:for-each>
5759
- </dc:creator>
5760
- <dc:description>
5761
- <xsl:variable name="abstract">
5762
6193
 
5763
6194
 
5764
- <xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5765
-
5766
- </xsl:variable>
5767
- <xsl:value-of select="normalize-space($abstract)"/>
5768
- </dc:description>
5769
- <pdf:Keywords>
5770
- <xsl:call-template name="insertKeywords"/>
5771
- </pdf:Keywords>
5772
- </rdf:Description>
5773
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5774
- <!-- XMP properties go here -->
5775
- <xmp:CreatorTool/>
5776
- </rdf:Description>
5777
- </rdf:RDF>
5778
- </x:xmpmeta>
5779
- </fo:declarations>
6195
+
6196
+ </xsl:for-each>
6197
+ </xsl:variable>
6198
+ <xsl:choose>
6199
+ <xsl:when test="normalize-space($title) != ''">
6200
+ <xsl:value-of select="$title"/>
6201
+ </xsl:when>
6202
+ <xsl:otherwise>
6203
+ <xsl:text> </xsl:text>
6204
+ </xsl:otherwise>
6205
+ </xsl:choose>
6206
+ </dc:title>
6207
+ <dc:creator>
6208
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6209
+
6210
+
6211
+ <xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
6212
+
6213
+
6214
+ </xsl:for-each>
6215
+ </dc:creator>
6216
+ <dc:description>
6217
+ <xsl:variable name="abstract">
6218
+
6219
+
6220
+ <xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
6221
+
6222
+ </xsl:variable>
6223
+ <xsl:value-of select="normalize-space($abstract)"/>
6224
+ </dc:description>
6225
+ <pdf:Keywords>
6226
+ <xsl:call-template name="insertKeywords"/>
6227
+ </pdf:Keywords>
6228
+ </rdf:Description>
6229
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6230
+ <!-- XMP properties go here -->
6231
+ <xmp:CreatorTool/>
6232
+ </rdf:Description>
6233
+ </rdf:RDF>
6234
+ </x:xmpmeta>
5780
6235
  </xsl:template><xsl:template name="getId">
5781
6236
  <xsl:choose>
5782
6237
  <xsl:when test="../@id">
@@ -5940,4 +6395,44 @@
5940
6395
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5941
6396
  </xsl:choose>
5942
6397
 
6398
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6399
+ <xsl:param name="isAdded"/>
6400
+ <xsl:param name="isDeleted"/>
6401
+ <xsl:choose>
6402
+ <xsl:when test="local-name() = 'math'">
6403
+ <xsl:if test="$isAdded = 'true'">
6404
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6405
+ </xsl:if>
6406
+ <xsl:if test="$isDeleted = 'true'">
6407
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6408
+ </xsl:if>
6409
+ </xsl:when>
6410
+ <xsl:otherwise>
6411
+ <xsl:if test="$isAdded = 'true'">
6412
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6413
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6414
+ </xsl:if>
6415
+ <xsl:if test="$isDeleted = 'true'">
6416
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6417
+ <xsl:if test="local-name() = 'table'">
6418
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6419
+ </xsl:if>
6420
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6421
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6422
+ </xsl:if>
6423
+ </xsl:otherwise>
6424
+ </xsl:choose>
6425
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6426
+ <xsl:if test="$lang = 'ar'">
6427
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6428
+ </xsl:if>
6429
+ </xsl:template><xsl:template name="setAlignment">
6430
+ <xsl:param name="align" select="normalize-space(@align)"/>
6431
+ <xsl:choose>
6432
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6433
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6434
+ <xsl:when test="$align != ''">
6435
+ <xsl:value-of select="$align"/>
6436
+ </xsl:when>
6437
+ </xsl:choose>
5943
6438
  </xsl:template></xsl:stylesheet>