metanorma-nist 1.2.6 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +29 -8
  3. data/.github/workflows/release.yml +36 -0
  4. data/README.adoc +23 -7
  5. data/lib/asciidoctor/nist/basicdoc.rng +50 -3
  6. data/lib/asciidoctor/nist/boilerplate.rb +3 -1
  7. data/lib/asciidoctor/nist/cleanup.rb +2 -1
  8. data/lib/asciidoctor/nist/converter.rb +3 -0
  9. data/lib/asciidoctor/nist/front.rb +36 -45
  10. data/lib/asciidoctor/nist/front_id.rb +18 -7
  11. data/lib/asciidoctor/nist/isodoc.rng +61 -3
  12. data/lib/asciidoctor/nist/nist.rng +1 -0
  13. data/lib/asciidoctor/nist/validate.rb +17 -6
  14. data/lib/isodoc/nist/base_convert.rb +2 -3
  15. data/lib/isodoc/nist/fonts_manifest.yaml +4 -0
  16. data/lib/isodoc/nist/html/header_cswp.html +2 -3
  17. data/lib/isodoc/nist/html/htmlstyle.css +221 -221
  18. data/lib/isodoc/nist/html/htmlstyle.scss +5 -6
  19. data/lib/isodoc/nist/html/nist.css +49 -50
  20. data/lib/isodoc/nist/html/nist.scss +49 -50
  21. data/lib/isodoc/nist/html/nist_cswp.css +48 -49
  22. data/lib/isodoc/nist/html/nist_cswp.scss +48 -49
  23. data/lib/isodoc/nist/html/wordstyle.css +42 -42
  24. data/lib/isodoc/nist/html/wordstyle.scss +42 -42
  25. data/lib/isodoc/nist/html/wordstyle_cswp.css +52 -52
  26. data/lib/isodoc/nist/html/wordstyle_cswp.scss +52 -52
  27. data/lib/isodoc/nist/html_convert.rb +12 -1
  28. data/lib/isodoc/nist/metadata.rb +28 -40
  29. data/lib/isodoc/nist/metadata_id.rb +3 -7
  30. data/lib/isodoc/nist/nist.cswp.xsl +319 -154
  31. data/lib/isodoc/nist/nist.sp.xsl +316 -190
  32. data/lib/isodoc/nist/presentation_xml_convert.rb +30 -10
  33. data/lib/isodoc/nist/refs.rb +6 -20
  34. data/lib/isodoc/nist/render.rb +42 -40
  35. data/lib/isodoc/nist/render_dates.rb +8 -9
  36. data/lib/isodoc/nist/word_convert.rb +9 -3
  37. data/lib/isodoc/nist/xref.rb +11 -5
  38. data/lib/metanorma/nist/processor.rb +14 -8
  39. data/lib/metanorma/nist/version.rb +1 -1
  40. data/metanorma-nist.gemspec +2 -2
  41. metadata +8 -6
@@ -25,7 +25,10 @@ module IsoDoc
25
25
  '"Libre Baskerville",serif'),
26
26
  headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
27
27
  '"Libre Baskerville",serif'),
28
- monospacefont: '"Space Mono",monospace'
28
+ monospacefont: '"Space Mono",monospace',
29
+ normalfontsize: "14px",
30
+ footnotefontsize: "0.9em",
31
+ monospacefontsize: "0.8em",
29
32
  }
30
33
  end
31
34
 
@@ -46,6 +49,14 @@ module IsoDoc
46
49
  HEAD
47
50
  end
48
51
 
52
+ def html_head()
53
+ super + <<~HEAD.freeze
54
+ <link rel="stylesheet" href="https://pages.nist.gov/nist-header-footer/css/nist-combined.css">
55
+ <script src="https://pages.nist.gov/nist-header-footer/js/jquery-1.9.0.min.js" type="text/javascript" defer="defer"></script>
56
+ <script src="https://pages.nist.gov/nist-header-footer/js/nist-header-footer.js" type="text/javascript" defer="defer"></script>
57
+ HEAD
58
+ end
59
+
49
60
  def toclevel
50
61
  ret = toclevel_classes.map do |l|
51
62
  "#{l}:not(:empty):not(.TermNum):not(.noTOC):not(.AbstractTitle):"\
@@ -9,11 +9,9 @@ module IsoDoc
9
9
  super
10
10
  here = File.dirname(__FILE__)
11
11
  set(:logo_nist, File.expand_path(File.join(here, "html", "logo.png")))
12
- set(:logo_cswp,
13
- File.expand_path(File.join(here, "html", "logo_cswp.png")))
12
+ set(:logo_cswp, File.expand_path(File.join(here, "html", "logo_cswp.png")))
14
13
  set(:logo_commerce,
15
- File.expand_path(File.join(here, "html",
16
- "commerce-logo-color.png")))
14
+ File.expand_path(File.join(here, "html", "commerce-logo-color.png")))
17
15
  set(:logo_commerce_word,
18
16
  File.expand_path(File.join(here, "html", "deptofcommerce.png")))
19
17
  end
@@ -57,12 +55,9 @@ module IsoDoc
57
55
  ixml.xpath(ns("//bibdata/date")).each do |d|
58
56
  val = Common::date_range(d)
59
57
  next if val == "XXX"
60
- set("#{d['type']}date_monthyear".to_sym,
61
- daterange_proc(val, :monthyr))
62
- set("#{d['type']}date_mmddyyyy".to_sym,
63
- daterange_proc(val, :mmddyyyy))
64
- set("#{d['type']}date_MMMddyyyy".to_sym,
65
- daterange_proc(val, :MMMddyyyy))
58
+ set("#{d['type']}date_monthyear".to_sym, daterange_proc(val, :monthyr))
59
+ set("#{d['type']}date_mmddyyyy".to_sym, daterange_proc(val, :mmddyyyy))
60
+ set("#{d['type']}date_MMMddyyyy".to_sym, daterange_proc(val, :MMMddyyyy))
66
61
  end
