metanorma-un 0.6.6 → 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -160,7 +160,7 @@
160
160
  <fo:block>
161
161
  <xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:ol[1]/un:li[1]/un:p[1], '.', '')"/>
162
162
  </fo:block>
163
- <fo:block><xsl:value-of select="$title"/></fo:block>
163
+ <fo:block role="H1"><xsl:value-of select="$title"/></fo:block>
164
164
  </fo:block>
165
165
  </fo:block-container>
166
166
 
@@ -485,7 +485,10 @@
485
485
  </xsl:template>
486
486
 
487
487
  <xsl:template match="un:title" mode="inline-header">
488
- <fo:inline>
488
+ <xsl:variable name="level">
489
+ <xsl:call-template name="getLevel"/>
490
+ </xsl:variable>
491
+ <fo:inline role="H{$level}">
489
492
  <xsl:apply-templates/>
490
493
  </fo:inline>
491
494
  </xsl:template>
@@ -715,8 +718,9 @@
715
718
  <xsl:otherwise>11pt</xsl:otherwise>
716
719
  </xsl:choose>
717
720
  </xsl:variable>
718
- <fo:block font-size="{$font-size}" font-weight="bold" margin-top="3pt" margin-bottom="16pt" keep-with-next="always">
721
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-top="3pt" margin-bottom="16pt" keep-with-next="always" role="H{$level}">
719
722
  <xsl:apply-templates/>
723
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
720
724
  </fo:block>
721
725
  </xsl:template>
722
726
 
@@ -734,15 +738,17 @@
734
738
  </xsl:variable>
735
739
  <xsl:choose>
736
740
  <xsl:when test="$level = 1">
737
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" keep-with-next="always">
741
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" keep-with-next="always" role="H{$level}">
738
742
  <fo:block margin-bottom="12pt">
739
743
  <xsl:apply-templates/>
744
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
740
745
  </fo:block>
741
746
  </fo:block>
742
747
  </xsl:when>
743
748
  <xsl:otherwise>
744
- <fo:block font-size="{$font-size}" font-weight="bold" margin-left="1mm" space-before="3pt" margin-bottom="6pt" keep-with-next="always">
749
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-left="1mm" space-before="3pt" margin-bottom="6pt" keep-with-next="always" role="H{$level}">
745
750
  <xsl:apply-templates/>
751
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
746
752
  </fo:block>
747
753
  </xsl:otherwise>
748
754
  </xsl:choose>
@@ -769,7 +775,7 @@
769
775
  <xsl:choose>
770
776
  <xsl:when test="ancestor::un:sections and $level = 1">
771
777
  <fo:block-container margin-left="-16mm">
772
- <fo:block font-size="{$font-size}" font-weight="bold" margin-left="16mm" space-before="16pt" margin-bottom="13pt" keep-with-next="always">
778
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-left="16mm" space-before="16pt" margin-bottom="13pt" keep-with-next="always" role="H{$level}">
773
779
  <fo:table table-layout="fixed" width="100%">
774
780
  <fo:table-column column-width="16mm"/>
775
781
  <fo:table-column column-width="130mm"/>
@@ -788,6 +794,7 @@
788
794
  <fo:table-cell>
789
795
  <fo:block>
790
796
  <xsl:call-template name="extractTitle"/>
797
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
791
798
  </fo:block>
792
799
  </fo:table-cell>
793
800
  </fo:table-row>
@@ -797,7 +804,7 @@
797
804
  </fo:block-container>
798
805
  </xsl:when>
799
806
  <xsl:when test="ancestor::un:sections">
800
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="16pt" margin-bottom="13pt" text-indent="-8mm" keep-with-next="always">
807
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="16pt" margin-bottom="13pt" text-indent="-8mm" keep-with-next="always" role="H{$level}">
801
808
  <xsl:if test="$level = 2">
802
809
  <xsl:attribute name="margin-left">1mm</xsl:attribute>
803
810
  <xsl:attribute name="space-before">12pt</xsl:attribute>
@@ -814,8 +821,9 @@
814
821
  </fo:block>
815
822
  </xsl:when>
816
823
  <xsl:otherwise>
817
- <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}">
818
825
  <xsl:apply-templates/>
826
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
819
827
  </fo:block>
820
828
  </xsl:otherwise>
821
829
  </xsl:choose>
@@ -1046,26 +1054,26 @@
1046
1054
  <!-- ============================ -->
1047
1055
 
1048
1056
  <xsl:template name="insertHeaderFooter">
1049
- <fo:static-content flow-name="header-odd">
1057
+ <fo:static-content flow-name="header-odd" role="artifact">
1050
1058
  <fo:block-container height="25mm" display-align="after" border-bottom="0.5pt solid black" margin-left="-20.5mm" margin-right="-20.5mm">
