metanorma-ogc 1.0.6 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -1
  3. data/.github/workflows/ubuntu.yml +20 -7
  4. data/.github/workflows/windows.yml +8 -1
  5. data/lib/asciidoctor/ogc/biblio.rng +36 -6
  6. data/lib/asciidoctor/ogc/boilerplate.xml +7 -22
  7. data/lib/asciidoctor/ogc/converter.rb +11 -16
  8. data/lib/asciidoctor/ogc/isodoc.rng +444 -1
  9. data/lib/asciidoctor/ogc/reqt.rng +23 -0
  10. data/lib/isodoc/ogc.rb +2 -0
  11. data/lib/isodoc/ogc/base_convert.rb +12 -60
  12. data/lib/isodoc/ogc/biblio.rb +6 -5
  13. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +0 -5
  14. data/lib/isodoc/ogc/html/scripts.html +10 -7
  15. data/lib/isodoc/ogc/html_convert.rb +3 -7
  16. data/lib/isodoc/ogc/metadata.rb +0 -8
  17. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +995 -377
  18. data/lib/isodoc/ogc/ogc.best-practice.xsl +995 -377
  19. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +995 -377
  20. data/lib/isodoc/ogc/ogc.community-practice.xsl +995 -377
  21. data/lib/isodoc/ogc/ogc.community-standard.xsl +995 -377
  22. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +995 -377
  23. data/lib/isodoc/ogc/ogc.engineering-report.xsl +995 -377
  24. data/lib/isodoc/ogc/ogc.other.xsl +995 -377
  25. data/lib/isodoc/ogc/ogc.policy.xsl +995 -377
  26. data/lib/isodoc/ogc/ogc.reference-model.xsl +995 -377
  27. data/lib/isodoc/ogc/ogc.release-notes.xsl +995 -377
  28. data/lib/isodoc/ogc/ogc.standard.xsl +995 -377
  29. data/lib/isodoc/ogc/ogc.test-suite.xsl +995 -377
  30. data/lib/isodoc/ogc/ogc.user-guide.xsl +995 -377
  31. data/lib/isodoc/ogc/ogc.white-paper.xsl +995 -377
  32. data/lib/isodoc/ogc/pdf_convert.rb +0 -13
  33. data/lib/isodoc/ogc/presentation_xml_convert.rb +10 -0
  34. data/lib/isodoc/ogc/reqt.rb +49 -125
  35. data/lib/isodoc/ogc/sections.rb +9 -8
  36. data/lib/isodoc/ogc/word_convert.rb +7 -16
  37. data/lib/isodoc/ogc/xref.rb +158 -0
  38. data/lib/metanorma/ogc/processor.rb +11 -9
  39. data/lib/metanorma/ogc/version.rb +1 -1
  40. data/metanorma-ogc.gemspec +2 -2
  41. metadata +12 -12
  42. data/lib/isodoc/ogc/html/scripts.pdf.html +0 -72
@@ -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:ogc="https://www.metanorma.org/ns/ogc" 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:ogc="https://www.metanorma.org/ns/ogc" 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
 
@@ -161,51 +161,7 @@
161
161
 
162
162
  </fo:layout-master-set>
163
163
 
164
- <fo:declarations>
165
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
166
- <pdf:dictionary type="normal" key="ViewerPreferences">
167
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
168
- </pdf:dictionary>
169
- </pdf:catalog>
170
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
171
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
172
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
173
- <!-- Dublin Core properties go here -->
174
- <dc:title>
175
- <xsl:choose>
176
- <xsl:when test="$doctitle != ''">
177
- <xsl:value-of select="$doctitle"/>
178
- </xsl:when>
179
- <xsl:otherwise>
180
- <xsl:text> </xsl:text>
181
- </xsl:otherwise>
182
- </xsl:choose>
183
- </dc:title>
184
- <dc:creator/>
185
- <dc:description>
186
- <xsl:variable name="abstract">
187
- <xsl:copy-of select="/ogc:ogc-standard/ogc:bibdata/ogc:abstract//text()"/>
188
- </xsl:variable>
189
- <xsl:value-of select="normalize-space($abstract)"/>
190
- </dc:description>
191
- <pdf:Keywords>
192
- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata//ogc:keyword">
193
- <xsl:sort data-type="text" order="ascending"/>
194
- <xsl:apply-templates/>
195
- <xsl:choose>
196
- <xsl:when test="position() != last()">, </xsl:when>
197
- <xsl:otherwise>.</xsl:otherwise>
198
- </xsl:choose>
199
- </xsl:for-each>
200
- </pdf:Keywords>
201
- </rdf:Description>
202
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
203
- <!-- XMP properties go here -->
204
- <xmp:CreatorTool/>
205
- </rdf:Description>
206
- </rdf:RDF>
207
- </x:xmpmeta>
208
- </fo:declarations>
164
+ <xsl:call-template name="addPDFUAmeta"/>
209
165
 
210
166
  <!-- Cover Page -->
211
167
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -309,8 +265,9 @@
309
265
  <fo:table-cell>
310
266
  <fo:block>
311
267
  <xsl:variable name="stage" select="/ogc:ogc-standard/ogc:bibdata/ogc:status/ogc:stage"/>
312
- <xsl:value-of select="translate(substring($stage, 1, 1), $lower, $upper)"/>
313
- <xsl:value-of select="substring($stage, 2)"/>
268
+ <xsl:call-template name="capitalize">
269
+ <xsl:with-param name="str" select="$stage"/>
270
+ </xsl:call-template>
314
271
  </fo:block>
315
272
  </fo:table-cell>
316
273
  </fo:table-row>
@@ -356,7 +313,12 @@
356
313
  <fo:block break-after="page"/>
357
314
 
358
315
  <fo:block-container font-weight="bold" line-height="115%">
359
- <fo:block font-size="14pt" margin-top="2pt" margin-bottom="15.5pt">Contents</fo:block>
316
+ <xsl:variable name="title-toc">
317
+ <xsl:call-template name="getTitle">
318
+ <xsl:with-param name="name" select="'title-toc'"/>
319
+ </xsl:call-template>
320
+ </xsl:variable>
321
+ <fo:block font-size="14pt" margin-top="2pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block>
360
322
 
361
323
  <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and @level &lt;= 2]"><!-- skip clause from preface [not(@level = 2 and starts-with(@section, '0'))] -->
362
324
 
@@ -405,7 +367,12 @@
405
367
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
406
368
  <fo:block font-size="12pt"> </fo:block>
407
369
  <fo:block font-size="12pt"> </fo:block>
408
- <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt">List of Tables</fo:block>
370
+ <xsl:variable name="title-list-tables">
371
+ <xsl:call-template name="getTitle">
372
+ <xsl:with-param name="name" select="'title-list-tables'"/>
373
+ </xsl:call-template>
374
+ </xsl:variable>
375
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt"><xsl:value-of select="$title-list-tables"/></fo:block>
409
376
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table']">
410
377
  <fo:block text-align-last="justify" margin-top="6pt">
411
378
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -427,7 +394,12 @@
427
394
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
428
395
  <fo:block font-size="12pt"> </fo:block>
429
396
  <fo:block font-size="12pt"> </fo:block>
430
- <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt">List of Figures</fo:block>
397
+ <xsl:variable name="title-list-figures">
398
+ <xsl:call-template name="getTitle">
399
+ <xsl:with-param name="name" select="'title-list-figures'"/>
400
+ </xsl:call-template>
401
+ </xsl:variable>
402
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt"><xsl:value-of select="$title-list-figures"/></fo:block>
431
403
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
432
404
  <fo:block text-align-last="justify" margin-top="6pt">
433
405
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -671,7 +643,9 @@
671
643
  <xsl:choose>
672
644
  <xsl:when test="not(ogc:title)">
673
645
  <xsl:variable name="name" select="local-name()"/>
674
- <xsl:value-of select="translate(substring($name, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($name, 2)"/>
646
+ <xsl:call-template name="capitalize">
647
+ <xsl:with-param name="str" select="$name"/>
648
+ </xsl:call-template>
675
649
  </xsl:when>
676
650
  <xsl:otherwise>
677
651
  <xsl:value-of select="ogc:title"/>
@@ -691,7 +665,12 @@
691
665
  <xsl:number format="i" value="$sectionNum"/>
692
666
  </xsl:variable>
693
667
  <item id="keywords" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
694
- <xsl:text>Keywords</xsl:text>
668
+ <xsl:variable name="title-keywords">
669
+ <xsl:call-template name="getTitle">
670
+ <xsl:with-param name="name" select="'title-keywords'"/>
671
+ </xsl:call-template>
672
+ </xsl:variable>
673
+ <xsl:value-of select="$title-keywords"/>
695
674
  </item>
696
675
  </xsl:template>
697
676
  <!-- Submitting Organizations -->
@@ -701,7 +680,12 @@
701
680
  <xsl:number format="i" value="$sectionNum"/>
702
681
  </xsl:variable>
703
682
  <item id="submitting_orgs" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
704
- <xsl:text>Submitting Organizations</xsl:text>
683
+ <xsl:variable name="title-submitting-organizations">
684
+ <xsl:call-template name="getTitle">
685
+ <xsl:with-param name="name" select="'title-submitting-organizations'"/>
686
+ </xsl:call-template>
687
+ </xsl:variable>
688
+ <xsl:value-of select="$title-submitting-organizations"/>
705
689
  </item>
706
690
  </xsl:template>
707
691
 
@@ -709,7 +693,12 @@
709
693
  <xsl:param name="sectionNum"/>
710
694
  <item level="" id="{@id}" type="figure">
711
695
  <xsl:attribute name="section">
712
- <xsl:text>Figure </xsl:text>
696
+ <xsl:variable name="title-figure">
697
+ <xsl:call-template name="getTitle">
698
+ <xsl:with-param name="name" select="'title-figure'"/>
699
+ </xsl:call-template>
700
+ </xsl:variable>
701
+ <xsl:value-of select="$title-figure"/>
713
702
  <xsl:choose>
714
703
  <xsl:when test="ancestor::ogc:annex">
715
704
  <xsl:choose>
@@ -744,7 +733,12 @@
744
733
  <xsl:variable name="annex-id" select="ancestor::ogc:annex/@id"/>
745
734
  <item level="" id="{@id}" display="false" type="table">
746
735
  <xsl:attribute name="section">
747
- <xsl:text>Table </xsl:text>
736
+ <xsl:variable name="title-table">
737
+ <xsl:call-template name="getTitle">
738
+ <xsl:with-param name="name" select="'title-table'"/>
739
+ </xsl:call-template>
740
+ </xsl:variable>
741
+ <xsl:value-of select="$title-table"/>
748
742
  <xsl:choose>
749
743
  <xsl:when test="ancestor::*[local-name()='executivesummary']">
750
744
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered='true')]"/>
@@ -767,7 +761,12 @@
767
761
  <xsl:template match="ogc:formula" mode="contents">
768
762
  <item level="" id="{@id}" display="false">
769
763
  <xsl:attribute name="section">
