metanorma-un 0.6.6 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -127,7 +127,7 @@
127
127
  </fo:block>
128
128
  </fo:block>
129
129
  <fo:block-container absolute-position="fixed" left="50mm" top="30mm" width="139mm" height="40mm" text-align="right" display-align="after">
130
- <fo:block font-family="Arial" font-size="24.5pt" font-weight="bold" margin-right="3mm"> <!-- margin-top="19mm" -->
130
+ <fo:block font-family="Arial" font-size="24.5pt" font-weight="bold" margin-right="3mm" role="H1"> <!-- margin-top="19mm" -->
131
131
  <xsl:if test="string-length($title) &gt; 70">
132
132
  <xsl:attribute name="font-size">22pt</xsl:attribute>
133
133
  </xsl:if>
@@ -142,7 +142,7 @@
142
142
  <fo:flow flow-name="xsl-region-body" font-family="Arial">
143
143
  <fo:block font-size="14pt" font-weight="bold" text-align="center">United Nations Economic Commission for Europe</fo:block>
144
144
  <fo:block font-size="12pt" font-weight="normal" text-align="center" margin-top="46pt" margin-bottom="128pt" keep-together="always">United Nations Centre for Trade Facilitation and Electronic Business</fo:block>
145
- <fo:block font-size="22pt" font-weight="bold" text-align="center">
145
+ <fo:block font-size="22pt" font-weight="bold" text-align="center" role="H1">
146
146
  <xsl:value-of select="$title"/>
147
147
  <xsl:value-of select="$linebreak"/>
148
148
  <xsl:value-of select="$doctypenumber"/>
@@ -200,17 +200,17 @@
200
200
  <xsl:with-param name="name" select="'title-toc'"/>
201
201
  </xsl:call-template>
202
202
  </xsl:variable>
203
- <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt"><xsl:value-of select="$title-toc"/></fo:block>
203
+ <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
204
204
  <xsl:variable name="title-page">
205
205
  <xsl:call-template name="getTitle">
206
206
  <xsl:with-param name="name" select="'title-page'"/>
207
207
  </xsl:call-template>
208
208
  </xsl:variable>
209
209
  <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-page"/></fo:block>
210
- <fo:block>
210
+ <fo:block role="TOC">
211
211
  <xsl:for-each select="xalan:nodeset($contents)//item[not (@type = 'annex' or @parent = 'annex') and @display = 'true']">
212
212
 
213
- <fo:block>
213
+ <fo:block role="TOCI">
214
214
 
215
215
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
216
216
  <xsl:if test="@level = 2 and @section != ''">
@@ -249,7 +249,7 @@
249
249
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']">
250
250
  <fo:block text-align="center" margin-top="12pt" margin-bottom="12pt">ANNEXES</fo:block>
251
251
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']">
252
- <fo:block>
252
+ <fo:block role="TOCI">
253
253
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
254
254
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
255
255
  <xsl:if test="@section != ''">
@@ -423,7 +423,10 @@
423
423
 
424
424
 
425
425
  <xsl:template match="un:legal-statement//un:clause/un:title">
426
- <fo:block font-weight="bold">
426
+ <xsl:variable name="level">
427
+ <xsl:call-template name="getLevel"/>
428
+ </xsl:variable>
429
+ <fo:block font-weight="bold" role="H{$level}">
427
430
  <xsl:choose>
428
431
  <xsl:when test="text() = 'Note'">
429
432
  <xsl:attribute name="font-size">14pt</xsl:attribute>
@@ -567,7 +570,10 @@
567
570
  </xsl:template>
568
571
 
569
572
  <xsl:template match="un:title" mode="inline-header">
570
- <fo:inline>
573
+ <xsl:variable name="level">
574
+ <xsl:call-template name="getLevel"/>
575
+ </xsl:variable>
576
+ <fo:inline role="H{$level}">
571
577
  <xsl:apply-templates/>
572
578
  </fo:inline>
573
579
  </xsl:template>
@@ -739,8 +745,9 @@
739
745
  <xsl:otherwise>12pt</xsl:otherwise>
740
746
  </xsl:choose>
741
747
  </xsl:variable>
742
- <fo:block font-size="{$font-size}" font-weight="bold" margin-top="30pt" margin-bottom="16pt" keep-with-next="always">
748
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-top="30pt" margin-bottom="16pt" keep-with-next="always" role="H{$level}">
743
749
  <xsl:apply-templates/>
