metanorma-nist 1.0.9 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/nist/biblio.rng +1 -1
  7. data/lib/asciidoctor/nist/cleanup.rb +5 -4
  8. data/lib/asciidoctor/nist/converter.rb +13 -18
  9. data/lib/asciidoctor/nist/isodoc.rng +427 -0
  10. data/lib/asciidoctor/nist/reqt.rng +23 -0
  11. data/lib/isodoc/nist/base_convert.rb +26 -4
  12. data/lib/isodoc/nist/html/_coverpage.css +243 -0
  13. data/lib/isodoc/nist/html/_coverpage.scss +1 -1
  14. data/lib/isodoc/nist/html/html_nist_titlepage.html +1 -1
  15. data/lib/isodoc/nist/html/htmlstyle.css +955 -0
  16. data/lib/isodoc/nist/html/nist.css +1055 -0
  17. data/lib/isodoc/nist/html/nist.scss +0 -1
  18. data/lib/isodoc/nist/html/nist_cswp.css +996 -0
  19. data/lib/isodoc/nist/html/nist_cswp.scss +0 -1
  20. data/lib/isodoc/nist/html/wordstyle.css +1440 -0
  21. data/lib/isodoc/nist/html/wordstyle.scss +0 -1
  22. data/lib/isodoc/nist/html/wordstyle_cswp.css +1119 -0
  23. data/lib/isodoc/nist/html/wordstyle_cswp.scss +0 -1
  24. data/lib/isodoc/nist/html_convert.rb +2 -9
  25. data/lib/isodoc/nist/nist.cswp.xsl +988 -361
  26. data/lib/isodoc/nist/nist.sp.xsl +1129 -495
  27. data/lib/isodoc/nist/pdf_convert.rb +4 -15
  28. data/lib/isodoc/nist/presentation_xml_convert.rb +10 -0
  29. data/lib/isodoc/nist/refs.rb +7 -3
  30. data/lib/isodoc/nist/section.rb +2 -1
  31. data/lib/isodoc/nist/word_convert.rb +0 -5
  32. data/lib/isodoc/nist/word_convert_toc.rb +2 -2
  33. data/lib/isodoc/nist/{xrefs.rb → xref.rb} +2 -2
  34. data/lib/metanorma-nist.rb +2 -0
  35. data/lib/metanorma/nist/processor.rb +6 -8
  36. data/lib/metanorma/nist/version.rb +1 -1
  37. data/metanorma-nist.gemspec +2 -1
  38. metadata +30 -10
@@ -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,16 +3564,246 @@
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:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
3567
+ <xsl:template name="getSubSectionIntroduction">
3568
+ <xsl:number format=".1" count="*[local-name() = 'clause'] | *[local-name() = 'terms'] | *[local-name() = 'definitions']"/>
3569
+ </xsl:template>
3570
+
3571
+ <xsl:template name="getFigureNumber">
3572
+ <xsl:choose>
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>
3605
3602
 
3606
3603
 
3607
- </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
3608
- <xsl:value-of select="."/>
3609
- </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']">
3610
- <xsl:value-of select="$linebreak"/>
3611
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3612
- <xsl:call-template name="add-zero-spaces"/>
3613
- </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']">
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']">
3614
3807
 
3615
3808
  <xsl:variable name="simple-table">
3616
3809
  <!-- <xsl:copy> -->
@@ -3645,33 +3838,17 @@
3645
3838
 
3646
3839
 
3647
3840
 
3648
- <xsl:text>Table </xsl:text>
3649
- <xsl:choose>
3650
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3651
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3652
- </xsl:when>
3653
- <xsl:when test="ancestor::*[local-name()='annex']">
3654
-
3655
-
3656
-
3657
-
3658
-
3659
- <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
3660
- <xsl:number format="A-" count="*[local-name()='annex']"/>
3661
- <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
3662
-
3663
-
3664
-
3665
-
3666
- </xsl:when>
3667
- <xsl:otherwise>
3668
-
3669
-
3670
- <xsl:number format="A." count="*[local-name()='annex']"/>
3671
- <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']"/>
3672
-
3673
- </xsl:otherwise>
3674
- </xsl:choose>
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
+
3675
3852
  <xsl:if test="*[local-name()='name']">
3676
3853
 
3677
3854
 
@@ -3741,6 +3918,7 @@
3741
3918
 
3742
3919
 
3743
3920
 
3921
+
3744
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">
3745
3923
 
3746
3924
 
