metanorma-nist 1.2.5 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +62 -0
  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 +36 -43
  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 +225 -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 +329 -156
  31. data/lib/isodoc/nist/nist.sp.xsl +326 -192
  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/metanorma/nist/processor.rb +14 -8
  38. data/lib/metanorma/nist/version.rb +1 -1
  39. data/metanorma-nist.gemspec +2 -2
  40. metadata +9 -9
  41. data/.github/workflows/macos.yml +0 -38
  42. data/.github/workflows/ubuntu.yml +0 -56
  43. data/.github/workflows/windows.yml +0 -40
@@ -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
 
@@ -1408,6 +1362,7 @@
1408
1362
 
1409
1363
 
1410
1364
 
1365
+
1411
1366
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
1412
1367
 
1413
1368
 
@@ -1447,6 +1402,7 @@
1447
1402
 
1448
1403
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1449
1404
 
1405
+
1450
1406
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1451
1407
 
1452
1408
 
@@ -1471,6 +1427,7 @@
1471
1427
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1472
1428
 
1473
1429
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1430
+
1474
1431
 
1475
1432
 
1476
1433
 
@@ -1589,7 +1546,9 @@
1589
1546
 
1590
1547
 
1591
1548
 
1592
-
1549
+ <!-- <xsl:if test="$namespace = 'bipm'">
1550
+ <fo:block>&#xA0;</fo:block>
1551
+ </xsl:if> -->
1593
1552
 
1594
1553
  <!-- $namespace = 'iso' or -->
1595
1554
 
@@ -1621,10 +1580,12 @@
1621
1580
 
1622
1581
 
1623
1582
  <xsl:variable name="colwidths">
1624
- <xsl:call-template name="calculate-column-widths">
1625
- <xsl:with-param name="cols-count" select="$cols-count"/>
1626
- <xsl:with-param name="table" select="$simple-table"/>
1627
- </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>
1628
1589
  </xsl:variable>
1629
1590
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1630
1591
 
@@ -1704,16 +1665,25 @@
1704
1665
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1705
1666
  </xsl:if>
1706
1667
 
1707
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1708
- <xsl:choose>
1709
- <xsl:when test=". = 1 or . = 0">
1710
- <fo:table-column column-width="proportional-column-width(2)"/>
1711
- </xsl:when>
1712
- <xsl:otherwise>
1713
- <fo:table-column column-width="proportional-column-width({.})"/>
1714
- </xsl:otherwise>
1715
- </xsl:choose>
1716
- </xsl:for-each>
1668
+ <xsl:choose>
1669
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1670
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1671
+ <fo:table-column column-width="{@width}"/>
1672
+ </xsl:for-each>
1673
+ </xsl:when>
1674
+ <xsl:otherwise>
1675
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1676
+ <xsl:choose>
1677
+ <xsl:when test=". = 1 or . = 0">
1678
+ <fo:table-column column-width="proportional-column-width(2)"/>
1679
+ </xsl:when>
1680
+ <xsl:otherwise>
1681
+ <fo:table-column column-width="proportional-column-width({.})"/>
1682
+ </xsl:otherwise>
1683
+ </xsl:choose>
1684
+ </xsl:for-each>
1685
+ </xsl:otherwise>
1686
+ </xsl:choose>
1717
1687
 
1718
1688
  <xsl:choose>
1719
1689
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -1726,10 +1696,12 @@
1726
1696
 
1727
1697
  </fo:table>
1728
1698
 
1699
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1729
1700
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1730
1701
  <xsl:call-template name="insertTableFooterInSeparateTable">
1731
1702
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
1732
1703
  <xsl:with-param name="colwidths" select="$colwidths"/>
1704
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1733
1705
  </xsl:call-template>
1734
1706
  </xsl:for-each>
1735
1707
 
@@ -1762,6 +1734,7 @@
1762
1734
  <xsl:if test="normalize-space() != ''">
1763
1735
  <fo:block xsl:use-attribute-sets="table-name-style">
1764
1736
 
1737
+
1765
1738
  <xsl:apply-templates/>
