metanorma-itu 1.0.17 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -119,35 +120,7 @@
119
120
  </fo:page-sequence-master>
120
121
  </fo:layout-master-set>
121
122
 
122
- <fo:declarations>
123
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
124
- <pdf:dictionary type="normal" key="ViewerPreferences">
125
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
126
- </pdf:dictionary>
127
- </pdf:catalog>
128
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
129
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
130
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
131
- <!-- Dublin Core properties go here -->
132
- <dc:title><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='main']"/> </dc:title>
133
- <dc:creator><xsl:value-of select="/itu:iso-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/></dc:creator>
134
- <dc:description>
135
- <xsl:variable name="abstract">
136
- <xsl:copy-of select="/itu:itu-standard/itu:bibdata/itu:abstract//text()"/>
137
- </xsl:variable>
138
- <xsl:value-of select="normalize-space($abstract)"/>
139
- </dc:description>
140
- <pdf:Keywords>
141
- <xsl:call-template name="insertKeywords"/>
142
- </pdf:Keywords>
143
- </rdf:Description>
144
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
145
- <!-- XMP properties go here -->
146
- <xmp:CreatorTool/>
147
- </rdf:Description>
148
- </rdf:RDF>
149
- </x:xmpmeta>
150
- </fo:declarations>
123
+ <xsl:call-template name="addPDFUAmeta"/>
151
124
 
152
125
  <!-- cover page -->
153
126
  <fo:page-sequence master-reference="cover-page">
@@ -217,7 +190,12 @@
217
190
  <fo:table-cell text-align="right">
218
191
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
219
192
  <fo:block font-size="18pt" font-weight="bold">
220
- <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"/>
221
199
  </fo:block>
222
200
  </xsl:if>
223
201
  <fo:block font-size="14pt">
@@ -304,7 +282,12 @@
304
282
  <xsl:text>  </xsl:text>
305
283
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
306
284
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
307
- <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"/>
308
291
  </xsl:if>
309
292
  </fo:block>
310
293
  </fo:table-cell>
@@ -339,6 +322,11 @@
339
322
  <xsl:value-of select="$linebreak"/>
340
323
  </fo:block>
341
324
  <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
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>
342
330
  <xsl:value-of select="$title-keywords"/>
343
331
  </fo:block>
344
332
  <fo:block>
@@ -365,6 +353,16 @@
365
353
  <xsl:if test="xalan:nodeset($contents)//item">
366
354
  <fo:block break-after="page"/>
367
355
  <fo:block-container>
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>
368
366
  <fo:block margin-top="6pt" text-align="center" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:block>
369
367
  <fo:block margin-top="6pt" text-align="right" font-weight="bold"><xsl:value-of select="$title-page"/></fo:block>
370
368
 
@@ -611,15 +609,16 @@
611
609
  <xsl:template match="itu:figure" mode="contents">
612
610
  <xsl:param name="sectionNum"/>
613
611
  <item level="" id="{@id}" display="false" type="figure">
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>
614
617
  <xsl:variable name="title" select="$title-figure"/>
615
618
  <xsl:attribute name="section">
616
619
  <xsl:call-template name="getSection">
617
620
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
618
- </xsl:call-template>
619
- <!-- <xsl:text>Figure </xsl:text>
620
- <xsl:call-template name="getItemNumber">
621
- <xsl:with-param name="brackets" select="'false'"/>
622
- </xsl:call-template> -->
621
+ </xsl:call-template>
623
622
  </xsl:attribute>
624
623
  <xsl:attribute name="topsection">
625
624
  <xsl:call-template name="getTopSection">
@@ -639,13 +638,16 @@
639
638
  <xsl:template match="itu:table" mode="contents">
640
639
  <xsl:param name="sectionNum"/>
641
640
  <item level="" id="{@id}" display="false" type="table">
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>
642
646
  <xsl:variable name="title" select="$title-table"/>
643
647
  <xsl:attribute name="section">
644
648
  <xsl:call-template name="getSection">
645
649
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
646
- </xsl:call-template>
647
- <!-- <xsl:text>Table </xsl:text>
648
- <xsl:call-template name="getItemNumber"/> -->
650
+ </xsl:call-template>
649
651
  </xsl:attribute>
650
652
  <xsl:attribute name="topsection">
651
653
  <xsl:call-template name="getTopSection">
@@ -666,6 +668,16 @@
666
668
  <xsl:template match="itu:formula" mode="contents">
667
669
  <xsl:param name="sectionNum"/>
668
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>
669
681
  <xsl:variable name="title">
670
682
  <xsl:choose>
671
683
  <xsl:when test="@inequality = 'true'"><xsl:value-of select="$title-inequality"/></xsl:when>
@@ -682,6 +694,11 @@
682
694
  </xsl:attribute>
683
695
  <xsl:variable name="parent-element" select="local-name(..)"/>
684
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>
685
702
  <xsl:choose>
686
703
  <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
687
704
  <xsl:otherwise/>