750
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
744
751
  </fo:block>
745
752
  </xsl:template>
746
753
 
@@ -758,12 +765,13 @@
758
765
 
759
766
  <xsl:choose>
760
767
  <xsl:when test="$level = 1">
761
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-top="12pt" margin-bottom="16pt" keep-with-next="always" line-height="18pt">
768
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-top="12pt" margin-bottom="16pt" keep-with-next="always" line-height="18pt" role="H{$level}">
762
769
  <xsl:apply-templates/>
770
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
763
771
  </fo:block>
764
772
  </xsl:when>
765
773
  <xsl:when test="$level &gt;= 2">
766
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
774
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always" role="H{$level}"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
767
775
  <xsl:if test="$level = 2">
768
776
  <xsl:attribute name="margin-top">16pt</xsl:attribute>
769
777
  </xsl:if>
@@ -796,7 +804,7 @@
796
804
 
797
805
  <xsl:choose>
798
806
  <xsl:when test="ancestor::un:sections">
799
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
807
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always" role="H{$level}"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
800
808
  <xsl:if test="$level = 1">
801
809
  <!-- <xsl:attribute name="margin-left">-8.5mm</xsl:attribute> -->
802
810
  <xsl:attribute name="margin-top">18pt</xsl:attribute>
@@ -813,8 +821,9 @@
813
821
  </xsl:when>
814
822
 
815
823
  <xsl:otherwise>
816
- <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always">
824
+ <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always" role="H{$level}">
817
825
  <xsl:apply-templates/>
826
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
818
827
  </fo:block>
819
828
  </xsl:otherwise>
820
829
  </xsl:choose>
@@ -1017,7 +1026,7 @@
1017
1026
  <!-- ============================ -->
1018
1027
 
1019
1028
  <xsl:template name="insertHeaderPreface">
1020
- <fo:static-content flow-name="header">
1029
+ <fo:static-content flow-name="header" role="artifact">
1021
1030
  <fo:block-container height="25.5mm" display-align="before" border-bottom="0.5pt solid black">
1022
1031
  <fo:block font-weight="bold" padding-top="20.5mm" text-align="center">
1023
1032
  <!-- <xsl:text>UN/CEFACT </xsl:text> -->
@@ -1028,7 +1037,7 @@
1028
1037
  </xsl:template>
1029
1038
 
1030
1039
  <xsl:template name="insertHeader">
1031
- <fo:static-content flow-name="header">
1040
+ <fo:static-content flow-name="header" role="artifact">
1032
1041
  <fo:block-container height="28.5mm" display-align="before" border-bottom="0.5pt solid black">
1033
1042
  <fo:block font-weight="bold" padding-top="20.5mm" text-align="center">
1034
1043
  <!-- <xsl:text>UN/CEFACT </xsl:text> -->
@@ -1039,7 +1048,7 @@
1039
1048
  </xsl:template>
1040
1049
 
1041
1050
  <xsl:template name="insertFooter">
1042
- <fo:static-content flow-name="footer">
1051
+ <fo:static-content flow-name="footer" role="artifact">
1043
1052
  <fo:block-container height="29mm" display-align="after">
1044
1053
  <fo:block font-size="9pt" font-weight="bold" text-align="center" padding-bottom="24mm"><fo:page-number/></fo:block>
1045
1054
  </fo:block-container>
@@ -1227,12 +1236,13 @@
1227
1236
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1228
1237
  <xsl:attribute name="white-space">pre</xsl:attribute>
1229
1238
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1239
+ <xsl:attribute name="role">Code</xsl:attribute>
1230
1240
 
1231
1241
 
1232
1242
 
1233
1243
 
1234
1244
 
1235
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1245
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1236
1246
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1237
1247
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1238
1248
 
@@ -1252,8 +1262,13 @@
1252
1262
 
1253
1263
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1254
1264
 
1255
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1256
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1265
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1266
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1267
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1268
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1269
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1270
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1271
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1257
1272
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1258
1273
 
1259
1274
 
@@ -1321,6 +1336,7 @@
1321
1336
 
1322
1337
 
1323
1338
 
1339
+
1324
1340
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1325
1341
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1326
1342
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1335,7 +1351,9 @@
1335
1351
 
1336
1352
 
1337
1353
 
1338
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1354
+ </xsl:attribute-set><xsl:variable name="table-border_">
1355
+
1356
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1339
1357
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1340
1358
 
