metanorma-ogc 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -0
  3. data/.github/workflows/ubuntu.yml +10 -0
  4. data/.github/workflows/windows.yml +8 -0
  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 +12 -24
  8. data/lib/asciidoctor/ogc/isodoc.rng +450 -4
  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 +0 -4
  16. data/lib/isodoc/ogc/metadata.rb +0 -8
  17. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +3843 -0
  18. data/lib/isodoc/ogc/ogc.best-practice.xsl +3843 -0
  19. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +3843 -0
  20. data/lib/isodoc/ogc/ogc.community-practice.xsl +3843 -0
  21. data/lib/isodoc/ogc/ogc.community-standard.xsl +1194 -491
  22. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +3843 -0
  23. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1194 -491
  24. data/lib/isodoc/ogc/ogc.other.xsl +1194 -491
  25. data/lib/isodoc/ogc/ogc.policy.xsl +1194 -491
  26. data/lib/isodoc/ogc/ogc.reference-model.xsl +1194 -491
  27. data/lib/isodoc/ogc/ogc.release-notes.xsl +1194 -491
  28. data/lib/isodoc/ogc/ogc.standard.xsl +1194 -491
  29. data/lib/isodoc/ogc/ogc.test-suite.xsl +1194 -491
  30. data/lib/isodoc/ogc/ogc.user-guide.xsl +1194 -491
  31. data/lib/isodoc/ogc/ogc.white-paper.xsl +3843 -0
  32. data/lib/isodoc/ogc/pdf_convert.rb +6 -15
  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 +3 -12
  37. data/lib/isodoc/ogc/xref.rb +158 -0
  38. data/lib/metanorma/ogc/processor.rb +12 -6
  39. data/lib/metanorma/ogc/version.rb +1 -1
  40. data/metanorma-ogc.gemspec +2 -2
  41. metadata +18 -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
 
@@ -6,6 +6,8 @@
6
6
  <xsl:variable name="pageHeight" select="'297mm'"/>
7
7
 
8
8
 
9
+
10
+ <xsl:variable name="debug">false</xsl:variable>
9
11
 
10
12
  <xsl:variable name="copyright">
11
13
  <xsl:text>© Open Geospatial Consortium </xsl:text>
@@ -159,51 +161,7 @@
159
161
 
160
162
  </fo:layout-master-set>
161
163
 
162
- <fo:declarations>
163
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
164
- <pdf:dictionary type="normal" key="ViewerPreferences">
165
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
166
- </pdf:dictionary>
167
- </pdf:catalog>
168
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
169
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
170
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
171
- <!-- Dublin Core properties go here -->
172
- <dc:title>
173
- <xsl:choose>
174
- <xsl:when test="$doctitle != ''">
175
- <xsl:value-of select="$doctitle"/>
176
- </xsl:when>
177
- <xsl:otherwise>
178
- <xsl:text> </xsl:text>
179
- </xsl:otherwise>
180
- </xsl:choose>
181
- </dc:title>
182
- <dc:creator/>
183
- <dc:description>
184
- <xsl:variable name="abstract">
185
- <xsl:copy-of select="/ogc:ogc-standard/ogc:bibdata/ogc:abstract//text()"/>
186
- </xsl:variable>
187
- <xsl:value-of select="normalize-space($abstract)"/>
188
- </dc:description>
189
- <pdf:Keywords>
190
- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata//ogc:keyword">
191
- <xsl:sort data-type="text" order="ascending"/>
192
- <xsl:apply-templates/>
193
- <xsl:choose>
194
- <xsl:when test="position() != last()">, </xsl:when>
195
- <xsl:otherwise>.</xsl:otherwise>
196
- </xsl:choose>
197
- </xsl:for-each>
198
- </pdf:Keywords>
199
- </rdf:Description>
200
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
201
- <!-- XMP properties go here -->
202
- <xmp:CreatorTool/>
203
- </rdf:Description>
204
- </rdf:RDF>
205
- </x:xmpmeta>
206
- </fo:declarations>
164
+ <xsl:call-template name="addPDFUAmeta"/>
207
165
 
208
166
  <!-- Cover Page -->
209
167
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -307,8 +265,9 @@
307
265
  <fo:table-cell>
308
266
  <fo:block>
309
267
  <xsl:variable name="stage" select="/ogc:ogc-standard/ogc:bibdata/ogc:status/ogc:stage"/>
310
- <xsl:value-of select="translate(substring($stage, 1, 1), $lower, $upper)"/>
311
- <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>
312
271
  </fo:block>
313
272
  </fo:table-cell>
314
273
  </fo:table-row>
@@ -338,10 +297,13 @@
338
297
  </fo:static-content>
339
298
  <xsl:call-template name="insertHeaderFooter"/>
340
299
  <fo:flow flow-name="xsl-region-body">
341
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
342
- DEBUG
343
- contents=<!-- <xsl:copy-of select="xalan:nodeset($contents)"/> -->
344
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
300
+
301
+ <xsl:if test="$debug = 'true'">
302
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
303
+ DEBUG
304
+ contents=<!-- <xsl:copy-of select="xalan:nodeset($contents)"/> -->
305
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
306
+ </xsl:if>
345
307
 
346
308
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:license-statement"/>
347
309
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:feedback-statement"/>
@@ -351,7 +313,12 @@
351
313
  <fo:block break-after="page"/>
352
314
 
353
315
  <fo:block-container font-weight="bold" line-height="115%">
354
- <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>
355
322
 
356
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'))] -->
357
324
 
@@ -400,7 +367,12 @@
400
367
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
401
368
  <fo:block font-size="12pt"> </fo:block>
402
369
  <fo:block font-size="12pt"> </fo:block>
403
- <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>
404
376
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table']">
405
377
  <fo:block text-align-last="justify" margin-top="6pt">
406
378
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -422,7 +394,12 @@
422
394
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
423
395
  <fo:block font-size="12pt"> </fo:block>
424
396
  <fo:block font-size="12pt"> </fo:block>
425
- <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>
426
403
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
427
404
  <fo:block text-align-last="justify" margin-top="6pt">
428
405
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -666,7 +643,9 @@
666
643
  <xsl:choose>
667
644
  <xsl:when test="not(ogc:title)">
668
645
  <xsl:variable name="name" select="local-name()"/>
669
- <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>
670
649
  </xsl:when>
671
650
  <xsl:otherwise>
672
651
  <xsl:value-of select="ogc:title"/>
@@ -686,7 +665,12 @@
686
665
  <xsl:number format="i" value="$sectionNum"/>
687
666
  </xsl:variable>
688
667
  <item id="keywords" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
689
- <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"/>
690
674
  </item>
691
675
  </xsl:template>
692
676
  <!-- Submitting Organizations -->
@@ -696,7 +680,12 @@
696
680
  <xsl:number format="i" value="$sectionNum"/>
697
681
  </xsl:variable>
698
682
  <item id="submitting_orgs" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
699
- <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"/>
700
689
  </item>
701
690
  </xsl:template>
702
691
 
@@ -704,7 +693,12 @@
704
693
  <xsl:param name="sectionNum"/>
705
694
  <item level="" id="{@id}" type="figure">
706
695
  <xsl:attribute name="section">
707
- <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"/>
708
702
  <xsl:choose>
709
703
  <xsl:when test="ancestor::ogc:annex">
710
704
  <xsl:choose>
@@ -739,7 +733,12 @@
739
733
  <xsl:variable name="annex-id" select="ancestor::ogc:annex/@id"/>
740
734
  <item level="" id="{@id}" display="false" type="table">
741
735
  <xsl:attribute name="section">
742
- <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"/>
743
742
  <xsl:choose>
744
743
  <xsl:when test="ancestor::*[local-name()='executivesummary']">
745
744
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered='true')]"/>
@@ -762,7 +761,12 @@
762
761
  <xsl:template match="ogc:formula" mode="contents">
