metanorma-nist 1.0.8 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) 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/README.adoc +22 -0
  6. data/Rakefile +2 -0
  7. data/lib/asciidoctor/nist/biblio.rng +14 -4
  8. data/lib/asciidoctor/nist/cleanup.rb +5 -4
  9. data/lib/asciidoctor/nist/converter.rb +13 -18
  10. data/lib/asciidoctor/nist/front.rb +1 -0
  11. data/lib/asciidoctor/nist/front_id.rb +73 -23
  12. data/lib/asciidoctor/nist/isodoc.rng +444 -1
  13. data/lib/asciidoctor/nist/reqt.rng +23 -0
  14. data/lib/isodoc/nist/base_convert.rb +66 -62
  15. data/lib/isodoc/nist/html/_coverpage.scss +1 -1
  16. data/lib/isodoc/nist/html/html_nist_titlepage.html +1 -1
  17. data/lib/isodoc/nist/html/nist.scss +1 -2
  18. data/lib/isodoc/nist/html/nist_cswp.scss +1 -2
  19. data/lib/isodoc/nist/html/wordstyle.scss +0 -1
  20. data/lib/isodoc/nist/html/wordstyle_cswp.scss +0 -1
  21. data/lib/isodoc/nist/html_convert.rb +30 -68
  22. data/lib/isodoc/nist/metadata.rb +0 -6
  23. data/lib/isodoc/nist/nist.cswp.xsl +1116 -359
  24. data/lib/isodoc/nist/nist.sp.xsl +1276 -512
  25. data/lib/isodoc/nist/pdf_convert.rb +4 -15
  26. data/lib/isodoc/nist/presentation_xml_convert.rb +10 -0
  27. data/lib/isodoc/nist/refs.rb +44 -2
  28. data/lib/isodoc/nist/section.rb +56 -0
  29. data/lib/isodoc/nist/word_convert.rb +2 -42
  30. data/lib/isodoc/nist/word_convert_toc.rb +2 -2
  31. data/lib/isodoc/nist/{xrefs.rb → xref.rb} +2 -2
  32. data/lib/metanorma-nist.rb +2 -0
  33. data/lib/metanorma/nist/processor.rb +6 -8
  34. data/lib/metanorma/nist/version.rb +1 -1
  35. data/metanorma-nist.gemspec +4 -2
  36. metadata +41 -12
@@ -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,13 +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: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()">
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>
2850
+
2851
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2852
+
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()">
2737
2925
  <xsl:value-of select="."/>
2738
- </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']">
2739
2927
  <xsl:value-of select="$linebreak"/>
2740
- </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()" priority="1">
2741
- <xsl:call-template name="add-zero-spaces"/>
2742
- </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']">
2743
2932
 
2744
2933
  <xsl:variable name="simple-table">
2745
2934
  <!-- <xsl:copy> -->
@@ -2753,6 +2942,9 @@
2753
2942
 
2754
2943
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2755
2944
 
2945
+ <!-- <xsl:if test="$namespace = 'iso'">
2946
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2947
+ </xsl:if> -->
2756
2948
 
2757
2949
  <xsl:choose>
2758
2950
  <xsl:when test="@unnumbered = 'true'"/>
@@ -2762,36 +2954,26 @@
2762
2954
 
2763
2955
  <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2764
2956
 
2957
+
2958
+
2765
2959
  <xsl:attribute name="font-family">Arial</xsl:attribute>
2766
2960
  <xsl:attribute name="font-size">9pt</xsl:attribute>
2767
2961
 
2768
2962
 
2769
2963
 
2770
2964
 