770
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="ogc:annex | ogc:formula"/><xsl:text>)</xsl:text>
764
+ <xsl:variable name="title-formula">
765
+ <xsl:call-template name="getTitle">
766
+ <xsl:with-param name="name" select="'title-formula'"/>
767
+ </xsl:call-template>
768
+ </xsl:variable>
769
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="ogc:annex | ogc:formula"/>
771
770
  </xsl:attribute>
772
771
  </item>
773
772
  </xsl:template>
@@ -785,7 +784,12 @@
785
784
 
786
785
  <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
787
786
  <fo:block margin-bottom="12pt">
788
- <xsl:text>Version: </xsl:text>
787
+ <xsl:variable name="title-edition">
788
+ <xsl:call-template name="getTitle">
789
+ <xsl:with-param name="name" select="'title-edition'"/>
790
+ </xsl:call-template>
791
+ </xsl:variable>
792
+ <xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text>
789
793
  <xsl:value-of select="."/><xsl:text> </xsl:text>
790
794
  </fo:block>
791
795
  </xsl:template>
@@ -899,7 +903,9 @@
899
903
  <fo:block id="{$id}" font-size="13pt" font-weight="bold" margin-bottom="12pt" color="rgb(14, 26, 133)">
900
904
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
901
905
  <xsl:variable name="name" select="local-name()"/>
902
- <xsl:value-of select="translate(substring($name, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($name, 2)"/>
906
+ <xsl:call-template name="capitalize">
907
+ <xsl:with-param name="str" select="$name"/>
908
+ </xsl:call-template>
903
909
  </fo:block>
904
910
  </xsl:if>
905
911
  <xsl:apply-templates/>
@@ -909,14 +915,23 @@
909
915
  <xsl:param name="sectionNum" select="'1'"/>
910
916
  <fo:block id="keywords" font-size="13pt" font-weight="bold" margin-top="13.5pt" margin-bottom="12pt" color="rgb(14, 26, 133)">
911
917
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="2mm"> </fo:inline>
912
- <xsl:text>Keywords</xsl:text>
918
+ <xsl:variable name="title-keywords">
919
+ <xsl:call-template name="getTitle">
920
+ <xsl:with-param name="name" select="'title-keywords'"/>
921
+ </xsl:call-template>
922
+ </xsl:variable>
923
+ <xsl:value-of select="$title-keywords"/>
913
924
  </fo:block>
914
925
  <fo:block margin-bottom="12pt">The following are keywords to be used by search engines and document catalogues.</fo:block>
915
926
  <fo:block margin-bottom="12pt">
916
- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
927
+ <xsl:call-template name="insertKeywords">
928
+ <xsl:with-param name="sorting">no</xsl:with-param>
929
+ <xsl:with-param name="charAtEnd"/>
930
+ </xsl:call-template>
931
+ <!-- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
917
932
  <xsl:value-of select="."/>
918
933
  <xsl:if test="position() != last()">, </xsl:if>
919
- </xsl:for-each>
934
+ </xsl:for-each> -->
920
935
  </fo:block>
921
936
  </xsl:template>
922
937
  <!-- Submitting Organizations -->
@@ -924,7 +939,12 @@
924
939
  <xsl:param name="sectionNum" select="'1'"/>
925
940
  <fo:block id="submitting_orgs" font-size="13pt" font-weight="bold" color="rgb(14, 26, 133)" margin-top="13.5pt" margin-bottom="12pt">
926
941
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
927
- <xsl:text>Submitting Organizations</xsl:text>
942
+ <xsl:variable name="title-submitting-organizations">
943
+ <xsl:call-template name="getTitle">
944
+ <xsl:with-param name="name" select="'title-submitting-organizations'"/>
945
+ </xsl:call-template>
946
+ </xsl:variable>
947
+ <xsl:value-of select="$title-submitting-organizations"/>
928
948
  </fo:block>
929
949
  <fo:block margin-bottom="12pt">The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</fo:block>
930
950
  <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
@@ -1117,10 +1137,13 @@
1117
1137
  </xsl:attribute>
1118
1138
  <xsl:attribute name="space-after">
1119
1139
  <xsl:choose>
1120
- <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1140
+ <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1121
1141
  <xsl:otherwise>12pt</xsl:otherwise>
1122
1142
  </xsl:choose>
1123
1143
  </xsl:attribute>
1144
+ <xsl:if test="ancestor::ogc:dd and not(ancestor::ogc:table)">
1145
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1146
+ </xsl:if>
1124
1147
  <xsl:attribute name="line-height">115%</xsl:attribute>
1125
1148
  <xsl:apply-templates/>
1126
1149
  </xsl:element>
@@ -1142,7 +1165,7 @@
1142
1165
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1143
1166
  </fn>
1144
1167
  -->
1145
- <xsl:template match="ogc:title/ogc:fn | ogc:p/ogc:fn[not(ancestor::ogc:table)]" priority="2">
1168
+ <xsl:template match="ogc:title/ogc:fn | ogc:p/ogc:fn[not(ancestor::ogc:table)] | ogc:p/*/ogc:fn[not(ancestor::ogc:table)] | ogc:sourcecode/ogc:fn[not(ancestor::ogc:table)]" priority="2">
1146
1169
  <fo:footnote keep-with-previous.within-line="always">
1147
1170
  <xsl:variable name="number" select="@reference"/>
1148
1171
 
@@ -1188,10 +1211,6 @@
1188
1211
  </xsl:template>
1189
1212
 
1190
1213
  <xsl:template match="ogc:figure">
1191
- <xsl:variable name="title">
1192
- <xsl:text>Figure </xsl:text>
1193
- </xsl:variable>
1194
-
1195
1214
  <fo:block-container id="{@id}">
1196
1215
  <fo:block>
1197
1216
  <xsl:apply-templates/>
@@ -1201,7 +1220,11 @@
1201
1220
  <xsl:call-template name="note"/>
1202
1221
  </xsl:for-each>
1203
1222
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="6pt" keep-with-previous="always">
1204
-
1223
+ <xsl:variable name="title-figure">
1224
+ <xsl:call-template name="getTitle">
1225
+ <xsl:with-param name="name" select="'title-figure'"/>
1226
+ </xsl:call-template>
1227
+ </xsl:variable>
1205
1228
  <xsl:choose>
1206
1229
  <xsl:when test="ancestor::ogc:annex">
1207
1230
  <xsl:choose>
@@ -1209,13 +1232,13 @@
1209
1232
  <xsl:number format="a) "/>
1210
1233
  </xsl:when>
1211
1234
  <xsl:otherwise>
1212
- <xsl:value-of select="$title"/><xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
1235
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
1213
1236
  </xsl:otherwise>
1214
1237
  </xsl:choose>
1215
1238
 
1216
1239
  </xsl:when>
1217
1240
  <xsl:otherwise>
1218
- <xsl:value-of select="$title"/><xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1241
+ <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1219
1242
  </xsl:otherwise>
1220
1243
  </xsl:choose>
1221
1244
  <xsl:if test="ogc:name">
@@ -1298,13 +1321,13 @@
1298
1321
  </xsl:choose>
1299
1322
  </xsl:variable>
1300
1323
  <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
1301
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1324
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1302
1325
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1303
1326
  </fo:basic-link>
1304
1327
  </fo:inline>
1305
1328
  <fo:footnote-body>
1306
1329
  <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
1307
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
1330
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
1308
1331
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1309
1332
  </fo:inline>
1310
1333
  <xsl:apply-templates/>
@@ -1371,6 +1394,14 @@
1371
1394
  </fo:list-item>
1372
1395
  </xsl:template>
1373
1396
 
1397
+ <xsl:template match="ogc:term">
1398
+ <xsl:param name="sectionNum"/>
1399
+ <fo:block id="{@id}">
1400
+ <xsl:apply-templates>
1401
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1402
+ </xsl:apply-templates>
1403
+ </fo:block>
1404
+ </xsl:template>
1374
1405
 
1375
1406
  <xsl:template match="ogc:preferred">
1376
1407
  <xsl:param name="sectionNum"/>
@@ -1390,7 +1421,7 @@
1390
1421
  </xsl:variable>
1391
1422
  <fo:block font-size="{$font-size}">
1392
1423
  <fo:block font-weight="bold" keep-with-next="always">
1393
- <fo:inline id="{../@id}">
1424
+ <fo:inline>
1394
1425
  <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1395
1426
  </fo:inline>
1396
1427
  </fo:block>
@@ -1407,7 +1438,12 @@
1407
1438
  </xsl:template>
1408
1439
 
1409
1440
  <xsl:template match="ogc:deprecates">
1410
- <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
1441
+ <xsl:variable name="title-deprecated">
1442
+ <xsl:call-template name="getTitle">
1443
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1444
+ </xsl:call-template>
1445
+ </xsl:variable>
1446
+ <fo:block><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
1411
1447
  </xsl:template>
1412
1448
 
1413
1449
  <xsl:template match="ogc:definition[preceding-sibling::ogc:domain]">
@@ -1428,7 +1464,14 @@
1428
1464
  <fo:block margin-bottom="12pt" keep-with-previous="always">
1429
1465
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1430
1466
  <fo:basic-link internal-destination="{ogc:origin/@bibitemid}" fox:alt-text="{ogc:origin/@citeas}">
