metanorma-nist 1.0.9 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/nist/biblio.rng +1 -1
  7. data/lib/asciidoctor/nist/cleanup.rb +5 -4
  8. data/lib/asciidoctor/nist/converter.rb +13 -18
  9. data/lib/asciidoctor/nist/isodoc.rng +427 -0
  10. data/lib/asciidoctor/nist/reqt.rng +23 -0
  11. data/lib/isodoc/nist/base_convert.rb +26 -4
  12. data/lib/isodoc/nist/html/_coverpage.css +243 -0
  13. data/lib/isodoc/nist/html/_coverpage.scss +1 -1
  14. data/lib/isodoc/nist/html/html_nist_titlepage.html +1 -1
  15. data/lib/isodoc/nist/html/htmlstyle.css +955 -0
  16. data/lib/isodoc/nist/html/nist.css +1055 -0
  17. data/lib/isodoc/nist/html/nist.scss +0 -1
  18. data/lib/isodoc/nist/html/nist_cswp.css +996 -0
  19. data/lib/isodoc/nist/html/nist_cswp.scss +0 -1
  20. data/lib/isodoc/nist/html/wordstyle.css +1440 -0
  21. data/lib/isodoc/nist/html/wordstyle.scss +0 -1
  22. data/lib/isodoc/nist/html/wordstyle_cswp.css +1119 -0
  23. data/lib/isodoc/nist/html/wordstyle_cswp.scss +0 -1
  24. data/lib/isodoc/nist/html_convert.rb +2 -9
  25. data/lib/isodoc/nist/nist.cswp.xsl +988 -361
  26. data/lib/isodoc/nist/nist.sp.xsl +1129 -495
  27. data/lib/isodoc/nist/pdf_convert.rb +4 -15
  28. data/lib/isodoc/nist/presentation_xml_convert.rb +10 -0
  29. data/lib/isodoc/nist/refs.rb +7 -3
  30. data/lib/isodoc/nist/section.rb +2 -1
  31. data/lib/isodoc/nist/word_convert.rb +0 -5
  32. data/lib/isodoc/nist/word_convert_toc.rb +2 -2
  33. data/lib/isodoc/nist/{xrefs.rb → xref.rb} +2 -2
  34. data/lib/metanorma-nist.rb +2 -0
  35. data/lib/metanorma/nist/processor.rb +6 -8
  36. data/lib/metanorma/nist/version.rb +1 -1
  37. data/metanorma-nist.gemspec +2 -1
  38. metadata +30 -10
@@ -1024,4 +1024,3 @@ ol
1024
1024
  ul
1025
1025
  {margin-bottom:0cm;
1026
1026
  margin-left:18pt;}
1027
-
@@ -37,10 +37,6 @@ module IsoDoc
37
37
  }
38
38
  end
39
39
 
40
- def metadata_init(lang, script, labels)
41
- @meta = Metadata.new(lang, script, labels)
42
- end
43
-
44
40
  def googlefonts
45
41
  <<~HEAD.freeze
46
42
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,600,600i" rel="stylesheet">
@@ -64,7 +60,7 @@ module IsoDoc
64
60
  toc = "<ul>"
65
61
  path = toclevel_classes.map do |l|
66
62
  "//main//#{l}[not(@class = 'TermNum')][not(@class = 'noTOC')]"\
67
- "[not(text())][not(@class = 'AbstractTitle')]"\
63
+ "[text()][not(@class = 'AbstractTitle')]"\
68
64
  "[not(@class = 'IntroTitle')][not(@class = 'ForewordTitle')]"
69
65
  end
70
66
  docxml.xpath(path.join(" | ")).each_with_index do |h, tocidx|
@@ -85,10 +81,6 @@ module IsoDoc
85
81
  end
86
82
  end
87
83
 
88
- def html_toc(docxml)
89
- docxml
90
- end
91
-
92
84
  def authority_cleanup(docxml)
93
85
  dest = docxml.at("//div[@id = 'authority']") || return
94
86
  auth = docxml.at("//div[@class = 'authority']") || return
@@ -110,6 +102,7 @@ module IsoDoc
110
102
  super
111
103
  term_cleanup(docxml)
112
104
  requirement_cleanup(docxml)
105
+ docxml
113
106
  end
114
107
 
115
108
  def make_body3(body, docxml)
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -9,6 +9,8 @@
9
9
  <xsl:variable name="pageWidth" select="'8.5in'"/>
10
10
  <xsl:variable name="pageHeight" select="'11in'"/>
11
11
 
12
+ <xsl:variable name="debug">false</xsl:variable>
13
+
12
14
  <xsl:variable name="title" select="/nist:nist-standard/nist:bibdata/nist:title[@language = 'en' and @type = 'main']"/>
13
15
 
14
16
  <xsl:variable name="date">
@@ -76,44 +78,7 @@
76
78
 
77
79
  </fo:layout-master-set>
78
80
 
79
- <fo:declarations>
80
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
81
- <pdf:dictionary type="normal" key="ViewerPreferences">
82
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
83
- </pdf:dictionary>
84
- </pdf:catalog>
85
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
86
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
87
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
88
- <!-- Dublin Core properties go here -->
89
- <dc:title><xsl:value-of select="$title"/></dc:title>
90
- <dc:creator>
91
- <xsl:for-each select="/nist:nist-standard/nist:bibdata/nist:contributor[nist:role/@type = 'author']">
92
- <xsl:value-of select="nist:person/nist:name/nist:completename"/>
93
- <xsl:if test="position() != last()">; </xsl:if>
94
- </xsl:for-each>
95
- </dc:creator>
96
- <dc:description>
97
- <xsl:variable name="abstract">
98
- <xsl:copy-of select="/nist:nist-standard/nist:preface/nist:abstract//text()"/>
99
- </xsl:variable>
100
- <xsl:value-of select="normalize-space($abstract)"/>
101
- </dc:description>
102
- <pdf:Keywords>
103
- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
104
- <xsl:sort data-type="text" order="ascending"/>
105
- <xsl:apply-templates/>
106
- <xsl:if test="position() != last()">, </xsl:if>
107
- </xsl:for-each>
108
- </pdf:Keywords>
109
- </rdf:Description>
110
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
111
- <!-- XMP properties go here -->
112
- <xmp:CreatorTool/>
113
- </rdf:Description>
114
- </rdf:RDF>
115
- </x:xmpmeta>
116
- </fo:declarations>
81
+ <xsl:call-template name="addPDFUAmeta"/>
117
82
 
118
83
  <!-- cover page -->
119
84
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -236,29 +201,48 @@
236
201
 
237
202
  <!-- Abstract -->
238
203
  <xsl:if test="/nist:nist-standard/nist:preface/nist:abstract">
239
- <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt">Abstract</fo:block>
204
+ <xsl:variable name="title-abstract">
205
+ <xsl:call-template name="getTitle">
206
+ <xsl:with-param name="name" select="'title-abstract'"/>
207
+ </xsl:call-template>
208
+ </xsl:variable>
209
+ <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt"><xsl:value-of select="$title-abstract"/></fo:block>
240
210
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:abstract"/>
241
211
  </xsl:if>
242
212
 
243
213
  <!-- Keywords -->
244
214
  <xsl:if test="/nist:nist-standard/nist:bibdata/nist:keyword">
245
215
  <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt">
246
- <xsl:text>Keywords</xsl:text>
216
+ <xsl:variable name="title-keywords">
217
+ <xsl:call-template name="getTitle">
218
+ <xsl:with-param name="name" select="'title-keywords'"/>
219
+ </xsl:call-template>
220
+ </xsl:variable>
221
+ <xsl:value-of select="$title-keywords"/>
247
222
  </fo:block>
248
223
  <fo:block margin-bottom="12pt" text-align="justify">
249
- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
224
+ <xsl:call-template name="insertKeywords">
225
+ <xsl:with-param name="charAtEnd"/>
226
+ <xsl:with-param name="charDelim">; </xsl:with-param>
227
+ </xsl:call-template>
228
+ <!-- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
250
229
  <xsl:sort data-type="text" order="ascending"/>
251
230
  <xsl:apply-templates/>
252
231
  <xsl:choose>
253
232
  <xsl:when test="position() != last()">; </xsl:when>
254
- <xsl:otherwise/>
233
+ <xsl:otherwise></xsl:otherwise>
255
234
  </xsl:choose>
256
- </xsl:for-each>
235
+ </xsl:for-each> -->
257
236
  </fo:block>
258
237
  </xsl:if>
259
238
 
260
239
  <xsl:if test="/nist:nist-standard/nist:preface/nist:acknowledgements">
261
- <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-top="18pt" margin-bottom="12pt">Acknowledgements</fo:block>
240
+ <xsl:variable name="title-acknowledgements">
241
+ <xsl:call-template name="getTitle">
242
+ <xsl:with-param name="name" select="'title-acknowledgements'"/>
243
+ </xsl:call-template>
244
+ </xsl:variable>
245
+ <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-top="18pt" margin-bottom="12pt"><xsl:value-of select="$title-acknowledgements"/></fo:block>
262
246
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:acknowledgements"/>
263
247
  </xsl:if>
264
248
 
@@ -282,11 +266,12 @@
282
266
  <!-- Executive summary -->
283
267
  <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:executivesummary"/> -->
284
268
 
285
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
286
- DEBUG
287
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
288
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
289
-
269
+ <xsl:if test="$debug = 'true'">
270
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
271
+ DEBUG
272
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
273
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
274
+ </xsl:if>
290
275
  <!-- CONTENTS -->
291
276
  <!-- <fo:block break-after="page"/>
292
277
  <fo:block-container font-family="Arial">
@@ -463,14 +448,7 @@
463
448
  <xsl:param name="sectionNum"/>
464
449
 
465
450
  <xsl:variable name="id">
466
- <xsl:choose>
467
- <xsl:when test="../@id">
468
- <xsl:value-of select="../@id"/>
469
- </xsl:when>
470
- <xsl:otherwise>
471
- <xsl:value-of select="text()"/>
472
- </xsl:otherwise>
473
- </xsl:choose>
451
+ <xsl:call-template name="getId"/>
474
452
  </xsl:variable>
475
453
 
476
454
  <xsl:variable name="level">
@@ -511,7 +489,12 @@
511
489
  <xsl:param name="sectionNum"/>