1766
1739
  </fo:block>
1767
1740
  </xsl:if>
@@ -1944,12 +1917,26 @@
1944
1917
 
1945
1918
 
1946
1919
 
1947
- <!-- except gb and bipm -->
1948
1920
 
1949
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1950
1921
 
1951
1922
 
1923
+ <!-- except gb -->
1952
1924
 
1925
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1926
+
1927
+
1928
+ <!-- show Note under table in preface (ex. abstract) sections -->
1929
+ <!-- empty, because notes show at page side in main sections -->
1930
+ <!-- <xsl:if test="$namespace = 'bipm'">
1931
+ <xsl:choose>
1932
+ <xsl:when test="ancestor::*[local-name()='preface']">
1933
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1934
+ </xsl:when>
1935
+ <xsl:otherwise>
1936
+ <fo:block/>
1937
+ </xsl:otherwise>
1938
+ </xsl:choose>
1939
+ </xsl:if> -->
1953
1940
 
1954
1941
 
1955
1942
  <!-- horizontal row separator -->
@@ -1968,12 +1955,22 @@
1968
1955
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1969
1956
  <xsl:param name="table_attributes"/>
1970
1957
  <xsl:param name="colwidths"/>
1958
+ <xsl:param name="colgroup"/>
1971
1959
 
1972
1960
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1973
1961
 
1974
1962
  <xsl:if test="$isNoteOrFnExist = 'true'">
1975
1963
 
1976
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1964
+ <xsl:variable name="cols-count">
1965
+ <xsl:choose>
1966
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1967
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1968
+ </xsl:when>
1969
+ <xsl:otherwise>
1970
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1971
+ </xsl:otherwise>
1972
+ </xsl:choose>
1973
+ </xsl:variable>
1977
1974
 
1978
1975
  <fo:table keep-with-previous="always">
1979
1976
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -1991,16 +1988,25 @@
1991
1988
  </xsl:choose>
1992
1989
  </xsl:for-each>
1993
1990
 
1994
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1995
- <xsl:choose>
1996
- <xsl:when test=". = 1 or . = 0">
1997
- <fo:table-column column-width="proportional-column-width(2)"/>
1998
- </xsl:when>
1999
- <xsl:otherwise>
2000
- <fo:table-column column-width="proportional-column-width({.})"/>
2001
- </xsl:otherwise>
2002
- </xsl:choose>
2003
- </xsl:for-each>
1991
+ <xsl:choose>
1992
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1993
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1994
+ <fo:table-column column-width="{@width}"/>
1995
+ </xsl:for-each>
1996
+ </xsl:when>
1997
+ <xsl:otherwise>
1998
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1999
+ <xsl:choose>
2000
+ <xsl:when test=". = 1 or . = 0">
2001
+ <fo:table-column column-width="proportional-column-width(2)"/>
2002
+ </xsl:when>
2003
+ <xsl:otherwise>
2004
+ <fo:table-column column-width="proportional-column-width({.})"/>
2005
+ </xsl:otherwise>
2006
+ </xsl:choose>
2007
+ </xsl:for-each>
2008
+ </xsl:otherwise>
2009
+ </xsl:choose>
2004
2010
 
2005
2011
  <fo:table-body>
2006
2012
  <fo:table-row>
@@ -2012,7 +2018,11 @@
2012
2018
 
2013
2019
 
2014
2020
 
2015
- <!-- except gb and bipm -->
2021
+
2022
+
2023
+
2024
+
2025
+ <!-- except gb -->
2016
2026
 
2017
2027
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2018
2028
 
@@ -2101,6 +2111,10 @@
2101
2111
 
2102
2112
 
2103
2113
 
2114
+ <!-- <xsl:if test="$namespace = 'bipm'">
2115
+ <xsl:attribute name="height">8mm</xsl:attribute>
2116
+ </xsl:if> -->
2117
+
2104
2118
  <xsl:apply-templates/>
2105
2119
  </fo:table-row>
2106
2120
  </xsl:template><xsl:template match="*[local-name()='th']">