1431
- <xsl:text>[SOURCE: </xsl:text>
1467
+ <xsl:text>[</xsl:text>
1468
+ <xsl:variable name="title-source">
1469
+ <xsl:call-template name="getTitle">
1470
+ <xsl:with-param name="name" select="'title-source'"/>
1471
+ </xsl:call-template>
1472
+ </xsl:variable>
1473
+ <xsl:value-of select="$title-source"/>
1474
+ <xsl:text>: </xsl:text>
1432
1475
  <fo:inline color="blue" text-decoration="underline">
1433
1476
  <xsl:value-of select="ogc:origin/@citeas"/>
1434
1477
 
@@ -1441,19 +1484,20 @@
1441
1484
  </fo:block>
1442
1485
  </xsl:template>
1443
1486
 
1444
- <xsl:template match="ogc:modification">
1445
- <xsl:text>, modified — </xsl:text>
1446
- <xsl:apply-templates/>
1447
- </xsl:template>
1487
+
1448
1488
  <xsl:template match="ogc:modification/ogc:p">
1449
1489
  <fo:inline><xsl:apply-templates/></fo:inline>
1450
1490
  </xsl:template>
1451
1491
 
1452
1492
  <xsl:template match="ogc:termnote">
1453
1493
  <fo:block font-size="10pt" margin-bottom="12pt">
1454
- <xsl:text>Note </xsl:text>
1455
- <xsl:number/>
1456
- <xsl:text> to entry: </xsl:text>
1494
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1495
+ <xsl:variable name="title-note-to-entry">
1496
+ <xsl:call-template name="getTitle">
1497
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1498
+ </xsl:call-template>
1499
+ </xsl:variable>
1500
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1457
1501
  <xsl:apply-templates/>
1458
1502
  </fo:block>
1459
1503
  </xsl:template>
@@ -1469,7 +1513,12 @@
1469
1513
 
1470
1514
  <xsl:template match="ogc:termexample">
1471
1515
  <fo:block font-size="10pt" margin-bottom="12pt">
1472
- <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
1516
+ <xsl:variable name="title-example">
1517
+ <xsl:call-template name="getTitle">
1518
+ <xsl:with-param name="name" select="'title-example'"/>
1519
+ </xsl:call-template>
1520
+ </xsl:variable>
1521
+ <fo:inline padding-right="10mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
1473
1522
  <xsl:apply-templates/>
1474
1523
  </fo:block>
1475
1524
  </xsl:template>
@@ -1598,62 +1647,11 @@
1598
1647
 
1599
1648
  <xsl:template match="ogc:source">
1600
1649
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1601
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1650
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1602
1651
  <xsl:apply-templates select="ogc:localityStack"/>
1603
1652
  </fo:basic-link>
1604
1653
  </xsl:template>
1605
-
1606
- <xsl:template match="ogc:appendix">
1607
- <fo:block font-size="12pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1608
- <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
1609
- <xsl:apply-templates select="ogc:title" mode="process"/>
1610
- </fo:block>
1611
- <xsl:apply-templates/>
1612
- </xsl:template>
1613
-
1614
- <xsl:template match="ogc:appendix//ogc:example">
1615
- <fo:block font-size="10pt" margin-bottom="12pt">
1616
- <xsl:text>EXAMPLE</xsl:text>
1617
- <xsl:if test="ogc:name">
1618
- <xsl:text> — </xsl:text><xsl:apply-templates select="ogc:name" mode="process"/>
1619
- </xsl:if>
1620
- </fo:block>
1621
- <xsl:apply-templates/>
1622
- </xsl:template>
1623
-
1624
- <xsl:template match="ogc:appendix//ogc:example/ogc:name"/>
1625
- <xsl:template match="ogc:appendix//ogc:example/ogc:name" mode="process">
1626
- <fo:inline><xsl:apply-templates/></fo:inline>
1627
- </xsl:template>
1628
-
1629
- <xsl:template match="ogc:callout">
1630
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
1631
- </xsl:template>
1632
-
1633
- <xsl:template match="ogc:annotation">
1634
- <fo:block>
1635
-
1636
- </fo:block>
1637
- <xsl:apply-templates/>
1638
- </xsl:template>
1639
-
1640
- <xsl:template match="ogc:annotation/text()"/>
1641
-
1642
- <xsl:template match="ogc:annotation/ogc:p">
1643
- <xsl:variable name="annotation-id" select="../@id"/>
1644
- <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
1645
- <fo:block id="{$annotation-id}">
1646
- <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
1647
- <xsl:apply-templates/>
1648
- </fo:block>
1649
- </xsl:template>
1650
-
1651
-
1652
- <xsl:template match="ogc:appendix/ogc:title"/>
1653
- <xsl:template match="ogc:appendix/ogc:title" mode="process">
1654
- <fo:inline><xsl:apply-templates/></fo:inline>
1655
- </xsl:template>
1656
-
1654
+
1657
1655
 
1658
1656
  <xsl:template match="ogc:xref">
1659
1657
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
@@ -1664,6 +1662,17 @@
1664
1662
  <!-- </xsl:if> -->
1665
1663
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1666
1664
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
1665
+
1666
+ <xsl:variable name="title-clause">
1667
+ <xsl:call-template name="getTitle">
1668
+ <xsl:with-param name="name" select="'title-clause'"/>
1669
+ </xsl:call-template>
1670
+ </xsl:variable>
1671
+ <xsl:variable name="title-annex">
1672
+ <xsl:call-template name="getTitle">
1673
+ <xsl:with-param name="name" select="'title-annex'"/>
1674
+ </xsl:call-template>
1675
+ </xsl:variable>
1667
1676
 
1668
1677
  <xsl:choose>
1669
1678
  <xsl:when test="normalize-space(.) != ''">
@@ -1671,9 +1680,9 @@
1671
1680
  </xsl:when>
1672
1681
  <xsl:otherwise>
1673
1682
  <xsl:choose>
1674
- <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1675
- <xsl:when test="$type = 'term' and ($root = 'clause' or $root = 'terms')">Clause </xsl:when>
1676
- <xsl:when test="$type = 'clause' and $root = 'annex'">Annex </xsl:when>
1683
+ <xsl:when test="$type = 'clause' and $root != 'annex'"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1684
+ <xsl:when test="$type = 'term' and ($root = 'clause' or $root = 'terms')"><xsl:value-of select="$title-clause"/></xsl:when>
1685
+ <xsl:when test="$type = 'clause' and $root = 'annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1677
1686
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1678
1687
  </xsl:choose>
1679
1688
  <xsl:value-of select="$section"/>
@@ -1682,30 +1691,26 @@
1682
1691
  </fo:basic-link>
1683
1692
  </xsl:template>
1684
1693
 
1685
- <xsl:template match="ogc:sourcecode">
1686
- <fo:block font-family="Courier" font-size="10pt" margin-bottom="6pt" keep-with-next="always" line-height="113%">
1687
- <xsl:choose>
1688
- <xsl:when test="@lang = 'en'"/>
1689
- <xsl:otherwise>
1690
- <xsl:attribute name="white-space">pre</xsl:attribute>
1691
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1692
- </xsl:otherwise>
1693
- </xsl:choose>
1694
- <xsl:apply-templates/>
1695
- </fo:block>
1694
+ <xsl:template match="ogc:sourcecode" priority="2">
1695
+ <xsl:call-template name="sourcecode"/>
1696
+ <xsl:variable name="title-figure">
1697
+ <xsl:call-template name="getTitle">
1698
+ <xsl:with-param name="name" select="'title-figure'"/>
1699
+ </xsl:call-template>
1700
+ </xsl:variable>
1696
1701
  <xsl:choose>
1697
1702
  <xsl:when test="@unnumbered='true'"/>
1698
1703
  <xsl:when test="ancestor::ogc:example"/>
1699
1704
  <xsl:when test="ancestor::ogc:td"/>
1700
1705
  <xsl:when test="ancestor::ogc:annex">
1701
- <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1706
+ <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1702
1707
  <xsl:choose>
1703
1708
  <xsl:when test="count(//ogc:annex) = 1">
1704
1709
  <xsl:value-of select="/ogc:nist-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/><xsl:number format="-1" level="any" count="ogc:annex//ogc:sourcecode"/>
1705
1710
  </xsl:when>
1706
1711
  <xsl:otherwise>
1707
1712
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1708
- <xsl:text>Figure </xsl:text>
1713
+ <xsl:value-of select="$title-figure"/>
1709
1714
  <xsl:number format="A." level="multiple" count="ogc:annex"/>
1710
1715
  <xsl:number format="1" level="any" count="ogc:sourcecode[ancestor::ogc:annex/@id = $id_annex and not(@unnumbered='true') and not(ancestor::ogc:example)]"/>
1711
1716
  <xsl:if test="ogc:name">
@@ -1718,7 +1723,7 @@
1718
1723
  </xsl:when>
1719
1724
  <xsl:otherwise>
1720
1725
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1721
- <xsl:text>Figure </xsl:text>
1726
+ <xsl:value-of select="$title-figure"/>
1722
1727
  <xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1723
1728
  <xsl:if test="ogc:name">
1724
1729
  <xsl:text> — </xsl:text>
@@ -1743,7 +1748,12 @@
1743
1748
 
1744
1749
  <xsl:template match="ogc:example">
1745
1750
  <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1746
- <xsl:text>EXAMPLE</xsl:text>
1751
+ <xsl:variable name="title-example">
1752
+ <xsl:call-template name="getTitle">
1753
+ <xsl:with-param name="name" select="'title-example'"/>
1754
+ </xsl:call-template>
1755
+ </xsl:variable>
1756
+ <xsl:value-of select="normalize-space($title-example)"/>
1747
1757
  <xsl:if test="following-sibling::ogc:example or preceding-sibling::ogc:example">
1748
1758
  <xsl:number format=" 1"/>
1749
1759
  </xsl:if>
@@ -1774,7 +1784,12 @@
1774
1784
  </xsl:if>
1775
1785
  <xsl:variable name="clauseid" select="ancestor::ogc:clause[1]/@id"/>
1776
1786
  <fo:inline padding-right="4mm">
1777
- <xsl:text>NOTE </xsl:text>
1787
+ <xsl:variable name="title-note">
1788
+ <xsl:call-template name="getTitle">
1789
+ <xsl:with-param name="name" select="'title-note'"/>
1790
+ </xsl:call-template>
1791
+ </xsl:variable>
1792
+ <xsl:value-of select="$title-note"/>
1778
1793
  <xsl:if test="count(//ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]) &gt; 1">
1779
1794
  <xsl:number count="ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]" level="any"/>
1780
1795
  </xsl:if>
@@ -1801,7 +1816,7 @@
1801
1816
  </xsl:if> -->
1802
1817
  <xsl:choose>
1803
1818
  <xsl:when test="@citeas and normalize-space(text()) = ''">
1804
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1819
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1805
1820
  </xsl:when>
1806
1821
  <xsl:when test="@bibitemid and normalize-space(text()) = ''">
1807
1822
  <xsl:value-of select="//ogc:bibitem[@id = current()/@bibitemid]/ogc:docidentifier"/>
@@ -1814,9 +1829,19 @@
1814
1829
  </xsl:template>
1815
1830
 
1816
1831
  <xsl:template match="ogc:locality">
1832
+ <xsl:variable name="title-clause">
1833
+ <xsl:call-template name="getTitle">
1834
+ <xsl:with-param name="name" select="'title-clause'"/>
1835
+ </xsl:call-template>
1836
+ </xsl:variable>
1837
+ <xsl:variable name="title-annex">
1838
+ <xsl:call-template name="getTitle">
1839
+ <xsl:with-param name="name" select="'title-annex'"/>
1840
+ </xsl:call-template>
1841
+ </xsl:variable>
1817
1842
  <xsl:choose>
1818
- <xsl:when test="@type ='clause'">Clause </xsl:when>
1819
- <xsl:when test="@type ='annex'">Annex </xsl:when>
1843
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1844
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1820
1845
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1821
1846
  </xsl:choose>
1822
1847
  <xsl:text> </xsl:text><xsl:value-of select="ogc:referenceFrom"/>
@@ -1825,8 +1850,8 @@
1825
1850
  <xsl:template match="ogc:admonition">
1826
1851
  <fo:block-container border="0.5pt solid rgb(79, 129, 189)" color="rgb(79, 129, 189)" margin-left="16mm" margin-right="16mm" margin-bottom="12pt">
1827
1852
  <fo:block-container margin-left="0mm" margin-right="0mm" padding="2mm" padding-top="3mm">
1828
- <fo:block font-size="11pt" margin-bottom="6pt" font-weight="bold" font-style="italic" text-align="center">
1829
- <xsl:value-of select="translate(@type, $lower, $upper)"/>
1853
+ <fo:block font-size="11pt" margin-bottom="6pt" font-weight="bold" font-style="italic" text-align="center">
1854
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/>
1830
1855
  </fo:block>
1831
1856
  <fo:block font-style="italic">
1832
1857
  <xsl:apply-templates/>
@@ -1837,6 +1862,12 @@
1837
1862
 
1838
1863
  </xsl:template>
1839
1864
 
1865
+ <xsl:template match="ogc:formula">
1866
+ <fo:block id="{@id}">
1867
+ <xsl:apply-templates/>
1868
+ </fo:block>
1869
+ </xsl:template>
1870
+
1840
1871
  <xsl:template match="ogc:formula/ogc:dt/ogc:stem">
1841
1872
  <fo:inline>
1842
1873
  <xsl:apply-templates/>
@@ -1844,7 +1875,7 @@
1844
1875
  </xsl:template>
1845
1876
 
1846
1877
  <xsl:template match="ogc:formula/ogc:stem">
1847
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
1878
+ <fo:block margin-top="6pt" margin-bottom="12pt">
1848
1879
  <fo:table table-layout="fixed" width="100%">
1849
1880
  <fo:table-column column-width="95%"/>
1850
1881
  <fo:table-column column-width="5%"/>
@@ -1859,7 +1890,7 @@
1859
1890
  <fo:block text-align="right">
1860
1891
  <xsl:choose>
1861
1892
  <xsl:when test="ancestor::ogc:annex">
1862
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="ogc:annex | ogc:formula"/><xsl:text>)</xsl:text>
1893
+ <xsl:number format="(A.1)" level="multiple" count="ogc:annex | ogc:formula"/>
1863
1894
  </xsl:when>
1864
1895
  <xsl:otherwise> <!-- not(ancestor::ogc:annex) -->
1865
1896
  <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="ogc:formula"/><xsl:text>)</xsl:text> -->