1341
1359
 
@@ -1451,7 +1469,8 @@
1451
1469
 
1452
1470
 
1453
1471
 
1454
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1472
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1473
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1455
1474
 
1456
1475
 
1457
1476
 
@@ -1636,11 +1655,15 @@
1636
1655
  <fo:block>&#xA0;</fo:block>
1637
1656
  </xsl:if> -->
1638
1657
 
1658
+
1659
+ <!-- Display table's name before table as standalone block -->
1639
1660
  <!-- $namespace = 'iso' or -->
1640
1661
 
1641
1662
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1642
1663
 
1643
-
1664
+
1665
+
1666
+
1644
1667
 
1645
1668
  <xsl:call-template name="fn_name_display"/>
1646
1669
 
@@ -1716,6 +1739,12 @@
1716
1739
 
1717
1740
 
1718
1741
 
1742
+
1743
+
1744
+
1745
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1746
+
1747
+
1719
1748
  <xsl:variable name="table_width">
1720
1749
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1721
1750
 
@@ -1739,6 +1768,7 @@
1739
1768
 
1740
1769
 
1741
1770
 
1771
+
1742
1772
 
1743
1773
 
1744
1774
  <xsl:if test="ancestor::*[local-name()='sections']">
@@ -1767,6 +1797,8 @@
1767
1797
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1768
1798
  </xsl:if>
1769
1799
 
1800
+
1801
+
1770
1802
  <xsl:choose>
1771
1803
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1772
1804
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -2051,9 +2083,9 @@
2051
2083
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2052
2084
  <xsl:with-param name="continued">true</xsl:with-param>
2053
2085
  </xsl:apply-templates>
2054
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2055
- <xsl:call-template name="fn_name_display"/>
2056
- </xsl:for-each>
2086
+
2087
+
2088
+
2057
2089
 
2058
2090
  </fo:table-cell>
2059
2091
  </fo:table-row>
@@ -2135,7 +2167,11 @@
2135
2167
 
2136
2168
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2137
2169
 
2138
- <xsl:if test="$isNoteOrFnExist = 'true'">
2170
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2171
+
2172
+ </xsl:variable>
2173
+
2174
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2139
2175
 
2140
2176
  <xsl:variable name="cols-count">
2141
2177
  <xsl:choose>
@@ -2164,6 +2200,8 @@
2164
2200
  </xsl:choose>
2165
2201
  </xsl:for-each>
2166
2202
 
2203
+
2204
+
2167
2205
  <xsl:choose>
2168
2206
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2169
2207
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2190,6 +2228,7 @@
2190
2228
 
2191
2229
 
2192
2230
 
2231
+
2193
2232
  <!-- fn will be processed inside 'note' processing -->
2194
2233
 
2195
2234
 
@@ -2198,6 +2237,11 @@
2198
2237
 
2199
2238
 
2200
2239
 
2240
+
2241
+
2242
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2243
+
2244
+
2201
2245
  <!-- except gb -->
2202
2246
 
2203
2247
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2223,6 +2267,10 @@
2223
2267
  <!-- fn processing -->
2224
2268
  <xsl:call-template name="fn_display"/>
2225
2269
 
2270
+
2271
+ <!-- for PAS display Notes after footnotes -->
2272
+
2273
+
2226
2274
  </fo:table-cell>
2227
2275
  </fo:table-row>
2228
2276
  </fo:table-body>
@@ -2264,6 +2312,19 @@
2264
2312
 
2265
2313
  </fo:table-body>
2266
2314
 
2315
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2316
+ <xsl:choose>
2317
+ <xsl:when test="substring-after(., '—') != ''">
2318
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2319
+ </xsl:when>
2320
+ <xsl:otherwise>
2321
+ <xsl:value-of select="."/>
2322
+ </xsl:otherwise>
2323
+ </xsl:choose>
2324
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2325
+ <xsl:apply-templates mode="presentation_name"/>
2326
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2327
+ <xsl:apply-templates select="."/>
2267
2328
  </xsl:template><xsl:template match="*[local-name()='tr']">
2268
2329
  <xsl:variable name="parent-name" select="local-name(..)"/>
2269
2330
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2276,10 +2337,13 @@
2276
2337
 
2277
2338
 
2278
2339
 
2340
+
2341
+
2279
2342
  </xsl:if>
2280
2343
  <xsl:if test="$parent-name = 'tfoot'">