763
762
  <item level="" id="{@id}" display="false">
764
763
  <xsl:attribute name="section">
765
- <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"/>
766
770
  </xsl:attribute>
767
771
  </item>
768
772
  </xsl:template>
@@ -780,7 +784,12 @@
780
784
 
781
785
  <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
782
786
  <fo:block margin-bottom="12pt">
783
- <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>
784
793
  <xsl:value-of select="."/><xsl:text> </xsl:text>
785
794
  </fo:block>
786
795
  </xsl:template>
@@ -894,7 +903,9 @@
894
903
  <fo:block id="{$id}" font-size="13pt" font-weight="bold" margin-bottom="12pt" color="rgb(14, 26, 133)">
895
904
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
896
905
  <xsl:variable name="name" select="local-name()"/>
897
- <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>
898
909
  </fo:block>
899
910
  </xsl:if>
900
911
  <xsl:apply-templates/>
@@ -904,14 +915,23 @@
904
915
  <xsl:param name="sectionNum" select="'1'"/>
905
916
  <fo:block id="keywords" font-size="13pt" font-weight="bold" margin-top="13.5pt" margin-bottom="12pt" color="rgb(14, 26, 133)">
906
917
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="2mm"> </fo:inline>
907
- <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"/>
908
924
  </fo:block>
909
925
  <fo:block margin-bottom="12pt">The following are keywords to be used by search engines and document catalogues.</fo:block>
910
926
  <fo:block margin-bottom="12pt">
911
- <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">
912
932
  <xsl:value-of select="."/>
913
933
  <xsl:if test="position() != last()">, </xsl:if>
914
- </xsl:for-each>
934
+ </xsl:for-each> -->
915
935
  </fo:block>
916
936
  </xsl:template>
917
937
  <!-- Submitting Organizations -->
@@ -919,7 +939,12 @@
919
939
  <xsl:param name="sectionNum" select="'1'"/>
920
940
  <fo:block id="submitting_orgs" font-size="13pt" font-weight="bold" color="rgb(14, 26, 133)" margin-top="13.5pt" margin-bottom="12pt">
921
941
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
922
- <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"/>
923
948
  </fo:block>
924
949
  <fo:block margin-bottom="12pt">The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</fo:block>
925
950
  <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
@@ -1112,10 +1137,13 @@
1112
1137
  </xsl:attribute>
1113
1138
  <xsl:attribute name="space-after">
1114
1139
  <xsl:choose>
1115
- <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1140
+ <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1116
1141
  <xsl:otherwise>12pt</xsl:otherwise>
1117
1142
  </xsl:choose>
1118
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>
1119
1147
  <xsl:attribute name="line-height">115%</xsl:attribute>
1120
1148
  <xsl:apply-templates/>
1121
1149
  </xsl:element>
@@ -1137,7 +1165,7 @@
1137
1165
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1138
1166
  </fn>
1139
1167
  -->
1140
- <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">
1141
1169
  <fo:footnote keep-with-previous.within-line="always">
1142
1170
  <xsl:variable name="number" select="@reference"/>
1143
1171
 
@@ -1183,10 +1211,6 @@
1183
1211
  </xsl:template>
1184
1212
 
1185
1213
  <xsl:template match="ogc:figure">
1186
- <xsl:variable name="title">
1187
- <xsl:text>Figure </xsl:text>
1188
- </xsl:variable>
1189
-
1190
1214
  <fo:block-container id="{@id}">
1191
1215
  <fo:block>
1192
1216
  <xsl:apply-templates/>
@@ -1196,7 +1220,11 @@
1196
1220
  <xsl:call-template name="note"/>
1197
1221
  </xsl:for-each>
1198
1222
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="6pt" keep-with-previous="always">
1199
-
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>
1200
1228
  <xsl:choose>
1201
1229
  <xsl:when test="ancestor::ogc:annex">
1202
1230
  <xsl:choose>
@@ -1204,13 +1232,13 @@
1204
1232
  <xsl:number format="a) "/>
1205
1233
  </xsl:when>
1206
1234
  <xsl:otherwise>
1207
- <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"/>
1208
1236
  </xsl:otherwise>
1209
1237
  </xsl:choose>
1210
1238
 
1211
1239
  </xsl:when>
1212
1240
  <xsl:otherwise>
1213
- <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"/>
1214
1242
  </xsl:otherwise>
1215
1243
  </xsl:choose>
1216
1244
  <xsl:if test="ogc:name">
@@ -1293,13 +1321,13 @@
1293
1321
  </xsl:choose>
1294
1322
  </xsl:variable>
1295
1323
  <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
1296
- <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}">
1297
1325
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1298
1326
  </fo:basic-link>
1299
1327
  </fo:inline>
1300
1328
  <fo:footnote-body>
1301
1329
  <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
1302
- <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" -->
1303
1331
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1304
1332
  </fo:inline>
1305
1333
  <xsl:apply-templates/>
@@ -1366,19 +1394,13 @@
1366
1394
  </fo:list-item>
1367
1395
  </xsl:template>
1368
1396
 
1369
- <xsl:template match="ogc:link">
1370
- <fo:inline>
1371
- <fo:basic-link external-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1372
- <xsl:choose>
1373
- <xsl:when test="normalize-space(.) = ''">
1374
- <xsl:value-of select="@target"/>
1375
- </xsl:when>
1376
- <xsl:otherwise>
1377
- <xsl:apply-templates/>
1378
- </xsl:otherwise>
1379
- </xsl:choose>
1380
- </fo:basic-link>
1381
- </fo:inline>
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>
1382
1404
  </xsl:template>
1383
1405
 
1384
1406
  <xsl:template match="ogc:preferred">
@@ -1399,7 +1421,7 @@
1399
1421
  </xsl:variable>
1400
1422
  <fo:block font-size="{$font-size}">
1401
1423
  <fo:block font-weight="bold" keep-with-next="always">
1402
- <fo:inline id="{../@id}">
1424
+ <fo:inline>
1403
1425
  <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1404
1426
  </fo:inline>
1405
1427
  </fo:block>
@@ -1416,7 +1438,12 @@
1416
1438
  </xsl:template>
1417
1439
 
1418
1440
  <xsl:template match="ogc:deprecates">
1419
- <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>
1420
1447
  </xsl:template>
1421
1448
 
1422
1449
  <xsl:template match="ogc:definition[preceding-sibling::ogc:domain]">
@@ -1437,12 +1464,19 @@
1437
1464
  <fo:block margin-bottom="12pt" keep-with-previous="always">
1438
1465
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1439
1466
  <fo:basic-link internal-destination="{ogc:origin/@bibitemid}" fox:alt-text="{ogc:origin/@citeas}">
1440
- <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>
1441
1475
  <fo:inline color="blue" text-decoration="underline">
1442
1476
  <xsl:value-of select="ogc:origin/@citeas"/>
1443
- <xsl:if test="ogc:origin/ogc:locality/ogc:referenceFrom">
1444
- <xsl:text>, </xsl:text><xsl:value-of select="ogc:origin/ogc:locality/ogc:referenceFrom"/>
1445
- </xsl:if>
1477
+
1478
+ <xsl:apply-templates select="ogc:origin/ogc:localityStack"/>
1479
+
1446
1480
  </fo:inline>
1447
1481
  </fo:basic-link>
1448
1482
  <xsl:apply-templates select="ogc:modification"/>
@@ -1450,19 +1484,20 @@
1450
1484
  </fo:block>
1451
1485
  </xsl:template>
1452
1486
 
1453
- <xsl:template match="ogc:modification">
1454
- <xsl:text>, modified — </xsl:text>
1455
- <xsl:apply-templates/>
1456
- </xsl:template>
1487
+
1457
1488
  <xsl:template match="ogc:modification/ogc:p">
1458
1489
  <fo:inline><xsl:apply-templates/></fo:inline>