512
490
  <item level="" id="{@id}" type="figure">
513
491
  <xsl:attribute name="section">
514
- <xsl:text>Figure </xsl:text>
492
+ <xsl:variable name="title-figure">
493
+ <xsl:call-template name="getTitle">
494
+ <xsl:with-param name="name" select="'title-figure'"/>
495
+ </xsl:call-template>
496
+ </xsl:variable>
497
+ <xsl:value-of select="$title-figure"/>
515
498
  <xsl:choose>
516
499
  <xsl:when test="ancestor::nist:annex">
517
500
  <xsl:choose>
@@ -544,7 +527,12 @@
544
527
  <xsl:variable name="annex-id" select="ancestor::nist:annex/@id"/>
545
528
  <item level="" id="{@id}" display="false" type="table">
546
529
  <xsl:attribute name="section">
547
- <xsl:text>Table </xsl:text>
530
+ <xsl:variable name="title-table">
531
+ <xsl:call-template name="getTitle">
532
+ <xsl:with-param name="name" select="'title-table'"/>
533
+ </xsl:call-template>
534
+ </xsl:variable>
535
+ <xsl:value-of select="$title-table"/>
548
536
  <xsl:choose>
549
537
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
550
538
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -567,7 +555,12 @@
567
555
  <xsl:param name="sectionNum"/>
568
556
  <item level="" id="{@id}" display="false">
569
557
  <xsl:attribute name="section">
570
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="nist:annex | nist:formula"/><xsl:text>)</xsl:text>
558
+ <xsl:variable name="title-formula">
559
+ <xsl:call-template name="getTitle">
560
+ <xsl:with-param name="name" select="'title-formula'"/>
561
+ </xsl:call-template>
562
+ </xsl:variable>
563
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="nist:annex | nist:formula"/>
571
564
  </xsl:attribute>
572
565
  </item>
573
566
  </xsl:template>
@@ -601,7 +594,13 @@
601
594
  <item level="" id="{@id}" display="false" type="Terms">
602
595
  <xsl:if test="ancestor::nist:annex">
603
596
  <xsl:attribute name="section">
604
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="nist:annex"/>
597
+ <xsl:variable name="title-appendix">
598
+ <xsl:call-template name="getTitle">
599
+ <xsl:with-param name="name" select="'title-appendix'"/>
600
+ </xsl:call-template>
601
+ </xsl:variable>
602
+ <xsl:value-of select="$title-appendix"/>
603
+ <xsl:number format="A" count="nist:annex"/>
605
604
  </xsl:attribute>
606
605
  </xsl:if>
607
606
  </item>
@@ -612,7 +611,12 @@
612
611
  <xsl:choose>
613
612
  <xsl:when test="ancestor::nist:annex">
614
613
  <xsl:attribute name="section">
615
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="nist:annex"/>
614
+ <xsl:variable name="title-appendix">
615
+ <xsl:call-template name="getTitle">
616
+ <xsl:with-param name="name" select="'title-appendix'"/>
617
+ </xsl:call-template>
618
+ </xsl:variable>
619
+ <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="nist:annex"/>
616
620
  </xsl:attribute>
617
621
  </xsl:when>
618
622
  <xsl:otherwise>
@@ -670,7 +674,12 @@
670
674
 
671
675
  <xsl:template match="nist:note/nist:p" name="note">
672
676
  <fo:block font-size="11pt" space-before="4pt">
673
- <xsl:text>NOTE </xsl:text>
677
+ <xsl:variable name="title-note">
678
+ <xsl:call-template name="getTitle">
679
+ <xsl:with-param name="name" select="'title-note'"/>
680
+ </xsl:call-template>
681
+ </xsl:variable>
682
+ <xsl:value-of select="$title-note"/>
674
683
  <xsl:if test="../following-sibling::nist:note or ../preceding-sibling::nist:note">
675
684
  <xsl:number count="nist:note"/><xsl:text> </xsl:text>
676
685
  </xsl:if>
@@ -681,8 +690,13 @@
681
690
 
682
691
  <xsl:template match="nist:recommendation">
683
692
  <fo:block margin-left="20mm">
684
- <fo:block font-weight="bold">
685
- <xsl:text>Recommendation </xsl:text>
693
+ <fo:block font-weight="bold">
694
+ <xsl:variable name="title-recommendation">
695
+ <xsl:call-template name="getTitle">
696
+ <xsl:with-param name="name" select="'title-recommendation'"/>
697
+ </xsl:call-template>
698
+ </xsl:variable>
699
+ <xsl:value-of select="$title-recommendation"/>
686
700
  <xsl:choose>
687
701
  <xsl:when test="ancestor::nist:sections">
688
702
  <xsl:number level="any" count="nist:sections//nist:recommendation"/>
@@ -705,7 +719,7 @@
705
719
  <fo:block margin-left="8mm" margin-right="8mm">
706
720
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
707
721
  <xsl:choose>
708
- <xsl:when test="@type='important'">IMPORTANT</xsl:when>
722
+ <xsl:when test="@type='important'"><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/></xsl:when>
709
723
  <xsl:when test="@type='tip'">
710
724
  <xsl:apply-templates select="nist:name" mode="process"/>
711
725
  </xsl:when>
@@ -819,14 +833,7 @@
819
833
  <xsl:template match="nist:title">
820
834
  <xsl:param name="sectionNum"/>
821
835
  <xsl:variable name="id">
822
- <xsl:choose>
823
- <xsl:when test="../@id">
824
- <xsl:value-of select="../@id"/>
825
- </xsl:when>
826
- <xsl:otherwise>
827
- <xsl:value-of select="text()"/>
828
- </xsl:otherwise>
829
- </xsl:choose>
836
+ <xsl:call-template name="getId"/>
830
837
  </xsl:variable>
831
838
 
832
839
  <xsl:variable name="parent-name" select="local-name(..)"/>
@@ -926,30 +933,6 @@
926
933
  </xsl:template>
927
934
 
928
935
 
929
- <xsl:template match="nist:preferred2">
930
- <xsl:param name="sectionNum"/>
931
- <!-- DEBUG need -->
932
- <fo:block space-before="6pt" text-align="justify">
933
- <fo:inline id="{../@id}" padding-right="5mm" font-weight="bold">
934
- <!-- <xsl:value-of select="$sectionNum"/><xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term"/> -->
935
- <xsl:variable name="section">
936
- <xsl:call-template name="getSection">
937
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
938
- </xsl:call-template>
939
- </xsl:variable>
940
- <xsl:value-of select="$section"/>
941
- </fo:inline>
942
- <fo:inline font-weight="bold">
943
- <xsl:apply-templates/>
944
- </fo:inline>
945
- <xsl:if test="../nist:termsource/nist:origin">
946
- <xsl:text> [</xsl:text><xsl:value-of select="../nist:termsource/nist:origin/@citeas"/><xsl:text>]</xsl:text>
947
- </xsl:if>
948
- <xsl:text>: </xsl:text>
949
- <xsl:apply-templates select="following-sibling::nist:definition/node()" mode="process"/> <!-- -->
950
- </fo:block>
951
- </xsl:template>
952
-
953
936
 
954
937
  <xsl:template match="nist:p//nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn" priority="2">
955
938
  <fo:footnote>
@@ -1003,7 +986,12 @@
1003
986
  <xsl:call-template name="note"/>
1004
987
  </xsl:for-each>
1005
988
  <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-previous="always">
1006
- <xsl:text>Figure </xsl:text>
989
+ <xsl:variable name="title-figure">
990
+ <xsl:call-template name="getTitle">
991
+ <xsl:with-param name="name" select="'title-figure'"/>
992
+ </xsl:call-template>
993
+ </xsl:variable>
994
+ <xsl:value-of select="$title-figure"/>
1007
995
  <xsl:choose>
1008
996
  <xsl:when test="ancestor::nist:annex">
1009
997
  <xsl:choose>
@@ -1134,7 +1122,12 @@
1134
1122
 
1135
1123
  <xsl:template match="nist:annex//nist:note/nist:p">
1136
1124
  <fo:block font-size="11pt" margin-top="4pt">
1137
- <xsl:text>NOTE </xsl:text>
1125
+ <xsl:variable name="title-note">
1126
+ <xsl:call-template name="getTitle">
1127
+ <xsl:with-param name="name" select="'title-note'"/>
1128
+ </xsl:call-template>
1129
+ </xsl:variable>
1130
+ <xsl:value-of select="$title-note"/>
1138
1131
  <xsl:if test="../following-sibling::nist:note or ../preceding-sibling::nist:note">
1139
1132
  <xsl:number count="nist:note"/><xsl:text> </xsl:text>
1140
1133
  </xsl:if>
@@ -1153,7 +1146,12 @@
1153
1146
  <xsl:template match="nist:ul//nist:note | nist:ol//nist:note"/>
1154
1147
  <xsl:template match="nist:ul//nist:note/nist:p | nist:ol//nist:note/nist:p" mode="process">
1155
1148
  <fo:block font-size="11pt" margin-top="4pt">
1156
- <xsl:text>NOTE </xsl:text>
1149
+ <xsl:variable name="title-note">
1150
+ <xsl:call-template name="getTitle">
1151
+ <xsl:with-param name="name" select="'title-note'"/>
1152
+ </xsl:call-template>
1153
+ </xsl:variable>
1154
+ <xsl:value-of select="$title-note"/>
1157
1155
  <xsl:if test="../following-sibling::nist:note or ../preceding-sibling::nist:note">
1158
1156
  <xsl:number count="nist:note"/><xsl:text> </xsl:text>
1159
1157
  </xsl:if>
@@ -1224,39 +1222,28 @@
1224
1222
  </fo:block>
1225
1223
  </xsl:template>
1226
1224
 
1227
- <xsl:template match="nist:link">
1228
- <xsl:if test="ancestor::nist:formattedref">
1225
+ <xsl:template match="nist:link" priority="2">
1226
+ <xsl:if test="ancestor::*[local-name()='formattedref']">
1229
1227
  <xsl:value-of select="$linebreak"/>
1230
1228
  </xsl:if>