@@ -2190,7 +2204,8 @@
2190
2204
  </xsl:attribute>
2191
2205
  </xsl:if>
2192
2206
  <xsl:call-template name="display-align"/>
2193
- <fo:block>
2207
+ <fo:block>
2208
+
2194
2209
  <xsl:apply-templates/>
2195
2210
  </fo:block>
2196
2211
  </fo:table-cell>
@@ -2411,7 +2426,13 @@
2411
2426
  <xsl:apply-templates/>
2412
2427
  </fo:inline>
2413
2428
  </xsl:template><xsl:template match="*[local-name()='dl']">
2414
- <fo:block-container margin-left="0mm">
2429
+ <fo:block-container>
2430
+
2431
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2432
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2433
+ </xsl:if>
2434
+
2435
+
2415
2436
  <xsl:if test="parent::*[local-name() = 'note']">
2416
2437
  <xsl:attribute name="margin-left">
2417
2438
  <xsl:choose>
@@ -2421,8 +2442,12 @@
2421
2442
  </xsl:attribute>
2422
2443
 
2423
2444
  </xsl:if>
2424
- <fo:block-container margin-left="0mm">
2425
-
2445
+ <fo:block-container>
2446
+
2447
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2448
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2449
+
2450
+
2426
2451
  <xsl:variable name="parent" select="local-name(..)"/>
2427
2452
 
2428
2453
  <xsl:variable name="key_iso">
@@ -2436,9 +2461,12 @@
2436
2461
  <fo:block margin-bottom="12pt" text-align="left">
2437
2462
 
2438
2463
  <xsl:variable name="title-where">
2439
- <xsl:call-template name="getTitle">
2440
- <xsl:with-param name="name" select="'title-where'"/>
2441
- </xsl:call-template>
2464
+
2465
+
2466
+ <xsl:call-template name="getTitle">
2467
+ <xsl:with-param name="name" select="'title-where'"/>
2468
+ </xsl:call-template>
2469
+
2442
2470
  </xsl:variable>
2443
2471
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2444
2472
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2454,9 +2482,12 @@
2454
2482
 
2455
2483
 
2456
2484
  <xsl:variable name="title-where">
2457
- <xsl:call-template name="getTitle">
2458
- <xsl:with-param name="name" select="'title-where'"/>
2459
- </xsl:call-template>
2485
+
2486
+
2487
+ <xsl:call-template name="getTitle">
2488
+ <xsl:with-param name="name" select="'title-where'"/>
2489
+ </xsl:call-template>
2490
+
2460
2491
  </xsl:variable>
2461
2492
  <xsl:value-of select="$title-where"/>
2462
2493
  </fo:block>
@@ -2467,9 +2498,12 @@
2467
2498
 
2468
2499
 
2469
2500
  <xsl:variable name="title-key">
2470
- <xsl:call-template name="getTitle">
2471
- <xsl:with-param name="name" select="'title-key'"/>
2472
- </xsl:call-template>
2501
+
2502
+
2503
+ <xsl:call-template name="getTitle">
2504
+ <xsl:with-param name="name" select="'title-key'"/>
2505
+ </xsl:call-template>
2506
+
2473
2507
  </xsl:variable>
2474
2508
  <xsl:value-of select="$title-key"/>
2475
2509
  </fo:block>
@@ -2603,12 +2637,32 @@
2603
2637
  </xsl:otherwise>
2604
2638
  </xsl:choose>
2605
2639
  </xsl:template><xsl:template name="getMaxLength_dt">