1459
1490
  </xsl:template>
1460
1491
 
1461
1492
  <xsl:template match="ogc:termnote">
1462
1493
  <fo:block font-size="10pt" margin-bottom="12pt">
1463
- <xsl:text>Note </xsl:text>
1464
- <xsl:number/>
1465
- <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)"/>
1466
1501
  <xsl:apply-templates/>
1467
1502
  </fo:block>
1468
1503
  </xsl:template>
@@ -1478,7 +1513,12 @@
1478
1513
 
1479
1514
  <xsl:template match="ogc:termexample">
1480
1515
  <fo:block font-size="10pt" margin-bottom="12pt">
1481
- <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>
1482
1522
  <xsl:apply-templates/>
1483
1523
  </fo:block>
1484
1524
  </xsl:template>
@@ -1607,65 +1647,11 @@
1607
1647
 
1608
1648
  <xsl:template match="ogc:source">
1609
1649
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1610
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1611
- <xsl:if test="ogc:locality">
1612
- <xsl:text>, </xsl:text>
1613
- <xsl:apply-templates select="ogc:locality"/>
1614
- </xsl:if>
1650
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1651
+ <xsl:apply-templates select="ogc:localityStack"/>
1615
1652
  </fo:basic-link>
1616
1653
  </xsl:template>
1617
-
1618
- <xsl:template match="ogc:appendix">
1619
- <fo:block font-size="12pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1620
- <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
1621
- <xsl:apply-templates select="ogc:title" mode="process"/>
1622
- </fo:block>
1623
- <xsl:apply-templates/>
1624
- </xsl:template>
1625
-
1626
- <xsl:template match="ogc:appendix//ogc:example">
1627
- <fo:block font-size="10pt" margin-bottom="12pt">
1628
- <xsl:text>EXAMPLE</xsl:text>
1629
- <xsl:if test="ogc:name">
1630
- <xsl:text> — </xsl:text><xsl:apply-templates select="ogc:name" mode="process"/>
1631
- </xsl:if>
1632
- </fo:block>
1633
- <xsl:apply-templates/>
1634
- </xsl:template>
1635
-
1636
- <xsl:template match="ogc:appendix//ogc:example/ogc:name"/>
1637
- <xsl:template match="ogc:appendix//ogc:example/ogc:name" mode="process">
1638
- <fo:inline><xsl:apply-templates/></fo:inline>
1639
- </xsl:template>
1640
-
1641
- <xsl:template match="ogc:callout">
1642
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
1643
- </xsl:template>
1644
-
1645
- <xsl:template match="ogc:annotation">
1646
- <fo:block>
1647
-
1648
- </fo:block>
1649
- <xsl:apply-templates/>
1650
- </xsl:template>
1651
-
1652
- <xsl:template match="ogc:annotation/text()"/>
1653
-
1654
- <xsl:template match="ogc:annotation/ogc:p">
1655
- <xsl:variable name="annotation-id" select="../@id"/>
1656
- <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
1657
- <fo:block id="{$annotation-id}">
1658
- <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
1659
- <xsl:apply-templates/>
1660
- </fo:block>
1661
- </xsl:template>
1662
-
1663
-
1664
- <xsl:template match="ogc:appendix/ogc:title"/>
1665
- <xsl:template match="ogc:appendix/ogc:title" mode="process">
1666
- <fo:inline><xsl:apply-templates/></fo:inline>
1667
- </xsl:template>
1668
-
1654
+
1669
1655
 
1670
1656
  <xsl:template match="ogc:xref">
1671
1657
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
@@ -1676,6 +1662,17 @@
1676
1662
  <!-- </xsl:if> -->
1677
1663
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1678
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>
1679
1676
 
1680
1677
  <xsl:choose>
1681
1678
  <xsl:when test="normalize-space(.) != ''">
@@ -1683,9 +1680,9 @@
1683
1680
  </xsl:when>
1684
1681
  <xsl:otherwise>
1685
1682
  <xsl:choose>
1686
- <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1687
- <xsl:when test="$type = 'term' and ($root = 'clause' or $root = 'terms')">Clause </xsl:when>
1688
- <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>
1689
1686
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1690
1687
  </xsl:choose>
1691
1688
  <xsl:value-of select="$section"/>
@@ -1694,30 +1691,26 @@
1694
1691
  </fo:basic-link>
1695
1692
  </xsl:template>
1696
1693
 
1697
- <xsl:template match="ogc:sourcecode">
1698
- <fo:block font-family="Courier" font-size="10pt" margin-bottom="6pt" keep-with-next="always" line-height="113%">
1699
- <xsl:choose>
1700
- <xsl:when test="@lang = 'en'"/>
1701
- <xsl:otherwise>
1702
- <xsl:attribute name="white-space">pre</xsl:attribute>
1703
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1704
- </xsl:otherwise>
1705
- </xsl:choose>
1706
- <xsl:apply-templates/>
1707
- </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>
1708
1701
  <xsl:choose>
1709
1702
  <xsl:when test="@unnumbered='true'"/>
1710
1703
  <xsl:when test="ancestor::ogc:example"/>
1711
1704
  <xsl:when test="ancestor::ogc:td"/>
1712
1705
  <xsl:when test="ancestor::ogc:annex">
1713
- <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1706
+ <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1714
1707
  <xsl:choose>
1715
1708
  <xsl:when test="count(//ogc:annex) = 1">
1716
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"/>
1717
1710
  </xsl:when>
1718
1711
  <xsl:otherwise>
1719
1712
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1720
- <xsl:text>Figure </xsl:text>
1713
+ <xsl:value-of select="$title-figure"/>
1721
1714
  <xsl:number format="A." level="multiple" count="ogc:annex"/>
1722
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)]"/>
1723
1716
  <xsl:if test="ogc:name">
@@ -1730,7 +1723,7 @@
1730
1723
  </xsl:when>
1731
1724
  <xsl:otherwise>
1732
1725
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1733
- <xsl:text>Figure </xsl:text>
1726
+ <xsl:value-of select="$title-figure"/>
1734
1727
  <xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1735
1728
  <xsl:if test="ogc:name">
1736
1729
  <xsl:text> — </xsl:text>
@@ -1755,7 +1748,12 @@
1755
1748
 
1756
1749
  <xsl:template match="ogc:example">
1757
1750
  <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1758
- <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)"/>
1759
1757
  <xsl:if test="following-sibling::ogc:example or preceding-sibling::ogc:example">
1760
1758
  <xsl:number format=" 1"/>
1761
1759
  </xsl:if>
@@ -1786,7 +1784,12 @@
1786
1784
  </xsl:if>
1787
1785
  <xsl:variable name="clauseid" select="ancestor::ogc:clause[1]/@id"/>
1788
1786
  <fo:inline padding-right="4mm">
1789
- <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"/>
1790
1793
  <xsl:if test="count(//ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]) &gt; 1">
1791
1794
  <xsl:number count="ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]" level="any"/>
1792
1795
  </xsl:if>
@@ -1813,30 +1816,32 @@
1813
1816
  </xsl:if> -->
1814
1817
  <xsl:choose>
1815
1818
  <xsl:when test="@citeas and normalize-space(text()) = ''">
1816
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1819
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1817
1820
  </xsl:when>
1818
1821
  <xsl:when test="@bibitemid and normalize-space(text()) = ''">
1819
1822
  <xsl:value-of select="//ogc:bibitem[@id = current()/@bibitemid]/ogc:docidentifier"/>
1820
1823
  </xsl:when>
1821
1824
  <xsl:otherwise/>
1822
1825
  </xsl:choose>