@@ -3762,9 +3940,10 @@
3762
3940
 
3763
3941
 
3764
3942
 
3943
+
3765
3944
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3766
3945
  <xsl:choose>
3767
- <xsl:when test=". = 1">
3946
+ <xsl:when test=". = 1 or . = 0">
3768
3947
  <fo:table-column column-width="proportional-column-width(2)"/>
3769
3948
  </xsl:when>
3770
3949
  <xsl:otherwise>
@@ -3772,21 +3951,57 @@
3772
3951
  </xsl:otherwise>
3773
3952
  </xsl:choose>
3774
3953
  </xsl:for-each>
3775
- <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
+
3776
3964
  </fo:table>
3777
3965
 
3778
3966
 
3779
3967
 
3780
3968
  </fo:block-container>
3781
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='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">
3782
3997
  <xsl:apply-templates/>
3783
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
3998
+ </xsl:template><xsl:template name="calculate-columns-numbers">
3784
3999
  <xsl:param name="table-row"/>
3785
4000
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
3786
4001
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
3787
4002
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3788
4003
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3789
- </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">
3790
4005
  <xsl:param name="table"/>
3791
4006
  <xsl:param name="cols-count"/>
3792
4007
  <xsl:param name="curr-col" select="1"/>
@@ -3795,7 +4010,7 @@
3795
4010
  <xsl:if test="$curr-col &lt;= $cols-count">
3796
4011
  <xsl:variable name="widths">
3797
4012
  <xsl:choose>
3798
- <xsl:when test="not($table)">
4013
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
3799
4014
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
3800
4015
  <xsl:variable name="words">
3801
4016
  <xsl:call-template name="tokenize">
@@ -3834,9 +4049,16 @@
3834
4049
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3835
4050
  </xsl:variable>
3836
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>
3837
4057
  <xsl:call-template name="tokenize">
3838
4058
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3839
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
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, '​', ' '))"/>
3840
4062
  </xsl:call-template>
3841
4063
  </xsl:variable>
3842
4064
  <xsl:variable name="max_length">
@@ -3877,17 +4099,28 @@
3877
4099
  <xsl:with-param name="table" select="$table"/>
3878
4100
  </xsl:call-template>
3879
4101
  </xsl:if>
3880
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
4102
+ </xsl:template><xsl:template match="text()" mode="td_text">
3881
4103
  <xsl:variable name="zero-space">​</xsl:variable>
3882
4104
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3883
- </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">
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"/>
3884
4111
  <!-- font-weight="bold" -->
3885
- <fo:table-header>
4112
+ <fo:table-header>
4113
+
3886
4114
  <xsl:apply-templates/>
3887
4115
  </fo:table-header>
3888
- </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">
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">
3889
4121
  <xsl:apply-templates/>
3890
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
4122
+ </xsl:template><xsl:template name="insertTableFooter">
4123
+ <xsl:param name="cols-count"/>
3891
4124
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3892
4125
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3893
4126
 
@@ -3898,22 +4131,7 @@
3898
4131
  <!-- if there are note(s) or fn(s) then create footer row -->
3899
4132
  <xsl:if test="$isNoteOrFnExist = 'true'">
3900
4133
 
3901
- <xsl:variable name="cols-count">
3902
- <xsl:choose>
3903
- <xsl:when test="../*[local-name()='thead']">
3904
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3905
- <xsl:call-template name="calculate-columns-numbers">
3906
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3907
- </xsl:call-template>
3908
- </xsl:when>
3909
- <xsl:otherwise>
3910
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3911
- <xsl:call-template name="calculate-columns-numbers">
3912
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3913
- </xsl:call-template>
3914
- </xsl:otherwise>
3915
- </xsl:choose>
3916
- </xsl:variable>
4134
+
3917
4135
 
3918
4136
  <fo:table-row>
3919
4137
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -3941,11 +4159,30 @@
3941
4159
  </fo:table-footer>
3942
4160
 
3943
4161
  </xsl:if>
3944
- </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']">
4162
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
4163
+
4164
+ <xsl:variable name="cols-count">
4165
+ <xsl:choose>
4166
+ <xsl:when test="../*[local-name()='thead']">
4167
+ <xsl:call-template name="calculate-columns-numbers">
4168
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
4169
+ </xsl:call-template>
4170
+ </xsl:when>
4171
+ <xsl:otherwise>
4172
+ <xsl:call-template name="calculate-columns-numbers">
4173
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
4174
+ </xsl:call-template>
4175
+ </xsl:otherwise>
4176
+ </xsl:choose>
4177
+ </xsl:variable>
3945
4178
 