67
62
  withdrawal_pending(ixml)
68
63
  most_recent_date(ixml)
@@ -101,13 +96,18 @@ module IsoDoc
101
96
  end
102
97
 
103
98
  def series(ixml, _out)
104
- series = ixml.at(ns("//bibdata/series[@type = 'main']/title"))&.text and
105
- set(:series, series)
106
- seriesabbr =
107
- ixml.at(ns("//bibdata/series[@type = 'main']/abbreviation"))&.text
99
+ series = ixml.at(ns("//bibdata/series[@type = 'main']/title"))&.text and set(:series, series)
100
+ seriesabbr = ixml.at(ns("//bibdata/series[@type = 'main']/abbreviation"))&.text
108
101
  set(:seriesabbr, seriesabbr) if seriesabbr
109
- subs = ixml.at(ns("//bibdata/series[@type = 'secondary']/"\
110
- "title"))&.text and set(:subseries, subs)
102
+ subs = ixml.at(ns("//bibdata/series[@type = 'secondary']/title"))&.text
103
+ abbr = ixml.at(ns("//bibdata/series[@type = 'secondary']/abbreviation"))&.text
104
+ if (seriesabbr == "NIST CSTS")
105
+ subs and set(:series, subs)
106
+ abbr and set(:seriesabbr, abbr)
107
+ else
108
+ subs and set(:subseries, subs)
109
+ abbr and set(:subseriesabbr, abbr)
110
+ end
111
111
  end
112
112
 
113
113
  def mmddyyyy(isodate)
@@ -129,8 +129,7 @@ module IsoDoc
129
129
  super
130
130
  a = xml.at(ns("//bibdata/uri[@type = 'email']")) and set(:email, a.text)
131
131
  a = xml.at(ns("//bibdata/uri[@type = 'doi']")) and set(:doi, a.text)
132
- a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and
133
- set(:url, a.text)
132
+ a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and set(:url, a.text)
134
133
  end
135
134
 
136
135
  def relations1(ixml, type)
@@ -157,35 +156,28 @@ module IsoDoc
157
156
  def superseding_doc(ixml)
158
157
  d = ixml.at(ns("//bibdata/relation[@type = 'obsoletedBy']/bibitem"))
159
158
  return unless d
160
- set(:superseding_status,
161
- status_print(d.at(ns("./status/stage"))&.text || "final"))
159
+ set(:superseding_status, status_print(d.at(ns("./status/stage"))&.text || "final"))
162
160
  superseding_iteration(d)
163
161
  docid = d.at(ns("./docidentifier[@type = 'NIST']"))&.text and
164
162
  set(:superseding_docidentifier, docid)
165
163
  docid_long = d.at(ns("./docidentifier[@type = 'nist-long']"))&.text and
166
164
  set(:superseding_docidentifier_long, docid_long)
167
165
  superseding_dates(d)
168
- doi = d.at(ns("./uri[@type = 'doi']"))&.text and
169
- set(:superseding_doi, doi)
170
- uri = d.at(ns("./uri[@type = 'uri']"))&.text and
171
- set(:superseding_uri, uri)
166
+ doi = d.at(ns("./uri[@type = 'doi']"))&.text and set(:superseding_doi, doi)
167
+ uri = d.at(ns("./uri[@type = 'uri']"))&.text and set(:superseding_uri, uri)
172
168
  superseding_titles(ixml, d)
173
169
  authors = d.xpath(ns("./contributor[role/@type = 'author']/person"))
174
- authors.empty? and authors =
175
- ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
170
+ authors.empty? and authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
176
171
  set(:superseding_authors, extract_person_names(authors))
177
172
  end
178
173
 
179
174
  def superseding_titles(ixml, d)
180
175
  if title = d.at(ns("./title[@type = 'main']"))&.text
181
176
  set(:superseding_title, d.at(ns("./title[@type = 'main']"))&.text)
182
- set(:superseding_subtitle,
183
- d.at(ns("./title[@type = 'subtitle']"))&.text)
177
+ set(:superseding_subtitle, d.at(ns("./title[@type = 'subtitle']"))&.text)
184
178
  else