1823
- <xsl:if test="ogc:locality">
1824
- <xsl:text>, </xsl:text>
1825
- <!-- <xsl:choose>
1826
- <xsl:when test="ogc:locality/@type = 'section'">Section </xsl:when>
1827
- <xsl:when test="ogc:locality/@type = 'clause'">Clause </xsl:when>
1828
- <xsl:otherwise></xsl:otherwise>
1829
- </xsl:choose> -->
1830
- <xsl:apply-templates select="ogc:locality"/>
1831
- </xsl:if>
1826
+ <xsl:apply-templates select="ogc:localityStack"/>
1832
1827
  <xsl:apply-templates select="text()"/>
1833
1828
  </fo:basic-link>
1834
1829
  </xsl:template>
1835
1830
 
1836
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>
1837
1842
  <xsl:choose>
1838
- <xsl:when test="@type ='clause'">Clause </xsl:when>
1839
- <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>
1840
1845
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1841
1846
  </xsl:choose>
1842
1847
  <xsl:text> </xsl:text><xsl:value-of select="ogc:referenceFrom"/>
@@ -1845,8 +1850,8 @@
1845
1850
  <xsl:template match="ogc:admonition">
1846
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">
1847
1852
  <fo:block-container margin-left="0mm" margin-right="0mm" padding="2mm" padding-top="3mm">
1848
- <fo:block font-size="11pt" margin-bottom="6pt" font-weight="bold" font-style="italic" text-align="center">
1849
- <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))"/>
1850
1855
  </fo:block>
1851
1856
  <fo:block font-style="italic">
1852
1857
  <xsl:apply-templates/>
@@ -1857,6 +1862,12 @@
1857
1862
 
1858
1863
  </xsl:template>
1859
1864
 
1865
+ <xsl:template match="ogc:formula">
1866
+ <fo:block id="{@id}">
1867
+ <xsl:apply-templates/>
1868
+ </fo:block>
1869
+ </xsl:template>
1870
+
1860
1871
  <xsl:template match="ogc:formula/ogc:dt/ogc:stem">
1861
1872
  <fo:inline>
1862
1873
  <xsl:apply-templates/>
@@ -1864,7 +1875,7 @@
1864
1875
  </xsl:template>
1865
1876
 
1866
1877
  <xsl:template match="ogc:formula/ogc:stem">
1867
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
1878
+ <fo:block margin-top="6pt" margin-bottom="12pt">
1868
1879
  <fo:table table-layout="fixed" width="100%">
1869
1880
  <fo:table-column column-width="95%"/>
1870
1881
  <fo:table-column column-width="5%"/>
@@ -1879,7 +1890,7 @@
1879
1890
  <fo:block text-align="right">
1880
1891
  <xsl:choose>
1881
1892
  <xsl:when test="ancestor::ogc:annex">
1882
- <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"/>
1883
1894
  </xsl:when>
1884
1895
  <xsl:otherwise> <!-- not(ancestor::ogc:annex) -->
1885
1896
  <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="ogc:formula"/><xsl:text>)</xsl:text> -->
@@ -1906,11 +1917,7 @@
1906
1917
  <fo:block> </fo:block>
1907
1918
  <fo:block break-after="page"/>
1908
1919
  </xsl:template>
1909
-
1910
- <xsl:template match="ogc:bookmark">
1911
- <fo:inline id="{@id}"/>
1912
- </xsl:template>
1913
-
1920
+
1914
1921
  <xsl:template name="insertHeaderFooter">
1915
1922
  <xsl:param name="pagenum-font-weight" select="'normal'"/>
1916
1923
  <fo:static-content flow-name="header-even">
@@ -1968,38 +1975,6 @@
1968
1975
  </fo:static-content>
1969
1976
  </xsl:template>
1970
1977
 
1971
- <xsl:template name="getId">
1972
- <xsl:choose>
1973
- <xsl:when test="../@id">
1974
- <xsl:value-of select="../@id"/>
1975
- </xsl:when>
1976
- <xsl:otherwise>
1977
- <xsl:value-of select="text()"/>
1978
- </xsl:otherwise>
1979
- </xsl:choose>
1980
- </xsl:template>
1981
-
1982
- <xsl:template name="getLevel">
1983
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1984
- <xsl:variable name="level">
1985
- <xsl:choose>
1986
- <xsl:when test="ancestor::ogc:preface">
1987
- <xsl:value-of select="$level_total - 2"/>
1988
- </xsl:when>
1989
- <xsl:when test="ancestor::ogc:sections">
1990
- <xsl:value-of select="$level_total - 2"/>
1991
- </xsl:when>
1992
- <xsl:when test="ancestor::ogc:bibliography">
1993
- <xsl:value-of select="$level_total - 2"/>
1994
- </xsl:when>
1995
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1996
- <xsl:otherwise>
1997
- <xsl:value-of select="$level_total - 1"/>
1998
- </xsl:otherwise>
1999
- </xsl:choose>
2000
- </xsl:variable>
2001
- <xsl:value-of select="$level"/>
2002
- </xsl:template>
2003
1978
 
2004
1979
  <xsl:template name="getSection">
2005
1980
  <xsl:param name="sectionNum"/>
@@ -2019,7 +1994,7 @@
2019
1994
  </xsl:when>
2020
1995
  <xsl:when test="$level &gt;= 2">
2021
1996
  <xsl:variable name="num">
2022
- <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"/>
2023
1998
  </xsl:variable>
2024
1999
  <xsl:value-of select="concat($sectionNum, $num)"/>
2025
2000
  </xsl:when>
@@ -2043,7 +2018,12 @@
2043
2018
  <xsl:when test="ancestor::ogc:annex">
2044
2019
  <xsl:choose>
2045
2020
  <xsl:when test="$level = 1">
2046
- <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"/>
2047
2027
  <xsl:choose>
2048
2028
  <xsl:when test="count(//ogc:annex) = 1">
2049
2029
  <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/>
@@ -2086,119 +2066,328 @@
2086
2066
  <xsl:value-of select="$section"/>
2087
2067
  </xsl:template>
2088
2068
 
2089
- <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:template xmlns: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()">
2090
- <xsl:value-of select="."/>
2091
- </xsl:template><xsl:template xmlns: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']">
2092
- <xsl:value-of select="$linebreak"/>
2093
- </xsl:template><xsl:template xmlns: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()" priority="1">
2094
- <xsl:call-template name="add-zero-spaces"/>
2095
- </xsl:template><xsl:template xmlns: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']">
2096
-
2097
- <xsl:variable name="simple-table">
2098
- <!-- <xsl:copy> -->
2099
- <xsl:call-template name="getSimpleTable"/>
2100
- <!-- </xsl:copy> -->
2101
- </xsl:variable>
2102
-
2103
- <!-- DEBUG -->
2104
- <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2105
- <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
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
+
2106
2077
 
2107
- <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2078
+ <title-note lang="en">NOTE </title-note>
2079
+ <title-note lang="fr">NOTE </title-note>
2108
2080
 
2081
+ <title-note lang="zh">NOTE </title-note>
2109
2082
 
2110
2083
 
2111
- <xsl:choose>
2112
- <xsl:when test="@unnumbered = 'true'"/>
2113
- <xsl:otherwise>
2114
-
2115
-
2116
-
2117
- <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2118
-
2119
-
2120
-
2121
-
2122
-
2123
- <xsl:attribute name="font-weight">normal</xsl:attribute>
2124
- <xsl:attribute name="font-size">11pt</xsl:attribute>
2125
-
2126
- <xsl:text>Table </xsl:text>
2127
- <xsl:choose>
2128
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2129
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2130
- </xsl:when>
2131
- <xsl:when test="ancestor::*[local-name()='annex']">
2132
-
2133
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2134
-
2135
-
2136
-
2137
-
2138
-
2139
-
2140
- </xsl:when>
2141
- <xsl:otherwise>
2142
-
2143
-
2144
- <xsl:number format="A." count="*[local-name()='annex']"/>
2145
- <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']"/>
2146
-
2147
- </xsl:otherwise>
2148
- </xsl:choose>
2149
- <xsl:if test="*[local-name()='name']">
2150
-
2151
-
2152
-
2153
- <xsl:text> — </xsl:text>
2154
-
2155
- <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
2156
- </xsl:if>
2157
- </fo:block>
2158
-
2159
-
2160
- <xsl:call-template name="fn_name_display"/>
2161
-
2162
- </xsl:otherwise>
2163
- </xsl:choose>
2164
2084
 