3946
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
4179
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
4180
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4181
+ </xsl:apply-templates>
3947
4182
 
3948
- <xsl:call-template name="insertTableFooter"/>
4183
+ <xsl:call-template name="insertTableFooter">
4184
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4185
+ </xsl:call-template>
3949
4186
 
3950
4187
  <fo:table-body>
3951
4188
  <xsl:apply-templates/>
@@ -3953,7 +4190,7 @@
3953
4190
 
3954
4191
  </fo:table-body>
3955
4192
 
3956
- </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']">
4193
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3957
4194
  <xsl:variable name="parent-name" select="local-name(..)"/>
3958
4195
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3959
4196
  <fo:table-row min-height="4mm">
@@ -3976,7 +4213,7 @@
3976
4213
 
3977
4214
  <xsl:apply-templates/>
3978
4215
  </fo:table-row>
3979
- </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']">
3980
4217
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3981
4218
 
3982
4219
 
@@ -4003,7 +4240,7 @@
4003
4240
  <xsl:apply-templates/>
4004
4241
  </fo:block>
4005
4242
  </fo:table-cell>
4006
- </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']">
4007
4244
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
4008
4245
 
4009
4246
 
@@ -4029,6 +4266,7 @@
4029
4266
  </xsl:attribute>
4030
4267
  </xsl:if>
4031
4268
  <fo:block>
4269
+
4032
4270
  <xsl:apply-templates/>
4033
4271
  </fo:block>
4034
4272
  <!-- <xsl:choose>
@@ -4044,16 +4282,24 @@
4044
4282
 
4045
4283
 
4046
4284
  </fo:table-cell>
4047
- </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">
4048
4286
 
4049
4287
 
4050
4288
  <fo:block font-size="10pt" margin-bottom="12pt">
4051
4289
 
4052
4290
 
4053
4291
 
4292
+
4054
4293
  <fo:inline padding-right="2mm">
4055
4294
 
4056
- <xsl:text>NOTE </xsl:text>
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"/>
4057
4303
 
4058
4304
 
4059
4305
 
@@ -4063,9 +4309,9 @@
4063
4309
  <xsl:apply-templates mode="process"/>
4064
4310
  </fo:block>
4065
4311
 
4066
- </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">
4067
4313
  <xsl:apply-templates/>
4068
- </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">
4069
4315
  <xsl:variable name="references">
4070
4316
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4071
4317
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -4082,6 +4328,7 @@
4082
4328
 
4083
4329
 
4084
4330
 
4331
+
4085
4332
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
4086
4333
 
4087
4334
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -4105,7 +4352,7 @@
4105
4352
  </fo:block>
4106
4353
  </xsl:if>
4107
4354
  </xsl:for-each>
4108
- </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">
4109
4356
  <!-- <xsl:variable name="references">
4110
4357
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
4111
4358
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -4121,7 +4368,7 @@
4121
4368
  <xsl:apply-templates/>
4122
4369
  </fo:block>
4123
4370
  </xsl:for-each>
4124
- </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">
4125
4372
  <xsl:variable name="key_iso">
4126
4373
  <!-- and (not(@class) or @class !='pseudocode') -->
4127
4374
  </xsl:variable>
@@ -4132,6 +4379,36 @@
4132
4379
  </fn>
4133
4380
  </xsl:for-each>
4134
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
+
4135
4412
  <xsl:if test="xalan:nodeset($references)//fn">
4136
4413
  <fo:block>
4137
4414
  <fo:table width="95%" table-layout="fixed">
@@ -4139,8 +4416,19 @@
4139
4416
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4140
4417
 
4141
4418
  </xsl:if>
4142
- <fo:table-column column-width="15%"/>
4143
- <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>
4144
4432
  <fo:table-body>
4145
4433
  <xsl:for-each select="xalan:nodeset($references)//fn">
4146
4434
  <xsl:variable name="reference" select="@reference"/>
@@ -4172,7 +4460,7 @@
4172
4460
  </fo:block>
4173
4461
  </xsl:if>
4174
4462
 
4175
- </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']">
4176
4464
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
4177
4465
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
4178
4466
 
@@ -4189,11 +4477,11 @@
4189
4477
  <xsl:value-of select="@reference"/>
4190
4478
  </fo:basic-link>
4191
4479
  </fo:inline>