2281
2344
 
2282
2345
 
2346
+
2283
2347
  </xsl:if>
2284
2348
 
2285
2349
 
@@ -2289,6 +2353,8 @@
2289
2353
 
2290
2354
 
2291
2355
 
2356
+
2357
+
2292
2358
  <!-- <xsl:if test="$namespace = 'bipm'">
2293
2359
  <xsl:attribute name="height">8mm</xsl:attribute>
2294
2360
  </xsl:if> -->
@@ -2430,8 +2496,13 @@
2430
2496
 
2431
2497
 
2432
2498
 
2499
+
2500
+ <!-- Table's note name (NOTE, for example) -->
2501
+
2433
2502
  <fo:inline padding-right="2mm">
2434
2503
 
2504
+
2505
+
2435
2506
 
2436
2507
 
2437
2508
  <xsl:if test="@type = 'source' or @type = 'abbreviation'">
@@ -2449,6 +2520,8 @@
2449
2520
 
2450
2521
  </fo:inline>
2451
2522
 
2523
+
2524
+
2452
2525
  <xsl:apply-templates mode="process"/>
2453
2526
  </fo:block>
2454
2527
 
@@ -2456,18 +2529,18 @@
2456
2529
  <xsl:apply-templates/>
2457
2530
  </xsl:template><xsl:template name="fn_display">
2458
2531
  <xsl:variable name="references">
2532
+
2459
2533
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2460
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2461
-
2462
-
2463
- <xsl:apply-templates/>
2464
- </fn>
2534
+ <xsl:call-template name="create_fn"/>
2465
2535
  </xsl:for-each>
2466
2536
  </xsl:variable>
2537
+
2467
2538
  <xsl:for-each select="xalan:nodeset($references)//fn">
2468
2539
  <xsl:variable name="reference" select="@reference"/>
2469
2540
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2470
2541
  <fo:block margin-bottom="12pt">
2542
+
2543
+
2471
2544
 
2472
2545
 
2473
2546
 
@@ -2487,6 +2560,7 @@
2487
2560
  <xsl:value-of select="@reference"/>
2488
2561
 
2489
2562
 
2563
+
2490
2564
  </fo:inline>
2491
2565
  <fo:inline>
2492
2566
 
@@ -2496,6 +2570,12 @@
2496
2570
  </fo:block>
2497
2571
  </xsl:if>
2498
2572
  </xsl:for-each>
2573
+ </xsl:template><xsl:template name="create_fn">
2574
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2575
+
2576
+
2577
+ <xsl:apply-templates/>
2578
+ </fn>
2499
2579
  </xsl:template><xsl:template name="fn_name_display">
2500
2580
  <!-- <xsl:variable name="references">
2501
2581
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2636,6 +2716,7 @@
2636
2716
 
2637
2717
  <xsl:value-of select="@reference"/>
2638
2718
 
2719
+
2639
2720
  </fo:basic-link>
2640
2721
  </fo:inline>
2641
2722
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3474,16 +3555,68 @@
3474
3555
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3475
3556
  </xsl:call-template>
3476
3557
 
3558
+
3559
+
3477
3560
  <xsl:variable name="mathml">
3478
3561
  <xsl:apply-templates select="." mode="mathml"/>
3479
3562
  </xsl:variable>
3480
3563
  <fo:instream-foreign-object fox:alt-text="Math">
3481
3564
 
3482
3565
 
3566
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3567
+ <xsl:variable name="comment_text_">
3568
+ <xsl:choose>
3569
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3570
+ <xsl:value-of select="$comment_text_following"/>
3571
+ </xsl:when>
3572
+ <xsl:otherwise>
3573
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3574
+ </xsl:otherwise>
3575
+ </xsl:choose>
3576
+ </xsl:variable>
3577
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3578
+
3579
+ <xsl:if test="normalize-space($comment_text) != ''">
3580
+ <!-- put Mathin Alternate Text -->
3581
+ <xsl:attribute name="fox:alt-text">
3582
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3583
+ </xsl:attribute>
3584
+ </xsl:if>
3585
+
3586
+ <xsl:variable name="mathml_content">
3587
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3588
+ </xsl:variable>
3589
+ <!-- put MathML in Actual Text -->
3590
+ <xsl:attribute name="fox:actual-text">
3591
+ <xsl:value-of select="$mathml_content"/>
3592
+ </xsl:attribute>
3593
+
3594
+
3483
3595
  <!-- <xsl:copy-of select="."/> -->
