metanorma-itu 1.0.15 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -1
  3. data/.github/workflows/ubuntu.yml +20 -7
  4. data/.github/workflows/windows.yml +8 -1
  5. data/lib/asciidoctor/itu/biblio.rng +36 -6
  6. data/lib/asciidoctor/itu/cleanup.rb +7 -7
  7. data/lib/asciidoctor/itu/converter.rb +18 -16
  8. data/lib/asciidoctor/itu/front.rb +25 -0
  9. data/lib/asciidoctor/itu/isodoc.rng +444 -1
  10. data/lib/asciidoctor/itu/reqt.rng +23 -0
  11. data/lib/isodoc/itu.rb +1 -0
  12. data/lib/isodoc/itu/base_convert.rb +71 -17
  13. data/lib/isodoc/itu/html/_coverpage.scss +7 -3
  14. data/lib/isodoc/itu/html/html_itu_titlepage.html +4 -5
  15. data/lib/isodoc/itu/html/htmlstyle.scss +9 -5
  16. data/lib/isodoc/itu/html/itu.scss +27 -0
  17. data/lib/isodoc/itu/html/scripts.html +10 -7
  18. data/lib/isodoc/itu/html/word_itu_intro.html +11 -1
  19. data/lib/isodoc/itu/html/word_itu_titlepage.html +1 -4
  20. data/lib/isodoc/itu/html/wordstyle.scss +6 -5
  21. data/lib/isodoc/itu/i18n-en.yaml +2 -1
  22. data/lib/isodoc/itu/itu.recommendation-annex.xsl +1186 -417
  23. data/lib/isodoc/itu/itu.recommendation.xsl +1186 -417
  24. data/lib/isodoc/itu/itu.resolution.xsl +1186 -417
  25. data/lib/isodoc/itu/metadata.rb +16 -6
  26. data/lib/isodoc/itu/pdf_convert.rb +0 -13
  27. data/lib/isodoc/itu/presentation_xml_convert.rb +10 -0
  28. data/lib/isodoc/itu/ref.rb +46 -22
  29. data/lib/isodoc/itu/terms.rb +9 -22
  30. data/lib/isodoc/itu/word_convert.rb +10 -8
  31. data/lib/isodoc/itu/xref.rb +43 -12
  32. data/lib/metanorma/itu/processor.rb +11 -9
  33. data/lib/metanorma/itu/version.rb +1 -1
  34. data/metanorma-itu.gemspec +2 -2
  35. metadata +11 -12
  36. data/lib/isodoc/itu/html/scripts.pdf.html +0 -72
@@ -9,7 +9,8 @@ norm_annex: (This annex forms an integral part of this %.)
9
9
  inform_annex: (This appendix does not form an integral part of this %.)
10
10
  formula: Equation
11
11
  inequality: Inequality
12
- annex_subclause: Clause
12
+ clause: clause
13
+ annex_subclause: clause
13
14
  in: in
14
15
  where: "where:"
15
16
  blankclause: This clause is intentionally left blank.
@@ -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:itu="https://www.metanorma.org/ns/itu" 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:itu="https://www.metanorma.org/ns/itu" 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 method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -26,8 +26,9 @@
26
26
  </xsl:call-template>
27
27
  </xsl:variable>
28
28
  <xsl:variable name="doctype">
29
- <xsl:value-of select="translate(substring(/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype,1,1),$lower,$upper)"/>
30
- <xsl:value-of select="substring(/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype,2)"/>
29
+ <xsl:call-template name="capitalize">
30
+ <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype"/>
31
+ </xsl:call-template>
31
32
  </xsl:variable>
32
33
 
33
34
 
@@ -51,8 +52,6 @@
51
52
  <xsl:apply-templates select="/itu:itu-standard/itu:annex" mode="contents"/>
52
53
  <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[position() != 1]" mode="contents"/> <!-- @id = 'bibliography' -->
53
54
 
54
- <xsl:apply-templates select="//itu3" mode="contents"/>
55
-
56
55
  <xsl:apply-templates select="//itu:table" mode="contents"/>
57
56
 
58
57
  </contents>
@@ -121,42 +120,7 @@
121
120
  </fo:page-sequence-master>
122
121
  </fo:layout-master-set>
123
122
 
124
- <fo:declarations>
125
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
126
- <pdf:dictionary type="normal" key="ViewerPreferences">
127
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
128
- </pdf:dictionary>
129
- </pdf:catalog>
130
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
131
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
132
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
133
- <!-- Dublin Core properties go here -->
134
- <dc:title><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='main']"/></dc:title>
135
- <dc:creator><xsl:value-of select="/itu:iso-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/></dc:creator>
136
- <dc:description>
137
- <xsl:variable name="abstract">
138
- <xsl:copy-of select="/itu:itu-standard/itu:bibdata/itu:abstract//text()"/>
139
- </xsl:variable>
140
- <xsl:value-of select="normalize-space($abstract)"/>
141
- </dc:description>
142
- <pdf:Keywords>
143
- <xsl:for-each select="/itu:itu-standard/itu:bibdata//itu:keyword">
144
- <xsl:sort data-type="text" order="ascending"/>
145
- <xsl:apply-templates/>
146
- <xsl:choose>
147
- <xsl:when test="position() != last()">, </xsl:when>
148
- <xsl:otherwise>.</xsl:otherwise>
149
- </xsl:choose>
150
- </xsl:for-each>
151
- </pdf:Keywords>
152
- </rdf:Description>
153
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
154
- <!-- XMP properties go here -->
155
- <xmp:CreatorTool/>
156
- </rdf:Description>
157
- </rdf:RDF>
158
- </x:xmpmeta>
159
- </fo:declarations>
123
+ <xsl:call-template name="addPDFUAmeta"/>
160
124
 
161
125
  <!-- cover page -->
162
126
  <fo:page-sequence master-reference="cover-page">
@@ -180,12 +144,12 @@
180
144
  <fo:table-column column-width="35.8mm"/>
181
145
  <fo:table-column column-width="67mm"/>
182
146
  <fo:table-body>
183
- <fo:table-row height="42.5mm">
147
+ <fo:table-row height="37.5mm"> <!-- 42.5mm -->
184
148
  <fo:table-cell>
185
149
  <fo:block> </fo:block>
186
150
  </fo:table-cell>
187
151
  <fo:table-cell number-columns-spanned="3">
188
- <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray" margin-top="16pt"> <!-- letter-spacing="4pt", Helvetica for letter-spacing working -->
152
+ <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working -->
189
153
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
190
154
  <xsl:call-template name="addLetterSpacing">
191
155
  <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/>
@@ -226,7 +190,12 @@
226
190
  <fo:table-cell text-align="right">
227
191
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
228
192
  <fo:block font-size="18pt" font-weight="bold">
229
- <xsl:text>Annex </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
193
+ <xsl:variable name="title-annex">
194
+ <xsl:call-template name="getTitle">
195
+ <xsl:with-param name="name" select="'title-annex'"/>
196
+ </xsl:call-template>
197
+ </xsl:variable>
198
+ <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
230
199
  </fo:block>
231
200
  </xsl:if>
232
201
  <fo:block font-size="14pt">
@@ -236,29 +205,31 @@
236
205
  </fo:block>
237
206
  </fo:table-cell>
238
207
  </fo:table-row>
239
- <fo:table-row height="59mm">
208
+ <fo:table-row height="64mm"> <!-- 59mm -->
240
209
  <fo:table-cell>
241
210
  <fo:block> </fo:block>
242
211
  </fo:table-cell>
243
- <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm">
244
- <fo:block>
245
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']) != ''">
246
- <xsl:variable name="title">
247
- <xsl:text>Series </xsl:text>
248
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']"/>
249
- </xsl:variable>
250
- <xsl:value-of select="translate($title, $lower, $upper)"/>
251
- </xsl:if>
252
- </fo:block>
253
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
254
- <fo:block margin-top="6pt">
255
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
256
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
257
- <xsl:text> — </xsl:text>
258
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
212
+ <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm" display-align="after">
213
+ <fo:block padding-bottom="7mm">
214
+ <fo:block text-transform="uppercase">
215
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']) != ''">
216
+ <xsl:variable name="title">
217
+ <xsl:text>Series </xsl:text>
218
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']"/>
219
+ </xsl:variable>
220
+ <xsl:value-of select="$title"/>
259
221
  </xsl:if>
260
222
  </fo:block>
261
- </xsl:if>
223
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
224
+ <fo:block margin-top="6pt">
225
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
226
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
227
+ <xsl:text> — </xsl:text>
228
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
229
+ </xsl:if>
230
+ </fo:block>
231
+ </xsl:if>
232
+ </fo:block>
262
233
  </fo:table-cell>
263
234
  </fo:table-row>
264
235
  <fo:table-row height="40mm">
@@ -311,7 +282,12 @@
311
282
  <xsl:text>  </xsl:text>
312
283
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
313
284
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
314
- <xsl:text> — Annex </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
285
+ <xsl:variable name="title-annex">
286
+ <xsl:call-template name="getTitle">
287
+ <xsl:with-param name="name" select="'title-annex'"/>
288
+ </xsl:call-template>
289
+ </xsl:variable>
290
+ <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
315
291
  </xsl:if>
316
292
  </fo:block>
317
293
  </fo:table-cell>
@@ -346,17 +322,15 @@
346
322
  <xsl:value-of select="$linebreak"/>
347
323
  </fo:block>
348
324
  <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
349
- <xsl:text>Keywords</xsl:text>
325
+ <xsl:variable name="title-keywords">
326
+ <xsl:call-template name="getTitle">
327
+ <xsl:with-param name="name" select="'title-keywords'"/>
328
+ </xsl:call-template>
329
+ </xsl:variable>
330
+ <xsl:value-of select="$title-keywords"/>
350
331
  </fo:block>
351
332
  <fo:block>
352
- <xsl:for-each select="/itu:itu-standard/itu:bibdata//itu:keyword">
353
- <xsl:sort data-type="text" order="ascending"/>
354
- <xsl:apply-templates/>
355
- <xsl:choose>
356
- <xsl:when test="position() != last()">, </xsl:when>
357
- <xsl:otherwise>.</xsl:otherwise>
358
- </xsl:choose>
359
- </xsl:for-each>
333
+ <xsl:call-template name="insertKeywords"/>
360
334
  </fo:block>
361
335
  </xsl:if>
362
336
 
@@ -379,8 +353,18 @@
379
353
  <xsl:if test="xalan:nodeset($contents)//item">
380
354
  <fo:block break-after="page"/>
381
355
  <fo:block-container>
382
- <fo:block margin-top="6pt" text-align="center" font-weight="bold">Table of Contents</fo:block>
383
- <fo:block margin-top="6pt" text-align="right" font-weight="bold">Page</fo:block>
356
+ <xsl:variable name="title-toc">
357
+ <xsl:call-template name="getTitle">
358
+ <xsl:with-param name="name" select="'title-toc'"/>
359
+ </xsl:call-template>
360
+ </xsl:variable>
361
+ <xsl:variable name="title-page">
362
+ <xsl:call-template name="getTitle">
363
+ <xsl:with-param name="name" select="'title-page'"/>
364
+ </xsl:call-template>
365
+ </xsl:variable>
366
+ <fo:block margin-top="6pt" text-align="center" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:block>
367
+ <fo:block margin-top="6pt" text-align="right" font-weight="bold"><xsl:value-of select="$title-page"/></fo:block>
384
368
 
385
369
  <xsl:for-each select="xalan:nodeset($contents)//item">
386
370
  <xsl:if test="@display = 'true'">
@@ -625,15 +609,21 @@
625
609
  <xsl:template match="itu:figure" mode="contents">
626
610
  <xsl:param name="sectionNum"/>
627
611
  <item level="" id="{@id}" display="false" type="figure">
628
- <xsl:variable name="title">Figure </xsl:variable>
612
+ <xsl:variable name="title-figure">
613
+ <xsl:call-template name="getTitle">
614
+ <xsl:with-param name="name" select="'title-figure'"/>
615
+ </xsl:call-template>
616
+ </xsl:variable>
617
+ <xsl:variable name="title" select="$title-figure"/>
629
618
  <xsl:attribute name="section">
