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
  <xsl:variable name="sub-title" select="/nist:nist-standard/nist:bibdata/nist:title[@language = 'en' and @type = 'subtitle']"/>
14
16
 
@@ -35,7 +37,12 @@
35
37
  <xsl:variable name="contents">
36
38
  <contents>
37
39
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:executivesummary" mode="contents"/>
38
- <xsl:apply-templates select="/nist:nist-standard/nist:sections/*" mode="contents"/> <!-- /* Main sections -->
40
+ <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:introduction" mode="contents">
41
+ <xsl:with-param name="sectionNum" select="'1'"/>
42
+ </xsl:apply-templates>
43
+ <xsl:apply-templates select="/nist:nist-standard/nist:sections/*" mode="contents"> <!-- /* Main sections -->
44
+ <xsl:with-param name="sectionNumSkew" select="count(/nist:nist-standard/nist:preface/nist:introduction)"/>
45
+ </xsl:apply-templates>
39
46
  <xsl:apply-templates select="/nist:nist-standard/nist:annex" mode="contents"/>
40
47
  </contents>
41
48
  </xsl:variable>
@@ -74,45 +81,8 @@
74
81
  </fo:simple-page-master>
75
82
  </fo:layout-master-set>
76
83
 
77
- <fo:declarations>
78
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
79
- <pdf:dictionary type="normal" key="ViewerPreferences">
80
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
81
- </pdf:dictionary>
82
- </pdf:catalog>
83
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
84
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
85
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
86
- <!-- Dublin Core properties go here -->
87
- <dc:title><xsl:value-of select="$title"/></dc:title>
88
- <dc:creator>
89
- <xsl:for-each select="/nist:nist-standard/nist:bibdata/nist:contributor[nist:role/@type = 'author']">
90
- <xsl:value-of select="nist:person/nist:name/nist:completename"/>
91
- <xsl:if test="position() != last()">; </xsl:if>
92
- </xsl:for-each>
93
- </dc:creator>
94
- <dc:description>
95
- <xsl:variable name="abstract">
96
- <xsl:copy-of select="/nist:nist-standard/nist:preface/nist:abstract//text()"/>
97
- </xsl:variable>
98
- <xsl:value-of select="normalize-space($abstract)"/>
99
- </dc:description>
100
- <pdf:Keywords>
101
- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
102
- <xsl:sort data-type="text" order="ascending"/>
103
- <xsl:apply-templates/>
104
- <xsl:if test="position() != last()">, </xsl:if>
105
- </xsl:for-each>
106
- </pdf:Keywords>
107
- </rdf:Description>
108
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
109
- <!-- XMP properties go here -->
110
- <xmp:CreatorTool/>
111
- </rdf:Description>
112
- </rdf:RDF>
113
- </x:xmpmeta>
114
- </fo:declarations>
115
-
84
+ <xsl:call-template name="addPDFUAmeta"/>
85
+
116
86
  <!-- cover page -->
117
87
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
118
88
  <fo:flow flow-name="xsl-region-body">
@@ -793,8 +763,8 @@
793
763
  <!-- Used Helvetica font (https://stackoverflow.com/questions/25261949/xsl-fo-letter-spacing-with-text-align) -->
794
764
  <fo:block font-family="Arial" font-size="16pt" text-align="center" padding-top="1mm">
795
765
  <!-- <fo:inline letter-spacing="10pt"><xsl:value-of select="translate(/nist:nist-standard/nist:bibdata/nist:title[@language = 'en' and @type = 'document-class'], $lower, $upper)"/></fo:inline> -->
796
- <xsl:call-template name="addLetterSpacing">
797
- <xsl:with-param name="text" select="translate(/nist:nist-standard/nist:bibdata/nist:title[@language = 'en' and @type = 'document-class'], $lower, $upper)"/>
766
+ <xsl:call-template name="addLetterSpacing">
767
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(/nist:nist-standard/nist:bibdata/nist:title[@language = 'en' and @type = 'document-class']))"/>
798
768
  </xsl:call-template>
799
769
  </fo:block>
800
770
  </fo:block-container>
@@ -900,7 +870,12 @@
900
870
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:foreword"/>
901
871
 
902
872
  <xsl:if test="/nist:nist-standard/nist:preface/nist:abstract">
903
- <fo:block font-family="Arial" text-align="center" font-weight="bold" margin-bottom="12pt">Abstract</fo:block>
873
+ <xsl:variable name="title-abstract">
874
+ <xsl:call-template name="getTitle">
875
+ <xsl:with-param name="name" select="'title-abstract'"/>
876
+ </xsl:call-template>
877
+ </xsl:variable>
878
+ <fo:block font-family="Arial" text-align="center" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-abstract"/></fo:block>
904
879
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:abstract"/>
905
880
  </xsl:if>
906
881
 
@@ -908,20 +883,28 @@
908
883
  <!-- Keywords -->
909
884
  <xsl:if test="/nist:nist-standard/nist:bibdata/nist:keyword">
910
885
  <fo:block font-family="Arial" font-weight="bold" text-align="center" margin-bottom="12pt">
911
- <xsl:text>Keywords</xsl:text>
886
+ <xsl:variable name="title-keywords">
887
+ <xsl:call-template name="getTitle">
888
+ <xsl:with-param name="name" select="'title-keywords'"/>
889
+ </xsl:call-template>
890
+ </xsl:variable>
891
+ <xsl:value-of select="$title-keywords"/>
912
892
  </fo:block>
913
893
  <fo:block>
914
- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
894
+ <xsl:call-template name="insertKeywords">
895
+ <xsl:with-param name="charDelim">; </xsl:with-param>
896
+ </xsl:call-template>
897
+ <!-- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
915
898
  <xsl:sort data-type="text" order="ascending"/>
916
899
  <xsl:apply-templates/>
917
900
  <xsl:choose>
918
901
  <xsl:when test="position() != last()">; </xsl:when>
919
902
  <xsl:otherwise>.</xsl:otherwise>
920
903
  </xsl:choose>
921
- </xsl:for-each>
904
+ </xsl:for-each> -->
922
905
  </fo:block>
923
906
  </xsl:if>
924
- <fo:block break-after="page"/>
907
+ <!-- <fo:block break-after="page"/> -->
925
908
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:acknowledgements"/>
926
909
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:clause"/>
927
910
  <fo:block break-after="page"/>
@@ -930,15 +913,22 @@
930
913
  <!-- Executive summary -->
931
914
  <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:executivesummary"/>
932
915
 
933
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
934
- DEBUG
935
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
936
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
937
-
916
+ <xsl:if test="$debug = 'true'">
917
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
918
+ DEBUG
919
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
920
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
921
+ </xsl:if>
922
+
938
923
  <!-- CONTENTS -->
939
924
  <fo:block break-after="page"/>
940
925
  <fo:block-container font-family="Arial" font-size="11pt">
941
- <fo:block font-size="12pt" margin-bottom="12pt" text-align="center" font-weight="bold">Table of Contents</fo:block>
926
+ <xsl:variable name="title-toc">
927
+ <xsl:call-template name="getTitle">
928
+ <xsl:with-param name="name" select="'title-toc'"/>
929
+ </xsl:call-template>
930
+ </xsl:variable>
931
+ <fo:block font-size="12pt" margin-bottom="12pt" text-align="center" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:block>
942
932
  <xsl:for-each select="xalan:nodeset($contents)//item[not(@type = 'table') and not(@type = 'figure')]">
943
933
  <xsl:if test="@display = 'true'">
944
934
  <fo:block>
@@ -983,7 +973,12 @@
983
973
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
984
974
  <fo:block font-size="12pt"> </fo:block>
985
975
  <fo:block font-size="12pt"> </fo:block>
986
- <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt">List of Figures</fo:block>
976
+ <xsl:variable name="title-list-figures">
977
+ <xsl:call-template name="getTitle">
978
+ <xsl:with-param name="name" select="'title-list-figures'"/>
979
+ </xsl:call-template>
980
+ </xsl:variable>
981
+ <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt"><xsl:value-of select="$title-list-figures"/></fo:block>
987
982
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
988
983
  <fo:block text-align-last="justify" margin-top="6pt" margin-bottom="6pt">
989
984
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -1007,7 +1002,12 @@
1007
1002
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
1008
1003
  <fo:block font-size="12pt"> </fo:block>
1009
1004
  <fo:block font-size="12pt"> </fo:block>
1010
- <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt">List of Tables</fo:block>
1005
+ <xsl:variable name="title-list-tables">
1006
+ <xsl:call-template name="getTitle">
1007
+ <xsl:with-param name="name" select="'title-list-tables'"/>
1008
+ </xsl:call-template>
1009
+ </xsl:variable>
1010
+ <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt"><xsl:value-of select="$title-list-tables"/></fo:block>
1011
1011
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table']">
1012
1012
  <fo:block text-align-last="justify" margin-top="6pt" margin-bottom="6pt">
1013
1013
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -1044,9 +1044,16 @@
1044
1044
  <fo:flow flow-name="xsl-region-body">
1045
1045
  <!-- Clause(s) -->
1046
1046
  <fo:block>
1047
- <xsl:apply-templates select="/nist:nist-standard/nist:sections/*"/>
1048
-
1049
- <!-- <xsl:apply-templates select="/nist:nist-standard/nist:annex"/> --> <!-- last() -->
1047
+ <xsl:if test="/nist:nist-standard/nist:preface/nist:introduction">
1048
+ <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:introduction">
1049
+ <xsl:with-param name="sectionNum" select="'1'"/>
1050
+ </xsl:apply-templates>
1051
+ <fo:block break-after="page"/>
1052
+ </xsl:if>
1053
+
1054
+ <xsl:apply-templates select="/nist:nist-standard/nist:sections/*">
1055
+ <xsl:with-param name="sectionNumSkew" select="count(/nist:nist-standard/nist:preface/nist:introduction)"/>
1056
+ </xsl:apply-templates>
1050
1057
 
1051
1058
  </fo:block>
1052
1059
 
@@ -1179,7 +1186,7 @@
1179
1186
  <fo:block-container absolute-position="fixed" top="202mm" left="26mm" height="7mm" width="165mm" border-top="1.5pt solid black" border-bottom="1.5pt solid black">
1180
1187
  <fo:block font-family="Arial" font-size="16pt" text-align="center" padding-top="0.7mm">
1181
1188
  <xsl:call-template name="addLetterSpacing">
1182
- <xsl:with-param name="text" select="translate(/nist:nist-standard/nist:bibdata/nist:title[@language = 'en' and @type = 'document-class'], $lower, $upper)"/>
1189
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(/nist:nist-standard/nist:bibdata/nist:title[@language = 'en' and @type = 'document-class']))"/>
1183
1190
  </xsl:call-template>
1184
1191
  </fo:block>
1185
1192
  </fo:block-container>
@@ -1188,7 +1195,12 @@
1188
1195
 
1189
1196
  <xsl:template match="nist:preface/nist:acknowledgements[not(nist:title)]">
1190
1197
  <fo:block id="{@id}" font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" space-before="12pt" margin-bottom="12pt">
1191
- <xsl:text>Acknowledgements</xsl:text>
1198
+ <xsl:variable name="title-acknowledgements">
1199
+ <xsl:call-template name="getTitle">
1200
+ <xsl:with-param name="name" select="'title-acknowledgements'"/>
1201
+ </xsl:call-template>
1202
+ </xsl:variable>
1203
+ <xsl:value-of select="$title-acknowledgements"/>
1192
1204
  </fo:block>
1193
1205
  <xsl:apply-templates/>
1194
1206
  </xsl:template>
@@ -1243,14 +1255,7 @@
1243
1255
  <xsl:param name="sectionNum"/>
1244
1256
  <!-- sectionNum=<xsl:value-of select="$sectionNum"/> -->
1245
1257
  <xsl:variable name="id">
1246
- <xsl:choose>
1247
- <xsl:when test="../@id">
1248
- <xsl:value-of select="../@id"/>
1249
- </xsl:when>
1250
- <xsl:otherwise>
1251
- <xsl:value-of select="text()"/>
1252
- </xsl:otherwise>
1253
- </xsl:choose>
1258
+ <xsl:call-template name="getId"/>
1254
1259
  </xsl:variable>
1255
1260
 
1256
1261
  <xsl:variable name="level">
@@ -1323,33 +1328,17 @@
1323
1328
  </xsl:template>
1324
1329
 
1325
1330
 
1326
- <xsl:template match="nist:figure" mode="contents">
1331
+ <xsl:template match="nist:figure[not(@unnumbered='true')]" mode="contents">
1327
1332
  <xsl:param name="sectionNum"/>
1328
1333
  <item level="" id="{@id}" type="figure">
1329
1334
  <xsl:attribute name="section">
1330
- <xsl:text>Figure </xsl:text>
1331
- <xsl:choose>
1332
- <xsl:when test="ancestor::nist:annex">
1333
- <xsl:choose>
1334
- <xsl:when test="count(//nist:annex) = 1">
1335
- <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:ext/nist:structuredidentifier/nist:annexid"/><xsl:number format="-1" level="any" count="nist:annex//nist:figure"/>
1336
- </xsl:when>
1337
- <xsl:otherwise>
1338
- <xsl:number format="A.1-1" level="multiple" count="nist:annex | nist:figure"/>
1339
- </xsl:otherwise>
1340
- </xsl:choose>
1341
- </xsl:when>
1342
- <xsl:when test="ancestor::nist:figure">
1343
- <xsl:for-each select="parent::*[1]">
1344
- <xsl:number format="1" level="any" count="nist:figure[not(parent::nist:figure)]"/>
1345
- </xsl:for-each>
1346
- <xsl:number format="-a" count="nist:figure"/>
1347
- </xsl:when>
1348
- <xsl:otherwise>
1349
- <xsl:number format="1" level="any" count="nist:figure[not(parent::nist:figure)]"/>
1350
- <!-- <xsl:number format="1.1-1" level="multiple" count="nist:annex | nist:figure"/> -->
1351
- </xsl:otherwise>
1352
- </xsl:choose>
1335
+ <xsl:variable name="title-figure">
1336
+ <xsl:call-template name="getTitle">
1337
+ <xsl:with-param name="name" select="'title-figure'"/>
1338
+ </xsl:call-template>
1339
+ </xsl:variable>
1340
+ <xsl:value-of select="$title-figure"/>
1341
+ <xsl:call-template name="getFigureNumber"/>
1353
1342
  </xsl:attribute>
1354
1343
  <xsl:if test="ancestor::nist:annex">
1355
1344
  <xsl:variable name="section">
@@ -1368,25 +1357,18 @@
1368
1357
  </item>
1369
1358
  </xsl:template>
1370
1359
 
1371
- <xsl:template match="nist:table" mode="contents">
1360
+ <xsl:template match="nist:table[not(@unnumbered='true')]" mode="contents">
1372
1361
  <xsl:param name="sectionNum"/>
1373
1362
  <xsl:variable name="annex-id" select="ancestor::nist:annex/@id"/>
1374
1363
  <item level="" id="{@id}" display="false" type="table">
1375
1364
  <xsl:attribute name="section">
1376
- <xsl:text>Table </xsl:text>
1377
- <xsl:choose>
1378
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1379
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
1380
- </xsl:when>
1381
- <xsl:when test="ancestor::*[local-name()='annex']">
1382
- <xsl:number format="A-" count="nist:annex"/>
1383
- <xsl:number format="1" level="any" count="nist:table[ancestor::nist:annex[@id = $annex-id]]"/>
1384
- </xsl:when>
1385
- <xsl:otherwise>
1386
- <!-- <xsl:number format="1"/> -->
1387
- <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
1388
- </xsl:otherwise>
1389
- </xsl:choose>
1365
+ <xsl:variable name="title-table">
1366
+ <xsl:call-template name="getTitle">
1367
+ <xsl:with-param name="name" select="'title-table'"/>
1368
+ </xsl:call-template>
1369
+ </xsl:variable>
1370
+ <xsl:value-of select="$title-table"/>
1371
+ <xsl:call-template name="getTableNumber"/>
1390
1372
  </xsl:attribute>
1391
1373
  <xsl:if test="ancestor::nist:annex">
1392
1374
  <xsl:variable name="section">
@@ -1406,11 +1388,16 @@
1406
1388
  </xsl:template>
1407
1389
 
1408
1390
 
1409
- <xsl:template match="nist:formula" mode="contents">
1391
+ <xsl:template match="nist:formula[not(@unnumbered='true')]" mode="contents">
1410
1392
  <xsl:param name="sectionNum"/>
1411
1393
  <item level="" id="{@id}" display="false">
1412
1394
  <xsl:attribute name="section">
1413
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="nist:annex | nist:formula"/><xsl:text>)</xsl:text>
1395
+ <xsl:variable name="title-formula">
1396
+ <xsl:call-template name="getTitle">
1397
+ <xsl:with-param name="name" select="'title-formula'"/>
1398
+ </xsl:call-template>
1399
+ </xsl:variable>
1400
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="nist:annex | nist:formula[not(@unnumbered='true')]"/>
1414
1401
  </xsl:attribute>
1415
1402
  </item>
1416
1403
  </xsl:template>
@@ -1521,24 +1508,31 @@
1521
1508
  <fo:block>
1522
1509
  <xsl:attribute name="margin-bottom">
1523
1510
  <xsl:choose>
1524
- <xsl:when test="(local-name(..) = 'td' or local-name(..) = 'th') and ancestor::nist:annex">0</xsl:when>
1511
+ <xsl:when test="(local-name(..) = 'td' or local-name(..) = 'th')">0</xsl:when> <!-- and ancestor::nist:annex -->
1525
1512
  <xsl:when test="$margin != ''"><xsl:value-of select="$margin"/></xsl:when>
1526
1513
  <xsl:otherwise>12pt</xsl:otherwise>
1527
1514
  </xsl:choose>
1528
1515
  </xsl:attribute>
1529
- <xsl:attribute name="text-align">
1530
- <xsl:choose>
1531
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1532
- <xsl:otherwise>left</xsl:otherwise>
1533
- </xsl:choose>
1534
- </xsl:attribute>
1516
+ <xsl:if test="not(local-name(..) = 'td' or local-name(..) = 'th')">
1517
+ <xsl:attribute name="text-align">
1518
+ <xsl:choose>
1519
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1520
+ <xsl:otherwise>left</xsl:otherwise>
1521
+ </xsl:choose>
1522
+ </xsl:attribute>
1523
+ </xsl:if>
1535
1524
  <xsl:apply-templates/>
1536
1525
  </fo:block>
1537
1526
  </xsl:template>
1538
1527
 
1539
1528
  <xsl:template match="nist:note/nist:p" name="note">
1540
1529
  <fo:block font-size="11pt" space-before="4pt">
1541
- <xsl:text>NOTE </xsl:text>
1530
+ <xsl:variable name="title-note">
1531
+ <xsl:call-template name="getTitle">
1532
+ <xsl:with-param name="name" select="'title-note'"/>
1533
+ </xsl:call-template>
1534
+ </xsl:variable>
1535
+ <xsl:value-of select="$title-note"/>
1542
1536
  <xsl:if test="../following-sibling::nist:note or ../preceding-sibling::nist:note">
1543
1537
  <xsl:number count="nist:note"/><xsl:text> </xsl:text>
1544
1538
  </xsl:if>
@@ -1550,7 +1544,12 @@
1550
1544
  <xsl:template match="nist:recommendation">
1551
1545
  <fo:block margin-left="20mm">
1552
1546
  <fo:block font-weight="bold">
1553
- <xsl:text>Recommendation </xsl:text>
1547
+ <xsl:variable name="title-recommendation">
1548
+ <xsl:call-template name="getTitle">
1549
+ <xsl:with-param name="name" select="'title-recommendation'"/>
1550
+ </xsl:call-template>
1551
+ </xsl:variable>
1552
+ <xsl:value-of select="$title-recommendation"/>
1554
1553
  <xsl:choose>
1555
1554
  <xsl:when test="ancestor::nist:sections">
1556
1555
  <xsl:number level="any" count="nist:sections//nist:recommendation"/>
@@ -1573,7 +1572,7 @@
1573
1572
  <fo:block margin-left="8mm" margin-right="8mm" padding-top="6mm" padding-bottom="7mm">
1574
1573
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
1575
1574
  <xsl:choose>
1576
- <xsl:when test="@type='important'">IMPORTANT</xsl:when>
1575
+ <xsl:when test="@type='important'"><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/></xsl:when>
1577
1576
  <xsl:when test="@type='tip'">
1578
1577
  <xsl:apply-templates select="nist:name" mode="process"/>
1579
1578
  </xsl:when>
@@ -1689,14 +1688,7 @@
1689
1688
  <xsl:template match="nist:title">
1690
1689
  <xsl:param name="sectionNum"/>
1691
1690
  <xsl:variable name="id">
1692
- <xsl:choose>
1693
- <xsl:when test="../@id">
1694
- <xsl:value-of select="../@id"/>
1695
- </xsl:when>
1696
- <xsl:otherwise>
1697
- <xsl:value-of select="text()"/>
1698
- </xsl:otherwise>
1699
- </xsl:choose>
1691
+ <xsl:call-template name="getId"/>
1700
1692
  </xsl:variable>
1701
1693
 
1702
1694
  <xsl:variable name="parent-name" select="local-name(..)"/>
@@ -1728,8 +1720,7 @@
1728
1720
  <xsl:call-template name="getSection">
1729
1721
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
1730
1722
  </xsl:call-template>
1731
- </xsl:variable>
1732
-
1723
+ </xsl:variable>
1733
1724
  <xsl:choose>
1734
1725
  <xsl:when test="ancestor::nist:legal-statement">
1735
1726
  <fo:block id="{$id}" font-family="Arial" font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
@@ -1743,7 +1734,7 @@
1743
1734
  </fo:block>
1744
1735
  </fo:block-container>
1745
1736
  </xsl:when>
1746
- <xsl:when test="ancestor::nist:preface">
1737
+ <xsl:when test="ancestor::nist:preface and not(ancestor::nist:introduction)">
1747
1738
  <fo:block id="{$id}" font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" space-before="12pt" margin-bottom="12pt">
1748
1739
  <xsl:apply-templates/>
1749
1740
  </fo:block>
@@ -1794,51 +1785,6 @@
1794
1785
  </xsl:template>
1795
1786
 
1796
1787
 
1797
- <xsl:template match="nist:preferred2">
1798
- <xsl:param name="sectionNum"/>
1799
- <!-- DEBUG need -->
1800
- <fo:block space-before="6pt" text-align="justify">
1801
- <fo:inline id="{../@id}" padding-right="5mm" font-weight="bold">
1802
- <!-- <xsl:value-of select="$sectionNum"/><xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term"/> -->
1803
- <xsl:variable name="section">
1804
- <xsl:call-template name="getSection">
1805
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
1806
- </xsl:call-template>
1807
- </xsl:variable>
1808
- <xsl:value-of select="$section"/>
1809
- </fo:inline>
1810
- <fo:inline font-weight="bold">
1811
- <xsl:apply-templates/>
1812
- </fo:inline>
1813
- <xsl:if test="../nist:termsource/nist:origin">
1814
- <xsl:text> [</xsl:text><xsl:value-of select="../nist:termsource/nist:origin/@citeas"/><xsl:text>]</xsl:text>
1815
- </xsl:if>
1816
- <xsl:text>: </xsl:text>
1817
- <xsl:apply-templates select="following-sibling::nist:definition/node()" mode="process"/> <!-- -->
1818
- </fo:block>
1819
- <!-- <xsl:if test="following-sibling::itu:table">
1820
- <fo:block space-after="18pt">&#xA0;</fo:block>
1821
- </xsl:if> -->
1822
- </xsl:template>
1823
-
1824
- <xsl:template match="nist:definition2/nist:p"/>
1825
- <xsl:template match="nist:definition2/nist:formula"/>
1826
-
1827
- <xsl:template match="nist:definition2/nist:p" mode="process"> <!-- -->
1828
- <xsl:choose>
1829
- <xsl:when test="position() = 1">
1830
- <fo:inline>
1831
- <xsl:apply-templates/>
1832
- </fo:inline>
1833
- </xsl:when>
1834
- <xsl:otherwise>
1835
- <fo:block margin-top="6pt" text-align="justify">
1836
- <xsl:apply-templates/>
1837
- </fo:block>
1838
- </xsl:otherwise>
1839
- </xsl:choose>
1840
- </xsl:template>
1841
-
1842
1788
  <xsl:template match="nist:p/nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn" priority="2">
1843
1789
  <fo:footnote>
1844
1790
  <xsl:variable name="number">
@@ -1892,35 +1838,24 @@
1892
1838
  <xsl:call-template name="fn_display_figure"/>
1893
1839
  <xsl:for-each select="nist:note//nist:p">
1894
1840
  <xsl:call-template name="note"/>
1895
- </xsl:for-each>
1841
+ </xsl:for-each>
1896
1842
  <fo:block font-weight="bold" text-align="center" space-before="6pt" margin-bottom="6pt" keep-with-previous="always">
1897
1843
  <xsl:if test="nist:dl">
1898
1844
  <xsl:attribute name="space-before">12pt</xsl:attribute>
1899
1845
  </xsl:if>
1900
- <xsl:text>Figure </xsl:text>
1901
- <xsl:choose>
1902
- <xsl:when test="ancestor::nist:annex">
1903
- <xsl:choose>
1904
- <xsl:when test="count(//nist:annex) = 1">
1905
- <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:ext/nist:structuredidentifier/nist:annexid"/><xsl:number format="-1" level="any" count="nist:annex//nist:figure"/>
1906
- </xsl:when>
1907
- <xsl:otherwise>
1908
- <xsl:number format="A-1-1" level="multiple" count="nist:annex | nist:figure"/>
1909
- </xsl:otherwise>
1910
- </xsl:choose>
1911
- </xsl:when>
1912
- <xsl:when test="ancestor::nist:figure">
1913
- <xsl:for-each select="parent::*[1]">
1914
- <xsl:number format="1" level="any" count="nist:figure[not(parent::nist:figure)]"/>
1915
- </xsl:for-each>
1916
- <xsl:number format="-a" count="nist:figure"/>
1917
- </xsl:when>
1918
- <xsl:otherwise>
1919
- <xsl:number format="1" level="any" count="nist:figure[not(parent::nist:figure)]"/>
1920
- </xsl:otherwise>
1921
- </xsl:choose>
1846
+ <xsl:if test="not(@unnumbered='true')">
1847
+ <xsl:variable name="title-figure">
1848
+ <xsl:call-template name="getTitle">
1849
+ <xsl:with-param name="name" select="'title-figure'"/>
1850
+ </xsl:call-template>
1851
+ </xsl:variable>
1852
+ <xsl:value-of select="$title-figure"/>
1853
+ <xsl:call-template name="getFigureNumber"/>
1854
+ </xsl:if>
1922
1855
  <xsl:if test="nist:name">
1923
- <xsl:text> — </xsl:text>
1856
+ <xsl:if test="not(@unnumbered='true')">
1857
+ <xsl:text> — </xsl:text>
1858
+ </xsl:if>
1924
1859
  <xsl:value-of select="nist:name"/>
1925
1860
  </xsl:if>
1926
1861
  </fo:block>
@@ -1995,7 +1930,14 @@
1995
1930
  </xsl:if>
1996
1931
  <xsl:if test="nist:title">
1997
1932
  <xsl:for-each select="nist:contributor">
1998
- <xsl:value-of select="nist:organization/nist:name"/>
1933
+ <xsl:choose>
1934
+ <xsl:when test="nist:person/nist:name/nist:completename">
1935
+ <xsl:apply-templates select="nist:person/nist:name/nist:completename"/>
1936
+ </xsl:when>
1937
+ <xsl:otherwise>
1938
+ <xsl:apply-templates select="nist:organization/nist:name"/>
1939
+ </xsl:otherwise>
1940
+ </xsl:choose>
1999
1941
  <xsl:if test="position() != last()">, </xsl:if>
2000
1942
  </xsl:for-each>
2001
1943
  <xsl:text> (</xsl:text>
@@ -2019,6 +1961,9 @@
2019
1961
  <xsl:if test="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name">
2020
1962
  <xsl:text> (</xsl:text><xsl:value-of select="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name"/><xsl:text>)</xsl:text>
2021
1963
  </xsl:if>
1964
+ <xsl:if test="nist:place">
1965
+ <xsl:text> (</xsl:text><xsl:value-of select="nist:place"/><xsl:text>)</xsl:text>
1966
+ </xsl:if>
2022
1967
  <xsl:text>, </xsl:text>
2023
1968
  <xsl:value-of select="$date"/>
2024
1969
  <xsl:text>. </xsl:text>
@@ -2045,7 +1990,12 @@
2045
1990
 
2046
1991
  <xsl:template match="nist:annex//nist:note/nist:p">
2047
1992
  <fo:block font-size="11pt" margin-top="4pt">
2048
- <xsl:text>NOTE </xsl:text>
1993
+ <xsl:variable name="title-note">
1994
+ <xsl:call-template name="getTitle">
1995
+ <xsl:with-param name="name" select="'title-note'"/>
1996
+ </xsl:call-template>
1997
+ </xsl:variable>
1998
+ <xsl:value-of select="$title-note"/>
2049
1999
  <xsl:if test="../following-sibling::nist:note or ../preceding-sibling::nist:note">
2050
2000
  <xsl:number count="nist:note"/><xsl:text> </xsl:text>
2051
2001
  </xsl:if>
@@ -2071,7 +2021,12 @@
2071
2021
  <xsl:template match="nist:ul//nist:note | nist:ol//nist:note"/>
2072
2022
  <xsl:template match="nist:ul//nist:note/nist:p | nist:ol//nist:note/nist:p" mode="process">
2073
2023
  <fo:block font-size="11pt" margin-top="4pt">
2074
- <xsl:text>NOTE </xsl:text>
2024
+ <xsl:variable name="title-note">
2025
+ <xsl:call-template name="getTitle">
2026
+ <xsl:with-param name="name" select="'title-note'"/>
2027
+ </xsl:call-template>
2028
+ </xsl:variable>
2029
+ <xsl:value-of select="$title-note"/>
2075
2030
  <xsl:if test="../following-sibling::nist:note or ../preceding-sibling::nist:note">
2076
2031
  <xsl:number count="nist:note"/><xsl:text> </xsl:text>
2077
2032
  </xsl:if>
@@ -2151,18 +2106,8 @@
2151
2106
  </fo:block>
2152
2107
  </xsl:template>
2153
2108
 
2154
- <xsl:template match="nist:link">
2155
- <xsl:variable name="target">
2156
- <xsl:choose>
2157
- <xsl:when test="contains(@target, 'mailto:')">
2158
- <xsl:value-of select="substring-after(@target, 'mailto:')"/>
2159
- </xsl:when>
2160
- <xsl:otherwise>
2161
- <xsl:value-of select="@target"/>
2162
- </xsl:otherwise>
2163
- </xsl:choose>
2164
- </xsl:variable>
2165
- <fo:basic-link external-destination="{@target}" color="blue" fox:alt-text="link {@target}">
2109
+ <xsl:template match="nist:link" priority="2">
2110
+ <fo:inline color="blue">
2166
2111
  <xsl:choose>
2167
2112
  <xsl:when test="ancestor::nist:annex">
2168
2113
  </xsl:when>
@@ -2173,26 +2118,24 @@
2173
2118
  </xsl:if>
2174
2119
  </xsl:otherwise>
2175
2120
  </xsl:choose>
2176
- <xsl:choose>
2177
- <xsl:when test="normalize-space(.) = ''">
2178
- <xsl:value-of select="$target"/>
2179
- </xsl:when>
2180
- <xsl:otherwise>
2181
- <xsl:apply-templates/>
2182
- </xsl:otherwise>
2183
- </xsl:choose>
2184
- </fo:basic-link>
2121
+ <xsl:call-template name="link"/>
2122
+ </fo:inline>
2185
2123
  </xsl:template>
2186
2124
 
2187
2125
 
2188
2126
  <xsl:template match="nist:termnote">
2189
2127
  <fo:block margin-top="4pt">
2190
- <xsl:text>NOTE </xsl:text>
2191
- <xsl:if test="following-sibling::nist:termnote or preceding-sibling::nist:termnote">
2192
- <xsl:number/><xsl:text> </xsl:text>
2193
- </xsl:if>
2194
- <xsl:text>– </xsl:text>
2195
- <xsl:apply-templates/>
2128
+ <xsl:variable name="title-note">
2129
+ <xsl:call-template name="getTitle">
2130
+ <xsl:with-param name="name" select="'title-note'"/>
2131
+ </xsl:call-template>
2132
+ </xsl:variable>
2133
+ <xsl:value-of select="$title-note"/>
2134
+ <xsl:if test="following-sibling::nist:termnote or preceding-sibling::nist:termnote">
2135
+ <xsl:number/><xsl:text> </xsl:text>
2136
+ </xsl:if>
2137
+ <xsl:text>– </xsl:text>
2138
+ <xsl:apply-templates/>
2196
2139
  </fo:block>
2197
2140
  </xsl:template>
2198
2141
  <xsl:template match="nist:termnote/nist:p">
@@ -2207,39 +2150,47 @@
2207
2150
 
2208
2151
  <xsl:template match="nist:formula" name="formula">
2209
2152
  <fo:block id="{@id}" margin-bottom="12pt"> <!-- margin-top="6pt" text-align="center" -->
2210
- <fo:table table-layout="fixed" width="100%">
2211
- <fo:table-column column-width="95%"/>
2212
- <fo:table-column column-width="5%"/>
2213
- <fo:table-body>
2214
- <fo:table-row>
2215
- <fo:table-cell>
2216
- <fo:block text-align="left" margin-left="7mm">
2217
- <!-- <xsl:if test="ancestor::nist:annex">
2218
- <xsl:attribute name="text-align">left</xsl:attribute>
2219
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
2220
- </xsl:if> -->
2221
- <xsl:apply-templates/>
2222
- </fo:block>
2223
- </fo:table-cell>
2224
- <fo:table-cell> <!-- display-align="center" -->
2225
- <fo:block text-align="right">
2226
- <xsl:if test="not(ancestor::nist:annex)">
2227
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
2228
- </xsl:if>
2229
- <xsl:if test="ancestor::nist:annex">
2230
- <xsl:variable name="annex-id" select="ancestor::nist:annex/@id"/>
2231
- <xsl:text>(</xsl:text>
2232
- <xsl:number format="A-" count="nist:annex"/>
2233
- <xsl:number format="1" level="any" count="nist:formula[ancestor::nist:annex[@id = $annex-id]]"/>
2234
- <xsl:text>)</xsl:text>
2235
- </xsl:if>
2236
- </fo:block>
2237
- </fo:table-cell>
2238
- </fo:table-row>
2239
- </fo:table-body>
2240
- </fo:table>
2241
- <fo:inline keep-together.within-line="always">
2242
- </fo:inline>
2153
+ <xsl:choose>
2154
+ <xsl:when test="not(@unnumbered='true')">
2155
+ <fo:table table-layout="fixed" width="100%">
2156
+ <fo:table-column column-width="95%"/>
2157
+ <fo:table-column column-width="5%"/>
2158
+ <fo:table-body>
2159
+ <fo:table-row>
2160
+ <fo:table-cell>
2161
+ <fo:block text-align="left" margin-left="7mm">
2162
+ <!-- <xsl:if test="ancestor::nist:annex">
2163
+ <xsl:attribute name="text-align">left</xsl:attribute>
2164
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2165
+ </xsl:if> -->
2166
+ <xsl:apply-templates/>
2167
+ </fo:block>
2168
+ </fo:table-cell>
2169
+ <fo:table-cell> <!-- display-align="center" -->
2170
+ <fo:block text-align="right">
2171
+ <xsl:if test="not(ancestor::nist:annex)">
2172
+ <xsl:number format="(1)" level="any" count="nist:formula[not(@unnumbered='true')]"/>
2173
+ </xsl:if>
2174
+ <xsl:if test="ancestor::nist:annex">
2175
+ <xsl:variable name="annex-id" select="ancestor::nist:annex/@id"/>
2176
+ <xsl:text>(</xsl:text>
2177
+ <xsl:number format="A-" count="nist:annex"/>
2178
+ <xsl:number format="1" level="any" count="nist:formula[ancestor::nist:annex[@id = $annex-id]][not(@unnumbered='true')]"/>
2179
+ <xsl:text>)</xsl:text>
2180
+ </xsl:if>
2181
+ </fo:block>
2182
+ </fo:table-cell>
2183
+ </fo:table-row>
2184
+ </fo:table-body>
2185
+ </fo:table>
2186
+ <fo:inline keep-together.within-line="always">
2187
+ </fo:inline>
2188
+ </xsl:when>
2189
+ <xsl:otherwise>
2190
+ <xsl:attribute name="text-align">center</xsl:attribute>
2191
+ <xsl:apply-templates/>
2192
+ </xsl:otherwise>
2193
+ </xsl:choose>
2243
2194
  </fo:block>
2244
2195
  </xsl:template>
2245
2196
 
@@ -2263,13 +2214,24 @@
2263
2214
 
2264
2215
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
2265
2216
 
2217
+ <xsl:variable name="title-section">
2218
+ <xsl:call-template name="getTitle">
2219
+ <xsl:with-param name="name" select="'title-section'"/>
2220
+ </xsl:call-template>
2221
+ </xsl:variable>
2222
+ <xsl:variable name="title-example-xref">
2223
+ <xsl:call-template name="getTitle">
2224
+ <xsl:with-param name="name" select="'title-example-xref'"/>
2225
+ </xsl:call-template>
2226
+ </xsl:variable>
2227
+
2266
2228
  <fo:basic-link internal-destination="{@target}" text-decoration="underline" color="blue" fox:alt-text="{$section}">
2267
2229
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
2268
2230
  <xsl:variable name="parent" select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
2269
2231
  <xsl:choose>
2270
2232
  <xsl:when test="$type = 'clause' and $parent = 'annex'"><xsl:value-of select="$annexprefix"/></xsl:when>
2271
- <xsl:when test="$type = 'clause'">Section </xsl:when><!-- and not (ancestor::annex) -->
2272
- <xsl:when test="$type = 'Example'">Example </xsl:when>
2233
+ <xsl:when test="$type = 'clause'"><xsl:value-of select="$title-section"/></xsl:when><!-- and not (ancestor::annex) -->
2234
+ <xsl:when test="$type = 'Example'"><xsl:value-of select="$title-example-xref"/></xsl:when>
2273
2235
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
2274
2236
  </xsl:choose>
2275
2237
 
@@ -2278,8 +2240,13 @@
2278
2240
  <xsl:variable name="currentSection">
2279
2241
  <xsl:call-template name="getSection"/>
2280
2242
  </xsl:variable>
2281
- <xsl:if test="not(contains($section, $currentSection))">
2282
- <xsl:text>in </xsl:text>
2243
+ <xsl:if test="not(contains($section, $currentSection))">
2244
+ <xsl:variable name="title-in">
2245
+ <xsl:call-template name="getTitle">
2246
+ <xsl:with-param name="name" select="'title-in'"/>
2247
+ </xsl:call-template>
2248
+ </xsl:variable>
2249
+ <xsl:value-of select="$title-in"/>
2283
2250
  <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
2284
2251
  <xsl:text> </xsl:text>
2285
2252
  <xsl:value-of select="$section"/>
@@ -2298,8 +2265,13 @@
2298
2265
 
2299
2266
 
2300
2267
  <xsl:template match="nist:example">
2301
- <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">EXAMPLE</fo:block>
2302
- <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" margin-left="25.4mm" margin-right="12.7mm">
2268
+ <xsl:variable name="title-example">
2269
+ <xsl:call-template name="getTitle">
2270
+ <xsl:with-param name="name" select="'title-example'"/>
2271
+ </xsl:call-template>
2272
+ </xsl:variable>
2273
+ <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt" keep-with-next="always"><xsl:value-of select="$title-example"/></fo:block>
2274
+ <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" margin-left="12.5mm" margin-right="12.7mm">
2303
2275
  <xsl:apply-templates/>
2304
2276
  </fo:block>
2305
2277
  </xsl:template>
@@ -2339,7 +2311,7 @@
2339
2311
  <xsl:if test="@type = 'inline'">
2340
2312
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2341
2313
  </xsl:if>
2342
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
2314
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
2343
2315
 
2344
2316
  <xsl:apply-templates select="nist:localityStack"/>
2345
2317
 
@@ -2348,9 +2320,19 @@
2348
2320
  </xsl:template>
2349
2321
 
2350
2322
  <xsl:template match="nist:locality">
2323
+ <xsl:variable name="title-section">
2324
+ <xsl:call-template name="getTitle">
2325
+ <xsl:with-param name="name" select="'title-section'"/>
2326
+ </xsl:call-template>
2327
+ </xsl:variable>
2328
+ <xsl:variable name="title-clause">
2329
+ <xsl:call-template name="getTitle">
2330
+ <xsl:with-param name="name" select="'title-clause'"/>
2331
+ </xsl:call-template>
2332
+ </xsl:variable>
2351
2333
  <xsl:choose>
2352
- <xsl:when test="@type = 'section'">Section </xsl:when>
2353
- <xsl:when test="@type = 'clause'">Clause </xsl:when>
2334
+ <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when>
2335
+ <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
2354
2336
  <xsl:otherwise/>
2355
2337
  </xsl:choose>
2356
2338
  <xsl:text> </xsl:text><xsl:value-of select="nist:referenceFrom"/>
@@ -2368,7 +2350,7 @@
2368
2350
  </fo:block>
2369
2351
  </xsl:template>
2370
2352
  <xsl:template match="nist:term" mode="table">
2371
- <fo:table-row>
2353
+ <fo:table-row id="{@id}">
2372
2354
  <fo:table-cell padding-right="1mm">
2373
2355
  <fo:block margin-bottom="12pt">
2374
2356
  <xsl:apply-templates select="nist:preferred"/>
@@ -2382,7 +2364,7 @@
2382
2364
  </fo:table-row>
2383
2365
  </xsl:template>
2384
2366
  <xsl:template match="nist:preferred">
2385
- <fo:inline id="{../@id}">
2367
+ <fo:inline>
2386
2368
  <xsl:apply-templates/>
2387
2369
  </fo:inline>
2388
2370
  </xsl:template>
@@ -2449,24 +2431,6 @@
2449
2431
  </fo:block>
2450
2432
  </xsl:template>
2451
2433
 
2452
- <xsl:template match="nist:sourcecode">
2453
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
2454
- <!-- <xsl:choose>
2455
- <xsl:when test="@lang = 'en'"></xsl:when>
2456
- <xsl:otherwise> -->
2457
- <xsl:attribute name="white-space">pre</xsl:attribute>
2458
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
2459
- <!-- </xsl:otherwise>
2460
- </xsl:choose> -->
2461
- <xsl:apply-templates/>
2462
- </fo:block>
2463
- </xsl:template>
2464
-
2465
- <!-- <xsl:template match="nist:dt//nist:stem">
2466
- <xsl:apply-templates />
2467
- <xsl:value-of select="$linebreak"/>
2468
- </xsl:template> -->
2469
-
2470
2434
  <xsl:template match="nist:dd//nist:stem[count(ancestor::nist:dd/nist:p) = 1 and normalize-space(ancestor::nist:dd/nist:p/text()) = '']">
2471
2435
  <fo:block text-align="center">
2472
2436
  <xsl:apply-templates/>
@@ -2550,7 +2514,7 @@
2550
2514
  <xsl:template name="insertFooter">
2551
2515
  <fo:static-content flow-name="footer" font-family="Times New Roman" font-size="10pt">
2552
2516
  <fo:block-container height="1in" display-align="after">
2553
- <fo:block text-align="right" padding-bottom="0.5in" margin-right="-4mm"><fo:page-number/></fo:block>
2517
+ <fo:block text-align="center" padding-bottom="0.5in" margin-right="-4mm"><fo:page-number/></fo:block>
2554
2518
  </fo:block-container>
2555
2519
  </fo:static-content>
2556
2520
  </xsl:template>
@@ -2561,6 +2525,16 @@
2561
2525
  </xsl:template>
2562
2526
 
2563
2527
  <xsl:template name="insertFooterAnnex">
2528
+ <xsl:variable name="title-appendix">
2529
+ <xsl:call-template name="getTitle">
2530
+ <xsl:with-param name="name" select="'title-appendix'"/>
2531
+ </xsl:call-template>
2532
+ </xsl:variable>
2533
+ <xsl:variable name="title-page">
2534
+ <xsl:call-template name="getTitle">
2535
+ <xsl:with-param name="name" select="'title-page'"/>
2536
+ </xsl:call-template>
2537
+ </xsl:variable>
2564
2538
  <fo:static-content flow-name="footer-annex" font-family="Times New Roman" font-size="10pt">
2565
2539
  <fo:block-container height="1in" display-align="after">
2566
2540
  <fo:block padding-bottom="0.5in">
@@ -2571,12 +2545,13 @@
2571
2545
  <fo:table-row>
2572
2546
  <fo:table-cell>
2573
2547
  <fo:block>
2574
- <xsl:text>APPENDIX </xsl:text><fo:retrieve-marker retrieve-class-name="annex_number"/>
2548
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title-appendix))"/><fo:retrieve-marker retrieve-class-name="annex_number"/>
2575
2549
  </fo:block>
2576
2550
  </fo:table-cell>
2577
2551
  <fo:table-cell text-align="right">
2578
- <fo:block margin-right="-4mm">
2579
- <xsl:text>PAGE </xsl:text>
2552
+ <fo:block margin-right="-4mm">
2553
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title-page))"/>
2554
+ <xsl:text> </xsl:text>
2580
2555
  <fo:retrieve-marker retrieve-class-name="annex_number"/>
2581
2556
  <xsl:text>-</xsl:text>
2582
2557
  <fo:page-number/>
@@ -3405,25 +3380,7 @@
3405
3380
  </xsl:if>
3406
3381
  </xsl:template>
3407
3382
 
3408
- <xsl:template name="getLevel">
3409
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
3410
- <xsl:variable name="level">
3411
- <xsl:choose>
3412
- <xsl:when test="ancestor::nist:sections">
3413
- <xsl:value-of select="$level_total - 2"/>
3414
- </xsl:when>
3415
- <xsl:when test="ancestor::nist:bibliography">
3416
- <xsl:value-of select="$level_total - 2"/>
3417
- </xsl:when>
3418
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
3419
- <xsl:otherwise>
3420
- <xsl:value-of select="$level_total - 1"/>
3421
- </xsl:otherwise>
3422
- </xsl:choose>
3423
- </xsl:variable>
3424
- <xsl:value-of select="$level"/>
3425
- </xsl:template>
3426
-
3383
+
3427
3384
  <xsl:template name="getSection">
3428
3385
  <xsl:param name="sectionNum"/>
3429
3386
  <xsl:variable name="level">
@@ -3434,15 +3391,21 @@
3434
3391
  <xsl:when test="ancestor::nist:bibliography">
3435
3392
  <xsl:value-of select="$sectionNum"/>
3436
3393
  </xsl:when>
3437
- <xsl:when test="ancestor::nist:sections">
3394
+ <xsl:when test="ancestor::nist:sections or ancestor::nist:introduction">
3438
3395
  <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
3439
3396
  <xsl:choose>
3440
3397
  <xsl:when test="$level = 1">
3441
3398
  <xsl:value-of select="$sectionNum"/>
3442
3399
  </xsl:when>
3400
+ <xsl:when test="$level = 2 and ancestor::nist:introduction">
3401
+ <xsl:variable name="num">
3402
+ <xsl:call-template name="getSubSectionIntroduction"/>
3403
+ </xsl:variable>
3404
+ <xsl:value-of select="concat($sectionNum, $num)"/>
3405
+ </xsl:when>
3443
3406
  <xsl:when test="$level &gt;= 2">
3444
3407
  <xsl:variable name="num">
3445
- <xsl:number format=".1" level="multiple" count="nist:clause/nist:clause | nist:clause/nist:terms | nist:terms/nist:term | nist:clause/nist:term"/>
3408
+ <xsl:call-template name="getSubSection"/>
3446
3409
  </xsl:variable>
3447
3410
  <xsl:value-of select="concat($sectionNum, $num)"/>
3448
3411
  </xsl:when>
@@ -3601,65 +3564,291 @@
3601
3564
  </xsl:if>
3602
3565
  </xsl:template>
3603
3566
 
3604
- <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()">
3605
- <xsl:value-of select="."/>
3606
- </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']">
3607
- <xsl:value-of select="$linebreak"/>
3608
- </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">
3609
- <xsl:call-template name="add-zero-spaces"/>
3610
- </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']">
3611
-
3612
- <xsl:variable name="simple-table">
3613
- <!-- <xsl:copy> -->
3614
- <xsl:call-template name="getSimpleTable"/>
3615
- <!-- </xsl:copy> -->
3616
- </xsl:variable>
3617
-
3618
- <!-- DEBUG -->
3619
- <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
3620
- <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
3567
+ <xsl:template name="getSubSectionIntroduction">
3568
+ <xsl:number format=".1" count="*[local-name() = 'clause'] | *[local-name() = 'terms'] | *[local-name() = 'definitions']"/>
3569
+ </xsl:template>
3621
3570
 
3622
- <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3623
-
3624
-
3571
+ <xsl:template name="getFigureNumber">
3625
3572
  <xsl:choose>
3626
- <xsl:when test="@unnumbered = 'true'"/>
3627
- <xsl:otherwise>
3628
-
3629
-
3573
+ <xsl:when test="ancestor::nist:annex">
3574
+ <xsl:choose>
3575
+ <xsl:when test="count(//nist:annex) = 1">
3576
+ <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:ext/nist:structuredidentifier/nist:annexid"/><xsl:number format="-1" level="any" count="nist:annex//nist:figure[not(@unnumbered='true')]"/>
3577
+ </xsl:when>
3578
+ <xsl:otherwise>
3579
+ <xsl:number format="A.1-1" level="multiple" count="nist:annex | nist:figure[not(@unnumbered='true')]"/>
3580
+ </xsl:otherwise>
3581
+ </xsl:choose>
3582
+ </xsl:when>
3583
+ <xsl:when test="ancestor::nist:figure">
3584
+ <xsl:for-each select="parent::*[1]">
3585
+ <xsl:number format="1" level="any" count="nist:figure[not(parent::nist:figure)][not(@unnumbered='true')]"/>
3586
+ </xsl:for-each>
3587
+ <xsl:number format="-a" count="nist:figure[not(@unnumbered='true')]"/>
3588
+ </xsl:when>
3589
+ <xsl:otherwise>
3590
+ <xsl:number format="1" level="any" count="nist:figure[not(parent::nist:figure)][not(@unnumbered='true')]"/>
3591
+ <!-- <xsl:number format="1.1-1" level="multiple" count="nist:annex | nist:figure"/> -->
3592
+ </xsl:otherwise>
3593
+ </xsl:choose>
3594
+ </xsl:template>
3595
+
3596
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
3597
+
3598
+ <title-table lang="en">Table </title-table>
3599
+ <title-table lang="fr">Tableau </title-table>
3600
+
3601
+ <title-table lang="zh">Table </title-table>
3602
+
3603
+
3604
+
3605
+ <title-note lang="en">NOTE </title-note>
3606
+ <title-note lang="fr">NOTE </title-note>
3607
+
3608
+ <title-note lang="zh">NOTE </title-note>
3609
+
3610
+
3611
+
3612
+ <title-figure lang="en">Figure </title-figure>
3613
+ <title-figure lang="fr">Figure </title-figure>
3614
+
3615
+ <title-figure lang="zh">Figure </title-figure>
3616
+
3617
+
3618
+
3619
+ <title-example lang="en">EXAMPLE </title-example>
3620
+ <title-example lang="fr">EXEMPLE </title-example>
3621
+
3622
+ <title-example lang="zh">EXAMPLE </title-example>
3623
+
3624
+
3625
+
3626
+ <title-example-xref lang="en">Example </title-example-xref>
3627
+ <title-example-xref lang="fr">Exemple </title-example-xref>
3628
+
3629
+ <title-section lang="en">Section </title-section>
3630
+ <title-section lang="fr">Section </title-section>
3631
+
3632
+ <title-inequality lang="en">Inequality </title-inequality>
3633
+ <title-inequality lang="fr">Inequality </title-inequality>
3634
+
3635
+ <title-equation lang="en">Equation </title-equation>
3636
+ <title-equation lang="fr">Equation </title-equation>
3637
+
3638
+ <title-annex lang="en">Annex </title-annex>
3639
+ <title-annex lang="fr">Annexe </title-annex>
3640
+
3641
+ <title-annex lang="zh">Annex </title-annex>
3642
+
3643
+
3644
+
3645
+ <title-appendix lang="en">Appendix </title-appendix>
3646
+ <title-appendix lang="fr">Appendix </title-appendix>
3647
+
3648
+ <title-clause lang="en">Clause </title-clause>
3649
+ <title-clause lang="fr">Article </title-clause>
3650
+
3651
+ <title-clause lang="zh">Clause </title-clause>
3652
+
3653
+
3654
+
3655
+ <title-edition lang="en">
3656
+
3657
+ <xsl:text>Edition </xsl:text>
3658
+
3659
+
3660
+ </title-edition>
3661
+
3662
+ <title-formula lang="en">Formula </title-formula>
3663
+ <title-formula lang="fr">Formula </title-formula>
3664
+
3665
+ <title-toc lang="en">
3666
+
3667
+
3668
+ <xsl:text>Table of Contents</xsl:text>
3669
+
3670
+
3671
+ </title-toc>
3672
+ <title-toc lang="fr">Sommaire</title-toc>
3673
+
3674
+ <title-toc lang="zh">Contents</title-toc>
3675
+
3676
+
3677
+
3678
+ <title-page lang="en">Page</title-page>
3679
+ <title-page lang="fr">Page</title-page>
3680
+
3681
+ <title-key lang="en">Key</title-key>
3682
+ <title-key lang="fr">Légende</title-key>
3683
+
3684
+ <title-where lang="en">where</title-where>
3685
+ <title-where lang="fr">où</title-where>
3686
+
3687
+ <title-descriptors lang="en">Descriptors</title-descriptors>
3688
+
3689
+ <title-part lang="en">
3690
+
3691
+
3692
+ </title-part>
3693
+ <title-part lang="fr">
3694
+
3695
+
3696
+ </title-part>
3697
+ <title-part lang="zh">第 # 部分:</title-part>
3698
+
3699
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
3700
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
3701
+
3702
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
3703
+
3704
+
3705
+
3706
+ <title-modified lang="en">modified</title-modified>
3707
+ <title-modified lang="fr">modifiée</title-modified>
3708
+
3709
+ <title-modified lang="zh">modified</title-modified>
3710
+
3711
+
3712
+
3713
+ <title-source lang="en">SOURCE</title-source>
3714
+
3715
+ <title-keywords lang="en">Keywords</title-keywords>
3716
+
3717
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
3718
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
3719
+
3720
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
3721
+
3722
+ <title-list-tables lang="en">List of Tables</title-list-tables>
3723
+
3724
+ <title-list-figures lang="en">List of Figures</title-list-figures>
3725
+
3726
+ <title-recommendation lang="en">Recommendation </title-recommendation>
3727
+
3728
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
3729
+
3730
+ <title-abstract lang="en">Abstract</title-abstract>
3731
+
3732
+ <title-summary lang="en">Summary</title-summary>
3733
+
3734
+ <title-in lang="en">in </title-in>
3735
+
3736
+ <title-box lang="en">Box </title-box>
3737
+
3738
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3739
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
3740
+
3741
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3742
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
3743
+
3744
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3745
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
3746
+
3747
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
3748
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
3749
+
3750
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
3751
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
3752
+
3753
+ <title-caution lang="en">CAUTION</title-caution>
3754
+ <title-caution lang="zh">注意</title-caution>
3755
+
3756
+ <title-warning lang="en">WARNING</title-warning>
3757
+ <title-warning lang="zh">警告</title-warning>
3758
+
3759
+ <title-amendment lang="en">AMENDMENT</title-amendment>
3760
+ </xsl:variable><xsl:template name="getTitle">
3761
+ <xsl:param name="name"/>
3762
+ <xsl:variable name="lang">
3763
+ <xsl:call-template name="getLang"/>
3764
+ </xsl:variable>
3765
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
3766
+ <xsl:choose>
3767
+ <xsl:when test="normalize-space($title_) != ''">
3768
+ <xsl:value-of select="$title_"/>
3769
+ </xsl:when>
3770
+ <xsl:otherwise>
3771
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3772
+ </xsl:otherwise>
3773
+ </xsl:choose>
3774
+ </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">
3775
+
3776
+
3777
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
3778
+
3779
+
3780
+
3781
+
3782
+
3783
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
3784
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3785
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
3786
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3787
+
3788
+
3789
+
3790
+
3791
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
3792
+
3793
+
3794
+
3795
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
3796
+
3797
+
3798
+
3799
+ </xsl:attribute-set><xsl:template match="text()">
3800
+ <xsl:value-of select="."/>
3801
+ </xsl:template><xsl:template match="*[local-name()='br']">
3802
+ <xsl:value-of select="$linebreak"/>
3803
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3804
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3805
+ <xsl:call-template name="add-zero-spaces-java"/>
3806
+ </xsl:template><xsl:template match="*[local-name()='table']">
3807
+
3808
+ <xsl:variable name="simple-table">
3809
+ <!-- <xsl:copy> -->
3810
+ <xsl:call-template name="getSimpleTable"/>
3811
+ <!-- </xsl:copy> -->
3812
+ </xsl:variable>
3813
+
3814
+ <!-- DEBUG -->
3815
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
3816
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
3817
+
3818
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3819
+
3820
+ <!-- <xsl:if test="$namespace = 'iso'">
3821
+ <fo:block space-before="6pt">&#xA0;</fo:block>
3822
+ </xsl:if> -->
3823
+
3824
+ <xsl:choose>
3825
+ <xsl:when test="@unnumbered = 'true'"/>
3826
+ <xsl:otherwise>
3827
+
3828
+
3630
3829
 
3631
3830
  <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
3632
3831
 
3832
+
3833
+
3633
3834
  <xsl:attribute name="font-family">Arial</xsl:attribute>
3634
3835
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3635
3836
 
3636
3837
 
3637
3838
 
3638
3839
 
3639
- <xsl:text>Table </xsl:text>
3640
- <xsl:choose>
3641
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3642
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3643
- </xsl:when>
3644
- <xsl:when test="ancestor::*[local-name()='annex']">
3645
-
3646
-
3647
-
3648
- <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
3649
- <xsl:number format="A-" count="*[local-name()='annex']"/>
3650
- <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
3651
-
3652
-
3653
-
3654
-
3655
- </xsl:when>
3656
- <xsl:otherwise>
3657
- <!-- <xsl:number format="1"/> -->
3658
- <xsl:number format="A." count="*[local-name()='annex']"/>
3659
- <!-- <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/> -->
3660
- <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']"/>
3661
- </xsl:otherwise>
3662
- </xsl:choose>
3840
+
3841
+
3842
+ <xsl:variable name="title-table">
3843
+ <xsl:call-template name="getTitle">
3844
+ <xsl:with-param name="name" select="'title-table'"/>
3845
+ </xsl:call-template>
3846
+ </xsl:variable>
3847
+ <xsl:value-of select="$title-table"/>
3848
+
3849
+ <xsl:call-template name="getTableNumber"/>
3850
+
3851
+
3663
3852
  <xsl:if test="*[local-name()='name']">
3664
3853
 
3665
3854
 
@@ -3702,11 +3891,11 @@
3702
3891
  </xsl:call-template>
3703
3892
  </xsl:variable>
3704
3893
 
3705
- <xsl:variable name="colwidths2">
3894
+ <!-- <xsl:variable name="colwidths2">
3706
3895
  <xsl:call-template name="calculate-column-widths">
3707
3896
  <xsl:with-param name="cols-count" select="$cols-count"/>
3708
3897
  </xsl:call-template>
3709
- </xsl:variable>
3898
+ </xsl:variable> -->
3710
3899
 
3711
3900
  <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3712
3901
  colwidthsNew=<xsl:copy-of select="$colwidths"/>
@@ -3727,7 +3916,12 @@
3727
3916
 
3728
3917
 
3729
3918
 
3730
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
3919
+
3920
+
3921
+
3922
+ <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">
3923
+
3924
+
3731
3925
 
3732
3926
 
3733
3927
 
@@ -3746,9 +3940,10 @@
3746
3940
 
3747
3941
 
3748
3942
 
3943
+
3749
3944
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3750
3945
  <xsl:choose>
3751
- <xsl:when test=". = 1">
3946
+ <xsl:when test=". = 1 or . = 0">
3752
3947
  <fo:table-column column-width="proportional-column-width(2)"/>
3753
3948
  </xsl:when>
3754
3949
  <xsl:otherwise>
@@ -3756,18 +3951,57 @@
3756
3951
  </xsl:otherwise>
3757
3952
  </xsl:choose>
3758
3953
  </xsl:for-each>
3759
- <xsl:apply-templates/>
3954
+
3955
+ <xsl:choose>
3956
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3957
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3958
+ </xsl:when>
3959
+ <xsl:otherwise>
3960
+ <xsl:apply-templates/>
3961
+ </xsl:otherwise>
3962
+ </xsl:choose>
3963
+
3760
3964
  </fo:table>
3965
+
3966
+
3967
+
3761
3968
  </fo:block-container>
3762
- </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">
3969
+ </xsl:template><xsl:template name="getTableNumber">
3970
+ <xsl:choose>
3971
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3972
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3973
+ </xsl:when>
3974
+ <xsl:when test="ancestor::*[local-name()='annex']">
3975
+
3976
+
3977
+
3978
+
3979
+
3980
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
3981
+ <xsl:number format="A-" count="*[local-name()='annex']"/>
3982
+ <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
3983
+
3984
+
3985
+
3986
+
3987
+ </xsl:when>
3988
+ <xsl:otherwise>
3989
+
3990
+
3991
+ <xsl:number format="A." count="*[local-name()='annex']"/>
3992
+ <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']"/>
3993
+
3994
+ </xsl:otherwise>
3995
+ </xsl:choose>
3996
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
3763
3997
  <xsl:apply-templates/>
3764
- </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">
3998
+ </xsl:template><xsl:template name="calculate-columns-numbers">
3765
3999
  <xsl:param name="table-row"/>
3766
4000
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
3767
4001
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
3768
4002
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3769
4003
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3770
- </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">
4004
+ </xsl:template><xsl:template name="calculate-column-widths">
3771
4005
  <xsl:param name="table"/>
3772
4006
  <xsl:param name="cols-count"/>
3773
4007
  <xsl:param name="curr-col" select="1"/>
@@ -3776,7 +4010,7 @@
3776
4010
  <xsl:if test="$curr-col &lt;= $cols-count">
3777
4011
  <xsl:variable name="widths">
3778
4012
  <xsl:choose>
3779
- <xsl:when test="not($table)">
4013
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
3780
4014
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
3781
4015
  <xsl:variable name="words">
3782
4016
  <xsl:call-template name="tokenize">
@@ -3811,9 +4045,20 @@
3811
4045
  </xsl:when>
3812
4046
  <xsl:otherwise>
3813
4047
  <xsl:for-each select="xalan:nodeset($table)//tr">
4048
+ <xsl:variable name="td_text">
4049
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
4050
+ </xsl:variable>
3814
4051
  <xsl:variable name="words">
4052
+ <xsl:variable name="string_with_added_zerospaces">
4053
+ <xsl:call-template name="add-zero-spaces-java">
4054
+ <xsl:with-param name="text" select="$td_text"/>
4055
+ </xsl:call-template>
4056
+ </xsl:variable>
3815
4057
  <xsl:call-template name="tokenize">
3816
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
4058
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
4059
+ <!-- 2009 thinspace -->
4060
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
4061
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
3817
4062
  </xsl:call-template>
3818
4063
  </xsl:variable>
3819
4064
  <xsl:variable name="max_length">
@@ -3854,52 +4099,98 @@
3854
4099
  <xsl:with-param name="table" select="$table"/>
3855
4100
  </xsl:call-template>
3856
4101
  </xsl:if>
3857
- </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">
3858
- <!-- <fo:table-header font-weight="bold">
3859
- <xsl:apply-templates />
3860
- </fo:table-header> -->
3861
- <xsl:apply-templates/>
3862
- </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">
4102
+ </xsl:template><xsl:template match="text()" mode="td_text">
4103
+ <xsl:variable name="zero-space">​</xsl:variable>
4104
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
4105
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
4106
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
4107
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
4108
+ <xsl:value-of select="@target"/>
4109
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
4110
+ <xsl:param name="cols-count"/>
4111
+ <!-- font-weight="bold" -->
4112
+ <fo:table-header>
4113
+
4114
+ <xsl:apply-templates/>
4115
+ </fo:table-header>
4116
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
4117
+ <fo:table-body>
4118
+ <xsl:apply-templates/>
4119
+ </fo:table-body>
4120
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
3863
4121
  <xsl:apply-templates/>
3864
- </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']">
4122
+ </xsl:template><xsl:template name="insertTableFooter">
4123
+ <xsl:param name="cols-count"/>
4124
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
4125
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
4126
+
4127
+ <fo:table-footer>
4128
+
4129
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
4130
+
4131
+ <!-- if there are note(s) or fn(s) then create footer row -->
4132
+ <xsl:if test="$isNoteOrFnExist = 'true'">
4133
+
4134
+
4135
+
4136
+ <fo:table-row>
4137
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
4138
+
4139
+
4140
+
4141
+ <!-- fn will be processed inside 'note' processing -->
4142
+
4143
+
4144
+ <!-- except gb -->
4145
+
4146
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
4147
+
4148
+
4149
+ <!-- horizontal row separator -->
4150
+
4151
+
4152
+ <!-- fn processing -->
4153
+ <xsl:call-template name="fn_display"/>
4154
+
4155
+ </fo:table-cell>
4156
+ </fo:table-row>
4157
+
4158
+ </xsl:if>
4159
+ </fo:table-footer>
4160
+
4161
+ </xsl:if>
4162
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
4163
+
3865
4164
  <xsl:variable name="cols-count">
3866
4165
  <xsl:choose>
3867
- <xsl:when test="../*[local-name()='thead']">
3868
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
4166
+ <xsl:when test="../*[local-name()='thead']">
3869
4167
  <xsl:call-template name="calculate-columns-numbers">
3870
4168
  <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3871
4169
  </xsl:call-template>
3872
4170
  </xsl:when>
3873
- <xsl:otherwise>
3874
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
4171
+ <xsl:otherwise>
3875
4172
  <xsl:call-template name="calculate-columns-numbers">
3876
4173
  <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3877
4174
  </xsl:call-template>
3878
4175
  </xsl:otherwise>
3879
4176
  </xsl:choose>
3880
4177
  </xsl:variable>
3881
-
4178
+
4179
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
4180
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4181
+ </xsl:apply-templates>
4182
+
4183
+ <xsl:call-template name="insertTableFooter">
4184
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4185
+ </xsl:call-template>
4186
+
3882
4187
  <fo:table-body>
3883
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3884
4188
  <xsl:apply-templates/>
3885
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3886
- <!-- if there are note(s) or fn(s) then create footer row -->
3887
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
3888
- <fo:table-row>
3889
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3890
-
3891
-
3892
- <!-- fn will be processed inside 'note' processing -->
3893
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3894
- <!-- fn processing -->
3895
- <xsl:call-template name="fn_display"/>
3896
-
3897
- </fo:table-cell>
3898
- </fo:table-row>
3899
-
3900
- </xsl:if>
4189
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
4190
+
3901
4191
  </fo:table-body>
3902
- </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']">
4192
+
4193
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3903
4194
  <xsl:variable name="parent-name" select="local-name(..)"/>
3904
4195
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3905
4196
  <fo:table-row min-height="4mm">
@@ -3912,18 +4203,22 @@
3912
4203
 
3913
4204
 
3914
4205
 
4206
+
3915
4207
  </xsl:if>
3916
4208
  <xsl:if test="$parent-name = 'tfoot'">
3917
4209
 
4210
+
3918
4211
  </xsl:if>
3919
4212
 
4213
+
3920
4214
  <xsl:apply-templates/>
3921
4215
  </fo:table-row>
3922
- </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']">
4216
+ </xsl:template><xsl:template match="*[local-name()='th']">
3923
4217
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3924
4218
 
3925
4219
 
3926
4220
 
4221
+
3927
4222
  <xsl:attribute name="text-align">center</xsl:attribute>
3928
4223
  <xsl:attribute name="background-color">black</xsl:attribute>
3929
4224
  <xsl:attribute name="color">white</xsl:attribute>
@@ -3945,7 +4240,7 @@
3945
4240
  <xsl:apply-templates/>
3946
4241
  </fo:block>
3947
4242
  </fo:table-cell>
3948
- </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']">
4243
+ </xsl:template><xsl:template match="*[local-name()='td']">
3949
4244
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3950
4245
 
3951
4246
 
@@ -3953,6 +4248,9 @@
3953
4248
 
3954
4249
 
3955
4250
 
4251
+
4252
+
4253
+
3956
4254
  <xsl:if test="ancestor::*[local-name()='thead']">
3957
4255
  <xsl:attribute name="font-weight">normal</xsl:attribute>
3958
4256
  </xsl:if>
@@ -3968,6 +4266,7 @@
3968
4266
  </xsl:attribute>
3969
4267
  </xsl:if>
3970
4268
  <fo:block>
4269
+
3971
4270
  <xsl:apply-templates/>
3972
4271
  </fo:block>
3973
4272
  <!-- <xsl:choose>
@@ -3983,13 +4282,25 @@
3983
4282
 
3984
4283
 
3985
4284
  </fo:table-cell>
3986
- </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">
4285
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3987
4286
 
3988
4287
 
3989
4288
  <fo:block font-size="10pt" margin-bottom="12pt">
3990
4289
 
4290
+
4291
+
4292
+
3991
4293
  <fo:inline padding-right="2mm">
3992
- <xsl:text>NOTE </xsl:text>
4294
+
4295
+
4296
+
4297
+ <xsl:variable name="title-note">
4298
+ <xsl:call-template name="getTitle">
4299
+ <xsl:with-param name="name" select="'title-note'"/>
4300
+ </xsl:call-template>
4301
+ </xsl:variable>
4302
+ <xsl:value-of select="$title-note"/>
4303
+
3993
4304
 
3994
4305
 
3995
4306
  <xsl:number format="1 "/>
@@ -3998,9 +4309,9 @@
3998
4309
  <xsl:apply-templates mode="process"/>
3999
4310
  </fo:block>
4000
4311
 
4001
- </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">
4312
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
4002
4313
  <xsl:apply-templates/>
4003
- </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">
4314
+ </xsl:template><xsl:template name="fn_display">
4004
4315
  <xsl:variable name="references">
4005
4316
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4006
4317
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -4015,6 +4326,9 @@
4015
4326
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4016
4327
  <fo:block margin-bottom="12pt">
4017
4328
 
4329
+
4330
+
4331
+
4018
4332
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
4019
4333
 
4020
4334
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -4022,6 +4336,8 @@
4022
4336
 
4023
4337
 
4024
4338
 
4339
+
4340
+
4025
4341
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4026
4342
 
4027
4343
  <xsl:value-of select="@reference"/>
@@ -4036,7 +4352,7 @@
4036
4352
  </fo:block>
4037
4353
  </xsl:if>
4038
4354
  </xsl:for-each>
4039
- </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">
4355
+ </xsl:template><xsl:template name="fn_name_display">
4040
4356
  <!-- <xsl:variable name="references">
4041
4357
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
4042
4358
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -4052,7 +4368,7 @@
4052
4368
  <xsl:apply-templates/>
4053
4369
  </fo:block>
4054
4370
  </xsl:for-each>
4055
- </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">
4371
+ </xsl:template><xsl:template name="fn_display_figure">
4056
4372
  <xsl:variable name="key_iso">
4057
4373
  <!-- and (not(@class) or @class !='pseudocode') -->
4058
4374
  </xsl:variable>
@@ -4063,14 +4379,56 @@
4063
4379
  </fn>
4064
4380
  </xsl:for-each>
4065
4381
  </xsl:variable>
4382
+
4383
+ <!-- current hierarchy is 'figure' element -->
4384
+ <xsl:variable name="following_dl_colwidths">
4385
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4386
+ <xsl:variable name="html-table">
4387
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4388
+ <xsl:element name="{$ns}:table">
4389
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4390
+ <tbody>
4391
+ <xsl:apply-templates mode="dl"/>
4392
+ </tbody>
4393
+ </xsl:for-each>
4394
+ </xsl:element>
4395
+ </xsl:variable>
4396
+
4397
+ <xsl:call-template name="calculate-column-widths">
4398
+ <xsl:with-param name="cols-count" select="2"/>
4399
+ <xsl:with-param name="table" select="$html-table"/>
4400
+ </xsl:call-template>
4401
+
4402
+ </xsl:if>
4403
+ </xsl:variable>
4404
+
4405
+
4406
+ <xsl:variable name="maxlength_dt">
4407
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4408
+ <xsl:call-template name="getMaxLength_dt"/>
4409
+ </xsl:for-each>
4410
+ </xsl:variable>
4411
+
4066
4412
  <xsl:if test="xalan:nodeset($references)//fn">
4067
4413
  <fo:block>
4068
4414
  <fo:table width="95%" table-layout="fixed">
4069
4415
  <xsl:if test="normalize-space($key_iso) = 'true'">
4070
4416
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4417
+
4071
4418
  </xsl:if>
4072
- <fo:table-column column-width="15%"/>
4073
- <fo:table-column column-width="85%"/>
4419
+ <xsl:choose>
4420
+ <!-- if there 'dl', then set same columns width -->
4421
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4422
+ <xsl:call-template name="setColumnWidth_dl">
4423
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4424
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4425
+ </xsl:call-template>
4426
+ </xsl:when>
4427
+ <xsl:otherwise>
4428
+ <fo:table-column column-width="15%"/>
4429
+ <fo:table-column column-width="85%"/>
4430
+ </xsl:otherwise>
4431
+ </xsl:choose>
4074
4432
  <fo:table-body>
4075
4433
  <xsl:for-each select="xalan:nodeset($references)//fn">
4076
4434
  <xsl:variable name="reference" select="@reference"/>
@@ -4102,11 +4460,12 @@
4102
4460
  </fo:block>
4103
4461
  </xsl:if>
4104
4462
 
4105
- </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']">
4463
+ </xsl:template><xsl:template match="*[local-name()='fn']">
4106
4464
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
4107
4465
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
4108
4466
 
4109
4467
 
4468
+
4110
4469
  <xsl:attribute name="vertical-align">super</xsl:attribute>
4111
4470
  <xsl:attribute name="color">blue</xsl:attribute>
4112
4471
 
@@ -4118,11 +4477,11 @@
4118
4477
  <xsl:value-of select="@reference"/>
4119
4478
  </fo:basic-link>
4120
4479
  </fo:inline>
4121
- </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']">
4480
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
4122
4481
  <fo:inline>
4123
4482
  <xsl:apply-templates/>
4124
4483
  </fo:inline>
4125
- </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']">
4484
+ </xsl:template><xsl:template match="*[local-name()='dl']">
4126
4485
  <xsl:variable name="parent" select="local-name(..)"/>
4127
4486
 
4128
4487
  <xsl:variable name="key_iso">
@@ -4135,7 +4494,12 @@
4135
4494
 
4136
4495
  <fo:block margin-bottom="12pt" text-align="left">
4137
4496
 
4138
- <xsl:text>where </xsl:text>
4497
+ <xsl:variable name="title-where">
4498
+ <xsl:call-template name="getTitle">
4499
+ <xsl:with-param name="name" select="'title-where'"/>
4500
+ </xsl:call-template>
4501
+ </xsl:variable>
4502
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4139
4503
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4140
4504
  <xsl:text/>
4141
4505
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -4147,13 +4511,26 @@
4147
4511
 
4148
4512
 
4149
4513
 
4150
- <xsl:text>where</xsl:text>
4514
+
4515
+ <xsl:variable name="title-where">
4516
+ <xsl:call-template name="getTitle">
4517
+ <xsl:with-param name="name" select="'title-where'"/>
4518
+ </xsl:call-template>
4519
+ </xsl:variable>
4520
+ <xsl:value-of select="$title-where"/>
4151
4521
  </fo:block>
4152
4522
  </xsl:when>
4153
4523
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
4154
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
4524
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4525
+
4155
4526
 
4156
- <xsl:text>Key</xsl:text>
4527
+
4528
+ <xsl:variable name="title-key">
4529
+ <xsl:call-template name="getTitle">
4530
+ <xsl:with-param name="name" select="'title-key'"/>
4531
+ </xsl:call-template>
4532
+ </xsl:variable>
4533
+ <xsl:value-of select="$title-key"/>
4157
4534
  </fo:block>
4158
4535
  </xsl:when>
4159
4536
  </xsl:choose>
@@ -4175,69 +4552,44 @@
4175
4552
  <xsl:attribute name="margin-left">-2.5mm</xsl:attribute>
4176
4553
  </xsl:if>
4177
4554
 
4178
- <!-- create virtual html table for dl/[dt and dd] -->
4179
- <xsl:variable name="html-table">
4180
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4181
- <xsl:element name="{$ns}:table">
4182
- <tbody>
4183
- <xsl:apply-templates mode="dl"/>
4184
- </tbody>
4185
- </xsl:element>
4186
- </xsl:variable>
4187
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
4188
- <xsl:variable name="colwidths">
4189
- <xsl:call-template name="calculate-column-widths">
4190
- <xsl:with-param name="cols-count" select="2"/>
4191
- <xsl:with-param name="table" select="$html-table"/>
4192
- </xsl:call-template>
4193
- </xsl:variable>
4194
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4555
+
4556
+
4195
4557
 
4196
4558
  <fo:table width="95%" table-layout="fixed">
4559
+
4197
4560
  <xsl:choose>
4198
4561
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
4199
4562
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
4200
4563
  </xsl:when>
4201
4564
  <xsl:when test="normalize-space($key_iso) = 'true'">
4202
4565
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4566
+
4203
4567
  </xsl:when>
4204
4568
  </xsl:choose>
4205
- <xsl:choose>
4206
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4207
- <fo:table-column column-width="50%"/>
4208
- <fo:table-column column-width="50%"/>
4209
- </xsl:when>
4210
- <xsl:otherwise>
4211
- <xsl:choose>
4212
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
4213
- <fo:table-column column-width="60%"/>
4214
- <fo:table-column column-width="40%"/>
4215
- </xsl:when> -->
4216
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
4217
- <fo:table-column column-width="50%"/>
4218
- <fo:table-column column-width="50%"/>
4219
- </xsl:when>
4220
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
4221
- <fo:table-column column-width="40%"/>
4222
- <fo:table-column column-width="60%"/>
4223
- </xsl:when>
4224
- <xsl:otherwise>
4225
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4226
- <xsl:choose>
4227
- <xsl:when test=". = 1">
4228
- <fo:table-column column-width="proportional-column-width(2)"/>
4229
- </xsl:when>
4230
- <xsl:otherwise>
4231
- <fo:table-column column-width="proportional-column-width({.})"/>
4232
- </xsl:otherwise>
4233
- </xsl:choose>
4234
- </xsl:for-each>
4235
- </xsl:otherwise>
4236
- </xsl:choose>
4237
- <!-- <fo:table-column column-width="15%"/>
4238
- <fo:table-column column-width="85%"/> -->
4239
- </xsl:otherwise>
4240
- </xsl:choose>
4569
+ <!-- create virtual html table for dl/[dt and dd] -->
4570
+ <xsl:variable name="html-table">
4571
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4572
+ <xsl:element name="{$ns}:table">
4573
+ <tbody>
4574
+ <xsl:apply-templates mode="dl"/>
4575
+ </tbody>
4576
+ </xsl:element>
4577
+ </xsl:variable>
4578
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
4579
+ <xsl:variable name="colwidths">
4580
+ <xsl:call-template name="calculate-column-widths">
4581
+ <xsl:with-param name="cols-count" select="2"/>
4582
+ <xsl:with-param name="table" select="$html-table"/>
4583
+ </xsl:call-template>
4584
+ </xsl:variable>
4585
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4586
+ <xsl:variable name="maxlength_dt">
4587
+ <xsl:call-template name="getMaxLength_dt"/>
4588
+ </xsl:variable>
4589
+ <xsl:call-template name="setColumnWidth_dl">
4590
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4591
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4592
+ </xsl:call-template>
4241
4593
  <fo:table-body>
4242
4594
  <xsl:apply-templates>
4243
4595
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -4247,7 +4599,61 @@
4247
4599
  </fo:block>
4248
4600
  </fo:block>
4249
4601
  </xsl:if>
4250
- </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']">
4602
+ </xsl:template><xsl:template name="setColumnWidth_dl">
4603
+ <xsl:param name="colwidths"/>
4604
+ <xsl:param name="maxlength_dt"/>
4605
+ <xsl:choose>
4606
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4607
+ <fo:table-column column-width="50%"/>
4608
+ <fo:table-column column-width="50%"/>
4609
+ </xsl:when>
4610
+ <xsl:otherwise>
4611
+ <xsl:choose>
4612
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4613
+ <fo:table-column column-width="5%"/>
4614
+ <fo:table-column column-width="95%"/>
4615
+ </xsl:when>
4616
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
4617
+ <fo:table-column column-width="10%"/>
4618
+ <fo:table-column column-width="90%"/>
4619
+ </xsl:when>
4620
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
4621
+ <fo:table-column column-width="60%"/>
4622
+ <fo:table-column column-width="40%"/>
4623
+ </xsl:when> -->
4624
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
4625
+ <fo:table-column column-width="50%"/>
4626
+ <fo:table-column column-width="50%"/>
4627
+ </xsl:when>
4628
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
4629
+ <fo:table-column column-width="40%"/>
4630
+ <fo:table-column column-width="60%"/>
4631
+ </xsl:when>
4632
+ <xsl:otherwise>
4633
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4634
+ <xsl:choose>
4635
+ <xsl:when test=". = 1 or . = 0">
4636
+ <fo:table-column column-width="proportional-column-width(2)"/>
4637
+ </xsl:when>
4638
+ <xsl:otherwise>
4639
+ <fo:table-column column-width="proportional-column-width({.})"/>
4640
+ </xsl:otherwise>
4641
+ </xsl:choose>
4642
+ </xsl:for-each>
4643
+ </xsl:otherwise>
4644
+ </xsl:choose>
4645
+ <!-- <fo:table-column column-width="15%"/>
4646
+ <fo:table-column column-width="85%"/> -->
4647
+ </xsl:otherwise>
4648
+ </xsl:choose>
4649
+ </xsl:template><xsl:template name="getMaxLength_dt">
4650
+ <xsl:for-each select="*[local-name()='dt']">
4651
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
4652
+ <xsl:if test="position() = 1">
4653
+ <xsl:value-of select="string-length(normalize-space(.))"/>
4654
+ </xsl:if>
4655
+ </xsl:for-each>
4656
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
4251
4657
  <xsl:param name="key_iso"/>
4252
4658
 
4253
4659
  <!-- <tr>
@@ -4263,7 +4669,12 @@
4263
4669
  <xsl:if test="normalize-space($key_iso) = 'true'">
4264
4670
  <xsl:attribute name="margin-top">0</xsl:attribute>
4265
4671
  </xsl:if>
4266
- NOTE
4672
+ <xsl:variable name="title-note">
4673
+ <xsl:call-template name="getTitle">
4674
+ <xsl:with-param name="name" select="'title-note'"/>
4675
+ </xsl:call-template>
4676
+ </xsl:variable>
4677
+ <xsl:value-of select="$title-note"/>
4267
4678
  </fo:block>
4268
4679
  </fo:table-cell>
4269
4680
  <fo:table-cell>
@@ -4272,7 +4683,7 @@
4272
4683
  </fo:block>
4273
4684
  </fo:table-cell>
4274
4685
  </fo:table-row>
4275
- </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">
4686
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
4276
4687
  <tr>
4277
4688
  <td>
4278
4689
  <xsl:apply-templates/>
@@ -4298,12 +4709,15 @@
4298
4709
  </tr>
4299
4710
  </xsl:if>
4300
4711
 
4301
- </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']">
4712
+ </xsl:template><xsl:template match="*[local-name()='dt']">
4302
4713
  <xsl:param name="key_iso"/>
4303
4714
 
4304
4715
  <fo:table-row>
4305
4716
  <fo:table-cell>
4717
+
4306
4718
  <fo:block margin-top="6pt">
4719
+
4720
+
4307
4721
  <xsl:if test="normalize-space($key_iso) = 'true'">
4308
4722
  <xsl:attribute name="margin-top">0</xsl:attribute>
4309
4723
 
@@ -4313,7 +4727,15 @@
4313
4727
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4314
4728
 
4315
4729
 
4730
+
4731
+
4732
+
4316
4733
  <xsl:apply-templates/>
4734
+ <!-- <xsl:if test="$namespace = 'gb'">
4735
+ <xsl:if test="ancestor::*[local-name()='formula']">
4736
+ <xsl:text>—</xsl:text>
4737
+ </xsl:if>
4738
+ </xsl:if> -->
4317
4739
  </fo:block>
4318
4740
  </fo:table-cell>
4319
4741
  <fo:table-cell>
@@ -4347,37 +4769,37 @@
4347
4769
  </fo:table-row>
4348
4770
  </xsl:if>
4349
4771
 
4350
- </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">
4772
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4351
4773
  <xsl:apply-templates/>
4352
- </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">
4774
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
4353
4775
  <xsl:apply-templates/>
4354
- </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">
4355
- <fo:inline><xsl:apply-templates/></fo:inline>
4356
- </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']">
4776
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4777
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4778
+ </xsl:template><xsl:template match="*[local-name()='em']">
4357
4779
  <fo:inline font-style="italic">
4358
4780
  <xsl:apply-templates/>
4359
4781
  </fo:inline>
4360
- </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']">
4782
+ </xsl:template><xsl:template match="*[local-name()='strong']">
4361
4783
  <fo:inline font-weight="bold">
4362
4784
  <xsl:apply-templates/>
4363
4785
  </fo:inline>
4364
- </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']">
4786
+ </xsl:template><xsl:template match="*[local-name()='sup']">
4365
4787
  <fo:inline font-size="80%" vertical-align="super">
4366
4788
  <xsl:apply-templates/>
4367
4789
  </fo:inline>
4368
- </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']">
4790
+ </xsl:template><xsl:template match="*[local-name()='sub']">
4369
4791
  <fo:inline font-size="80%" vertical-align="sub">
4370
4792
  <xsl:apply-templates/>
4371
4793
  </fo:inline>
4372
- </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']">
4373
- <fo:inline font-family="Courier" font-size="10pt">
4794
+ </xsl:template><xsl:template match="*[local-name()='tt']">
4795
+ <fo:inline font-family="Courier" font-size="10pt">
4374
4796
  <xsl:apply-templates/>
4375
4797
  </fo:inline>
4376
- </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']">
4798
+ </xsl:template><xsl:template match="*[local-name()='del']">
4377
4799
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4378
4800
  <xsl:apply-templates/>
4379
4801
  </fo:inline>
4380
- </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']]">
4802
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4381
4803
  <xsl:variable name="text" select="normalize-space(.)"/>
4382
4804
  <fo:inline font-size="75%">
4383
4805
  <xsl:if test="string-length($text) &gt; 0">
@@ -4386,10 +4808,11 @@
4386
4808
  </xsl:call-template>
4387
4809
  </xsl:if>
4388
4810
  </fo:inline>
4389
- </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">
4811
+ </xsl:template><xsl:template name="recursiveSmallCaps">
4390
4812
  <xsl:param name="text"/>
4391
4813
  <xsl:variable name="char" select="substring($text,1,1)"/>
4392
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4814
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4815
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
4393
4816
  <xsl:choose>
4394
4817
  <xsl:when test="$char=$upperCase">
4395
4818
  <fo:inline font-size="{100 div 0.75}%">
@@ -4405,7 +4828,7 @@
4405
4828
  <xsl:with-param name="text" select="substring($text,2)"/>
4406
4829
  </xsl:call-template>
4407
4830
  </xsl:if>
4408
- </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">
4831
+ </xsl:template><xsl:template name="tokenize">
4409
4832
  <xsl:param name="text"/>
4410
4833
  <xsl:param name="separator" select="' '"/>
4411
4834
  <xsl:choose>
@@ -4453,7 +4876,7 @@
4453
4876
  </xsl:call-template>
4454
4877
  </xsl:otherwise>
4455
4878
  </xsl:choose>
4456
- </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">
4879
+ </xsl:template><xsl:template name="max_length">
4457
4880
  <xsl:param name="words"/>
4458
4881
  <xsl:for-each select="$words//word">
4459
4882
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -4461,12 +4884,17 @@
4461
4884
  <xsl:value-of select="."/>
4462
4885
  </xsl:if>
4463
4886
  </xsl:for-each>
4464
- </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">
4887
+ </xsl:template><xsl:template name="add-zero-spaces-java">
4888
+ <xsl:param name="text" select="."/>
4889
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4890
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4891
+ </xsl:template><xsl:template name="add-zero-spaces">
4465
4892
  <xsl:param name="text" select="."/>
4466
4893
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
4467
4894
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
4468
4895
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
4469
4896
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4897
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
4470
4898
  <xsl:variable name="zero-space">​</xsl:variable>
4471
4899
  <xsl:choose>
4472
4900
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -4501,11 +4929,19 @@
4501
4929
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
4502
4930
  </xsl:call-template>
4503
4931
  </xsl:when>
4932
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
4933
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
4934
+ <xsl:value-of select="$zero-space-after-underscore"/>
4935
+ <xsl:value-of select="$zero-space"/>
4936
+ <xsl:call-template name="add-zero-spaces">
4937
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
4938
+ </xsl:call-template>
4939
+ </xsl:when>
4504
4940
  <xsl:otherwise>
4505
4941
  <xsl:value-of select="$text"/>
4506
4942
  </xsl:otherwise>
4507
4943
  </xsl:choose>
4508
- </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">
4944
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
4509
4945
  <xsl:param name="text" select="."/>
4510
4946
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4511
4947
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -4531,7 +4967,7 @@
4531
4967
  <xsl:value-of select="$text"/>
4532
4968
  </xsl:otherwise>
4533
4969
  </xsl:choose>
4534
- </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">
4970
+ </xsl:template><xsl:template name="getSimpleTable">
4535
4971
  <xsl:variable name="simple-table">
4536
4972
 
4537
4973
  <!-- Step 1. colspan processing -->
@@ -4558,9 +4994,9 @@
4558
4994
  </xsl:choose> -->
4559
4995
  </xsl:variable>
4560
4996
  <xsl:copy-of select="$simple-table"/>
4561
- </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">
4997
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4562
4998
  <xsl:apply-templates mode="simple-table-colspan"/>
4563
- </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">
4999
+ </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">
4564
5000
  <xsl:choose>
4565
5001
  <xsl:when test="@colspan">
4566
5002
  <xsl:variable name="td">
@@ -4582,16 +5018,16 @@
4582
5018
  </xsl:element>
4583
5019
  </xsl:otherwise>
4584
5020
  </xsl:choose>
4585
- </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">
5021
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
4586
5022
  <xsl:element name="tr">
4587
5023
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4588
5024
  <xsl:apply-templates mode="simple-table-colspan"/>
4589
5025
  </xsl:element>
4590
- </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">
5026
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
4591
5027
  <xsl:copy>
4592
5028
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
4593
5029
  </xsl:copy>
4594
- </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">
5030
+ </xsl:template><xsl:template name="repeatNode">
4595
5031
  <xsl:param name="count"/>
4596
5032
  <xsl:param name="node"/>
4597
5033
 
@@ -4602,18 +5038,18 @@
4602
5038
  </xsl:call-template>
4603
5039
  <xsl:copy-of select="$node"/>
4604
5040
  </xsl:if>
4605
- </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">
5041
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
4606
5042
  <xsl:copy>
4607
5043
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
4608
5044
  </xsl:copy>
4609
- </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">
5045
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
4610
5046
  <xsl:copy>
4611
5047
  <xsl:copy-of select="tr[1]"/>
4612
5048
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
4613
5049
  <xsl:with-param name="previousRow" select="tr[1]"/>
4614
5050
  </xsl:apply-templates>
4615
5051
  </xsl:copy>
4616
- </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">
5052
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
4617
5053
  <xsl:param name="previousRow"/>
4618
5054
  <xsl:variable name="currentRow" select="."/>
4619
5055
 
@@ -4647,28 +5083,356 @@
4647
5083
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4648
5084
  <xsl:with-param name="previousRow" select="$newRow"/>
4649
5085
  </xsl:apply-templates>
4650
- </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">
5086
+ </xsl:template><xsl:template name="getLang">
4651
5087
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4652
5088
  <xsl:choose>
4653
5089
  <xsl:when test="$language = 'English'">en</xsl:when>
4654
5090
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4655
5091
  </xsl:choose>
4656
- </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">
5092
+ </xsl:template><xsl:template name="capitalizeWords">
4657
5093
  <xsl:param name="str"/>
4658
5094
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
4659
5095
  <xsl:choose>
4660
5096
  <xsl:when test="contains($str2, ' ')">
4661
5097
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
4662
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4663
- <xsl:value-of select="substring($substr, 2)"/>
5098
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
5099
+ <xsl:value-of select="substring($substr, 2)"/> -->
5100
+ <xsl:call-template name="capitalize">
5101
+ <xsl:with-param name="str" select="$substr"/>
5102
+ </xsl:call-template>
4664
5103
  <xsl:text> </xsl:text>
4665
5104
  <xsl:call-template name="capitalizeWords">
4666
5105
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
4667
5106
  </xsl:call-template>
4668
5107
  </xsl:when>
4669
5108
  <xsl:otherwise>
4670
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4671
- <xsl:value-of select="substring($str2, 2)"/>
5109
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
5110
+ <xsl:value-of select="substring($str2, 2)"/> -->
5111
+ <xsl:call-template name="capitalize">
5112
+ <xsl:with-param name="str" select="$str2"/>
5113
+ </xsl:call-template>
5114
+ </xsl:otherwise>
5115
+ </xsl:choose>
5116
+ </xsl:template><xsl:template name="capitalize">
5117
+ <xsl:param name="str"/>
5118
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
5119
+ <xsl:value-of select="substring($str, 2)"/>
5120
+ </xsl:template><xsl:template match="mathml:math">
5121
+ <fo:inline font-family="STIX2Math">
5122
+ <fo:instream-foreign-object fox:alt-text="Math">
5123
+ <xsl:copy-of select="."/>
5124
+ </fo:instream-foreign-object>
5125
+ </fo:inline>
5126
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
5127
+ <xsl:for-each select="*[local-name()='locality']">
5128
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
5129
+ <xsl:apply-templates select="."/>
5130
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
5131
+ </xsl:for-each>
5132
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
5133
+ <xsl:variable name="target">
5134
+ <xsl:choose>
5135
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5136
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5137
+ </xsl:when>
5138
+ <xsl:otherwise>
5139
+ <xsl:value-of select="normalize-space(@target)"/>
5140
+ </xsl:otherwise>
5141
+ </xsl:choose>
5142
+ </xsl:variable>
5143
+ <fo:inline xsl:use-attribute-sets="link-style">
5144
+ <xsl:choose>
5145
+ <xsl:when test="$target = ''">
5146
+ <xsl:apply-templates/>
5147
+ </xsl:when>
5148
+ <xsl:otherwise>
5149
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
5150
+ <xsl:choose>
5151
+ <xsl:when test="normalize-space(.) = ''">
5152
+ <xsl:value-of select="$target"/>
5153
+ </xsl:when>
5154
+ <xsl:otherwise>
5155
+ <xsl:apply-templates/>
5156
+ </xsl:otherwise>
5157
+ </xsl:choose>
5158
+ </fo:basic-link>
5159
+ </xsl:otherwise>
5160
+ </xsl:choose>
5161
+ </fo:inline>
5162
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5163
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
5164
+ <!-- <xsl:choose>
5165
+ <xsl:when test="@lang = 'en'"></xsl:when>
5166
+ <xsl:otherwise> -->
5167
+ <xsl:attribute name="white-space">pre</xsl:attribute>
5168
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
5169
+ <!-- </xsl:otherwise>
5170
+ </xsl:choose> -->
5171
+ <xsl:apply-templates/>
5172
+ </fo:block>
5173
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
5174
+ <fo:inline id="{@id}"/>
5175
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
5176
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
5177
+ <xsl:variable name="title-appendix">
5178
+ <xsl:call-template name="getTitle">
5179
+ <xsl:with-param name="name" select="'title-appendix'"/>
5180
+ </xsl:call-template>
5181
+ </xsl:variable>
5182
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
5183
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
5184
+ </fo:block>
5185
+ <xsl:apply-templates/>
5186
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
5187
+ <fo:inline><xsl:apply-templates/></fo:inline>
5188
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
5189
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
5190
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
5191
+ <xsl:variable name="title-example">
5192
+ <xsl:call-template name="getTitle">
5193
+ <xsl:with-param name="name" select="'title-example'"/>
5194
+ </xsl:call-template>
5195
+ </xsl:variable>
5196
+ <xsl:value-of select="$title-example"/>
5197
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
5198
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
5199
+ </xsl:if>
5200
+ <xsl:if test="*[local-name()='name']">
5201
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
5202
+ </xsl:if>
5203
+ </fo:block>
5204
+ <xsl:apply-templates/>
5205
+ </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">
5206
+ <fo:inline><xsl:apply-templates/></fo:inline>
5207
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
5208
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5209
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
5210
+ <xsl:variable name="annotation-id" select="@id"/>
5211
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5212
+ <fo:block id="{$annotation-id}" white-space="nowrap">
5213
+ <fo:inline>
5214
+ <xsl:apply-templates>
5215
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
5216
+ </xsl:apply-templates>
5217
+ </fo:inline>
5218
+ </fo:block>
5219
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
5220
+ <xsl:param name="callout"/>
5221
+ <fo:inline id="{@id}">
5222
+ <!-- for first p in annotation, put <x> -->
5223
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
5224
+ <xsl:apply-templates/>
5225
+ </fo:inline>
5226
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5227
+ <xsl:variable name="title-modified">
5228
+ <xsl:call-template name="getTitle">
5229
+ <xsl:with-param name="name" select="'title-modified'"/>
5230
+ </xsl:call-template>
5231
+ </xsl:variable>
5232
+ <xsl:choose>
5233
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
5234
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
5235
+ </xsl:choose>
5236
+ <xsl:apply-templates/>
5237
+ </xsl:template><xsl:template name="convertDate">
5238
+ <xsl:param name="date"/>
5239
+ <xsl:param name="format" select="'short'"/>
5240
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
5241
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
5242
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
5243
+ <xsl:variable name="monthStr">
5244
+ <xsl:choose>
5245
+ <xsl:when test="$month = '01'">January</xsl:when>
5246
+ <xsl:when test="$month = '02'">February</xsl:when>
5247
+ <xsl:when test="$month = '03'">March</xsl:when>
5248
+ <xsl:when test="$month = '04'">April</xsl:when>
5249
+ <xsl:when test="$month = '05'">May</xsl:when>
5250
+ <xsl:when test="$month = '06'">June</xsl:when>
5251
+ <xsl:when test="$month = '07'">July</xsl:when>
5252
+ <xsl:when test="$month = '08'">August</xsl:when>
5253
+ <xsl:when test="$month = '09'">September</xsl:when>
5254
+ <xsl:when test="$month = '10'">October</xsl:when>
5255
+ <xsl:when test="$month = '11'">November</xsl:when>
5256
+ <xsl:when test="$month = '12'">December</xsl:when>
5257
+ </xsl:choose>
5258
+ </xsl:variable>
5259
+ <xsl:variable name="result">
5260
+ <xsl:choose>
5261
+ <xsl:when test="$format = 'short' or $day = ''">
5262
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5263
+ </xsl:when>
5264
+ <xsl:otherwise>
5265
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
5266
+ </xsl:otherwise>
5267
+ </xsl:choose>
5268
+ </xsl:variable>
5269
+ <xsl:value-of select="$result"/>
5270
+ </xsl:template><xsl:template name="insertKeywords">
5271
+ <xsl:param name="sorting" select="'true'"/>
5272
+ <xsl:param name="charAtEnd" select="'.'"/>
5273
+ <xsl:param name="charDelim" select="', '"/>
5274
+ <xsl:choose>
5275
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5276
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5277
+ <xsl:sort data-type="text" order="ascending"/>
5278
+ <xsl:call-template name="insertKeyword">
5279
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5280
+ <xsl:with-param name="charDelim" select="$charDelim"/>
5281
+ </xsl:call-template>
5282
+ </xsl:for-each>
5283
+ </xsl:when>
5284
+ <xsl:otherwise>
5285
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5286
+ <xsl:call-template name="insertKeyword">
5287
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5288
+ <xsl:with-param name="charDelim" select="$charDelim"/>
5289
+ </xsl:call-template>
5290
+ </xsl:for-each>
5291
+ </xsl:otherwise>
5292
+ </xsl:choose>
5293
+ </xsl:template><xsl:template name="insertKeyword">
5294
+ <xsl:param name="charAtEnd"/>
5295
+ <xsl:param name="charDelim"/>
5296
+ <xsl:apply-templates/>
5297
+ <xsl:choose>
5298
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
5299
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5300
+ </xsl:choose>
5301
+ </xsl:template><xsl:template name="addPDFUAmeta">
5302
+ <fo:declarations>
5303
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5304
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5305
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5306
+ </pdf:dictionary>
5307
+ </pdf:catalog>
5308
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5309
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5310
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5311
+ <!-- Dublin Core properties go here -->
5312
+ <dc:title>
5313
+ <xsl:variable name="title">
5314
+
5315
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5316
+
5317
+
5318
+
5319
+
5320
+ </xsl:variable>
5321
+ <xsl:choose>
5322
+ <xsl:when test="normalize-space($title) != ''">
5323
+ <xsl:value-of select="$title"/>
5324
+ </xsl:when>
5325
+ <xsl:otherwise>
5326
+ <xsl:text> </xsl:text>
5327
+ </xsl:otherwise>
5328
+ </xsl:choose>
5329
+ </dc:title>
5330
+ <dc:creator>
5331
+
5332
+
5333
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5334
+ <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
5335
+ <xsl:if test="position() != last()">; </xsl:if>
5336
+ </xsl:for-each>
5337
+
5338
+ </dc:creator>
5339
+ <dc:description>
5340
+ <xsl:variable name="abstract">
5341
+
5342
+
5343
+
5344
+ <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5345
+
5346
+
5347
+ </xsl:variable>
5348
+ <xsl:value-of select="normalize-space($abstract)"/>
5349
+ </dc:description>
5350
+ <pdf:Keywords>
5351
+ <xsl:call-template name="insertKeywords"/>
5352
+ </pdf:Keywords>
5353
+ </rdf:Description>
5354
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5355
+ <!-- XMP properties go here -->
5356
+ <xmp:CreatorTool/>
5357
+ </rdf:Description>
5358
+ </rdf:RDF>
5359
+ </x:xmpmeta>
5360
+ </fo:declarations>
5361
+ </xsl:template><xsl:template name="getId">
5362
+ <xsl:choose>
5363
+ <xsl:when test="../@id">
5364
+ <xsl:value-of select="../@id"/>
5365
+ </xsl:when>
5366
+ <xsl:otherwise>
5367
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
5368
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4672
5369
  </xsl:otherwise>
4673
5370
  </xsl:choose>
5371
+ </xsl:template><xsl:template name="getLevel">
5372
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
5373
+ <xsl:variable name="level">
5374
+ <xsl:choose>
5375
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
5376
+ <xsl:value-of select="$level_total - 2"/>
5377
+ </xsl:when>
5378
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
5379
+ <xsl:value-of select="$level_total - 2"/>
5380
+ </xsl:when>
5381
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
5382
+ <xsl:value-of select="$level_total - 2"/>
5383
+ </xsl:when>
5384
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
5385
+ <xsl:otherwise>
5386
+ <xsl:value-of select="$level_total - 1"/>
5387
+ </xsl:otherwise>
5388
+ </xsl:choose>
5389
+ </xsl:variable>
5390
+ <xsl:value-of select="$level"/>
5391
+ </xsl:template><xsl:template name="getSubSection">
5392
+ <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']"/>
5393
+ </xsl:template><xsl:template name="split">
5394
+ <xsl:param name="pText" select="."/>
5395
+ <xsl:param name="sep" select="','"/>
5396
+ <xsl:if test="string-length($pText) &gt;0">
5397
+ <item>
5398
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
5399
+ </item>
5400
+ <xsl:call-template name="split">
5401
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
5402
+ <xsl:with-param name="sep" select="$sep"/>
5403
+ </xsl:call-template>
5404
+ </xsl:if>
5405
+ </xsl:template><xsl:template name="getDocumentId">
5406
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
5407
+ </xsl:template><xsl:template name="namespaceCheck">
5408
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
5409
+ <xsl:variable name="XSLNS">
5410
+
5411
+
5412
+
5413
+
5414
+
5415
+ <xsl:value-of select="document('')//*/namespace::nist"/>
5416
+
5417
+
5418
+
5419
+
5420
+
5421
+
5422
+
5423
+
5424
+ </xsl:variable>
5425
+ <xsl:if test="$documentNS != $XSLNS">
5426
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
5427
+ </xsl:if>
5428
+ </xsl:template><xsl:template name="getLanguage">
5429
+ <xsl:param name="lang"/>
5430
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
5431
+ <xsl:choose>
5432
+ <xsl:when test="$language = 'en'">English</xsl:when>
5433
+ <xsl:when test="$language = 'fr'">French</xsl:when>
5434
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
5435
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
5436
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5437
+ </xsl:choose>
4674
5438
  </xsl:template></xsl:stylesheet>