4192
- </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']">
4193
4481
  <fo:inline>
4194
4482
  <xsl:apply-templates/>
4195
4483
  </fo:inline>
4196
- </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']">
4197
4485
  <xsl:variable name="parent" select="local-name(..)"/>
4198
4486
 
4199
4487
  <xsl:variable name="key_iso">
@@ -4205,8 +4493,13 @@
4205
4493
 
4206
4494
 
4207
4495
  <fo:block margin-bottom="12pt" text-align="left">
4208
-
4209
- <xsl:text>where </xsl:text>
4496
+
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>
4210
4503
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4211
4504
  <xsl:text/>
4212
4505
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -4219,15 +4512,25 @@
4219
4512
 
4220
4513
 
4221
4514
 
4222
- <xsl:text>where</xsl:text>
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"/>
4223
4521
  </fo:block>
4224
4522
  </xsl:when>
4225
4523
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
4226
- <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">
4227
4525
 
4228
4526
 
4229
4527
 
4230
- <xsl:text>Key</xsl:text>
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"/>
4231
4534
  </fo:block>
4232
4535
  </xsl:when>
4233
4536
  </xsl:choose>
@@ -4242,6 +4545,7 @@
4242
4545
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
4243
4546
  </xsl:if>
4244
4547
 
4548
+
4245
4549
  <fo:block>
4246
4550
 
4247
4551
  <xsl:if test="not(.//*[local-name()='dt']//*[local-name()='stem'])">
@@ -4249,23 +4553,7 @@
4249
4553
  </xsl:if>
4250
4554
 
4251
4555
 
4252
- <!-- create virtual html table for dl/[dt and dd] -->
4253
- <xsl:variable name="html-table">
4254
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4255
- <xsl:element name="{$ns}:table">
4256
- <tbody>
4257
- <xsl:apply-templates mode="dl"/>
4258
- </tbody>
4259
- </xsl:element>
4260
- </xsl:variable>
4261
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
4262
- <xsl:variable name="colwidths">
4263
- <xsl:call-template name="calculate-column-widths">
4264
- <xsl:with-param name="cols-count" select="2"/>
4265
- <xsl:with-param name="table" select="$html-table"/>
4266
- </xsl:call-template>
4267
- </xsl:variable>
4268
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4556
+
4269
4557
 
4270
4558
  <fo:table width="95%" table-layout="fixed">
4271
4559
 
@@ -4278,42 +4566,30 @@
4278
4566
 
4279
4567
  </xsl:when>
4280
4568
  </xsl:choose>
4281
- <xsl:choose>
4282
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4283
- <fo:table-column column-width="50%"/>
4284
- <fo:table-column column-width="50%"/>
4285
- </xsl:when>
4286
- <xsl:otherwise>
4287
- <xsl:choose>
4288
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
4289
- <fo:table-column column-width="60%"/>
4290
- <fo:table-column column-width="40%"/>
4291
- </xsl:when> -->
4292
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
4293
- <fo:table-column column-width="50%"/>
4294
- <fo:table-column column-width="50%"/>
4295
- </xsl:when>
4296
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
4297
- <fo:table-column column-width="40%"/>
4298
- <fo:table-column column-width="60%"/>
4299
- </xsl:when>
4300
- <xsl:otherwise>
4301
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4302
- <xsl:choose>
4303
- <xsl:when test=". = 1">
4304
- <fo:table-column column-width="proportional-column-width(2)"/>
4305
- </xsl:when>
4306
- <xsl:otherwise>
4307
- <fo:table-column column-width="proportional-column-width({.})"/>
4308
- </xsl:otherwise>
4309
- </xsl:choose>
4310
- </xsl:for-each>
4311
- </xsl:otherwise>
4312
- </xsl:choose>
4313
- <!-- <fo:table-column column-width="15%"/>
4314
- <fo:table-column column-width="85%"/> -->
4315
- </xsl:otherwise>
4316
- </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>
4317
4593
  <fo:table-body>
4318
4594
  <xsl:apply-templates>
4319
4595
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -4323,7 +4599,61 @@
4323
4599
  </fo:block>
4324
4600
  </fo:block>
4325
4601
  </xsl:if>
4326
- </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']">
4327
4657
  <xsl:param name="key_iso"/>
4328
4658
 
4329
4659
  <!-- <tr>
@@ -4339,7 +4669,12 @@
4339
4669
  <xsl:if test="normalize-space($key_iso) = 'true'">