630
619
  <xsl:call-template name="getSection">
631
620
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
621
+ </xsl:call-template>
622
+ </xsl:attribute>
623
+ <xsl:attribute name="topsection">
624
+ <xsl:call-template name="getTopSection">
625
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
632
626
  </xsl:call-template>
633
- <!-- <xsl:text>Figure </xsl:text>
634
- <xsl:call-template name="getItemNumber">
635
- <xsl:with-param name="brackets" select="'false'"/>
636
- </xsl:call-template> -->
637
627
  </xsl:attribute>
638
628
  <xsl:value-of select="$title"/>
639
629
  <xsl:call-template name="getItemNumber">
@@ -648,13 +638,21 @@
648
638
  <xsl:template match="itu:table" mode="contents">
649
639
  <xsl:param name="sectionNum"/>
650
640
  <item level="" id="{@id}" display="false" type="table">
651
- <xsl:variable name="title">Table </xsl:variable>
641
+ <xsl:variable name="title-table">
642
+ <xsl:call-template name="getTitle">
643
+ <xsl:with-param name="name" select="'title-table'"/>
644
+ </xsl:call-template>
645
+ </xsl:variable>
646
+ <xsl:variable name="title" select="$title-table"/>
652
647
  <xsl:attribute name="section">
653
648
  <xsl:call-template name="getSection">
654
649
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
650
+ </xsl:call-template>
651
+ </xsl:attribute>
652
+ <xsl:attribute name="topsection">
653
+ <xsl:call-template name="getTopSection">
654
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
655
655
  </xsl:call-template>
656
- <!-- <xsl:text>Table </xsl:text>
657
- <xsl:call-template name="getItemNumber"/> -->
658
656
  </xsl:attribute>
659
657
  <xsl:value-of select="$title"/>
660
658
  <xsl:call-template name="getItemNumber">
@@ -670,23 +668,39 @@
670
668
  <xsl:template match="itu:formula" mode="contents">
671
669
  <xsl:param name="sectionNum"/>
672
670
  <item level="" id="{@id}" display="false" type="formula">
671
+ <xsl:variable name="title-inequality">
672
+ <xsl:call-template name="getTitle">
673
+ <xsl:with-param name="name" select="'title-inequality'"/>
674
+ </xsl:call-template>
675
+ </xsl:variable>
676
+ <xsl:variable name="title-equation">
677
+ <xsl:call-template name="getTitle">
678
+ <xsl:with-param name="name" select="'title-equation'"/>
679
+ </xsl:call-template>
680
+ </xsl:variable>
673
681
  <xsl:variable name="title">
674
682
  <xsl:choose>
675
- <xsl:when test="@inequality = 'true'">Inequality </xsl:when>
676
- <xsl:otherwise>Equation </xsl:otherwise>
683
+ <xsl:when test="@inequality = 'true'"><xsl:value-of select="$title-inequality"/></xsl:when>
684
+ <xsl:otherwise><xsl:value-of select="$title-equation"/></xsl:otherwise>
677
685
  </xsl:choose>
678
686
  </xsl:variable>
679
- <xsl:attribute name="section">
687
+ <xsl:variable name="section">
680
688
  <xsl:call-template name="getSection">
681
689
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
682
690
  </xsl:call-template>
683
- <!-- <xsl:value-of select="$title"/>
684
- <xsl:call-template name="getItemNumber"/> -->
685
- </xsl:attribute>
691
+ </xsl:variable>
692
+ <xsl:attribute name="section">
693
+ <xsl:value-of select="$section"/>
694
+ </xsl:attribute>
686
695
  <xsl:variable name="parent-element" select="local-name(..)"/>
687
696
  <xsl:attribute name="parent">
697
+ <xsl:variable name="title-clause">
698
+ <xsl:call-template name="getTitle">
699
+ <xsl:with-param name="name" select="'title-clause'"/>
700
+ </xsl:call-template>
701
+ </xsl:variable>
688
702
  <xsl:choose>
689
- <xsl:when test="$parent-element = 'clause'">Clause</xsl:when>
703
+ <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
690
704
  <xsl:otherwise/>
691
705
  </xsl:choose>
692
706
  </xsl:attribute>
@@ -698,6 +712,11 @@
698
712
  <xsl:attribute name="number">
699
713
  <xsl:value-of select="$itemNumber"/>
700
714
  </xsl:attribute>
715
+ <xsl:attribute name="topsection">
716
+ <xsl:call-template name="getTopSection">
717
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
718
+ </xsl:call-template>
719
+ </xsl:attribute>
701
720
  <xsl:value-of select="$title"/>
702
721
  <xsl:value-of select="$itemNumber"/>
703
722
  </item>
@@ -793,11 +812,21 @@
793
812
  <xsl:variable name="parent-element" select="local-name(..)"/>
794
813
  <item level="" id="{@id}" display="false" type="example" section="{$section}">
795
814
  <xsl:attribute name="parent">
815
+ <xsl:variable name="title-clause">
816
+ <xsl:call-template name="getTitle">
817
+ <xsl:with-param name="name" select="'title-clause'"/>
818
+ </xsl:call-template>
819
+ </xsl:variable>
796
820
  <xsl:choose>
797
- <xsl:when test="$parent-element = 'clause'">Clause</xsl:when>
821
+ <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
798
822
  <xsl:otherwise/>
799
823
  </xsl:choose>
800
824
  </xsl:attribute>
825
+ <xsl:attribute name="topsection">
826
+ <xsl:call-template name="getTopSection">
827
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
828
+ </xsl:call-template>
829
+ </xsl:attribute>
801
830
  </item>
802
831
  <xsl:apply-templates mode="contents">
803
832
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
@@ -816,6 +845,11 @@
816
845
  </xsl:call-template>
817
846
  </xsl:variable>
818
847
  <item level="" id="{@id}" display="false" type="note" section="{$section}">
848
+ <xsl:attribute name="topsection">
849
+ <xsl:call-template name="getTopSection">
850
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
851
+ </xsl:call-template>
852
+ </xsl:attribute>
819
853
  <xsl:number/>
820
854
  </item>
821
855
  <xsl:apply-templates mode="contents">
@@ -823,23 +857,6 @@
823
857
  </xsl:apply-templates>
824
858
  </xsl:template>
825
859
 
826
- <xsl:template match="itu:termnote" mode="contents">
827
- <xsl:param name="sectionNum"/>
828
- <xsl:variable name="level">
829
- <xsl:call-template name="getLevel"/>
830
- </xsl:variable>
831
- <xsl:variable name="section">
832
- <xsl:call-template name="getSection">
833
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
834
- </xsl:call-template>
835
- </xsl:variable>
836
- <item level="" id="{@id}" display="false" type="note" section="{$section}">
837
- <xsl:number/>
838
- </item>
839
- <xsl:apply-templates mode="contents">
840
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
841
- </xsl:apply-templates>
842
- </xsl:template>
843
860
 
844
861
  <xsl:template match="itu:note" mode="contents">
845
862
  <xsl:param name="sectionNum"/>
@@ -854,6 +871,11 @@
854
871
  </xsl:for-each>
855
872
  </xsl:variable>
856
873
  <item level="" id="{@id}" display="false" type="note" section="{$section}">
874
+ <xsl:attribute name="topsection">
875
+ <xsl:call-template name="getTopSection">
876
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
877
+ </xsl:call-template>
878
+ </xsl:attribute>
857
879
  <xsl:number/>
858
880
  </item>
859
881
  <xsl:apply-templates mode="contents">
@@ -910,6 +932,18 @@
910
932
  </xsl:otherwise>
911
933
  </xsl:choose>
912
934
  </xsl:template>
935
+
936
+ <xsl:template match="itu:xref" mode="contents">
937
+ <xsl:param name="sectionNum"/>
938
+ <item level="" id="{generate-id()}" display="false" type="xref">
939
+
940
+ <xsl:attribute name="topsection">
941
+ <xsl:call-template name="getTopSection">
942
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
943
+ </xsl:call-template>
944
+ </xsl:attribute>
945
+ </item>
946
+ </xsl:template>
913
947
 
914
948
  <!-- ============================= -->
915
949
  <!-- ============================= -->
@@ -925,8 +959,13 @@
925
959
  <xsl:value-of select="$linebreak"/>
926
960
  <xsl:value-of select="$linebreak"/>
927
961
  </fo:block>
928
- <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
929
- <xsl:text>Summary</xsl:text>
962
+ <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
963
+ <xsl:variable name="title-summary">
964
+ <xsl:call-template name="getTitle">
965
+ <xsl:with-param name="name" select="'title-summary'"/>
966
+ </xsl:call-template>
967
+ </xsl:variable>
968
+ <xsl:value-of select="$title-summary"/>
930
969
  </fo:block>
931
970
  <xsl:apply-templates/>
932
971
  </xsl:template>
@@ -952,14 +991,23 @@
952
991
  <!-- PARAGRAPHS -->
953
992
  <!-- ============================= -->
954
993
  <xsl:template match="itu:p | itu:sections/itu:p">
994
+ <xsl:param name="sectionNum"/>
955
995
  <fo:block margin-top="6pt">
956
996
  <xsl:attribute name="text-align">
957
997
  <xsl:choose>
958
998
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
999
+ <xsl:when test="ancestor::*[1][local-name() = 'td']/@align">
1000
+ <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/>
1001
+ </xsl:when>
1002
+ <xsl:when test="ancestor::*[1][local-name() = 'th']/@align">
1003
+ <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/>
1004
+ </xsl:when>
959
1005
  <xsl:otherwise>justify</xsl:otherwise>
960
1006
  </xsl:choose>
961
1007
  </xsl:attribute>
962
- <xsl:apply-templates/>
1008
+ <xsl:apply-templates>
1009
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1010
+ </xsl:apply-templates>
963
1011
  </fo:block>
964
1012
  </xsl:template>
965
1013
 
@@ -975,7 +1023,12 @@
975
1023
  <xsl:if test="ancestor::itu:figure">
976
1024
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
977
1025
  </xsl:if>
978
- <xsl:text>NOTE </xsl:text>
1026
+ <xsl:variable name="title-note">
1027
+ <xsl:call-template name="getTitle">
1028
+ <xsl:with-param name="name" select="'title-note'"/>
1029
+ </xsl:call-template>
1030
+ </xsl:variable>
1031
+ <xsl:value-of select="$title-note"/>
979
1032
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
980
1033
  <xsl:if test="count(//itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]) &gt; 1">
981
1034
  <xsl:number count="itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]" level="any"/>
@@ -1210,12 +1263,20 @@
1210
1263
  </fo:block>
1211
1264
  </xsl:template>
1212
1265
 
1266
+ <xsl:template match="itu:term">
1267
+ <xsl:param name="sectionNum"/>
1268
+ <fo:block id="{@id}">
1269
+ <xsl:apply-templates>
1270
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1271
+ </xsl:apply-templates>
1272
+ </fo:block>
1273
+ </xsl:template>
1213
1274
 
1214
1275
  <xsl:template match="itu:preferred">
1215
1276
  <xsl:param name="sectionNum"/>
1216
1277
  <!-- DEBUG need -->
1217
1278
  <fo:block space-before="6pt" text-align="justify">
1218
- <fo:inline id="{../@id}" padding-right="5mm" font-weight="bold">
1279
+ <fo:inline padding-right="5mm" font-weight="bold">
1219
1280
  <!-- <xsl:value-of select="$sectionNum"/><xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term"/> -->
1220
1281
  <xsl:variable name="level">
1221
1282
  <xsl:call-template name="getLevel"/>
@@ -1239,7 +1300,15 @@
1239
1300
  <xsl:apply-templates/>
1240
1301
  </fo:inline>
1241
1302
  <xsl:if test="../itu:termsource/itu:origin">
1242
- <xsl:text> [</xsl:text><xsl:value-of select="../itu:termsource/itu:origin/@citeas"/><xsl:text>]</xsl:text>
1303
+ <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/>
1304
+ <xsl:choose>
1305
+ <xsl:when test="contains($citeas, '[')">
1306
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1307
+ </xsl:when>
1308
+ <xsl:otherwise>
1309
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1310
+ </xsl:otherwise>
1311
+ </xsl:choose>
1243
1312
  </xsl:if>