1051
1059
  <fo:block font-size="9pt" font-weight="bold" text-align="right" margin-left="21mm" margin-right="21mm" padding-bottom="0.5mm">
1052
1060
  <xsl:value-of select="$id"/>
1053
1061
  </fo:block>
1054
1062
  </fo:block-container>
1055
1063
  </fo:static-content>
1056
- <fo:static-content flow-name="footer-odd">
1064
+ <fo:static-content flow-name="footer-odd" role="artifact">
1057
1065
  <fo:block-container height="40mm" margin-left="-20.5mm" margin-right="-20.5mm">
1058
1066
  <fo:block font-size="9pt" font-weight="bold" text-align="right" margin-left="21mm" margin-right="21mm" padding-top="12mm"><fo:page-number/></fo:block>
1059
1067
  </fo:block-container>
1060
1068
  </fo:static-content>
1061
- <fo:static-content flow-name="header-even">
1069
+ <fo:static-content flow-name="header-even" role="artifact">
1062
1070
  <fo:block-container height="25mm" display-align="after" border-bottom="0.5pt solid black" margin-left="-20.5mm" margin-right="-20.5mm">
1063
1071
  <fo:block font-size="9pt" font-weight="bold" margin-left="21mm" margin-right="21mm" padding-bottom="0.5mm">
1064
1072
  <xsl:value-of select="$id"/>
1065
1073
  </fo:block>
1066
1074
  </fo:block-container>
1067
1075
  </fo:static-content>
1068
- <fo:static-content flow-name="footer-even">
1076
+ <fo:static-content flow-name="footer-even" role="artifact">
1069
1077
  <fo:block-container height="40mm" margin-left="-20.5mm" margin-right="-20.5mm">
1070
1078
  <fo:block font-size="9pt" font-weight="bold" margin-left="21mm" margin-right="21mm" padding-top="12mm"><fo:page-number/></fo:block>
1071
1079
  </fo:block-container>
@@ -1073,103 +1081,6 @@
1073
1081
  </xsl:template>
1074
1082
 
1075
1083
 
1076
- <xsl:template name="number-to-words">
1077
- <xsl:param name="number"/>
1078
- <xsl:param name="first"/>
1079
- <xsl:if test="$number != ''">
1080
- <xsl:variable name="words">
1081
- <words>
1082
- <word cardinal="1">one-</word>
1083
- <word ordinal="1">first </word>
1084
- <word cardinal="2">two-</word>
1085
- <word ordinal="2">second </word>
1086
- <word cardinal="3">three-</word>
1087
- <word ordinal="3">third </word>
1088
- <word cardinal="4">four-</word>
1089
- <word ordinal="4">fourth </word>
1090
- <word cardinal="5">five-</word>
1091
- <word ordinal="5">fifth </word>
1092
- <word cardinal="6">six-</word>
1093
- <word ordinal="6">sixth </word>
1094
- <word cardinal="7">seven-</word>
1095
- <word ordinal="7">seventh </word>
1096
- <word cardinal="8">eight-</word>
1097
- <word ordinal="8">eighth </word>
1098
- <word cardinal="9">nine-</word>
1099
- <word ordinal="9">ninth </word>
1100
- <word ordinal="10">tenth </word>
1101
- <word ordinal="11">eleventh </word>
1102
- <word ordinal="12">twelfth </word>
1103
- <word ordinal="13">thirteenth </word>
1104
- <word ordinal="14">fourteenth </word>
1105
- <word ordinal="15">fifteenth </word>
1106
- <word ordinal="16">sixteenth </word>
1107
- <word ordinal="17">seventeenth </word>
1108
- <word ordinal="18">eighteenth </word>
1109
- <word ordinal="19">nineteenth </word>
1110
- <word cardinal="20">twenty-</word>
1111
- <word ordinal="20">twentieth </word>
1112
- <word cardinal="30">thirty-</word>
1113
- <word ordinal="30">thirtieth </word>
1114
- <word cardinal="40">forty-</word>
1115
- <word ordinal="40">fortieth </word>
1116
- <word cardinal="50">fifty-</word>
1117
- <word ordinal="50">fiftieth </word>
1118
- <word cardinal="60">sixty-</word>
1119
- <word ordinal="60">sixtieth </word>
1120
- <word cardinal="70">seventy-</word>
1121
- <word ordinal="70">seventieth </word>
1122
- <word cardinal="80">eighty-</word>
1123
- <word ordinal="80">eightieth </word>
1124
- <word cardinal="90">ninety-</word>
1125
- <word ordinal="90">ninetieth </word>
1126
- <word cardinal="100">hundred-</word>
1127
- <word ordinal="100">hundredth </word>
1128
- </words>
1129
- </xsl:variable>
1130
-
1131
- <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
1132
-
1133
- <xsl:variable name="value">
1134
- <xsl:choose>
1135
- <xsl:when test="$ordinal != ''">
1136
- <xsl:value-of select="$ordinal"/>
1137
- </xsl:when>
1138
- <xsl:otherwise>
1139
- <xsl:choose>
1140
- <xsl:when test="$number &lt; 100">
1141
- <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
1142
- <xsl:variable name="digit" select="substring($number,2)"/>
1143
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
1144
- <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
1145
- </xsl:when>
1146
- <xsl:otherwise>
1147
- <!-- more 100 -->
1148
- <xsl:variable name="hundred" select="substring($number,1,1)"/>
1149
- <xsl:variable name="digits" select="number(substring($number,2))"/>
1150
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
1151
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
1152
- <xsl:call-template name="number-to-words">
1153
- <xsl:with-param name="number" select="$digits"/>
1154
- </xsl:call-template>
1155
- </xsl:otherwise>
1156
- </xsl:choose>
1157
- </xsl:otherwise>
1158
- </xsl:choose>
1159
- </xsl:variable>
1160
- <xsl:choose>
1161
- <xsl:when test="$first = 'true'">
1162
- <xsl:call-template name="capitalize">
1163
- <xsl:with-param name="str" select="$value"/>
1164
- </xsl:call-template>
1165
- </xsl:when>
1166
- <xsl:otherwise>
1167
- <xsl:value-of select="$value"/>
1168
- </xsl:otherwise>
1169
- </xsl:choose>
1170
- </xsl:if>
1171
- </xsl:template>
1172
-
1173
1084
  <!-- convert YYYY-MM-DD to (Month YYYY) -->