185
- set(:superseding_title,
186
- ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
187
- set(:superseding_subtitle,
188
- ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
179
+ set(:superseding_title, ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
180
+ set(:superseding_subtitle, ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
189
181
  end
190
182
  end
191
183
 
@@ -200,8 +192,7 @@ module IsoDoc
200
192
  set(:superseding_iteration_ordinal, "Final")
201
193
  set(:superseding_iteration_code, "FPD")
202
194
  else
203
- set(:superseding_iteration_ordinal,
204
- iter.to_i.localize.to_rbnf_s("SpelloutRules", "spellout-ordinal"))
195
+ set(:superseding_iteration_ordinal, iter.to_i.localize.to_rbnf_s("SpelloutRules", "spellout-ordinal"))
205
196
  set(:superseding_iteration_code, "#{iter}PD")
206
197
  end
207
198
  end
@@ -223,12 +214,9 @@ module IsoDoc
223
214
  end
224
215
 
225
216
  def note(xml, _out)
226
- note = xml.at(ns("//bibdata/note[@type = 'additional-note']"))&.text and
227
- set(:additional_note, note)
228
- note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and
229
- set(:withdrawal_note, note)
230
- note = xml.at(ns("//bibdata/note[@type = "\
231
- "'withdrawal-announcement-link']"))&.text and
217
+ note = xml.at(ns("//bibdata/note[@type = 'additional-note']"))&.text and set(:additional_note, note)
218
+ note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and set(:withdrawal_note, note)
219
+ note = xml.at(ns("//bibdata/note[@type = 'withdrawal-announcement-link']"))&.text and
232
220
  set(:withdrawal_announcement_link, note)
233
221
  super
234
222
  end
@@ -73,8 +73,7 @@ module IsoDoc
73
73
 
74
74
  def docid(ixml, _out)
75
75
  docid = ixml.at(ns("//bibdata/docidentifier[@type = 'NIST']"))&.text
76
- docid_long = ixml.at(ns("//bibdata/docidentifier"\
77
- "[@type = 'nist-long']"))&.text
76
+ docid_long = ixml.at(ns("//bibdata/docidentifier[@type = 'nist-long']"))&.text
78
77
  set(:docidentifier, docid)
79
78
  set(:docidentifier_long, docid_long)
80
79
  set(:docidentifier_undated, stripdate(docid))
@@ -86,8 +85,7 @@ module IsoDoc
86
85
 
87
86
  def stripdate(id)
88
87
  return if id.nil?
89
- id.sub(/ \((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[^)]+\)$/,
90
- "")
88
+ id.sub(/ \((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[^)]+\)$/, "")
91
89
  end
92
90
 
93
91
  def draft_prefix(ixml)
@@ -117,9 +115,7 @@ module IsoDoc
117
115
 
118
116
  def draftinfo(draft, revdate)
119
117
  draftinfo = ""
120
- if draft
121
- draftinfo = " #{@labels["draft_label"]} #{draft}"
122
- end
118
+ draft and draftinfo = " #{@labels["draft_label"]} #{draft}"
123
119
  @i18n.l10n(draftinfo, @lang, @script)
124
120
  end
125
121
  end
@@ -151,19 +151,35 @@
151
151
  <xsl:for-each select="/nist:nist-standard/nist:bibdata/nist:contributor[nist:role/@type = 'author']">
152
152
  <xsl:value-of select="nist:person/nist:name/nist:completename"/>
153
153
  <xsl:variable name="org-name" select="nist:person/nist:affiliation/nist:organization/nist:name"/>
154
+ <xsl:variable name="subdivision">
155
+ <xsl:for-each select="nist:person/nist:affiliation/nist:organization/nist:subdivision">
156
+ <xsl:value-of select="."/>
157
+ <xsl:if test="position() != last()">, </xsl:if>
158
+ </xsl:for-each>
159
+ </xsl:variable>
160
+ <xsl:variable name="following_subdivision">
161
+ <xsl:for-each select="following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:subdivision">
162
+ <xsl:value-of select="."/>
163
+ <xsl:if test="position() != last()">, </xsl:if>
164
+ </xsl:for-each>
165
+ </xsl:variable>
154
166
  <xsl:variable name="org-address" select="nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress"/>
155
- <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $org-address)">
156
-
157
- <xsl:for-each select="xalan:tokenize($org-name, ',')">
167
+ <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, $following_subdivision, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $subdivision, $org-address)">
168
+ <!-- <xsl:for-each select="xalan:tokenize($org-name, ',')">
158
169
  <fo:block>
159
170
  <fo:inline font-style="italic">
160
171
  <xsl:value-of select="."/>
161
- <!-- <xsl:if test="normalize-space($org-address) != ''">
162
- <fo:inline>, <xsl:value-of select="$org-address"/></fo:inline>
163
- </xsl:if> -->
164
172
  </fo:inline>
165
173
  </fo:block>
166
- </xsl:for-each>
174
+ </xsl:for-each> -->
175
+ <fo:block font-style="italic">
176
+ <xsl:value-of select="$org-name"/>
177
+ </fo:block>
178
+ <xsl:if test="normalize-space($subdivision) != ''">
179
+ <fo:block font-style="italic">
180
+ <xsl:value-of select="$subdivision"/>
181
+ </fo:block>
182
+ </xsl:if>
167
183
 
168
184
  <xsl:if test="normalize-space($org-address) != ''">
169
185
  <fo:block>
@@ -558,30 +574,23 @@
558
574
  <!-- Bibliography -->
559
575
  <!-- ============================= -->
560
576
 
561
-
562
- <!-- Example: [ITU-T A.23] ITU-T A.23, Recommendation ITU-T A.23, Annex A (2014), Guide for ITU-T and ISO/IEC JTC 1 cooperation. -->
577
+ <!-- Examples:
578
+ [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
579
+ [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
580
+ -->
563
581
  <xsl:template match="nist:bibitem">
564
-
565
582
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
566
583
  <fo:list-item>
567
584
  <fo:list-item-label end-indent="label-end()">
568
585
  <fo:block>
569
586
  <fo:inline id="{@id}">
570
587
  <!-- <xsl:number format="[1]"/> -->
571
- <xsl:value-of select="nist:docidentifier"/>
588
+ <xsl:value-of select="nist:docidentifier[@display = 'true']"/>
572
589
  </fo:inline>
573
590
  </fo:block>
574
591
  </fo:list-item-label>
575
592
  <fo:list-item-body start-indent="body-start()">
576
593
  <fo:block>
577
- <xsl:choose>
578
- <xsl:when test="nist:title[@type = 'main' and @language = 'en']">
579
- <xsl:apply-templates select="nist:title[@type = 'main' and @language = 'en']"/>
580
- </xsl:when>
581
- <xsl:otherwise>
582
- <xsl:apply-templates select="nist:title"/>
583
- </xsl:otherwise>
584
- </xsl:choose>
585
594
  <xsl:apply-templates select="nist:formattedref"/>
586
595
  </fo:block>
587
596
  </fo:list-item-body>
@@ -589,6 +598,9 @@
589
598
  </fo:list-block>
590
599
  </xsl:template>
591
600
 
601
+ <xsl:template match="nist:formattedref">
602
+ <xsl:apply-templates/>
603
+ </xsl:template>
592
604
  <!-- ============================= -->
593
605
  <!-- ============================= -->
594
606
 
@@ -618,6 +630,11 @@
618
630
  </fo:block>
619
631
  </xsl:template>
620
632
 
633
+ <xsl:template match="nist:references">
634
+ <fo:block id="{@id}">
635
+ <xsl:apply-templates/>
636
+ </fo:block>
637
+ </xsl:template>
621
638
  <xsl:template match="nist:references/nist:title">
622
639
  <fo:block-container color="white" background-color="{$color}" margin-bottom="12pt" keep-with-next="always" height="5mm" margin-left="-0.5mm" margin-right="-0.5mm">
623
640
  <fo:block font-family="Arial" font-size="12pt" font-weight="bold" margin-left="1mm" padding-top="0.3mm">
@@ -685,14 +702,14 @@
685
702
  </xsl:variable>
686
703
  <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
687
704
  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
688
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
705
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
689
706
  </fo:basic-link>
690
707
  </fo:inline>
691
708
  <fo:footnote-body>
692
709
  <fo:block-container margin-left="3mm">
693
710
  <fo:block font-size="9pt" font-family="Times New Roman" font-style="normal" font-weight="normal" margin-left="-3mm" margin-top="6pt" margin-bottom="12pt" start-indent="0mm" text-indent="-2mm" line-height="10pt" page-break-inside="avoid">
694
711
  <fo:inline id="footnote_{@reference}_{$number}" font-size="75%" keep-with-next.within-line="always" vertical-align="super" padding-right="1mm"> <!-- alignment-baseline="hanging" -->
695
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
712
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
696
713
  </fo:inline>
697
714
  <xsl:for-each select="nist:p">
698
715
  <xsl:apply-templates/>
@@ -725,78 +742,6 @@
725
742
  </xsl:template>
726
743
 
727
744
 
728
- <!-- Examples:
729
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
730
- [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
731
- -->
732
- <xsl:template match="nist:annex//nist:bibitem">
733
- <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
734
- <xsl:if test="nist:formattedref">
735
- <xsl:choose>
736
- <xsl:when test="nist:docidentifier[@type = 'metanorma']">
737
- <xsl:attribute name="margin-left">0</xsl:attribute>
738
- <xsl:attribute name="text-indent">0</xsl:attribute>
739
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
740
- <!-- create list -->
741
- <fo:list-block>
742
- <fo:list-item>
743
- <fo:list-item-label end-indent="label-end()">
744
- <fo:block>
745
- <xsl:apply-templates select="nist:docidentifier[@type = 'metanorma']" mode="process"/>
746
- </fo:block>
747
- </fo:list-item-label>
748
- <fo:list-item-body start-indent="body-start()">
749
- <fo:block margin-left="3mm">
750
- <xsl:apply-templates select="nist:formattedref"/>
751
- </fo:block>
752
- </fo:list-item-body>
753
- </fo:list-item>
754
- </fo:list-block>
755
- </xsl:when>
756
- <xsl:otherwise>
757
- <xsl:apply-templates select="nist:formattedref"/>
758
- <xsl:apply-templates select="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
759
- </xsl:otherwise>
760
- </xsl:choose>
761
-
762
-
763
- </xsl:if>
764
- <xsl:if test="nist:title">
765
- <xsl:for-each select="nist:contributor">
766
- <xsl:value-of select="nist:organization/nist:name"/>
767
- <xsl:if test="position() != last()">, </xsl:if>
768
- </xsl:for-each>
769
- <xsl:text> (</xsl:text>
770
-
771
- <xsl:value-of select="$date"/>
772
- <xsl:text>) </xsl:text>
773
- <fo:inline font-style="italic"><xsl:value-of select="nist:title"/></fo:inline>
774
- <xsl:if test="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name">
775
- <xsl:text> (</xsl:text><xsl:value-of select="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name"/><xsl:text>)</xsl:text>
776
- </xsl:if>
777
- <xsl:text>, </xsl:text>
778
- <xsl:value-of select="$date"/>
779
- <xsl:text>. </xsl:text>
780
- <xsl:value-of select="nist:docidentifier"/>
781
- <xsl:value-of select="$linebreak"/>
782
- <xsl:value-of select="nist:uri"/>
783
- </xsl:if>
784
- </fo:block>
785
- </xsl:template>
786
-
787
- <xsl:template match="nist:annex//nist:bibitem//nist:formattedref">
788
- <xsl:apply-templates/>
789
- </xsl:template>
790
-
791
- <xsl:template match="nist:docidentifier[@type = 'metanorma']" mode="process">
792
- <xsl:apply-templates/>
793
- </xsl:template>
794
- <xsl:template match="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
795
- <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
796
- </xsl:template>
797
- <xsl:template match="nist:docidentifier"/>
798
-
799
-
800
745
  <xsl:template match="nist:ul | nist:ol" mode="ul_ol">
801
746
  <fo:list-block>
802
747
  <xsl:apply-templates/>
@@ -849,7 +794,7 @@
849
794
  <xsl:number format="1."/>
850
795
  </xsl:when>
851
796
  <xsl:when test="../@type = 'arabic'">
852
- <xsl:number format="a)"/>
797
+ <xsl:number format="a)" lang="en"/>
853
798
  </xsl:when>
854
799
  <xsl:when test="../@type = 'alphabet'">
855
800
  <xsl:number format="1)"/>
@@ -857,7 +802,7 @@
857
802
  <xsl:when test="ancestor::*[nist:annex]">
858
803
  <xsl:choose>
859
804
  <xsl:when test="$level = 1">
860
- <xsl:number format="a)"/>
805
+ <xsl:number format="a)" lang="en"/>
861
806
  </xsl:when>
862
807
  <xsl:when test="$level = 2">
863
808
  <xsl:number format="i)"/>
@@ -1142,13 +1087,22 @@
1142
1087
  <title-part lang="en">
1143
1088
 
1144
1089
 
1090
+
1145
1091
  </title-part>
1146
1092
  <title-part lang="fr">
1147
1093
 
1148
1094
 
1095
+
1149
1096
  </title-part>
1150
1097
  <title-part lang="zh">第 # 部分:</title-part>
1151
1098
 
1099
+ <title-subpart lang="en">
1100
+
1101
+ </title-subpart>
1102
+ <title-subpart lang="fr">
1103
+
1104
+ </title-subpart>
1105
+
1152
1106
  <title-modified lang="en">modified</title-modified>
1153
1107
  <title-modified lang="fr">modifiée</title-modified>
1154
1108
 
@@ -1448,6 +1402,7 @@
1448
1402
 
1449
1403
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1450
1404
 
1405
+
1451
1406
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1452
1407
 
1453
1408
 
@@ -1472,6 +1427,7 @@
1472
1427
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1473
1428
 
1474
1429
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1430
+
1475
1431
 
1476
1432
 
1477
1433
 
@@ -1590,7 +1546,9 @@
1590
1546
 
1591
1547
 
1592
1548
 
1593
-
1549
+ <!-- <xsl:if test="$namespace = 'bipm'">
1550
+ <fo:block>&#xA0;</fo:block>
1551
+ </xsl:if> -->
1594
1552
 
1595
1553
  <!-- $namespace = 'iso' or -->
1596
1554
 
@@ -1622,10 +1580,12 @@
1622
1580
 
1623
1581
 
1624
1582
  <xsl:variable name="colwidths">
1625
- <xsl:call-template name="calculate-column-widths">
1626
- <xsl:with-param name="cols-count" select="$cols-count"/>
1627
- <xsl:with-param name="table" select="$simple-table"/>
1628
- </xsl:call-template>
1583
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1584
+ <xsl:call-template name="calculate-column-widths">
1585
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1586
+ <xsl:with-param name="table" select="$simple-table"/>
1587
+ </xsl:call-template>
1588
+ </xsl:if>
1629
1589
  </xsl:variable>
1630
1590
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1631
1591
 
@@ -1676,7 +1636,12 @@
1676
1636
 
1677
1637
  <xsl:variable name="table_attributes">
1678
1638
  <attribute name="table-layout">fixed</attribute>
1679
- <attribute name="width">100%</attribute>
1639
+ <attribute name="width">
1640
+ <xsl:choose>
1641
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1642
+ <xsl:otherwise>100%</xsl:otherwise>
1643
+ </xsl:choose>
1644
+ </attribute>
1680
1645
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1681
1646
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1682
1647
 
@@ -1705,16 +1670,25 @@
1705
1670
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1706
1671
  </xsl:if>
1707
1672
 
1708
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1709
- <xsl:choose>
1710
- <xsl:when test=". = 1 or . = 0">
1711
- <fo:table-column column-width="proportional-column-width(2)"/>
1712
- </xsl:when>
1713
- <xsl:otherwise>
1714
- <fo:table-column column-width="proportional-column-width({.})"/>
1715
- </xsl:otherwise>
1716
- </xsl:choose>
1717
- </xsl:for-each>
1673
+ <xsl:choose>
1674
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1675
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1676
+ <fo:table-column column-width="{@width}"/>
1677
+ </xsl:for-each>
1678
+ </xsl:when>
1679
+ <xsl:otherwise>
1680
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1681
+ <xsl:choose>
1682
+ <xsl:when test=". = 1 or . = 0">
1683
+ <fo:table-column column-width="proportional-column-width(2)"/>
1684
+ </xsl:when>
1685
+ <xsl:otherwise>
1686
+ <fo:table-column column-width="proportional-column-width({.})"/>
1687
+ </xsl:otherwise>
1688
+ </xsl:choose>
1689
+ </xsl:for-each>
1690
+ </xsl:otherwise>
1691
+ </xsl:choose>
1718
1692
 
1719
1693
  <xsl:choose>
1720
1694
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -1727,10 +1701,12 @@
1727
1701
 
1728
1702
  </fo:table>
1729
1703
 
1704
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1730
1705
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1731
1706
  <xsl:call-template name="insertTableFooterInSeparateTable">
1732
1707
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
1733
1708
  <xsl:with-param name="colwidths" select="$colwidths"/>
1709
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1734
1710
  </xsl:call-template>
1735
1711
  </xsl:for-each>
1736
1712
 
@@ -1763,6 +1739,7 @@
1763
1739
  <xsl:if test="normalize-space() != ''">
1764
1740
  <fo:block xsl:use-attribute-sets="table-name-style">
1765
1741
 
1742
+
1766
1743
  <xsl:apply-templates/>
1767
1744
  </fo:block>
1768
1745
  </xsl:if>
@@ -1983,12 +1960,22 @@
1983
1960
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1984
1961
  <xsl:param name="table_attributes"/>
1985
1962
  <xsl:param name="colwidths"/>
1963
+ <xsl:param name="colgroup"/>
1986
1964
 
1987
1965
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1988
1966
 
1989
1967
  <xsl:if test="$isNoteOrFnExist = 'true'">
1990
1968
 
1991
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1969
+ <xsl:variable name="cols-count">
1970
+ <xsl:choose>
1971
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1972
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1973
+ </xsl:when>
1974
+ <xsl:otherwise>
1975
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1976
+ </xsl:otherwise>
1977
+ </xsl:choose>
1978
+ </xsl:variable>
1992
1979
 
1993
1980
  <fo:table keep-with-previous="always">
1994
1981
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -2006,16 +1993,25 @@
2006
1993
  </xsl:choose>
2007
1994
  </xsl:for-each>
2008
1995
 
2009
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2010
- <xsl:choose>
2011
- <xsl:when test=". = 1 or . = 0">
2012
- <fo:table-column column-width="proportional-column-width(2)"/>
2013
- </xsl:when>
2014
- <xsl:otherwise>
2015
- <fo:table-column column-width="proportional-column-width({.})"/>
2016
- </xsl:otherwise>
2017
- </xsl:choose>
2018
- </xsl:for-each>
1996
+ <xsl:choose>
1997
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1998
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1999
+ <fo:table-column column-width="{@width}"/>
2000
+ </xsl:for-each>
2001
+ </xsl:when>
2002
+ <xsl:otherwise>
2003
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2004
+ <xsl:choose>
2005
+ <xsl:when test=". = 1 or . = 0">
2006
+ <fo:table-column column-width="proportional-column-width(2)"/>
2007
+ </xsl:when>
2008
+ <xsl:otherwise>
2009
+ <fo:table-column column-width="proportional-column-width({.})"/>
2010
+ </xsl:otherwise>
2011
+ </xsl:choose>
2012
+ </xsl:for-each>
2013
+ </xsl:otherwise>
2014
+ </xsl:choose>
2019
2015
 
2020
2016
  <fo:table-body>
2021
2017
  <fo:table-row>
@@ -2119,6 +2115,7 @@
2119
2115
 
2120
2116
 
2121
2117
 
2118
+
2122
2119
  <!-- <xsl:if test="$namespace = 'bipm'">
2123
2120
  <xsl:attribute name="height">8mm</xsl:attribute>
2124
2121
  </xsl:if> -->
@@ -2212,7 +2209,8 @@
2212
2209
  </xsl:attribute>
2213
2210
  </xsl:if>
2214
2211
  <xsl:call-template name="display-align"/>
2215
- <fo:block>
2212
+ <fo:block>
2213
+
2216
2214
  <xsl:apply-templates/>
2217
2215
  </fo:block>
2218
2216
  </fo:table-cell>
@@ -2433,7 +2431,13 @@
2433
2431
  <xsl:apply-templates/>
2434
2432
  </fo:inline>
2435
2433
  </xsl:template><xsl:template match="*[local-name()='dl']">
2436
- <fo:block-container margin-left="0mm">
2434
+ <fo:block-container>
2435
+
2436
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2437
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2438
+ </xsl:if>
2439
+
2440
+
2437
2441
  <xsl:if test="parent::*[local-name() = 'note']">
2438
2442
  <xsl:attribute name="margin-left">
2439
2443
  <xsl:choose>
@@ -2443,8 +2447,12 @@
2443
2447
  </xsl:attribute>
2444
2448
 
2445
2449
  </xsl:if>
2446
- <fo:block-container margin-left="0mm">
2447
-
2450
+ <fo:block-container>
2451
+
2452
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2453
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2454
+
2455
+
2448
2456
  <xsl:variable name="parent" select="local-name(..)"/>
2449
2457
 
2450
2458
  <xsl:variable name="key_iso">
@@ -2458,9 +2466,12 @@
2458
2466
  <fo:block margin-bottom="12pt" text-align="left">
2459
2467
 
2460
2468
  <xsl:variable name="title-where">
2461
- <xsl:call-template name="getTitle">
2462
- <xsl:with-param name="name" select="'title-where'"/>
2463
- </xsl:call-template>
2469
+
2470
+
2471
+ <xsl:call-template name="getTitle">
2472
+ <xsl:with-param name="name" select="'title-where'"/>
2473
+ </xsl:call-template>
2474
+
2464
2475
  </xsl:variable>
2465
2476
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2466
2477
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2476,9 +2487,12 @@
2476
2487
 
2477
2488
 
2478
2489
  <xsl:variable name="title-where">
2479
- <xsl:call-template name="getTitle">
2480
- <xsl:with-param name="name" select="'title-where'"/>
2481
- </xsl:call-template>
2490
+
2491
+
2492
+ <xsl:call-template name="getTitle">
2493
+ <xsl:with-param name="name" select="'title-where'"/>
2494
+ </xsl:call-template>
2495
+
2482
2496
  </xsl:variable>
2483
2497
  <xsl:value-of select="$title-where"/>
2484
2498
  </fo:block>
@@ -2489,9 +2503,12 @@
2489
2503
 
2490
2504
 
2491
2505
  <xsl:variable name="title-key">
2492
- <xsl:call-template name="getTitle">
2493
- <xsl:with-param name="name" select="'title-key'"/>
2494
- </xsl:call-template>
2506
+
2507
+
2508
+ <xsl:call-template name="getTitle">
2509
+ <xsl:with-param name="name" select="'title-key'"/>
2510
+ </xsl:call-template>
2511
+
2495
2512
  </xsl:variable>
2496
2513
  <xsl:value-of select="$title-key"/>
2497
2514
  </fo:block>
@@ -2625,12 +2642,32 @@
2625
2642
  </xsl:otherwise>
2626
2643
  </xsl:choose>
2627
2644
  </xsl:template><xsl:template name="getMaxLength_dt">
2628
- <xsl:for-each select="*[local-name()='dt']">
2629
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2630
- <xsl:if test="position() = 1">
2631
- <xsl:value-of select="string-length(normalize-space(.))"/>
2632
- </xsl:if>
2633
- </xsl:for-each>
2645
+ <xsl:variable name="lengths">
2646
+ <xsl:for-each select="*[local-name()='dt']">
2647
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2648
+ <xsl:variable name="attributes">
2649
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2650
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2651
+ </xsl:variable>
2652
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2653
+ </xsl:for-each>
2654
+ </xsl:variable>
2655
+ <xsl:variable name="maxLength">
2656
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2657
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2658
+ <xsl:if test="position() = 1">
2659
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2660
+ </xsl:if>
2661
+ </xsl:for-each> -->
2662
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2663
+ <xsl:sort select="." data-type="number" order="descending"/>
2664
+ <xsl:if test="position() = 1">
2665
+ <xsl:value-of select="."/>
2666
+ </xsl:if>
2667
+ </xsl:for-each>
2668
+ </xsl:variable>
2669
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2670
+ <xsl:value-of select="$maxLength"/>
2634
2671
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2635
2672
  <xsl:param name="key_iso"/>
2636
2673
 
@@ -2758,6 +2795,7 @@
2758
2795
  </fo:inline>
2759
2796
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
2760
2797
  <fo:inline font-weight="bold">
2798
+
2761
2799
  <xsl:apply-templates/>
2762
2800
  </fo:inline>
2763
2801
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -2797,6 +2835,10 @@
2797
2835
  </xsl:if>
2798
2836
  <xsl:apply-templates/>
2799
2837
  </fo:inline>
2838
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2839
+ <fo:inline text-decoration="underline">
2840
+ <xsl:apply-templates/>
2841
+ </fo:inline>
2800
2842
  </xsl:template><xsl:template match="*[local-name()='del']">
2801
2843
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2802
2844
  <xsl:apply-templates/>
@@ -3086,7 +3128,18 @@
3086
3128
  <xsl:with-param name="previousRow" select="$newRow"/>
3087
3129
  </xsl:apply-templates>
3088
3130
  </xsl:template><xsl:template name="getLang">
3089
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3131
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3132
+ <xsl:variable name="language">
3133
+ <xsl:choose>
3134
+ <xsl:when test="$language_current != ''">
3135
+ <xsl:value-of select="$language_current"/>
3136
+ </xsl:when>
3137
+ <xsl:otherwise>
3138
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3139
+ </xsl:otherwise>
3140
+ </xsl:choose>
3141
+ </xsl:variable>
3142
+
3090
3143
  <xsl:choose>
3091
3144
  <xsl:when test="$language = 'English'">en</xsl:when>
3092
3145
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -3121,6 +3174,7 @@
3121
3174
  <xsl:value-of select="substring($str, 2)"/>
3122
3175
  </xsl:template><xsl:template match="mathml:math">
3123
3176
  <fo:inline font-family="STIX Two Math"> <!-- -->
3177
+
3124
3178
  <xsl:variable name="mathml">
3125
3179
  <xsl:apply-templates select="." mode="mathml"/>
3126
3180
  </xsl:variable>
@@ -3150,6 +3204,7 @@
3150
3204
  </xsl:choose>
3151
3205
  </xsl:variable>
3152
3206
  <fo:inline xsl:use-attribute-sets="link-style">
3207
+
3153
3208
  <xsl:choose>
3154
3209
  <xsl:when test="$target = ''">
3155
3210
  <xsl:apply-templates/>
@@ -3203,10 +3258,14 @@
3203
3258
  </fo:inline>
3204
3259
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
3205
3260
  <xsl:variable name="title-modified">
3206
- <xsl:call-template name="getTitle">
3207
- <xsl:with-param name="name" select="'title-modified'"/>
3208
- </xsl:call-template>
3261
+
3262
+
3263
+ <xsl:call-template name="getTitle">
3264
+ <xsl:with-param name="name" select="'title-modified'"/>
3265
+ </xsl:call-template>
3266
+
3209
3267
  </xsl:variable>
3268
+
3210
3269
  <xsl:choose>
3211
3270
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3212
3271
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -3361,7 +3420,8 @@
3361
3420
  </fo:inline>
3362
3421
  </xsl:if>
3363
3422
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
3364
- <fo:block-container id="{@id}">
3423
+ <fo:block-container id="{@id}">
3424
+
3365
3425
  <fo:block>
3366
3426
  <xsl:apply-templates/>
3367
3427
  </fo:block>
@@ -3412,7 +3472,7 @@
3412
3472
  <xsl:apply-templates mode="bookmarks"/>
3413
3473
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3414
3474
  <xsl:apply-templates select="."/>
3415
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3475
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3416
3476
  <xsl:apply-templates mode="bookmarks"/>
3417
3477
  </xsl:template><xsl:template name="addBookmarks">
3418
3478
  <xsl:param name="contents"/>
@@ -3428,6 +3488,8 @@
3428
3488
  <xsl:variable name="bookmark-title_">
3429
3489
  <xsl:call-template name="getLangVersion">
3430
3490
  <xsl:with-param name="lang" select="@lang"/>
3491
+ <xsl:with-param name="doctype" select="@doctype"/>
3492
+ <xsl:with-param name="title" select="@title-part"/>
3431
3493
  </xsl:call-template>
3432
3494
  </xsl:variable>
3433
3495
  <xsl:choose>
@@ -3445,13 +3507,34 @@
3445
3507
  </xsl:choose>
3446
3508
  </fo:bookmark-title>
3447
3509
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3510
+
3511
+ <xsl:call-template name="insertFigureBookmarks">
3512
+ <xsl:with-param name="contents" select="contents"/>
3513
+ </xsl:call-template>
3514
+
3515
+ <xsl:call-template name="insertTableBookmarks">
3516
+ <xsl:with-param name="contents" select="contents"/>
3517
+ <xsl:with-param name="lang" select="@lang"/>
3518
+ </xsl:call-template>
3519
+
3448
3520
  </fo:bookmark>
3449
3521
 
3450
3522
  </xsl:for-each>
3451
3523
  </xsl:when>
3452
3524
  <xsl:otherwise>
3453
3525
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3526
+
3454
3527
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3528
+
3529
+ <xsl:call-template name="insertFigureBookmarks">
3530
+ <xsl:with-param name="contents" select="contents"/>
3531
+ </xsl:call-template>
3532
+
3533
+ <xsl:call-template name="insertTableBookmarks">
3534
+ <xsl:with-param name="contents" select="contents"/>
3535
+ <xsl:with-param name="lang" select="@lang"/>
3536
+ </xsl:call-template>
3537
+
3455
3538
  </xsl:for-each>
3456
3539
  </xsl:otherwise>
3457
3540
  </xsl:choose>
@@ -3470,8 +3553,44 @@
3470
3553
 
3471
3554
  </fo:bookmark-tree>
3472
3555
  </xsl:if>
3556
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3557
+ <xsl:param name="contents"/>
3558
+ <xsl:if test="xalan:nodeset($contents)/figure">
3559
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3560
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3561
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3562
+ <fo:bookmark internal-destination="{@id}">
3563
+ <fo:bookmark-title>
3564
+ <xsl:value-of select="normalize-space(title)"/>
3565
+ </fo:bookmark-title>
3566
+ </fo:bookmark>
3567
+ </xsl:for-each>
3568
+ </fo:bookmark>
3569
+ </xsl:if>
3570
+ </xsl:template><xsl:template name="insertTableBookmarks">
3571
+ <xsl:param name="contents"/>
3572
+ <xsl:param name="lang"/>
3573
+ <xsl:if test="xalan:nodeset($contents)/table">
3574
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3575
+ <fo:bookmark-title>
3576
+ <xsl:choose>
3577
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3578
+ <xsl:otherwise>Tables</xsl:otherwise>
3579
+ </xsl:choose>
3580
+ </fo:bookmark-title>
3581
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3582
+ <fo:bookmark internal-destination="{@id}">
3583
+ <fo:bookmark-title>
3584
+ <xsl:value-of select="normalize-space(title)"/>
3585
+ </fo:bookmark-title>
3586
+ </fo:bookmark>
3587
+ </xsl:for-each>
3588
+ </fo:bookmark>
3589
+ </xsl:if>
3473
3590
  </xsl:template><xsl:template name="getLangVersion">
3474
3591
  <xsl:param name="lang"/>
3592
+ <xsl:param name="doctype" select="''"/>
3593
+ <xsl:param name="title" select="''"/>
3475
3594
  <xsl:choose>
3476
3595
  <xsl:when test="$lang = 'en'">
3477
3596
 
@@ -3963,7 +4082,8 @@
3963
4082
  <fo:block-container margin-left="0mm">
3964
4083
 
3965
4084
  <fo:block xsl:use-attribute-sets="quote-style">
3966
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
4085
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4086
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3967
4087
  </fo:block>
3968
4088
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3969
4089
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4089,9 +4209,12 @@
4089
4209
  </fo:block>
4090
4210
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
4091
4211
  <xsl:variable name="title-deprecated">
4092
- <xsl:call-template name="getTitle">
4093
- <xsl:with-param name="name" select="'title-deprecated'"/>
4094
- </xsl:call-template>
4212
+
4213
+
4214
+ <xsl:call-template name="getTitle">
4215
+ <xsl:with-param name="name" select="'title-deprecated'"/>
4216
+ </xsl:call-template>
4217
+
4095
4218
  </xsl:variable>
4096
4219
  <fo:block xsl:use-attribute-sets="deprecates-style">
4097
4220
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4144,7 +4267,7 @@
4144
4267
  <fo:block id="{@id}">
4145
4268
  <xsl:apply-templates/>
4146
4269
  </fo:block>
4147
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
4270
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/><xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
4148
4271
 
4149
4272
  <fo:block break-after="page"/>
4150
4273
 
@@ -4203,7 +4326,10 @@
4203
4326
  <fo:table-column column-width="107mm"/>
4204
4327
  <fo:table-column column-width="15mm"/>
4205
4328
  <fo:table-body>
4206
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4329
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4330
+
4331
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
4332
+
4207
4333
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
4208
4334
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
4209
4335
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -4221,6 +4347,10 @@
4221
4347
  <fo:block><xsl:apply-templates/></fo:block>
4222
4348
  </fo:table-cell>
4223
4349
  </xsl:template><xsl:template name="processBibitem">
4350
+
4351
+
4352
+ <!-- end BIPM bibitem processing-->
4353
+
4224
4354
 
4225
4355
 
4226
4356
 
@@ -4279,6 +4409,8 @@
4279
4409
  <xsl:value-of select="translate(.,'. ','')"/>
4280
4410
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4281
4411
  <xsl:value-of select="substring(.,1,1)"/>
4412
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4413
+ <fo:inline><xsl:apply-templates/></fo:inline>
4282
4414
  </xsl:template><xsl:template name="convertDate">
4283
4415
  <xsl:param name="date"/>
4284
4416
  <xsl:param name="format" select="'short'"/>
@@ -4463,13 +4595,22 @@
4463
4595
  </xsl:template><xsl:template name="split">
4464
4596
  <xsl:param name="pText" select="."/>
4465
4597
  <xsl:param name="sep" select="','"/>
4598
+ <xsl:param name="normalize-space" select="'true'"/>
4466
4599
  <xsl:if test="string-length($pText) &gt;0">
4467
4600
  <item>
4468
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4601
+ <xsl:choose>
4602
+ <xsl:when test="$normalize-space = 'true'">
4603
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4604
+ </xsl:when>
4605
+ <xsl:otherwise>
4606
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4607
+ </xsl:otherwise>
4608
+ </xsl:choose>
4469
4609
  </item>
4470
4610
  <xsl:call-template name="split">
4471
4611
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4472
4612
  <xsl:with-param name="sep" select="$sep"/>
4613
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4473
4614
  </xsl:call-template>
4474
4615
  </xsl:if>
4475
4616
  </xsl:template><xsl:template name="getDocumentId">
@@ -4535,4 +4676,28 @@
4535
4676
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4536
4677
  </xsl:call-template>
4537
4678
  </xsl:if>
4679
+ </xsl:template><xsl:template name="repeat">
4680
+ <xsl:param name="char" select="'*'"/>
4681
+ <xsl:param name="count"/>
4682
+ <xsl:if test="$count &gt; 0">
4683
+ <xsl:value-of select="$char"/>
4684
+ <xsl:call-template name="repeat">
4685
+ <xsl:with-param name="char" select="$char"/>
4686
+ <xsl:with-param name="count" select="$count - 1"/>
4687
+ </xsl:call-template>
4688
+ </xsl:if>
4689
+ </xsl:template><xsl:template name="getLocalizedString">
4690
+ <xsl:param name="key"/>
4691
+
4692
+ <xsl:variable name="curr_lang">
4693
+ <xsl:call-template name="getLang"/>
4694
+ </xsl:variable>
4695
+
4696
+ <xsl:choose>
4697
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4698
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4699
+ </xsl:when>
4700
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4701
+ </xsl:choose>
4702
+
4538
4703
  </xsl:template></xsl:stylesheet>