1231
- <fo:basic-link external-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="link {@target}">
1232
- <xsl:choose>
1233
- <xsl:when test="normalize-space(.) = ''">
1234
- <xsl:choose>
1235
- <xsl:when test="starts-with(@target, 'mailto:')">
1236
- <xsl:value-of select="substring-after(@target, 'mailto:')"/>
1237
- </xsl:when>
1238
- <xsl:otherwise>
1239
- <xsl:value-of select="@target"/>
1240
- </xsl:otherwise>
1241
- </xsl:choose>
1242
- </xsl:when>
1243
- <xsl:otherwise>
1244
- <xsl:apply-templates/>
1245
- </xsl:otherwise>
1246
- </xsl:choose>
1247
- </fo:basic-link>
1248
- <!-- </fo:inline> -->
1229
+ <fo:inline color="blue" text-decoration="underline">
1230
+ <xsl:call-template name="link"/>
1231
+ </fo:inline>
1249
1232
  </xsl:template>
1250
-
1251
-
1233
+
1252
1234
  <xsl:template match="nist:termnote">
1253
1235
  <fo:block margin-top="4pt">
1254
- <xsl:text>NOTE </xsl:text>
1255
- <xsl:if test="following-sibling::nist:termnote or preceding-sibling::nist:termnote">
1256
- <xsl:number/><xsl:text> </xsl:text>
1257
- </xsl:if>
1258
- <xsl:text>– </xsl:text>
1259
- <xsl:apply-templates/>
1236
+ <xsl:variable name="title-note">
1237
+ <xsl:call-template name="getTitle">
1238
+ <xsl:with-param name="name" select="'title-note'"/>
1239
+ </xsl:call-template>
1240
+ </xsl:variable>
1241
+ <xsl:value-of select="$title-note"/>
1242
+ <xsl:if test="following-sibling::nist:termnote or preceding-sibling::nist:termnote">
1243
+ <xsl:number/><xsl:text> </xsl:text>
1244
+ </xsl:if>
1245
+ <xsl:text>– </xsl:text>
1246
+ <xsl:apply-templates/>
1260
1247
  </fo:block>
1261
1248
  </xsl:template>
1262
1249
  <xsl:template match="nist:termnote/nist:p">
@@ -1288,7 +1275,7 @@
1288
1275
  <fo:table-cell> <!-- display-align="center" -->
1289
1276
  <fo:block text-align="right">
1290
1277
  <xsl:if test="not(ancestor::nist:annex)">
1291
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
1278
+ <xsl:number format="(1)" level="any"/>
1292
1279
  </xsl:if>
1293
1280
  <xsl:if test="ancestor::nist:annex">
1294
1281
  <xsl:variable name="annex-id" select="ancestor::nist:annex/@id"/>
@@ -1316,11 +1303,22 @@
1316
1303
 
1317
1304
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1318
1305
 
1306
+ <xsl:variable name="title-section">
1307
+ <xsl:call-template name="getTitle">
1308
+ <xsl:with-param name="name" select="'title-section'"/>
1309
+ </xsl:call-template>
1310
+ </xsl:variable>
1311
+ <xsl:variable name="title-example-xref">
1312
+ <xsl:call-template name="getTitle">
1313
+ <xsl:with-param name="name" select="'title-example-xref'"/>
1314
+ </xsl:call-template>
1315
+ </xsl:variable>
1316
+
1319
1317
  <fo:basic-link internal-destination="{@target}" text-decoration="underline" color="blue" fox:alt-text="{@target}">
1320
1318
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1321
1319
  <xsl:choose>
1322
- <xsl:when test="$type = 'clause'">Section </xsl:when><!-- and not (ancestor::annex) -->
1323
- <xsl:when test="$type = 'Example'">Example </xsl:when>
1320
+ <xsl:when test="$type = 'clause'"><xsl:value-of select="$title-section"/></xsl:when><!-- and not (ancestor::annex) -->
1321
+ <xsl:when test="$type = 'Example'"><xsl:value-of select="$title-example-xref"/></xsl:when>
1324
1322
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1325
1323
  </xsl:choose>
1326
1324
 
@@ -1329,8 +1327,13 @@
1329
1327
  <xsl:variable name="currentSection">
1330
1328
  <xsl:call-template name="getSection"/>
1331
1329
  </xsl:variable>
1332
- <xsl:if test="not(contains($section, $currentSection))">
1333
- <xsl:text>in </xsl:text>
1330
+ <xsl:if test="not(contains($section, $currentSection))">
1331
+ <xsl:variable name="title-in">
1332
+ <xsl:call-template name="getTitle">
1333
+ <xsl:with-param name="name" select="'title-in'"/>
1334
+ </xsl:call-template>
1335
+ </xsl:variable>
1336
+ <xsl:value-of select="$title-in"/>
1334
1337
  <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1335
1338
  <xsl:text> </xsl:text>
1336
1339
  <xsl:value-of select="$section"/>
@@ -1349,7 +1352,12 @@
1349
1352
 
1350
1353
 
1351
1354
  <xsl:template match="nist:example">
1352
- <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt">EXAMPLE</fo:block>
1355
+ <xsl:variable name="title-example">
1356
+ <xsl:call-template name="getTitle">
1357
+ <xsl:with-param name="name" select="'title-example'"/>
1358
+ </xsl:call-template>
1359
+ </xsl:variable>
1360
+ <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-example"/></fo:block>
1353
1361
  <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm">
1354
1362
  <xsl:apply-templates/>
1355
1363
  </fo:block>
@@ -1390,7 +1398,7 @@
1390
1398
  <xsl:if test="@type = 'inline'">
1391
1399
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1392
1400
  </xsl:if>
1393
- <!-- <xsl:text>[</xsl:text> --><xsl:value-of select="@citeas" disable-output-escaping="yes"/><!-- <xsl:text>]</xsl:text> -->
1401
+ <!-- <xsl:text>[</xsl:text> --><xsl:value-of select="@citeas"/><!-- <xsl:text>]</xsl:text> --> <!-- disable-output-escaping="yes" -->
1394
1402
 
1395
1403
  <xsl:apply-templates select="nist:localityStack"/>
1396
1404
 
@@ -1399,9 +1407,19 @@
1399
1407
  </xsl:template>
1400
1408
 
1401
1409
  <xsl:template match="nist:locality">
1410
+ <xsl:variable name="title-section">
1411
+ <xsl:call-template name="getTitle">
1412
+ <xsl:with-param name="name" select="'title-section'"/>
1413
+ </xsl:call-template>
1414
+ </xsl:variable>
1415
+ <xsl:variable name="title-clause">
1416
+ <xsl:call-template name="getTitle">
1417
+ <xsl:with-param name="name" select="'title-clause'"/>
1418
+ </xsl:call-template>
1419
+ </xsl:variable>
1402
1420
  <xsl:choose>
1403
- <xsl:when test="@type = 'section'">Section </xsl:when>
1404
- <xsl:when test="@type = 'clause'">Clause </xsl:when>
1421
+ <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when>
1422
+ <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1405
1423
  <xsl:otherwise/>
1406
1424
  </xsl:choose>
1407
1425
  <xsl:text> </xsl:text><xsl:value-of select="nist:referenceFrom"/>
@@ -1419,7 +1437,7 @@
1419
1437
  </fo:block>
1420
1438
  </xsl:template>
1421
1439
  <xsl:template match="nist:term" mode="table">
1422
- <fo:table-row>
1440
+ <fo:table-row id="{@id}">
1423
1441
  <fo:table-cell padding-right="1mm">
1424
1442
  <fo:block margin-bottom="12pt">
1425
1443
  <xsl:apply-templates select="nist:preferred"/>
@@ -1433,7 +1451,7 @@
1433
1451
  </fo:table-row>
1434
1452
  </xsl:template>
1435
1453
  <xsl:template match="nist:preferred">
1436
- <fo:inline id="{../@id}">
1454
+ <fo:inline>
1437
1455
  <xsl:apply-templates/>
1438
1456
  </fo:inline>
1439
1457
  </xsl:template>
@@ -1500,26 +1518,6 @@
1500
1518
  </fo:block>
1501
1519
  </xsl:template>
1502
1520
 
1503
- <xsl:template match="nist:sourcecode">
1504
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
1505
- <!-- <xsl:choose>
1506
- <xsl:when test="@lang = 'en'"></xsl:when>
1507
- <xsl:otherwise> -->
1508
- <xsl:attribute name="white-space">pre</xsl:attribute>
1509
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1510
- <!-- </xsl:otherwise>
1511
- </xsl:choose> -->
1512
- <xsl:apply-templates/>
1513
- </fo:block>
1514
- </xsl:template>
1515
-
1516
- <!-- <xsl:template match="nist:dt//nist:stem">
1517
- <xsl:apply-templates />
1518
- <xsl:value-of select="$linebreak"/>
1519
- </xsl:template> -->
1520
-
1521
-
1522
-
1523
1521
  <xsl:template name="insertHeaderFooter">
1524
1522
  <xsl:call-template name="insertHeader"/>
1525
1523
  <xsl:call-template name="insertFooter"/>
@@ -2645,31 +2643,18 @@
2645
2643
  </xsl:if>
2646
2644
  </xsl:template>
2647
2645
 
2648
- <xsl:template name="getLevel">
2649
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2650
- <xsl:variable name="level">
2651
- <xsl:choose>
2652
- <xsl:when test="ancestor::nist:sections">
2653
- <xsl:value-of select="$level_total - 2"/>
2654
- </xsl:when>
2655
- <xsl:when test="ancestor::nist:bibliography">
2656
- <xsl:value-of select="$level_total - 2"/>
2657
- </xsl:when>
2658
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2659
- <xsl:otherwise>
2660
- <xsl:value-of select="$level_total - 1"/>
2661
- </xsl:otherwise>
2662
- </xsl:choose>
2663
- </xsl:variable>
2664
- <xsl:value-of select="$level"/>
2665
- </xsl:template>
2666
-
2646
+
2667
2647
  <xsl:template name="getSection">
2668
2648
  <xsl:param name="sectionNum"/>
2669
2649
  <xsl:variable name="level">
2670
2650
  <xsl:call-template name="getLevel"/>
2671
2651
  </xsl:variable>
2672
2652
  <xsl:variable name="section">