1174
1085
  <xsl:template name="formatDate">
1175
1086
  <xsl:param name="date"/>
@@ -1368,12 +1279,13 @@
1368
1279
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1369
1280
  <xsl:attribute name="white-space">pre</xsl:attribute>
1370
1281
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1282
+ <xsl:attribute name="role">Code</xsl:attribute>
1371
1283
 
1372
1284
 
1373
1285
 
1374
1286
 
1375
1287
 
1376
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1288
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1377
1289
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1378
1290
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1379
1291
 
@@ -1393,8 +1305,13 @@
1393
1305
 
1394
1306
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1395
1307
 
1396
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1397
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1308
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1309
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1310
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1311
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1312
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1313
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1314
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1398
1315
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1399
1316
 
1400
1317
 
@@ -1462,6 +1379,7 @@
1462
1379
 
1463
1380
 
1464
1381
 
1382
+
1465
1383
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1466
1384
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1467
1385
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1476,7 +1394,9 @@
1476
1394
 
1477
1395
 
1478
1396
 
1479
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1397
+ </xsl:attribute-set><xsl:variable name="table-border_">
1398
+
1399
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1480
1400
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1481
1401
 
1482
1402
 
@@ -1591,7 +1511,8 @@
1591
1511
 
1592
1512
 
1593
1513
 
1594
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1514
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1515
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1595
1516
 
1596
1517
 
1597
1518
 
@@ -1776,11 +1697,15 @@
1776
1697
  <fo:block>&#xA0;</fo:block>
1777
1698
  </xsl:if> -->
1778
1699
 
1700
+
1701
+ <!-- Display table's name before table as standalone block -->
1779
1702
  <!-- $namespace = 'iso' or -->
1780
1703
 
1781
1704
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1782
1705
 
1783
-
1706
+
1707
+
1708
+
1784
1709
 
1785
1710
  <xsl:call-template name="fn_name_display"/>
1786
1711
 
@@ -1854,6 +1779,12 @@
1854
1779
 
1855
1780
 
1856
1781
 
1782
+
1783
+
1784
+
1785
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1786
+
1787
+
1857
1788
  <xsl:variable name="table_width">
1858
1789
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1859
1790
 
@@ -1877,6 +1808,7 @@
1877
1808
 
1878
1809
 
1879
1810
 
1811
+
1880
1812
 
1881
1813
 
1882
1814
 
@@ -1902,6 +1834,8 @@
1902
1834
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1903
1835
  </xsl:if>
1904
1836
 
1837
+
1838
+
1905
1839
  <xsl:choose>
1906
1840
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1907
1841
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -2186,9 +2120,9 @@
2186
2120
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2187
2121
  <xsl:with-param name="continued">true</xsl:with-param>
2188
2122
  </xsl:apply-templates>
2189
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2190
- <xsl:call-template name="fn_name_display"/>
2191
- </xsl:for-each>
2123
+
2124
+
2125
+
2192
2126
 
2193
2127
  </fo:table-cell>
2194
2128
  </fo:table-row>
@@ -2270,7 +2204,11 @@
2270
2204
 
2271
2205
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2272
2206
 
2273
- <xsl:if test="$isNoteOrFnExist = 'true'">
2207
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2208
+
2209
+ </xsl:variable>
2210
+
2211
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2274
2212
 
