metanorma-iso 1.3.27 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f2bd4b15c4295ebf947cb014b8bbc6f53b7c539860613320a00e65f44e918fc
4
- data.tar.gz: 2e3741a0bf4f87e702571463f70460d8ba94e54d71a3f1ed910c54735df60b1f
3
+ metadata.gz: cf7373ffbae98a68238da9522616ea93b1f80ed8c927351146bba35e3b55d8d3
4
+ data.tar.gz: 88c3f55c85d8bd6896f70fb8e5d049a23bef8b78ee5fb0dc3013dcdd9352cdd0
5
5
  SHA512:
6
- metadata.gz: 0dab537420c96a7c56e6eaf99d20462e7bf8284ed2e919761df70e1e8b2c3331376001abdf81d14e769f938492ecbe5a4439dc547c050a01e6bb4529ed2f0bab
7
- data.tar.gz: 9acb9ac16c1fb230c842d43596af7fd01ee8f08504ab62119ce03379fab9c56e7aa1e878a5114b74c0cf5214656cef47d9b0846eac9e94ca6e282181445bc948
6
+ metadata.gz: ec1b451def873895ba8d1d92f87ac2bfe3820312dbc36533df5115421b89fd7ac3d1ecd8ec8720c29c8070f210f6c1af1b554360cf668c0fa5a921ee8232d10b
7
+ data.tar.gz: bf7f4b814a7dfbd3c7daf1f3845ec2da2b0ee3bcb04494eb0b2a5c5346011819d1c386a553250d65cb84b305dde0ffe866f9d7b40ce167390fdfd1274b6824b0
@@ -41,26 +41,23 @@ module Asciidoctor
41
41
  IsoDoc::Iso::StsConvert.new(html_extract_attributes(node))
42
42
  end
43
43
 
44
+ def presentation_xml_converter(node)
45
+ IsoDoc::Iso::PresentationXMLConvert.new(html_extract_attributes(node))
46
+ end
47
+
44
48
  def init(node)
45
49
  super
46
50
  @amd = %w(amendment technical-corrigendum).include? node.attr("doctype")
47
51
  end
48
52
 
49
- def document(node)
50
- init(node)
51
- ret = makexml(node).to_xml(indent: 2)
52
- unless node.attr("nodoc") || !node.attr("docfile")
53
+ def outputs(node, ret)
53
54
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
54
- html_converter_alt(node).convert(@filename + ".xml")
55
- FileUtils.mv "#{@filename}.html", "#{@filename}_alt.html"
56
- html_converter(node).convert(@filename + ".xml")
57
- doc_converter(node).convert(@filename + ".xml")
58
- pdf_converter(node)&.convert(@filename + ".xml")
59
- sts_converter(node)&.convert(@filename + ".xml")
60
- end
61
- @log.write(@localdir + @filename + ".err") unless @novalid
62
- @files_to_delete.each { |f| FileUtils.rm f }
63
- ret
55
+ presentation_xml_converter(node).convert(@filename + ".xml")
56
+ html_converter_alt(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}_alt.html")
57
+ html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
58
+ doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
59
+ pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
60
+ #sts_converter(node)&.convert(@filename + ".xml")
64
61
  end
65
62
 
66
63
  def load_yaml(lang, script)
@@ -11,10 +11,17 @@ module IsoDoc
11
11
  @meta = Metadata.new(lang, script, labels)
12
12
  end
13
13
 
14
- def convert1(docxml, filename, dir)
14
+ def xref_init(lang, script, klass, labels, options)
15
+ @xrefs = Xref.new(lang, script, klass, labels, options)
16
+ end
17
+
18
+ def amd(docxml)
15
19
  doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
16
- @amd = %w(amendment technical-corrigendum).include? doctype
17
- if @amd
20
+ %w(amendment technical-corrigendum).include? doctype
21
+ end
22
+
23
+ def convert1(docxml, filename, dir)
24
+ if amd(docxml)
18
25
  @oldsuppressheadingnumbers = @suppressheadingnumbers
19
26
  @suppressheadingnumbers = true
20
27
  end
@@ -62,12 +69,12 @@ module IsoDoc
62
69
  end
63
70
 
64
71
  def prefix_container(container, linkend, target)
65
- delim = anchor(target, :type) == "listitem" ? " " : ", "
66
- l10n(anchor(container, :xref) + delim + linkend)
72
+ delim = @xrefs.anchor(target, :type) == "listitem" ? " " : ", "
73
+ l10n(@xrefs.anchor(container, :xref) + delim + linkend)
67
74
  end
68
75
 
69
76
  def example_span_label(node, div, name)
70
- n = get_anchors[node["id"]]
77
+ n = @xrefs.get[node["id"]]
71
78
  div.span **{ class: "example_label" } do |p|
72
79
  lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
73
80
  l10n("#{@example_lbl} #{n[:label]}")
@@ -139,12 +146,6 @@ module IsoDoc
139
146
  ""
140
147
  end
141
148
 
142
- def reference_names(ref)
143
- super
144
- @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].
145
- sub(/ \(All Parts\)/i, "") }
146
- end
147
-
148
149
  def cleanup(docxml)
149
150
  super
150
151
  table_th_center(docxml)
@@ -200,17 +201,17 @@ module IsoDoc
200
201
  div << " &mdash; "
201
202
  end
202
203
 
203
- def figure_name_parse(node, div, name)
204
- lbl = anchor(node['id'], :label, false)
205
- lbl = nil if labelled_ancestor(node) && node.ancestors("figure").empty?
206
- return if lbl.nil? && name.nil?
207
- div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
208
- figname = node.parent.name == "figure" ? "" : "#{@figure_lbl} "
209
- lbl.nil? or p << l10n("#{figname}#{lbl}")
210
- name and !lbl.nil? and p << "&nbsp;&mdash; "
211
- name and name.children.each { |n| parse(n, div) }
204
+ def figure_name_parse(node, div, name)
205
+ lbl = @xrefs.anchor(node['id'], :label, false)
206
+ lbl = nil if labelled_ancestor(node) && node.ancestors("figure").empty?
207
+ return if lbl.nil? && name.nil?
208
+ div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
209
+ figname = node.parent.name == "figure" ? "" : "#{@figure_lbl} "
210
+ lbl.nil? or p << l10n("#{figname}#{lbl}")
211
+ name and !lbl.nil? and p << "&nbsp;&mdash; "
212
+ name and name.children.each { |n| parse(n, div) }
213
+ end
212
214
  end
213
215
  end
214
- end
215
216
  end
216
217
  end
@@ -24,18 +24,15 @@
24
24
  <xsl:variable name="ISOname" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-reference']"/>
25
25
 
26
26
  <!-- Information and documentation — Codes for transcription systems -->
27
- <xsl:variable name="title-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'main']"/>
28
- <xsl:variable name="title-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'main']"/>
29
27
  <xsl:variable name="title-intro" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-intro']"/>
30
28
  <xsl:variable name="title-intro-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-intro']"/>
31
29
  <xsl:variable name="title-main" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-main']"/>
32
30
  <xsl:variable name="title-main-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-main']"/>
33
31
  <xsl:variable name="part" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@part"/>
34
32
 
35
-
36
-
37
- <xsl:variable name="doctype_uppercased" select="translate(translate(/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype,'-',' '), $lower,$upper)"/>
38
-
33
+ <xsl:variable name="doctype" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype"/>
34
+ <xsl:variable name="doctype_uppercased" select="java:toUpperCase(java:java.lang.String.new(translate($doctype,'-',' ')))"/>
35
+
39
36
  <xsl:variable name="stage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:stage)"/>
40
37
  <xsl:variable name="substage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:substage)"/>
41
38
  <xsl:variable name="stagename" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename)"/>
@@ -62,8 +59,8 @@
62
59
 
63
60
  <xsl:variable name="stage-fullname-uppercased">
64
61
  <xsl:choose>
65
- <xsl:when test="$stagename != ''">
66
- <xsl:value-of select="translate($stagename, $lower, $upper)"/>
62
+ <xsl:when test="$stagename != ''">
63
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
67
64
  </xsl:when>
68
65
  <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
69
66
  <xsl:when test="$stage-abbreviation = 'PWI'">PRELIMINARY WORK ITEM</xsl:when>
@@ -311,35 +308,7 @@
311
308
 
312
309
  </fo:layout-master-set>
313
310
 