@@ -795,6 +812,11 @@
795
812
  <xsl:variable name="parent-element" select="local-name(..)"/>
796
813
  <item level="" id="{@id}" display="false" type="example" section="{$section}">
797
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>
798
820
  <xsl:choose>
799
821
  <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
800
822
  <xsl:otherwise/>
@@ -937,8 +959,13 @@
937
959
  <xsl:value-of select="$linebreak"/>
938
960
  <xsl:value-of select="$linebreak"/>
939
961
  </fo:block>
940
- <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
941
- <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"/>
942
969
  </fo:block>
943
970
  <xsl:apply-templates/>
944
971
  </xsl:template>
@@ -995,7 +1022,12 @@
995
1022
  <fo:block font-size="11pt" space-before="4pt" text-align="justify">
996
1023
  <xsl:if test="ancestor::itu:figure">
997
1024
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
998
- </xsl:if>
1025
+ </xsl:if>
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>
999
1031
  <xsl:value-of select="$title-note"/>
1000
1032
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1001
1033
  <xsl:if test="count(//itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]) &gt; 1">
@@ -1231,12 +1263,20 @@
1231
1263
  </fo:block>
1232
1264
  </xsl:template>
1233
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>
1234
1274
 
1235
1275
  <xsl:template match="itu:preferred">
1236
1276
  <xsl:param name="sectionNum"/>
1237
1277
  <!-- DEBUG need -->
1238
1278
  <fo:block space-before="6pt" text-align="justify">
1239
- <fo:inline id="{../@id}" padding-right="5mm" font-weight="bold">
1279
+ <fo:inline padding-right="5mm" font-weight="bold">
1240
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"/> -->
1241
1281
  <xsl:variable name="level">
1242
1282
  <xsl:call-template name="getLevel"/>
@@ -1263,7 +1303,7 @@
1263
1303
  <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/>
1264
1304
  <xsl:choose>
1265
1305
  <xsl:when test="contains($citeas, '[')">
1266
- <xsl:text> </xsl:text><xsl:value-of select="$citeas" disable-output-escaping="yes"/>
1306
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1267
1307
  </xsl:when>
1268
1308
  <xsl:otherwise>
1269
1309
  <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
@@ -1386,6 +1426,11 @@
1386
1426
  <xsl:choose>
1387
1427
  <xsl:when test="local-name(*) = 'figure' and normalize-space(itu:name) = ''"/><!-- don't show 'Figure' for outer figure without name -->
1388
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>
1389
1434
  <xsl:value-of select="$title-figure"/>
1390
1435
  <xsl:value-of select="$itemnumber"/>
1391
1436
  </xsl:when>
@@ -1467,6 +1512,11 @@
1467
1512
  <xsl:template match="itu:ul//itu:note/itu:p | itu:ol//itu:note/itu:p" mode="process">
1468
1513
  <xsl:variable name="id" select="ancestor::*[local-name() = 'clause'][1]/@id"/>
1469
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>
1470
1520
  <xsl:value-of select="$title-note"/>
1471
1521
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1472
1522
  <xsl:if test="count(//itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]) &gt; 1">
@@ -1532,6 +1582,11 @@
1532
1582
 
1533
1583
  <xsl:template match="itu:termnote">
1534
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>
1535
1590
  <xsl:value-of select="$title-note"/>
1536
1591
  <xsl:if test="following-sibling::itu:termnote or preceding-sibling::itu:termnote">
1537
1592
  <xsl:number/><xsl:text> </xsl:text>
@@ -1634,10 +1689,22 @@
1634
1689
  <fo:basic-link internal-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1635
1690
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1636
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
+
1637
1704
  <xsl:choose>
1638
1705
  <xsl:when test="($type = 'clause' or $type = 'term') and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1639
- <xsl:when test="($type = 'clause' or $type = 'term') and $level &gt; 1"><xsl:value-of select="translate($title-clause, $upper, $lower)"/></xsl:when>
1640
- <xsl:when test="$type = 'example'">Example </xsl:when>
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>
1641
1708
  <xsl:when test="$type = 'figure'"/>
1642
1709
  <xsl:when test="$type = 'formula'"/>
1643
1710
  <xsl:when test="$type = 'table'"/>
@@ -1646,13 +1713,20 @@
1646
1713
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1647
1714
  </xsl:choose>
1648
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
+
1649
1722
  <xsl:choose>
1650
1723
  <xsl:when test="$type = 'example'">
1651
1724
  <xsl:variable name="currentSection">
1652
1725
  <xsl:call-template name="getSection"/>
1653
1726
  </xsl:variable>
1654
- <xsl:if test="not(contains($section, $currentSection))">
1655
- <xsl:text>in </xsl:text>
1727
+ <xsl:if test="not(contains($section, $currentSection))">
1728
+
1729
+ <xsl:value-of select="$title-in"/>
1656
1730
  <xsl:if test="$level = 1">
1657
1731
  <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1658
1732
  <xsl:text> </xsl:text>