2275
2213
  <xsl:variable name="cols-count">
2276
2214
  <xsl:choose>
@@ -2299,6 +2237,8 @@
2299
2237
  </xsl:choose>
2300
2238
  </xsl:for-each>
2301
2239
 
2240
+
2241
+
2302
2242
  <xsl:choose>
2303
2243
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2304
2244
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2325,6 +2265,7 @@
2325
2265
 
2326
2266
 
2327
2267
 
2268
+
2328
2269
  <!-- fn will be processed inside 'note' processing -->
2329
2270
 
2330
2271
 
@@ -2333,6 +2274,11 @@
2333
2274
 
2334
2275
 
2335
2276
 
2277
+
2278
+
2279
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2280
+
2281
+
2336
2282
  <!-- except gb -->
2337
2283
 
2338
2284
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2358,6 +2304,10 @@
2358
2304
  <!-- fn processing -->
2359
2305
  <xsl:call-template name="fn_display"/>
2360
2306
 
2307
+
2308
+ <!-- for PAS display Notes after footnotes -->
2309
+
2310
+
2361
2311
  </fo:table-cell>
2362
2312
  </fo:table-row>
2363
2313
  </fo:table-body>
@@ -2399,6 +2349,19 @@
2399
2349
 
2400
2350
  </fo:table-body>
2401
2351
 
2352
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2353
+ <xsl:choose>
2354
+ <xsl:when test="substring-after(., '—') != ''">
2355
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2356
+ </xsl:when>
2357
+ <xsl:otherwise>
2358
+ <xsl:value-of select="."/>
2359
+ </xsl:otherwise>
2360
+ </xsl:choose>
2361
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2362
+ <xsl:apply-templates mode="presentation_name"/>
2363
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2364
+ <xsl:apply-templates select="."/>
2402
2365
  </xsl:template><xsl:template match="*[local-name()='tr']">
2403
2366
  <xsl:variable name="parent-name" select="local-name(..)"/>
2404
2367
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2411,10 +2374,13 @@
2411
2374
 
2412
2375
 
2413
2376
 
2377
+
2378
+
2414
2379
  </xsl:if>
2415
2380
  <xsl:if test="$parent-name = 'tfoot'">
2416
2381
 
2417
2382
 
2383
+
2418
2384
  </xsl:if>
2419
2385
 
2420
2386
 
@@ -2428,6 +2394,8 @@
2428
2394
 
2429
2395
 
2430
2396
 
2397
+
2398
+
2431
2399
  <!-- <xsl:if test="$namespace = 'bipm'">
2432
2400
  <xsl:attribute name="height">8mm</xsl:attribute>
2433
2401
  </xsl:if> -->
@@ -2565,8 +2533,13 @@
2565
2533
 
2566
2534
 
2567
2535
 
2536
+
2537
+ <!-- Table's note name (NOTE, for example) -->
2538
+
2568
2539
  <fo:inline padding-right="2mm">
2569
2540
 
2541
+
2542
+
2570
2543
 
2571
2544
 
2572
2545
  <xsl:if test="@type = 'source' or @type = 'abbreviation'">
@@ -2584,6 +2557,8 @@
2584
2557
 
2585
2558
  </fo:inline>
2586
2559
 
2560
+
2561
+
2587
2562
  <xsl:apply-templates mode="process"/>
2588
2563
  </fo:block>
2589
2564
 
@@ -2591,18 +2566,18 @@
2591
2566
  <xsl:apply-templates/>
2592
2567
  </xsl:template><xsl:template name="fn_display">
2593
2568
  <xsl:variable name="references">
2569
+
2594
2570
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2595
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2596
-
2597
-
2598
- <xsl:apply-templates/>
2599
- </fn>
2571
+ <xsl:call-template name="create_fn"/>
2600
2572
  </xsl:for-each>
2601
2573
  </xsl:variable>
2574
+
2602
2575
  <xsl:for-each select="xalan:nodeset($references)//fn">
2603
2576
  <xsl:variable name="reference" select="@reference"/>
2604
2577
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2605
2578
  <fo:block margin-bottom="12pt">
2579
+
2580
+
2606
2581
 
2607
2582
 
2608
2583
 
@@ -2622,6 +2597,7 @@
2622
2597
  <xsl:value-of select="@reference"/>
2623
2598
 
2624
2599
 
2600
+
2625
2601
  </fo:inline>
2626
2602
  <fo:inline>
2627
2603
 
@@ -2631,6 +2607,12 @@
2631
2607
  </fo:block>
2632
2608
  </xsl:if>
2633
2609
  </xsl:for-each>
2610
+ </xsl:template><xsl:template name="create_fn">
2611
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2612
+
2613
+
2614
+ <xsl:apply-templates/>
2615
+ </fn>
2634
2616
  </xsl:template><xsl:template name="fn_name_display">