@@ -1886,11 +1917,7 @@
1886
1917
  <fo:block> </fo:block>
1887
1918
  <fo:block break-after="page"/>
1888
1919
  </xsl:template>
1889
-
1890
- <xsl:template match="ogc:bookmark">
1891
- <fo:inline id="{@id}"/>
1892
- </xsl:template>
1893
-
1920
+
1894
1921
  <xsl:template name="insertHeaderFooter">
1895
1922
  <xsl:param name="pagenum-font-weight" select="'normal'"/>
1896
1923
  <fo:static-content flow-name="header-even">
@@ -1948,38 +1975,6 @@
1948
1975
  </fo:static-content>
1949
1976
  </xsl:template>
1950
1977
 
1951
- <xsl:template name="getId">
1952
- <xsl:choose>
1953
- <xsl:when test="../@id">
1954
- <xsl:value-of select="../@id"/>
1955
- </xsl:when>
1956
- <xsl:otherwise>
1957
- <xsl:value-of select="text()"/>
1958
- </xsl:otherwise>
1959
- </xsl:choose>
1960
- </xsl:template>
1961
-
1962
- <xsl:template name="getLevel">
1963
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1964
- <xsl:variable name="level">
1965
- <xsl:choose>
1966
- <xsl:when test="ancestor::ogc:preface">
1967
- <xsl:value-of select="$level_total - 2"/>
1968
- </xsl:when>
1969
- <xsl:when test="ancestor::ogc:sections">
1970
- <xsl:value-of select="$level_total - 2"/>
1971
- </xsl:when>
1972
- <xsl:when test="ancestor::ogc:bibliography">
1973
- <xsl:value-of select="$level_total - 2"/>
1974
- </xsl:when>
1975
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1976
- <xsl:otherwise>
1977
- <xsl:value-of select="$level_total - 1"/>
1978
- </xsl:otherwise>
1979
- </xsl:choose>
1980
- </xsl:variable>
1981
- <xsl:value-of select="$level"/>
1982
- </xsl:template>
1983
1978
 
1984
1979
  <xsl:template name="getSection">
1985
1980
  <xsl:param name="sectionNum"/>
@@ -1999,7 +1994,7 @@
1999
1994
  </xsl:when>
2000
1995
  <xsl:when test="$level &gt;= 2">
2001
1996
  <xsl:variable name="num">
2002
- <xsl:number format=".1" level="multiple" count="ogc:clause/ogc:clause | ogc:clause/ogc:terms | ogc:terms/ogc:term | ogc:clause/ogc:term | ogc:clause/ogc:definitions | ogc:definitions/ogc:definitions | ogc:terms/ogc:definitions"/>
1997
+ <xsl:call-template name="getSubSection"/>
2003
1998
  </xsl:variable>
2004
1999
  <xsl:value-of select="concat($sectionNum, $num)"/>
2005
2000
  </xsl:when>
@@ -2023,7 +2018,12 @@
2023
2018
  <xsl:when test="ancestor::ogc:annex">
2024
2019
  <xsl:choose>
2025
2020
  <xsl:when test="$level = 1">
2026
- <xsl:text>Annex </xsl:text>
2021
+ <xsl:variable name="title-annex">
2022
+ <xsl:call-template name="getTitle">
2023
+ <xsl:with-param name="name" select="'title-annex'"/>
2024
+ </xsl:call-template>
2025
+ </xsl:variable>
2026
+ <xsl:value-of select="$title-annex"/>
2027
2027
  <xsl:choose>
2028
2028
  <xsl:when test="count(//ogc:annex) = 1">
2029
2029
  <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/>
@@ -2066,19 +2066,230 @@
2066
2066
  <xsl:value-of select="$section"/>
2067
2067
  </xsl:template>
2068
2068
 
2069
- <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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="link-style">
2069
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2070
+
2071
+ <title-table lang="en">Table </title-table>
2072
+ <title-table lang="fr">Tableau </title-table>
2073
+
2074
+ <title-table lang="zh">Table </title-table>
2075
+
2076
+
2077
+
2078
+ <title-note lang="en">NOTE </title-note>
2079
+ <title-note lang="fr">NOTE </title-note>
2080
+
2081
+ <title-note lang="zh">NOTE </title-note>
2082
+
2083
+
2084
+
2085
+ <title-figure lang="en">Figure </title-figure>
2086
+ <title-figure lang="fr">Figure </title-figure>
2087
+
2088
+ <title-figure lang="zh">Figure </title-figure>
2089
+
2090
+
2091
+
2092
+ <title-example lang="en">EXAMPLE </title-example>
2093
+ <title-example lang="fr">EXEMPLE </title-example>
2094
+
2095
+ <title-example lang="zh">EXAMPLE </title-example>
2096
+
2097
+
2098
+
2099
+ <title-example-xref lang="en">Example </title-example-xref>
2100
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2101
+
2102
+ <title-section lang="en">Section </title-section>
2103
+ <title-section lang="fr">Section </title-section>
2104
+
2105
+ <title-inequality lang="en">Inequality </title-inequality>
2106
+ <title-inequality lang="fr">Inequality </title-inequality>
2107
+
2108
+ <title-equation lang="en">Equation </title-equation>
2109
+ <title-equation lang="fr">Equation </title-equation>
2110
+
2111
+ <title-annex lang="en">Annex </title-annex>
2112
+ <title-annex lang="fr">Annexe </title-annex>
2113
+
2114
+ <title-annex lang="zh">Annex </title-annex>
2115
+
2116
+
2117
+
2118
+ <title-appendix lang="en">Appendix </title-appendix>
2119
+ <title-appendix lang="fr">Appendix </title-appendix>
2120
+
2121
+ <title-clause lang="en">Clause </title-clause>
2122
+ <title-clause lang="fr">Article </title-clause>
2123
+
2124
+ <title-clause lang="zh">Clause </title-clause>
2125
+
2126
+
2127
+
2128
+ <title-edition lang="en">
2129
+
2130
+
2131
+ <xsl:text>Version</xsl:text>
2132
+
2133
+ </title-edition>
2134
+
2135
+ <title-formula lang="en">Formula </title-formula>
2136
+ <title-formula lang="fr">Formula </title-formula>
2137
+
2138
+ <title-toc lang="en">
2139
+
2140
+ <xsl:text>Contents</xsl:text>
2141
+
2142
+
2143
+
2144
+ </title-toc>
2145
+ <title-toc lang="fr">Sommaire</title-toc>
2146
+
2147
+ <title-toc lang="zh">Contents</title-toc>
2148
+
2149
+
2150
+
2151
+ <title-page lang="en">Page</title-page>
2152
+ <title-page lang="fr">Page</title-page>
2153
+
2154
+ <title-key lang="en">Key</title-key>
2155
+ <title-key lang="fr">Légende</title-key>
2156
+
2157
+ <title-where lang="en">where</title-where>
2158
+ <title-where lang="fr">où</title-where>
2159
+
2160
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2161
+
2162
+ <title-part lang="en">
2163
+
2164
+
2165
+ </title-part>
2166
+ <title-part lang="fr">
2167
+
2168
+
2169
+ </title-part>
2170
+ <title-part lang="zh">第 # 部分:</title-part>
2171
+
2172
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2173
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2174
+
2175
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2176
+
2177
+
2178
+
2179
+ <title-modified lang="en">modified</title-modified>
2180
+ <title-modified lang="fr">modifiée</title-modified>
2181
+
2182
+ <title-modified lang="zh">modified</title-modified>
2183
+
2184
+
2185
+
2186
+ <title-source lang="en">SOURCE</title-source>
2187
+
2188
+ <title-keywords lang="en">Keywords</title-keywords>
2189
+
2190
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2191
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2192
+
2193
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2194
+
2195
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2196
+
2197
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2198
+
2199
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2200
+
2201
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2202
+
2203
+ <title-abstract lang="en">Abstract</title-abstract>
2204
+
2205
+ <title-summary lang="en">Summary</title-summary>
2206
+
2207
+ <title-in lang="en">in </title-in>
2208
+
2209
+ <title-box lang="en">Box </title-box>
2210
+
2211
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2212
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2213
+
2214
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2215
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2216
+
2217
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2218
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2219
+
2220
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2221
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2222
+
2223
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2224
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2225
+
2226
+ <title-caution lang="en">CAUTION</title-caution>
2227
+ <title-caution lang="zh">注意</title-caution>
2228
+
2229
+ <title-warning lang="en">WARNING</title-warning>
2230
+ <title-warning lang="zh">警告</title-warning>
2231
+
2232
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2233
+ </xsl:variable><xsl:template name="getTitle">
2234
+ <xsl:param name="name"/>
2235
+ <xsl:variable name="lang">
2236
+ <xsl:call-template name="getLang"/>
2237
+ </xsl:variable>
2238
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2239
+ <xsl:choose>
2240
+ <xsl:when test="normalize-space($title_) != ''">
2241
+ <xsl:value-of select="$title_"/>
2242
+ </xsl:when>
2243
+ <xsl:otherwise>
2244
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2245
+ </xsl:otherwise>
2246
+ </xsl:choose>
2247
+ </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">
2070
2248
 
2071
2249
  <xsl:attribute name="color">blue</xsl:attribute>
2072
2250
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2073
2251
 
2074
2252
 