3484
3596
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3485
3597
  </fo:instream-foreign-object>
3486
3598
  </fo:inline>
3599
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3600
+ <!-- <xsl:text>a+b</xsl:text> -->
3601
+ <xsl:text>&lt;</xsl:text>
3602
+ <xsl:value-of select="local-name()"/>
3603
+ <xsl:if test="local-name() = 'math'">
3604
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3605
+ </xsl:if>
3606
+ <xsl:for-each select="@*">
3607
+ <xsl:text> </xsl:text>
3608
+ <xsl:value-of select="local-name()"/>
3609
+ <xsl:text>="</xsl:text>
3610
+ <xsl:value-of select="."/>
3611
+ <xsl:text>"</xsl:text>
3612
+ </xsl:for-each>
3613
+ <xsl:text>&gt;</xsl:text>
3614
+ <xsl:apply-templates mode="mathml_actual_text"/>
3615
+ <xsl:text>&lt;/</xsl:text>
3616
+ <xsl:value-of select="local-name()"/>
3617
+ <xsl:text>&gt;</xsl:text>
3618
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3619
+ <xsl:value-of select="normalize-space()"/>
3487
3620
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3488
3621
  <xsl:copy>
3489
3622
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3493,19 +3626,6 @@
3493
3626
  <!-- replace start and end spaces to non-break space -->
3494
3627
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3495
3628
  </xsl:copy>
3496
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3497
- <xsl:copy>
3498
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3499
- </xsl:copy>
3500
- <xsl:choose>
3501
- <!-- if in msub, then don't add space -->
3502
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3503
- <!-- if next char in digit, don't add space -->
3504
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3505
- <xsl:otherwise>
3506
- <mathml:mspace width="0.5ex"/>
3507
- </xsl:otherwise>
3508
- </xsl:choose>
3509
3629
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3510
3630
  <xsl:variable name="target">
3511
3631
  <xsl:choose>
@@ -3558,7 +3678,10 @@
3558
3678
  </fo:block>
3559
3679
  <xsl:apply-templates/>
3560
3680
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3561
- <fo:inline><xsl:apply-templates/></fo:inline>
3681
+ <xsl:variable name="level">
3682
+ <xsl:call-template name="getLevel"/>
3683
+ </xsl:variable>
3684
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3562
3685
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3563
3686
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3564
3687
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3593,9 +3716,10 @@
3593
3716
 
3594
3717
  </xsl:variable>
3595
3718
 
3719
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3596
3720
  <xsl:choose>
3597
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3598
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3721
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3722
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3599
3723
  </xsl:choose>
3600
3724
  <xsl:apply-templates/>
3601
3725
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3643,6 +3767,7 @@
3643
3767
 
3644
3768
 
3645
3769
 
3770
+
3646
3771
  <fo:block-container margin-left="0mm">
3647
3772
 
3648
3773
 
@@ -3755,7 +3880,10 @@
3755
3880
  </fo:block>
3756
3881
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3757
3882
  <xsl:if test="normalize-space() != ''">
3758
- <fo:inline>
3883
+ <xsl:variable name="level">
3884
+ <xsl:call-template name="getLevelTermName"/>
3885
+ </xsl:variable>
3886
+ <fo:inline role="H{$level}">
3759
3887
  <xsl:apply-templates/>
3760
3888
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3761
3889
  <xsl:text>.</xsl:text>
@@ -3833,7 +3961,24 @@
3833
3961
  </fo:instream-foreign-object>
3834
3962
  </xsl:when>
3835
3963
  <xsl:otherwise>
3836
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3964
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3965
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3966
+
3967
+ <xsl:variable name="img_src">
3968
+ <xsl:choose>
3969
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3970
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3971
+ </xsl:choose>
3972
+ </xsl:variable>
3973
+
3974
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3975
+ <xsl:if test="number($scale) &lt; 100">
3976
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3977
+ </xsl:if>
3978
+
3979
+ </xsl:if>
3980
+
3981
+ </fo:external-graphic>
3837
3982
  </xsl:otherwise>
3838
3983
  </xsl:choose>
3839
3984
 
@@ -4004,11 +4149,13 @@
4004
4149
  <xsl:attribute name="width">100%</xsl:attribute>
4005
4150
  <xsl:attribute name="content-height">100%</xsl:attribute>