2653
+ <xsl:variable name="title-appendix">
2654
+ <xsl:call-template name="getTitle">
2655
+ <xsl:with-param name="name" select="'title-appendix'"/>
2656
+ </xsl:call-template>
2657
+ </xsl:variable>
2673
2658
  <xsl:choose>
2674
2659
  <xsl:when test="ancestor::nist:bibliography">
2675
2660
  <xsl:value-of select="$sectionNum"/>
@@ -2682,7 +2667,7 @@
2682
2667
  </xsl:when>
2683
2668
  <xsl:when test="$level &gt;= 2">
2684
2669
  <xsl:variable name="num">
2685
- <xsl:number format=".1" level="multiple" count="nist:clause/nist:clause | nist:clause/nist:terms | nist:terms/nist:term | nist:clause/nist:term"/>
2670
+ <xsl:call-template name="getSubSection"/>
2686
2671
  </xsl:variable>
2687
2672
  <xsl:value-of select="concat($sectionNum, $num)"/>
2688
2673
  </xsl:when>
@@ -2693,7 +2678,7 @@
2693
2678
  <xsl:when test="ancestor::nist:annex[@obligation = 'informative']">
2694
2679
  <xsl:choose>
2695
2680
  <xsl:when test="$level = 1">
2696
- <xsl:text>Appendix </xsl:text>
2681
+ <xsl:value-of select="$title-appendix"/>
2697
2682
  <xsl:number format="I" level="any" count="nist:annex[@obligation = 'informative']"/>
2698
2683
  </xsl:when>
2699
2684
  <xsl:otherwise>
@@ -2704,7 +2689,7 @@
2704
2689
  <xsl:when test="ancestor::nist:annex">
2705
2690
  <xsl:choose>
2706
2691
  <xsl:when test="$level = 1">
2707
- <xsl:text>Appendix </xsl:text>
2692
+ <xsl:value-of select="$title-appendix"/>
2708
2693
  <xsl:choose>
2709
2694
  <xsl:when test="count(//nist:annex) = 1">
2710
2695
  <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:ext/nist:structuredidentifier/nist:annexid"/>
@@ -2733,16 +2718,217 @@
2733
2718
  <xsl:value-of select="$section"/>
2734
2719
  </xsl:template>
2735
2720
 
2736
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
2721
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2722
+
2723
+ <title-table lang="en">Table </title-table>
2724
+ <title-table lang="fr">Tableau </title-table>
2725
+
2726
+ <title-table lang="zh">Table </title-table>
2727
+
2728
+
2729
+
2730
+ <title-note lang="en">NOTE </title-note>
2731
+ <title-note lang="fr">NOTE </title-note>
2732
+
2733
+ <title-note lang="zh">NOTE </title-note>
2734
+
2735
+
2736
+
2737
+ <title-figure lang="en">Figure </title-figure>
2738
+ <title-figure lang="fr">Figure </title-figure>
2739
+
2740
+ <title-figure lang="zh">Figure </title-figure>
2741
+
2742
+
2743
+
2744
+ <title-example lang="en">EXAMPLE </title-example>
2745
+ <title-example lang="fr">EXEMPLE </title-example>
2746
+
2747
+ <title-example lang="zh">EXAMPLE </title-example>
2748
+
2749
+
2750
+
2751
+ <title-example-xref lang="en">Example </title-example-xref>
2752
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2753
+
2754
+ <title-section lang="en">Section </title-section>
2755
+ <title-section lang="fr">Section </title-section>
2756
+
2757
+ <title-inequality lang="en">Inequality </title-inequality>
2758
+ <title-inequality lang="fr">Inequality </title-inequality>
2759
+
2760
+ <title-equation lang="en">Equation </title-equation>
2761
+ <title-equation lang="fr">Equation </title-equation>
2762
+
2763
+ <title-annex lang="en">Annex </title-annex>
2764
+ <title-annex lang="fr">Annexe </title-annex>
2765
+
2766
+ <title-annex lang="zh">Annex </title-annex>
2767
+
2768
+
2769
+
2770
+ <title-appendix lang="en">Appendix </title-appendix>
2771
+ <title-appendix lang="fr">Appendix </title-appendix>
2772
+
2773
+ <title-clause lang="en">Clause </title-clause>
2774
+ <title-clause lang="fr">Article </title-clause>
2775
+
2776
+ <title-clause lang="zh">Clause </title-clause>
2777
+
2778
+
2779
+
2780
+ <title-edition lang="en">
2781
+
2782
+ <xsl:text>Edition </xsl:text>
2783
+
2784
+
2785
+ </title-edition>
2786
+
2787
+ <title-formula lang="en">Formula </title-formula>
2788
+ <title-formula lang="fr">Formula </title-formula>
2789
+
2790
+ <title-toc lang="en">
2791
+
2792
+
2793
+ <xsl:text>Table of Contents</xsl:text>
2794
+
2795
+
2796
+ </title-toc>
2797
+ <title-toc lang="fr">Sommaire</title-toc>
2798
+
2799
+ <title-toc lang="zh">Contents</title-toc>
2800
+
2801
+
2802
+
2803
+ <title-page lang="en">Page</title-page>
2804
+ <title-page lang="fr">Page</title-page>
2805
+
2806
+ <title-key lang="en">Key</title-key>
2807
+ <title-key lang="fr">Légende</title-key>
2808
+
2809
+ <title-where lang="en">where</title-where>
2810
+ <title-where lang="fr">où</title-where>
2811
+
2812
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2813
+
2814
+ <title-part lang="en">
2815
+
2816
+
2817
+ </title-part>
2818
+ <title-part lang="fr">
2819
+
2820
+
2821
+ </title-part>
2822
+ <title-part lang="zh">第 # 部分:</title-part>
2823
+
2824
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2825
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2826
+
2827
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2828
+
2829
+
2830
+
2831
+ <title-modified lang="en">modified</title-modified>
2832
+ <title-modified lang="fr">modifiée</title-modified>
2833
+
2834
+ <title-modified lang="zh">modified</title-modified>
2835
+
2836
+
2837
+
2838
+ <title-source lang="en">SOURCE</title-source>
2839
+
2840
+ <title-keywords lang="en">Keywords</title-keywords>
2841
+
2842
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2843
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2844
+
2845
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2846
+
2847
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2848
+
2849
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2737
2850
 
2851
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2738
2852
 
2739
- </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
2853
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2854
+
2855
+ <title-abstract lang="en">Abstract</title-abstract>
2856
+
2857
+ <title-summary lang="en">Summary</title-summary>
2858
+
2859
+ <title-in lang="en">in </title-in>
2860
+
2861
+ <title-box lang="en">Box </title-box>
2862
+
2863
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2864
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2865
+
2866
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2867
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2868
+
2869
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2870
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2871
+
2872
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2873
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2874
+
2875
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2876
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2877
+
2878
+ <title-caution lang="en">CAUTION</title-caution>
2879
+ <title-caution lang="zh">注意</title-caution>
2880
+
2881
+ <title-warning lang="en">WARNING</title-warning>
2882
+ <title-warning lang="zh">警告</title-warning>
2883
+
2884
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2885
+ </xsl:variable><xsl:template name="getTitle">
2886
+ <xsl:param name="name"/>
2887
+ <xsl:variable name="lang">
2888
+ <xsl:call-template name="getLang"/>
2889
+ </xsl:variable>
2890
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2891
+ <xsl:choose>
2892
+ <xsl:when test="normalize-space($title_) != ''">
2893
+ <xsl:value-of select="$title_"/>
2894
+ </xsl:when>
2895
+ <xsl:otherwise>
2896
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2897
+ </xsl:otherwise>
2898
+ </xsl:choose>
2899
+ </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">
2900
+
2901
+
2902
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2903
+
2904
+
2905
+
2906
+
2907
+
2908
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2909
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2910
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2911
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2912
+
2913
+
2914
+
2915
+
2916
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2917
+
2918
+
2919
+
2920
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2921
+
2922
+
2923
+
2924
+ </xsl:attribute-set><xsl:template match="text()">
2740
2925
  <xsl:value-of select="."/>
2741
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
2926
+ </xsl:template><xsl:template match="*[local-name()='br']">
2742
2927
  <xsl:value-of select="$linebreak"/>
2743
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2744
- <xsl:call-template name="add-zero-spaces"/>
2745
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
2928
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2929
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2930
+ <xsl:call-template name="add-zero-spaces-java"/>
2931
+ </xsl:template><xsl:template match="*[local-name()='table']">
2746
2932
 
2747
2933
  <xsl:variable name="simple-table">
2748
2934
  <!-- <xsl:copy> -->
@@ -2777,33 +2963,17 @@
2777
2963
 
2778
2964
 
2779
2965
 
2780
- <xsl:text>Table </xsl:text>
2781
- <xsl:choose>
2782
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2783
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2784
- </xsl:when>
2785
- <xsl:when test="ancestor::*[local-name()='annex']">
2786
-
2787
-
2788
-
2789
-
2790
-
2791
- <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2792
- <xsl:number format="A-" count="*[local-name()='annex']"/>
2793
- <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2794
-
2795
-
2796
-
2797
-
2798
- </xsl:when>
2799
- <xsl:otherwise>
2800
-
2801
-
2802
- <xsl:number format="A." count="*[local-name()='annex']"/>
2803
- <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2804
-
2805
- </xsl:otherwise>
2806
- </xsl:choose>
2966
+
2967
+ <xsl:variable name="title-table">
2968
+ <xsl:call-template name="getTitle">
2969
+ <xsl:with-param name="name" select="'title-table'"/>
2970
+ </xsl:call-template>
2971
+ </xsl:variable>
2972
+ <xsl:value-of select="$title-table"/>
2973
+
2974
+ <xsl:call-template name="getTableNumber"/>
2975
+
2976
+
2807
2977
  <xsl:if test="*[local-name()='name']">
2808
2978
 
2809
2979
 
@@ -2873,6 +3043,7 @@
2873
3043
 
2874
3044
 
2875
3045
 
3046
+
2876
3047
  <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
2877
3048
 
2878
3049
 
@@ -2894,9 +3065,10 @@
2894
3065
 
2895
3066
 
2896
3067
 
3068
+
2897
3069
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2898
3070
  <xsl:choose>
2899
- <xsl:when test=". = 1">
3071
+ <xsl:when test=". = 1 or . = 0">
2900
3072
  <fo:table-column column-width="proportional-column-width(2)"/>