2606
- <xsl:for-each select="*[local-name()='dt']">
2607
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2608
- <xsl:if test="position() = 1">
2609
- <xsl:value-of select="string-length(normalize-space(.))"/>
2610
- </xsl:if>
2611
- </xsl:for-each>
2640
+ <xsl:variable name="lengths">
2641
+ <xsl:for-each select="*[local-name()='dt']">
2642
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2643
+ <xsl:variable name="attributes">
2644
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2645
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2646
+ </xsl:variable>
2647
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2648
+ </xsl:for-each>
2649
+ </xsl:variable>
2650
+ <xsl:variable name="maxLength">
2651
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2652
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2653
+ <xsl:if test="position() = 1">
2654
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2655
+ </xsl:if>
2656
+ </xsl:for-each> -->
2657
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2658
+ <xsl:sort select="." data-type="number" order="descending"/>
2659
+ <xsl:if test="position() = 1">
2660
+ <xsl:value-of select="."/>
2661
+ </xsl:if>
2662
+ </xsl:for-each>
2663
+ </xsl:variable>
2664
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2665
+ <xsl:value-of select="$maxLength"/>
2612
2666
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2613
2667
  <xsl:param name="key_iso"/>
2614
2668
 
@@ -2736,6 +2790,7 @@
2736
2790
  </fo:inline>
2737
2791
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
2738
2792
  <fo:inline font-weight="bold">
2793
+
2739
2794
  <xsl:apply-templates/>
2740
2795
  </fo:inline>
2741
2796
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -3064,7 +3119,18 @@
3064
3119
  <xsl:with-param name="previousRow" select="$newRow"/>
3065
3120
  </xsl:apply-templates>
3066
3121
  </xsl:template><xsl:template name="getLang">
3067
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3122
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3123
+ <xsl:variable name="language">
3124
+ <xsl:choose>
3125
+ <xsl:when test="$language_current != ''">
3126
+ <xsl:value-of select="$language_current"/>
3127
+ </xsl:when>
3128
+ <xsl:otherwise>
3129
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3130
+ </xsl:otherwise>
3131
+ </xsl:choose>
3132
+ </xsl:variable>
3133
+
3068
3134
  <xsl:choose>
3069
3135
  <xsl:when test="$language = 'English'">en</xsl:when>
3070
3136
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -3099,6 +3165,7 @@
3099
3165
  <xsl:value-of select="substring($str, 2)"/>
3100
3166
  </xsl:template><xsl:template match="mathml:math">
3101
3167
  <fo:inline font-family="STIX Two Math"> <!-- -->
3168
+
3102
3169
  <xsl:variable name="mathml">
3103
3170
  <xsl:apply-templates select="." mode="mathml"/>
3104
3171
  </xsl:variable>
@@ -3128,6 +3195,7 @@
3128
3195
  </xsl:choose>
3129
3196
  </xsl:variable>
3130
3197
  <fo:inline xsl:use-attribute-sets="link-style">
3198
+
3131
3199
  <xsl:choose>
3132
3200
  <xsl:when test="$target = ''">
3133
3201
  <xsl:apply-templates/>
@@ -3181,10 +3249,14 @@
3181
3249
  </fo:inline>
3182
3250
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
3183
3251
  <xsl:variable name="title-modified">
3184
- <xsl:call-template name="getTitle">
3185
- <xsl:with-param name="name" select="'title-modified'"/>
3186
- </xsl:call-template>
3252
+
3253
+
3254
+ <xsl:call-template name="getTitle">
3255
+ <xsl:with-param name="name" select="'title-modified'"/>
3256
+ </xsl:call-template>
3257
+
3187
3258
  </xsl:variable>
3259
+
3188
3260
  <xsl:choose>
3189
3261
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3190
3262
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -3245,6 +3317,8 @@
3245
3317
 
3246
3318
 
3247
3319
 
3320
+
3321
+
3248
3322
  <fo:inline xsl:use-attribute-sets="note-name-style">
3249
3323
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3250
3324
  </fo:inline>
@@ -3337,7 +3411,8 @@
3337
3411
  </fo:inline>
3338
3412
  </xsl:if>
3339
3413
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
3340
- <fo:block-container id="{@id}">
3414
+ <fo:block-container id="{@id}">
3415
+
3341
3416
  <fo:block>
3342
3417
  <xsl:apply-templates/>
3343
3418
  </fo:block>
@@ -3388,7 +3463,7 @@
3388
3463
  <xsl:apply-templates mode="bookmarks"/>
3389
3464
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3390
3465
  <xsl:apply-templates select="."/>