@@ -1673,7 +1747,8 @@
1673
1747
 
1674
1748
  <xsl:if test="not(contains($section, $currentSection))"> -->
1675
1749
  <xsl:if test="$topsection != $xreftopsection">
1676
- <xsl:text> in </xsl:text>
1750
+ <xsl:text> </xsl:text>
1751
+ <xsl:value-of select="$title-in"/>
1677
1752
  <xsl:if test="$level = 1">
1678
1753
  <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1679
1754
  <xsl:text> </xsl:text>
@@ -1691,10 +1766,11 @@
1691
1766
  <xsl:call-template name="getSection"/>
1692
1767
  </xsl:variable>
1693
1768
  <xsl:if test="not(contains($section, $currentSection))">
1694
- <xsl:text> in </xsl:text>
1769
+ <xsl:text> </xsl:text>
1770
+ <xsl:value-of select="$title-in"/>
1695
1771
  <xsl:choose>
1696
1772
  <xsl:when test="$level = 1"><xsl:value-of select="$title-clause"/></xsl:when>
1697
- <xsl:when test="$level &gt; 1"><xsl:value-of select="translate($title-clause, $upper, $lower)"/></xsl:when>
1773
+ <xsl:when test="$level &gt; 1"><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-clause))"/></xsl:when>
1698
1774
  </xsl:choose>
1699
1775
  <xsl:value-of select="$section"/>
1700
1776
  </xsl:if>
@@ -1737,6 +1813,11 @@
1737
1813
 
1738
1814
  <xsl:template match="itu:example/itu:name">
1739
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>
1740
1821
  <xsl:value-of select="normalize-space($title-example)"/>
1741
1822
  <xsl:if test="count(ancestor::itu:clause[1]/itu:example) &gt; 1">
1742
1823
  <xsl:text> </xsl:text><xsl:number count="itu:example"/>
@@ -1764,10 +1845,10 @@
1764
1845
  <fo:basic-link internal-destination="{@bibitemid}" color="blue" text-decoration="underline" fox:alt-text="{@citeas}">
1765
1846
  <xsl:choose>
1766
1847
  <xsl:when test="contains(@citeas, '[')">
1767
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1848
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1768
1849
  </xsl:when>
1769
1850
  <xsl:otherwise>
1770
- <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" -->
1771
1852
  </xsl:otherwise>
1772
1853
  </xsl:choose>
1773
1854
 
@@ -1778,8 +1859,13 @@
1778
1859
  </xsl:template>
1779
1860
 
1780
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>
1781
1867
  <xsl:choose>
1782
- <xsl:when test="@type ='section'">Section</xsl:when>
1868
+ <xsl:when test="@type ='section'"><xsl:value-of select="normalize-space($title-section)"/></xsl:when>
1783
1869
  <xsl:otherwise/>
1784
1870
  </xsl:choose>
1785
1871
  <xsl:value-of select="itu:referenceFrom"/>
@@ -1809,7 +1895,7 @@
1809
1895
 
1810
1896
  <xsl:template match="itu:source">
1811
1897
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1812
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1898
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1813
1899
  <xsl:apply-templates select="itu:localityStack"/>
1814
1900
  </fo:basic-link>
1815
1901
  </xsl:template>
@@ -2335,24 +2421,6 @@
2335
2421
  </xsl:if>
2336
2422
  </xsl:template>
2337
2423
 
2338
- <xsl:template name="getLevel">
2339
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2340
- <xsl:variable name="level">
2341
- <xsl:choose>
2342
- <xsl:when test="ancestor::itu:sections">
2343
- <xsl:value-of select="$level_total - 2"/>
2344
- </xsl:when>
2345
- <xsl:when test="ancestor::itu:bibliography">
2346
- <xsl:value-of select="$level_total - 2"/>
2347
- </xsl:when>
2348
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2349
- <xsl:otherwise>
2350
- <xsl:value-of select="$level_total - 1"/>
2351
- </xsl:otherwise>
2352
- </xsl:choose>
2353
- </xsl:variable>
2354
- <xsl:value-of select="$level"/>
2355
- </xsl:template>
2356
2424
 
2357
2425
  <xsl:template name="getSection">
2358
2426
  <xsl:param name="sectionNum"/>
@@ -2372,7 +2440,7 @@
2372
2440
  </xsl:when>
2373
2441
  <xsl:when test="$level &gt;= 2">
2374
2442
  <xsl:variable name="num">
2375
- <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"/>
2376
2444
  </xsl:variable>
2377
2445
  <!-- <xsl:variable name="sectionNum_">
2378
2446
  <xsl:choose>
@@ -2392,6 +2460,11 @@
2392
2460
  <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2393
2461
  <xsl:choose>
2394
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>
2395
2468
  <xsl:value-of select="$title-appendix"/><xsl:text> </xsl:text>
2396
2469
  <xsl:number format="I" level="any" count="itu:annex[@obligation = 'informative']"/>
2397
2470
  </xsl:when>
@@ -2403,6 +2476,11 @@
2403
2476
  <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2404