2901
3073
  </xsl:when>
2902
3074
  <xsl:otherwise>
@@ -2904,21 +3076,57 @@
2904
3076
  </xsl:otherwise>
2905
3077
  </xsl:choose>
2906
3078
  </xsl:for-each>
2907
- <xsl:apply-templates/>
2908
- </fo:table>
2909
-
3079
+
3080
+ <xsl:choose>
3081
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3082
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3083
+ </xsl:when>
3084
+ <xsl:otherwise>
3085
+ <xsl:apply-templates/>
3086
+ </xsl:otherwise>
3087
+ </xsl:choose>
3088
+
3089
+ </fo:table>
3090
+
2910
3091
 
2911
3092
 
2912
3093
  </fo:block-container>
2913
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
3094
+ </xsl:template><xsl:template name="getTableNumber">
3095
+ <xsl:choose>
3096
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3097
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3098
+ </xsl:when>
3099
+ <xsl:when test="ancestor::*[local-name()='annex']">
3100
+
3101
+
3102
+
3103
+
3104
+
3105
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
3106
+ <xsl:number format="A-" count="*[local-name()='annex']"/>
3107
+ <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
3108
+
3109
+
3110
+
3111
+
3112
+ </xsl:when>
3113
+ <xsl:otherwise>
3114
+
3115
+
3116
+ <xsl:number format="A." count="*[local-name()='annex']"/>
3117
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
3118
+
3119
+ </xsl:otherwise>
3120
+ </xsl:choose>
3121
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2914
3122
  <xsl:apply-templates/>
2915
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
3123
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2916
3124
  <xsl:param name="table-row"/>
2917
3125
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2918
3126
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2919
3127
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2920
3128
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2921
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
3129
+ </xsl:template><xsl:template name="calculate-column-widths">
2922
3130
  <xsl:param name="table"/>
2923
3131
  <xsl:param name="cols-count"/>
2924
3132
  <xsl:param name="curr-col" select="1"/>
@@ -2927,7 +3135,7 @@
2927
3135
  <xsl:if test="$curr-col &lt;= $cols-count">
2928
3136
  <xsl:variable name="widths">
2929
3137
  <xsl:choose>
2930
- <xsl:when test="not($table)">
3138
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2931
3139
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2932
3140
  <xsl:variable name="words">
2933
3141
  <xsl:call-template name="tokenize">
@@ -2966,9 +3174,16 @@
2966
3174
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2967
3175
  </xsl:variable>
2968
3176
  <xsl:variable name="words">
3177
+ <xsl:variable name="string_with_added_zerospaces">
3178
+ <xsl:call-template name="add-zero-spaces-java">
3179
+ <xsl:with-param name="text" select="$td_text"/>
3180
+ </xsl:call-template>
3181
+ </xsl:variable>
2969
3182
  <xsl:call-template name="tokenize">
2970
3183
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2971
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
3184
+ <!-- 2009 thinspace -->
3185
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3186
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2972
3187
  </xsl:call-template>
2973
3188
  </xsl:variable>
2974
3189
  <xsl:variable name="max_length">
@@ -3009,17 +3224,28 @@
3009
3224
  <xsl:with-param name="table" select="$table"/>
3010
3225
  </xsl:call-template>
3011
3226
  </xsl:if>
3012
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
3227
+ </xsl:template><xsl:template match="text()" mode="td_text">
3013
3228
  <xsl:variable name="zero-space">​</xsl:variable>
3014
3229
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3015
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
3230
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3231
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3232
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3233
+ <xsl:value-of select="@target"/>
3234
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3235
+ <xsl:param name="cols-count"/>
3016
3236
  <!-- font-weight="bold" -->
3017
- <fo:table-header>
3237
+ <fo:table-header>
3238
+
3018
3239
  <xsl:apply-templates/>
3019
3240
  </fo:table-header>
3020
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
3241
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3242
+ <fo:table-body>
3243
+ <xsl:apply-templates/>
3244
+ </fo:table-body>
3245
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
3021
3246
  <xsl:apply-templates/>
3022
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
3247
+ </xsl:template><xsl:template name="insertTableFooter">
3248
+ <xsl:param name="cols-count"/>
3023
3249
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3024
3250
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3025
3251
 
@@ -3030,22 +3256,7 @@
3030
3256
  <!-- if there are note(s) or fn(s) then create footer row -->
3031
3257
  <xsl:if test="$isNoteOrFnExist = 'true'">
3032
3258
 
3033
- <xsl:variable name="cols-count">
3034
- <xsl:choose>
3035
- <xsl:when test="../*[local-name()='thead']">
3036
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3037
- <xsl:call-template name="calculate-columns-numbers">
3038
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3039
- </xsl:call-template>
3040
- </xsl:when>
3041
- <xsl:otherwise>
3042
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3043
- <xsl:call-template name="calculate-columns-numbers">
3044
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3045
- </xsl:call-template>
3046
- </xsl:otherwise>
3047
- </xsl:choose>
3048
- </xsl:variable>
3259
+
3049
3260
 
3050
3261
  <fo:table-row>
3051
3262
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -3073,11 +3284,30 @@
3073
3284
  </fo:table-footer>
3074
3285
 
3075
3286
  </xsl:if>
3076
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
3287
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3077
3288
 
3078
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3289
+ <xsl:variable name="cols-count">
3290
+ <xsl:choose>
3291
+ <xsl:when test="../*[local-name()='thead']">
3292
+ <xsl:call-template name="calculate-columns-numbers">
3293
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3294
+ </xsl:call-template>
3295
+ </xsl:when>
3296
+ <xsl:otherwise>
3297
+ <xsl:call-template name="calculate-columns-numbers">
3298
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3299
+ </xsl:call-template>
3300
+ </xsl:otherwise>
3301
+ </xsl:choose>
3302
+ </xsl:variable>
3303
+
3304
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3305
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3306
+ </xsl:apply-templates>
3079
3307
 
3080
- <xsl:call-template name="insertTableFooter"/>
3308
+ <xsl:call-template name="insertTableFooter">
3309
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3310
+ </xsl:call-template>
3081
3311
 
3082
3312
  <fo:table-body>
3083
3313
  <xsl:apply-templates/>
@@ -3085,7 +3315,7 @@
3085
3315
 
3086
3316
  </fo:table-body>
3087
3317
 
3088
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
3318
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3089
3319
  <xsl:variable name="parent-name" select="local-name(..)"/>
3090
3320
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3091
3321
  <fo:table-row min-height="4mm">
@@ -3108,7 +3338,7 @@
3108
3338
 
3109
3339
  <xsl:apply-templates/>
3110
3340
  </fo:table-row>
3111
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
3341
+ </xsl:template><xsl:template match="*[local-name()='th']">
3112
3342
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3113
3343
 
3114
3344
 
@@ -3135,7 +3365,7 @@
3135
3365
  <xsl:apply-templates/>
3136
3366
  </fo:block>
3137
3367
  </fo:table-cell>
3138
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
3368
+ </xsl:template><xsl:template match="*[local-name()='td']">
3139
3369
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3140
3370
 
3141
3371
 
@@ -3161,6 +3391,7 @@
3161
3391
  </xsl:attribute>
3162
3392
  </xsl:if>
3163
3393
  <fo:block>
3394
+
3164
3395
  <xsl:apply-templates/>
3165
3396
  </fo:block>
3166
3397
  <!-- <xsl:choose>
@@ -3176,16 +3407,24 @@
3176
3407
 
3177
3408
 
3178
3409
  </fo:table-cell>
3179
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3410
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3180
3411
 
3181
3412
 
3182
3413
  <fo:block font-size="10pt" margin-bottom="12pt">
3183
3414
 
3184
3415
 
3185
3416
 
3417
+
3186
3418
  <fo:inline padding-right="2mm">
3187
3419
 
3188
- <xsl:text>NOTE </xsl:text>
3420
+
3421
+
3422
+ <xsl:variable name="title-note">
3423
+ <xsl:call-template name="getTitle">
3424
+ <xsl:with-param name="name" select="'title-note'"/>
3425
+ </xsl:call-template>
3426
+ </xsl:variable>
3427
+ <xsl:value-of select="$title-note"/>
3189
3428
 
3190
3429
 
3191
3430
 
@@ -3195,9 +3434,9 @@
3195
3434
  <xsl:apply-templates mode="process"/>
3196
3435
  </fo:block>
3197
3436
 
3198
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3437
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3199
3438
  <xsl:apply-templates/>
3200
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
3439
+ </xsl:template><xsl:template name="fn_display">
3201
3440
  <xsl:variable name="references">
3202
3441
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3203
3442
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3214,6 +3453,7 @@
3214
3453
 
3215
3454
 
3216
3455
 
3456
+
3217
3457
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3218
3458
 
3219
3459
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -3237,7 +3477,7 @@
3237
3477
  </fo:block>
3238
3478
  </xsl:if>
3239
3479
  </xsl:for-each>
3240
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
3480
+ </xsl:template><xsl:template name="fn_name_display">
3241
3481
  <!-- <xsl:variable name="references">
3242
3482
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3243
3483
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3253,7 +3493,7 @@
3253
3493
  <xsl:apply-templates/>
3254
3494
  </fo:block>
3255
3495
  </xsl:for-each>
3256
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
3496
+ </xsl:template><xsl:template name="fn_display_figure">
3257
3497
  <xsl:variable name="key_iso">
3258
3498
  <!-- and (not(@class) or @class !='pseudocode') -->
3259
3499
  </xsl:variable>
@@ -3264,6 +3504,36 @@
3264
3504
  </fn>
3265
3505
  </xsl:for-each>
3266
3506
  </xsl:variable>
3507
+
3508
+ <!-- current hierarchy is 'figure' element -->
3509
+ <xsl:variable name="following_dl_colwidths">
3510
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3511
+ <xsl:variable name="html-table">
3512
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3513
+ <xsl:element name="{$ns}:table">
3514
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3515
+ <tbody>
3516
+ <xsl:apply-templates mode="dl"/>
3517
+ </tbody>
3518
+ </xsl:for-each>
3519
+ </xsl:element>
3520
+ </xsl:variable>
3521
+
3522
+ <xsl:call-template name="calculate-column-widths">
3523
+ <xsl:with-param name="cols-count" select="2"/>
3524
+ <xsl:with-param name="table" select="$html-table"/>
3525
+ </xsl:call-template>
3526
+
3527
+ </xsl:if>
3528
+ </xsl:variable>
3529
+
3530
+
3531
+ <xsl:variable name="maxlength_dt">
3532
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3533
+ <xsl:call-template name="getMaxLength_dt"/>
3534
+ </xsl:for-each>
3535
+ </xsl:variable>
3536
+
3267
3537
  <xsl:if test="xalan:nodeset($references)//fn">