4006
4151
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4152
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4153
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4007
4154
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4008
4155
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4009
4156
  <!-- effective height / width = 1.48, 1.4 - with title -->
4010
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4011
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4157
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4158
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4012
4159
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4013
4160
  </xsl:if>
4014
4161
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4025,6 +4172,23 @@
4025
4172
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4026
4173
  <xsl:value-of select="."/>
4027
4174
  </xsl:attribute>
4175
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4176
+ <xsl:copy>
4177
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4178
+ <xsl:variable name="viewbox">
4179
+ <xsl:call-template name="split">
4180
+ <xsl:with-param name="pText" select="@viewBox"/>
4181
+ <xsl:with-param name="sep" select="' '"/>
4182
+ </xsl:call-template>
4183
+ </xsl:variable>
4184
+ <xsl:attribute name="width">
4185
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4186
+ </xsl:attribute>
4187
+ <xsl:attribute name="height">
4188
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4189
+ </xsl:attribute>
4190
+ <xsl:apply-templates mode="svg_update"/>
4191
+ </xsl:copy>
4028
4192
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4029
4193
  <xsl:variable name="svg_content" select="document(@src)"/>
4030
4194
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4355,6 +4519,7 @@
4355
4519
  </xsl:when>
4356
4520
  <xsl:otherwise>
4357
4521
  <xsl:apply-templates/>
4522
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4358
4523
  </xsl:otherwise>
4359
4524
  </xsl:choose>
4360
4525
  </fo:block>
@@ -4495,14 +4660,6 @@
4495
4660
  <fo:block>
4496
4661
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4497
4662
  </fo:block>
4498
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4499
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4500
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4501
- </fo:block>
4502
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4503
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4504
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4505
- </fo:block>
4506
4663
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4507
4664
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4508
4665
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4519,6 +4676,38 @@
4519
4676
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4520
4677
  <xsl:apply-templates/>
4521
4678
  </fo:block>
4679
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4680
+ <fo:block xsl:use-attribute-sets="subject-style">
4681
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4682
+ </fo:block>
4683
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4684
+ <fo:block xsl:use-attribute-sets="subject-style">
4685
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4686
+ </fo:block>
4687
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4688
+ <fo:block xsl:use-attribute-sets="inherit-style">
4689
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4690
+ </fo:block>
4691
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4692
+ <fo:block xsl:use-attribute-sets="description-style">
4693
+ <xsl:apply-templates/>
4694
+ </fo:block>
4695
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4696
+ <fo:block xsl:use-attribute-sets="specification-style">
4697
+ <xsl:apply-templates/>
4698
+ </fo:block>
4699
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4700
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4701
+ <xsl:apply-templates/>
4702
+ </fo:block>
4703
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4704
+ <fo:block xsl:use-attribute-sets="verification-style">
4705
+ <xsl:apply-templates/>
4706
+ </fo:block>
4707
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4708
+ <fo:block xsl:use-attribute-sets="import-style">
4709
+ <xsl:apply-templates/>
4710
+ </fo:block>
4522
4711
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4523
4712
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4524
4713
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4670,7 +4859,19 @@
4670
4859
  </fo:inline>
4671
4860
  </xsl:if>
4672
4861
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4673
- <fo:inline><xsl:apply-templates/></fo:inline>
4862
+ <xsl:variable name="element">inline
4863
+
4864
+ </xsl:variable>
4865
+ <xsl:choose>
4866
+ <xsl:when test="contains($element, 'block')">
4867
+ <fo:block xsl:use-attribute-sets="example-p-style">
4868
+ <xsl:apply-templates/>
4869
+ </fo:block>
4870
+ </xsl:when>
4871
+ <xsl:otherwise>
4872
+ <fo:inline><xsl:apply-templates/></fo:inline>
4873
+ </xsl:otherwise>
4874
+ </xsl:choose>
4674
4875
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4675
4876
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4676
4877
 
@@ -4853,9 +5054,10 @@
4853
5054
 
4854
5055
 
4855
5056
  </xsl:if>
4856
-
5057
+
5058
+
5059
+
4857
5060
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4858
-
4859
5061
  <xsl:if test="normalize-space(@citeas) = ''">
4860
5062
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4861
5063
  </xsl:if>
@@ -4863,6 +5065,7 @@
4863
5065
 
4864
5066
 
4865
5067
 
5068
+
4866
5069
  </xsl:if>
4867
5070
 
4868
5071
  <xsl:apply-templates/>