1244
1313
  <xsl:text>: </xsl:text>
1245
1314
  <xsl:apply-templates select="following-sibling::itu:definition/node()" mode="process"/> <!-- -->
@@ -1354,10 +1423,18 @@
1354
1423
  <xsl:with-param name="brackets" select="'false'"/>
1355
1424
  </xsl:call-template>
1356
1425
  </xsl:variable>
1357
- <xsl:if test="$itemnumber != ''">
1358
- <xsl:text>Figure </xsl:text>
1359
- <xsl:value-of select="$itemnumber"/>
1360
- </xsl:if>
1426
+ <xsl:choose>
1427
+ <xsl:when test="local-name(*) = 'figure' and normalize-space(itu:name) = ''"/><!-- don't show 'Figure' for outer figure without name -->
1428
+ <xsl:when test="$itemnumber != ''">
1429
+ <xsl:variable name="title-figure">
1430
+ <xsl:call-template name="getTitle">
1431
+ <xsl:with-param name="name" select="'title-figure'"/>
1432
+ </xsl:call-template>
1433
+ </xsl:variable>
1434
+ <xsl:value-of select="$title-figure"/>
1435
+ <xsl:value-of select="$itemnumber"/>
1436
+ </xsl:when>
1437
+ </xsl:choose>
1361
1438
  <xsl:if test="itu:name">
1362
1439
  <xsl:text> — </xsl:text>
1363
1440
  <xsl:apply-templates select="itu:name" mode="process"/>
@@ -1416,18 +1493,6 @@
1416
1493
  <xsl:template match="itu:docidentifier"/>
1417
1494
 
1418
1495
 
1419
-
1420
- <xsl:template match="itu:annex2//itu:note/itu:p">
1421
- <fo:block font-size="11pt" margin-top="4pt">
1422
- <xsl:text>NOTE </xsl:text>
1423
- <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1424
- <xsl:number count="itu:note"/><xsl:text> </xsl:text>
1425
- <!-- </xsl:if> -->
1426
- <xsl:text>– </xsl:text>
1427
- <xsl:apply-templates/>
1428
- </fo:block>
1429
- </xsl:template>
1430
-
1431
1496
  <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol">
1432
1497
  <xsl:if test="preceding-sibling::*[1][local-name() = 'title']">
1433
1498
  <fo:block padding-top="-8pt" font-size="1pt"> </fo:block>
@@ -1439,10 +1504,20 @@
1439
1504
  </xsl:template>
1440
1505
 
1441
1506
  <xsl:template match="itu:ul//itu:note | itu:ol//itu:note"/>
1507
+ <xsl:template match="itu:ul//itu:note | itu:ol//itu:note" mode="process">
1508
+ <fo:block id="{@id}">
1509
+ <xsl:apply-templates mode="process"/>
1510
+ </fo:block>
1511
+ </xsl:template>
1442
1512
  <xsl:template match="itu:ul//itu:note/itu:p | itu:ol//itu:note/itu:p" mode="process">
1443
1513
  <xsl:variable name="id" select="ancestor::*[local-name() = 'clause'][1]/@id"/>
1444
- <fo:block font-size="11pt" margin-top="4pt">
1445
- <xsl:text>NOTE </xsl:text>
1514
+ <fo:block font-size="11pt" margin-top="4pt">
1515
+ <xsl:variable name="title-note">
1516
+ <xsl:call-template name="getTitle">
1517
+ <xsl:with-param name="name" select="'title-note'"/>
1518
+ </xsl:call-template>
1519
+ </xsl:variable>
1520
+ <xsl:value-of select="$title-note"/>
1446
1521
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1447
1522
  <xsl:if test="count(//itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]) &gt; 1">
1448
1523
  <xsl:number count="itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]" level="any"/>
@@ -1467,10 +1542,13 @@
1467
1542
  <xsl:attribute name="margin-left">18mm</xsl:attribute>
1468
1543
  </xsl:if>
1469
1544
  <xsl:if test="local-name(..) = 'ul'">
1470
- <xsl:attribute name="margin-left">15mm</xsl:attribute>
1471
- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1472
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
1545
+ <xsl:attribute name="margin-left">7mm</xsl:attribute><!-- 15mm -->
1546
+ <xsl:if test="ancestor::itu:table">
1547
+ <xsl:attribute name="margin-left">4.5mm</xsl:attribute>
1473
1548
  </xsl:if>
1549
+ <!-- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1550
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
1551
+ </xsl:if> -->
1474
1552
  </xsl:if>
1475
1553
  <fo:block-container margin-left="0mm">
1476
1554
  <xsl:apply-templates/>
@@ -1481,7 +1559,7 @@
1481
1559
  </fo:list-item>
1482
1560
  </xsl:template>
1483
1561
 
1484
- <xsl:template match="itu:li//itu:p">
1562
+ <xsl:template match="itu:li//itu:p[not(parent::itu:dd)]">
1485
1563
  <fo:block margin-bottom="0pt"> <!-- margin-bottom="6pt" -->
1486
1564
  <!-- <xsl:if test="local-name(ancestor::itu:li[1]/..) = 'ul'">
1487
1565
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -1493,11 +1571,9 @@
1493
1571
  <xsl:template match="itu:link" priority="2">
1494
1572
  <fo:inline color="blue">
1495
1573
  <xsl:if test="local-name(..) = 'formattedref' or ancestor::itu:preface">
1496
- <xsl:attribute name="font-family">Arial</xsl:attribute>
1497
- <xsl:attribute name="font-size">8pt</xsl:attribute>
1498
- <xsl:if test="local-name(..) = 'formattedref'">
1499
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
1500
- </xsl:if>
1574
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1575
+ <!-- <xsl:attribute name="font-family">Arial</xsl:attribute>
1576
+ <xsl:attribute name="font-size">8pt</xsl:attribute> -->
1501
1577
  </xsl:if>
1502
1578
  <xsl:call-template name="link"/>
1503
1579
  </fo:inline>
@@ -1505,8 +1581,13 @@
1505
1581
 
1506
1582
 
1507
1583
  <xsl:template match="itu:termnote">
1508
- <fo:block id="{@id}" margin-top="4pt">
1509
- <xsl:text>NOTE </xsl:text>
1584
+ <fo:block id="{@id}" margin-top="4pt">
1585
+ <xsl:variable name="title-note">
1586
+ <xsl:call-template name="getTitle">
1587
+ <xsl:with-param name="name" select="'title-note'"/>
1588
+ </xsl:call-template>
1589
+ </xsl:variable>
1590
+ <xsl:value-of select="$title-note"/>
1510
1591
  <xsl:if test="following-sibling::itu:termnote or preceding-sibling::itu:termnote">
1511
1592
  <xsl:number/><xsl:text> </xsl:text>
1512
1593
  </xsl:if>
@@ -1549,7 +1630,7 @@
1549
1630
 
1550
1631
  <xsl:template match="itu:formula" name="formula">
1551
1632
  <xsl:param name="sectionNum"/>
1552
- <fo:block id="{@id}" margin-top="6pt"> <!-- text-align="center" -->
1633
+ <fo:block id="{@id}" margin-top="6pt" margin-bottom="6pt"> <!-- text-align="center" -->
1553
1634
  <xsl:apply-templates/>
1554
1635
  <fo:inline keep-together.within-line="always">
1555
1636
  </fo:inline>
@@ -1599,32 +1680,57 @@
1599
1680
  <xsl:param name="sectionNum"/>
1600
1681
 
1601
1682
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1683
+ <xsl:variable name="topsection" select="xalan:nodeset($contents)//item[@id = current()/@target]/@topsection"/>
1684
+ <xsl:variable name="xref_id" select="generate-id()"/>
1685
+ <xsl:variable name="xreftopsection" select="xalan:nodeset($contents)//item[@id = $xref_id]/@topsection"/>
1602
1686
 
1603
1687
  <xsl:variable name="text" select="xalan:nodeset($contents)//item[@id = current()/@target]/text()"/>
1604
1688
 
1605
1689
  <fo:basic-link internal-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1606
1690
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1691
+ <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =current()/@target]/@level"/>
1692
+
1693
+ <xsl:variable name="title-clause">
1694
+ <xsl:call-template name="getTitle">
1695
+ <xsl:with-param name="name" select="'title-clause'"/>
1696
+ </xsl:call-template>
1697
+ </xsl:variable>
1698
+ <xsl:variable name="title-example-xref">
1699
+ <xsl:call-template name="getTitle">
1700
+ <xsl:with-param name="name" select="'title-example-xref'"/>
1701
+ </xsl:call-template>
1702
+ </xsl:variable>
1703
+
1607
1704
  <xsl:choose>
1608
- <xsl:when test="$type = 'clause'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1609
- <xsl:when test="$type = 'example'">Example </xsl:when>
1705
+ <xsl:when test="($type = 'clause' or $type = 'term') and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1706
+ <xsl:when test="($type = 'clause' or $type = 'term') and $level &gt; 1"><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-clause))"/></xsl:when>
1707
+ <xsl:when test="$type = 'example'"><xsl:value-of select="$title-example-xref"/></xsl:when>
1610
1708
  <xsl:when test="$type = 'figure'"/>
1611
1709
  <xsl:when test="$type = 'formula'"/>
1612
1710
  <xsl:when test="$type = 'table'"/>
1613
- <xsl:when test="$type = 'term'">Clause </xsl:when>
1614
1711
  <xsl:when test="$type = 'note'"><xsl:text>Note </xsl:text><xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/text()"/></xsl:when>
1615
1712
 
1616
1713
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1617
1714
  </xsl:choose>
1618
1715
 
1716
+ <xsl:variable name="title-in">
1717
+ <xsl:call-template name="getTitle">
1718
+ <xsl:with-param name="name" select="'title-in'"/>
1719
+ </xsl:call-template>
1720
+ </xsl:variable>
1721
+
1619
1722
  <xsl:choose>
1620
1723
  <xsl:when test="$type = 'example'">
1621
1724
  <xsl:variable name="currentSection">
1622
1725
  <xsl:call-template name="getSection"/>
1623
1726
  </xsl:variable>
1624
- <xsl:if test="not(contains($section, $currentSection))">
1625
- <xsl:text>in </xsl:text>
1626
- <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1627
- <xsl:text> </xsl:text>
1727
+ <xsl:if test="not(contains($section, $currentSection))">
1728
+
1729
+ <xsl:value-of select="$title-in"/>
1730
+ <xsl:if test="$level = 1">
1731
+ <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1732
+ <xsl:text> </xsl:text>
1733
+ </xsl:if>
1628
1734
  <xsl:value-of select="$section"/>
1629
1735
  </xsl:if>
1630
1736
  </xsl:when>
@@ -1635,13 +1741,18 @@
1635
1741
 
1636
1742
  <xsl:when test="$type = 'formula'">
1637
1743
  <xsl:value-of select="$text"/>
1638
- <xsl:variable name="currentSection">
1744
+ <!-- <xsl:variable name="currentSection">
1639
1745
  <xsl:call-template name="getSection"/>
1640
- </xsl:variable>
1641
- <xsl:if test="not(contains($section, $currentSection))">
1642
- <xsl:text> in </xsl:text>
1643
- <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1644
- <xsl:text> </xsl:text>
1746
+ </xsl:variable>
1747
+
1748
+ <xsl:if test="not(contains($section, $currentSection))"> -->
1749
+ <xsl:if test="$topsection != $xreftopsection">
1750
+ <xsl:text> </xsl:text>
1751
+ <xsl:value-of select="$title-in"/>
1752
+ <xsl:if test="$level = 1">
1753
+ <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1754
+ <xsl:text> </xsl:text>
1755
+ </xsl:if>
1645
1756
  <xsl:value-of select="$section"/>
1646
1757
  </xsl:if>
1647
1758
  </xsl:when>
@@ -1655,7 +1766,12 @@
1655
1766
  <xsl:call-template name="getSection"/>
1656
1767
  </xsl:variable>
1657
1768
  <xsl:if test="not(contains($section, $currentSection))">