4340
4670
  <xsl:attribute name="margin-top">0</xsl:attribute>
4341
4671
  </xsl:if>
4342
- 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"/>
4343
4678
  </fo:block>
4344
4679
  </fo:table-cell>
4345
4680
  <fo:table-cell>
@@ -4348,7 +4683,7 @@
4348
4683
  </fo:block>
4349
4684
  </fo:table-cell>
4350
4685
  </fo:table-row>
4351
- </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">
4352
4687
  <tr>
4353
4688
  <td>
4354
4689
  <xsl:apply-templates/>
@@ -4374,11 +4709,12 @@
4374
4709
  </tr>
4375
4710
  </xsl:if>
4376
4711
 
4377
- </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']">
4378
4713
  <xsl:param name="key_iso"/>
4379
4714
 
4380
4715
  <fo:table-row>
4381
4716
  <fo:table-cell>
4717
+
4382
4718
  <fo:block margin-top="6pt">
4383
4719
 
4384
4720
 
@@ -4391,8 +4727,15 @@
4391
4727
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4392
4728
 
4393
4729
 
4394
- <xsl:apply-templates/>
4395
4730
 
4731
+
4732
+
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> -->
4396
4739
  </fo:block>
4397
4740
  </fo:table-cell>
4398
4741
  <fo:table-cell>
@@ -4426,37 +4769,37 @@
4426
4769
  </fo:table-row>
4427
4770
  </xsl:if>
4428
4771
 
4429
- </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">
4430
4773
  <xsl:apply-templates/>
4431
- </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">
4432
4775
  <xsl:apply-templates/>
4433
- </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">
4776
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4434
4777
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4435
- </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']">
4778
+ </xsl:template><xsl:template match="*[local-name()='em']">
4436
4779
  <fo:inline font-style="italic">
4437
4780
  <xsl:apply-templates/>
4438
4781
  </fo:inline>
4439
- </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']">
4440
4783
  <fo:inline font-weight="bold">
4441
4784
  <xsl:apply-templates/>
4442
4785
  </fo:inline>
4443
- </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']">
4444
4787
  <fo:inline font-size="80%" vertical-align="super">
4445
4788
  <xsl:apply-templates/>
4446
4789
  </fo:inline>
4447
- </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']">
4448
4791
  <fo:inline font-size="80%" vertical-align="sub">
4449
4792
  <xsl:apply-templates/>
4450
4793
  </fo:inline>
4451
- </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']">
4452
- <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">
4453
4796
  <xsl:apply-templates/>
4454
4797
  </fo:inline>
4455
- </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']">
4456
4799
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4457
4800
  <xsl:apply-templates/>
4458
4801
  </fo:inline>
4459
- </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']]">
4460
4803
  <xsl:variable name="text" select="normalize-space(.)"/>
4461
4804
  <fo:inline font-size="75%">
4462
4805
  <xsl:if test="string-length($text) &gt; 0">
@@ -4465,10 +4808,11 @@
4465
4808
  </xsl:call-template>
4466
4809
  </xsl:if>
4467
4810
  </fo:inline>
4468
- </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">
4469
4812
  <xsl:param name="text"/>
4470
4813
  <xsl:variable name="char" select="substring($text,1,1)"/>
4471
- <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))"/>
4472
4816
  <xsl:choose>
4473
4817
  <xsl:when test="$char=$upperCase">
4474
4818
  <fo:inline font-size="{100 div 0.75}%">
@@ -4484,7 +4828,7 @@
4484
4828
  <xsl:with-param name="text" select="substring($text,2)"/>
4485
4829
  </xsl:call-template>
4486
4830
  </xsl:if>
4487
- </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">
4488
4832
  <xsl:param name="text"/>
4489
4833
  <xsl:param name="separator" select="' '"/>
4490
4834
  <xsl:choose>
@@ -4532,7 +4876,7 @@
4532
4876
  </xsl:call-template>
4533
4877
  </xsl:otherwise>
4534
4878
  </xsl:choose>
4535
- </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">
4536
4880
  <xsl:param name="words"/>
4537
4881
  <xsl:for-each select="$words//word">
4538
4882
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -4540,7 +4884,11 @@
4540
4884
  <xsl:value-of select="."/>
4541
4885
  </xsl:if>
4542
4886
  </xsl:for-each>
4543
- </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">
4544
4892
  <xsl:param name="text" select="."/>
4545
4893
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
4546
4894
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -4593,7 +4941,7 @@
4593
4941
  <xsl:value-of select="$text"/>