2075
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="text()">
2253
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2254
+
2255
+
2256
+
2257
+
2258
+
2259
+
2260
+
2261
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2262
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2263
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2264
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2265
+ <xsl:attribute name="line-height">113%</xsl:attribute>
2266
+
2267
+
2268
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2269
+
2270
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2271
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2272
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
2273
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2274
+
2275
+
2276
+
2277
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2278
+
2279
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2280
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
2281
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2282
+
2283
+
2284
+
2285
+ </xsl:attribute-set><xsl:template match="text()">
2076
2286
  <xsl:value-of select="."/>
2077
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='br']">
2287
+ </xsl:template><xsl:template match="*[local-name()='br']">
2078
2288
  <xsl:value-of select="$linebreak"/>
2079
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2080
- <xsl:call-template name="add-zero-spaces"/>
2081
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']">
2289
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2290
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2291
+ <xsl:call-template name="add-zero-spaces-java"/>
2292
+ </xsl:template><xsl:template match="*[local-name()='table']">
2082
2293
 
2083
2294
  <xsl:variable name="simple-table">
2084
2295
  <!-- <xsl:copy> -->
@@ -2113,31 +2324,17 @@
2113
2324
  <xsl:attribute name="font-size">11pt</xsl:attribute>
2114
2325
 
2115
2326
 
2116
- <xsl:text>Table </xsl:text>
2117
- <xsl:choose>
2118
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2119
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2120
- </xsl:when>
2121
- <xsl:when test="ancestor::*[local-name()='annex']">
2122
-
2123
-
2124
-
2125
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2126
-
2127
-
2128
-
2129
-
2130
-
2131
-
2132
- </xsl:when>
2133
- <xsl:otherwise>
2134
-
2135
-
2136
- <xsl:number format="A." count="*[local-name()='annex']"/>
2137
- <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']"/>
2138
-
2139
- </xsl:otherwise>
2140
- </xsl:choose>
2327
+
2328
+ <xsl:variable name="title-table">
2329
+ <xsl:call-template name="getTitle">
2330
+ <xsl:with-param name="name" select="'title-table'"/>
2331
+ </xsl:call-template>
2332
+ </xsl:variable>
2333
+ <xsl:value-of select="$title-table"/>
2334
+
2335
+ <xsl:call-template name="getTableNumber"/>
2336
+
2337
+
2141
2338
  <xsl:if test="*[local-name()='name']">
2142
2339
 
2143
2340
 
@@ -2211,6 +2408,7 @@
2211
2408
  <xsl:attribute name="space-after">12pt</xsl:attribute>
2212
2409
 
2213
2410
 
2411
+
2214
2412
  <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">
2215
2413
 
2216
2414
 
@@ -2227,9 +2425,10 @@
2227
2425
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2228
2426
 
2229
2427
 
2428
+
2230
2429
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2231
2430
  <xsl:choose>
2232
- <xsl:when test=". = 1">
2431
+ <xsl:when test=". = 1 or . = 0">
2233
2432
  <fo:table-column column-width="proportional-column-width(2)"/>
2234
2433
  </xsl:when>
2235
2434
  <xsl:otherwise>
@@ -2237,21 +2436,55 @@
2237
2436
  </xsl:otherwise>
2238
2437
  </xsl:choose>
2239
2438
  </xsl:for-each>
2240
- <xsl:apply-templates/>
2439
+
2440
+ <xsl:choose>
2441
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2442
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2443
+ </xsl:when>
2444
+ <xsl:otherwise>
2445
+ <xsl:apply-templates/>
2446
+ </xsl:otherwise>
2447
+ </xsl:choose>
2448
+
2241
2449
  </fo:table>
2242
2450
 
2243
2451
 
2244
2452
 
2245
2453
  </fo:block-container>
2246
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2454
+ </xsl:template><xsl:template name="getTableNumber">
2455
+ <xsl:choose>
2456
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2457
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2458
+ </xsl:when>
2459
+ <xsl:when test="ancestor::*[local-name()='annex']">
2460
+
2461
+
2462
+
2463
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2464
+
2465
+
2466
+
2467
+
2468
+
2469
+
2470
+ </xsl:when>
2471
+ <xsl:otherwise>
2472
+
2473
+
2474
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2475
+ <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']"/>
2476
+
2477
+ </xsl:otherwise>
2478
+ </xsl:choose>
2479
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2247
2480
  <xsl:apply-templates/>
2248
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="calculate-columns-numbers">
2481
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2249
2482
  <xsl:param name="table-row"/>
2250
2483
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2251
2484
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2252
2485
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2253
2486
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2254
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="calculate-column-widths">
2487
+ </xsl:template><xsl:template name="calculate-column-widths">
2255
2488
  <xsl:param name="table"/>
2256
2489
  <xsl:param name="cols-count"/>
2257
2490
  <xsl:param name="curr-col" select="1"/>
@@ -2260,7 +2493,7 @@
2260
2493
  <xsl:if test="$curr-col &lt;= $cols-count">
2261
2494
  <xsl:variable name="widths">
2262
2495
  <xsl:choose>
2263
- <xsl:when test="not($table)">
2496
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2264
2497
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2265
2498
  <xsl:variable name="words">
2266
2499
  <xsl:call-template name="tokenize">
@@ -2299,9 +2532,16 @@
2299
2532
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2300
2533
  </xsl:variable>
2301
2534
  <xsl:variable name="words">
2535
+ <xsl:variable name="string_with_added_zerospaces">
2536
+ <xsl:call-template name="add-zero-spaces-java">
2537
+ <xsl:with-param name="text" select="$td_text"/>
2538
+ </xsl:call-template>
2539
+ </xsl:variable>
2302
2540
  <xsl:call-template name="tokenize">
2303
2541
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2304
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
2542
+ <!-- 2009 thinspace -->
2543
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2544
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2305
2545
  </xsl:call-template>
2306
2546
  </xsl:variable>
2307
2547
  <xsl:variable name="max_length">
@@ -2342,17 +2582,28 @@
2342
2582
  <xsl:with-param name="table" select="$table"/>
2343
2583
  </xsl:call-template>
2344
2584
  </xsl:if>
2345
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="text()" mode="td_text">
2585
+ </xsl:template><xsl:template match="text()" mode="td_text">
2346
2586
  <xsl:variable name="zero-space">​</xsl:variable>
2347
2587
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2348
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='thead']" mode="process">
2588
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2589
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2590
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2591
+ <xsl:value-of select="@target"/>
2592
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2593
+ <xsl:param name="cols-count"/>
2349
2594
  <!-- font-weight="bold" -->
2350
- <fo:table-header>
2595
+ <fo:table-header>
2596
+
2351
2597
  <xsl:apply-templates/>
2352
2598
  </fo:table-header>
2353
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tfoot']" mode="process">
2599
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
2600
+ <fo:table-body>
2601
+ <xsl:apply-templates/>
2602
+ </fo:table-body>
2603
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2354
2604
  <xsl:apply-templates/>
2355
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="insertTableFooter">
2605
+ </xsl:template><xsl:template name="insertTableFooter">
2606
+ <xsl:param name="cols-count"/>
2356
2607
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2357
2608
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2358
2609
 
@@ -2363,22 +2614,7 @@
2363
2614
  <!-- if there are note(s) or fn(s) then create footer row -->
2364
2615
  <xsl:if test="$isNoteOrFnExist = 'true'">
2365
2616
 
2366
- <xsl:variable name="cols-count">
2367
- <xsl:choose>
2368
- <xsl:when test="../*[local-name()='thead']">
2369
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2370
- <xsl:call-template name="calculate-columns-numbers">
2371
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2372
- </xsl:call-template>
2373
- </xsl:when>
2374
- <xsl:otherwise>
2375
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2376
- <xsl:call-template name="calculate-columns-numbers">
2377
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2378
- </xsl:call-template>
2379
- </xsl:otherwise>
2380
- </xsl:choose>
2381
- </xsl:variable>
2617
+
2382
2618
 
2383
2619
  <fo:table-row>
2384
2620
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -2406,11 +2642,30 @@
2406
2642
  </fo:table-footer>
2407
2643
 
2408
2644
  </xsl:if>
2409
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tbody']">
2645
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2410
2646
 
2411
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
2647
+ <xsl:variable name="cols-count">
2648
+ <xsl:choose>
2649
+ <xsl:when test="../*[local-name()='thead']">
2650
+ <xsl:call-template name="calculate-columns-numbers">
2651
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2652
+ </xsl:call-template>
2653
+ </xsl:when>
2654
+ <xsl:otherwise>
2655
+ <xsl:call-template name="calculate-columns-numbers">
2656
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2657
+ </xsl:call-template>
2658
+ </xsl:otherwise>
2659
+ </xsl:choose>
2660
+ </xsl:variable>
2412
2661
 
2413
- <xsl:call-template name="insertTableFooter"/>
2662
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
2663
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2664
+ </xsl:apply-templates>
2665
+
2666
+ <xsl:call-template name="insertTableFooter">
2667
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2668
+ </xsl:call-template>
2414
2669
 
2415
2670
  <fo:table-body>
2416
2671
  <xsl:apply-templates/>
@@ -2418,7 +2673,7 @@
2418
2673
 
2419
2674
  </fo:table-body>
2420
2675
 
2421
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tr']">
2676
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2422
2677
  <xsl:variable name="parent-name" select="local-name(..)"/>
2423
2678
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2424
2679
  <fo:table-row min-height="4mm">
@@ -2438,7 +2693,7 @@
2438
2693
 
2439
2694
  <xsl:apply-templates/>
2440
2695
  </fo:table-row>
2441
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='th']">
2696
+ </xsl:template><xsl:template match="*[local-name()='th']">
2442
2697
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2443
2698
 
2444
2699
 
@@ -2461,7 +2716,7 @@
2461
2716
  <xsl:apply-templates/>
2462
2717
  </fo:block>
2463
2718
  </fo:table-cell>
2464
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='td']">
2719
+ </xsl:template><xsl:template match="*[local-name()='td']">
2465
2720
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2466
2721
 
2467
2722
 
@@ -2483,6 +2738,7 @@
2483
2738
  </xsl:attribute>
2484
2739
  </xsl:if>
2485
2740
  <fo:block>
2741
+
2486
2742
  <xsl:apply-templates/>
2487
2743
  </fo:block>
2488
2744
  <!-- <xsl:choose>
@@ -2498,16 +2754,23 @@
2498
2754
 
2499
2755
 
2500
2756
  </fo:table-cell>
2501
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='note']" mode="process">
2757
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2502
2758
 
2503
2759
 
2504
2760
  <fo:block font-size="10pt" margin-bottom="12pt">
2505
2761
 
2506
2762
 
2507
2763
 
2764
+
2508
2765
  <fo:inline padding-right="2mm">
2509
2766
 
2510
- <xsl:text>NOTE </xsl:text>
2767
+
2768
+ <xsl:variable name="title-note">
2769
+ <xsl:call-template name="getTitle">
2770
+ <xsl:with-param name="name" select="'title-note'"/>
2771
+ </xsl:call-template>
2772
+ </xsl:variable>
2773
+ <xsl:value-of select="$title-note"/>
2511
2774
 