1658
- <xsl:text> in Clause </xsl:text>
1769
+ <xsl:text> </xsl:text>
1770
+ <xsl:value-of select="$title-in"/>
1771
+ <xsl:choose>
1772
+ <xsl:when test="$level = 1"><xsl:value-of select="$title-clause"/></xsl:when>
1773
+ <xsl:when test="$level &gt; 1"><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-clause))"/></xsl:when>
1774
+ </xsl:choose>
1659
1775
  <xsl:value-of select="$section"/>
1660
1776
  </xsl:if>
1661
1777
  </xsl:when>
@@ -1696,8 +1812,13 @@
1696
1812
  </xsl:template>
1697
1813
 
1698
1814
  <xsl:template match="itu:example/itu:name">
1699
- <fo:block font-weight="bold">
1700
- <xsl:text>EXAMPLE</xsl:text>
1815
+ <fo:block font-weight="bold">
1816
+ <xsl:variable name="title-example">
1817
+ <xsl:call-template name="getTitle">
1818
+ <xsl:with-param name="name" select="'title-example'"/>
1819
+ </xsl:call-template>
1820
+ </xsl:variable>
1821
+ <xsl:value-of select="normalize-space($title-example)"/>
1701
1822
  <xsl:if test="count(ancestor::itu:clause[1]/itu:example) &gt; 1">
1702
1823
  <xsl:text> </xsl:text><xsl:number count="itu:example"/>
1703
1824
  </xsl:if>
@@ -1724,10 +1845,10 @@
1724
1845
  <fo:basic-link internal-destination="{@bibitemid}" color="blue" text-decoration="underline" fox:alt-text="{@citeas}">
1725
1846
  <xsl:choose>
1726
1847
  <xsl:when test="contains(@citeas, '[')">
1727
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1848
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1728
1849
  </xsl:when>
1729
1850
  <xsl:otherwise>
1730
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1851
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1731
1852
  </xsl:otherwise>
1732
1853
  </xsl:choose>
1733
1854
 
@@ -1738,8 +1859,13 @@
1738
1859
  </xsl:template>
1739
1860
 
1740
1861
  <xsl:template match="itu:locality">
1862
+ <xsl:variable name="title-section">
1863
+ <xsl:call-template name="getTitle">
1864
+ <xsl:with-param name="name" select="'title-section'"/>
1865
+ </xsl:call-template>
1866
+ </xsl:variable>
1741
1867
  <xsl:choose>
1742
- <xsl:when test="@type ='section'">Section</xsl:when>
1868
+ <xsl:when test="@type ='section'"><xsl:value-of select="normalize-space($title-section)"/></xsl:when>
1743
1869
  <xsl:otherwise/>
1744
1870
  </xsl:choose>
1745
1871
  <xsl:value-of select="itu:referenceFrom"/>
@@ -1750,18 +1876,30 @@
1750
1876
  <xsl:apply-templates/>
1751
1877
  </xsl:template>
1752
1878
 
1753
- <xsl:template match="itu:sourcecode">
1754
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
1755
- <xsl:choose>
1756
- <xsl:when test="@lang = 'en'"/>
1757
- <xsl:otherwise>
1758
- <xsl:attribute name="white-space">pre</xsl:attribute>
1759
- </xsl:otherwise>
1760
- </xsl:choose>
1761
- <xsl:apply-templates/>
1879
+ <xsl:template match="itu:quote">
1880
+ <fo:block margin-top="6pt" margin-left="12mm" margin-right="12mm">
1881
+ <xsl:apply-templates select=".//itu:p"/>
1762
1882
  </fo:block>
1883
+ <xsl:if test="itu:author or itu:source">
1884
+ <fo:block text-align="right">
1885
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1886
+ <xsl:text>— </xsl:text>
1887
+ <xsl:value-of select="itu:author"/>
1888
+ <xsl:if test="itu:author and itu:source">
1889
+ <xsl:text>, </xsl:text>
1890
+ </xsl:if>
1891
+ <xsl:apply-templates select="itu:source"/>
1892
+ </fo:block>
1893
+ </xsl:if>
1763
1894
  </xsl:template>
1764
1895
 
1896
+ <xsl:template match="itu:source">
1897
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1898
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1899
+ <xsl:apply-templates select="itu:localityStack"/>
1900
+ </fo:basic-link>
1901
+ </xsl:template>
1902
+
1765
1903
  <xsl:template name="insertHeaderFooter">
1766
1904
  <fo:static-content flow-name="footer-even" font-family="Times New Roman" font-size="11pt">
1767
1905
  <fo:block-container height="19mm" display-align="after">
@@ -2283,24 +2421,6 @@
2283
2421
  </xsl:if>
2284
2422
  </xsl:template>
2285
2423
 
2286
- <xsl:template name="getLevel">
2287
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2288
- <xsl:variable name="level">
2289
- <xsl:choose>
2290
- <xsl:when test="ancestor::itu:sections">
2291
- <xsl:value-of select="$level_total - 2"/>
2292
- </xsl:when>
2293
- <xsl:when test="ancestor::itu:bibliography">
2294
- <xsl:value-of select="$level_total - 2"/>
2295
- </xsl:when>
2296
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2297
- <xsl:otherwise>
2298
- <xsl:value-of select="$level_total - 1"/>
2299
- </xsl:otherwise>
2300
- </xsl:choose>
2301
- </xsl:variable>
2302
- <xsl:value-of select="$level"/>
2303
- </xsl:template>
2304
2424
 
2305
2425
  <xsl:template name="getSection">
2306
2426
  <xsl:param name="sectionNum"/>
@@ -2320,8 +2440,16 @@
2320
2440
  </xsl:when>
2321
2441
  <xsl:when test="$level &gt;= 2">
2322
2442
  <xsl:variable name="num">
2323
- <xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term | itu:clause/itu:term | itu:clause/itu:definitions"/>
2443
+ <xsl:call-template name="getSubSection"/>
2324
2444
  </xsl:variable>
2445
+ <!-- <xsl:variable name="sectionNum_">
2446
+ <xsl:choose>
2447
+ <xsl:when test="normalize-space($sectionNum) = ''"><xsl:number format="1" count="itu:sections/*"/></xsl:when>
2448
+ <xsl:otherwise>
2449
+ <xsl:value-of select="$sectionNum"/>
2450
+ </xsl:otherwise>
2451
+ </xsl:choose>
2452
+ </xsl:variable> -->
2325
2453
  <xsl:value-of select="concat($sectionNum, $num)"/>
2326
2454
  </xsl:when>
2327
2455
  <xsl:otherwise>
@@ -2331,8 +2459,13 @@
2331
2459
  </xsl:when>
2332
2460
  <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2333
2461
  <xsl:choose>
2334
- <xsl:when test="$level = 1">
2335
- <xsl:text>Appendix </xsl:text>
2462
+ <xsl:when test="$level = 1">
2463
+ <xsl:variable name="title-appendix">
2464
+ <xsl:call-template name="getTitle">
2465
+ <xsl:with-param name="name" select="'title-appendix'"/>
2466
+ </xsl:call-template>
2467
+ </xsl:variable>
2468
+ <xsl:value-of select="$title-appendix"/><xsl:text> </xsl:text>
2336
2469
  <xsl:number format="I" level="any" count="itu:annex[@obligation = 'informative']"/>
2337
2470
  </xsl:when>
2338
2471
  <xsl:otherwise>
@@ -2342,8 +2475,13 @@
2342
2475
  </xsl:when>
2343
2476
  <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2344
2477
  <xsl:choose>
2345
- <xsl:when test="$level = 1">
2346
- <xsl:text>Annex </xsl:text>
2478
+ <xsl:when test="$level = 1">
2479
+ <xsl:variable name="title-annex">
2480
+ <xsl:call-template name="getTitle">
2481
+ <xsl:with-param name="name" select="'title-annex'"/>
2482
+ </xsl:call-template>
2483
+ </xsl:variable>
2484
+ <xsl:value-of select="$title-annex"/>
2347
2485
  <xsl:choose>
2348
2486
  <xsl:when test="count(//itu:annex) = 1">
2349
2487
  <xsl:choose>
@@ -2390,98 +2528,279 @@
2390
2528
  </xsl:if>
2391
2529
  </xsl:template>
2392
2530
 
2393
- <xsl:template name="getId">
2531
+ <xsl:template name="getTopSection">
2532
+ <xsl:param name="sectionNum"/>
2533
+ <xsl:variable name="section">
2534
+ <xsl:call-template name="getSection">
2535
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
2536
+ </xsl:call-template>
2537
+ </xsl:variable>
2538
+ <xsl:variable name="topsection_" select="normalize-space(translate($section, '().-',' '))"/>
2394
2539
  <xsl:choose>
2395
- <xsl:when test="../@id">
2396
- <xsl:value-of select="../@id"/>
2540
+ <xsl:when test="contains($topsection_, ' ')">
2541
+ <xsl:value-of select="substring-before($topsection_, ' ')"/>
2397
2542
  </xsl:when>
2398
2543
  <xsl:otherwise>
2399
- <xsl:value-of select="concat(local-name(..), '_', text())"/>
2544
+ <xsl:value-of select="$topsection_"/>
2400
2545
  </xsl:otherwise>
2401
2546
  </xsl:choose>
2402
2547
  </xsl:template>
2403
2548
 
2404
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
2549
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2550
+
2551
+ <title-table lang="en">Table </title-table>
2552
+ <title-table lang="fr">Tableau </title-table>
2553
+
2554
+ <title-table lang="zh">Table </title-table>
2405
2555
 
2406
2556
 
2407
- </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
2408
- <xsl:value-of select="."/>
2409
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
2410
- <xsl:value-of select="$linebreak"/>
2411
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2412
- <xsl:call-template name="add-zero-spaces"/>
2413
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
2414
-
2415
- <xsl:variable name="simple-table">
2416
- <!-- <xsl:copy> -->
2417
- <xsl:call-template name="getSimpleTable"/>
2418
- <!-- </xsl:copy> -->
2419
- </xsl:variable>
2420
-
2421
- <!-- DEBUG -->
2422
- <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2423
- <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2424
2557
 
2425
- <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2558
+ <title-note lang="en">NOTE </title-note>
2559
+ <title-note lang="fr">NOTE </title-note>
2426
2560
 
2427
- <fo:block space-before="18pt"> </fo:block>
2561
+ <title-note lang="zh">NOTE </title-note>
2428
2562
 
2429
- <!-- <xsl:if test="$namespace = 'iso'">
2430
- <fo:block space-before="6pt">&#xA0;</fo:block>
2431
- </xsl:if> -->
2432
2563
 
2433
- <xsl:choose>
2434
- <xsl:when test="@unnumbered = 'true'"/>
2435
- <xsl:otherwise>
2436
-
2437
-
2564
+
2565
+ <title-figure lang="en">Figure </title-figure>
2566
+ <title-figure lang="fr">Figure </title-figure>
2567
+
2568
+ <title-figure lang="zh">Figure </title-figure>
2569
+
2570
+
2571
+
2572
+ <title-example lang="en">EXAMPLE </title-example>
2573
+ <title-example lang="fr">EXEMPLE </title-example>
2574
+
2575
+ <title-example lang="zh">EXAMPLE </title-example>
2576
+
2577
+
2578
+
2579
+ <title-example-xref lang="en">Example </title-example-xref>
2580
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2581
+
2582
+ <title-section lang="en">Section </title-section>
2583
+ <title-section lang="fr">Section </title-section>
2584
+
2585
+ <title-inequality lang="en">Inequality </title-inequality>
2586
+ <title-inequality lang="fr">Inequality </title-inequality>
2587
+
2588
+ <title-equation lang="en">Equation </title-equation>
2589
+ <title-equation lang="fr">Equation </title-equation>
2438
2590
 