@@ -5248,7 +5451,6 @@
5248
5451
  </xsl:template><xsl:template name="processBibitem">
5249
5452
 
5250
5453
 
5251
- <!-- end BIPM bibitem processing-->
5252
5454
 
5253
5455
 
5254
5456
 
@@ -5378,6 +5580,9 @@
5378
5580
  <fo:block-container border="1pt solid black" width="50%">
5379
5581
  <fo:block> </fo:block>
5380
5582
  </fo:block-container>
5583
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5584
+ <fo:inline padding-right="5mm"> </fo:inline>
5585
+ <fo:inline><xsl:apply-templates/></fo:inline>
5381
5586
  </xsl:template><xsl:template name="convertDate">
5382
5587
  <xsl:param name="date"/>
5383
5588
  <xsl:param name="format" select="'short'"/>
@@ -5616,6 +5821,26 @@
5616
5821
  <xsl:value-of select="$level"/>
5617
5822
  </xsl:otherwise>
5618
5823
  </xsl:choose>
5824
+ </xsl:template><xsl:template name="getLevelTermName">
5825
+ <xsl:choose>
5826
+ <xsl:when test="normalize-space(../@depth) != ''">
5827
+ <xsl:value-of select="../@depth"/>
5828
+ </xsl:when>
5829
+ <xsl:otherwise>
5830
+ <xsl:variable name="title_level_">
5831
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5832
+ <xsl:call-template name="getLevel"/>
5833
+ </xsl:for-each>
5834
+ </xsl:variable>
5835
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5836
+ <xsl:choose>
5837
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5838
+ <xsl:otherwise>
5839
+ <xsl:call-template name="getLevel"/>
5840
+ </xsl:otherwise>
5841
+ </xsl:choose>
5842
+ </xsl:otherwise>
5843
+ </xsl:choose>
5619
5844
  </xsl:template><xsl:template name="split">
5620
5845
  <xsl:param name="pText" select="."/>
5621
5846
  <xsl:param name="sep" select="','"/>
@@ -5713,20 +5938,40 @@
5713
5938
  </xsl:call-template>
5714
5939
  </xsl:if>
5715
5940
  </xsl:template><xsl:template name="getLocalizedString">
5716
- <xsl:param name="key"/>
5941
+ <xsl:param name="key"/>
5942
+ <xsl:param name="formatted">false</xsl:param>
5717
5943
 
5718
5944
  <xsl:variable name="curr_lang">
5719
5945
  <xsl:call-template name="getLang"/>
5720
5946
  </xsl:variable>
5721
5947
 
5722
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5948
+ <xsl:variable name="data_value">
5949
+ <xsl:choose>
5950
+ <xsl:when test="$formatted = 'true'">
5951
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5952
+ </xsl:when>
5953
+ <xsl:otherwise>
5954
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5955
+ </xsl:otherwise>
5956
+ </xsl:choose>
5957
+ </xsl:variable>
5723
5958
 
5724
5959
  <xsl:choose>
5725
- <xsl:when test="$data_value != ''">
5726
- <xsl:value-of select="$data_value"/>
5960
+ <xsl:when test="normalize-space($data_value) != ''">
5961
+ <xsl:choose>
5962
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5963
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5964
+ </xsl:choose>
5727
5965
  </xsl:when>
5728
5966
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5729
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5967
+ <xsl:choose>
5968
+ <xsl:when test="$formatted = 'true'">
5969
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5970
+ </xsl:when>
5971
+ <xsl:otherwise>
5972
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5973
+ </xsl:otherwise>
5974
+ </xsl:choose>
5730
5975
  </xsl:when>
5731
5976
  <xsl:otherwise>
5732
5977
  <xsl:variable name="key_">
@@ -5737,7 +5982,7 @@
5737
5982
  <xsl:value-of select="$key_"/>
5738
5983
  </xsl:otherwise>
5739
5984
  </xsl:choose>
5740
-
5985
+
5741
5986
  </xsl:template><xsl:template name="setTrackChangesStyles">
5742
5987
  <xsl:param name="isAdded"/>
5743
5988
  <xsl:param name="isDeleted"/>
@@ -5788,4 +6033,100 @@
5788
6033
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5789
6034
  </xsl:choose>
5790
6035
  </xsl:attribute>