314
- <fo:declarations>
315
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
316
- <pdf:dictionary type="normal" key="ViewerPreferences">
317
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
318
- </pdf:dictionary>
319
- </pdf:catalog>
320
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
321
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
322
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
323
- <!-- Dublin Core properties go here -->
324
- <dc:title><xsl:value-of select="$title-en"/></dc:title>
325
- <dc:creator><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:contributor[iso:role/@type='author']/iso:organization/iso:name"/></dc:creator>
326
- <dc:description>
327
- <xsl:variable name="abstract">
328
- <xsl:copy-of select="/iso:iso-standard/iso:bibliography/iso:references/iso:bibitem/iso:abstract//text()"/>
329
- </xsl:variable>
330
- <xsl:value-of select="normalize-space($abstract)"/>
331
- </dc:description>
332
- <pdf:Keywords>
333
- <xsl:call-template name="insertKeywords"/>
334
- </pdf:Keywords>
335
- </rdf:Description>
336
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
337
- <!-- XMP properties go here -->
338
- <xmp:CreatorTool/>
339
- </rdf:Description>
340
- </rdf:RDF>
341
- </x:xmpmeta>
342
- </fo:declarations>
311
+ <xsl:call-template name="addPDFUAmeta"/>
343
312
 
344
313
  <!-- cover page -->
345
314
  <xsl:choose>
@@ -928,8 +897,9 @@
928
897
  <xsl:if test="$part != ''">
929
898
  <xsl:text> — </xsl:text>
930
899
  <fo:block margin-top="6pt" font-weight="normal">
931
- <xsl:value-of select="$title-part-fr"/><xsl:value-of select="$part"/>
932
- <xsl:text>:</xsl:text>
900
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
901
+ <!-- <xsl:value-of select="$title-part-fr"/><xsl:value-of select="$part"/>
902
+ <xsl:text>:</xsl:text> -->
933
903
  </fo:block>
934
904
  </xsl:if>
935
905
  <xsl:value-of select="$part-fr"/>
@@ -972,81 +942,101 @@
972
942
  <xsl:apply-templates select="/iso:iso-standard/iso:boilerplate/iso:copyright-statement"/>
973
943
  </fo:block>
974
944
  </fo:block>
975
- </fo:block-container>
976
- <fo:block break-after="page"/>
945
+ </fo:block-container>
977
946
  </xsl:if>
978
947
 
979
- <fo:block-container font-weight="bold">
980
-
981
- <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
982
- <fo:inline font-size="16pt" font-weight="bold">Contents</fo:inline>
983
- <fo:inline keep-together.within-line="always">
984
- <fo:leader leader-pattern="space"/>
985
- <fo:inline font-weight="normal" font-size="10pt">Page</fo:inline>
986
- </fo:inline>
987
- </fo:block>
988
-
989
- <xsl:if test="$debug = 'true'">
990
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
991
- DEBUG
992
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
993
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
994
- </xsl:if>
948
+
949
+ <xsl:choose>
950
+ <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
995
951
 
996
- <xsl:variable name="margin-left">12</xsl:variable>
997
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
998
-
999
- <fo:block>
1000
- <xsl:if test="@level = 1">
1001
- <xsl:attribute name="margin-top">5pt</xsl:attribute>
1002
- </xsl:if>
1003
- <xsl:if test="@level = 3">
1004
- <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
952
+ <xsl:otherwise>
953
+ <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
954
+ <fo:block break-after="page"/>
955
+ </xsl:if>
956
+ <fo:block-container font-weight="bold">
957
+
958
+ <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
959
+ <xsl:variable name="title-toc">
960
+ <xsl:call-template name="getTitle">
961
+ <xsl:with-param name="name" select="'title-toc'"/>
962
+ </xsl:call-template>
963
+ </xsl:variable>
964
+ <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
965
+ <fo:inline keep-together.within-line="always">
966
+ <fo:leader leader-pattern="space"/>
967
+ <xsl:variable name="title-page">
968
+ <xsl:call-template name="getTitle">
969
+ <xsl:with-param name="name" select="'title-page'"/>
970
+ </xsl:call-template>
971
+ </xsl:variable>
972
+ <fo:inline font-weight="normal" font-size="10pt"><xsl:value-of select="$title-page"/></fo:inline>
973
+ </fo:inline>
974
+ </fo:block>
975
+
976
+ <xsl:if test="$debug = 'true'">
977
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
978
+ DEBUG
979
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
980
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1005
981
  </xsl:if>
1006
- <fo:list-block>
1007
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1008
- <xsl:if test="@level &gt;= 2">
1009
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1010
- </xsl:if>
1011
- <xsl:attribute name="provisional-distance-between-starts">
1012
- <xsl:choose>
1013
- <!-- skip 0 section without subsections -->
1014
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1015
- <xsl:when test="@section != '' and not(@display-section = 'false')"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1016
- <xsl:otherwise>0mm</xsl:otherwise>
1017
- </xsl:choose>
1018
- </xsl:attribute>
1019
- <fo:list-item>
1020
- <fo:list-item-label end-indent="label-end()">
1021
- <fo:block>
1022
- <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
1023
- <xsl:value-of select="@section"/>
1024
- </xsl:if>
1025
- </fo:block>
1026
- </fo:list-item-label>
1027
- <fo:list-item-body start-indent="body-start()">
1028
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1029
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1030
- <xsl:if test="@section and @display-section = 'false'">
1031
- <xsl:value-of select="@section"/><xsl:text> </xsl:text>
1032
- </xsl:if>
1033
- <xsl:if test="@addon != ''">
1034
- <fo:inline font-weight="normal">(<xsl:value-of select="@addon"/>)</fo:inline>
982
+
983
+ <xsl:variable name="margin-left">12</xsl:variable>
984
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
985
+
986
+ <fo:block>
987
+ <xsl:if test="@level = 1">
988
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
989
+ </xsl:if>
990
+ <xsl:if test="@level = 3">
991
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
992
+ </xsl:if>
993
+ <fo:list-block>
994
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
995
+ <xsl:if test="@level &gt;= 2">
996
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
997
+ </xsl:if>
998
+ <xsl:attribute name="provisional-distance-between-starts">
999
+ <xsl:choose>
1000
+ <!-- skip 0 section without subsections -->
1001
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1002
+ <xsl:when test="@section != '' and not(@display-section = 'false')"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1003
+ <xsl:otherwise>0mm</xsl:otherwise>
1004
+ </xsl:choose>
1005
+ </xsl:attribute>
1006
+ <fo:list-item>
1007
+ <fo:list-item-label end-indent="label-end()">
1008
+ <fo:block>
1009
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
1010
+ <xsl:value-of select="@section"/>
1035
1011
  </xsl:if>
1036
- <xsl:text> </xsl:text><xsl:value-of select="text()"/>
1037
- <fo:inline keep-together.within-line="always">
1038
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1039
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1040
- </fo:inline>
1041
- </fo:basic-link>
1042
- </fo:block>
1043
- </fo:list-item-body>
1044
- </fo:list-item>
1045
- </fo:list-block>
1046
- </fo:block>
1047
-
1048
- </xsl:for-each>
1049
- </fo:block-container>
1012
+ </fo:block>
1013
+ </fo:list-item-label>
1014
+ <fo:list-item-body start-indent="body-start()">
1015
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1016
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1017
+ <xsl:if test="@section and @display-section = 'false'">
1018
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
1019
+ </xsl:if>
1020
+ <xsl:if test="@addon != ''">
1021
+ <fo:inline font-weight="normal">(<xsl:value-of select="@addon"/>)</fo:inline>
1022
+ </xsl:if>
1023
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
1024
+ <fo:inline keep-together.within-line="always">
1025
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1026
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1027
+ </fo:inline>
1028
+ </fo:basic-link>
1029
+ </fo:block>
1030
+ </fo:list-item-body>
1031
+ </fo:list-item>
1032
+ </fo:list-block>
1033
+ </fo:block>
1034
+
1035
+ </xsl:for-each>
1036
+ </fo:block-container>
1037
+ </xsl:otherwise>
1038
+ </xsl:choose>
1039
+
1050
1040
  <!-- Foreword, Introduction -->
1051
1041
  <xsl:apply-templates select="/iso:iso-standard/iso:preface/node()"/>
1052
1042
 
@@ -1084,9 +1074,10 @@
1084
1074
  <xsl:if test="$part != ''">
1085
1075
  <xsl:text> — </xsl:text>
1086
1076
  <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1087
- <xsl:value-of select="$title-part-en"/>
1077
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1078
+ <!-- <xsl:value-of select="$title-part-en"/>
1088
1079
  <xsl:value-of select="$part"/>
1089
- <xsl:text>:</xsl:text>
1080
+ <xsl:text>:</xsl:text> -->
1090
1081
  </fo:block>
1091
1082
  </xsl:if>
1092
1083
  </xsl:if>
@@ -1094,9 +1085,27 @@
1094
1085
  <fo:block>
1095
1086
  <xsl:value-of select="$part-en"/>