3268
3538
  <fo:block>
3269
3539
  <fo:table width="95%" table-layout="fixed">
@@ -3271,8 +3541,19 @@
3271
3541
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3272
3542
 
3273
3543
  </xsl:if>
3274
- <fo:table-column column-width="15%"/>
3275
- <fo:table-column column-width="85%"/>
3544
+ <xsl:choose>
3545
+ <!-- if there 'dl', then set same columns width -->
3546
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3547
+ <xsl:call-template name="setColumnWidth_dl">
3548
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3549
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3550
+ </xsl:call-template>
3551
+ </xsl:when>
3552
+ <xsl:otherwise>
3553
+ <fo:table-column column-width="15%"/>
3554
+ <fo:table-column column-width="85%"/>
3555
+ </xsl:otherwise>
3556
+ </xsl:choose>
3276
3557
  <fo:table-body>
3277
3558
  <xsl:for-each select="xalan:nodeset($references)//fn">
3278
3559
  <xsl:variable name="reference" select="@reference"/>
@@ -3304,7 +3585,7 @@
3304
3585
  </fo:block>
3305
3586
  </xsl:if>
3306
3587
 
3307
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
3588
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3308
3589
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3309
3590
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3310
3591
 
@@ -3321,11 +3602,11 @@
3321
3602
  <xsl:value-of select="@reference"/>
3322
3603
  </fo:basic-link>
3323
3604
  </fo:inline>
3324
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
3605
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3325
3606
  <fo:inline>
3326
3607
  <xsl:apply-templates/>
3327
3608
  </fo:inline>
3328
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
3609
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3329
3610
  <xsl:variable name="parent" select="local-name(..)"/>
3330
3611
 
3331
3612
  <xsl:variable name="key_iso">
@@ -3337,8 +3618,13 @@
3337
3618
 
3338
3619
 
3339
3620
  <fo:block margin-bottom="12pt" text-align="left">
3340
-
3341
- <xsl:text>where </xsl:text>
3621
+
3622
+ <xsl:variable name="title-where">
3623
+ <xsl:call-template name="getTitle">
3624
+ <xsl:with-param name="name" select="'title-where'"/>
3625
+ </xsl:call-template>
3626
+ </xsl:variable>
3627
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3342
3628
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3343
3629
  <xsl:text/>
3344
3630
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3351,15 +3637,25 @@
3351
3637
 
3352
3638
 
3353
3639
 
3354
- <xsl:text>where</xsl:text>
3640
+ <xsl:variable name="title-where">
3641
+ <xsl:call-template name="getTitle">
3642
+ <xsl:with-param name="name" select="'title-where'"/>
3643
+ </xsl:call-template>
3644
+ </xsl:variable>
3645
+ <xsl:value-of select="$title-where"/>
3355
3646
  </fo:block>
3356
3647
  </xsl:when>
3357
3648
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3358
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3649
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3359
3650
 
3360
3651
 
3361
3652
 
3362
- <xsl:text>Key</xsl:text>
3653
+ <xsl:variable name="title-key">
3654
+ <xsl:call-template name="getTitle">
3655
+ <xsl:with-param name="name" select="'title-key'"/>
3656
+ </xsl:call-template>
3657
+ </xsl:variable>
3658
+ <xsl:value-of select="$title-key"/>
3363
3659
  </fo:block>
3364
3660
  </xsl:when>
3365
3661
  </xsl:choose>
@@ -3374,6 +3670,7 @@
3374
3670
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
3375
3671
  </xsl:if>
3376
3672
 
3673
+
3377
3674
  <fo:block>
3378
3675
 
3379
3676
  <xsl:if test="not(.//*[local-name()='dt']//*[local-name()='stem'])">
@@ -3381,23 +3678,7 @@
3381
3678
  </xsl:if>
3382
3679
 
3383
3680
 
3384
- <!-- create virtual html table for dl/[dt and dd] -->
3385
- <xsl:variable name="html-table">
3386
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3387
- <xsl:element name="{$ns}:table">
3388
- <tbody>
3389
- <xsl:apply-templates mode="dl"/>
3390
- </tbody>
3391
- </xsl:element>
3392
- </xsl:variable>
3393
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3394
- <xsl:variable name="colwidths">
3395
- <xsl:call-template name="calculate-column-widths">
3396
- <xsl:with-param name="cols-count" select="2"/>
3397
- <xsl:with-param name="table" select="$html-table"/>
3398
- </xsl:call-template>
3399
- </xsl:variable>
3400
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3681
+
3401
3682
 
3402
3683
  <fo:table width="95%" table-layout="fixed">
3403
3684
 
@@ -3410,42 +3691,30 @@
3410
3691
 
3411
3692
  </xsl:when>
3412
3693
  </xsl:choose>
3413
- <xsl:choose>
3414
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3415
- <fo:table-column column-width="50%"/>
3416
- <fo:table-column column-width="50%"/>
3417
- </xsl:when>
3418
- <xsl:otherwise>
3419
- <xsl:choose>
3420
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3421
- <fo:table-column column-width="60%"/>
3422
- <fo:table-column column-width="40%"/>
3423
- </xsl:when> -->
3424
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3425
- <fo:table-column column-width="50%"/>
3426
- <fo:table-column column-width="50%"/>
3427
- </xsl:when>
3428
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3429
- <fo:table-column column-width="40%"/>
3430
- <fo:table-column column-width="60%"/>
3431
- </xsl:when>
3432
- <xsl:otherwise>
3433
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3434
- <xsl:choose>
3435
- <xsl:when test=". = 1">
3436
- <fo:table-column column-width="proportional-column-width(2)"/>
3437
- </xsl:when>
3438
- <xsl:otherwise>
3439
- <fo:table-column column-width="proportional-column-width({.})"/>
3440
- </xsl:otherwise>
3441
- </xsl:choose>
3442
- </xsl:for-each>
3443
- </xsl:otherwise>
3444
- </xsl:choose>
3445
- <!-- <fo:table-column column-width="15%"/>
3446
- <fo:table-column column-width="85%"/> -->
3447
- </xsl:otherwise>
3448
- </xsl:choose>
3694
+ <!-- create virtual html table for dl/[dt and dd] -->
3695
+ <xsl:variable name="html-table">
3696
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3697
+ <xsl:element name="{$ns}:table">
3698
+ <tbody>
3699
+ <xsl:apply-templates mode="dl"/>
3700
+ </tbody>
3701
+ </xsl:element>
3702
+ </xsl:variable>
3703
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3704
+ <xsl:variable name="colwidths">
3705
+ <xsl:call-template name="calculate-column-widths">
3706
+ <xsl:with-param name="cols-count" select="2"/>
3707
+ <xsl:with-param name="table" select="$html-table"/>
3708
+ </xsl:call-template>
3709
+ </xsl:variable>
3710
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3711
+ <xsl:variable name="maxlength_dt">
3712
+ <xsl:call-template name="getMaxLength_dt"/>
3713
+ </xsl:variable>
3714
+ <xsl:call-template name="setColumnWidth_dl">
3715
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3716
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3717
+ </xsl:call-template>
3449
3718
  <fo:table-body>
3450
3719
  <xsl:apply-templates>
3451
3720
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3455,7 +3724,61 @@
3455
3724
  </fo:block>
3456
3725
  </fo:block>
3457
3726
  </xsl:if>
3458
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
3727
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3728
+ <xsl:param name="colwidths"/>
3729
+ <xsl:param name="maxlength_dt"/>
3730
+ <xsl:choose>
3731
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3732
+ <fo:table-column column-width="50%"/>
3733
+ <fo:table-column column-width="50%"/>
3734
+ </xsl:when>
3735
+ <xsl:otherwise>
3736
+ <xsl:choose>
3737
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3738
+ <fo:table-column column-width="5%"/>
3739
+ <fo:table-column column-width="95%"/>
3740
+ </xsl:when>
3741
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3742
+ <fo:table-column column-width="10%"/>
3743
+ <fo:table-column column-width="90%"/>
3744
+ </xsl:when>
3745
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3746
+ <fo:table-column column-width="60%"/>
3747
+ <fo:table-column column-width="40%"/>
3748
+ </xsl:when> -->
3749
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3750
+ <fo:table-column column-width="50%"/>
3751
+ <fo:table-column column-width="50%"/>
3752
+ </xsl:when>
3753
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3754
+ <fo:table-column column-width="40%"/>
3755
+ <fo:table-column column-width="60%"/>
3756
+ </xsl:when>
3757
+ <xsl:otherwise>
3758
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3759
+ <xsl:choose>
3760
+ <xsl:when test=". = 1 or . = 0">
3761
+ <fo:table-column column-width="proportional-column-width(2)"/>
3762
+ </xsl:when>
3763
+ <xsl:otherwise>
3764
+ <fo:table-column column-width="proportional-column-width({.})"/>
3765
+ </xsl:otherwise>
3766
+ </xsl:choose>
3767
+ </xsl:for-each>
3768
+ </xsl:otherwise>
3769
+ </xsl:choose>
3770
+ <!-- <fo:table-column column-width="15%"/>
3771
+ <fo:table-column column-width="85%"/> -->
3772
+ </xsl:otherwise>
3773
+ </xsl:choose>
3774
+ </xsl:template><xsl:template name="getMaxLength_dt">
3775
+ <xsl:for-each select="*[local-name()='dt']">
3776
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3777
+ <xsl:if test="position() = 1">
3778
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3779
+ </xsl:if>
3780
+ </xsl:for-each>
3781
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3459
3782
  <xsl:param name="key_iso"/>
3460
3783
 
3461
3784
  <!-- <tr>
@@ -3471,7 +3794,12 @@
3471
3794
  <xsl:if test="normalize-space($key_iso) = 'true'">