2771
- <xsl:text>Table </xsl:text>
2772
- <xsl:choose>
2773
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2774
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2775
- </xsl:when>
2776
- <xsl:when test="ancestor::*[local-name()='annex']">
2777
-
2778
-
2779
-
2780
- <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2781
- <xsl:number format="A-" count="*[local-name()='annex']"/>
2782
- <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2783
-
2784
-
2785
-
2786
-
2787
- </xsl:when>
2788
- <xsl:otherwise>
2789
- <!-- <xsl:number format="1"/> -->
2790
- <xsl:number format="A." count="*[local-name()='annex']"/>
2791
- <!-- <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/> -->
2792
- <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']"/>
2793
- </xsl:otherwise>
2794
- </xsl:choose>
2965
+
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
+
2795
2977
  <xsl:if test="*[local-name()='name']">
2796
2978
 
2797
2979
 
@@ -2834,11 +3016,11 @@
2834
3016
  </xsl:call-template>
2835
3017
  </xsl:variable>
2836
3018
 
2837
- <xsl:variable name="colwidths2">
3019
+ <!-- <xsl:variable name="colwidths2">
2838
3020
  <xsl:call-template name="calculate-column-widths">
2839
3021
  <xsl:with-param name="cols-count" select="$cols-count"/>
2840
3022
  </xsl:call-template>
2841
- </xsl:variable>
3023
+ </xsl:variable> -->
2842
3024
 
2843
3025
  <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2844
3026
  colwidthsNew=<xsl:copy-of select="$colwidths"/>
@@ -2859,7 +3041,12 @@
2859
3041
 
2860
3042
 
2861
3043
 
2862
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
3044
+
3045
+
3046
+
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">
3048
+
3049
+
2863
3050
 
2864
3051
 
2865
3052
 
@@ -2878,9 +3065,10 @@
2878
3065
 
2879
3066
 
2880
3067
 
3068
+
2881
3069
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2882
3070
  <xsl:choose>
2883
- <xsl:when test=". = 1">
3071
+ <xsl:when test=". = 1 or . = 0">
2884
3072
  <fo:table-column column-width="proportional-column-width(2)"/>
2885
3073
  </xsl:when>
2886
3074
  <xsl:otherwise>
@@ -2888,18 +3076,57 @@
2888
3076
  </xsl:otherwise>
2889
3077
  </xsl:choose>
2890
3078
  </xsl:for-each>
2891
- <xsl:apply-templates/>
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
+
2892
3089
  </fo:table>
3090
+
3091
+
3092
+
2893
3093
  </fo:block-container>
2894
- </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">
2895
3122
  <xsl:apply-templates/>
2896
- </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">
2897
3124
  <xsl:param name="table-row"/>
2898
3125
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2899
3126
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2900
3127
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2901
3128
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2902
- </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">
2903
3130
  <xsl:param name="table"/>
2904
3131
  <xsl:param name="cols-count"/>
2905
3132
  <xsl:param name="curr-col" select="1"/>
@@ -2908,7 +3135,7 @@
2908
3135
  <xsl:if test="$curr-col &lt;= $cols-count">
2909
3136
  <xsl:variable name="widths">
2910
3137
  <xsl:choose>
2911
- <xsl:when test="not($table)">
3138
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2912
3139
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2913
3140
  <xsl:variable name="words">
2914
3141
  <xsl:call-template name="tokenize">
@@ -2943,9 +3170,20 @@
2943
3170
  </xsl:when>
2944
3171
  <xsl:otherwise>
2945
3172
  <xsl:for-each select="xalan:nodeset($table)//tr">
3173
+ <xsl:variable name="td_text">
3174
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3175
+ </xsl:variable>
2946
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>
2947
3182
  <xsl:call-template name="tokenize">
2948
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
3183
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
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, '​', ' '))"/>
2949
3187
  </xsl:call-template>
2950
3188
  </xsl:variable>
2951
3189
  <xsl:variable name="max_length">
@@ -2986,52 +3224,98 @@
2986
3224
  <xsl:with-param name="table" select="$table"/>
2987
3225
  </xsl:call-template>
2988
3226
  </xsl:if>