2165
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2085
+ <title-figure lang="en">Figure </title-figure>
2086
+ <title-figure lang="fr">Figure </title-figure>
2166
2087
 
2167
- <!-- <xsl:variable name="cols-count">
2168
- <xsl:choose>
2169
- <xsl:when test="*[local-name()='thead']">
2170
- <xsl:call-template name="calculate-columns-numbers">
2171
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2172
- </xsl:call-template>
2173
- </xsl:when>
2174
- <xsl:otherwise>
2175
- <xsl:call-template name="calculate-columns-numbers">
2176
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2177
- </xsl:call-template>
2178
- </xsl:otherwise>
2179
- </xsl:choose>
2180
- </xsl:variable> -->
2181
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2182
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2088
+ <title-figure lang="zh">Figure </title-figure>
2183
2089
 
2184
2090
 
2185
2091
 
2186
- <xsl:variable name="colwidths">
2187
- <xsl:call-template name="calculate-column-widths">
2188
- <xsl:with-param name="cols-count" select="$cols-count"/>
2189
- <xsl:with-param name="table" select="$simple-table"/>
2190
- </xsl:call-template>
2191
- </xsl:variable>
2092
+ <title-example lang="en">EXAMPLE </title-example>
2093
+ <title-example lang="fr">EXEMPLE </title-example>
2192
2094
 
2193
- <xsl:variable name="colwidths2">
2194
- <xsl:call-template name="calculate-column-widths">
2195
- <xsl:with-param name="cols-count" select="$cols-count"/>
2196
- </xsl:call-template>
2197
- </xsl:variable>
2095
+ <title-example lang="zh">EXAMPLE </title-example>
2198
2096
 
2199
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2200
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2201
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
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">
2248
+
2249
+ <xsl:attribute name="color">blue</xsl:attribute>
2250
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2251
+
2252
+
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()">
2286
+ <xsl:value-of select="."/>
2287
+ </xsl:template><xsl:template match="*[local-name()='br']">
2288
+ <xsl:value-of select="$linebreak"/>
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']">
2293
+
2294
+ <xsl:variable name="simple-table">
2295
+ <!-- <xsl:copy> -->
2296
+ <xsl:call-template name="getSimpleTable"/>
2297
+ <!-- </xsl:copy> -->
2298
+ </xsl:variable>
2299
+
2300
+ <!-- DEBUG -->
2301
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2302
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2303
+
2304
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2305
+
2306
+ <!-- <xsl:if test="$namespace = 'iso'">
2307
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2308
+ </xsl:if> -->
2309
+
2310
+ <xsl:choose>
2311
+ <xsl:when test="@unnumbered = 'true'"/>
2312
+ <xsl:otherwise>
2313
+
2314
+
2315
+
2316
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2317
+
2318
+
2319
+
2320
+
2321
+
2322
+
2323
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2324
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
2325
+
2326
+
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
+
2338
+ <xsl:if test="*[local-name()='name']">
2339
+
2340
+
2341
+
2342
+ <xsl:text> — </xsl:text>
2343
+
2344
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
2345
+ </xsl:if>
2346
+ </fo:block>
2347
+
2348
+
2349
+ <xsl:call-template name="fn_name_display"/>
2350
+
2351
+ </xsl:otherwise>
2352
+ </xsl:choose>
2353
+
2354
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2355
+
2356
+ <!-- <xsl:variable name="cols-count">
2357
+ <xsl:choose>
2358
+ <xsl:when test="*[local-name()='thead']">
2359
+ <xsl:call-template name="calculate-columns-numbers">
2360
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2361
+ </xsl:call-template>
2362
+ </xsl:when>
2363
+ <xsl:otherwise>
2364
+ <xsl:call-template name="calculate-columns-numbers">
2365
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2366
+ </xsl:call-template>
2367
+ </xsl:otherwise>
2368
+ </xsl:choose>
2369
+ </xsl:variable> -->
2370
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2371
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2372
+
2373
+
2374
+
2375
+ <xsl:variable name="colwidths">
2376
+ <xsl:call-template name="calculate-column-widths">
2377
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2378
+ <xsl:with-param name="table" select="$simple-table"/>
2379
+ </xsl:call-template>
2380
+ </xsl:variable>
2381
+
2382
+ <!-- <xsl:variable name="colwidths2">
2383
+ <xsl:call-template name="calculate-column-widths">
2384
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2385
+ </xsl:call-template>
2386
+ </xsl:variable> -->
2387
+
2388
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2389
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2390
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2202
2391
 
2203
2392
  <xsl:variable name="margin-left">
2204
2393
  <xsl:choose>
@@ -2218,7 +2407,10 @@
2218
2407
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
2219
2408
  <xsl:attribute name="space-after">12pt</xsl:attribute>
2220
2409
 
2221
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
2410
+
2411
+
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">
2413
+
2222
2414
 
2223
2415
 
2224
2416
 
@@ -2233,9 +2425,10 @@
2233
2425
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2234
2426
 
2235
2427
 
2428
+
2236
2429
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2237
2430
  <xsl:choose>
2238
- <xsl:when test=". = 1">
2431
+ <xsl:when test=". = 1 or . = 0">
2239
2432
  <fo:table-column column-width="proportional-column-width(2)"/>
2240
2433
  </xsl:when>
2241
2434
  <xsl:otherwise>
@@ -2243,18 +2436,55 @@
2243
2436
  </xsl:otherwise>
2244
2437
  </xsl:choose>
2245
2438
  </xsl:for-each>
2246
- <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
+
2247
2449
  </fo:table>
2450
+
2451
+
2452
+
2248
2453
  </fo:block-container>
2249
- </xsl:template><xsl:template xmlns: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">
2250
2480
  <xsl:apply-templates/>
2251
- </xsl:template><xsl:template xmlns: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">
2252
2482
  <xsl:param name="table-row"/>
2253
2483
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2254
2484
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2255
2485
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2256
2486
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2257
- </xsl:template><xsl:template xmlns: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">
2258
2488
  <xsl:param name="table"/>
2259
2489
  <xsl:param name="cols-count"/>
2260
2490
  <xsl:param name="curr-col" select="1"/>
@@ -2263,7 +2493,7 @@
2263
2493
  <xsl:if test="$curr-col &lt;= $cols-count">
2264
2494
  <xsl:variable name="widths">
2265
2495
  <xsl:choose>
2266
- <xsl:when test="not($table)">
2496
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2267
2497
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2268
2498
  <xsl:variable name="words">
2269
2499
  <xsl:call-template name="tokenize">
@@ -2298,9 +2528,20 @@
2298
2528
  </xsl:when>
2299
2529
  <xsl:otherwise>
2300
2530
  <xsl:for-each select="xalan:nodeset($table)//tr">
2531
+ <xsl:variable name="td_text">
2532
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
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
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
2541
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
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, '​', ' '))"/>
2304
2545
  </xsl:call-template>
2305
2546
  </xsl:variable>
2306
2547
  <xsl:variable name="max_length">
@@ -2341,59 +2582,98 @@
2341
2582
  <xsl:with-param name="table" select="$table"/>
2342
2583
  </xsl:call-template>
2343
2584
  </xsl:if>
2344
- </xsl:template><xsl:template xmlns: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">
2345
- <!-- <fo:table-header font-weight="bold">
2346
- <xsl:apply-templates />
2347
- </fo:table-header> -->
2348
- <xsl:apply-templates/>
2349
- </xsl:template><xsl:template xmlns: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">
2585
+ </xsl:template><xsl:template match="text()" mode="td_text">
2586
+ <xsl:variable name="zero-space">​</xsl:variable>
2587
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
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"/>
2594
+ <!-- font-weight="bold" -->
2595
+ <fo:table-header>
2596
+
2597
+ <xsl:apply-templates/>
2598
+ </fo:table-header>
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">
2350
2604
  <xsl:apply-templates/>