1096
1087
  </fo:block>
1088
+
1089
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
1090
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1091
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1092
+ <xsl:variable name="title-amendment">
1093
+ <xsl:call-template name="getTitle">
1094
+ <xsl:with-param name="name" select="'title-amendment'"/>
1095
+ </xsl:call-template>
1096
+ </xsl:variable>
1097
+ <xsl:value-of select="$title-amendment"/>
1098
+ <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1099
+ <xsl:if test="normalize-space($amendment-number) != ''">
1100
+ <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1101
+ </xsl:if>
1102
+ <xsl:text>: </xsl:text>
1103
+ <xsl:value-of select="$title-amd"/>
1104
+ </fo:block>
1105
+ </xsl:if>
1106
+
1097
1107
  </fo:block>
1098
1108
 
1099
-
1100
1109
  </fo:block-container>
1101
1110
  <!-- Clause(s) -->
1102
1111
  <fo:block>
@@ -1174,6 +1183,11 @@
1174
1183
  </fo:block>
1175
1184
  <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1176
1185
  <fo:block font-size="9pt" margin-bottom="6pt">
1186
+ <xsl:variable name="title-descriptors">
1187
+ <xsl:call-template name="getTitle">
1188
+ <xsl:with-param name="name" select="'title-descriptors'"/>
1189
+ </xsl:call-template>
1190
+ </xsl:variable>
1177
1191
  <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
1178
1192
  <xsl:call-template name="insertKeywords">
1179
1193
  <xsl:with-param name="sorting">no</xsl:with-param>
@@ -1296,8 +1310,7 @@
1296
1310
  <xsl:template match="iso:figure" mode="contents">
1297
1311
  <item level="" id="{@id}" display="false">
1298
1312
  <xsl:attribute name="section">
1299
- <xsl:call-template name="getFigureNumber"/>
1300
- <!-- <xsl:text>Figure </xsl:text><xsl:number format="A.1-1" level="multiple" count="iso:annex | iso:figure"/> -->
1313
+ <xsl:call-template name="getFigureNumber"/>
1301
1314
  </xsl:attribute>
1302
1315
  </item>
1303
1316
  </xsl:template>
@@ -1308,6 +1321,11 @@
1308
1321
  <xsl:variable name="annex-id" select="ancestor::iso:annex/@id"/>
1309
1322
  <item level="" id="{@id}" display="false" type="table">
1310
1323
  <xsl:attribute name="section">
1324
+ <xsl:variable name="title-table">
1325
+ <xsl:call-template name="getTitle">
1326
+ <xsl:with-param name="name" select="'title-table'"/>
1327
+ </xsl:call-template>
1328
+ </xsl:variable>
1311
1329
  <xsl:value-of select="$title-table"/>
1312
1330
  <xsl:call-template name="getTableNumber"/>
1313
1331
  </xsl:attribute>
@@ -1318,7 +1336,15 @@
1318
1336
  <xsl:template match="iso:formula" mode="contents">
1319
1337
  <item level="" id="{@id}" display="false">
1320
1338
  <xsl:attribute name="section">
1321
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="iso:annex | iso:formula"/><xsl:text>)</xsl:text>
1339
+ <xsl:variable name="title-formula">
1340
+ <xsl:call-template name="getTitle">
1341
+ <xsl:with-param name="name" select="'title-formula'"/>
1342
+ </xsl:call-template>
1343
+ </xsl:variable>
1344
+ <xsl:value-of select="$title-formula"/>
1345
+ <xsl:call-template name="getFormulaNumber">
1346
+ <xsl:with-param name="display" select="not(@unnumbered = 'true')"/>
1347
+ </xsl:call-template>
1322
1348
  </xsl:attribute>
1323
1349
  </item>
1324
1350
  </xsl:template>
@@ -1512,6 +1538,11 @@
1512
1538
  </xsl:variable>
1513
1539
 
1514
1540
  <xsl:choose>
1541
+ <xsl:when test="$doctype = 'amendment'">
1542
+ <fo:block id="{$id}" font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always">
1543
+ <xsl:apply-templates/>
1544
+ </fo:block>
1545
+ </xsl:when>
1515
1546
  <xsl:when test="$parent-name = 'annex'">
1516
1547
  <fo:block id="{$id}" font-size="16pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always">
1517
1548
  <xsl:value-of select="$section"/>
@@ -1705,7 +1736,7 @@
1705
1736
  <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
1706
1737
  </fo:block>
1707
1738
  <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1708
- <xsl:value-of select="$title-figure"/>
1739
+ <!-- <xsl:value-of select="$title-figure"/> -->
1709
1740
  <xsl:call-template name="getFigureNumber"/>
1710
1741
  </fo:block>
1711
1742
  </fo:block-container>
@@ -1721,9 +1752,12 @@
1721
1752
  <xsl:call-template name="note"/>
1722
1753
  </xsl:for-each>
1723
1754
  <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
1724
- <xsl:call-template name="getFigureNumber"/>
1755
+ <xsl:variable name="figureNumber">
1756
+ <xsl:call-template name="getFigureNumber"/>
1757
+ </xsl:variable>
1758
+ <xsl:value-of select="$figureNumber"/>
1725
1759
  <xsl:if test="iso:name">
1726
- <xsl:if test="not(local-name(..) = 'figure')">
1760
+ <xsl:if test="not(local-name(..) = 'figure') and normalize-space($figureNumber) != ''">
1727
1761
  <xsl:text> — </xsl:text>
1728
1762
  </xsl:if>
1729
1763
  <xsl:value-of select="iso:name"/>
@@ -1733,7 +1767,13 @@
1733
1767
  </xsl:template>
1734
1768
 
1735
1769
  <xsl:template name="getFigureNumber">
1770
+ <xsl:variable name="title-figure">
1771
+ <xsl:call-template name="getTitle">
1772
+ <xsl:with-param name="name" select="'title-figure'"/>
1773
+ </xsl:call-template>
1774
+ </xsl:variable>
1736
1775
  <xsl:choose>
1776
+ <xsl:when test="$doctype = 'amendment'"/>
1737
1777
  <xsl:when test="ancestor::iso:annex">
1738
1778
  <xsl:choose>
1739
1779
  <xsl:when test="local-name(..) = 'figure'">
@@ -1805,13 +1845,13 @@
1805
1845
  <xsl:number level="any" count="iso:bibitem/iso:note"/>
1806
1846
  </xsl:variable>
1807
1847
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1808
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1848
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1809
1849
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1810
1850
  </fo:basic-link>
1811
1851
  </fo:inline>
1812
1852
  <fo:footnote-body>
1813
1853
  <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1814
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1854
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1815
1855
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1816
1856
  </fo:inline>
1817
1857
  <xsl:apply-templates/>
@@ -1849,7 +1889,7 @@
1849
1889
 
1850
1890
  <xsl:template match="iso:term">
1851
1891
  <xsl:param name="sectionNum"/>
1852
- <fo:block margin-bottom="10pt">
1892
+ <fo:block id="{@id}" margin-bottom="10pt">
1853
1893
  <xsl:apply-templates>
1854
1894
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
1855
1895
  </xsl:apply-templates>
@@ -1860,7 +1900,7 @@
1860
1900
  <xsl:param name="sectionNum"/>
1861
1901
  <fo:block line-height="1.1">
1862
1902
  <fo:block font-weight="bold" keep-with-next="always">
1863
- <fo:inline id="{../@id}">
1903
+ <fo:inline>
1864
1904
  <xsl:variable name="section">
1865
1905
  <xsl:call-template name="getSection">
1866
1906
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
@@ -1883,7 +1923,12 @@
1883
1923
  </xsl:template>
1884
1924
 
1885
1925
  <xsl:template match="iso:deprecates">
1886
- <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
1926
+ <xsl:variable name="title-deprecated">
1927
+ <xsl:call-template name="getTitle">
1928
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1929
+ </xsl:call-template>
1930
+ </xsl:variable>
1931
+ <fo:block><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
1887
1932
  </xsl:template>
1888
1933
 
1889
1934
  <xsl:template match="iso:definition[preceding-sibling::iso:domain]">
@@ -1905,6 +1950,11 @@
1905
1950
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1906
1951
  <fo:basic-link internal-destination="{iso:origin/@bibitemid}" fox:alt-text="{iso:origin/@citeas}">