2439
- <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2440
-
2441
-
2442
-
2443
-
2444
-
2445
-
2446
-
2447
- <xsl:text>Table </xsl:text>
2448
- <xsl:choose>
2449
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2450
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2451
- </xsl:when>
2452
- <xsl:when test="ancestor::*[local-name()='annex']">
2453
-
2454
-
2455
-
2456
-
2457
- <xsl:choose>
2458
- <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2459
- <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/>
2460
- <!-- Table in Appendix -->
2461
- <xsl:number format="I-" count="itu:annex[@obligation = 'informative']"/>
2462
- <xsl:number format="1" level="any" count="itu:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::itu:annex[@id = $annex-id]]"/>
2463
- </xsl:when>
2464
- <!-- Table in Annex -->
2465
- <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2466
- <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/>
2467
- <xsl:number format="A-" count="itu:annex[not(@obligation) or @obligation != 'informative']"/>
2468
- <xsl:number format="1" level="any" count="itu:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::itu:annex[@id = $annex-id]]"/>
2469
- </xsl:when>
2470
- </xsl:choose>
2471
-
2472
-
2473
-
2474
-
2475
-
2476
- </xsl:when>
2477
- <xsl:otherwise>
2478
-
2479
-
2480
- <xsl:number format="A." count="*[local-name()='annex']"/>
2481
- <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']"/>
2482
-
2483
- </xsl:otherwise>
2484
- </xsl:choose>
2591
+ <title-annex lang="en">Annex </title-annex>
2592
+ <title-annex lang="fr">Annexe </title-annex>
2593
+
2594
+ <title-annex lang="zh">Annex </title-annex>
2595
+
2596
+
2597
+
2598
+ <title-appendix lang="en">Appendix </title-appendix>
2599
+ <title-appendix lang="fr">Appendix </title-appendix>
2600
+
2601
+ <title-clause lang="en">Clause </title-clause>
2602
+ <title-clause lang="fr">Article </title-clause>
2603
+
2604
+ <title-clause lang="zh">Clause </title-clause>
2605
+
2606
+
2607
+
2608
+ <title-edition lang="en">
2609
+
2610
+ <xsl:text>Edition </xsl:text>
2611
+
2612
+
2613
+ </title-edition>
2614
+
2615
+ <title-formula lang="en">Formula </title-formula>
2616
+ <title-formula lang="fr">Formula </title-formula>
2617
+
2618
+ <title-toc lang="en">
2619
+
2620
+
2621
+ <xsl:text>Table of Contents</xsl:text>
2622
+
2623
+
2624
+ </title-toc>
2625
+ <title-toc lang="fr">Sommaire</title-toc>
2626
+
2627
+ <title-toc lang="zh">Contents</title-toc>
2628
+
2629
+
2630
+
2631
+ <title-page lang="en">Page</title-page>
2632
+ <title-page lang="fr">Page</title-page>
2633
+
2634
+ <title-key lang="en">Key</title-key>
2635
+ <title-key lang="fr">Légende</title-key>
2636
+
2637
+ <title-where lang="en">where</title-where>
2638
+ <title-where lang="fr">où</title-where>
2639
+
2640
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2641
+
2642
+ <title-part lang="en">
2643
+
2644
+
2645
+ </title-part>
2646
+ <title-part lang="fr">
2647
+
2648
+
2649
+ </title-part>
2650
+ <title-part lang="zh">第 # 部分:</title-part>
2651
+
2652
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2653
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2654
+
2655
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2656
+
2657
+
2658
+
2659
+ <title-modified lang="en">modified</title-modified>
2660
+ <title-modified lang="fr">modifiée</title-modified>
2661
+
2662
+ <title-modified lang="zh">modified</title-modified>
2663
+
2664
+
2665
+
2666
+ <title-source lang="en">SOURCE</title-source>
2667
+
2668
+ <title-keywords lang="en">Keywords</title-keywords>
2669
+
2670
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2671
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2672
+
2673
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2674
+
2675
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2676
+
2677
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2678
+
2679
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2680
+
2681
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2682
+
2683
+ <title-abstract lang="en">Abstract</title-abstract>
2684
+
2685
+ <title-summary lang="en">Summary</title-summary>
2686
+
2687
+ <title-in lang="en">in </title-in>
2688
+
2689
+ <title-box lang="en">Box </title-box>
2690
+
2691
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2692
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2693
+
2694
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2695
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2696
+
2697
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2698
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2699
+
2700
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2701
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2702
+
2703
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2704
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2705
+
2706
+ <title-caution lang="en">CAUTION</title-caution>
2707
+ <title-caution lang="zh">注意</title-caution>
2708
+
2709
+ <title-warning lang="en">WARNING</title-warning>
2710
+ <title-warning lang="zh">警告</title-warning>
2711
+
2712
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2713
+ </xsl:variable><xsl:template name="getTitle">
2714
+ <xsl:param name="name"/>
2715
+ <xsl:variable name="lang">
2716
+ <xsl:call-template name="getLang"/>
2717
+ </xsl:variable>
2718
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2719
+ <xsl:choose>
2720
+ <xsl:when test="normalize-space($title_) != ''">
2721
+ <xsl:value-of select="$title_"/>
2722
+ </xsl:when>
2723
+ <xsl:otherwise>
2724
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2725
+ </xsl:otherwise>
2726
+ </xsl:choose>
2727
+ </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">
2728
+
2729
+
2730
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2731
+
2732
+
2733
+
2734
+
2735
+
2736
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2737
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2738
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2739
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2740
+
2741
+
2742
+
2743
+
2744
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2745
+
2746
+
2747
+
2748
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2749
+
2750
+
2751
+
2752
+ </xsl:attribute-set><xsl:template match="text()">
2753
+ <xsl:value-of select="."/>
2754
+ </xsl:template><xsl:template match="*[local-name()='br']">
2755
+ <xsl:value-of select="$linebreak"/>
2756
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2757
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2758
+ <xsl:call-template name="add-zero-spaces-java"/>
2759
+ </xsl:template><xsl:template match="*[local-name()='table']">
2760
+
2761
+ <xsl:variable name="simple-table">
2762
+ <!-- <xsl:copy> -->
2763
+ <xsl:call-template name="getSimpleTable"/>
2764
+ <!-- </xsl:copy> -->
2765
+ </xsl:variable>
2766
+
2767
+ <!-- DEBUG -->
2768
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2769
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2770
+
2771
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2772
+
2773
+ <fo:block space-before="18pt"> </fo:block>
2774
+
2775
+ <!-- <xsl:if test="$namespace = 'iso'">
2776
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2777
+ </xsl:if> -->
2778
+
2779
+ <xsl:choose>
2780
+ <xsl:when test="@unnumbered = 'true'"/>
2781
+ <xsl:otherwise>
2782
+
2783
+
2784
+
2785
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2786
+
2787
+
2788
+
2789
+
2790
+
2791
+
2792
+
2793
+
2794
+ <xsl:variable name="title-table">
2795
+ <xsl:call-template name="getTitle">
2796
+ <xsl:with-param name="name" select="'title-table'"/>
2797
+ </xsl:call-template>
2798
+ </xsl:variable>
2799
+ <xsl:value-of select="$title-table"/>
2800
+
2801
+ <xsl:call-template name="getTableNumber"/>
2802
+
2803
+
2485
2804
  <xsl:if test="*[local-name()='name']">
2486
2805
 
2487
2806
 
@@ -2557,6 +2876,7 @@
2557
2876
 
2558
2877
 
2559
2878
 
2879
+
2560
2880
  <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">
2561
2881
 
2562
2882
 
@@ -2573,9 +2893,10 @@
2573
2893
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2574
2894
 
2575
2895
 
2896
+
2576
2897
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2577
2898
  <xsl:choose>
2578
- <xsl:when test=". = 1">
2899
+ <xsl:when test=". = 1 or . = 0">
2579
2900
  <fo:table-column column-width="proportional-column-width(2)"/>
2580
2901
  </xsl:when>
2581
2902
  <xsl:otherwise>
@@ -2583,21 +2904,68 @@
2583
2904
  </xsl:otherwise>
2584
2905
  </xsl:choose>
2585
2906
  </xsl:for-each>
2586
- <xsl:apply-templates/>
2907
+
2908
+ <xsl:choose>
2909
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2910
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2911
+ </xsl:when>
2912
+ <xsl:otherwise>
2913
+ <xsl:apply-templates/>
2914
+ </xsl:otherwise>
2915
+ </xsl:choose>
2916
+
2587
2917
  </fo:table>
2588
2918
 
2589
2919
 
2590
2920
 
2591
2921
  </fo:block-container>
2592
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2922
+ </xsl:template><xsl:template name="getTableNumber">
2923
+ <xsl:choose>
2924
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2925
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2926
+ </xsl:when>
2927
+ <xsl:when test="ancestor::*[local-name()='annex']">
2928
+
2929
+
2930
+
2931
+
2932
+ <xsl:choose>
2933
+ <xsl:when test="ancestor::*[local-name()='annex'][@obligation = 'informative']">
2934
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2935
+ <!-- Table in Appendix -->
2936
+ <xsl:number format="I-" count="*[local-name()='annex'][@obligation = 'informative']"/>
2937
+ <xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2938
+ </xsl:when>
2939
+ <!-- Table in Annex -->
2940
+ <xsl:when test="ancestor::*[local-name()='annex'][not(@obligation) or @obligation != 'informative']">
2941
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2942
+ <xsl:number format="A-" count="*[local-name()='annex'][not(@obligation) or @obligation != 'informative']"/>
2943
+ <xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2944
+ </xsl:when>
2945
+ </xsl:choose>
2946
+
2947
+
2948
+
2949
+
2950
+
2951
+ </xsl:when>
2952
+ <xsl:otherwise>
2953
+
2954
+
2955
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2956
+ <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']"/>
2957
+
2958
+ </xsl:otherwise>
2959
+ </xsl:choose>
2960
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2593
2961
  <xsl:apply-templates/>
2594
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
2962
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2595
2963
  <xsl:param name="table-row"/>
2596
2964
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2597
2965
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2598
2966
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2599
2967
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2600
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
2968
+ </xsl:template><xsl:template name="calculate-column-widths">
2601
2969
  <xsl:param name="table"/>
2602
2970
  <xsl:param name="cols-count"/>
2603
2971
  <xsl:param name="curr-col" select="1"/>
@@ -2606,7 +2974,7 @@
2606
2974
  <xsl:if test="$curr-col &lt;= $cols-count">
2607
2975
  <xsl:variable name="widths">
2608
2976
  <xsl:choose>
2609
- <xsl:when test="not($table)">
2977
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2610
2978
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2611
2979
  <xsl:variable name="words">
2612
2980
  <xsl:call-template name="tokenize">
@@ -2645,9 +3013,16 @@
2645
3013
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2646
3014
  </xsl:variable>
2647
3015
  <xsl:variable name="words">
3016
+ <xsl:variable name="string_with_added_zerospaces">
3017
+ <xsl:call-template name="add-zero-spaces-java">
3018
+ <xsl:with-param name="text" select="$td_text"/>
3019
+ </xsl:call-template>
3020
+ </xsl:variable>
2648
3021
  <xsl:call-template name="tokenize">
2649
3022
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2650
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
3023
+ <!-- 2009 thinspace -->
3024
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3025
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2651
3026
  </xsl:call-template>
2652
3027
  </xsl:variable>
2653
3028
  <xsl:variable name="max_length">
@@ -2688,17 +3063,28 @@
2688
3063
  <xsl:with-param name="table" select="$table"/>
2689
3064
  </xsl:call-template>
2690
3065
  </xsl:if>
2691
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
3066
+ </xsl:template><xsl:template match="text()" mode="td_text">
2692
3067
  <xsl:variable name="zero-space">​</xsl:variable>
2693
3068
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2694
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
3069
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3070
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3071
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3072
+ <xsl:value-of select="@target"/>
3073
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3074
+ <xsl:param name="cols-count"/>
2695
3075
  <!-- font-weight="bold" -->
2696
- <fo:table-header>
3076
+ <fo:table-header>
3077
+
2697
3078
  <xsl:apply-templates/>
2698
3079
  </fo:table-header>
2699
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
3080
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3081
+ <fo:table-body>
3082
+ <xsl:apply-templates/>
3083
+ </fo:table-body>
3084
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2700
3085
  <xsl:apply-templates/>
2701
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
3086
+ </xsl:template><xsl:template name="insertTableFooter">
3087
+ <xsl:param name="cols-count"/>
2702
3088
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2703
3089
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2704
3090
 
@@ -2709,22 +3095,7 @@
2709
3095
  <!-- if there are note(s) or fn(s) then create footer row -->