2351
- </xsl:template><xsl:template xmlns: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']">
2605
+ </xsl:template><xsl:template name="insertTableFooter">
2606
+ <xsl:param name="cols-count"/>
2607
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2608
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2609
+
2610
+ <fo:table-footer>
2611
+
2612
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2613
+
2614
+ <!-- if there are note(s) or fn(s) then create footer row -->
2615
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2616
+
2617
+
2618
+
2619
+ <fo:table-row>
2620
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2621
+
2622
+
2623
+
2624
+ <!-- fn will be processed inside 'note' processing -->
2625
+
2626
+
2627
+ <!-- except gb -->
2628
+
2629
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2630
+
2631
+
2632
+ <!-- horizontal row separator -->
2633
+
2634
+
2635
+ <!-- fn processing -->
2636
+ <xsl:call-template name="fn_display"/>
2637
+
2638
+ </fo:table-cell>
2639
+ </fo:table-row>
2640
+
2641
+ </xsl:if>
2642
+ </fo:table-footer>
2643
+
2644
+ </xsl:if>
2645
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2646
+
2352
2647
  <xsl:variable name="cols-count">
2353
2648
  <xsl:choose>
2354
- <xsl:when test="../*[local-name()='thead']">
2355
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2649
+ <xsl:when test="../*[local-name()='thead']">
2356
2650
  <xsl:call-template name="calculate-columns-numbers">
2357
2651
  <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2358
2652
  </xsl:call-template>
2359
2653
  </xsl:when>
2360
- <xsl:otherwise>
2361
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2654
+ <xsl:otherwise>
2362
2655
  <xsl:call-template name="calculate-columns-numbers">
2363
2656
  <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2364
2657
  </xsl:call-template>
2365
2658
  </xsl:otherwise>
2366
2659
  </xsl:choose>
2367
2660
  </xsl:variable>
2368
-
2661
+
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>
2669
+
2369
2670
  <fo:table-body>
2370
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
2371
2671
  <xsl:apply-templates/>
2372
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2373
- <!-- if there are note(s) or fn(s) then create footer row -->
2374
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
2375
- <fo:table-row>
2376
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2377
-
2378
-
2379
-
2380
- <!-- fn will be processed inside 'note' processing -->
2381
-
2382
-
2383
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2384
-
2385
- <!-- horizontal row separator -->
2386
-
2387
-
2388
- <!-- fn processing -->
2389
- <xsl:call-template name="fn_display"/>
2390
-
2391
- </fo:table-cell>
2392
- </fo:table-row>
2393
-
2394
- </xsl:if>
2672
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
2673
+
2395
2674
  </fo:table-body>
2396
- </xsl:template><xsl:template xmlns: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']">
2675
+
2676
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2397
2677
  <xsl:variable name="parent-name" select="local-name(..)"/>
2398
2678
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2399
2679
  <fo:table-row min-height="4mm">
@@ -2410,9 +2690,10 @@
2410
2690
 
2411
2691
  </xsl:if>
2412
2692
 
2693
+
2413
2694
  <xsl:apply-templates/>
2414
2695
  </fo:table-row>
2415
- </xsl:template><xsl:template xmlns: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']">
2416
2697
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2417
2698
 
2418
2699
 
@@ -2435,7 +2716,7 @@
2435
2716
  <xsl:apply-templates/>
2436
2717
  </fo:block>
2437
2718
  </fo:table-cell>
2438
- </xsl:template><xsl:template xmlns: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']">
2439
2720
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2440
2721
 
2441
2722
 
@@ -2444,6 +2725,8 @@
2444
2725
 
2445
2726
 
2446
2727
 
2728
+
2729
+
2447
2730
  <xsl:if test="@colspan">
2448
2731
  <xsl:attribute name="number-columns-spanned">
2449
2732
  <xsl:value-of select="@colspan"/>
@@ -2455,6 +2738,7 @@
2455
2738
  </xsl:attribute>
2456
2739
  </xsl:if>
2457
2740
  <fo:block>
2741
+
2458
2742
  <xsl:apply-templates/>
2459
2743
  </fo:block>
2460
2744
  <!-- <xsl:choose>
@@ -2470,28 +2754,39 @@
2470
2754
 
2471
2755
 
2472
2756
  </fo:table-cell>
2473
- </xsl:template><xsl:template xmlns: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">
2474
2758
 
2475
2759
 
2476
2760
  <fo:block font-size="10pt" margin-bottom="12pt">
2477
2761
 
2478
2762
 
2763
+
2764
+
2479
2765
  <fo:inline padding-right="2mm">
2480
- <xsl:text>NOTE </xsl:text>
2766
+
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"/>
2481
2774
 
2482
2775
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2483
2776
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
2484
2777
  <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
2485
2778
  </xsl:if>
2779
+
2780
+
2486
2781
 
2487
2782
 
2488
2783
  </fo:inline>
2489
2784
  <xsl:apply-templates mode="process"/>
2490
2785
  </fo:block>
2491
2786
 
2492
- </xsl:template><xsl:template xmlns: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">
2493
2788
  <xsl:apply-templates/>
2494
- </xsl:template><xsl:template xmlns: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">
2495
2790
  <xsl:variable name="references">
2496
2791
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2497
2792
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2513,6 +2808,8 @@
2513
2808
  <fo:block margin-bottom="12pt">
2514
2809
 
2515
2810
 
2811
+
2812
+
2516
2813
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2517
2814
 
2518
2815
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2521,6 +2818,7 @@
2521
2818
 
2522
2819
 
2523
2820
 
2821
+
2524
2822
  <xsl:value-of select="@reference"/>
2525
2823
 
2526
2824
  </fo:inline>
@@ -2531,7 +2829,7 @@
2531
2829
  </fo:block>
2532
2830
  </xsl:if>
2533
2831
  </xsl:for-each>
2534
- </xsl:template><xsl:template xmlns: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">
2535
2833
  <!-- <xsl:variable name="references">
2536
2834
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2537
2835
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2547,7 +2845,7 @@
2547
2845
  <xsl:apply-templates/>
2548
2846
  </fo:block>
2549
2847
  </xsl:for-each>
2550
- </xsl:template><xsl:template xmlns: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">
2551
2849
  <xsl:variable name="key_iso">
2552
2850
  <!-- and (not(@class) or @class !='pseudocode') -->
2553
2851
  </xsl:variable>
@@ -2558,6 +2856,36 @@
2558
2856
  </fn>
2559
2857
  </xsl:for-each>
2560
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
+
2561
2889
  <xsl:if test="xalan:nodeset($references)//fn">
2562
2890
  <fo:block>
2563
2891
  <fo:table width="95%" table-layout="fixed">
@@ -2565,8 +2893,19 @@
2565
2893
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2566
2894
 
2567
2895
  </xsl:if>
2568
- <fo:table-column column-width="15%"/>
2569
- <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>
2570
2909
  <fo:table-body>
2571
2910
  <xsl:for-each select="xalan:nodeset($references)//fn">
2572
2911
  <xsl:variable name="reference" select="@reference"/>
@@ -2598,11 +2937,12 @@
2598
2937
  </fo:block>
2599
2938
  </xsl:if>
2600
2939
 
2601
- </xsl:template><xsl:template xmlns: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']">
2602
2941
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2603
2942
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
2604
2943
 
2605
2944
 
2945
+
2606
2946
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2607
2947
  <xsl:attribute name="color">blue</xsl:attribute>
2608
2948
 
@@ -2619,11 +2959,11 @@
2619
2959
  <xsl:value-of select="@reference"/>