1907
1952
  <xsl:text>[</xsl:text>
1953
+ <xsl:variable name="title-source">
1954
+ <xsl:call-template name="getTitle">
1955
+ <xsl:with-param name="name" select="'title-source'"/>
1956
+ </xsl:call-template>
1957
+ </xsl:variable>
1908
1958
  <xsl:value-of select="$title-source"/>
1909
1959
  <xsl:text>: </xsl:text>
1910
1960
  <xsl:value-of select="iso:origin/@citeas"/>
@@ -1920,10 +1970,7 @@
1920
1970
  </fo:block>
1921
1971
  </xsl:template>
1922
1972
 
1923
- <xsl:template match="iso:modification">
1924
- <xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text>
1925
- <xsl:apply-templates/>
1926
- </xsl:template>
1973
+
1927
1974
  <xsl:template match="iso:modification/iso:p">
1928
1975
  <fo:inline><xsl:apply-templates/></fo:inline>
1929
1976
  </xsl:template>
@@ -1934,6 +1981,11 @@
1934
1981
  <xsl:number />
1935
1982
  <xsl:text> to entry: </xsl:text> -->
1936
1983
  <xsl:variable name="num"><xsl:number/></xsl:variable>
1984
+ <xsl:variable name="title-note-to-entry">
1985
+ <xsl:call-template name="getTitle">
1986
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1987
+ </xsl:call-template>
1988
+ </xsl:variable>
1937
1989
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1938
1990
  <xsl:apply-templates/>
1939
1991
  </fo:block>
@@ -1955,6 +2007,11 @@
1955
2007
  <xsl:template match="iso:termexample">
1956
2008
  <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt" text-align="justify">
1957
2009
  <fo:inline padding-right="5mm">
2010
+ <xsl:variable name="title-example">
2011
+ <xsl:call-template name="getTitle">
2012
+ <xsl:with-param name="name" select="'title-example'"/>
2013
+ </xsl:call-template>
2014
+ </xsl:variable>
1958
2015
  <xsl:value-of select="$title-example"/>
1959
2016
  <xsl:if test="count(ancestor::iso:term[1]//iso:termexample) &gt; 1">
1960
2017
  <xsl:number/>
@@ -2038,7 +2095,8 @@
2038
2095
  </fo:block>
2039
2096
  <fo:block text-align="right">
2040
2097
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
2041
- <xsl:text>— </xsl:text><xsl:value-of select="iso:author"/>
2098
+ <xsl:apply-templates select="iso:author"/>
2099
+ <!-- <xsl:text>— </xsl:text><xsl:value-of select="iso:author"/> -->
2042
2100
  <xsl:if test="iso:source">
2043
2101
  <xsl:text>, </xsl:text>
2044
2102
  <xsl:apply-templates select="iso:source"/>
@@ -2046,9 +2104,13 @@
2046
2104
  </fo:block>
2047
2105
  </xsl:template>
2048
2106
 
2107
+ <xsl:template match="iso:quote/iso:author">
2108
+ <xsl:text>— </xsl:text><xsl:apply-templates/>
2109
+ </xsl:template>
2110
+
2049
2111
  <xsl:template match="iso:source">
2050
2112
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
2051
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2113
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2052
2114
  <xsl:apply-templates select="iso:localityStack"/>
2053
2115
  </fo:basic-link>
2054
2116
  </xsl:template>
@@ -2075,6 +2137,13 @@
2075
2137
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = $target]/@type"/>
2076
2138
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id =$target]/@root"/>
2077
2139
  <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =$target]/@level"/>
2140
+
2141
+ <xsl:variable name="title-clause">
2142
+ <xsl:call-template name="getTitle">
2143
+ <xsl:with-param name="name" select="'title-clause'"/>
2144
+ </xsl:call-template>
2145
+ </xsl:variable>
2146
+
2078
2147
  <xsl:choose>
2079
2148
  <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
2080
2149
  <xsl:when test="$type = 'li'">
@@ -2105,6 +2174,11 @@
2105
2174
  </xsl:if> -->
2106
2175
  <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2107
2176
  <fo:inline padding-right="5mm">
2177
+ <xsl:variable name="title-example">
2178
+ <xsl:call-template name="getTitle">
2179
+ <xsl:with-param name="name" select="'title-example'"/>
2180
+ </xsl:call-template>
2181
+ </xsl:variable>
2108
2182
  <xsl:value-of select="$title-example"/>
2109
2183
  <xsl:if test="count(ancestor::iso:clause[1]//iso:example) &gt; 1">
2110
2184
  <xsl:number count="iso:example[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
@@ -2118,6 +2192,11 @@
2118
2192
  <fo:block font-size="10pt" margin-top="8pt" margin-bottom="12pt" text-align="justify">
2119
2193
  <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2120
2194
  <fo:inline padding-right="6mm">
2195
+ <xsl:variable name="title-note">
2196
+ <xsl:call-template name="getTitle">
2197
+ <xsl:with-param name="name" select="'title-note'"/>
2198
+ </xsl:call-template>
2199
+ </xsl:variable>
2121
2200
  <xsl:value-of select="$title-note"/>
2122
2201
  <xsl:if test="count(ancestor::iso:clause[1]//iso:note) &gt; 1">
2123
2202
  <xsl:number count="iso:note[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
@@ -2143,7 +2222,7 @@
2143
2222
 
2144
2223
  <xsl:choose>
2145
2224
  <xsl:when test="@citeas and normalize-space(text()) = ''">
2146
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2225
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2147
2226
  </xsl:when>
2148
2227
  <xsl:when test="@bibitemid and normalize-space(text()) = ''">
2149
2228
  <xsl:value-of select="//iso:bibitem[@id = current()/@bibitemid]/iso:docidentifier"/>
@@ -2156,6 +2235,21 @@
2156
2235
  </xsl:template>
2157
2236
 
2158
2237
  <xsl:template match="iso:locality">
2238
+ <xsl:variable name="title-clause">
2239
+ <xsl:call-template name="getTitle">
2240
+ <xsl:with-param name="name" select="'title-clause'"/>
2241
+ </xsl:call-template>
2242
+ </xsl:variable>
2243
+ <xsl:variable name="title-annex">
2244
+ <xsl:call-template name="getTitle">
2245
+ <xsl:with-param name="name" select="'title-annex'"/>
2246
+ </xsl:call-template>
2247
+ </xsl:variable>
2248
+ <xsl:variable name="title-table">
2249
+ <xsl:call-template name="getTitle">
2250
+ <xsl:with-param name="name" select="'title-table'"/>
2251
+ </xsl:call-template>
2252
+ </xsl:variable>
2159
2253
  <xsl:choose>
2160
2254
  <xsl:when test="ancestor::iso:termsource"/>
2161
2255
  <xsl:when test="@type ='clause' and ancestor::iso:eref"/>
@@ -2168,13 +2262,19 @@
2168
2262
  </xsl:template>
2169
2263
 
2170
2264
  <xsl:template match="iso:admonition">
2171
- <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
2172
- <xsl:value-of select="translate(@type, $lower, $upper)"/>
2265
+ <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
2266
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/>
2173
2267
  <xsl:text> — </xsl:text>
2174
2268
  <xsl:apply-templates/>
2175
2269
  </fo:block>
2176
2270
  </xsl:template>
2177
2271
 
2272
+ <xsl:template match="iso:formula">
2273
+ <fo:block id="{@id}">
2274
+ <xsl:apply-templates/>
2275
+ </fo:block>
2276
+ </xsl:template>
2277
+
2178
2278
  <xsl:template match="iso:formula/iso:dt/iso:stem">
2179
2279
  <fo:inline>
2180
2280
  <xsl:apply-templates/>
@@ -2182,7 +2282,7 @@
2182
2282
  </xsl:template>
2183
2283
 
2184
2284
  <xsl:template match="iso:formula/iso:stem">
2185
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
2285
+ <fo:block margin-top="6pt" margin-bottom="12pt">
2186
2286
  <fo:table table-layout="fixed" width="100%">
2187
2287
  <fo:table-column column-width="95%"/>
2188
2288
  <fo:table-column column-width="5%"/>
@@ -2195,14 +2295,9 @@
2195
2295
  </fo:table-cell>
2196
2296
  <fo:table-cell display-align="center">
2197
2297
  <fo:block text-align="right">
2198
- <xsl:choose>
2199
- <xsl:when test="ancestor::iso:annex">
2200
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="iso:annex | iso:formula"/><xsl:text>)</xsl:text>
2201
- </xsl:when>
2202
- <xsl:otherwise> <!-- not(ancestor::iso:annex) -->
2203
- <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="iso:formula"/><xsl:text>)</xsl:text> -->
2204
- </xsl:otherwise>
2205
- </xsl:choose>
2298
+ <xsl:call-template name="getFormulaNumber">
2299
+ <xsl:with-param name="display" select="not(../@unnumbered = 'true')"/>
2300
+ </xsl:call-template>
2206
2301
  </fo:block>
2207
2302
  </fo:table-cell>
2208
2303
  </fo:table-row>