2477
  <xsl:choose>
2405
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>
2406
2484
  <xsl:value-of select="$title-annex"/>
2407
2485
  <xsl:choose>
2408
2486
  <xsl:when test="count(//itu:annex) = 1">
@@ -2450,17 +2528,6 @@
2450
2528
  </xsl:if>
2451
2529
  </xsl:template>
2452
2530
 
2453
- <xsl:template name="getId">
2454
- <xsl:choose>
2455
- <xsl:when test="../@id">
2456
- <xsl:value-of select="../@id"/>
2457
- </xsl:when>
2458
- <xsl:otherwise>
2459
- <xsl:value-of select="concat(local-name(..), '_', text())"/>
2460
- </xsl:otherwise>
2461
- </xsl:choose>
2462
- </xsl:template>
2463
-
2464
2531
  <xsl:template name="getTopSection">
2465
2532
  <xsl:param name="sectionNum"/>
2466
2533
  <xsl:variable name="section">
@@ -2479,44 +2546,185 @@
2479
2546
  </xsl:choose>
2480
2547
  </xsl:template>
2481
2548
 
2482
- <xsl:variable name="title-table">
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>
2555
+
2556
+
2557
+
2558
+ <title-note lang="en">NOTE </title-note>
2559
+ <title-note lang="fr">NOTE </title-note>
2560
+
2561
+ <title-note lang="zh">NOTE </title-note>
2562
+
2563
+
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>
2590
+
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>
2483
2651
 
2484
- <xsl:text>Table </xsl:text>
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>
2485
2654
 
2655
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2486
2656
 
2487
- </xsl:variable><xsl:variable name="title-note">
2488
2657
 
2489
- <xsl:text>NOTE </xsl:text>
2490
2658
 
2659
+ <title-modified lang="en">modified</title-modified>
2660
+ <title-modified lang="fr">modifiée</title-modified>
2491
2661
 
2492
- </xsl:variable><xsl:variable name="title-figure">
2662
+ <title-modified lang="zh">modified</title-modified>
2493
2663
 
2494
- <xsl:text>Figure </xsl:text>
2495
2664
 
2496
2665
 
2497
- </xsl:variable><xsl:variable name="title-example">
2666
+ <title-source lang="en">SOURCE</title-source>
2498
2667
 
2499
- <xsl:text>EXAMPLE </xsl:text>
2668
+ <title-keywords lang="en">Keywords</title-keywords>
2500
2669
 
2670
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2671
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2501
2672
 
2502
- </xsl:variable><xsl:variable name="title-inequality">Inequality </xsl:variable><xsl:variable name="title-equation">Equation </xsl:variable><xsl:variable name="title-annex">
2673
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2503
2674
 
2504
- <xsl:text>Annex </xsl:text>
2675
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2505
2676
 
2677
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2506
2678
 
2507
- </xsl:variable><xsl:variable name="title-appendix">
2508
- <xsl:text>Appendix </xsl:text>
2509
- </xsl:variable><xsl:variable name="title-clause">
2679
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2510
2680
 
2511
- <xsl:text>Clause </xsl:text>
2681
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2512
2682
 
2683
+ <title-abstract lang="en">Abstract</title-abstract>
2513
2684
 
2514
- </xsl:variable><xsl:variable name="title-edition">
2515
- <xsl:text>Edition </xsl:text>
2516
- </xsl:variable><xsl:variable name="title-toc">
2685
+ <title-summary lang="en">Summary</title-summary>
2517
2686
 
2518
- Table of Contents
2519
- </xsl:variable><xsl:variable name="title-page">Page</xsl:variable><xsl:variable name="title-key">Key</xsl:variable><xsl:variable name="title-where">where</xsl:variable><xsl:variable name="title-descriptors">Descriptors</xsl:variable><xsl:variable name="title-part-en">Part </xsl:variable><xsl:variable name="title-part-fr">Partie </xsl:variable><xsl:variable name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable name="title-modified">modified</xsl:variable><xsl:variable name="title-source">SOURCE</xsl:variable><xsl:variable name="title-keywords">Keywords</xsl:variable><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">
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">
2520
2728
 
2521
2729
 
2522
2730
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
@@ -2583,7 +2791,11 @@
2583
2791
 
2584
2792
 
2585
2793
 
2586
-
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>
2587
2799
  <xsl:value-of select="$title-table"/>
2588
2800
 
2589
2801
  <xsl:call-template name="getTableNumber"/>
@@ -2692,7 +2904,16 @@
2692
2904
  </xsl:otherwise>
2693
2905
  </xsl:choose>
2694
2906
  </xsl:for-each>
2695
- <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
+
2696
2917
  </fo:table>
2697
2918
 
2698
2919
 
@@ -2856,6 +3077,10 @@
2856
3077
 
2857
3078
  <xsl:apply-templates/>
2858
3079
  </fo:table-header>