2989
- </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">
2990
- <!-- <fo:table-header font-weight="bold">
2991
- <xsl:apply-templates />
2992
- </fo:table-header> -->
2993
- <xsl:apply-templates/>
2994
- </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">
3227
+ </xsl:template><xsl:template match="text()" mode="td_text">
3228
+ <xsl:variable name="zero-space">​</xsl:variable>
3229
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
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"/>
3236
+ <!-- font-weight="bold" -->
3237
+ <fo:table-header>
3238
+
3239
+ <xsl:apply-templates/>
3240
+ </fo:table-header>
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">
2995
3246
  <xsl:apply-templates/>
2996
- </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']">
3247
+ </xsl:template><xsl:template name="insertTableFooter">
3248
+ <xsl:param name="cols-count"/>
3249
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3250
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3251
+
3252
+ <fo:table-footer>
3253
+
3254
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3255
+
3256
+ <!-- if there are note(s) or fn(s) then create footer row -->
3257
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3258
+
3259
+
3260
+
3261
+ <fo:table-row>
3262
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3263
+
3264
+
3265
+
3266
+ <!-- fn will be processed inside 'note' processing -->
3267
+
3268
+
3269
+ <!-- except gb -->
3270
+
3271
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3272
+
3273
+
3274
+ <!-- horizontal row separator -->
3275
+
3276
+
3277
+ <!-- fn processing -->
3278
+ <xsl:call-template name="fn_display"/>
3279
+
3280
+ </fo:table-cell>
3281
+ </fo:table-row>
3282
+
3283
+ </xsl:if>
3284
+ </fo:table-footer>
3285
+
3286
+ </xsl:if>
3287
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3288
+
2997
3289
  <xsl:variable name="cols-count">
2998
3290
  <xsl:choose>
2999
- <xsl:when test="../*[local-name()='thead']">
3000
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3291
+ <xsl:when test="../*[local-name()='thead']">
3001
3292
  <xsl:call-template name="calculate-columns-numbers">
3002
3293
  <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3003
3294
  </xsl:call-template>
3004
3295
  </xsl:when>
3005
- <xsl:otherwise>
3006
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3296
+ <xsl:otherwise>
3007
3297
  <xsl:call-template name="calculate-columns-numbers">
3008
3298
  <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3009
3299
  </xsl:call-template>
3010
3300
  </xsl:otherwise>
3011
3301
  </xsl:choose>
3012
3302
  </xsl:variable>
3013
-
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>
3307
+
3308
+ <xsl:call-template name="insertTableFooter">
3309
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3310
+ </xsl:call-template>
3311
+
3014
3312
  <fo:table-body>
3015
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3016
3313
  <xsl:apply-templates/>
3017
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3018
- <!-- if there are note(s) or fn(s) then create footer row -->
3019
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
3020
- <fo:table-row>
3021
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3022
-
3023
-
3024
- <!-- fn will be processed inside 'note' processing -->
3025
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3026
- <!-- fn processing -->
3027
- <xsl:call-template name="fn_display"/>
3028
-
3029
- </fo:table-cell>
3030
- </fo:table-row>
3031
-
3032
- </xsl:if>
3314
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
3315
+
3033
3316
  </fo:table-body>
3034
- </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']">
3317
+
3318
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3035
3319
  <xsl:variable name="parent-name" select="local-name(..)"/>
3036
3320
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3037
3321
  <fo:table-row min-height="4mm">
@@ -3044,18 +3328,22 @@
3044
3328
 
3045
3329
 
3046
3330
 
3331
+
3047
3332
  </xsl:if>
3048
3333
  <xsl:if test="$parent-name = 'tfoot'">
3049
3334
 
3335
+
3050
3336
  </xsl:if>
3051
3337
 
3338
+
3052
3339
  <xsl:apply-templates/>
3053
3340
  </fo:table-row>
3054
- </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']">
3055
3342
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3056
3343
 