2512
2775
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2513
2776
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -2521,9 +2784,9 @@
2521
2784
  <xsl:apply-templates mode="process"/>
2522
2785
  </fo:block>
2523
2786
 
2524
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2787
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2525
2788
  <xsl:apply-templates/>
2526
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="fn_display">
2789
+ </xsl:template><xsl:template name="fn_display">
2527
2790
  <xsl:variable name="references">
2528
2791
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2529
2792
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2546,6 +2809,7 @@
2546
2809
 
2547
2810
 
2548
2811
 
2812
+
2549
2813
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2550
2814
 
2551
2815
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2565,7 +2829,7 @@
2565
2829
  </fo:block>
2566
2830
  </xsl:if>
2567
2831
  </xsl:for-each>
2568
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="fn_name_display">
2832
+ </xsl:template><xsl:template name="fn_name_display">
2569
2833
  <!-- <xsl:variable name="references">
2570
2834
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2571
2835
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2581,7 +2845,7 @@
2581
2845
  <xsl:apply-templates/>
2582
2846
  </fo:block>
2583
2847
  </xsl:for-each>
2584
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="fn_display_figure">
2848
+ </xsl:template><xsl:template name="fn_display_figure">
2585
2849
  <xsl:variable name="key_iso">
2586
2850
  <!-- and (not(@class) or @class !='pseudocode') -->
2587
2851
  </xsl:variable>
@@ -2592,6 +2856,36 @@
2592
2856
  </fn>
2593
2857
  </xsl:for-each>
2594
2858
  </xsl:variable>
2859
+
2860
+ <!-- current hierarchy is 'figure' element -->
2861
+ <xsl:variable name="following_dl_colwidths">
2862
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2863
+ <xsl:variable name="html-table">
2864
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2865
+ <xsl:element name="{$ns}:table">
2866
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2867
+ <tbody>
2868
+ <xsl:apply-templates mode="dl"/>
2869
+ </tbody>
2870
+ </xsl:for-each>
2871
+ </xsl:element>
2872
+ </xsl:variable>
2873
+
2874
+ <xsl:call-template name="calculate-column-widths">
2875
+ <xsl:with-param name="cols-count" select="2"/>
2876
+ <xsl:with-param name="table" select="$html-table"/>
2877
+ </xsl:call-template>
2878
+
2879
+ </xsl:if>
2880
+ </xsl:variable>
2881
+
2882
+
2883
+ <xsl:variable name="maxlength_dt">
2884
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2885
+ <xsl:call-template name="getMaxLength_dt"/>
2886
+ </xsl:for-each>
2887
+ </xsl:variable>
2888
+
2595
2889
  <xsl:if test="xalan:nodeset($references)//fn">
2596
2890
  <fo:block>
2597
2891
  <fo:table width="95%" table-layout="fixed">
@@ -2599,8 +2893,19 @@
2599
2893
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2600
2894
 
2601
2895
  </xsl:if>
2602
- <fo:table-column column-width="15%"/>
2603
- <fo:table-column column-width="85%"/>
2896
+ <xsl:choose>
2897
+ <!-- if there 'dl', then set same columns width -->
2898
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
2899
+ <xsl:call-template name="setColumnWidth_dl">
2900
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
2901
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2902
+ </xsl:call-template>
2903
+ </xsl:when>
2904
+ <xsl:otherwise>
2905
+ <fo:table-column column-width="15%"/>
2906
+ <fo:table-column column-width="85%"/>
2907
+ </xsl:otherwise>
2908
+ </xsl:choose>
2604
2909
  <fo:table-body>
2605
2910
  <xsl:for-each select="xalan:nodeset($references)//fn">
2606
2911
  <xsl:variable name="reference" select="@reference"/>
@@ -2632,7 +2937,7 @@
2632
2937
  </fo:block>
2633
2938
  </xsl:if>
2634
2939
 
2635
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='fn']">
2940
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2636
2941
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2637
2942
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
2638
2943
 
@@ -2654,11 +2959,11 @@
2654
2959
  <xsl:value-of select="@reference"/>
2655
2960
  </fo:basic-link>
2656
2961
  </fo:inline>