3080
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3081
+ <fo:table-body>
3082
+ <xsl:apply-templates/>
3083
+ </fo:table-body>
2859
3084
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2860
3085
  <xsl:apply-templates/>
2861
3086
  </xsl:template><xsl:template name="insertTableFooter">
@@ -3034,6 +3259,12 @@
3034
3259
  <fo:inline padding-right="2mm">
3035
3260
 
3036
3261
 
3262
+
3263
+ <xsl:variable name="title-note">
3264
+ <xsl:call-template name="getTitle">
3265
+ <xsl:with-param name="name" select="'title-note'"/>
3266
+ </xsl:call-template>
3267
+ </xsl:variable>
3037
3268
  <xsl:value-of select="$title-note"/>
3038
3269
 
3039
3270
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
@@ -3130,6 +3361,36 @@
3130
3361
  </fn>
3131
3362
  </xsl:for-each>
3132
3363
  </xsl:variable>
3364
+
3365
+ <!-- current hierarchy is 'figure' element -->
3366
+ <xsl:variable name="following_dl_colwidths">
3367
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3368
+ <xsl:variable name="html-table">
3369
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3370
+ <xsl:element name="{$ns}:table">
3371
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3372
+ <tbody>
3373
+ <xsl:apply-templates mode="dl"/>
3374
+ </tbody>
3375
+ </xsl:for-each>
3376
+ </xsl:element>
3377
+ </xsl:variable>
3378
+
3379
+ <xsl:call-template name="calculate-column-widths">
3380
+ <xsl:with-param name="cols-count" select="2"/>
3381
+ <xsl:with-param name="table" select="$html-table"/>
3382
+ </xsl:call-template>
3383
+
3384
+ </xsl:if>
3385
+ </xsl:variable>
3386
+
3387
+
3388
+ <xsl:variable name="maxlength_dt">
3389
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3390
+ <xsl:call-template name="getMaxLength_dt"/>
3391
+ </xsl:for-each>
3392
+ </xsl:variable>
3393
+
3133
3394
  <xsl:if test="xalan:nodeset($references)//fn">
3134
3395
  <fo:block>
3135
3396
  <fo:table width="95%" table-layout="fixed">
@@ -3137,8 +3398,19 @@
3137
3398
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3138
3399
 
3139
3400
  </xsl:if>
3140
- <fo:table-column column-width="15%"/>
3141
- <fo:table-column column-width="85%"/>
3401
+ <xsl:choose>
3402
+ <!-- if there 'dl', then set same columns width -->
3403
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3404
+ <xsl:call-template name="setColumnWidth_dl">
3405
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3406
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3407
+ </xsl:call-template>
3408
+ </xsl:when>
3409
+ <xsl:otherwise>
3410
+ <fo:table-column column-width="15%"/>
3411
+ <fo:table-column column-width="85%"/>
3412
+ </xsl:otherwise>
3413
+ </xsl:choose>
3142
3414
  <fo:table-body>
3143
3415
  <xsl:for-each select="xalan:nodeset($references)//fn">
3144
3416
  <xsl:variable name="reference" select="@reference"/>
@@ -3202,6 +3474,11 @@
3202
3474
 
3203
3475
  <fo:block margin-bottom="12pt" text-align="left">
3204
3476
 
3477
+ <xsl:variable name="title-where">
3478
+ <xsl:call-template name="getTitle">
3479
+ <xsl:with-param name="name" select="'title-where'"/>
3480
+ </xsl:call-template>
3481
+ </xsl:variable>
3205
3482
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3206
3483
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3207
3484
  <xsl:text/>
@@ -3217,14 +3494,24 @@
3217
3494
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3218
3495
 
3219
3496
 
3497
+ <xsl:variable name="title-where">
3498
+ <xsl:call-template name="getTitle">
3499
+ <xsl:with-param name="name" select="'title-where'"/>
3500
+ </xsl:call-template>
3501
+ </xsl:variable>
3220
3502
  <xsl:value-of select="$title-where"/>:
3221
3503
  </fo:block>
3222
3504
  </xsl:when>
3223
3505
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3224
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3506
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3225
3507
 
3226
3508
 
3227
3509
 
3510
+ <xsl:variable name="title-key">
3511
+ <xsl:call-template name="getTitle">
3512
+ <xsl:with-param name="name" select="'title-key'"/>
3513
+ </xsl:call-template>
3514
+ </xsl:variable>
3228
3515
  <xsl:value-of select="$title-key"/>
3229
3516
  </fo:block>
3230
3517
  </xsl:when>
@@ -3248,23 +3535,6 @@
3248
3535
 
3249
3536
 
3250
3537
 
3251
- <!-- create virtual html table for dl/[dt and dd] -->
3252
- <xsl:variable name="html-table">
3253
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3254
- <xsl:element name="{$ns}:table">
3255
- <tbody>
3256
- <xsl:apply-templates mode="dl"/>
3257
- </tbody>
3258
- </xsl:element>
3259
- </xsl:variable>
3260
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3261
- <xsl:variable name="colwidths">
3262
- <xsl:call-template name="calculate-column-widths">
3263
- <xsl:with-param name="cols-count" select="2"/>
3264
- <xsl:with-param name="table" select="$html-table"/>
3265
- </xsl:call-template>
3266
- </xsl:variable>
3267
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3268
3538
 