3057
3344
 
3058
3345
 
3346
+
3059
3347
  <xsl:attribute name="text-align">center</xsl:attribute>
3060
3348
  <xsl:attribute name="background-color">black</xsl:attribute>
3061
3349
  <xsl:attribute name="color">white</xsl:attribute>
@@ -3077,7 +3365,7 @@
3077
3365
  <xsl:apply-templates/>
3078
3366
  </fo:block>
3079
3367
  </fo:table-cell>
3080
- </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']">
3081
3369
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3082
3370
 
3083
3371
 
@@ -3085,6 +3373,9 @@
3085
3373
 
3086
3374
 
3087
3375
 
3376
+
3377
+
3378
+
3088
3379
  <xsl:if test="ancestor::*[local-name()='thead']">
3089
3380
  <xsl:attribute name="font-weight">normal</xsl:attribute>
3090
3381
  </xsl:if>
@@ -3100,6 +3391,7 @@
3100
3391
  </xsl:attribute>
3101
3392
  </xsl:if>
3102
3393
  <fo:block>
3394
+
3103
3395
  <xsl:apply-templates/>
3104
3396
  </fo:block>
3105
3397
  <!-- <xsl:choose>
@@ -3115,13 +3407,25 @@
3115
3407
 
3116
3408
 
3117
3409
  </fo:table-cell>
3118
- </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">
3119
3411
 
3120
3412
 
3121
3413
  <fo:block font-size="10pt" margin-bottom="12pt">
3122
3414
 
3415
+
3416
+
3417
+
3123
3418
  <fo:inline padding-right="2mm">
3124
- <xsl:text>NOTE </xsl:text>
3419
+
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"/>
3428
+
3125
3429
 
3126
3430
 
3127
3431
  <xsl:number format="1 "/>
@@ -3130,9 +3434,9 @@
3130
3434
  <xsl:apply-templates mode="process"/>
3131
3435
  </fo:block>
3132
3436
 
3133
- </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">
3134
3438
  <xsl:apply-templates/>
3135
- </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">
3136
3440
  <xsl:variable name="references">
3137
3441
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3138
3442
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3147,6 +3451,9 @@
3147
3451
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3148
3452
  <fo:block margin-bottom="12pt">
3149
3453
 
3454
+
3455
+
3456
+
3150
3457
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3151
3458
 
3152
3459
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -3154,6 +3461,8 @@
3154
3461
 
3155
3462
 
3156
3463
 
3464
+
3465
+
3157
3466
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3158
3467
 
3159
3468
  <xsl:value-of select="@reference"/>
@@ -3168,7 +3477,7 @@
3168
3477
  </fo:block>
3169
3478
  </xsl:if>
3170
3479
  </xsl:for-each>
3171
- </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">
3172
3481
  <!-- <xsl:variable name="references">
3173
3482
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3174
3483
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3184,7 +3493,7 @@
3184
3493
  <xsl:apply-templates/>
3185
3494
  </fo:block>
3186
3495
  </xsl:for-each>
3187
- </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">
3188
3497
  <xsl:variable name="key_iso">
3189
3498
  <!-- and (not(@class) or @class !='pseudocode') -->
3190
3499
  </xsl:variable>
@@ -3195,14 +3504,56 @@
3195
3504
  </fn>
3196
3505
  </xsl:for-each>
3197
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
+
3198
3537
  <xsl:if test="xalan:nodeset($references)//fn">
3199
3538
  <fo:block>
3200
3539
  <fo:table width="95%" table-layout="fixed">
3201
3540
  <xsl:if test="normalize-space($key_iso) = 'true'">
3202
3541
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3542
+
3203
3543
  </xsl:if>
3204
- <fo:table-column column-width="15%"/>
3205
- <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>
3206
3557
  <fo:table-body>
3207
3558
  <xsl:for-each select="xalan:nodeset($references)//fn">