2657
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='fn']/*[local-name()='p']">
2962
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2658
2963
  <fo:inline>
2659
2964
  <xsl:apply-templates/>
2660
2965
  </fo:inline>
2661
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dl']">
2966
+ </xsl:template><xsl:template match="*[local-name()='dl']">
2662
2967
  <xsl:variable name="parent" select="local-name(..)"/>
2663
2968
 
2664
2969
  <xsl:variable name="key_iso">
@@ -2670,8 +2975,13 @@
2670
2975
 
2671
2976
 
2672
2977
  <fo:block margin-bottom="12pt" text-align="left">
2673
-
2674
- <xsl:text>where </xsl:text>
2978
+
2979
+ <xsl:variable name="title-where">
2980
+ <xsl:call-template name="getTitle">
2981
+ <xsl:with-param name="name" select="'title-where'"/>
2982
+ </xsl:call-template>
2983
+ </xsl:variable>
2984
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2675
2985
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
2676
2986
  <xsl:text/>
2677
2987
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -2684,15 +2994,25 @@
2684
2994
 
2685
2995
 
2686
2996
 
2687
- <xsl:text>where</xsl:text>
2997
+ <xsl:variable name="title-where">
2998
+ <xsl:call-template name="getTitle">
2999
+ <xsl:with-param name="name" select="'title-where'"/>
3000
+ </xsl:call-template>
3001
+ </xsl:variable>
3002
+ <xsl:value-of select="$title-where"/>
2688
3003
  </fo:block>
2689
3004
  </xsl:when>
2690
3005
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2691
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3006
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2692
3007
 
2693
3008
 
2694
3009
 
2695
- <xsl:text>Key</xsl:text>
3010
+ <xsl:variable name="title-key">
3011
+ <xsl:call-template name="getTitle">
3012
+ <xsl:with-param name="name" select="'title-key'"/>
3013
+ </xsl:call-template>
3014
+ </xsl:variable>
3015
+ <xsl:value-of select="$title-key"/>
2696
3016
  </fo:block>
2697
3017
  </xsl:when>
2698
3018
  </xsl:choose>
@@ -2703,26 +3023,11 @@
2703
3023
 
2704
3024
 
2705
3025
 
3026
+
2706
3027
  <fo:block>
2707
3028
 
2708
3029
 
2709
- <!-- create virtual html table for dl/[dt and dd] -->
2710
- <xsl:variable name="html-table">
2711
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2712
- <xsl:element name="{$ns}:table">
2713
- <tbody>
2714
- <xsl:apply-templates mode="dl"/>
2715
- </tbody>
2716
- </xsl:element>
2717
- </xsl:variable>
2718
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
2719
- <xsl:variable name="colwidths">
2720
- <xsl:call-template name="calculate-column-widths">
2721
- <xsl:with-param name="cols-count" select="2"/>
2722
- <xsl:with-param name="table" select="$html-table"/>
2723
- </xsl:call-template>
2724
- </xsl:variable>
2725
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3030
+
2726
3031
 
2727
3032
  <fo:table width="95%" table-layout="fixed">
2728
3033
 
@@ -2735,42 +3040,30 @@
2735
3040
 
2736
3041
  </xsl:when>
2737
3042
  </xsl:choose>
2738
- <xsl:choose>
2739
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2740
- <fo:table-column column-width="50%"/>
2741
- <fo:table-column column-width="50%"/>
2742
- </xsl:when>
2743
- <xsl:otherwise>
2744
- <xsl:choose>
2745
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2746
- <fo:table-column column-width="60%"/>
2747
- <fo:table-column column-width="40%"/>
2748
- </xsl:when> -->
2749
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2750
- <fo:table-column column-width="50%"/>
2751
- <fo:table-column column-width="50%"/>
2752
- </xsl:when>
2753
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2754
- <fo:table-column column-width="40%"/>
2755
- <fo:table-column column-width="60%"/>
2756
- </xsl:when>
2757
- <xsl:otherwise>
2758
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2759
- <xsl:choose>
2760
- <xsl:when test=". = 1">
2761
- <fo:table-column column-width="proportional-column-width(2)"/>
2762
- </xsl:when>
2763
- <xsl:otherwise>
2764
- <fo:table-column column-width="proportional-column-width({.})"/>
2765
- </xsl:otherwise>
2766
- </xsl:choose>
2767
- </xsl:for-each>
2768
- </xsl:otherwise>
2769
- </xsl:choose>
2770
- <!-- <fo:table-column column-width="15%"/>
2771
- <fo:table-column column-width="85%"/> -->
2772
- </xsl:otherwise>
2773
- </xsl:choose>
3043
+ <!-- create virtual html table for dl/[dt and dd] -->
3044
+ <xsl:variable name="html-table">
3045
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3046
+ <xsl:element name="{$ns}:table">
3047
+ <tbody>
3048
+ <xsl:apply-templates mode="dl"/>
3049
+ </tbody>
3050
+ </xsl:element>
3051
+ </xsl:variable>
3052
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3053
+ <xsl:variable name="colwidths">
3054
+ <xsl:call-template name="calculate-column-widths">
3055
+ <xsl:with-param name="cols-count" select="2"/>
3056
+ <xsl:with-param name="table" select="$html-table"/>
3057
+ </xsl:call-template>
3058
+ </xsl:variable>
3059
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3060
+ <xsl:variable name="maxlength_dt">
3061
+ <xsl:call-template name="getMaxLength_dt"/>
3062
+ </xsl:variable>
3063
+ <xsl:call-template name="setColumnWidth_dl">
3064
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3065
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3066
+ </xsl:call-template>
2774
3067
  <fo:table-body>
2775
3068
  <xsl:apply-templates>
2776
3069
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -2780,7 +3073,61 @@
2780
3073
  </fo:block>
2781
3074
  </fo:block>
2782
3075
  </xsl:if>
2783
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dl']/*[local-name()='note']">
3076
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3077
+ <xsl:param name="colwidths"/>
3078
+ <xsl:param name="maxlength_dt"/>
3079
+ <xsl:choose>
3080
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3081
+ <fo:table-column column-width="50%"/>
3082
+ <fo:table-column column-width="50%"/>
3083
+ </xsl:when>
3084
+ <xsl:otherwise>
3085
+ <xsl:choose>
3086
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3087
+ <fo:table-column column-width="5%"/>
3088
+ <fo:table-column column-width="95%"/>
3089
+ </xsl:when>
3090
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3091
+ <fo:table-column column-width="10%"/>
3092
+ <fo:table-column column-width="90%"/>
3093
+ </xsl:when>
3094
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3095
+ <fo:table-column column-width="60%"/>
3096
+ <fo:table-column column-width="40%"/>
3097
+ </xsl:when> -->
3098
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3099
+ <fo:table-column column-width="50%"/>
3100
+ <fo:table-column column-width="50%"/>
3101
+ </xsl:when>
3102
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3103
+ <fo:table-column column-width="40%"/>
3104
+ <fo:table-column column-width="60%"/>
3105
+ </xsl:when>
3106
+ <xsl:otherwise>
3107
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3108
+ <xsl:choose>
3109
+ <xsl:when test=". = 1 or . = 0">
3110
+ <fo:table-column column-width="proportional-column-width(2)"/>
3111
+ </xsl:when>
3112
+ <xsl:otherwise>
3113
+ <fo:table-column column-width="proportional-column-width({.})"/>
3114
+ </xsl:otherwise>
3115
+ </xsl:choose>
3116
+ </xsl:for-each>
3117
+ </xsl:otherwise>
3118
+ </xsl:choose>
3119
+ <!-- <fo:table-column column-width="15%"/>
3120
+ <fo:table-column column-width="85%"/> -->
3121
+ </xsl:otherwise>
3122
+ </xsl:choose>
3123
+ </xsl:template><xsl:template name="getMaxLength_dt">
3124
+ <xsl:for-each select="*[local-name()='dt']">
3125
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3126
+ <xsl:if test="position() = 1">
3127
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3128
+ </xsl:if>
3129
+ </xsl:for-each>
3130
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
2784
3131
  <xsl:param name="key_iso"/>
2785
3132
 
2786
3133
  <!-- <tr>
@@ -2796,7 +3143,12 @@
2796
3143
  <xsl:if test="normalize-space($key_iso) = 'true'">
2797
3144
  <xsl:attribute name="margin-top">0</xsl:attribute>
2798
3145
  </xsl:if>
2799
- NOTE
3146
+ <xsl:variable name="title-note">
3147
+ <xsl:call-template name="getTitle">
3148
+ <xsl:with-param name="name" select="'title-note'"/>
3149
+ </xsl:call-template>
3150
+ </xsl:variable>
3151
+ <xsl:value-of select="$title-note"/>
2800
3152
  </fo:block>
2801
3153
  </fo:table-cell>
2802
3154
  <fo:table-cell>
@@ -2805,7 +3157,7 @@
2805
3157
  </fo:block>
2806
3158
  </fo:table-cell>
2807
3159
  </fo:table-row>
2808
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dt']" mode="dl">
3160
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
2809
3161
  <tr>
2810
3162
  <td>
2811
3163
  <xsl:apply-templates/>
@@ -2818,11 +3170,12 @@
2818
3170
  </td>
2819
3171
  </tr>
2820
3172
 
2821
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dt']">
3173
+ </xsl:template><xsl:template match="*[local-name()='dt']">
2822
3174
  <xsl:param name="key_iso"/>
2823
3175
 
2824
3176
  <fo:table-row>
2825
3177
  <fo:table-cell>
3178
+
2826
3179
  <fo:block margin-top="6pt">
2827
3180
 
2828
3181
 
@@ -2832,8 +3185,18 @@
2832
3185
  </xsl:if>
2833
3186
 
2834
3187
 
2835
- <xsl:apply-templates/>
2836
3188
 
3189
+
3190
+
3191
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
3192
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3193
+
3194
+ <xsl:apply-templates/>
3195
+ <!-- <xsl:if test="$namespace = 'gb'">
3196
+ <xsl:if test="ancestor::*[local-name()='formula']">
3197
+ <xsl:text>—</xsl:text>
3198
+ </xsl:if>
3199
+ </xsl:if> -->
2837
3200
  </fo:block>
2838
3201
  </fo:table-cell>
2839
3202
  <fo:table-cell>
@@ -2847,37 +3210,37 @@
2847
3210
  </fo:table-cell>
2848
3211
  </fo:table-row>
2849
3212
 
2850
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']" mode="dl_process">
3213
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2851
3214
  <xsl:apply-templates/>
2852
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']" mode="process">
3215
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2853
3216
  <xsl:apply-templates/>
2854
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3217
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2855
3218
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
2856
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='em']">
3219
+ </xsl:template><xsl:template match="*[local-name()='em']">
2857
3220
  <fo:inline font-style="italic">
2858
3221
  <xsl:apply-templates/>
2859
3222
  </fo:inline>
2860
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='strong']">
3223
+ </xsl:template><xsl:template match="*[local-name()='strong']">
2861
3224
  <fo:inline font-weight="bold">
2862
3225
  <xsl:apply-templates/>
2863
3226
  </fo:inline>
2864
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='sup']">
3227
+ </xsl:template><xsl:template match="*[local-name()='sup']">
2865
3228
  <fo:inline font-size="80%" vertical-align="super">
2866
3229
  <xsl:apply-templates/>
2867
3230
  </fo:inline>
2868
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='sub']">
3231
+ </xsl:template><xsl:template match="*[local-name()='sub']">
2869
3232
  <fo:inline font-size="80%" vertical-align="sub">
2870
3233
  <xsl:apply-templates/>
2871
3234
  </fo:inline>
2872
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tt']">
2873
- <fo:inline font-family="Courier" font-size="10pt">
3235
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3236
+ <fo:inline font-family="Courier" font-size="10pt">
2874
3237
  <xsl:apply-templates/>
2875
3238
  </fo:inline>
2876
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='del']">
3239
+ </xsl:template><xsl:template match="*[local-name()='del']">
2877
3240
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2878
3241
  <xsl:apply-templates/>
2879
3242
  </fo:inline>
2880
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="text()[ancestor::*[local-name()='smallcap']]">
3243
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2881
3244
  <xsl:variable name="text" select="normalize-space(.)"/>
2882
3245
  <fo:inline font-size="75%">
2883
3246
  <xsl:if test="string-length($text) &gt; 0">
@@ -2886,10 +3249,11 @@
2886
3249
  </xsl:call-template>
2887
3250
  </xsl:if>
2888
3251
  </fo:inline>
2889
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="recursiveSmallCaps">
3252
+ </xsl:template><xsl:template name="recursiveSmallCaps">
2890
3253
  <xsl:param name="text"/>
2891
3254
  <xsl:variable name="char" select="substring($text,1,1)"/>
2892
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3255
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3256
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
2893
3257
  <xsl:choose>
2894
3258
  <xsl:when test="$char=$upperCase">
2895
3259
  <fo:inline font-size="{100 div 0.75}%">
@@ -2905,7 +3269,7 @@
2905
3269
  <xsl:with-param name="text" select="substring($text,2)"/>
2906
3270
  </xsl:call-template>
2907
3271
  </xsl:if>
2908
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="tokenize">
3272
+ </xsl:template><xsl:template name="tokenize">
2909
3273
  <xsl:param name="text"/>
2910
3274
  <xsl:param name="separator" select="' '"/>
2911
3275
  <xsl:choose>
@@ -2953,7 +3317,7 @@
2953
3317
  </xsl:call-template>
2954
3318
  </xsl:otherwise>
2955
3319
  </xsl:choose>
2956
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="max_length">
3320
+ </xsl:template><xsl:template name="max_length">
2957
3321
  <xsl:param name="words"/>
2958
3322
  <xsl:for-each select="$words//word">
2959
3323
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2961,7 +3325,11 @@
2961
3325
  <xsl:value-of select="."/>
2962
3326
  </xsl:if>
2963
3327
  </xsl:for-each>
2964
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="add-zero-spaces">
3328
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3329
+ <xsl:param name="text" select="."/>
3330
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3331
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3332
+ </xsl:template><xsl:template name="add-zero-spaces">
2965
3333
  <xsl:param name="text" select="."/>
2966
3334
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
2967
3335
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3014,7 +3382,7 @@
3014
3382
  <xsl:value-of select="$text"/>
3015
3383
  </xsl:otherwise>
3016
3384
  </xsl:choose>
3017
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="add-zero-spaces-equal">
3385
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3018
3386
  <xsl:param name="text" select="."/>
3019
3387
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3020
3388
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3040,7 +3408,7 @@
3040
3408
  <xsl:value-of select="$text"/>
3041
3409
  </xsl:otherwise>
3042
3410
  </xsl:choose>
3043
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="getSimpleTable">
3411
+ </xsl:template><xsl:template name="getSimpleTable">
3044
3412
  <xsl:variable name="simple-table">
3045
3413
 
3046
3414
  <!-- Step 1. colspan processing -->
@@ -3067,9 +3435,9 @@
3067
3435
  </xsl:choose> -->
3068
3436
  </xsl:variable>
3069
3437
  <xsl:copy-of select="$simple-table"/>
3070
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3438
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3071
3439
  <xsl:apply-templates mode="simple-table-colspan"/>
3072
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3440
+ </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">
3073
3441
  <xsl:choose>
3074
3442
  <xsl:when test="@colspan">
3075
3443
  <xsl:variable name="td">
@@ -3091,16 +3459,16 @@
3091
3459
  </xsl:element>
3092
3460
  </xsl:otherwise>
3093
3461
  </xsl:choose>
3094
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tr']" mode="simple-table-colspan">
3462
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3095
3463
  <xsl:element name="tr">
3096
3464
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3097
3465
  <xsl:apply-templates mode="simple-table-colspan"/>
3098
3466
  </xsl:element>
3099
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="@*|node()" mode="simple-table-colspan">
3467
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3100
3468
  <xsl:copy>
3101
3469
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3102
3470
  </xsl:copy>
3103
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="repeatNode">
3471
+ </xsl:template><xsl:template name="repeatNode">
3104
3472
  <xsl:param name="count"/>
3105
3473
  <xsl:param name="node"/>
3106
3474
 
@@ -3111,18 +3479,18 @@
3111
3479
  </xsl:call-template>
3112
3480
  <xsl:copy-of select="$node"/>
3113
3481
  </xsl:if>
3114
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="@*|node()" mode="simple-table-rowspan">
3482
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3115
3483
  <xsl:copy>
3116
3484
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3117
3485
  </xsl:copy>
3118
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="tbody" mode="simple-table-rowspan">
3486
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3119
3487
  <xsl:copy>
3120
3488
  <xsl:copy-of select="tr[1]"/>
3121
3489
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3122
3490
  <xsl:with-param name="previousRow" select="tr[1]"/>
3123
3491
  </xsl:apply-templates>
3124
3492
  </xsl:copy>
3125
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="tr" mode="simple-table-rowspan">
3493
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3126
3494
  <xsl:param name="previousRow"/>
3127
3495
  <xsl:variable name="currentRow" select="."/>
3128
3496
 
@@ -3156,43 +3524,53 @@
3156
3524
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3157
3525
  <xsl:with-param name="previousRow" select="$newRow"/>
3158
3526
  </xsl:apply-templates>
3159
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="getLang">
3527
+ </xsl:template><xsl:template name="getLang">
3160
3528
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3161
3529
  <xsl:choose>
3162
3530
  <xsl:when test="$language = 'English'">en</xsl:when>
3163
3531
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3164
3532
  </xsl:choose>
3165
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="capitalizeWords">
3533
+ </xsl:template><xsl:template name="capitalizeWords">
3166
3534
  <xsl:param name="str"/>
3167
3535
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3168
3536
  <xsl:choose>
3169
3537
  <xsl:when test="contains($str2, ' ')">
3170
3538
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3171
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3172
- <xsl:value-of select="substring($substr, 2)"/>
3539
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3540
+ <xsl:value-of select="substring($substr, 2)"/> -->
3541
+ <xsl:call-template name="capitalize">
3542
+ <xsl:with-param name="str" select="$substr"/>
3543
+ </xsl:call-template>
3173
3544
  <xsl:text> </xsl:text>
3174
3545
  <xsl:call-template name="capitalizeWords">
3175
3546
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3176
3547
  </xsl:call-template>
3177
3548
  </xsl:when>
3178
3549
  <xsl:otherwise>
3179
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3180
- <xsl:value-of select="substring($str2, 2)"/>
3550
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3551
+ <xsl:value-of select="substring($str2, 2)"/> -->
3552
+ <xsl:call-template name="capitalize">
3553
+ <xsl:with-param name="str" select="$str2"/>
3554
+ </xsl:call-template>
3181
3555
  </xsl:otherwise>
3182
3556
  </xsl:choose>
3183
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="mathml:math">
3557
+ </xsl:template><xsl:template name="capitalize">
3558
+ <xsl:param name="str"/>
3559
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3560
+ <xsl:value-of select="substring($str, 2)"/>
3561
+ </xsl:template><xsl:template match="mathml:math">
3184
3562
  <fo:inline font-family="STIX2Math">
3185
3563
  <fo:instream-foreign-object fox:alt-text="Math">
3186
3564
  <xsl:copy-of select="."/>
3187
3565
  </fo:instream-foreign-object>
3188
3566
  </fo:inline>
3189
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='localityStack']">
3567
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3190
3568
  <xsl:for-each select="*[local-name()='locality']">
3191
3569
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3192
3570
  <xsl:apply-templates select="."/>
3193
3571
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3194
3572
  </xsl:for-each>
3195
- </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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='link']" name="link">
3573
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3196
3574
  <xsl:variable name="target">
3197
3575
  <xsl:choose>
3198
3576
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3222,4 +3600,244 @@
3222
3600
  </xsl:otherwise>
3223
3601
  </xsl:choose>
3224
3602
  </fo:inline>
3603
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3604
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3605
+ <!-- <xsl:choose>
3606
+ <xsl:when test="@lang = 'en'"></xsl:when>
3607
+ <xsl:otherwise> -->
3608
+ <xsl:attribute name="white-space">pre</xsl:attribute>
3609
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
3610
+ <!-- </xsl:otherwise>
3611
+ </xsl:choose> -->
3612
+ <xsl:apply-templates/>
3613
+ </fo:block>
3614
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3615
+ <fo:inline id="{@id}"/>
3616
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3617
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3618
+ <xsl:variable name="title-appendix">
3619
+ <xsl:call-template name="getTitle">
3620
+ <xsl:with-param name="name" select="'title-appendix'"/>
3621
+ </xsl:call-template>
3622
+ </xsl:variable>
3623
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3624
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3625
+ </fo:block>
3626
+ <xsl:apply-templates/>
3627
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3628
+ <fo:inline><xsl:apply-templates/></fo:inline>
3629
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3630
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
3631
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3632
+ <xsl:variable name="title-example">
3633
+ <xsl:call-template name="getTitle">
3634
+ <xsl:with-param name="name" select="'title-example'"/>
3635
+ </xsl:call-template>
3636
+ </xsl:variable>
3637
+ <xsl:value-of select="$title-example"/>
3638
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3639
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
3640
+ </xsl:if>
3641
+ <xsl:if test="*[local-name()='name']">
3642
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3643
+ </xsl:if>
3644
+ </fo:block>
3645
+ <xsl:apply-templates/>
3646
+ </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">
3647
+ <fo:inline><xsl:apply-templates/></fo:inline>
3648
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3649
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3650
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3651
+ <xsl:variable name="annotation-id" select="@id"/>
3652
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3653
+ <fo:block id="{$annotation-id}" white-space="nowrap">
3654
+ <fo:inline>
3655
+ <xsl:apply-templates>
3656
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
3657
+ </xsl:apply-templates>
3658
+ </fo:inline>
3659
+ </fo:block>
3660
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3661
+ <xsl:param name="callout"/>
3662
+ <fo:inline id="{@id}">
3663
+ <!-- for first p in annotation, put <x> -->
3664
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3665
+ <xsl:apply-templates/>
3666
+ </fo:inline>
3667
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
3668
+ <xsl:variable name="title-modified">
3669
+ <xsl:call-template name="getTitle">
3670
+ <xsl:with-param name="name" select="'title-modified'"/>
3671
+ </xsl:call-template>
3672
+ </xsl:variable>
3673
+ <xsl:choose>
3674
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3675
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3676
+ </xsl:choose>
3677
+ <xsl:apply-templates/>
3678
+ </xsl:template><xsl:template name="convertDate">
3679
+ <xsl:param name="date"/>
3680
+ <xsl:param name="format" select="'short'"/>
3681
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
3682
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
3683
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
3684
+ <xsl:variable name="monthStr">
3685
+ <xsl:choose>
3686
+ <xsl:when test="$month = '01'">January</xsl:when>
3687
+ <xsl:when test="$month = '02'">February</xsl:when>
3688
+ <xsl:when test="$month = '03'">March</xsl:when>
3689
+ <xsl:when test="$month = '04'">April</xsl:when>
3690
+ <xsl:when test="$month = '05'">May</xsl:when>
3691
+ <xsl:when test="$month = '06'">June</xsl:when>
3692
+ <xsl:when test="$month = '07'">July</xsl:when>
3693
+ <xsl:when test="$month = '08'">August</xsl:when>
3694
+ <xsl:when test="$month = '09'">September</xsl:when>
3695
+ <xsl:when test="$month = '10'">October</xsl:when>
3696
+ <xsl:when test="$month = '11'">November</xsl:when>
3697
+ <xsl:when test="$month = '12'">December</xsl:when>
3698
+ </xsl:choose>
3699
+ </xsl:variable>
3700
+ <xsl:variable name="result">
3701
+ <xsl:choose>
3702
+ <xsl:when test="$format = 'short' or $day = ''">
3703
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
3704
+ </xsl:when>
3705
+ <xsl:otherwise>
3706
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
3707
+ </xsl:otherwise>
3708
+ </xsl:choose>
3709
+ </xsl:variable>
3710
+ <xsl:value-of select="$result"/>
3711
+ </xsl:template><xsl:template name="insertKeywords">
3712
+ <xsl:param name="sorting" select="'true'"/>
3713
+ <xsl:param name="charAtEnd" select="'.'"/>
3714
+ <xsl:param name="charDelim" select="', '"/>
3715
+ <xsl:choose>
3716
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
3717
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3718
+ <xsl:sort data-type="text" order="ascending"/>
3719
+ <xsl:call-template name="insertKeyword">
3720
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3721
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3722
+ </xsl:call-template>
3723
+ </xsl:for-each>
3724
+ </xsl:when>
3725
+ <xsl:otherwise>
3726
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3727
+ <xsl:call-template name="insertKeyword">
3728
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3729
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3730
+ </xsl:call-template>
3731
+ </xsl:for-each>
3732
+ </xsl:otherwise>
3733
+ </xsl:choose>
3734
+ </xsl:template><xsl:template name="insertKeyword">
3735
+ <xsl:param name="charAtEnd"/>
3736
+ <xsl:param name="charDelim"/>
3737
+ <xsl:apply-templates/>
3738
+ <xsl:choose>
3739
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3740
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3741
+ </xsl:choose>
3742
+ </xsl:template><xsl:template name="addPDFUAmeta">
3743
+ <fo:declarations>
3744
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
3745
+ <pdf:dictionary type="normal" key="ViewerPreferences">
3746
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
3747
+ </pdf:dictionary>
3748
+ </pdf:catalog>
3749
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
3750
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3751
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
3752
+ <!-- Dublin Core properties go here -->
3753
+ <dc:title>
3754
+ <xsl:variable name="title">
3755
+
3756
+
3757
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3758
+
3759
+
3760
+
3761
+ </xsl:variable>
3762
+ <xsl:choose>
3763
+ <xsl:when test="normalize-space($title) != ''">
3764
+ <xsl:value-of select="$title"/>
3765
+ </xsl:when>
3766
+ <xsl:otherwise>
3767
+ <xsl:text> </xsl:text>
3768
+ </xsl:otherwise>
3769
+ </xsl:choose>
3770
+ </dc:title>
3771
+ <dc:creator>
3772
+
3773
+
3774
+ </dc:creator>
3775
+ <dc:description>
3776
+ <xsl:variable name="abstract">
3777
+
3778
+
3779
+
3780
+
3781
+ <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
3782
+
3783
+ </xsl:variable>
3784
+ <xsl:value-of select="normalize-space($abstract)"/>
3785
+ </dc:description>
3786
+ <pdf:Keywords>
3787
+ <xsl:call-template name="insertKeywords"/>
3788
+ </pdf:Keywords>
3789
+ </rdf:Description>
3790
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
3791
+ <!-- XMP properties go here -->
3792
+ <xmp:CreatorTool/>
3793
+ </rdf:Description>
3794
+ </rdf:RDF>
3795
+ </x:xmpmeta>
3796
+ </fo:declarations>
3797
+ </xsl:template><xsl:template name="getId">
3798
+ <xsl:choose>
3799
+ <xsl:when test="../@id">
3800
+ <xsl:value-of select="../@id"/>
3801
+ </xsl:when>
3802
+ <xsl:otherwise>
3803
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
3804
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
3805
+ </xsl:otherwise>
3806
+ </xsl:choose>
3807
+ </xsl:template><xsl:template name="getLevel">
3808
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
3809
+ <xsl:variable name="level">
3810
+ <xsl:choose>
3811
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
3812
+ <xsl:value-of select="$level_total - 2"/>
3813
+ </xsl:when>
3814
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
3815
+ <xsl:value-of select="$level_total - 2"/>
3816
+ </xsl:when>
3817
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
3818
+ <xsl:value-of select="$level_total - 2"/>
3819
+ </xsl:when>
3820
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
3821
+ <xsl:otherwise>
3822
+ <xsl:value-of select="$level_total - 1"/>
3823
+ </xsl:otherwise>
3824
+ </xsl:choose>
3825
+ </xsl:variable>
3826
+ <xsl:value-of select="$level"/>
3827
+ </xsl:template><xsl:template name="getSubSection">
3828
+ <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']"/>
3829
+ </xsl:template><xsl:template name="split">
3830
+ <xsl:param name="pText" select="."/>
3831
+ <xsl:param name="sep" select="','"/>
3832
+ <xsl:if test="string-length($pText) &gt;0">
3833
+ <item>
3834
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
3835
+ </item>
3836
+ <xsl:call-template name="split">
3837
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
3838
+ <xsl:with-param name="sep" select="$sep"/>
3839
+ </xsl:call-template>
3840
+ </xsl:if>
3841
+ </xsl:template><xsl:template name="getDocumentId">
3842
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3225
3843
  </xsl:template></xsl:stylesheet>