3269
3539
  <fo:table width="95%" table-layout="fixed">
3270
3540
 
@@ -3277,42 +3547,30 @@
3277
3547
 
3278
3548
  </xsl:when>
3279
3549
  </xsl:choose>
3280
- <xsl:choose>
3281
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3282
- <fo:table-column column-width="50%"/>
3283
- <fo:table-column column-width="50%"/>
3284
- </xsl:when>
3285
- <xsl:otherwise>
3286
- <xsl:choose>
3287
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3288
- <fo:table-column column-width="60%"/>
3289
- <fo:table-column column-width="40%"/>
3290
- </xsl:when> -->
3291
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3292
- <fo:table-column column-width="50%"/>
3293
- <fo:table-column column-width="50%"/>
3294
- </xsl:when>
3295
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3296
- <fo:table-column column-width="40%"/>
3297
- <fo:table-column column-width="60%"/>
3298
- </xsl:when>
3299
- <xsl:otherwise>
3300
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3301
- <xsl:choose>
3302
- <xsl:when test=". = 1 or . = 0">
3303
- <fo:table-column column-width="proportional-column-width(2)"/>
3304
- </xsl:when>
3305
- <xsl:otherwise>
3306
- <fo:table-column column-width="proportional-column-width({.})"/>
3307
- </xsl:otherwise>
3308
- </xsl:choose>
3309
- </xsl:for-each>
3310
- </xsl:otherwise>
3311
- </xsl:choose>
3312
- <!-- <fo:table-column column-width="15%"/>
3313
- <fo:table-column column-width="85%"/> -->
3314
- </xsl:otherwise>
3315
- </xsl:choose>
3550
+ <!-- create virtual html table for dl/[dt and dd] -->
3551
+ <xsl:variable name="html-table">
3552
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3553
+ <xsl:element name="{$ns}:table">
3554
+ <tbody>
3555
+ <xsl:apply-templates mode="dl"/>
3556
+ </tbody>
3557
+ </xsl:element>
3558
+ </xsl:variable>
3559
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3560
+ <xsl:variable name="colwidths">
3561
+ <xsl:call-template name="calculate-column-widths">
3562
+ <xsl:with-param name="cols-count" select="2"/>
3563
+ <xsl:with-param name="table" select="$html-table"/>
3564
+ </xsl:call-template>
3565
+ </xsl:variable>
3566
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3567
+ <xsl:variable name="maxlength_dt">
3568
+ <xsl:call-template name="getMaxLength_dt"/>
3569
+ </xsl:variable>
3570
+ <xsl:call-template name="setColumnWidth_dl">
3571
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3572
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3573
+ </xsl:call-template>
3316
3574
  <fo:table-body>
3317
3575
  <xsl:apply-templates>
3318
3576
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3322,6 +3580,60 @@
3322
3580
  </fo:block>
3323
3581
  </fo:block>
3324
3582
  </xsl:if>
3583
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3584
+ <xsl:param name="colwidths"/>
3585
+ <xsl:param name="maxlength_dt"/>
3586
+ <xsl:choose>
3587
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3588
+ <fo:table-column column-width="50%"/>
3589
+ <fo:table-column column-width="50%"/>
3590
+ </xsl:when>
3591
+ <xsl:otherwise>
3592
+ <xsl:choose>
3593
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3594
+ <fo:table-column column-width="5%"/>
3595
+ <fo:table-column column-width="95%"/>
3596
+ </xsl:when>
3597
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3598
+ <fo:table-column column-width="10%"/>
3599
+ <fo:table-column column-width="90%"/>
3600
+ </xsl:when>
3601
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3602
+ <fo:table-column column-width="60%"/>
3603
+ <fo:table-column column-width="40%"/>
3604
+ </xsl:when> -->
3605
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3606
+ <fo:table-column column-width="50%"/>
3607
+ <fo:table-column column-width="50%"/>
3608
+ </xsl:when>
3609
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3610
+ <fo:table-column column-width="40%"/>
3611
+ <fo:table-column column-width="60%"/>
3612
+ </xsl:when>
3613
+ <xsl:otherwise>
3614
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3615
+ <xsl:choose>
3616
+ <xsl:when test=". = 1 or . = 0">
3617
+ <fo:table-column column-width="proportional-column-width(2)"/>
3618
+ </xsl:when>
3619
+ <xsl:otherwise>
3620
+ <fo:table-column column-width="proportional-column-width({.})"/>
3621
+ </xsl:otherwise>
3622
+ </xsl:choose>
3623
+ </xsl:for-each>
3624
+ </xsl:otherwise>
3625
+ </xsl:choose>
3626
+ <!-- <fo:table-column column-width="15%"/>
3627
+ <fo:table-column column-width="85%"/> -->
3628
+ </xsl:otherwise>
3629
+ </xsl:choose>
3630
+ </xsl:template><xsl:template name="getMaxLength_dt">
3631
+ <xsl:for-each select="*[local-name()='dt']">
3632
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3633
+ <xsl:if test="position() = 1">
3634
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3635
+ </xsl:if>
3636
+ </xsl:for-each>
3325
3637
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3326
3638
  <xsl:param name="key_iso"/>