3208
3559
  <xsl:variable name="reference" select="@reference"/>
@@ -3234,11 +3585,12 @@
3234
3585
  </fo:block>
3235
3586
  </xsl:if>
3236
3587
 
3237
- </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']">
3238
3589
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3239
3590
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3240
3591
 
3241
3592
 
3593
+
3242
3594
  <xsl:attribute name="vertical-align">super</xsl:attribute>
3243
3595
  <xsl:attribute name="color">blue</xsl:attribute>
3244
3596
 
@@ -3250,11 +3602,11 @@
3250
3602
  <xsl:value-of select="@reference"/>
3251
3603
  </fo:basic-link>
3252
3604
  </fo:inline>
3253
- </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']">
3254
3606
  <fo:inline>
3255
3607
  <xsl:apply-templates/>
3256
3608
  </fo:inline>
3257
- </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']">
3258
3610
  <xsl:variable name="parent" select="local-name(..)"/>
3259
3611
 
3260
3612
  <xsl:variable name="key_iso">
@@ -3267,7 +3619,12 @@
3267
3619
 
3268
3620
  <fo:block margin-bottom="12pt" text-align="left">
3269
3621
 
3270
- <xsl:text>where </xsl:text>
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>
3271
3628
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3272
3629
  <xsl:text/>
3273
3630
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3279,13 +3636,26 @@
3279
3636
 
3280
3637
 
3281
3638
 
3282
- <xsl:text>where</xsl:text>
3639
+
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"/>
3283
3646
  </fo:block>
3284
3647
  </xsl:when>
3285
3648
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3286
- <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">
3650
+
3287
3651
 
3288
- <xsl:text>Key</xsl:text>
3652
+
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"/>
3289
3659
  </fo:block>
3290
3660
  </xsl:when>
3291
3661
  </xsl:choose>
@@ -3307,69 +3677,44 @@
3307
3677
  <xsl:attribute name="margin-left">-2.5mm</xsl:attribute>
3308
3678
  </xsl:if>
3309
3679
 
3310
- <!-- create virtual html table for dl/[dt and dd] -->
3311
- <xsl:variable name="html-table">
3312
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3313
- <xsl:element name="{$ns}:table">
3314
- <tbody>
3315
- <xsl:apply-templates mode="dl"/>
3316
- </tbody>
3317
- </xsl:element>
3318
- </xsl:variable>
3319
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3320
- <xsl:variable name="colwidths">
3321
- <xsl:call-template name="calculate-column-widths">
3322
- <xsl:with-param name="cols-count" select="2"/>
3323
- <xsl:with-param name="table" select="$html-table"/>
3324
- </xsl:call-template>
3325
- </xsl:variable>
3326
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3680
+
3681
+
3327
3682
 
3328
3683
  <fo:table width="95%" table-layout="fixed">
3684
+
3329
3685
  <xsl:choose>
3330
3686
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
3331
3687
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
3332
3688
  </xsl:when>
3333
3689
  <xsl:when test="normalize-space($key_iso) = 'true'">
3334
3690
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3691
+
3335
3692
  </xsl:when>
3336
3693
  </xsl:choose>
3337
- <xsl:choose>
3338
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3339
- <fo:table-column column-width="50%"/>
3340
- <fo:table-column column-width="50%"/>
3341
- </xsl:when>
3342
- <xsl:otherwise>
3343
- <xsl:choose>
3344
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3345
- <fo:table-column column-width="60%"/>
3346
- <fo:table-column column-width="40%"/>
3347
- </xsl:when> -->
3348
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3349
- <fo:table-column column-width="50%"/>
3350
- <fo:table-column column-width="50%"/>
3351
- </xsl:when>
3352
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3353
- <fo:table-column column-width="40%"/>
3354
- <fo:table-column column-width="60%"/>
3355
- </xsl:when>
3356
- <xsl:otherwise>
3357
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3358
- <xsl:choose>
3359
- <xsl:when test=". = 1">
3360
- <fo:table-column column-width="proportional-column-width(2)"/>
3361
- </xsl:when>
3362
- <xsl:otherwise>
3363
- <fo:table-column column-width="proportional-column-width({.})"/>
3364
- </xsl:otherwise>
3365
- </xsl:choose>
3366
- </xsl:for-each>
3367
- </xsl:otherwise>
3368
- </xsl:choose>
3369
- <!-- <fo:table-column column-width="15%"/>
3370
- <fo:table-column column-width="85%"/> -->
3371
- </xsl:otherwise>
3372
- </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>
3373
3718
  <fo:table-body>