@@ -2301,38 +2396,6 @@
2301
2396
  </fo:static-content>
2302
2397
  </xsl:template>
2303
2398
 
2304
- <xsl:template name="getId">
2305
- <xsl:choose>
2306
- <xsl:when test="../@id">
2307
- <xsl:value-of select="../@id"/>
2308
- </xsl:when>
2309
- <xsl:otherwise>
2310
- <xsl:value-of select="text()"/>
2311
- </xsl:otherwise>
2312
- </xsl:choose>
2313
- </xsl:template>
2314
-
2315
- <xsl:template name="getLevel">
2316
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2317
- <xsl:variable name="level">
2318
- <xsl:choose>
2319
- <xsl:when test="ancestor::iso:preface">
2320
- <xsl:value-of select="$level_total - 2"/>
2321
- </xsl:when>
2322
- <xsl:when test="ancestor::iso:sections">
2323
- <xsl:value-of select="$level_total - 2"/>
2324
- </xsl:when>
2325
- <xsl:when test="ancestor::iso:bibliography">
2326
- <xsl:value-of select="$level_total - 2"/>
2327
- </xsl:when>
2328
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2329
- <xsl:otherwise>
2330
- <xsl:value-of select="$level_total - 1"/>
2331
- </xsl:otherwise>
2332
- </xsl:choose>
2333
- </xsl:variable>
2334
- <xsl:value-of select="$level"/>
2335
- </xsl:template>
2336
2399
 
2337
2400
  <xsl:template name="getSection">
2338
2401
  <xsl:param name="sectionNum"/>
@@ -2352,7 +2415,7 @@
2352
2415
  </xsl:when>
2353
2416
  <xsl:when test="$level &gt;= 2">
2354
2417
  <xsl:variable name="num">
2355
- <xsl:number format=".1" level="multiple" count="iso:clause/iso:clause | iso:clause/iso:terms | iso:terms/iso:term | iso:clause/iso:term | iso:terms/iso:clause | iso:terms/iso:definitions | iso:definitions/iso:clause | iso:definitions/iso:definitions | iso:clause/iso:definitions"/>
2418
+ <xsl:call-template name="getSubSection"/>
2356
2419
  </xsl:variable>
2357
2420
  <xsl:value-of select="concat($sectionNum, $num)"/>
2358
2421
  </xsl:when>
@@ -2376,6 +2439,11 @@
2376
2439
  <xsl:variable name="annexid" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid)"/>
2377
2440
  <xsl:choose>
2378
2441
  <xsl:when test="$level = 1">
2442
+ <xsl:variable name="title-annex">
2443
+ <xsl:call-template name="getTitle">
2444
+ <xsl:with-param name="name" select="'title-annex'"/>
2445
+ </xsl:call-template>
2446
+ </xsl:variable>
2379
2447
  <xsl:value-of select="$title-annex"/>
2380
2448
  <xsl:choose>
2381
2449
  <xsl:when test="count(//iso:annex) = 1 and $annexid != ''">
@@ -3101,7 +3169,12 @@
3101
3169
  <xsl:value-of select="$edition"/>
3102
3170
  </xsl:when>
3103
3171
  </xsl:choose>
3104
- <xsl:if test="$edition != ''"><xsl:text> edition</xsl:text></xsl:if>
3172
+ <xsl:variable name="title-edition">
3173
+ <xsl:call-template name="getTitle">
3174
+ <xsl:with-param name="name" select="'title-edition'"/>
3175
+ </xsl:call-template>
3176
+ </xsl:variable>
3177
+ <xsl:if test="$edition != ''"><xsl:text> </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/></xsl:if>
3105
3178
  </xsl:template>
3106
3179
 
3107
3180
  <xsl:template name="printTitlePartFr">
@@ -3109,9 +3182,10 @@
3109
3182
  <xsl:if test="normalize-space($part-fr) != ''">
3110
3183
  <xsl:if test="$part != ''">
3111
3184
  <xsl:text> — </xsl:text>
3112
- <xsl:value-of select="$title-part-fr"/>
3185
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
3186
+ <!-- <xsl:value-of select="$title-part-fr"/>
3113
3187
  <xsl:value-of select="$part"/>
3114
- <xsl:text>:</xsl:text>
3188
+ <xsl:text>:</xsl:text> -->
3115
3189
  </xsl:if>
3116
3190
  <xsl:value-of select="$part-fr"/>
3117
3191
  </xsl:if>
@@ -3123,54 +3197,213 @@
3123
3197
  <xsl:if test="$part != ''">
3124
3198
  <xsl:text> — </xsl:text>
3125
3199
  <fo:block font-weight="normal" margin-top="6pt">
3126
- <xsl:value-of select="$title-part-en"/>
3200
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
3201
+ <!-- <xsl:value-of select="$title-part-en"/>
3127
3202
  <xsl:value-of select="$part"/>
3128
- <xsl:text>:</xsl:text>
3203
+ <xsl:text>:</xsl:text> -->
3129
3204
  </fo:block>
3130
3205
  </xsl:if>
3131
3206
  <xsl:value-of select="$part-en"/>
3132
3207
  </xsl:if>
3133
3208
  </xsl:template>
3209
+
3210
+ <xsl:template name="getFormulaNumber">
3211
+ <xsl:param name="display" select="'true'"/>
3212
+ <xsl:if test="$display = 'true'">
3213
+ <xsl:choose>
3214
+ <xsl:when test="ancestor::iso:annex">
3215
+ <xsl:number format="(A.1)" level="multiple" count="iso:annex | iso:formula[not(@unnumbered='true')]"/>
3216
+ </xsl:when>
3217
+ <xsl:otherwise> <!-- not(ancestor::iso:annex) -->
3218
+ <xsl:text>(</xsl:text><xsl:number level="any" count="iso:formula[not(@unnumbered='true')]"/><xsl:text>)</xsl:text>
3219
+ </xsl:otherwise>
3220
+ </xsl:choose>
3221
+ </xsl:if>
3222
+ </xsl:template>
3134
3223
 
3224
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
3225
+
3226
+ <title-table lang="en">Table </title-table>
3227
+ <title-table lang="fr">Tableau </title-table>
3228
+
3229
+ <title-table lang="zh">Table </title-table>
3230
+
3231
+
3135
3232
 
3136
- <xsl:variable name="title-table">
3233
+ <title-note lang="en">NOTE </title-note>
3234
+ <title-note lang="fr">NOTE </title-note>
3235
+
3236
+ <title-note lang="zh">NOTE </title-note>
3237
+
3137
3238
 
3138
- <xsl:text>Table </xsl:text>
3139
3239
 
3240
+ <title-figure lang="en">Figure </title-figure>
3241
+ <title-figure lang="fr">Figure </title-figure>
3140
3242
 
3141
- </xsl:variable><xsl:variable name="title-note">
3243
+ <title-figure lang="zh">Figure </title-figure>
3142
3244
 
3143
- <xsl:text>NOTE </xsl:text>
3144
3245
 
3145
3246
 
3146
- </xsl:variable><xsl:variable name="title-figure">
3247
+ <title-example lang="en">EXAMPLE </title-example>
3248
+ <title-example lang="fr">EXEMPLE </title-example>
3147
3249
 
3148
- <xsl:text>Figure </xsl:text>
3250
+ <title-example lang="zh">EXAMPLE </title-example>
3149
3251
 
3150
3252
 
3151
- </xsl:variable><xsl:variable name="title-example">
3152
3253
 
3153
- <xsl:text>EXAMPLE </xsl:text>
3254
+ <title-example-xref lang="en">Example </title-example-xref>
3255
+ <title-example-xref lang="fr">Exemple </title-example-xref>
3256
+
3257
+ <title-section lang="en">Section </title-section>
3258
+ <title-section lang="fr">Section </title-section>
3154
3259
 
3260
+ <title-inequality lang="en">Inequality </title-inequality>
3261
+ <title-inequality lang="fr">Inequality </title-inequality>
3155
3262
 
3156
- </xsl:variable><xsl:variable name="title-inequality">Inequality </xsl:variable><xsl:variable name="title-equation">Equation </xsl:variable><xsl:variable name="title-annex">
3263
+ <title-equation lang="en">Equation </title-equation>
3264
+ <title-equation lang="fr">Equation </title-equation>
3265
+
3266
+ <title-annex lang="en">Annex </title-annex>
3267
+ <title-annex lang="fr">Annexe </title-annex>
3157
3268
 
3158
- <xsl:text>Annex </xsl:text>
3269
+ <title-annex lang="zh">Annex </title-annex>
3159
3270
 
3160
3271
 
3161
- </xsl:variable><xsl:variable name="title-appendix">
3162
- <xsl:text>Appendix </xsl:text>
3163
- </xsl:variable><xsl:variable name="title-clause">
3164
3272
 