2710
3096
  <xsl:if test="$isNoteOrFnExist = 'true'">
2711
3097
 
2712
- <xsl:variable name="cols-count">
2713
- <xsl:choose>
2714
- <xsl:when test="../*[local-name()='thead']">
2715
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2716
- <xsl:call-template name="calculate-columns-numbers">
2717
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2718
- </xsl:call-template>
2719
- </xsl:when>
2720
- <xsl:otherwise>
2721
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2722
- <xsl:call-template name="calculate-columns-numbers">
2723
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2724
- </xsl:call-template>
2725
- </xsl:otherwise>
2726
- </xsl:choose>
2727
- </xsl:variable>
3098
+
2728
3099
 
2729
3100
  <fo:table-row>
2730
3101
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -2756,11 +3127,30 @@
2756
3127
  </fo:table-footer>
2757
3128
 
2758
3129
  </xsl:if>
2759
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
3130
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3131
+
3132
+ <xsl:variable name="cols-count">
3133
+ <xsl:choose>
3134
+ <xsl:when test="../*[local-name()='thead']">
3135
+ <xsl:call-template name="calculate-columns-numbers">
3136
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3137
+ </xsl:call-template>
3138
+ </xsl:when>
3139
+ <xsl:otherwise>
3140
+ <xsl:call-template name="calculate-columns-numbers">
3141
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3142
+ </xsl:call-template>
3143
+ </xsl:otherwise>
3144
+ </xsl:choose>
3145
+ </xsl:variable>
2760
3146
 
2761
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3147
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3148
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3149
+ </xsl:apply-templates>
2762
3150
 
2763
- <xsl:call-template name="insertTableFooter"/>
3151
+ <xsl:call-template name="insertTableFooter">
3152
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3153
+ </xsl:call-template>
2764
3154
 
2765
3155
  <fo:table-body>
2766
3156
  <xsl:apply-templates/>
@@ -2768,7 +3158,7 @@
2768
3158
 
2769
3159
  </fo:table-body>
2770
3160
 
2771
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
3161
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2772
3162
  <xsl:variable name="parent-name" select="local-name(..)"/>
2773
3163
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2774
3164
  <fo:table-row min-height="4mm">
@@ -2788,7 +3178,7 @@
2788
3178
 
2789
3179
  <xsl:apply-templates/>
2790
3180
  </fo:table-row>
2791
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
3181
+ </xsl:template><xsl:template match="*[local-name()='th']">
2792
3182
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2793
3183
 
2794
3184
 
@@ -2815,7 +3205,7 @@
2815
3205
  <xsl:apply-templates/>
2816
3206
  </fo:block>
2817
3207
  </fo:table-cell>
2818
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
3208
+ </xsl:template><xsl:template match="*[local-name()='td']">
2819
3209
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2820
3210
 
2821
3211
 
@@ -2842,6 +3232,7 @@
2842
3232
  </xsl:attribute>
2843
3233
  </xsl:if>
2844
3234
  <fo:block>
3235
+
2845
3236
  <xsl:apply-templates/>
2846
3237
  </fo:block>
2847
3238
  <!-- <xsl:choose>
@@ -2857,16 +3248,23 @@
2857
3248
 
2858
3249
 
2859
3250
  </fo:table-cell>
2860
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3251
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2861
3252
 
2862
3253
 
2863
3254
  <fo:block font-size="10pt" margin-bottom="12pt">
2864
3255
 
2865
3256
 
2866
3257
 
3258
+
2867
3259
  <fo:inline padding-right="2mm">
2868
3260
 
2869
- <xsl:text>NOTE </xsl:text>
3261
+
3262
+ <xsl:variable name="title-note">
3263
+ <xsl:call-template name="getTitle">
3264
+ <xsl:with-param name="name" select="'title-note'"/>
3265
+ </xsl:call-template>
3266
+ </xsl:variable>
3267
+ <xsl:value-of select="$title-note"/>
2870
3268
 
2871
3269
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2872
3270
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -2880,9 +3278,9 @@
2880
3278
  <xsl:apply-templates mode="process"/>
2881
3279
  </fo:block>
2882
3280
 
2883
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3281
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2884
3282
  <xsl:apply-templates/>
2885
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
3283
+ </xsl:template><xsl:template name="fn_display">
2886
3284
  <xsl:variable name="references">
2887
3285
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2888
3286
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2903,6 +3301,12 @@
2903
3301
 
2904
3302
 
2905
3303
 
3304
+
3305
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
3306
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
3307
+ <xsl:attribute name="text-indent">-5mm</xsl:attribute>
3308
+ <xsl:attribute name="start-indent">5mm</xsl:attribute>
3309
+
2906
3310
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2907
3311
 
2908
3312
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2912,6 +3316,7 @@
2912
3316
 
2913
3317
 
2914
3318
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
3319
+ <xsl:attribute name="font-size">70%</xsl:attribute>
2915
3320
 
2916
3321
 
2917
3322
  <xsl:value-of select="@reference"/>
@@ -2928,7 +3333,7 @@
2928
3333
  </fo:block>
2929
3334
  </xsl:if>
2930
3335
  </xsl:for-each>
2931
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
3336
+ </xsl:template><xsl:template name="fn_name_display">
2932
3337
  <!-- <xsl:variable name="references">
2933
3338
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2934
3339
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2944,7 +3349,7 @@
2944
3349
  <xsl:apply-templates/>
2945
3350
  </fo:block>
2946
3351
  </xsl:for-each>
2947
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
3352
+ </xsl:template><xsl:template name="fn_display_figure">
2948
3353
  <xsl:variable name="key_iso">
2949
3354
  <!-- and (not(@class) or @class !='pseudocode') -->
2950
3355
  </xsl:variable>
@@ -2955,6 +3360,36 @@
2955
3360
  </fn>
2956
3361
  </xsl:for-each>
2957
3362
  </xsl:variable>
3363
+
3364
+ <!-- current hierarchy is 'figure' element -->
3365
+ <xsl:variable name="following_dl_colwidths">
3366
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3367
+ <xsl:variable name="html-table">
3368
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3369
+ <xsl:element name="{$ns}:table">
3370
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3371
+ <tbody>
3372
+ <xsl:apply-templates mode="dl"/>
3373
+ </tbody>
3374
+ </xsl:for-each>
3375
+ </xsl:element>
3376
+ </xsl:variable>
3377
+
3378
+ <xsl:call-template name="calculate-column-widths">
3379
+ <xsl:with-param name="cols-count" select="2"/>
3380
+ <xsl:with-param name="table" select="$html-table"/>
3381
+ </xsl:call-template>
3382
+
3383
+ </xsl:if>
3384
+ </xsl:variable>
3385
+
3386
+
3387
+ <xsl:variable name="maxlength_dt">
3388
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3389
+ <xsl:call-template name="getMaxLength_dt"/>
3390
+ </xsl:for-each>
3391
+ </xsl:variable>
3392
+
2958
3393
  <xsl:if test="xalan:nodeset($references)//fn">
2959
3394
  <fo:block>
2960
3395
  <fo:table width="95%" table-layout="fixed">
@@ -2962,8 +3397,19 @@
2962
3397
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2963
3398
 
2964
3399
  </xsl:if>
2965
- <fo:table-column column-width="15%"/>
2966
- <fo:table-column column-width="85%"/>
3400
+ <xsl:choose>
3401
+ <!-- if there 'dl', then set same columns width -->
3402
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3403
+ <xsl:call-template name="setColumnWidth_dl">
3404
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3405
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3406
+ </xsl:call-template>
3407
+ </xsl:when>
3408
+ <xsl:otherwise>
3409
+ <fo:table-column column-width="15%"/>
3410
+ <fo:table-column column-width="85%"/>
3411
+ </xsl:otherwise>
3412
+ </xsl:choose>
2967
3413
  <fo:table-body>
2968
3414
  <xsl:for-each select="xalan:nodeset($references)//fn">
2969
3415
  <xsl:variable name="reference" select="@reference"/>
@@ -2995,7 +3441,7 @@
2995
3441
  </fo:block>
2996
3442
  </xsl:if>
2997
3443
 
2998
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
3444
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2999
3445
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3000
3446
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3001
3447
 
@@ -3010,11 +3456,11 @@
3010
3456
  <xsl:value-of select="@reference"/>
3011
3457
  </fo:basic-link>
3012
3458
  </fo:inline>
3013
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
3459
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3014
3460
  <fo:inline>
3015
3461
  <xsl:apply-templates/>
3016
3462
  </fo:inline>
3017
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
3463
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3018
3464
  <xsl:variable name="parent" select="local-name(..)"/>
3019
3465
 
3020
3466
  <xsl:variable name="key_iso">
@@ -3026,8 +3472,13 @@
3026
3472
 
3027
3473
 
3028
3474
  <fo:block margin-bottom="12pt" text-align="left">
3029
-
3030
- <xsl:text>where </xsl:text>
3475
+
3476
+ <xsl:variable name="title-where">
3477
+ <xsl:call-template name="getTitle">
3478
+ <xsl:with-param name="name" select="'title-where'"/>
3479
+ </xsl:call-template>
3480
+ </xsl:variable>
3481
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3031
3482
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3032
3483
  <xsl:text/>
3033
3484
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3042,15 +3493,25 @@
3042
3493
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3043
3494
 
3044
3495
 
3045
- <xsl:text>where</xsl:text>
3496
+ <xsl:variable name="title-where">
3497
+ <xsl:call-template name="getTitle">
3498
+ <xsl:with-param name="name" select="'title-where'"/>
3499
+ </xsl:call-template>
3500
+ </xsl:variable>
3501
+ <xsl:value-of select="$title-where"/>:
3046
3502
  </fo:block>
3047
3503
  </xsl:when>
3048
3504
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3049
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3505
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3050
3506
 
3051
3507
 
3052
3508
 
3053
- <xsl:text>Key</xsl:text>
3509
+ <xsl:variable name="title-key">
3510
+ <xsl:call-template name="getTitle">
3511
+ <xsl:with-param name="name" select="'title-key'"/>
3512
+ </xsl:call-template>
3513
+ </xsl:variable>
3514
+ <xsl:value-of select="$title-key"/>
3054
3515
  </fo:block>
3055
3516
  </xsl:when>
3056
3517
  </xsl:choose>
@@ -3060,31 +3521,19 @@
3060
3521
  <fo:block>
3061
3522
 
3062
3523
 
3063
- <xsl:if test="local-name(..) = 'li'">
3064
- <xsl:attribute name="margin-left">-4mm</xsl:attribute>
3524
+ <xsl:if test="$parent = 'figure' or $parent = 'formula'">
3525
+ <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
3065
3526
  </xsl:if>
3527
+ <xsl:if test="$parent = 'li'">
3528
+ <!-- <xsl:attribute name="margin-left">-4mm</xsl:attribute> -->
3529
+ </xsl:if>
3530
+
3066
3531
 
3067
3532
 
3068
3533
  <fo:block>
3069
3534
 
3070
3535
 
3071
- <!-- create virtual html table for dl/[dt and dd] -->
3072
- <xsl:variable name="html-table">
3073
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3074
- <xsl:element name="{$ns}:table">
3075
- <tbody>
3076
- <xsl:apply-templates mode="dl"/>
3077
- </tbody>
3078
- </xsl:element>
3079
- </xsl:variable>
3080
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3081
- <xsl:variable name="colwidths">
3082
- <xsl:call-template name="calculate-column-widths">
3083
- <xsl:with-param name="cols-count" select="2"/>
3084
- <xsl:with-param name="table" select="$html-table"/>
3085
- </xsl:call-template>
3086
- </xsl:variable>
3087
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3536
+
3088
3537
 
3089
3538
  <fo:table width="95%" table-layout="fixed">
3090
3539
 
@@ -3097,42 +3546,30 @@
3097
3546
 
3098
3547
  </xsl:when>
3099
3548
  </xsl:choose>