2635
2617
  <!-- <xsl:variable name="references">
2636
2618
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2771,6 +2753,7 @@
2771
2753
 
2772
2754
  <xsl:value-of select="@reference"/>
2773
2755
 
2756
+
2774
2757
  </fo:basic-link>
2775
2758
  </fo:inline>
2776
2759
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3609,16 +3592,68 @@
3609
3592
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3610
3593
  </xsl:call-template>
3611
3594
 
3595
+
3596
+
3612
3597
  <xsl:variable name="mathml">
3613
3598
  <xsl:apply-templates select="." mode="mathml"/>
3614
3599
  </xsl:variable>
3615
3600
  <fo:instream-foreign-object fox:alt-text="Math">
3616
3601
 
3617
3602
 
3603
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3604
+ <xsl:variable name="comment_text_">
3605
+ <xsl:choose>
3606
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3607
+ <xsl:value-of select="$comment_text_following"/>
3608
+ </xsl:when>
3609
+ <xsl:otherwise>
3610
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3611
+ </xsl:otherwise>
3612
+ </xsl:choose>
3613
+ </xsl:variable>
3614
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3615
+
3616
+ <xsl:if test="normalize-space($comment_text) != ''">
3617
+ <!-- put Mathin Alternate Text -->
3618
+ <xsl:attribute name="fox:alt-text">
3619
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3620
+ </xsl:attribute>
3621
+ </xsl:if>
3622
+
3623
+ <xsl:variable name="mathml_content">
3624
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3625
+ </xsl:variable>
3626
+ <!-- put MathML in Actual Text -->
3627
+ <xsl:attribute name="fox:actual-text">
3628
+ <xsl:value-of select="$mathml_content"/>
3629
+ </xsl:attribute>
3630
+
3631
+
3618
3632
  <!-- <xsl:copy-of select="."/> -->
3619
3633
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3620
3634
  </fo:instream-foreign-object>
3621
3635
  </fo:inline>
3636
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3637
+ <!-- <xsl:text>a+b</xsl:text> -->
3638
+ <xsl:text>&lt;</xsl:text>
3639
+ <xsl:value-of select="local-name()"/>
3640
+ <xsl:if test="local-name() = 'math'">
3641
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3642
+ </xsl:if>
3643
+ <xsl:for-each select="@*">
3644
+ <xsl:text> </xsl:text>
3645
+ <xsl:value-of select="local-name()"/>
3646
+ <xsl:text>="</xsl:text>
3647
+ <xsl:value-of select="."/>
3648
+ <xsl:text>"</xsl:text>
3649
+ </xsl:for-each>
3650
+ <xsl:text>&gt;</xsl:text>
3651
+ <xsl:apply-templates mode="mathml_actual_text"/>
3652
+ <xsl:text>&lt;/</xsl:text>
3653
+ <xsl:value-of select="local-name()"/>
3654
+ <xsl:text>&gt;</xsl:text>
3655
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3656
+ <xsl:value-of select="normalize-space()"/>
3622
3657
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3623
3658
  <xsl:copy>
3624
3659
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3628,19 +3663,6 @@
3628
3663
  <!-- replace start and end spaces to non-break space -->
3629
3664
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3630
3665
  </xsl:copy>
3631
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3632
- <xsl:copy>
3633
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3634
- </xsl:copy>
3635
- <xsl:choose>
3636
- <!-- if in msub, then don't add space -->
3637
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3638
- <!-- if next char in digit, don't add space -->
3639
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3640
- <xsl:otherwise>
3641
- <mathml:mspace width="0.5ex"/>
3642
- </xsl:otherwise>
3643
- </xsl:choose>
3644
3666
  </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">
3645
3667
  <xsl:variable name="target">
3646
3668
  <xsl:choose>
@@ -3693,7 +3715,10 @@
3693
3715
  </fo:block>
3694
3716
  <xsl:apply-templates/>
3695
3717
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3696
- <fo:inline><xsl:apply-templates/></fo:inline>
3718
+ <xsl:variable name="level">
3719
+ <xsl:call-template name="getLevel"/>
3720
+ </xsl:variable>
3721
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3697
3722
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3698
3723
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3699
3724
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3728,9 +3753,10 @@
3728
3753
 
3729
3754
  </xsl:variable>
3730
3755
 
3756
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3731
3757
  <xsl:choose>
3732
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3733
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3758
+ <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>
3759
+ <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>
3734
3760
  </xsl:choose>
3735
3761
  <xsl:apply-templates/>
3736
3762
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3774,6 +3800,7 @@
3774
3800
 
3775
3801
 
3776
3802
 
3803
+
3777
3804
  <fo:block-container margin-left="0mm">
3778
3805
 
3779
3806
 
@@ -3886,7 +3913,10 @@
3886
3913
  </fo:block>
3887
3914
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3888
3915
  <xsl:if test="normalize-space() != ''">