2620
2960
  </fo:basic-link>
2621
2961
  </fo:inline>
2622
- </xsl:template><xsl:template xmlns: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']">
2623
2963
  <fo:inline>
2624
2964
  <xsl:apply-templates/>
2625
2965
  </fo:inline>
2626
- </xsl:template><xsl:template xmlns: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']">
2627
2967
  <xsl:variable name="parent" select="local-name(..)"/>
2628
2968
 
2629
2969
  <xsl:variable name="key_iso">
@@ -2636,7 +2976,12 @@
2636
2976
 
2637
2977
  <fo:block margin-bottom="12pt" text-align="left">
2638
2978
 
2639
- <xsl:text>where </xsl:text>
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>
2640
2985
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
2641
2986
  <xsl:text/>
2642
2987
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -2648,14 +2993,26 @@
2648
2993
 
2649
2994
 
2650
2995
 
2651
- <xsl:text>where</xsl:text>
2996
+
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"/>
2652
3003
  </fo:block>
2653
3004
  </xsl:when>
2654
3005
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2655
- <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">
3007
+
2656
3008
 
2657
3009
 
2658
- <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"/>
2659
3016
  </fo:block>
2660
3017
  </xsl:when>
2661
3018
  </xsl:choose>
@@ -2669,25 +3026,11 @@
2669
3026
 
2670
3027
  <fo:block>
2671
3028
 
2672
- <!-- create virtual html table for dl/[dt and dd] -->
2673
- <xsl:variable name="html-table">
2674
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2675
- <xsl:element name="{$ns}:table">
2676
- <tbody>
2677
- <xsl:apply-templates mode="dl"/>
2678
- </tbody>
2679
- </xsl:element>
2680
- </xsl:variable>
2681
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
2682
- <xsl:variable name="colwidths">
2683
- <xsl:call-template name="calculate-column-widths">
2684
- <xsl:with-param name="cols-count" select="2"/>
2685
- <xsl:with-param name="table" select="$html-table"/>
2686
- </xsl:call-template>
2687
- </xsl:variable>
2688
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3029
+
3030
+
2689
3031
 
2690
3032
  <fo:table width="95%" table-layout="fixed">
3033
+
2691
3034
  <xsl:choose>
2692
3035
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2693
3036
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -2697,42 +3040,30 @@
2697
3040
 
2698
3041
  </xsl:when>
2699
3042
  </xsl:choose>
2700
- <xsl:choose>
2701
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2702
- <fo:table-column column-width="50%"/>
2703
- <fo:table-column column-width="50%"/>
2704
- </xsl:when>
2705
- <xsl:otherwise>
2706
- <xsl:choose>
2707
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2708
- <fo:table-column column-width="60%"/>
2709
- <fo:table-column column-width="40%"/>
2710
- </xsl:when> -->
2711
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2712
- <fo:table-column column-width="50%"/>
2713
- <fo:table-column column-width="50%"/>
2714
- </xsl:when>
2715
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2716
- <fo:table-column column-width="40%"/>
2717
- <fo:table-column column-width="60%"/>
2718
- </xsl:when>
2719
- <xsl:otherwise>
2720
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2721
- <xsl:choose>
2722
- <xsl:when test=". = 1">
2723
- <fo:table-column column-width="proportional-column-width(2)"/>
2724
- </xsl:when>
2725
- <xsl:otherwise>
2726
- <fo:table-column column-width="proportional-column-width({.})"/>
2727
- </xsl:otherwise>
2728
- </xsl:choose>
2729
- </xsl:for-each>
2730
- </xsl:otherwise>
2731
- </xsl:choose>
2732
- <!-- <fo:table-column column-width="15%"/>
2733
- <fo:table-column column-width="85%"/> -->
2734
- </xsl:otherwise>
2735
- </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>
2736
3067
  <fo:table-body>
2737
3068
  <xsl:apply-templates>
2738
3069
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -2742,7 +3073,61 @@
2742
3073
  </fo:block>
2743
3074
  </fo:block>
2744
3075
  </xsl:if>
2745
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns: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']">
2746
3131
  <xsl:param name="key_iso"/>
2747
3132
 
2748
3133
  <!-- <tr>
@@ -2758,7 +3143,12 @@
2758
3143
  <xsl:if test="normalize-space($key_iso) = 'true'">
2759
3144
  <xsl:attribute name="margin-top">0</xsl:attribute>
2760
3145
  </xsl:if>
2761
- 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"/>
2762
3152
  </fo:block>
2763
3153
  </fo:table-cell>
2764
3154
  <fo:table-cell>
@@ -2767,7 +3157,7 @@
2767
3157
  </fo:block>
2768
3158
  </fo:table-cell>
2769
3159
  </fo:table-row>
2770
- </xsl:template><xsl:template xmlns: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">
2771
3161
  <tr>
2772
3162
  <td>
2773
3163
  <xsl:apply-templates/>
@@ -2780,20 +3170,33 @@
2780
3170
  </td>
2781
3171
  </tr>
2782
3172
 
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()='dt']">
3173
+ </xsl:template><xsl:template match="*[local-name()='dt']">
2784
3174
  <xsl:param name="key_iso"/>
2785
3175
 
2786
3176
  <fo:table-row>
2787
3177
  <fo:table-cell>
3178
+
2788
3179
  <fo:block margin-top="6pt">
2789
3180
 
3181
+
2790
3182
  <xsl:if test="normalize-space($key_iso) = 'true'">
2791
3183
  <xsl:attribute name="margin-top">0</xsl:attribute>
2792
3184
 
2793
3185
  </xsl:if>
2794
3186
 
2795
3187
 
3188
+
3189
+
3190
+
3191
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
3192
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3193
+
2796
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> -->
2797
3200
  </fo:block>
2798
3201
  </fo:table-cell>
2799
3202
  <fo:table-cell>
@@ -2807,37 +3210,37 @@
2807
3210
  </fo:table-cell>
2808
3211
  </fo:table-row>
2809
3212
 
2810
- </xsl:template><xsl:template xmlns: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">
2811
3214
  <xsl:apply-templates/>
2812
- </xsl:template><xsl:template xmlns: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">
2813
3216
  <xsl:apply-templates/>
2814
- </xsl:template><xsl:template xmlns: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">
2815
- <fo:inline><xsl:apply-templates/></fo:inline>
2816
- </xsl:template><xsl:template xmlns: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']">
3217
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3218
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3219
+ </xsl:template><xsl:template match="*[local-name()='em']">
2817
3220
  <fo:inline font-style="italic">
2818
3221
  <xsl:apply-templates/>
2819
3222
  </fo:inline>
2820
- </xsl:template><xsl:template xmlns: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']">
2821
3224
  <fo:inline font-weight="bold">
2822
3225
  <xsl:apply-templates/>
2823
3226
  </fo:inline>
2824
- </xsl:template><xsl:template xmlns: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']">
2825
3228
  <fo:inline font-size="80%" vertical-align="super">
2826
3229
  <xsl:apply-templates/>
2827
3230
  </fo:inline>
2828
- </xsl:template><xsl:template xmlns: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']">
2829
3232
  <fo:inline font-size="80%" vertical-align="sub">
2830
3233
  <xsl:apply-templates/>
2831
3234
  </fo:inline>
2832
- </xsl:template><xsl:template xmlns: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']">
2833
- <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">
2834
3237
  <xsl:apply-templates/>
2835
3238
  </fo:inline>
2836
- </xsl:template><xsl:template xmlns: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']">
2837
3240
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2838
3241
  <xsl:apply-templates/>
2839
3242
  </fo:inline>
2840
- </xsl:template><xsl:template xmlns: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']]">
2841
3244
  <xsl:variable name="text" select="normalize-space(.)"/>
2842
3245
  <fo:inline font-size="75%">
2843
3246
  <xsl:if test="string-length($text) &gt; 0">