3391
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3466
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3392
3467
  <xsl:apply-templates mode="bookmarks"/>
3393
3468
  </xsl:template><xsl:template name="addBookmarks">
3394
3469
  <xsl:param name="contents"/>
@@ -3404,6 +3479,8 @@
3404
3479
  <xsl:variable name="bookmark-title_">
3405
3480
  <xsl:call-template name="getLangVersion">
3406
3481
  <xsl:with-param name="lang" select="@lang"/>
3482
+ <xsl:with-param name="doctype" select="@doctype"/>
3483
+ <xsl:with-param name="title" select="@title-part"/>
3407
3484
  </xsl:call-template>
3408
3485
  </xsl:variable>
3409
3486
  <xsl:choose>
@@ -3421,13 +3498,34 @@
3421
3498
  </xsl:choose>
3422
3499
  </fo:bookmark-title>
3423
3500
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3501
+
3502
+ <xsl:call-template name="insertFigureBookmarks">
3503
+ <xsl:with-param name="contents" select="contents"/>
3504
+ </xsl:call-template>
3505
+
3506
+ <xsl:call-template name="insertTableBookmarks">
3507
+ <xsl:with-param name="contents" select="contents"/>
3508
+ <xsl:with-param name="lang" select="@lang"/>
3509
+ </xsl:call-template>
3510
+
3424
3511
  </fo:bookmark>
3425
3512
 
3426
3513
  </xsl:for-each>
3427
3514
  </xsl:when>
3428
3515
  <xsl:otherwise>
3429
3516
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3517
+
3430
3518
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3519
+
3520
+ <xsl:call-template name="insertFigureBookmarks">
3521
+ <xsl:with-param name="contents" select="contents"/>
3522
+ </xsl:call-template>
3523
+
3524
+ <xsl:call-template name="insertTableBookmarks">
3525
+ <xsl:with-param name="contents" select="contents"/>
3526
+ <xsl:with-param name="lang" select="@lang"/>
3527
+ </xsl:call-template>
3528
+
3431
3529
  </xsl:for-each>
3432
3530
  </xsl:otherwise>
3433
3531
  </xsl:choose>
@@ -3446,8 +3544,44 @@
3446
3544
 
3447
3545
  </fo:bookmark-tree>
3448
3546
  </xsl:if>
3547
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3548
+ <xsl:param name="contents"/>
3549
+ <xsl:if test="xalan:nodeset($contents)/figure">
3550
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3551
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3552
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3553
+ <fo:bookmark internal-destination="{@id}">
3554
+ <fo:bookmark-title>
3555
+ <xsl:value-of select="normalize-space(title)"/>
3556
+ </fo:bookmark-title>
3557
+ </fo:bookmark>
3558
+ </xsl:for-each>
3559
+ </fo:bookmark>
3560
+ </xsl:if>
3561
+ </xsl:template><xsl:template name="insertTableBookmarks">
3562
+ <xsl:param name="contents"/>
3563
+ <xsl:param name="lang"/>
3564
+ <xsl:if test="xalan:nodeset($contents)/table">
3565
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3566
+ <fo:bookmark-title>
3567
+ <xsl:choose>
3568
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3569
+ <xsl:otherwise>Tables</xsl:otherwise>
3570
+ </xsl:choose>
3571
+ </fo:bookmark-title>
3572
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3573
+ <fo:bookmark internal-destination="{@id}">
3574
+ <fo:bookmark-title>
3575
+ <xsl:value-of select="normalize-space(title)"/>
3576
+ </fo:bookmark-title>
3577
+ </fo:bookmark>
3578
+ </xsl:for-each>
3579
+ </fo:bookmark>
3580
+ </xsl:if>
3449
3581
  </xsl:template><xsl:template name="getLangVersion">
3450
3582
  <xsl:param name="lang"/>
3583
+ <xsl:param name="doctype" select="''"/>
3584
+ <xsl:param name="title" select="''"/>
3451
3585
  <xsl:choose>
3452
3586
  <xsl:when test="$lang = 'en'">
3453
3587
 