3889
- <fo:inline>
3916
+ <xsl:variable name="level">
3917
+ <xsl:call-template name="getLevelTermName"/>
3918
+ </xsl:variable>
3919
+ <fo:inline role="H{$level}">
3890
3920
  <xsl:apply-templates/>
3891
3921
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3892
3922
  <xsl:text>.</xsl:text>
@@ -3959,7 +3989,24 @@
3959
3989
  </fo:instream-foreign-object>
3960
3990
  </xsl:when>
3961
3991
  <xsl:otherwise>
3962
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3992
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3993
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3994
+
3995
+ <xsl:variable name="img_src">
3996
+ <xsl:choose>
3997
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3998
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3999
+ </xsl:choose>
4000
+ </xsl:variable>
4001
+
4002
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
4003
+ <xsl:if test="number($scale) &lt; 100">
4004
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
4005
+ </xsl:if>
4006
+
4007
+ </xsl:if>
4008
+
4009
+ </fo:external-graphic>
3963
4010
  </xsl:otherwise>
3964
4011
  </xsl:choose>
3965
4012
 
@@ -4130,11 +4177,13 @@
4130
4177
  <xsl:attribute name="width">100%</xsl:attribute>
4131
4178
  <xsl:attribute name="content-height">100%</xsl:attribute>
4132
4179
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4180
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4181
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4133
4182
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4134
4183
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4135
4184
  <!-- effective height / width = 1.48, 1.4 - with title -->
4136
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4137
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4185
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4186
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4138
4187
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4139
4188
  </xsl:if>
4140
4189
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4151,6 +4200,23 @@
4151
4200
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4152
4201
  <xsl:value-of select="."/>
4153
4202
  </xsl:attribute>
4203
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4204
+ <xsl:copy>
4205
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4206
+ <xsl:variable name="viewbox">
4207
+ <xsl:call-template name="split">
4208
+ <xsl:with-param name="pText" select="@viewBox"/>
4209
+ <xsl:with-param name="sep" select="' '"/>
4210
+ </xsl:call-template>
4211
+ </xsl:variable>
4212
+ <xsl:attribute name="width">
4213
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4214
+ </xsl:attribute>
4215
+ <xsl:attribute name="height">
4216
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4217
+ </xsl:attribute>
4218
+ <xsl:apply-templates mode="svg_update"/>
4219
+ </xsl:copy>
4154
4220
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4155
4221
  <xsl:variable name="svg_content" select="document(@src)"/>
4156
4222
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4481,6 +4547,7 @@
4481
4547
  </xsl:when>
4482
4548
  <xsl:otherwise>
4483
4549
  <xsl:apply-templates/>
4550
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4484
4551
  </xsl:otherwise>
4485
4552
  </xsl:choose>
4486
4553
  </fo:block>
@@ -4621,14 +4688,6 @@
4621
4688
  <fo:block>
4622
4689
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4623
4690
  </fo:block>
4624
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4625
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4626
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4627
- </fo:block>
4628
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4629
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4630
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4631
- </fo:block>
4632
4691
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4633
4692
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4634
4693
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4645,6 +4704,38 @@
4645
4704
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4646
4705
  <xsl:apply-templates/>
4647
4706
  </fo:block>
4707
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4708
+ <fo:block xsl:use-attribute-sets="subject-style">
4709
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4710
+ </fo:block>
4711
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4712
+ <fo:block xsl:use-attribute-sets="subject-style">
4713
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4714
+ </fo:block>
4715
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4716
+ <fo:block xsl:use-attribute-sets="inherit-style">
4717
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4718
+ </fo:block>
4719
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4720
+ <fo:block xsl:use-attribute-sets="description-style">
4721
+ <xsl:apply-templates/>
4722
+ </fo:block>
4723
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4724
+ <fo:block xsl:use-attribute-sets="specification-style">
4725
+ <xsl:apply-templates/>
4726
+ </fo:block>
4727
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4728
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4729
+ <xsl:apply-templates/>
4730
+ </fo:block>
4731
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4732
+ <fo:block xsl:use-attribute-sets="verification-style">
4733
+ <xsl:apply-templates/>
4734
+ </fo:block>
4735
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4736
+ <fo:block xsl:use-attribute-sets="import-style">
4737
+ <xsl:apply-templates/>
4738
+ </fo:block>
4648
4739
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4649
4740
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4650
4741
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4796,7 +4887,19 @@
4796
4887
  </fo:inline>
4797
4888
  </xsl:if>