3165
- <xsl:text>Clause </xsl:text>
3273
+ <title-appendix lang="en">Appendix </title-appendix>
3274
+ <title-appendix lang="fr">Appendix </title-appendix>
3275
+
3276
+ <title-clause lang="en">Clause </title-clause>
3277
+ <title-clause lang="fr">Article </title-clause>
3278
+
3279
+ <title-clause lang="zh">Clause </title-clause>
3280
+
3281
+
3282
+
3283
+ <title-edition lang="en">
3284
+
3285
+ <xsl:text>Edition </xsl:text>
3286
+
3287
+
3288
+ </title-edition>
3289
+
3290
+ <title-formula lang="en">Formula </title-formula>
3291
+ <title-formula lang="fr">Formula </title-formula>
3292
+
3293
+ <title-toc lang="en">
3294
+
3295
+ <xsl:text>Contents</xsl:text>
3296
+
3297
+
3298
+
3299
+ </title-toc>
3300
+ <title-toc lang="fr">Sommaire</title-toc>
3301
+
3302
+ <title-toc lang="zh">Contents</title-toc>
3303
+
3304
+
3305
+
3306
+ <title-page lang="en">Page</title-page>
3307
+ <title-page lang="fr">Page</title-page>
3308
+
3309
+ <title-key lang="en">Key</title-key>
3310
+ <title-key lang="fr">Légende</title-key>
3311
+
3312
+ <title-where lang="en">where</title-where>
3313
+ <title-where lang="fr">où</title-where>
3314
+
3315
+ <title-descriptors lang="en">Descriptors</title-descriptors>
3316
+
3317
+ <title-part lang="en">
3318
+
3319
+ <xsl:text>Part #:</xsl:text>
3320
+
3321
+
3322
+ </title-part>
3323
+ <title-part lang="fr">
3324
+
3325
+ <xsl:text>Partie #:</xsl:text>
3326
+
3327
+
3328
+ </title-part>
3329
+ <title-part lang="zh">第 # 部分:</title-part>
3166
3330
 
3331
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
3332
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
3167
3333
 
3168
- </xsl:variable><xsl:variable name="title-edition">
3169
- <xsl:text>Edition </xsl:text>
3170
- </xsl:variable><xsl:variable name="title-toc">
3334
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
3171
3335
 
3172
3336
 
3173
- </xsl:variable><xsl:variable name="title-page">Page</xsl:variable><xsl:variable name="title-key">Key</xsl:variable><xsl:variable name="title-where">where</xsl:variable><xsl:variable name="title-descriptors">Descriptors</xsl:variable><xsl:variable name="title-part-en">Part </xsl:variable><xsl:variable name="title-part-fr">Partie </xsl:variable><xsl:variable name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable name="title-modified">modified</xsl:variable><xsl:variable name="title-source">SOURCE</xsl:variable><xsl:variable name="title-keywords">Keywords</xsl:variable><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
3337
+
3338
+ <title-modified lang="en">modified</title-modified>
3339
+ <title-modified lang="fr">modifiée</title-modified>
3340
+
3341
+ <title-modified lang="zh">modified</title-modified>
3342
+
3343
+
3344
+
3345
+ <title-source lang="en">SOURCE</title-source>
3346
+
3347
+ <title-keywords lang="en">Keywords</title-keywords>
3348
+
3349
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
3350
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
3351
+
3352
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
3353
+
3354
+ <title-list-tables lang="en">List of Tables</title-list-tables>
3355
+
3356
+ <title-list-figures lang="en">List of Figures</title-list-figures>
3357
+
3358
+ <title-recommendation lang="en">Recommendation </title-recommendation>
3359
+
3360
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
3361
+
3362
+ <title-abstract lang="en">Abstract</title-abstract>
3363
+
3364
+ <title-summary lang="en">Summary</title-summary>
3365
+
3366
+ <title-in lang="en">in </title-in>
3367
+
3368
+ <title-box lang="en">Box </title-box>
3369
+
3370
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3371
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
3372
+
3373
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3374
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
3375
+
3376
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3377
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
3378
+
3379
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
3380
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
3381
+
3382
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
3383
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
3384
+
3385
+ <title-caution lang="en">CAUTION</title-caution>
3386
+ <title-caution lang="zh">注意</title-caution>
3387
+
3388
+ <title-warning lang="en">WARNING</title-warning>
3389
+ <title-warning lang="zh">警告</title-warning>
3390
+
3391
+ <title-amendment lang="en">AMENDMENT</title-amendment>
3392
+ </xsl:variable><xsl:template name="getTitle">
3393
+ <xsl:param name="name"/>
3394
+ <xsl:variable name="lang">
3395
+ <xsl:call-template name="getLang"/>
3396
+ </xsl:variable>
3397
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
3398
+ <xsl:choose>
3399
+ <xsl:when test="normalize-space($title_) != ''">
3400
+ <xsl:value-of select="$title_"/>
3401
+ </xsl:when>
3402
+ <xsl:otherwise>
3403
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3404
+ </xsl:otherwise>
3405
+ </xsl:choose>
3406
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
3174
3407
 
3175
3408
  <xsl:attribute name="color">blue</xsl:attribute>
3176
3409
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -3248,7 +3481,11 @@
3248
3481
 
3249
3482
 
3250
3483
 
3251
-
3484
+ <xsl:variable name="title-table">
3485
+ <xsl:call-template name="getTitle">
3486
+ <xsl:with-param name="name" select="'title-table'"/>
3487
+ </xsl:call-template>
3488
+ </xsl:variable>
3252
3489
  <xsl:value-of select="$title-table"/>
3253
3490
 
3254
3491
  <xsl:call-template name="getTableNumber"/>
@@ -3360,7 +3597,16 @@
3360
3597
  </xsl:otherwise>
3361
3598
  </xsl:choose>
3362
3599
  </xsl:for-each>
3363
- <xsl:apply-templates/>
3600
+
3601
+ <xsl:choose>
3602
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3603
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3604
+ </xsl:when>
3605
+ <xsl:otherwise>
3606
+ <xsl:apply-templates/>
3607
+ </xsl:otherwise>
3608
+ </xsl:choose>
3609
+
3364
3610
  </fo:table>
3365
3611
 
3366
3612
 
@@ -3530,6 +3776,10 @@
3530
3776
 
3531
3777
  <xsl:apply-templates/>
3532
3778
  </fo:table-header>
3779
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3780
+ <fo:table-body>
3781
+ <xsl:apply-templates/>
3782
+ </fo:table-body>
3533
3783
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
3534
3784
  <xsl:apply-templates/>
3535
3785
  </xsl:template><xsl:template name="insertTableFooter">
@@ -3704,6 +3954,11 @@
3704
3954
  <fo:marker marker-class-name="table_continued">
3705
3955
  <xsl:if test="$row_number &gt; 1">
3706
3956
  <fo:inline>
3957
+ <xsl:variable name="title-table">
3958
+ <xsl:call-template name="getTitle">
3959
+ <xsl:with-param name="name" select="'title-table'"/>
3960
+ </xsl:call-template>
3961
+ </xsl:variable>
3707
3962
  <xsl:value-of select="$title-table"/>
3708
3963
  <xsl:call-template name="getTableNumber"/>
3709
3964
  <xsl:text> </xsl:text>
@@ -3741,6 +3996,11 @@
3741
3996
  <fo:inline padding-right="2mm">
3742
3997
 
3743
3998
 
3999
+ <xsl:variable name="title-note">
4000
+ <xsl:call-template name="getTitle">
4001
+ <xsl:with-param name="name" select="'title-note'"/>
4002
+ </xsl:call-template>
4003
+ </xsl:variable>
3744
4004
  <xsl:value-of select="$title-note"/>
3745
4005
 
3746
4006
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
@@ -3824,6 +4084,36 @@
3824
4084
  </fn>
3825
4085
  </xsl:for-each>
3826
4086
  </xsl:variable>
4087
+
4088
+ <!-- current hierarchy is 'figure' element -->
4089
+ <xsl:variable name="following_dl_colwidths">
4090
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4091
+ <xsl:variable name="html-table">
4092
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4093
+ <xsl:element name="{$ns}:table">
4094
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4095
+ <tbody>
4096
+ <xsl:apply-templates mode="dl"/>
4097
+ </tbody>
4098
+ </xsl:for-each>
4099
+ </xsl:element>
4100
+ </xsl:variable>
4101
+
4102
+ <xsl:call-template name="calculate-column-widths">
4103
+ <xsl:with-param name="cols-count" select="2"/>
4104
+ <xsl:with-param name="table" select="$html-table"/>
4105
+ </xsl:call-template>
4106
+
4107
+ </xsl:if>
4108
+ </xsl:variable>
4109
+
4110
+
4111
+ <xsl:variable name="maxlength_dt">
4112
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4113
+ <xsl:call-template name="getMaxLength_dt"/>
4114
+ </xsl:for-each>
4115
+ </xsl:variable>
4116
+
3827
4117
  <xsl:if test="xalan:nodeset($references)//fn">