@@ -3939,7 +4073,8 @@
3939
4073
  <fo:block-container margin-left="0mm">
3940
4074
 
3941
4075
  <fo:block xsl:use-attribute-sets="quote-style">
3942
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
4076
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4077
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3943
4078
  </fo:block>
3944
4079
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3945
4080
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4065,9 +4200,12 @@
4065
4200
  </fo:block>
4066
4201
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
4067
4202
  <xsl:variable name="title-deprecated">
4068
- <xsl:call-template name="getTitle">
4069
- <xsl:with-param name="name" select="'title-deprecated'"/>
4070
- </xsl:call-template>
4203
+
4204
+
4205
+ <xsl:call-template name="getTitle">
4206
+ <xsl:with-param name="name" select="'title-deprecated'"/>
4207
+ </xsl:call-template>
4208
+
4071
4209
  </xsl:variable>
4072
4210
  <fo:block xsl:use-attribute-sets="deprecates-style">
4073
4211
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4120,7 +4258,7 @@
4120
4258
  <fo:block id="{@id}">
4121
4259
  <xsl:apply-templates/>
4122
4260
  </fo:block>
4123
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
4261
+ </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']">
4124
4262
 
4125
4263
  <fo:block break-after="page"/>
4126
4264
 
@@ -4179,7 +4317,10 @@
4179
4317
  <fo:table-column column-width="107mm"/>
4180
4318
  <fo:table-column column-width="15mm"/>
4181
4319
  <fo:table-body>
4182
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4320
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4321
+
4322
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
4323
+
4183
4324
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
4184
4325
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
4185
4326
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -4197,6 +4338,10 @@
4197
4338
  <fo:block><xsl:apply-templates/></fo:block>
4198
4339
  </fo:table-cell>
4199
4340
  </xsl:template><xsl:template name="processBibitem">
4341
+
4342
+
4343
+ <!-- end BIPM bibitem processing-->
4344
+
4200
4345
 
4201
4346
 
4202
4347
 
@@ -4439,13 +4584,22 @@
4439
4584
  </xsl:template><xsl:template name="split">
4440
4585
  <xsl:param name="pText" select="."/>
4441
4586
  <xsl:param name="sep" select="','"/>
4587
+ <xsl:param name="normalize-space" select="'true'"/>
4442
4588
  <xsl:if test="string-length($pText) &gt;0">
4443
4589
  <item>
4444
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4590
+ <xsl:choose>
4591
+ <xsl:when test="$normalize-space = 'true'">
4592
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4593
+ </xsl:when>
4594
+ <xsl:otherwise>
4595
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4596
+ </xsl:otherwise>
4597
+ </xsl:choose>
4445
4598
  </item>
4446
4599
  <xsl:call-template name="split">
4447
4600
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4448
4601
  <xsl:with-param name="sep" select="$sep"/>
4602
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4449
4603
  </xsl:call-template>
4450
4604
  </xsl:if>
4451
4605
  </xsl:template><xsl:template name="getDocumentId">
@@ -4511,4 +4665,23 @@
4511
4665
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4512
4666
  </xsl:call-template>
4513
4667
  </xsl:if>
4668
+ </xsl:template><xsl:template name="repeat">
4669
+ <xsl:param name="char" select="'*'"/>
4670
+ <xsl:param name="count"/>
4671
+ <xsl:if test="$count &gt; 0">
4672
+ <xsl:value-of select="$char"/>
4673
+ <xsl:call-template name="repeat">
4674
+ <xsl:with-param name="char" select="$char"/>
4675
+ <xsl:with-param name="count" select="$count - 1"/>
4676
+ </xsl:call-template>
4677
+ </xsl:if>
4678
+ </xsl:template><xsl:template name="getLocalizedString">
4679
+ <xsl:param name="key"/>
4680
+
4681
+ <xsl:variable name="curr_lang">
4682
+ <xsl:call-template name="getLang"/>
4683
+ </xsl:variable>
4684
+
4685
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4686
+
4514
4687
  </xsl:template></xsl:stylesheet>