3472
3795
  <xsl:attribute name="margin-top">0</xsl:attribute>
3473
3796
  </xsl:if>
3474
- NOTE
3797
+ <xsl:variable name="title-note">
3798
+ <xsl:call-template name="getTitle">
3799
+ <xsl:with-param name="name" select="'title-note'"/>
3800
+ </xsl:call-template>
3801
+ </xsl:variable>
3802
+ <xsl:value-of select="$title-note"/>
3475
3803
  </fo:block>
3476
3804
  </fo:table-cell>
3477
3805
  <fo:table-cell>
@@ -3480,7 +3808,7 @@
3480
3808
  </fo:block>
3481
3809
  </fo:table-cell>
3482
3810
  </fo:table-row>
3483
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
3811
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3484
3812
  <tr>
3485
3813
  <td>
3486
3814
  <xsl:apply-templates/>
@@ -3506,11 +3834,12 @@
3506
3834
  </tr>
3507
3835
  </xsl:if>
3508
3836
 
3509
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
3837
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3510
3838
  <xsl:param name="key_iso"/>
3511
3839
 
3512
3840
  <fo:table-row>
3513
3841
  <fo:table-cell>
3842
+
3514
3843
  <fo:block margin-top="6pt">
3515
3844
 
3516
3845
 
@@ -3523,8 +3852,15 @@
3523
3852
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3524
3853
 
3525
3854
 
3526
- <xsl:apply-templates/>
3527
3855
 
3856
+
3857
+
3858
+ <xsl:apply-templates/>
3859
+ <!-- <xsl:if test="$namespace = 'gb'">
3860
+ <xsl:if test="ancestor::*[local-name()='formula']">
3861
+ <xsl:text>—</xsl:text>
3862
+ </xsl:if>
3863
+ </xsl:if> -->
3528
3864
  </fo:block>
3529
3865
  </fo:table-cell>
3530
3866
  <fo:table-cell>
@@ -3558,37 +3894,37 @@
3558
3894
  </fo:table-row>
3559
3895
  </xsl:if>
3560
3896
 
3561
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
3897
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3562
3898
  <xsl:apply-templates/>
3563
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
3899
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3564
3900
  <xsl:apply-templates/>
3565
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3901
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3566
3902
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3567
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
3903
+ </xsl:template><xsl:template match="*[local-name()='em']">
3568
3904
  <fo:inline font-style="italic">
3569
3905
  <xsl:apply-templates/>
3570
3906
  </fo:inline>
3571
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
3907
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3572
3908
  <fo:inline font-weight="bold">
3573
3909
  <xsl:apply-templates/>
3574
3910
  </fo:inline>
3575
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
3911
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3576
3912
  <fo:inline font-size="80%" vertical-align="super">
3577
3913
  <xsl:apply-templates/>
3578
3914
  </fo:inline>
3579
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
3915
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3580
3916
  <fo:inline font-size="80%" vertical-align="sub">
3581
3917
  <xsl:apply-templates/>
3582
3918
  </fo:inline>
3583
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
3584
- <fo:inline font-family="Courier" font-size="10pt">
3919
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3920
+ <fo:inline font-family="Courier" font-size="10pt">
3585
3921
  <xsl:apply-templates/>
3586
3922
  </fo:inline>
3587
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
3923
+ </xsl:template><xsl:template match="*[local-name()='del']">
3588
3924
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3589
3925
  <xsl:apply-templates/>
3590
3926
  </fo:inline>
3591
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
3927
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3592
3928
  <xsl:variable name="text" select="normalize-space(.)"/>
3593
3929
  <fo:inline font-size="75%">
3594
3930
  <xsl:if test="string-length($text) &gt; 0">
@@ -3597,10 +3933,11 @@
3597
3933
  </xsl:call-template>
3598
3934
  </xsl:if>
3599
3935
  </fo:inline>
3600
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
3936
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3601
3937
  <xsl:param name="text"/>
3602
3938
  <xsl:variable name="char" select="substring($text,1,1)"/>
3603
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3939
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3940
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3604
3941
  <xsl:choose>
3605
3942
  <xsl:when test="$char=$upperCase">
3606
3943
  <fo:inline font-size="{100 div 0.75}%">
@@ -3616,7 +3953,7 @@
3616
3953
  <xsl:with-param name="text" select="substring($text,2)"/>
3617
3954
  </xsl:call-template>
3618
3955
  </xsl:if>
3619
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
3956
+ </xsl:template><xsl:template name="tokenize">
3620
3957
  <xsl:param name="text"/>
3621
3958
  <xsl:param name="separator" select="' '"/>
3622
3959
  <xsl:choose>
@@ -3664,7 +4001,7 @@
3664
4001
  </xsl:call-template>
3665
4002
  </xsl:otherwise>
3666
4003
  </xsl:choose>
3667
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
4004
+ </xsl:template><xsl:template name="max_length">
3668
4005
  <xsl:param name="words"/>
3669
4006
  <xsl:for-each select="$words//word">
3670
4007
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3672,7 +4009,11 @@
3672
4009
  <xsl:value-of select="."/>
3673
4010
  </xsl:if>
3674
4011
  </xsl:for-each>
3675
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
4012
+ </xsl:template><xsl:template name="add-zero-spaces-java">
4013
+ <xsl:param name="text" select="."/>
4014
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4015
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4016
+ </xsl:template><xsl:template name="add-zero-spaces">
3676
4017
  <xsl:param name="text" select="."/>
3677
4018
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3678
4019
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3725,7 +4066,7 @@
3725
4066
  <xsl:value-of select="$text"/>
3726
4067
  </xsl:otherwise>
3727
4068
  </xsl:choose>
3728
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
4069
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3729
4070
  <xsl:param name="text" select="."/>
3730
4071
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3731
4072
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3751,7 +4092,7 @@
3751
4092
  <xsl:value-of select="$text"/>
3752
4093
  </xsl:otherwise>
3753
4094
  </xsl:choose>
3754
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
4095
+ </xsl:template><xsl:template name="getSimpleTable">
3755
4096
  <xsl:variable name="simple-table">
3756
4097
 
3757
4098
  <!-- Step 1. colspan processing -->
@@ -3778,9 +4119,9 @@
3778
4119
  </xsl:choose> -->
3779
4120
  </xsl:variable>
3780
4121
  <xsl:copy-of select="$simple-table"/>
3781
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4122
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3782
4123
  <xsl:apply-templates mode="simple-table-colspan"/>
3783
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
4124
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3784
4125
  <xsl:choose>
3785
4126
  <xsl:when test="@colspan">
3786
4127
  <xsl:variable name="td">
@@ -3802,16 +4143,16 @@
3802
4143
  </xsl:element>
3803
4144
  </xsl:otherwise>
3804
4145
  </xsl:choose>
3805
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
4146
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3806
4147
  <xsl:element name="tr">
3807
4148
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3808
4149
  <xsl:apply-templates mode="simple-table-colspan"/>
3809
4150
  </xsl:element>
3810
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
4151
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3811
4152
  <xsl:copy>
3812
4153
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3813
4154
  </xsl:copy>
3814
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
4155
+ </xsl:template><xsl:template name="repeatNode">
3815
4156
  <xsl:param name="count"/>
3816
4157
  <xsl:param name="node"/>
3817
4158
 
@@ -3822,18 +4163,18 @@
3822
4163
  </xsl:call-template>
3823
4164
  <xsl:copy-of select="$node"/>
3824
4165
  </xsl:if>
3825
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
4166
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3826
4167
  <xsl:copy>
3827
4168
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3828
4169
  </xsl:copy>
3829
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
4170
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3830
4171
  <xsl:copy>
3831
4172
  <xsl:copy-of select="tr[1]"/>
3832
4173
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3833
4174
  <xsl:with-param name="previousRow" select="tr[1]"/>
3834
4175
  </xsl:apply-templates>
3835
4176
  </xsl:copy>
3836
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
4177
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3837
4178
  <xsl:param name="previousRow"/>
3838
4179
  <xsl:variable name="currentRow" select="."/>
3839
4180
 
@@ -3867,43 +4208,53 @@
3867
4208
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3868
4209
  <xsl:with-param name="previousRow" select="$newRow"/>
3869
4210
  </xsl:apply-templates>
3870
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
4211
+ </xsl:template><xsl:template name="getLang">
3871
4212
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3872
4213
  <xsl:choose>
3873
4214
  <xsl:when test="$language = 'English'">en</xsl:when>
3874
4215
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3875
4216
  </xsl:choose>
3876
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
4217
+ </xsl:template><xsl:template name="capitalizeWords">
3877
4218
  <xsl:param name="str"/>
3878
4219
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3879
4220
  <xsl:choose>
3880
4221
  <xsl:when test="contains($str2, ' ')">
3881
4222
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3882
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3883
- <xsl:value-of select="substring($substr, 2)"/>
4223
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4224
+ <xsl:value-of select="substring($substr, 2)"/> -->
4225
+ <xsl:call-template name="capitalize">
4226
+ <xsl:with-param name="str" select="$substr"/>
4227
+ </xsl:call-template>
3884
4228
  <xsl:text> </xsl:text>
3885
4229
  <xsl:call-template name="capitalizeWords">
3886
4230
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3887
4231
  </xsl:call-template>
3888
4232
  </xsl:when>
3889
4233
  <xsl:otherwise>
3890
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3891
- <xsl:value-of select="substring($str2, 2)"/>
4234
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4235
+ <xsl:value-of select="substring($str2, 2)"/> -->
4236
+ <xsl:call-template name="capitalize">
4237
+ <xsl:with-param name="str" select="$str2"/>
4238
+ </xsl:call-template>
3892
4239
  </xsl:otherwise>
3893
4240
  </xsl:choose>
3894
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
4241
+ </xsl:template><xsl:template name="capitalize">
4242
+ <xsl:param name="str"/>
4243
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4244
+ <xsl:value-of select="substring($str, 2)"/>
4245
+ </xsl:template><xsl:template match="mathml:math">
3895
4246
  <fo:inline font-family="STIX2Math">
3896
4247
  <fo:instream-foreign-object fox:alt-text="Math">
3897
4248
  <xsl:copy-of select="."/>
3898
4249
  </fo:instream-foreign-object>
3899
4250
  </fo:inline>