3327
3639
 
@@ -3338,6 +3650,11 @@
3338
3650
  <xsl:if test="normalize-space($key_iso) = 'true'">
3339
3651
  <xsl:attribute name="margin-top">0</xsl:attribute>
3340
3652
  </xsl:if>
3653
+ <xsl:variable name="title-note">
3654
+ <xsl:call-template name="getTitle">
3655
+ <xsl:with-param name="name" select="'title-note'"/>
3656
+ </xsl:call-template>
3657
+ </xsl:variable>
3341
3658
  <xsl:value-of select="$title-note"/>
3342
3659
  </fo:block>
3343
3660
  </fo:table-cell>
@@ -3387,7 +3704,11 @@
3387
3704
 
3388
3705
 
3389
3706
  <xsl:apply-templates/>
3390
-
3707
+ <!-- <xsl:if test="$namespace = 'gb'">
3708
+ <xsl:if test="ancestor::*[local-name()='formula']">
3709
+ <xsl:text>—</xsl:text>
3710
+ </xsl:if>
3711
+ </xsl:if> -->
3391
3712
  </fo:block>
3392
3713
  </fo:table-cell>
3393
3714
  <fo:table-cell>
@@ -3445,7 +3766,8 @@
3445
3766
  </xsl:template><xsl:template name="recursiveSmallCaps">
3446
3767
  <xsl:param name="text"/>
3447
3768
  <xsl:variable name="char" select="substring($text,1,1)"/>
3448
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3769
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3770
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3449
3771
  <xsl:choose>
3450
3772
  <xsl:when test="$char=$upperCase">
3451
3773
  <fo:inline font-size="{100 div 0.75}%">
@@ -3728,18 +4050,28 @@
3728
4050
  <xsl:choose>
3729
4051
  <xsl:when test="contains($str2, ' ')">
3730
4052
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3731
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3732
- <xsl:value-of select="substring($substr, 2)"/>
4053
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4054
+ <xsl:value-of select="substring($substr, 2)"/> -->
4055
+ <xsl:call-template name="capitalize">
4056
+ <xsl:with-param name="str" select="$substr"/>
4057
+ </xsl:call-template>
3733
4058
  <xsl:text> </xsl:text>
3734
4059
  <xsl:call-template name="capitalizeWords">
3735
4060
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3736
4061
  </xsl:call-template>
3737
4062
  </xsl:when>
3738
4063
  <xsl:otherwise>
3739
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3740
- <xsl:value-of select="substring($str2, 2)"/>
4064
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4065
+ <xsl:value-of select="substring($str2, 2)"/> -->
4066
+ <xsl:call-template name="capitalize">
4067
+ <xsl:with-param name="str" select="$str2"/>
4068
+ </xsl:call-template>
3741
4069
  </xsl:otherwise>
3742
4070
  </xsl:choose>
4071
+ </xsl:template><xsl:template name="capitalize">
4072
+ <xsl:param name="str"/>
4073
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4074
+ <xsl:value-of select="substring($str, 2)"/>
3743
4075
  </xsl:template><xsl:template match="mathml:math">
3744
4076
  <fo:inline font-family="STIX2Math">
3745
4077
  <fo:instream-foreign-object fox:alt-text="Math">
@@ -3797,6 +4129,11 @@
3797
4129
  <fo:inline id="{@id}"/>
3798
4130
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3799
4131
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4132
+ <xsl:variable name="title-appendix">
4133
+ <xsl:call-template name="getTitle">
4134
+ <xsl:with-param name="name" select="'title-appendix'"/>
4135
+ </xsl:call-template>
4136
+ </xsl:variable>
3800
4137
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3801
4138
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3802
4139
  </fo:block>
@@ -3806,6 +4143,11 @@
3806
4143
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3807
4144
  <fo:block xsl:use-attribute-sets="appendix-example-style">
3808
4145
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4146
+ <xsl:variable name="title-example">
4147
+ <xsl:call-template name="getTitle">
4148
+ <xsl:with-param name="name" select="'title-example'"/>
4149
+ </xsl:call-template>
4150
+ </xsl:variable>
3809
4151
  <xsl:value-of select="$title-example"/>
3810
4152
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3811
4153
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -3836,6 +4178,17 @@
3836
4178
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3837
4179
  <xsl:apply-templates/>
3838
4180
  </fo:inline>