6036
+ </xsl:template><xsl:template name="number-to-words">
6037
+ <xsl:param name="number"/>
6038
+ <xsl:param name="first"/>
6039
+ <xsl:if test="$number != ''">
6040
+ <xsl:variable name="words">
6041
+ <words>
6042
+ <word cardinal="1">One-</word>
6043
+ <word ordinal="1">First </word>
6044
+ <word cardinal="2">Two-</word>
6045
+ <word ordinal="2">Second </word>
6046
+ <word cardinal="3">Three-</word>
6047
+ <word ordinal="3">Third </word>
6048
+ <word cardinal="4">Four-</word>
6049
+ <word ordinal="4">Fourth </word>
6050
+ <word cardinal="5">Five-</word>
6051
+ <word ordinal="5">Fifth </word>
6052
+ <word cardinal="6">Six-</word>
6053
+ <word ordinal="6">Sixth </word>
6054
+ <word cardinal="7">Seven-</word>
6055
+ <word ordinal="7">Seventh </word>
6056
+ <word cardinal="8">Eight-</word>
6057
+ <word ordinal="8">Eighth </word>
6058
+ <word cardinal="9">Nine-</word>
6059
+ <word ordinal="9">Ninth </word>
6060
+ <word ordinal="10">Tenth </word>
6061
+ <word ordinal="11">Eleventh </word>
6062
+ <word ordinal="12">Twelfth </word>
6063
+ <word ordinal="13">Thirteenth </word>
6064
+ <word ordinal="14">Fourteenth </word>
6065
+ <word ordinal="15">Fifteenth </word>
6066
+ <word ordinal="16">Sixteenth </word>
6067
+ <word ordinal="17">Seventeenth </word>
6068
+ <word ordinal="18">Eighteenth </word>
6069
+ <word ordinal="19">Nineteenth </word>
6070
+ <word cardinal="20">Twenty-</word>
6071
+ <word ordinal="20">Twentieth </word>
6072
+ <word cardinal="30">Thirty-</word>
6073
+ <word ordinal="30">Thirtieth </word>
6074
+ <word cardinal="40">Forty-</word>
6075
+ <word ordinal="40">Fortieth </word>
6076
+ <word cardinal="50">Fifty-</word>
6077
+ <word ordinal="50">Fiftieth </word>
6078
+ <word cardinal="60">Sixty-</word>
6079
+ <word ordinal="60">Sixtieth </word>
6080
+ <word cardinal="70">Seventy-</word>
6081
+ <word ordinal="70">Seventieth </word>
6082
+ <word cardinal="80">Eighty-</word>
6083
+ <word ordinal="80">Eightieth </word>
6084
+ <word cardinal="90">Ninety-</word>
6085
+ <word ordinal="90">Ninetieth </word>
6086
+ <word cardinal="100">Hundred-</word>
6087
+ <word ordinal="100">Hundredth </word>
6088
+ </words>
6089
+ </xsl:variable>
6090
+
6091
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
6092
+
6093
+ <xsl:variable name="value">
6094
+ <xsl:choose>
6095
+ <xsl:when test="$ordinal != ''">
6096
+ <xsl:value-of select="$ordinal"/>
6097
+ </xsl:when>
6098
+ <xsl:otherwise>
6099
+ <xsl:choose>
6100
+ <xsl:when test="$number &lt; 100">
6101
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
6102
+ <xsl:variable name="digit" select="substring($number,2)"/>
6103
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
6104
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
6105
+ </xsl:when>
6106
+ <xsl:otherwise>
6107
+ <!-- more 100 -->
6108
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
6109
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
6110
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
6111
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
6112
+ <xsl:call-template name="number-to-words">
6113
+ <xsl:with-param name="number" select="$digits"/>
6114
+ </xsl:call-template>
6115
+ </xsl:otherwise>
6116
+ </xsl:choose>
6117
+ </xsl:otherwise>
6118
+ </xsl:choose>
6119
+ </xsl:variable>
6120
+ <xsl:choose>
6121
+ <xsl:when test="$first = 'true'">
6122
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6123
+ <xsl:call-template name="capitalize">
6124
+ <xsl:with-param name="str" select="$value_lc"/>
6125
+ </xsl:call-template>
6126
+ </xsl:when>
6127
+ <xsl:otherwise>
6128
+ <xsl:value-of select="$value"/>
6129
+ </xsl:otherwise>
6130
+ </xsl:choose>
6131
+ </xsl:if>
5791
6132
  </xsl:template></xsl:stylesheet>