4798
4889
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4799
- <fo:inline><xsl:apply-templates/></fo:inline>
4890
+ <xsl:variable name="element">inline
4891
+
4892
+ </xsl:variable>
4893
+ <xsl:choose>
4894
+ <xsl:when test="contains($element, 'block')">
4895
+ <fo:block xsl:use-attribute-sets="example-p-style">
4896
+ <xsl:apply-templates/>
4897
+ </fo:block>
4898
+ </xsl:when>
4899
+ <xsl:otherwise>
4900
+ <fo:inline><xsl:apply-templates/></fo:inline>
4901
+ </xsl:otherwise>
4902
+ </xsl:choose>
4800
4903
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4801
4904
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4802
4905
 
@@ -4979,9 +5082,10 @@
4979
5082
 
4980
5083
 
4981
5084
  </xsl:if>
4982
-
5085
+
5086
+
5087
+
4983
5088
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4984
-
4985
5089
  <xsl:if test="normalize-space(@citeas) = ''">
4986
5090
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4987
5091
  </xsl:if>
@@ -4989,6 +5093,7 @@
4989
5093
 
4990
5094
 
4991
5095
 
5096
+
4992
5097
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4993
5098
 
4994
5099
  </xsl:if>
@@ -5374,7 +5479,6 @@
5374
5479
  </xsl:template><xsl:template name="processBibitem">
5375
5480
 
5376
5481
 
5377
- <!-- end BIPM bibitem processing-->
5378
5482
 
5379
5483
 
5380
5484
 
@@ -5504,6 +5608,9 @@
5504
5608
  <fo:block-container border="1pt solid black" width="50%">
5505
5609
  <fo:block> </fo:block>
5506
5610
  </fo:block-container>
5611
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5612
+ <fo:inline padding-right="5mm"> </fo:inline>
5613
+ <fo:inline><xsl:apply-templates/></fo:inline>
5507
5614
  </xsl:template><xsl:template name="convertDate">
5508
5615
  <xsl:param name="date"/>
5509
5616
  <xsl:param name="format" select="'short'"/>
@@ -5742,6 +5849,26 @@
5742
5849
  <xsl:value-of select="$level"/>
5743
5850
  </xsl:otherwise>
5744
5851
  </xsl:choose>
5852
+ </xsl:template><xsl:template name="getLevelTermName">
5853
+ <xsl:choose>
5854
+ <xsl:when test="normalize-space(../@depth) != ''">
5855
+ <xsl:value-of select="../@depth"/>
5856
+ </xsl:when>
5857
+ <xsl:otherwise>
5858
+ <xsl:variable name="title_level_">
5859
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5860
+ <xsl:call-template name="getLevel"/>
5861
+ </xsl:for-each>
5862
+ </xsl:variable>
5863
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5864
+ <xsl:choose>
5865
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5866
+ <xsl:otherwise>
5867
+ <xsl:call-template name="getLevel"/>
5868
+ </xsl:otherwise>
5869
+ </xsl:choose>
5870
+ </xsl:otherwise>
5871
+ </xsl:choose>
5745
5872
  </xsl:template><xsl:template name="split">
5746
5873
  <xsl:param name="pText" select="."/>
5747
5874
  <xsl:param name="sep" select="','"/>
@@ -5839,20 +5966,40 @@
5839
5966
  </xsl:call-template>
5840
5967
  </xsl:if>
5841
5968
  </xsl:template><xsl:template name="getLocalizedString">
5842
- <xsl:param name="key"/>
5969
+ <xsl:param name="key"/>
5970
+ <xsl:param name="formatted">false</xsl:param>
5843
5971
 
5844
5972
  <xsl:variable name="curr_lang">
5845
5973
  <xsl:call-template name="getLang"/>
5846
5974
  </xsl:variable>
5847
5975
 
5848
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5976
+ <xsl:variable name="data_value">
5977
+ <xsl:choose>
5978
+ <xsl:when test="$formatted = 'true'">
5979
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5980
+ </xsl:when>
5981
+ <xsl:otherwise>
5982
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5983
+ </xsl:otherwise>
5984
+ </xsl:choose>
5985
+ </xsl:variable>
5849
5986
 
5850
5987
  <xsl:choose>
5851
- <xsl:when test="$data_value != ''">
5852
- <xsl:value-of select="$data_value"/>
5988
+ <xsl:when test="normalize-space($data_value) != ''">
5989
+ <xsl:choose>
5990
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5991
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5992
+ </xsl:choose>
5853
5993
  </xsl:when>
5854
5994
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5855
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5995
+ <xsl:choose>
5996
+ <xsl:when test="$formatted = 'true'">
5997
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5998
+ </xsl:when>
5999
+ <xsl:otherwise>
6000
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6001
+ </xsl:otherwise>
6002
+ </xsl:choose>
5856
6003
  </xsl:when>
5857
6004
  <xsl:otherwise>
5858
6005
  <xsl:variable name="key_">
@@ -5863,7 +6010,7 @@
5863
6010
  <xsl:value-of select="$key_"/>
5864
6011
  </xsl:otherwise>
5865
6012
  </xsl:choose>