4181
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4182
+ <xsl:variable name="title-modified">
4183
+ <xsl:call-template name="getTitle">
4184
+ <xsl:with-param name="name" select="'title-modified'"/>
4185
+ </xsl:call-template>
4186
+ </xsl:variable>
4187
+ <xsl:choose>
4188
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4189
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4190
+ </xsl:choose>
4191
+ <xsl:apply-templates/>
3839
4192
  </xsl:template><xsl:template name="convertDate">
3840
4193
  <xsl:param name="date"/>
3841
4194
  <xsl:param name="format" select="'short'"/>
@@ -3900,4 +4253,138 @@
3900
4253
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3901
4254
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3902
4255
  </xsl:choose>
4256
+ </xsl:template><xsl:template name="addPDFUAmeta">
4257
+ <fo:declarations>
4258
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4259
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4260
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4261
+ </pdf:dictionary>
4262
+ </pdf:catalog>
4263
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4264
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4265
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4266
+ <!-- Dublin Core properties go here -->
4267
+ <dc:title>
4268
+ <xsl:variable name="title">
4269
+
4270
+
4271
+
4272
+
4273
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@type='main']"/>
4274
+
4275
+ </xsl:variable>
4276
+ <xsl:choose>
4277
+ <xsl:when test="normalize-space($title) != ''">
4278
+ <xsl:value-of select="$title"/>
4279
+ </xsl:when>
4280
+ <xsl:otherwise>
4281
+ <xsl:text> </xsl:text>
4282
+ </xsl:otherwise>
4283
+ </xsl:choose>
4284
+ </dc:title>
4285
+ <dc:creator>
4286
+
4287
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
4288
+
4289
+
4290
+ </dc:creator>
4291
+ <dc:description>
4292
+ <xsl:variable name="abstract">
4293
+
4294
+
4295
+
4296
+
4297
+ <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
4298
+
4299
+ </xsl:variable>
4300
+ <xsl:value-of select="normalize-space($abstract)"/>
4301
+ </dc:description>
4302
+ <pdf:Keywords>
4303
+ <xsl:call-template name="insertKeywords"/>
4304
+ </pdf:Keywords>
4305
+ </rdf:Description>
4306
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4307
+ <!-- XMP properties go here -->
4308
+ <xmp:CreatorTool/>
4309
+ </rdf:Description>
4310
+ </rdf:RDF>
4311
+ </x:xmpmeta>
4312
+ </fo:declarations>
4313
+ </xsl:template><xsl:template name="getId">
4314
+ <xsl:choose>
4315
+ <xsl:when test="../@id">
4316
+ <xsl:value-of select="../@id"/>
4317
+ </xsl:when>
4318
+ <xsl:otherwise>
4319
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4320
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4321
+ </xsl:otherwise>
4322
+ </xsl:choose>
4323
+ </xsl:template><xsl:template name="getLevel">
4324
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4325
+ <xsl:variable name="level">
4326
+ <xsl:choose>
4327
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4328
+ <xsl:value-of select="$level_total - 2"/>
4329
+ </xsl:when>
4330
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4331
+ <xsl:value-of select="$level_total - 2"/>
4332
+ </xsl:when>
4333
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4334
+ <xsl:value-of select="$level_total - 2"/>
4335
+ </xsl:when>
4336
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4337
+ <xsl:otherwise>
4338
+ <xsl:value-of select="$level_total - 1"/>
4339
+ </xsl:otherwise>
4340
+ </xsl:choose>
4341
+ </xsl:variable>
4342
+ <xsl:value-of select="$level"/>
4343
+ </xsl:template><xsl:template name="getSubSection">
4344
+ <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']"/>
4345
+ </xsl:template><xsl:template name="split">
4346
+ <xsl:param name="pText" select="."/>
4347
+ <xsl:param name="sep" select="','"/>
4348
+ <xsl:if test="string-length($pText) &gt;0">
4349
+ <item>
4350
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4351
+ </item>
4352
+ <xsl:call-template name="split">
4353
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4354
+ <xsl:with-param name="sep" select="$sep"/>
4355
+ </xsl:call-template>
4356
+ </xsl:if>
4357
+ </xsl:template><xsl:template name="getDocumentId">
4358
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4359
+ </xsl:template><xsl:template name="namespaceCheck">
4360
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
4361
+ <xsl:variable name="XSLNS">
4362
+
4363
+
4364
+
4365
+ <xsl:value-of select="document('')//*/namespace::itu"/>
4366
+
4367
+
4368
+
4369
+
4370
+
4371
+
4372
+
4373
+
4374
+
4375
+
4376
+ </xsl:variable>
4377
+ <xsl:if test="$documentNS != $XSLNS">
4378
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
4379
+ </xsl:if>
4380
+ </xsl:template><xsl:template name="getLanguage">
4381
+ <xsl:param name="lang"/>
4382
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
4383
+ <xsl:choose>
4384
+ <xsl:when test="$language = 'en'">English</xsl:when>
4385
+ <xsl:when test="$language = 'fr'">French</xsl:when>
4386
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
4387
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
4388
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4389
+ </xsl:choose>
3903
4390
  </xsl:template></xsl:stylesheet>