3100
- <xsl:choose>
3101
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3102
- <fo:table-column column-width="50%"/>
3103
- <fo:table-column column-width="50%"/>
3104
- </xsl:when>
3105
- <xsl:otherwise>
3106
- <xsl:choose>
3107
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3108
- <fo:table-column column-width="60%"/>
3109
- <fo:table-column column-width="40%"/>
3110
- </xsl:when> -->
3111
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3112
- <fo:table-column column-width="50%"/>
3113
- <fo:table-column column-width="50%"/>
3114
- </xsl:when>
3115
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3116
- <fo:table-column column-width="40%"/>
3117
- <fo:table-column column-width="60%"/>
3118
- </xsl:when>
3119
- <xsl:otherwise>
3120
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3121
- <xsl:choose>
3122
- <xsl:when test=". = 1">
3123
- <fo:table-column column-width="proportional-column-width(2)"/>
3124
- </xsl:when>
3125
- <xsl:otherwise>
3126
- <fo:table-column column-width="proportional-column-width({.})"/>
3127
- </xsl:otherwise>
3128
- </xsl:choose>
3129
- </xsl:for-each>
3130
- </xsl:otherwise>
3131
- </xsl:choose>
3132
- <!-- <fo:table-column column-width="15%"/>
3133
- <fo:table-column column-width="85%"/> -->
3134
- </xsl:otherwise>
3135
- </xsl:choose>
3549
+ <!-- create virtual html table for dl/[dt and dd] -->
3550
+ <xsl:variable name="html-table">
3551
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3552
+ <xsl:element name="{$ns}:table">
3553
+ <tbody>
3554
+ <xsl:apply-templates mode="dl"/>
3555
+ </tbody>
3556
+ </xsl:element>
3557
+ </xsl:variable>
3558
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3559
+ <xsl:variable name="colwidths">
3560
+ <xsl:call-template name="calculate-column-widths">
3561
+ <xsl:with-param name="cols-count" select="2"/>
3562
+ <xsl:with-param name="table" select="$html-table"/>
3563
+ </xsl:call-template>
3564
+ </xsl:variable>
3565
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3566
+ <xsl:variable name="maxlength_dt">
3567
+ <xsl:call-template name="getMaxLength_dt"/>
3568
+ </xsl:variable>
3569
+ <xsl:call-template name="setColumnWidth_dl">
3570
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3571
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3572
+ </xsl:call-template>
3136
3573
  <fo:table-body>
3137
3574
  <xsl:apply-templates>
3138
3575
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3142,7 +3579,61 @@
3142
3579
  </fo:block>
3143
3580
  </fo:block>
3144
3581
  </xsl:if>
3145
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
3582
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3583
+ <xsl:param name="colwidths"/>
3584
+ <xsl:param name="maxlength_dt"/>
3585
+ <xsl:choose>
3586
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3587
+ <fo:table-column column-width="50%"/>
3588
+ <fo:table-column column-width="50%"/>
3589
+ </xsl:when>
3590
+ <xsl:otherwise>
3591
+ <xsl:choose>
3592
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3593
+ <fo:table-column column-width="5%"/>
3594
+ <fo:table-column column-width="95%"/>
3595
+ </xsl:when>
3596
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3597
+ <fo:table-column column-width="10%"/>
3598
+ <fo:table-column column-width="90%"/>
3599
+ </xsl:when>
3600
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3601
+ <fo:table-column column-width="60%"/>
3602
+ <fo:table-column column-width="40%"/>
3603
+ </xsl:when> -->
3604
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3605
+ <fo:table-column column-width="50%"/>
3606
+ <fo:table-column column-width="50%"/>
3607
+ </xsl:when>
3608
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3609
+ <fo:table-column column-width="40%"/>
3610
+ <fo:table-column column-width="60%"/>
3611
+ </xsl:when>
3612
+ <xsl:otherwise>
3613
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3614
+ <xsl:choose>
3615
+ <xsl:when test=". = 1 or . = 0">
3616
+ <fo:table-column column-width="proportional-column-width(2)"/>
3617
+ </xsl:when>
3618
+ <xsl:otherwise>
3619
+ <fo:table-column column-width="proportional-column-width({.})"/>
3620
+ </xsl:otherwise>
3621
+ </xsl:choose>
3622
+ </xsl:for-each>
3623
+ </xsl:otherwise>
3624
+ </xsl:choose>
3625
+ <!-- <fo:table-column column-width="15%"/>
3626
+ <fo:table-column column-width="85%"/> -->
3627
+ </xsl:otherwise>
3628
+ </xsl:choose>
3629
+ </xsl:template><xsl:template name="getMaxLength_dt">
3630
+ <xsl:for-each select="*[local-name()='dt']">
3631
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3632
+ <xsl:if test="position() = 1">
3633
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3634
+ </xsl:if>
3635
+ </xsl:for-each>
3636
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3146
3637
  <xsl:param name="key_iso"/>
3147
3638
 
3148
3639
  <!-- <tr>
@@ -3158,7 +3649,12 @@
3158
3649
  <xsl:if test="normalize-space($key_iso) = 'true'">
3159
3650
  <xsl:attribute name="margin-top">0</xsl:attribute>
3160
3651
  </xsl:if>
3161
- NOTE
3652
+ <xsl:variable name="title-note">
3653
+ <xsl:call-template name="getTitle">
3654
+ <xsl:with-param name="name" select="'title-note'"/>
3655
+ </xsl:call-template>
3656
+ </xsl:variable>
3657
+ <xsl:value-of select="$title-note"/>
3162
3658
  </fo:block>
3163
3659
  </fo:table-cell>
3164
3660
  <fo:table-cell>
@@ -3167,7 +3663,7 @@
3167
3663
  </fo:block>
3168
3664
  </fo:table-cell>
3169
3665
  </fo:table-row>
3170
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
3666
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3171
3667
  <tr>
3172
3668
  <td>
3173
3669
  <xsl:apply-templates/>
@@ -3180,11 +3676,16 @@
3180
3676
  </td>
3181
3677
  </tr>
3182
3678
 
3183
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
3679
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3184
3680
  <xsl:param name="key_iso"/>
3185
3681
 
3186
3682
  <fo:table-row>
3187
3683
  <fo:table-cell>
3684
+
3685
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
3686
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
3687
+ </xsl:if>
3688
+
3188
3689
  <fo:block margin-top="6pt">
3189
3690
 
3190
3691
 
@@ -3194,8 +3695,19 @@
3194
3695
  </xsl:if>
3195
3696
 
3196
3697
 
3197
- <xsl:apply-templates/>
3198
3698
 
3699
+
3700
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
3701
+ <xsl:attribute name="text-align">right</xsl:attribute>
3702
+ </xsl:if>
3703
+
3704
+
3705
+ <xsl:apply-templates/>
3706
+ <!-- <xsl:if test="$namespace = 'gb'">
3707
+ <xsl:if test="ancestor::*[local-name()='formula']">
3708
+ <xsl:text>—</xsl:text>
3709
+ </xsl:if>
3710
+ </xsl:if> -->
3199
3711
  </fo:block>
3200
3712
  </fo:table-cell>
3201
3713
  <fo:table-cell>
@@ -3211,37 +3723,37 @@
3211
3723
  </fo:table-cell>
3212
3724
  </fo:table-row>
3213
3725
 
3214
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
3726
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3215
3727
  <xsl:apply-templates/>
3216
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
3728
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3217
3729
  <xsl:apply-templates/>
3218
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3730
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3219
3731
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3220
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
3732
+ </xsl:template><xsl:template match="*[local-name()='em']">
3221
3733
  <fo:inline font-style="italic">
3222
3734
  <xsl:apply-templates/>
3223
3735
  </fo:inline>
3224
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
3736
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3225
3737
  <fo:inline font-weight="bold">
3226
3738
  <xsl:apply-templates/>
3227
3739
  </fo:inline>
3228
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
3740
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3229
3741
  <fo:inline font-size="80%" vertical-align="super">
3230
3742
  <xsl:apply-templates/>
3231
3743
  </fo:inline>
3232
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
3744
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3233
3745
  <fo:inline font-size="80%" vertical-align="sub">
3234
3746
  <xsl:apply-templates/>
3235
3747
  </fo:inline>
3236
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
3237
- <fo:inline font-family="Courier" font-size="10pt">
3748
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3749
+ <fo:inline font-family="Courier" font-size="10pt">
3238
3750
  <xsl:apply-templates/>
3239
3751
  </fo:inline>
3240
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
3752
+ </xsl:template><xsl:template match="*[local-name()='del']">
3241
3753
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3242
3754
  <xsl:apply-templates/>
3243
3755
  </fo:inline>
3244
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
3756
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3245
3757
  <xsl:variable name="text" select="normalize-space(.)"/>
3246
3758
  <fo:inline font-size="75%">
3247
3759
  <xsl:if test="string-length($text) &gt; 0">
@@ -3250,10 +3762,11 @@
3250
3762
  </xsl:call-template>
3251
3763
  </xsl:if>
3252
3764
  </fo:inline>
3253
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
3765
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3254
3766
  <xsl:param name="text"/>
3255
3767
  <xsl:variable name="char" select="substring($text,1,1)"/>
3256
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3768
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3769
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3257
3770
  <xsl:choose>
3258
3771
  <xsl:when test="$char=$upperCase">
3259
3772
  <fo:inline font-size="{100 div 0.75}%">
@@ -3269,7 +3782,7 @@
3269
3782
  <xsl:with-param name="text" select="substring($text,2)"/>
3270
3783
  </xsl:call-template>
3271
3784
  </xsl:if>
3272
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
3785
+ </xsl:template><xsl:template name="tokenize">
3273
3786
  <xsl:param name="text"/>
3274
3787
  <xsl:param name="separator" select="' '"/>
3275
3788
  <xsl:choose>
@@ -3317,7 +3830,7 @@
3317
3830
  </xsl:call-template>
3318
3831
  </xsl:otherwise>
3319
3832
  </xsl:choose>
3320
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
3833
+ </xsl:template><xsl:template name="max_length">
3321
3834
  <xsl:param name="words"/>
3322
3835
  <xsl:for-each select="$words//word">
3323
3836
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3325,7 +3838,11 @@
3325
3838
  <xsl:value-of select="."/>
3326
3839
  </xsl:if>
3327
3840
  </xsl:for-each>
3328
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
3841
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3842
+ <xsl:param name="text" select="."/>
3843
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3844
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3845
+ </xsl:template><xsl:template name="add-zero-spaces">
3329
3846
  <xsl:param name="text" select="."/>
3330
3847
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3331
3848
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3378,7 +3895,7 @@
3378
3895
  <xsl:value-of select="$text"/>
3379
3896
  </xsl:otherwise>
3380
3897
  </xsl:choose>
3381
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
3898
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3382
3899
  <xsl:param name="text" select="."/>
3383
3900
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3384
3901
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3404,7 +3921,7 @@
3404
3921
  <xsl:value-of select="$text"/>
3405
3922
  </xsl:otherwise>
3406
3923
  </xsl:choose>
3407
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
3924
+ </xsl:template><xsl:template name="getSimpleTable">
3408
3925
  <xsl:variable name="simple-table">
3409
3926
 
3410
3927
  <!-- Step 1. colspan processing -->
@@ -3431,9 +3948,9 @@
3431
3948
  </xsl:choose> -->
3432
3949
  </xsl:variable>
3433
3950
  <xsl:copy-of select="$simple-table"/>
3434
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3951
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3435
3952
  <xsl:apply-templates mode="simple-table-colspan"/>
3436
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3953
+ </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">
3437
3954
  <xsl:choose>
3438
3955
  <xsl:when test="@colspan">
3439
3956
  <xsl:variable name="td">
@@ -3455,16 +3972,16 @@
3455
3972
  </xsl:element>
3456
3973
  </xsl:otherwise>
3457
3974
  </xsl:choose>
3458
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
3975
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3459
3976
  <xsl:element name="tr">
3460
3977
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3461
3978
  <xsl:apply-templates mode="simple-table-colspan"/>
3462
3979
  </xsl:element>
3463
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
3980
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3464
3981
  <xsl:copy>
3465
3982
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3466
3983
  </xsl:copy>
3467
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
3984
+ </xsl:template><xsl:template name="repeatNode">
3468
3985
  <xsl:param name="count"/>
3469
3986
  <xsl:param name="node"/>
3470
3987
 
@@ -3475,18 +3992,18 @@
3475
3992
  </xsl:call-template>