5866
-
6013
+
5867
6014
  </xsl:template><xsl:template name="setTrackChangesStyles">
5868
6015
  <xsl:param name="isAdded"/>
5869
6016
  <xsl:param name="isDeleted"/>
@@ -5914,4 +6061,100 @@
5914
6061
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5915
6062
  </xsl:choose>
5916
6063
  </xsl:attribute>
6064
+ </xsl:template><xsl:template name="number-to-words">
6065
+ <xsl:param name="number"/>
6066
+ <xsl:param name="first"/>
6067
+ <xsl:if test="$number != ''">
6068
+ <xsl:variable name="words">
6069
+ <words>
6070
+ <word cardinal="1">One-</word>
6071
+ <word ordinal="1">First </word>
6072
+ <word cardinal="2">Two-</word>
6073
+ <word ordinal="2">Second </word>
6074
+ <word cardinal="3">Three-</word>
6075
+ <word ordinal="3">Third </word>
6076
+ <word cardinal="4">Four-</word>
6077
+ <word ordinal="4">Fourth </word>
6078
+ <word cardinal="5">Five-</word>
6079
+ <word ordinal="5">Fifth </word>
6080
+ <word cardinal="6">Six-</word>
6081
+ <word ordinal="6">Sixth </word>
6082
+ <word cardinal="7">Seven-</word>
6083
+ <word ordinal="7">Seventh </word>
6084
+ <word cardinal="8">Eight-</word>
6085
+ <word ordinal="8">Eighth </word>
6086
+ <word cardinal="9">Nine-</word>
6087
+ <word ordinal="9">Ninth </word>
6088
+ <word ordinal="10">Tenth </word>
6089
+ <word ordinal="11">Eleventh </word>
6090
+ <word ordinal="12">Twelfth </word>
6091
+ <word ordinal="13">Thirteenth </word>
6092
+ <word ordinal="14">Fourteenth </word>
6093
+ <word ordinal="15">Fifteenth </word>
6094
+ <word ordinal="16">Sixteenth </word>
6095
+ <word ordinal="17">Seventeenth </word>
6096
+ <word ordinal="18">Eighteenth </word>
6097
+ <word ordinal="19">Nineteenth </word>
6098
+ <word cardinal="20">Twenty-</word>
6099
+ <word ordinal="20">Twentieth </word>
6100
+ <word cardinal="30">Thirty-</word>
6101
+ <word ordinal="30">Thirtieth </word>
6102
+ <word cardinal="40">Forty-</word>
6103
+ <word ordinal="40">Fortieth </word>
6104
+ <word cardinal="50">Fifty-</word>
6105
+ <word ordinal="50">Fiftieth </word>
6106
+ <word cardinal="60">Sixty-</word>
6107
+ <word ordinal="60">Sixtieth </word>
6108
+ <word cardinal="70">Seventy-</word>
6109
+ <word ordinal="70">Seventieth </word>
6110
+ <word cardinal="80">Eighty-</word>
6111
+ <word ordinal="80">Eightieth </word>
6112
+ <word cardinal="90">Ninety-</word>
6113
+ <word ordinal="90">Ninetieth </word>
6114
+ <word cardinal="100">Hundred-</word>
6115
+ <word ordinal="100">Hundredth </word>
6116
+ </words>
6117
+ </xsl:variable>
6118
+
6119
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
6120
+
6121
+ <xsl:variable name="value">
6122
+ <xsl:choose>
6123
+ <xsl:when test="$ordinal != ''">
6124
+ <xsl:value-of select="$ordinal"/>
6125
+ </xsl:when>
6126
+ <xsl:otherwise>
6127
+ <xsl:choose>
6128
+ <xsl:when test="$number &lt; 100">
6129
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
6130
+ <xsl:variable name="digit" select="substring($number,2)"/>
6131
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
6132
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
6133
+ </xsl:when>
6134
+ <xsl:otherwise>
6135
+ <!-- more 100 -->
6136
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
6137
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
6138
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
6139
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
6140
+ <xsl:call-template name="number-to-words">
6141
+ <xsl:with-param name="number" select="$digits"/>
6142
+ </xsl:call-template>
6143
+ </xsl:otherwise>
6144
+ </xsl:choose>
6145
+ </xsl:otherwise>
6146
+ </xsl:choose>
6147
+ </xsl:variable>
6148
+ <xsl:choose>
6149
+ <xsl:when test="$first = 'true'">
6150
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6151
+ <xsl:call-template name="capitalize">
6152
+ <xsl:with-param name="str" select="$value_lc"/>
6153
+ </xsl:call-template>
6154
+ </xsl:when>
6155
+ <xsl:otherwise>
6156
+ <xsl:value-of select="$value"/>
6157
+ </xsl:otherwise>
6158
+ </xsl:choose>
6159
+ </xsl:if>
5917
6160
  </xsl:template></xsl:stylesheet>