@@ -2846,10 +3249,11 @@
2846
3249
  </xsl:call-template>
2847
3250
  </xsl:if>
2848
3251
  </fo:inline>
2849
- </xsl:template><xsl:template xmlns: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">
2850
3253
  <xsl:param name="text"/>
2851
3254
  <xsl:variable name="char" select="substring($text,1,1)"/>
2852
- <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))"/>
2853
3257
  <xsl:choose>
2854
3258
  <xsl:when test="$char=$upperCase">
2855
3259
  <fo:inline font-size="{100 div 0.75}%">
@@ -2865,7 +3269,7 @@
2865
3269
  <xsl:with-param name="text" select="substring($text,2)"/>
2866
3270
  </xsl:call-template>
2867
3271
  </xsl:if>
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" name="tokenize">
3272
+ </xsl:template><xsl:template name="tokenize">
2869
3273
  <xsl:param name="text"/>
2870
3274
  <xsl:param name="separator" select="' '"/>
2871
3275
  <xsl:choose>
@@ -2913,7 +3317,7 @@
2913
3317
  </xsl:call-template>
2914
3318
  </xsl:otherwise>
2915
3319
  </xsl:choose>
2916
- </xsl:template><xsl:template xmlns: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">
2917
3321
  <xsl:param name="words"/>
2918
3322
  <xsl:for-each select="$words//word">
2919
3323
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2921,12 +3325,17 @@
2921
3325
  <xsl:value-of select="."/>
2922
3326
  </xsl:if>
2923
3327
  </xsl:for-each>
2924
- </xsl:template><xsl:template xmlns: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">
2925
3333
  <xsl:param name="text" select="."/>
2926
3334
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
2927
3335
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
2928
3336
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
2929
3337
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3338
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
2930
3339
  <xsl:variable name="zero-space">​</xsl:variable>
2931
3340
  <xsl:choose>
2932
3341
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -2961,11 +3370,19 @@
2961
3370
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
2962
3371
  </xsl:call-template>
2963
3372
  </xsl:when>
3373
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
3374
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
3375
+ <xsl:value-of select="$zero-space-after-underscore"/>
3376
+ <xsl:value-of select="$zero-space"/>
3377
+ <xsl:call-template name="add-zero-spaces">
3378
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
3379
+ </xsl:call-template>
3380
+ </xsl:when>
2964
3381
  <xsl:otherwise>
2965
3382
  <xsl:value-of select="$text"/>
2966
3383
  </xsl:otherwise>
2967
3384
  </xsl:choose>
2968
- </xsl:template><xsl:template xmlns: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">
2969
3386
  <xsl:param name="text" select="."/>
2970
3387
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
2971
3388
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -2991,7 +3408,7 @@
2991
3408
  <xsl:value-of select="$text"/>
2992
3409
  </xsl:otherwise>
2993
3410
  </xsl:choose>
2994
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns: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">
2995
3412
  <xsl:variable name="simple-table">
2996
3413
 
2997
3414
  <!-- Step 1. colspan processing -->
@@ -3018,9 +3435,9 @@
3018
3435
  </xsl:choose> -->
3019
3436
  </xsl:variable>
3020
3437
  <xsl:copy-of select="$simple-table"/>
3021
- </xsl:template><xsl:template xmlns: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">
3022
3439
  <xsl:apply-templates mode="simple-table-colspan"/>
3023
- </xsl:template><xsl:template xmlns: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">
3024
3441
  <xsl:choose>
3025
3442
  <xsl:when test="@colspan">
3026
3443
  <xsl:variable name="td">
@@ -3042,16 +3459,16 @@
3042
3459
  </xsl:element>
3043
3460
  </xsl:otherwise>
3044
3461
  </xsl:choose>
3045
- </xsl:template><xsl:template xmlns: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">
3046
3463
  <xsl:element name="tr">
3047
3464
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3048
3465
  <xsl:apply-templates mode="simple-table-colspan"/>
3049
3466
  </xsl:element>
3050
- </xsl:template><xsl:template xmlns: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">
3051
3468
  <xsl:copy>
3052
3469
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3053
3470
  </xsl:copy>
3054
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns: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">
3055
3472
  <xsl:param name="count"/>
3056
3473
  <xsl:param name="node"/>
3057
3474
 
@@ -3062,18 +3479,18 @@
3062
3479
  </xsl:call-template>
3063
3480
  <xsl:copy-of select="$node"/>
3064
3481
  </xsl:if>
3065
- </xsl:template><xsl:template xmlns: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">
3066
3483
  <xsl:copy>
3067
3484
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3068
3485
  </xsl:copy>
3069
- </xsl:template><xsl:template xmlns: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">
3070
3487
  <xsl:copy>
3071
3488
  <xsl:copy-of select="tr[1]"/>
3072
3489
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3073
3490
  <xsl:with-param name="previousRow" select="tr[1]"/>
3074
3491
  </xsl:apply-templates>
3075
3492
  </xsl:copy>
3076
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns: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">
3077
3494
  <xsl:param name="previousRow"/>
3078
3495
  <xsl:variable name="currentRow" select="."/>
3079
3496
 
@@ -3107,34 +3524,320 @@
3107
3524
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3108
3525
  <xsl:with-param name="previousRow" select="$newRow"/>
3109
3526
  </xsl:apply-templates>
3110
- </xsl:template><xsl:template xmlns: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">
3111
3528
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3112
3529
  <xsl:choose>
3113
3530
  <xsl:when test="$language = 'English'">en</xsl:when>
3114
3531
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3115
3532
  </xsl:choose>
3116
- </xsl:template><xsl:template xmlns: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">
3117
3534
  <xsl:param name="str"/>
3118
3535
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3119
3536
  <xsl:choose>
3120
3537
  <xsl:when test="contains($str2, ' ')">
3121
3538
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3122
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3123
- <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>
3124
3544
  <xsl:text> </xsl:text>
3125
3545
  <xsl:call-template name="capitalizeWords">
3126
3546
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3127
3547
  </xsl:call-template>
3128
3548
  </xsl:when>
3129
3549
  <xsl:otherwise>
3130
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3131
- <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>
3132
3555
  </xsl:otherwise>
3133
3556
  </xsl:choose>
3134
- </xsl:template><xsl:template xmlns: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">
3135
3562
  <fo:inline font-family="STIX2Math">
3136
3563
  <fo:instream-foreign-object fox:alt-text="Math">
3137
3564
  <xsl:copy-of select="."/>
3138
3565
  </fo:instream-foreign-object>
3139
3566
  </fo:inline>
3567
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3568
+ <xsl:for-each select="*[local-name()='locality']">
3569
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3570
+ <xsl:apply-templates select="."/>
3571
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3572
+ </xsl:for-each>
3573
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3574
+ <xsl:variable name="target">
3575
+ <xsl:choose>
3576
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3577
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
3578
+ </xsl:when>
3579
+ <xsl:otherwise>
3580
+ <xsl:value-of select="normalize-space(@target)"/>
3581
+ </xsl:otherwise>
3582
+ </xsl:choose>
3583
+ </xsl:variable>
3584
+ <fo:inline xsl:use-attribute-sets="link-style">
3585
+ <xsl:choose>
3586
+ <xsl:when test="$target = ''">
3587
+ <xsl:apply-templates/>
3588
+ </xsl:when>
3589
+ <xsl:otherwise>
3590
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3591
+ <xsl:choose>
3592
+ <xsl:when test="normalize-space(.) = ''">
3593
+ <xsl:value-of select="$target"/>
3594
+ </xsl:when>
3595
+ <xsl:otherwise>
3596
+ <xsl:apply-templates/>
3597
+ </xsl:otherwise>
3598
+ </xsl:choose>
3599
+ </fo:basic-link>
3600
+ </xsl:otherwise>
3601
+ </xsl:choose>
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"/>
3140
3843
  </xsl:template></xsl:stylesheet>