3476
3993
  <xsl:copy-of select="$node"/>
3477
3994
  </xsl:if>
3478
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
3995
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3479
3996
  <xsl:copy>
3480
3997
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3481
3998
  </xsl:copy>
3482
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
3999
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3483
4000
  <xsl:copy>
3484
4001
  <xsl:copy-of select="tr[1]"/>
3485
4002
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3486
4003
  <xsl:with-param name="previousRow" select="tr[1]"/>
3487
4004
  </xsl:apply-templates>
3488
4005
  </xsl:copy>
3489
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
4006
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3490
4007
  <xsl:param name="previousRow"/>
3491
4008
  <xsl:variable name="currentRow" select="."/>
3492
4009
 
@@ -3520,43 +4037,53 @@
3520
4037
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3521
4038
  <xsl:with-param name="previousRow" select="$newRow"/>
3522
4039
  </xsl:apply-templates>
3523
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
4040
+ </xsl:template><xsl:template name="getLang">
3524
4041
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3525
4042
  <xsl:choose>
3526
4043
  <xsl:when test="$language = 'English'">en</xsl:when>
3527
4044
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3528
4045
  </xsl:choose>
3529
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
4046
+ </xsl:template><xsl:template name="capitalizeWords">
3530
4047
  <xsl:param name="str"/>
3531
4048
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3532
4049
  <xsl:choose>
3533
4050
  <xsl:when test="contains($str2, ' ')">
3534
4051
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3535
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3536
- <xsl:value-of select="substring($substr, 2)"/>
4052
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4053
+ <xsl:value-of select="substring($substr, 2)"/> -->
4054
+ <xsl:call-template name="capitalize">
4055
+ <xsl:with-param name="str" select="$substr"/>
4056
+ </xsl:call-template>
3537
4057
  <xsl:text> </xsl:text>
3538
4058
  <xsl:call-template name="capitalizeWords">
3539
4059
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3540
4060
  </xsl:call-template>
3541
4061
  </xsl:when>
3542
4062
  <xsl:otherwise>
3543
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3544
- <xsl:value-of select="substring($str2, 2)"/>
4063
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4064
+ <xsl:value-of select="substring($str2, 2)"/> -->
4065
+ <xsl:call-template name="capitalize">
4066
+ <xsl:with-param name="str" select="$str2"/>
4067
+ </xsl:call-template>
3545
4068
  </xsl:otherwise>
3546
4069
  </xsl:choose>
3547
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
4070
+ </xsl:template><xsl:template name="capitalize">
4071
+ <xsl:param name="str"/>
4072
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4073
+ <xsl:value-of select="substring($str, 2)"/>
4074
+ </xsl:template><xsl:template match="mathml:math">
3548
4075
  <fo:inline font-family="STIX2Math">
3549
4076
  <fo:instream-foreign-object fox:alt-text="Math">
3550
4077
  <xsl:copy-of select="."/>
3551
4078
  </fo:instream-foreign-object>
3552
4079
  </fo:inline>
3553
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
4080
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3554
4081
  <xsl:for-each select="*[local-name()='locality']">
3555
4082
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3556
4083
  <xsl:apply-templates select="."/>
3557
4084
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3558
4085
  </xsl:for-each>
3559
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
4086
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3560
4087
  <xsl:variable name="target">
3561
4088
  <xsl:choose>
3562
4089
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3586,4 +4113,246 @@
3586
4113
  </xsl:otherwise>
3587
4114
  </xsl:choose>
3588
4115
  </fo:inline>
4116
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4117
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4118
+ <!-- <xsl:choose>
4119
+ <xsl:when test="@lang = 'en'"></xsl:when>
4120
+ <xsl:otherwise> -->
4121
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4122
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4123
+ <!-- </xsl:otherwise>
4124
+ </xsl:choose> -->
4125
+ <xsl:apply-templates/>
4126
+ </fo:block>
4127
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4128
+ <fo:inline id="{@id}"/>
4129
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4130
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4131
+ <xsl:variable name="title-appendix">
4132
+ <xsl:call-template name="getTitle">
4133
+ <xsl:with-param name="name" select="'title-appendix'"/>
4134
+ </xsl:call-template>
4135
+ </xsl:variable>
4136
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4137
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4138
+ </fo:block>
4139
+ <xsl:apply-templates/>
4140
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4141
+ <fo:inline><xsl:apply-templates/></fo:inline>
4142
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4143
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4144
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4145
+ <xsl:variable name="title-example">
4146
+ <xsl:call-template name="getTitle">
4147
+ <xsl:with-param name="name" select="'title-example'"/>
4148
+ </xsl:call-template>
4149
+ </xsl:variable>
4150
+ <xsl:value-of select="$title-example"/>
4151
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4152
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4153
+ </xsl:if>
4154
+ <xsl:if test="*[local-name()='name']">
4155
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4156
+ </xsl:if>
4157
+ </fo:block>
4158
+ <xsl:apply-templates/>
4159
+ </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">
4160
+ <fo:inline><xsl:apply-templates/></fo:inline>
4161
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4162
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4163
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4164
+ <xsl:variable name="annotation-id" select="@id"/>
4165
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4166
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4167
+ <fo:inline>
4168
+ <xsl:apply-templates>
4169
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4170
+ </xsl:apply-templates>
4171
+ </fo:inline>
4172
+ </fo:block>
4173
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4174
+ <xsl:param name="callout"/>
4175
+ <fo:inline id="{@id}">
4176
+ <!-- for first p in annotation, put <x> -->
4177
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4178
+ <xsl:apply-templates/>
4179
+ </fo:inline>
4180
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4181
+ <xsl:variable name="title-modified">
4182
+ <xsl:call-template name="getTitle">
4183
+ <xsl:with-param name="name" select="'title-modified'"/>
4184
+ </xsl:call-template>
4185
+ </xsl:variable>
4186
+ <xsl:choose>
4187
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4188
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4189
+ </xsl:choose>
4190
+ <xsl:apply-templates/>
4191
+ </xsl:template><xsl:template name="convertDate">
4192
+ <xsl:param name="date"/>
4193
+ <xsl:param name="format" select="'short'"/>
4194
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4195
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4196
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4197
+ <xsl:variable name="monthStr">
4198
+ <xsl:choose>
4199
+ <xsl:when test="$month = '01'">January</xsl:when>
4200
+ <xsl:when test="$month = '02'">February</xsl:when>
4201
+ <xsl:when test="$month = '03'">March</xsl:when>
4202
+ <xsl:when test="$month = '04'">April</xsl:when>
4203
+ <xsl:when test="$month = '05'">May</xsl:when>
4204
+ <xsl:when test="$month = '06'">June</xsl:when>
4205
+ <xsl:when test="$month = '07'">July</xsl:when>
4206
+ <xsl:when test="$month = '08'">August</xsl:when>
4207
+ <xsl:when test="$month = '09'">September</xsl:when>
4208
+ <xsl:when test="$month = '10'">October</xsl:when>
4209
+ <xsl:when test="$month = '11'">November</xsl:when>
4210
+ <xsl:when test="$month = '12'">December</xsl:when>
4211
+ </xsl:choose>
4212
+ </xsl:variable>
4213
+ <xsl:variable name="result">
4214
+ <xsl:choose>
4215
+ <xsl:when test="$format = 'short' or $day = ''">
4216
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4217
+ </xsl:when>
4218
+ <xsl:otherwise>
4219
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4220
+ </xsl:otherwise>
4221
+ </xsl:choose>
4222
+ </xsl:variable>
4223
+ <xsl:value-of select="$result"/>
4224
+ </xsl:template><xsl:template name="insertKeywords">
4225
+ <xsl:param name="sorting" select="'true'"/>
4226
+ <xsl:param name="charAtEnd" select="'.'"/>
4227
+ <xsl:param name="charDelim" select="', '"/>
4228
+ <xsl:choose>
4229
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4230
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4231
+ <xsl:sort data-type="text" order="ascending"/>
4232
+ <xsl:call-template name="insertKeyword">
4233
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4234
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4235
+ </xsl:call-template>
4236
+ </xsl:for-each>
4237
+ </xsl:when>
4238
+ <xsl:otherwise>
4239
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4240
+ <xsl:call-template name="insertKeyword">
4241
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4242
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4243
+ </xsl:call-template>
4244
+ </xsl:for-each>
4245
+ </xsl:otherwise>
4246
+ </xsl:choose>
4247
+ </xsl:template><xsl:template name="insertKeyword">
4248
+ <xsl:param name="charAtEnd"/>
4249
+ <xsl:param name="charDelim"/>
4250
+ <xsl:apply-templates/>
4251
+ <xsl:choose>
4252
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4253
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4254
+ </xsl:choose>
4255
+ </xsl:template><xsl:template name="addPDFUAmeta">
4256
+ <fo:declarations>
4257
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4258
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4259
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4260
+ </pdf:dictionary>
4261
+ </pdf:catalog>
4262
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4263
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4264
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4265
+ <!-- Dublin Core properties go here -->
4266
+ <dc:title>
4267
+ <xsl:variable name="title">
4268
+
4269
+
4270
+
4271
+
4272
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@type='main']"/>
4273
+
4274
+ </xsl:variable>
4275
+ <xsl:choose>
4276
+ <xsl:when test="normalize-space($title) != ''">
4277
+ <xsl:value-of select="$title"/>
4278
+ </xsl:when>
4279
+ <xsl:otherwise>
4280
+ <xsl:text> </xsl:text>
4281
+ </xsl:otherwise>
4282
+ </xsl:choose>
4283
+ </dc:title>
4284
+ <dc:creator>
4285
+
4286
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
4287
+
4288
+
4289
+ </dc:creator>
4290
+ <dc:description>
4291
+ <xsl:variable name="abstract">
4292
+
4293
+
4294
+
4295
+
4296
+ <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
4297
+
4298
+ </xsl:variable>
4299
+ <xsl:value-of select="normalize-space($abstract)"/>
4300
+ </dc:description>
4301
+ <pdf:Keywords>
4302
+ <xsl:call-template name="insertKeywords"/>
4303
+ </pdf:Keywords>
4304
+ </rdf:Description>
4305
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4306
+ <!-- XMP properties go here -->
4307
+ <xmp:CreatorTool/>
4308
+ </rdf:Description>
4309
+ </rdf:RDF>
4310
+ </x:xmpmeta>
4311
+ </fo:declarations>
4312
+ </xsl:template><xsl:template name="getId">
4313
+ <xsl:choose>
4314
+ <xsl:when test="../@id">
4315
+ <xsl:value-of select="../@id"/>
4316
+ </xsl:when>
4317
+ <xsl:otherwise>
4318
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4319
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4320
+ </xsl:otherwise>
4321
+ </xsl:choose>
4322
+ </xsl:template><xsl:template name="getLevel">
4323
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4324
+ <xsl:variable name="level">
4325
+ <xsl:choose>
4326
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4327
+ <xsl:value-of select="$level_total - 2"/>
4328
+ </xsl:when>
4329
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4330
+ <xsl:value-of select="$level_total - 2"/>
4331
+ </xsl:when>
4332
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4333
+ <xsl:value-of select="$level_total - 2"/>
4334
+ </xsl:when>
4335
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4336
+ <xsl:otherwise>
4337
+ <xsl:value-of select="$level_total - 1"/>
4338
+ </xsl:otherwise>
4339
+ </xsl:choose>
4340
+ </xsl:variable>
4341
+ <xsl:value-of select="$level"/>
4342
+ </xsl:template><xsl:template name="getSubSection">
4343
+ <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']"/>
4344
+ </xsl:template><xsl:template name="split">
4345
+ <xsl:param name="pText" select="."/>
4346
+ <xsl:param name="sep" select="','"/>
4347
+ <xsl:if test="string-length($pText) &gt;0">
4348
+ <item>
4349
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4350
+ </item>
4351
+ <xsl:call-template name="split">
4352
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4353
+ <xsl:with-param name="sep" select="$sep"/>
4354
+ </xsl:call-template>
4355
+ </xsl:if>
4356
+ </xsl:template><xsl:template name="getDocumentId">
4357
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3589
4358
  </xsl:template></xsl:stylesheet>