3374
3719
  <xsl:apply-templates>
3375
3720
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3379,7 +3724,61 @@
3379
3724
  </fo:block>
3380
3725
  </fo:block>
3381
3726
  </xsl:if>
3382
- </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']">
3383
3782
  <xsl:param name="key_iso"/>
3384
3783
 
3385
3784
  <!-- <tr>
@@ -3395,7 +3794,12 @@
3395
3794
  <xsl:if test="normalize-space($key_iso) = 'true'">
3396
3795
  <xsl:attribute name="margin-top">0</xsl:attribute>
3397
3796
  </xsl:if>
3398
- 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"/>
3399
3803
  </fo:block>
3400
3804
  </fo:table-cell>
3401
3805
  <fo:table-cell>
@@ -3404,7 +3808,7 @@
3404
3808
  </fo:block>
3405
3809
  </fo:table-cell>
3406
3810
  </fo:table-row>
3407
- </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">
3408
3812
  <tr>
3409
3813
  <td>
3410
3814
  <xsl:apply-templates/>
@@ -3430,12 +3834,15 @@
3430
3834
  </tr>
3431
3835
  </xsl:if>
3432
3836
 
3433
- </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']">
3434
3838
  <xsl:param name="key_iso"/>
3435
3839
 
3436
3840
  <fo:table-row>
3437
3841
  <fo:table-cell>
3842
+
3438
3843
  <fo:block margin-top="6pt">
3844
+
3845
+
3439
3846
  <xsl:if test="normalize-space($key_iso) = 'true'">
3440
3847
  <xsl:attribute name="margin-top">0</xsl:attribute>
3441
3848
 
@@ -3445,7 +3852,15 @@
3445
3852
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3446
3853
 
3447
3854
 
3855
+
3856
+
3857
+
3448
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> -->
3449
3864
  </fo:block>
3450
3865
  </fo:table-cell>
3451
3866
  <fo:table-cell>
@@ -3479,37 +3894,37 @@
3479
3894
  </fo:table-row>
3480
3895
  </xsl:if>
3481
3896
 
3482
- </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">
3483
3898
  <xsl:apply-templates/>
3484
- </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">
3485
3900
  <xsl:apply-templates/>
3486
- </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">
3487
- <fo:inline><xsl:apply-templates/></fo:inline>
3488
- </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']">
3901
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3902
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3903
+ </xsl:template><xsl:template match="*[local-name()='em']">
3489
3904
  <fo:inline font-style="italic">
3490
3905
  <xsl:apply-templates/>
3491
3906
  </fo:inline>
3492
- </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']">
3493
3908
  <fo:inline font-weight="bold">
3494
3909
  <xsl:apply-templates/>
3495
3910
  </fo:inline>
3496
- </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']">
3497
3912
  <fo:inline font-size="80%" vertical-align="super">
3498
3913
  <xsl:apply-templates/>
3499
3914
  </fo:inline>
3500
- </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']">
3501
3916
  <fo:inline font-size="80%" vertical-align="sub">
3502
3917
  <xsl:apply-templates/>
3503
3918
  </fo:inline>
3504
- </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']">
3505
- <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">
3506
3921
  <xsl:apply-templates/>
3507
3922
  </fo:inline>