3900
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
4251
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3901
4252
  <xsl:for-each select="*[local-name()='locality']">
3902
4253
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3903
4254
  <xsl:apply-templates select="."/>
3904
4255
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3905
4256
  </xsl:for-each>
3906
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
4257
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3907
4258
  <xsl:variable name="target">
3908
4259
  <xsl:choose>
3909
4260
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3933,4 +4284,280 @@
3933
4284
  </xsl:otherwise>
3934
4285
  </xsl:choose>
3935
4286
  </fo:inline>
4287
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4288
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4289
+ <!-- <xsl:choose>
4290
+ <xsl:when test="@lang = 'en'"></xsl:when>
4291
+ <xsl:otherwise> -->
4292
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4293
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4294
+ <!-- </xsl:otherwise>
4295
+ </xsl:choose> -->
4296
+ <xsl:apply-templates/>
4297
+ </fo:block>
4298
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4299
+ <fo:inline id="{@id}"/>
4300
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4301
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4302
+ <xsl:variable name="title-appendix">
4303
+ <xsl:call-template name="getTitle">
4304
+ <xsl:with-param name="name" select="'title-appendix'"/>
4305
+ </xsl:call-template>
4306
+ </xsl:variable>
4307
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4308
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4309
+ </fo:block>
4310
+ <xsl:apply-templates/>
4311
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4312
+ <fo:inline><xsl:apply-templates/></fo:inline>
4313
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4314
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4315
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4316
+ <xsl:variable name="title-example">
4317
+ <xsl:call-template name="getTitle">
4318
+ <xsl:with-param name="name" select="'title-example'"/>
4319
+ </xsl:call-template>
4320
+ </xsl:variable>
4321
+ <xsl:value-of select="$title-example"/>
4322
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4323
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4324
+ </xsl:if>
4325
+ <xsl:if test="*[local-name()='name']">
4326
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4327
+ </xsl:if>
4328
+ </fo:block>
4329
+ <xsl:apply-templates/>
4330
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
4331
+ <fo:inline><xsl:apply-templates/></fo:inline>
4332
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4333
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4334
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4335
+ <xsl:variable name="annotation-id" select="@id"/>
4336
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4337
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4338
+ <fo:inline>
4339
+ <xsl:apply-templates>
4340
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4341
+ </xsl:apply-templates>
4342
+ </fo:inline>
4343
+ </fo:block>
4344
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4345
+ <xsl:param name="callout"/>
4346
+ <fo:inline id="{@id}">
4347
+ <!-- for first p in annotation, put <x> -->
4348
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4349
+ <xsl:apply-templates/>
4350
+ </fo:inline>
4351
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4352
+ <xsl:variable name="title-modified">
4353
+ <xsl:call-template name="getTitle">
4354
+ <xsl:with-param name="name" select="'title-modified'"/>
4355
+ </xsl:call-template>
4356
+ </xsl:variable>
4357
+ <xsl:choose>
4358
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4359
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4360
+ </xsl:choose>
4361
+ <xsl:apply-templates/>
4362
+ </xsl:template><xsl:template name="convertDate">
4363
+ <xsl:param name="date"/>
4364
+ <xsl:param name="format" select="'short'"/>
4365
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4366
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4367
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4368
+ <xsl:variable name="monthStr">
4369
+ <xsl:choose>
4370
+ <xsl:when test="$month = '01'">January</xsl:when>
4371
+ <xsl:when test="$month = '02'">February</xsl:when>
4372
+ <xsl:when test="$month = '03'">March</xsl:when>
4373
+ <xsl:when test="$month = '04'">April</xsl:when>
4374
+ <xsl:when test="$month = '05'">May</xsl:when>
4375
+ <xsl:when test="$month = '06'">June</xsl:when>
4376
+ <xsl:when test="$month = '07'">July</xsl:when>
4377
+ <xsl:when test="$month = '08'">August</xsl:when>
4378
+ <xsl:when test="$month = '09'">September</xsl:when>
4379
+ <xsl:when test="$month = '10'">October</xsl:when>
4380
+ <xsl:when test="$month = '11'">November</xsl:when>
4381
+ <xsl:when test="$month = '12'">December</xsl:when>
4382
+ </xsl:choose>
4383
+ </xsl:variable>
4384
+ <xsl:variable name="result">
4385
+ <xsl:choose>
4386
+ <xsl:when test="$format = 'short' or $day = ''">
4387
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4388
+ </xsl:when>
4389
+ <xsl:otherwise>
4390
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4391
+ </xsl:otherwise>
4392
+ </xsl:choose>
4393
+ </xsl:variable>
4394
+ <xsl:value-of select="$result"/>
4395
+ </xsl:template><xsl:template name="insertKeywords">
4396
+ <xsl:param name="sorting" select="'true'"/>
4397
+ <xsl:param name="charAtEnd" select="'.'"/>
4398
+ <xsl:param name="charDelim" select="', '"/>
4399
+ <xsl:choose>
4400
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4401
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4402
+ <xsl:sort data-type="text" order="ascending"/>
4403
+ <xsl:call-template name="insertKeyword">
4404
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4405
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4406
+ </xsl:call-template>
4407
+ </xsl:for-each>
4408
+ </xsl:when>
4409
+ <xsl:otherwise>
4410
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4411
+ <xsl:call-template name="insertKeyword">
4412
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4413
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4414
+ </xsl:call-template>
4415
+ </xsl:for-each>
4416
+ </xsl:otherwise>
4417
+ </xsl:choose>
4418
+ </xsl:template><xsl:template name="insertKeyword">
4419
+ <xsl:param name="charAtEnd"/>
4420
+ <xsl:param name="charDelim"/>
4421
+ <xsl:apply-templates/>
4422
+ <xsl:choose>
4423
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4424
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4425
+ </xsl:choose>
4426
+ </xsl:template><xsl:template name="addPDFUAmeta">
4427
+ <fo:declarations>
4428
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4429
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4430
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4431
+ </pdf:dictionary>
4432
+ </pdf:catalog>
4433
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4434
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4435
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4436
+ <!-- Dublin Core properties go here -->
4437
+ <dc:title>
4438
+ <xsl:variable name="title">
4439
+
4440
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4441
+
4442
+
4443
+
4444
+
4445
+ </xsl:variable>
4446
+ <xsl:choose>
4447
+ <xsl:when test="normalize-space($title) != ''">
4448
+ <xsl:value-of select="$title"/>
4449
+ </xsl:when>
4450
+ <xsl:otherwise>
4451
+ <xsl:text> </xsl:text>
4452
+ </xsl:otherwise>
4453
+ </xsl:choose>
4454
+ </dc:title>
4455
+ <dc:creator>
4456
+
4457
+
4458
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4459
+ <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
4460
+ <xsl:if test="position() != last()">; </xsl:if>
4461
+ </xsl:for-each>
4462
+
4463
+ </dc:creator>
4464
+ <dc:description>
4465
+ <xsl:variable name="abstract">
4466
+
4467
+
4468
+
4469
+ <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4470
+
4471
+
4472
+ </xsl:variable>
4473
+ <xsl:value-of select="normalize-space($abstract)"/>
4474
+ </dc:description>
4475
+ <pdf:Keywords>
4476
+ <xsl:call-template name="insertKeywords"/>
4477
+ </pdf:Keywords>
4478
+ </rdf:Description>
4479
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4480
+ <!-- XMP properties go here -->
4481
+ <xmp:CreatorTool/>
4482
+ </rdf:Description>
4483
+ </rdf:RDF>
4484
+ </x:xmpmeta>
4485
+ </fo:declarations>
4486
+ </xsl:template><xsl:template name="getId">
4487
+ <xsl:choose>
4488
+ <xsl:when test="../@id">
4489
+ <xsl:value-of select="../@id"/>
4490
+ </xsl:when>
4491
+ <xsl:otherwise>
4492
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4493
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4494
+ </xsl:otherwise>
4495
+ </xsl:choose>
4496
+ </xsl:template><xsl:template name="getLevel">
4497
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4498
+ <xsl:variable name="level">
4499
+ <xsl:choose>
4500
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4501
+ <xsl:value-of select="$level_total - 2"/>
4502
+ </xsl:when>
4503
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4504
+ <xsl:value-of select="$level_total - 2"/>
4505
+ </xsl:when>
4506
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4507
+ <xsl:value-of select="$level_total - 2"/>
4508
+ </xsl:when>
4509
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4510
+ <xsl:otherwise>
4511
+ <xsl:value-of select="$level_total - 1"/>
4512
+ </xsl:otherwise>
4513
+ </xsl:choose>
4514
+ </xsl:variable>
4515
+ <xsl:value-of select="$level"/>
4516
+ </xsl:template><xsl:template name="getSubSection">
4517
+ <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']"/>
4518
+ </xsl:template><xsl:template name="split">
4519
+ <xsl:param name="pText" select="."/>
4520
+ <xsl:param name="sep" select="','"/>
4521
+ <xsl:if test="string-length($pText) &gt;0">
4522
+ <item>
4523
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4524
+ </item>
4525
+ <xsl:call-template name="split">
4526
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4527
+ <xsl:with-param name="sep" select="$sep"/>
4528
+ </xsl:call-template>
4529
+ </xsl:if>
4530
+ </xsl:template><xsl:template name="getDocumentId">
4531
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4532
+ </xsl:template><xsl:template name="namespaceCheck">
4533
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
4534
+ <xsl:variable name="XSLNS">
4535
+
4536
+
4537
+
4538
+
4539
+
4540
+ <xsl:value-of select="document('')//*/namespace::nist"/>
4541
+
4542
+
4543
+
4544
+
4545
+
4546
+
4547
+
4548
+
4549
+ </xsl:variable>
4550
+ <xsl:if test="$documentNS != $XSLNS">
4551
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
4552
+ </xsl:if>
4553
+ </xsl:template><xsl:template name="getLanguage">
4554
+ <xsl:param name="lang"/>
4555
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
4556
+ <xsl:choose>
4557
+ <xsl:when test="$language = 'en'">English</xsl:when>
4558
+ <xsl:when test="$language = 'fr'">French</xsl:when>
4559
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
4560
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
4561
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4562
+ </xsl:choose>
3936
4563
  </xsl:template></xsl:stylesheet>