3828
4118
  <fo:block>
3829
4119
  <fo:table width="95%" table-layout="fixed">
@@ -3831,8 +4121,19 @@
3831
4121
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3832
4122
 
3833
4123
  </xsl:if>
3834
- <fo:table-column column-width="15%"/>
3835
- <fo:table-column column-width="85%"/>
4124
+ <xsl:choose>
4125
+ <!-- if there 'dl', then set same columns width -->
4126
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4127
+ <xsl:call-template name="setColumnWidth_dl">
4128
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4129
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4130
+ </xsl:call-template>
4131
+ </xsl:when>
4132
+ <xsl:otherwise>
4133
+ <fo:table-column column-width="15%"/>
4134
+ <fo:table-column column-width="85%"/>
4135
+ </xsl:otherwise>
4136
+ </xsl:choose>
3836
4137
  <fo:table-body>
3837
4138
  <xsl:for-each select="xalan:nodeset($references)//fn">
3838
4139
  <xsl:variable name="reference" select="@reference"/>
@@ -3903,6 +4204,11 @@
3903
4204
 
3904
4205
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3905
4206
 
4207
+ <xsl:variable name="title-where">
4208
+ <xsl:call-template name="getTitle">
4209
+ <xsl:with-param name="name" select="'title-where'"/>
4210
+ </xsl:call-template>
4211
+ </xsl:variable>
3906
4212
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3907
4213
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3908
4214
  <xsl:text/>
@@ -3918,17 +4224,27 @@
3918
4224
 
3919
4225
 
3920
4226
 
4227
+ <xsl:variable name="title-where">
4228
+ <xsl:call-template name="getTitle">
4229
+ <xsl:with-param name="name" select="'title-where'"/>
4230
+ </xsl:call-template>
4231
+ </xsl:variable>
3921
4232
  <xsl:value-of select="$title-where"/>
3922
4233
  </fo:block>
3923
4234
  </xsl:when>
3924
4235
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3925
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
4236
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3926
4237
 
3927
4238
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3928
4239
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3929
4240
 
3930
4241
 
3931
4242
 
4243
+ <xsl:variable name="title-key">
4244
+ <xsl:call-template name="getTitle">
4245
+ <xsl:with-param name="name" select="'title-key'"/>
4246
+ </xsl:call-template>
4247
+ </xsl:variable>
3932
4248
  <xsl:value-of select="$title-key"/>
3933
4249
  </fo:block>
3934
4250
  </xsl:when>
@@ -3950,23 +4266,6 @@
3950
4266
 
3951
4267
 
3952
4268
 
3953
- <!-- create virtual html table for dl/[dt and dd] -->
3954
- <xsl:variable name="html-table">
3955
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3956
- <xsl:element name="{$ns}:table">
3957
- <tbody>
3958
- <xsl:apply-templates mode="dl"/>
3959
- </tbody>
3960
- </xsl:element>
3961
- </xsl:variable>
3962
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3963
- <xsl:variable name="colwidths">
3964
- <xsl:call-template name="calculate-column-widths">
3965
- <xsl:with-param name="cols-count" select="2"/>
3966
- <xsl:with-param name="table" select="$html-table"/>
3967
- </xsl:call-template>
3968
- </xsl:variable>
3969
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3970
4269
 
3971
4270
  <fo:table width="95%" table-layout="fixed">
3972
4271
 
@@ -3979,42 +4278,30 @@
3979
4278
 
3980
4279
  </xsl:when>
3981
4280
  </xsl:choose>
3982
- <xsl:choose>
3983
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3984
- <fo:table-column column-width="50%"/>
3985
- <fo:table-column column-width="50%"/>
3986
- </xsl:when>
3987
- <xsl:otherwise>
3988
- <xsl:choose>
3989
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3990
- <fo:table-column column-width="60%"/>
3991
- <fo:table-column column-width="40%"/>
3992
- </xsl:when> -->
3993
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3994
- <fo:table-column column-width="50%"/>
3995
- <fo:table-column column-width="50%"/>
3996
- </xsl:when>
3997
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3998
- <fo:table-column column-width="40%"/>
3999
- <fo:table-column column-width="60%"/>
4000
- </xsl:when>
4001
- <xsl:otherwise>
4002
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4003
- <xsl:choose>
4004
- <xsl:when test=". = 1 or . = 0">
4005
- <fo:table-column column-width="proportional-column-width(2)"/>
4006
- </xsl:when>
4007
- <xsl:otherwise>
4008
- <fo:table-column column-width="proportional-column-width({.})"/>
4009
- </xsl:otherwise>
4010
- </xsl:choose>
4011
- </xsl:for-each>
4012
- </xsl:otherwise>
4013
- </xsl:choose>
4014
- <!-- <fo:table-column column-width="15%"/>
4015
- <fo:table-column column-width="85%"/> -->
4016
- </xsl:otherwise>
4017
- </xsl:choose>
4281
+ <!-- create virtual html table for dl/[dt and dd] -->
4282
+ <xsl:variable name="html-table">
4283
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4284
+ <xsl:element name="{$ns}:table">
4285
+ <tbody>
4286
+ <xsl:apply-templates mode="dl"/>
4287
+ </tbody>
4288
+ </xsl:element>
4289
+ </xsl:variable>
4290
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
4291
+ <xsl:variable name="colwidths">
4292
+ <xsl:call-template name="calculate-column-widths">
4293
+ <xsl:with-param name="cols-count" select="2"/>
4294
+ <xsl:with-param name="table" select="$html-table"/>
4295
+ </xsl:call-template>
4296
+ </xsl:variable>
4297
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4298
+ <xsl:variable name="maxlength_dt">
4299
+ <xsl:call-template name="getMaxLength_dt"/>
4300
+ </xsl:variable>
4301
+ <xsl:call-template name="setColumnWidth_dl">
4302
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4303
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4304
+ </xsl:call-template>
4018
4305
  <fo:table-body>
4019
4306
  <xsl:apply-templates>
4020
4307
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -4024,6 +4311,60 @@
4024
4311
  </fo:block>
4025
4312
  </fo:block>
4026
4313
  </xsl:if>
4314
+ </xsl:template><xsl:template name="setColumnWidth_dl">
4315
+ <xsl:param name="colwidths"/>
4316
+ <xsl:param name="maxlength_dt"/>
4317
+ <xsl:choose>
4318
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4319
+ <fo:table-column column-width="50%"/>
4320
+ <fo:table-column column-width="50%"/>
4321
+ </xsl:when>
4322
+ <xsl:otherwise>
4323
+ <xsl:choose>
4324
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4325
+ <fo:table-column column-width="5%"/>
4326
+ <fo:table-column column-width="95%"/>
4327
+ </xsl:when>
4328
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
4329
+ <fo:table-column column-width="10%"/>
4330
+ <fo:table-column column-width="90%"/>
4331
+ </xsl:when>
4332
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
4333
+ <fo:table-column column-width="60%"/>
4334
+ <fo:table-column column-width="40%"/>
4335
+ </xsl:when> -->
4336
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
4337
+ <fo:table-column column-width="50%"/>
4338
+ <fo:table-column column-width="50%"/>
4339
+ </xsl:when>
4340
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
4341
+ <fo:table-column column-width="40%"/>
4342
+ <fo:table-column column-width="60%"/>
4343
+ </xsl:when>
4344
+ <xsl:otherwise>
4345
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4346
+ <xsl:choose>
4347
+ <xsl:when test=". = 1 or . = 0">
4348
+ <fo:table-column column-width="proportional-column-width(2)"/>
4349
+ </xsl:when>
4350
+ <xsl:otherwise>
4351
+ <fo:table-column column-width="proportional-column-width({.})"/>
4352
+ </xsl:otherwise>
4353
+ </xsl:choose>
4354
+ </xsl:for-each>
4355
+ </xsl:otherwise>
4356
+ </xsl:choose>
4357
+ <!-- <fo:table-column column-width="15%"/>
4358
+ <fo:table-column column-width="85%"/> -->
4359
+ </xsl:otherwise>
4360
+ </xsl:choose>
4361
+ </xsl:template><xsl:template name="getMaxLength_dt">
4362
+ <xsl:for-each select="*[local-name()='dt']">
4363
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
4364
+ <xsl:if test="position() = 1">
4365
+ <xsl:value-of select="string-length(normalize-space(.))"/>
4366
+ </xsl:if>
4367
+ </xsl:for-each>
4027
4368
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
4028
4369
  <xsl:param name="key_iso"/>