4594
4942
  </xsl:otherwise>
4595
4943
  </xsl:choose>
4596
- </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">
4597
4945
  <xsl:param name="text" select="."/>
4598
4946
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4599
4947
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -4619,7 +4967,7 @@
4619
4967
  <xsl:value-of select="$text"/>
4620
4968
  </xsl:otherwise>
4621
4969
  </xsl:choose>
4622
- </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">
4623
4971
  <xsl:variable name="simple-table">
4624
4972
 
4625
4973
  <!-- Step 1. colspan processing -->
@@ -4646,9 +4994,9 @@
4646
4994
  </xsl:choose> -->
4647
4995
  </xsl:variable>
4648
4996
  <xsl:copy-of select="$simple-table"/>
4649
- </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">
4650
4998
  <xsl:apply-templates mode="simple-table-colspan"/>
4651
- </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">
4652
5000
  <xsl:choose>
4653
5001
  <xsl:when test="@colspan">
4654
5002
  <xsl:variable name="td">
@@ -4670,16 +5018,16 @@
4670
5018
  </xsl:element>
4671
5019
  </xsl:otherwise>
4672
5020
  </xsl:choose>
4673
- </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">
4674
5022
  <xsl:element name="tr">
4675
5023
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4676
5024
  <xsl:apply-templates mode="simple-table-colspan"/>
4677
5025
  </xsl:element>
4678
- </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">
4679
5027
  <xsl:copy>
4680
5028
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
4681
5029
  </xsl:copy>
4682
- </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">
4683
5031
  <xsl:param name="count"/>
4684
5032
  <xsl:param name="node"/>
4685
5033
 
@@ -4690,18 +5038,18 @@
4690
5038
  </xsl:call-template>
4691
5039
  <xsl:copy-of select="$node"/>
4692
5040
  </xsl:if>
4693
- </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">
4694
5042
  <xsl:copy>
4695
5043
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
4696
5044
  </xsl:copy>
4697
- </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">
4698
5046
  <xsl:copy>
4699
5047
  <xsl:copy-of select="tr[1]"/>
4700
5048
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
4701
5049
  <xsl:with-param name="previousRow" select="tr[1]"/>
4702
5050
  </xsl:apply-templates>
4703
5051
  </xsl:copy>
4704
- </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">
4705
5053
  <xsl:param name="previousRow"/>
4706
5054
  <xsl:variable name="currentRow" select="."/>
4707
5055
 
@@ -4735,43 +5083,53 @@
4735
5083
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4736
5084
  <xsl:with-param name="previousRow" select="$newRow"/>
4737
5085
  </xsl:apply-templates>
4738
- </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">
4739
5087
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4740
5088
  <xsl:choose>
4741
5089
  <xsl:when test="$language = 'English'">en</xsl:when>
4742
5090
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4743
5091
  </xsl:choose>
4744
- </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">
4745
5093
  <xsl:param name="str"/>
4746
5094
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
4747
5095
  <xsl:choose>
4748
5096
  <xsl:when test="contains($str2, ' ')">
4749
5097
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
4750
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4751
- <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>
4752
5103
  <xsl:text> </xsl:text>
4753
5104
  <xsl:call-template name="capitalizeWords">
4754
5105
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
4755
5106
  </xsl:call-template>
4756
5107
  </xsl:when>
4757
5108
  <xsl:otherwise>
4758
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4759
- <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>
4760
5114
  </xsl:otherwise>
4761
5115
  </xsl:choose>
4762
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
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">
4763
5121
  <fo:inline font-family="STIX2Math">
4764
5122
  <fo:instream-foreign-object fox:alt-text="Math">
4765
5123
  <xsl:copy-of select="."/>
4766
5124
  </fo:instream-foreign-object>
4767
5125
  </fo:inline>
4768
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
5126
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
4769
5127
  <xsl:for-each select="*[local-name()='locality']">
4770
5128
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
4771
5129
  <xsl:apply-templates select="."/>
4772
5130
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
4773
5131
  </xsl:for-each>
4774
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
5132
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
4775
5133
  <xsl:variable name="target">
4776
5134
  <xsl:choose>
4777
5135
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4801,4 +5159,280 @@
4801
5159
  </xsl:otherwise>
4802
5160
  </xsl:choose>
4803
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())"/>
5369
+ </xsl:otherwise>
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>
4804
5438
  </xsl:template></xsl:stylesheet>