3508
- </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']">
3509
3924
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3510
3925
  <xsl:apply-templates/>
3511
3926
  </fo:inline>
3512
- </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']]">
3513
3928
  <xsl:variable name="text" select="normalize-space(.)"/>
3514
3929
  <fo:inline font-size="75%">
3515
3930
  <xsl:if test="string-length($text) &gt; 0">
@@ -3518,10 +3933,11 @@
3518
3933
  </xsl:call-template>
3519
3934
  </xsl:if>
3520
3935
  </fo:inline>
3521
- </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">
3522
3937
  <xsl:param name="text"/>
3523
3938
  <xsl:variable name="char" select="substring($text,1,1)"/>
3524
- <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))"/>
3525
3941
  <xsl:choose>
3526
3942
  <xsl:when test="$char=$upperCase">
3527
3943
  <fo:inline font-size="{100 div 0.75}%">
@@ -3537,7 +3953,7 @@
3537
3953
  <xsl:with-param name="text" select="substring($text,2)"/>
3538
3954
  </xsl:call-template>
3539
3955
  </xsl:if>
3540
- </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">
3541
3957
  <xsl:param name="text"/>
3542
3958
  <xsl:param name="separator" select="' '"/>
3543
3959
  <xsl:choose>
@@ -3585,7 +4001,7 @@
3585
4001
  </xsl:call-template>
3586
4002
  </xsl:otherwise>
3587
4003
  </xsl:choose>
3588
- </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">
3589
4005
  <xsl:param name="words"/>
3590
4006
  <xsl:for-each select="$words//word">
3591
4007
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3593,12 +4009,17 @@
3593
4009
  <xsl:value-of select="."/>
3594
4010
  </xsl:if>
3595
4011
  </xsl:for-each>
3596
- </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">
3597
4017
  <xsl:param name="text" select="."/>
3598
4018
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3599
4019
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3600
4020
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3601
4021
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4022
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3602
4023
  <xsl:variable name="zero-space">​</xsl:variable>
3603
4024
  <xsl:choose>
3604
4025
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -3633,11 +4054,19 @@
3633
4054
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3634
4055
  </xsl:call-template>
3635
4056
  </xsl:when>
4057
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
4058
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
4059
+ <xsl:value-of select="$zero-space-after-underscore"/>
4060
+ <xsl:value-of select="$zero-space"/>
4061
+ <xsl:call-template name="add-zero-spaces">
4062
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
4063
+ </xsl:call-template>
4064
+ </xsl:when>
3636
4065
  <xsl:otherwise>
3637
4066
  <xsl:value-of select="$text"/>
3638
4067
  </xsl:otherwise>
3639
4068
  </xsl:choose>
3640
- </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">
3641
4070
  <xsl:param name="text" select="."/>
3642
4071
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3643
4072
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3663,7 +4092,7 @@
3663
4092
  <xsl:value-of select="$text"/>
3664
4093
  </xsl:otherwise>
3665
4094
  </xsl:choose>
3666
- </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">
3667
4096
  <xsl:variable name="simple-table">
3668
4097
 
3669
4098
  <!-- Step 1. colspan processing -->
@@ -3690,9 +4119,9 @@
3690
4119
  </xsl:choose> -->
3691
4120
  </xsl:variable>
3692
4121
  <xsl:copy-of select="$simple-table"/>
3693
- </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">
3694
4123
  <xsl:apply-templates mode="simple-table-colspan"/>
3695
- </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">
3696
4125
  <xsl:choose>
3697
4126
  <xsl:when test="@colspan">
3698
4127
  <xsl:variable name="td">
@@ -3714,16 +4143,16 @@
3714
4143
  </xsl:element>
3715
4144
  </xsl:otherwise>
3716
4145
  </xsl:choose>
3717
- </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">
3718
4147
  <xsl:element name="tr">