4029
4370
 
@@ -4040,6 +4381,11 @@
4040
4381
  <xsl:if test="normalize-space($key_iso) = 'true'">
4041
4382
  <xsl:attribute name="margin-top">0</xsl:attribute>
4042
4383
  </xsl:if>
4384
+ <xsl:variable name="title-note">
4385
+ <xsl:call-template name="getTitle">
4386
+ <xsl:with-param name="name" select="'title-note'"/>
4387
+ </xsl:call-template>
4388
+ </xsl:variable>
4043
4389
  <xsl:value-of select="$title-note"/>
4044
4390
  </fo:block>
4045
4391
  </fo:table-cell>
@@ -4083,7 +4429,11 @@
4083
4429
 
4084
4430
 
4085
4431
  <xsl:apply-templates/>
4086
-
4432
+ <!-- <xsl:if test="$namespace = 'gb'">
4433
+ <xsl:if test="ancestor::*[local-name()='formula']">
4434
+ <xsl:text>—</xsl:text>
4435
+ </xsl:if>
4436
+ </xsl:if> -->
4087
4437
  </fo:block>
4088
4438
  </fo:table-cell>
4089
4439
  <fo:table-cell>
@@ -4139,7 +4489,8 @@
4139
4489
  </xsl:template><xsl:template name="recursiveSmallCaps">
4140
4490
  <xsl:param name="text"/>
4141
4491
  <xsl:variable name="char" select="substring($text,1,1)"/>
4142
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4492
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4493
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
4143
4494
  <xsl:choose>
4144
4495
  <xsl:when test="$char=$upperCase">
4145
4496
  <fo:inline font-size="{100 div 0.75}%">
@@ -4422,18 +4773,28 @@
4422
4773
  <xsl:choose>
4423
4774
  <xsl:when test="contains($str2, ' ')">
4424
4775
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
4425
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4426
- <xsl:value-of select="substring($substr, 2)"/>
4776
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4777
+ <xsl:value-of select="substring($substr, 2)"/> -->
4778
+ <xsl:call-template name="capitalize">
4779
+ <xsl:with-param name="str" select="$substr"/>
4780
+ </xsl:call-template>
4427
4781
  <xsl:text> </xsl:text>
4428
4782
  <xsl:call-template name="capitalizeWords">
4429
4783
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
4430
4784
  </xsl:call-template>
4431
4785
  </xsl:when>
4432
4786
  <xsl:otherwise>
4433
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4434
- <xsl:value-of select="substring($str2, 2)"/>
4787
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4788
+ <xsl:value-of select="substring($str2, 2)"/> -->
4789
+ <xsl:call-template name="capitalize">
4790
+ <xsl:with-param name="str" select="$str2"/>
4791
+ </xsl:call-template>
4435
4792
  </xsl:otherwise>
4436
4793
  </xsl:choose>
4794
+ </xsl:template><xsl:template name="capitalize">
4795
+ <xsl:param name="str"/>
4796
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4797
+ <xsl:value-of select="substring($str, 2)"/>
4437
4798
  </xsl:template><xsl:template match="mathml:math">
4438
4799
  <fo:inline font-family="STIX2Math">
4439
4800
  <fo:instream-foreign-object fox:alt-text="Math">
@@ -4491,6 +4852,11 @@
4491
4852
  <fo:inline id="{@id}"/>
4492
4853
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4493
4854
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4855
+ <xsl:variable name="title-appendix">
4856
+ <xsl:call-template name="getTitle">
4857
+ <xsl:with-param name="name" select="'title-appendix'"/>
4858
+ </xsl:call-template>
4859
+ </xsl:variable>
4494
4860
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4495
4861
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4496
4862
  </fo:block>
@@ -4500,6 +4866,11 @@
4500
4866
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4501
4867
  <fo:block xsl:use-attribute-sets="appendix-example-style">
4502
4868
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4869
+ <xsl:variable name="title-example">
4870
+ <xsl:call-template name="getTitle">
4871
+ <xsl:with-param name="name" select="'title-example'"/>
4872
+ </xsl:call-template>
4873
+ </xsl:variable>
4503
4874
  <xsl:value-of select="$title-example"/>
4504
4875
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4505
4876
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -4530,6 +4901,17 @@
4530
4901
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4531
4902
  <xsl:apply-templates/>
4532
4903
  </fo:inline>
4904
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4905
+ <xsl:variable name="title-modified">
4906
+ <xsl:call-template name="getTitle">
4907
+ <xsl:with-param name="name" select="'title-modified'"/>
4908
+ </xsl:call-template>
4909
+ </xsl:variable>
4910
+ <xsl:choose>
4911
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4912
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4913
+ </xsl:choose>
4914
+ <xsl:apply-templates/>
4533
4915
  </xsl:template><xsl:template name="convertDate">
4534
4916
  <xsl:param name="date"/>
4535
4917
  <xsl:param name="format" select="'short'"/>
@@ -4594,4 +4976,107 @@
4594
4976
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4595
4977
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4596
4978
  </xsl:choose>
4979
+ </xsl:template><xsl:template name="addPDFUAmeta">
4980
+ <fo:declarations>
4981
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4982
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4983
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4984
+ </pdf:dictionary>
4985
+ </pdf:catalog>
4986
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4987
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4988
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4989
+ <!-- Dublin Core properties go here -->
4990
+ <dc:title>
4991
+ <xsl:variable name="title">
4992
+
4993
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4994
+
4995
+
4996
+
4997
+
4998
+ </xsl:variable>
4999
+ <xsl:choose>
5000
+ <xsl:when test="normalize-space($title) != ''">
5001
+ <xsl:value-of select="$title"/>
5002
+ </xsl:when>
5003
+ <xsl:otherwise>
5004
+ <xsl:text> </xsl:text>
5005
+ </xsl:otherwise>
5006
+ </xsl:choose>
5007
+ </dc:title>
5008
+ <dc:creator>
5009
+
5010
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
5011
+
5012
+
5013
+ </dc:creator>
5014
+ <dc:description>
5015
+ <xsl:variable name="abstract">
5016
+
5017
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
5018
+
5019
+
5020
+
5021
+
5022
+ </xsl:variable>
5023
+ <xsl:value-of select="normalize-space($abstract)"/>
5024
+ </dc:description>
5025
+ <pdf:Keywords>
5026
+ <xsl:call-template name="insertKeywords"/>
5027
+ </pdf:Keywords>
5028
+ </rdf:Description>
5029
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5030
+ <!-- XMP properties go here -->
5031
+ <xmp:CreatorTool/>
5032
+ </rdf:Description>
5033
+ </rdf:RDF>
5034
+ </x:xmpmeta>
5035
+ </fo:declarations>
5036
+ </xsl:template><xsl:template name="getId">
5037
+ <xsl:choose>
5038
+ <xsl:when test="../@id">
5039
+ <xsl:value-of select="../@id"/>
5040
+ </xsl:when>
5041
+ <xsl:otherwise>
5042
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
5043
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
5044
+ </xsl:otherwise>
5045
+ </xsl:choose>
5046
+ </xsl:template><xsl:template name="getLevel">
5047
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
5048
+ <xsl:variable name="level">
5049
+ <xsl:choose>
5050
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
5051
+ <xsl:value-of select="$level_total - 2"/>
5052
+ </xsl:when>
5053
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
5054
+ <xsl:value-of select="$level_total - 2"/>
5055
+ </xsl:when>
5056
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
5057
+ <xsl:value-of select="$level_total - 2"/>
5058
+ </xsl:when>
5059
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
5060
+ <xsl:otherwise>
5061
+ <xsl:value-of select="$level_total - 1"/>
5062
+ </xsl:otherwise>
5063
+ </xsl:choose>
5064
+ </xsl:variable>
5065
+ <xsl:value-of select="$level"/>
5066
+ </xsl:template><xsl:template name="getSubSection">
5067
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
5068
+ </xsl:template><xsl:template name="split">
5069
+ <xsl:param name="pText" select="."/>
5070
+ <xsl:param name="sep" select="','"/>
5071
+ <xsl:if test="string-length($pText) &gt;0">
5072
+ <item>
5073
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
5074
+ </item>
5075
+ <xsl:call-template name="split">
5076
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
5077
+ <xsl:with-param name="sep" select="$sep"/>
5078
+ </xsl:call-template>
5079
+ </xsl:if>
5080
+ </xsl:template><xsl:template name="getDocumentId">
5081
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4597
5082
  </xsl:template></xsl:stylesheet>