3719
4148
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3720
4149
  <xsl:apply-templates mode="simple-table-colspan"/>
3721
4150
  </xsl:element>
3722
- </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">
3723
4152
  <xsl:copy>
3724
4153
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3725
4154
  </xsl:copy>
3726
- </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">
3727
4156
  <xsl:param name="count"/>
3728
4157
  <xsl:param name="node"/>
3729
4158
 
@@ -3734,18 +4163,18 @@
3734
4163
  </xsl:call-template>
3735
4164
  <xsl:copy-of select="$node"/>
3736
4165
  </xsl:if>
3737
- </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">
3738
4167
  <xsl:copy>
3739
4168
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3740
4169
  </xsl:copy>
3741
- </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">
3742
4171
  <xsl:copy>
3743
4172
  <xsl:copy-of select="tr[1]"/>
3744
4173
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3745
4174
  <xsl:with-param name="previousRow" select="tr[1]"/>
3746
4175
  </xsl:apply-templates>
3747
4176
  </xsl:copy>
3748
- </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">
3749
4178
  <xsl:param name="previousRow"/>
3750
4179
  <xsl:variable name="currentRow" select="."/>
3751
4180
 
@@ -3779,28 +4208,356 @@
3779
4208
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3780
4209
  <xsl:with-param name="previousRow" select="$newRow"/>
3781
4210
  </xsl:apply-templates>
3782
- </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">
3783
4212
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3784
4213
  <xsl:choose>
3785
4214
  <xsl:when test="$language = 'English'">en</xsl:when>
3786
4215
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3787
4216
  </xsl:choose>
3788
- </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">
3789
4218
  <xsl:param name="str"/>
3790
4219
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3791
4220
  <xsl:choose>
3792
4221
  <xsl:when test="contains($str2, ' ')">
3793
4222
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3794
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3795
- <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>
3796
4228
  <xsl:text> </xsl:text>
3797
4229
  <xsl:call-template name="capitalizeWords">
3798
4230
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3799
4231
  </xsl:call-template>
3800
4232
  </xsl:when>
3801
4233
  <xsl:otherwise>
3802
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3803
- <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>
4239
+ </xsl:otherwise>
4240
+ </xsl:choose>
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">
4246
+ <fo:inline font-family="STIX2Math">
4247
+ <fo:instream-foreign-object fox:alt-text="Math">
4248
+ <xsl:copy-of select="."/>
4249
+ </fo:instream-foreign-object>
4250
+ </fo:inline>
4251
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
4252
+ <xsl:for-each select="*[local-name()='locality']">
4253
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
4254
+ <xsl:apply-templates select="."/>
4255
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
4256
+ </xsl:for-each>
4257
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
4258
+ <xsl:variable name="target">
4259
+ <xsl:choose>
4260
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4261
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
4262
+ </xsl:when>
4263
+ <xsl:otherwise>
4264
+ <xsl:value-of select="normalize-space(@target)"/>
4265
+ </xsl:otherwise>
4266
+ </xsl:choose>
4267
+ </xsl:variable>
4268
+ <fo:inline xsl:use-attribute-sets="link-style">
4269
+ <xsl:choose>
4270
+ <xsl:when test="$target = ''">
4271
+ <xsl:apply-templates/>
4272
+ </xsl:when>
4273
+ <xsl:otherwise>
4274
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4275
+ <xsl:choose>
4276
+ <xsl:when test="normalize-space(.) = ''">
4277
+ <xsl:value-of select="$target"/>
4278
+ </xsl:when>
4279
+ <xsl:otherwise>
4280
+ <xsl:apply-templates/>
4281
+ </xsl:otherwise>
4282
+ </xsl:choose>
4283
+ </fo:basic-link>
4284
+ </xsl:otherwise>
4285
+ </xsl:choose>
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())"/>
3804
4494
  </xsl:otherwise>
3805
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>
3806
4563
  </xsl:template></xsl:stylesheet>