metanorma-ribose 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -320,12 +320,13 @@
320
320
  <!-- background image -->
321
321
  <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0">
322
322
  <fo:block>
323
- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Cover-Background))}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
323
+ <!-- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Cover-Background))}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/> -->
324
+ <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Cover-Background))}" height="{$pageHeight}mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
324
325
  </fo:block>
325
326
  </fo:block-container>
326
327
 
327
328
  <!-- Ribose logo -->
328
- <fo:block-container absolute-position="fixed" left="171mm" top="246mm" height="30mm" width="40mm">
329
+ <fo:block-container absolute-position="fixed" left="171mm" top="{$pageHeight - 33.4}mm" height="30mm" width="40mm"> <!-- top="246mm" -->
329
330
  <fo:block>
330
331
  <fo:instream-foreign-object content-width="32mm" fox:alt-text="Ribose Logo">
331
332
  <xsl:copy-of select="$Ribose-Logo"/>
@@ -333,7 +334,7 @@
333
334
  </fo:block>
334
335
  </fo:block-container>
335
336
 
336
- <fo:block-container absolute-position="fixed" left="0mm" top="227mm" height="41mm" display-align="after">
337
+ <fo:block-container absolute-position="fixed" left="0mm" top="{$pageHeight - 52.4}mm" height="41mm" display-align="after"> <!-- top="227mm" -->
337
338
  <fo:block font-size="10pt" line-height="1.4">
338
339
  <fo:table table-layout="fixed" width="100%">
339
340
  <fo:table-column column-width="proportional-column-width(13)"/>
@@ -392,7 +393,7 @@
392
393
  </fo:block-container>
393
394
 
394
395
  <!-- title and version -->
395
- <fo:block-container height="60mm" display-align="center">
396
+ <fo:block-container margin-top="{$pageHeight - 279.4}mm" height="60mm" display-align="center">
396
397
  <xsl:variable name="title" select="/rsd:rsd-standard/rsd:bibdata/rsd:title[@language = $lang]"/>
397
398
  <xsl:if test="string-length($title) &gt; 80">
398
399
  <xsl:attribute name="margin-right">-30mm</xsl:attribute>
@@ -777,6 +778,7 @@
777
778
 
778
779
  <xsl:template match="rsd:p" name="paragraph">
779
780
  <xsl:param name="inline" select="'false'"/>
781
+ <xsl:param name="split_keep-within-line"/>
780
782
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
781
783
  <xsl:variable name="element-name">
782
784
  <xsl:choose>
@@ -809,7 +811,9 @@
809
811
  </xsl:if>
810
812
 
811
813
  <!-- <xsl:attribute name="line-height">155%</xsl:attribute> -->
812
- <xsl:apply-templates/>
814
+ <xsl:apply-templates>
815
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
816
+ </xsl:apply-templates>
813
817
  </xsl:element>
814
818
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
815
819
  <fo:block margin-bottom="12pt">
@@ -1209,12 +1213,41 @@
1209
1213
 
1210
1214
 
1211
1215
 
1212
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
1216
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
1217
+ <xsl:for-each select="$table_widths_from_if//table">
1218
+ <xsl:copy>
1219
+ <xsl:copy-of select="@*"/>
1220
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
1221
+ </xsl:copy>
1222
+ </xsl:for-each>
1223
+ </xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
1224
+ false
1225
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
1213
1226
  <xsl:call-template name="getLang"/>
1214
- </xsl:variable><xsl:variable name="pageWidth_">
1215
- 215.9
1227
+ </xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
1228
+ <xsl:choose>
1229
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
1230
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
1231
+ </xsl:choose>
1232
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
1233
+ <xsl:choose>
1234
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
1235
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
1236
+ </xsl:choose>
1237
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
1238
+ <xsl:choose>
1239
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
1240
+ <xsl:otherwise>
1241
+ 215.9
1242
+ </xsl:otherwise>
1243
+ </xsl:choose>
1216
1244
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1217
- 279.4
1245
+ <xsl:choose>
1246
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
1247
+ <xsl:otherwise>
1248
+ 279.4
1249
+ </xsl:otherwise>
1250
+ </xsl:choose>
1218
1251
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1219
1252
  29
1220
1253
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -1326,7 +1359,7 @@
1326
1359
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1327
1360
  </xsl:otherwise>
1328
1361
  </xsl:choose>
1329
- </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:attribute-set name="root-style">
1362
+ </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="font_noto_sans">Noto Sans, Noto Sans HK, Noto Sans JP, Noto Sans KR, Noto Sans SC, Noto Sans TC</xsl:variable><xsl:variable name="font_noto_sans_mono">Noto Sans Mono, Noto Sans Mono CJK HK, Noto Sans Mono CJK JP, Noto Sans Mono CJK KR, Noto Sans Mono CJK SC, Noto Sans Mono CJK TC</xsl:variable><xsl:variable name="font_noto_serif">Noto Serif, Noto Serif HK, Noto Serif JP, Noto Serif KR, Noto Serif SC, Noto Serif TC</xsl:variable><xsl:attribute-set name="root-style">
1330
1363
 
1331
1364
 
1332
1365
 
@@ -1342,7 +1375,9 @@
1342
1375
 
1343
1376
 
1344
1377
 
1345
- <xsl:attribute name="font-family">OpenSans, STIX Two Math</xsl:attribute>
1378
+
1379
+ <xsl:attribute name="font-family">OpenSans, STIX Two Math, <xsl:value-of select="$font_noto_sans"/></xsl:attribute>
1380
+ <xsl:attribute name="font-family-generic">Sans</xsl:attribute>
1346
1381
  <xsl:attribute name="font-weight">300</xsl:attribute>
1347
1382
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1348
1383
  <xsl:attribute name="color">rgb(88, 88, 90)</xsl:attribute>
@@ -1359,17 +1394,60 @@
1359
1394
  </xsl:variable>
1360
1395
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
1361
1396
 
1397
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
1398
+
1362
1399
  <xsl:for-each select="$root-style_/root-style/@*">
1400
+
1363
1401
  <xsl:choose>
1364
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1402
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
1403
+ <xsl:when test="local-name() = 'font-family'">
1404
+
1405
+ <xsl:variable name="font_regional_prefix">
1406
+ <xsl:choose>
1407
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
1408
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
1409
+ </xsl:choose>
1410
+ </xsl:variable>
1411
+
1365
1412
  <xsl:attribute name="{local-name()}">
1366
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1413
+
1414
+ <xsl:variable name="font_extended">
1415
+ <xsl:choose>
1416
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
1417
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
1418
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
1419
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
1420
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
1421
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
1422
+ </xsl:choose>
1423
+ </xsl:variable>
1424
+ <xsl:if test="normalize-space($font_extended) != ''">
1425
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
1426
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
1427
+ </xsl:if>
1428
+
1429
+ <xsl:value-of select="."/>
1430
+
1431
+ <xsl:if test="$additional_fonts != ''">
1432
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1433
+ </xsl:if>
1367
1434
  </xsl:attribute>
1368
1435
  </xsl:when>
1369
1436
  <xsl:otherwise>
1370
1437
  <xsl:copy-of select="."/>
1371
1438
  </xsl:otherwise>
1372
1439
  </xsl:choose>
1440
+
1441
+ <!-- <xsl:choose>
1442
+ <xsl:when test="local-name() = 'font-family'">
1443
+ <xsl:attribute name="{local-name()}">
1444
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1445
+ </xsl:attribute>
1446
+ </xsl:when>
1447
+ <xsl:otherwise>
1448
+ <xsl:copy-of select="."/>
1449
+ </xsl:otherwise>
1450
+ </xsl:choose> -->
1373
1451
  </xsl:for-each>
1374
1452
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
1375
1453
 
@@ -1450,11 +1528,12 @@
1450
1528
 
1451
1529
 
1452
1530
 
1531
+
1453
1532
 
1454
1533
 
1455
1534
 
1456
1535
 
1457
- <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
1536
+ <xsl:attribute name="font-family">Source Code Pro, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1458
1537
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1459
1538
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1460
1539
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -1495,6 +1574,7 @@
1495
1574
 
1496
1575
 
1497
1576
 
1577
+
1498
1578
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1499
1579
 
1500
1580
 
@@ -1512,6 +1592,7 @@
1512
1592
 
1513
1593
 
1514
1594
 
1595
+
1515
1596
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1516
1597
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1517
1598
 
@@ -1535,6 +1616,7 @@
1535
1616
 
1536
1617
 
1537
1618
 
1619
+
1538
1620
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1539
1621
  <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
1540
1622
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -1574,6 +1656,7 @@
1574
1656
 
1575
1657
  </xsl:attribute-set><xsl:variable name="table-border_">
1576
1658
 
1659
+
1577
1660
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
1578
1661
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1579
1662
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1595,6 +1678,7 @@
1595
1678
 
1596
1679
 
1597
1680
 
1681
+
1598
1682
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1599
1683
 
1600
1684
 
@@ -1623,6 +1707,7 @@
1623
1707
 
1624
1708
 
1625
1709
 
1710
+
1626
1711
  <xsl:attribute name="border">0pt solid black</xsl:attribute>
1627
1712
  <xsl:attribute name="font-size">9.5pt</xsl:attribute> <!-- 8pt -->
1628
1713
 
@@ -1634,6 +1719,7 @@
1634
1719
 
1635
1720
 
1636
1721
 
1722
+
1637
1723
 
1638
1724
 
1639
1725
 
@@ -1684,6 +1770,7 @@
1684
1770
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1685
1771
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1686
1772
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1773
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1687
1774
  <xsl:attribute name="display-align">center</xsl:attribute>
1688
1775
 
1689
1776
 
@@ -1705,6 +1792,8 @@
1705
1792
  <xsl:attribute name="display-align">center</xsl:attribute>
1706
1793
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1707
1794
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1795
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1796
+
1708
1797
 
1709
1798
 
1710
1799
 
@@ -1733,7 +1822,7 @@
1733
1822
 
1734
1823
 
1735
1824
 
1736
-
1825
+
1737
1826
 
1738
1827
 
1739
1828
 
@@ -1750,6 +1839,7 @@
1750
1839
 
1751
1840
 
1752
1841
 
1842
+
1753
1843
  <xsl:attribute name="font-size">8pt</xsl:attribute>
1754
1844
 
1755
1845
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
@@ -1760,6 +1850,8 @@
1760
1850
 
1761
1851
 
1762
1852
 
1853
+
1854
+
1763
1855
  </xsl:attribute-set><xsl:attribute-set name="table-fn-number-style">
1764
1856
  <xsl:attribute name="font-size">80%</xsl:attribute>
1765
1857
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1775,6 +1867,7 @@
1775
1867
 
1776
1868
 
1777
1869
 
1870
+
1778
1871
  </xsl:attribute-set><xsl:attribute-set name="fn-container-body-style">
1779
1872
  <xsl:attribute name="text-indent">0</xsl:attribute>
1780
1873
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -1796,7 +1889,8 @@
1796
1889
 
1797
1890
  <xsl:attribute name="min-height">7mm</xsl:attribute>
1798
1891
 
1799
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1892
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1893
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1800
1894
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1801
1895
 
1802
1896
 
@@ -1808,10 +1902,34 @@
1808
1902
 
1809
1903
 
1810
1904
 
1905
+
1811
1906
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1812
1907
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1813
1908
  <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
1814
1909
 
1910
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1911
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1912
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1913
+
1914
+
1915
+
1916
+
1917
+
1918
+
1919
+
1920
+
1921
+
1922
+
1923
+
1924
+
1925
+
1926
+
1927
+
1928
+ <xsl:attribute name="font-weight">300</xsl:attribute>
1929
+ <xsl:attribute name="color">black</xsl:attribute>
1930
+
1931
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1932
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1815
1933
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1816
1934
 
1817
1935
 
@@ -1851,6 +1969,7 @@
1851
1969
 
1852
1970
 
1853
1971
 
1972
+
1854
1973
 
1855
1974
 
1856
1975
 
@@ -1928,6 +2047,8 @@
1928
2047
  <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
1929
2048
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
1930
2049
 
2050
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
2051
+
1931
2052
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1932
2053
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
1933
2054
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -1987,6 +2108,7 @@
1987
2108
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1988
2109
 
1989
2110
 
2111
+
1990
2112
 
1991
2113
 
1992
2114
 
@@ -2035,6 +2157,7 @@
2035
2157
 
2036
2158
 
2037
2159
 
2160
+
2038
2161
  <xsl:attribute name="text-align">left</xsl:attribute>
2039
2162
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
2040
2163
 
@@ -2056,19 +2179,19 @@
2056
2179
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2057
2180
 
2058
2181
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2182
+ <xsl:attribute name="width">100%</xsl:attribute>
2183
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2184
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2059
2185
 
2060
2186
 
2061
- <xsl:attribute name="width">100%</xsl:attribute>
2062
2187
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2063
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2064
2188
 
2065
2189
 
2066
2190
 
2067
-
2068
-
2191
+
2069
2192
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
2070
2193
 
2071
- <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
2194
+ <xsl:attribute name="font-family">Source Code Pro, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2072
2195
 
2073
2196
 
2074
2197
 
@@ -2162,10 +2285,30 @@
2162
2285
 
2163
2286
 
2164
2287
 
2288
+
2165
2289
  <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
2166
2290
 
2167
2291
 
2168
2292
 
2293
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
2294
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2295
+
2296
+
2297
+
2298
+
2299
+
2300
+
2301
+
2302
+
2303
+
2304
+
2305
+
2306
+
2307
+
2308
+
2309
+ <xsl:attribute name="font-weight">300</xsl:attribute>
2310
+ <xsl:attribute name="color">black</xsl:attribute>
2311
+
2169
2312
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2170
2313
 
2171
2314
 
@@ -2219,6 +2362,7 @@
2219
2362
 
2220
2363
 
2221
2364
 
2365
+
2222
2366
  <xsl:attribute name="font-size">65%</xsl:attribute>
2223
2367
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2224
2368
 
@@ -2245,6 +2389,7 @@
2245
2389
 
2246
2390
 
2247
2391
 
2392
+
2248
2393
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2249
2394
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2250
2395
  <xsl:attribute name="color">rgb(168, 170, 173)</xsl:attribute>
@@ -2269,6 +2414,7 @@
2269
2414
 
2270
2415
 
2271
2416
 
2417
+
2272
2418
  <xsl:attribute name="font-size">60%</xsl:attribute>
2273
2419
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2274
2420
 
@@ -2287,6 +2433,7 @@
2287
2433
 
2288
2434
 
2289
2435
 
2436
+
2290
2437
  <xsl:attribute name="border">0.5pt solid rgb(79, 129, 189)</xsl:attribute>
2291
2438
  <xsl:attribute name="color">rgb(79, 129, 189)</xsl:attribute>
2292
2439
  <xsl:attribute name="margin-left">16mm</xsl:attribute>
@@ -2296,6 +2443,9 @@
2296
2443
 
2297
2444
 
2298
2445
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
2446
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2447
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2448
+
2299
2449
 
2300
2450
 
2301
2451
 
@@ -2304,8 +2454,6 @@
2304
2454
 
2305
2455
 
2306
2456
 
2307
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2308
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2309
2457
  <xsl:attribute name="padding">2mm</xsl:attribute>
2310
2458
  <xsl:attribute name="padding-top">3mm</xsl:attribute>
2311
2459
 
@@ -2342,6 +2490,7 @@
2342
2490
 
2343
2491
 
2344
2492
 
2493
+
2345
2494
  <xsl:attribute name="font-style">italic</xsl:attribute>
2346
2495
 
2347
2496
 
@@ -2382,6 +2531,7 @@
2382
2531
 
2383
2532
 
2384
2533
 
2534
+
2385
2535
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
2386
2536
  <xsl:attribute name="provisional-distance-between-starts">8mm</xsl:attribute>
2387
2537
 
@@ -2404,6 +2554,7 @@
2404
2554
 
2405
2555
 
2406
2556
 
2557
+
2407
2558
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
2408
2559
  <xsl:attribute name="provisional-distance-between-starts">8mm</xsl:attribute>
2409
2560
 
@@ -2432,6 +2583,7 @@
2432
2583
 
2433
2584
 
2434
2585
 
2586
+
2435
2587
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2436
2588
 
2437
2589
 
@@ -2452,6 +2604,7 @@
2452
2604
 
2453
2605
 
2454
2606
 
2607
+
2455
2608
  <xsl:attribute name="font-size">60%</xsl:attribute>
2456
2609
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2457
2610
 
@@ -2471,6 +2624,7 @@
2471
2624
 
2472
2625
 
2473
2626
 
2627
+
2474
2628
  <xsl:attribute name="color">rgb(168, 170, 173)</xsl:attribute>
2475
2629
 
2476
2630
  </xsl:attribute-set><xsl:attribute-set name="references-non-normative-style">
@@ -2584,13 +2738,13 @@
2584
2738
 
2585
2739
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2586
2740
  <xsl:variable name="nodes_preface_">
2587
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2741
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2588
2742
  <node id="{@id}"/>
2589
2743
  </xsl:for-each>
2590
2744
  </xsl:variable>
2591
2745
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2592
2746
 
2593
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2747
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2594
2748
  <xsl:sort select="@displayorder" data-type="number"/>
2595
2749
 
2596
2750
  <!-- process Section's title -->
@@ -2656,7 +2810,7 @@
2656
2810
  </xsl:for-each>
2657
2811
  </figures>
2658
2812
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2659
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2813
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2660
2814
  <xsl:sort select="@displayorder" data-type="number"/>
2661
2815
  <xsl:apply-templates select="."/>
2662
2816
  </xsl:for-each>
@@ -2710,7 +2864,38 @@
2710
2864
  </xsl:template><xsl:template match="*[local-name()='br']">
2711
2865
  <xsl:value-of select="$linebreak"/>
2712
2866
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2713
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2867
+ <xsl:param name="split_keep-within-line"/>
2868
+
2869
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2870
+ <xsl:choose>
2871
+
2872
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2873
+ <xsl:variable name="sep">_</xsl:variable>
2874
+ <xsl:variable name="items">
2875
+ <xsl:call-template name="split">
2876
+ <xsl:with-param name="pText" select="."/>
2877
+ <xsl:with-param name="sep" select="$sep"/>
2878
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2879
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2880
+ </xsl:call-template>
2881
+ </xsl:variable>
2882
+ <xsl:for-each select="xalan:nodeset($items)/item">
2883
+ <xsl:choose>
2884
+ <xsl:when test=". = $sep">
2885
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2886
+ </xsl:when>
2887
+ <xsl:otherwise>
2888
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2889
+ </xsl:otherwise>
2890
+ </xsl:choose>
2891
+ </xsl:for-each>
2892
+ </xsl:when>
2893
+
2894
+ <xsl:otherwise>
2895
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2896
+ </xsl:otherwise>
2897
+
2898
+ </xsl:choose>
2714
2899
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2715
2900
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2716
2901
  <xsl:apply-templates/>
@@ -2807,9 +2992,14 @@
2807
2992
 
2808
2993
  <xsl:variable name="table">
2809
2994
 
2810
- <xsl:variable name="simple-table">
2811
- <xsl:call-template name="getSimpleTable"/>
2995
+ <xsl:variable name="simple-table">
2996
+ <xsl:call-template name="getSimpleTable">
2997
+ <xsl:with-param name="id" select="@id"/>
2998
+ </xsl:call-template>
2812
2999
  </xsl:variable>
3000
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
3001
+
3002
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2813
3003
 
2814
3004
 
2815
3005
  <!-- Display table's name before table as standalone block -->
@@ -2830,7 +3020,23 @@
2830
3020
  </xsl:call-template>
2831
3021
  </xsl:if>
2832
3022
  </xsl:variable>
2833
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3023
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
3024
+
3025
+ <!-- DEBUG -->
3026
+ <xsl:if test="$table_if_debug = 'true'">
3027
+ <fo:block font-size="60%">
3028
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3029
+ </fo:block>
3030
+ </xsl:if>
3031
+
3032
+
3033
+ <!-- <xsl:copy-of select="$colwidths"/> -->
3034
+
3035
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3036
+ DEBUG
3037
+ colwidths=<xsl:copy-of select="$colwidths"/>
3038
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3039
+
2834
3040
 
2835
3041
 
2836
3042
  <xsl:variable name="margin-side">
@@ -2852,6 +3058,8 @@
2852
3058
 
2853
3059
 
2854
3060
 
3061
+
3062
+
2855
3063
 
2856
3064
 
2857
3065
 
@@ -2888,12 +3096,22 @@
2888
3096
 
2889
3097
 
2890
3098
 
3099
+
3100
+
2891
3101
  </xsl:element>
2892
3102
  </xsl:variable>
2893
3103
 
3104
+ <xsl:if test="$isGenerateTableIF = 'true'">
3105
+ <!-- to determine start of table -->
3106
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3107
+ </xsl:if>
2894
3108
 
2895
3109
  <fo:table id="{@id}">
2896
3110
 
3111
+ <xsl:if test="$isGenerateTableIF = 'true'">
3112
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3113
+ </xsl:if>
3114
+
2897
3115
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2898
3116
  <xsl:attribute name="{local-name()}">
2899
3117
  <xsl:value-of select="."/>
@@ -2907,24 +3125,47 @@
2907
3125
 
2908
3126
 
2909
3127
  <xsl:choose>
2910
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2911
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2912
- <fo:table-column column-width="{@width}"/>
2913
- </xsl:for-each>
3128
+ <xsl:when test="$isGenerateTableIF = 'true'">
3129
+ <!-- generate IF for table widths -->
3130
+ <!-- example:
3131
+ <tr>
3132
+ <td valign="top" align="left" id="tab-symdu_1_1">
3133
+ <p>Symbol</p>
3134
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3135
+ </td>
3136
+ <td valign="top" align="left" id="tab-symdu_1_2">
3137
+ <p>Description</p>
3138
+ <word id="tab-symdu_1_2_word_1">Description</word>
3139
+ </td>
3140
+ </tr>
3141
+ -->
3142
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
3143
+
2914
3144
  </xsl:when>
2915
3145
  <xsl:otherwise>
2916
- <xsl:call-template name="insertTableColumnWidth">
2917
- <xsl:with-param name="colwidths" select="$colwidths"/>
2918
- </xsl:call-template>
2919
- </xsl:otherwise>
2920
- </xsl:choose>
2921
3146
 
2922
- <xsl:choose>
2923
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2924
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2925
- </xsl:when>
2926
- <xsl:otherwise>
2927
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
3147
+ <xsl:choose>
3148
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3149
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3150
+ <fo:table-column column-width="{@width}"/>
3151
+ </xsl:for-each>
3152
+ </xsl:when>
3153
+ <xsl:otherwise>
3154
+ <xsl:call-template name="insertTableColumnWidth">
3155
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3156
+ </xsl:call-template>
3157
+ </xsl:otherwise>
3158
+ </xsl:choose>
3159
+
3160
+ <xsl:choose>
3161
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3162
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3163
+ </xsl:when>
3164
+ <xsl:otherwise>
3165
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
3166
+ </xsl:otherwise>
3167
+ </xsl:choose>
3168
+
2928
3169
  </xsl:otherwise>
2929
3170
  </xsl:choose>
2930
3171
 
@@ -3002,23 +3243,29 @@
3002
3243
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3003
3244
  <xsl:param name="continued"/>
3004
3245
  <xsl:if test="normalize-space() != ''">
3005
- <fo:block xsl:use-attribute-sets="table-name-style">
3006
-
3007
-
3008
-
3009
-
3246
+
3247
+
3010
3248
 
3011
- <xsl:choose>
3012
- <xsl:when test="$continued = 'true'">
3249
+ <fo:block xsl:use-attribute-sets="table-name-style">
3250
+
3013
3251
 
3014
- </xsl:when>
3015
- <xsl:otherwise>
3016
- <xsl:apply-templates/>
3017
- </xsl:otherwise>
3018
- </xsl:choose>
3019
-
3252
+
3253
+
3254
+
3255
+ <xsl:choose>
3256
+ <xsl:when test="$continued = 'true'">
3257
+
3258
+ </xsl:when>
3259
+ <xsl:otherwise>
3260
+ <xsl:apply-templates/>
3261
+ </xsl:otherwise>
3262
+ </xsl:choose>
3263
+
3264
+
3265
+ </fo:block>
3266
+
3020
3267
 
3021
- </fo:block>
3268
+
3022
3269
  </xsl:if>
3023
3270
  </xsl:template><xsl:template name="calculate-columns-numbers">
3024
3271
  <xsl:param name="table-row"/>
@@ -3027,11 +3274,22 @@
3027
3274
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3028
3275
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3029
3276
  </xsl:template><xsl:template name="calculate-column-widths">
3277
+ <xsl:param name="table"/>
3278
+ <xsl:param name="cols-count"/>
3279
+
3280
+ <xsl:call-template name="calculate-column-widths-proportional">
3281
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3282
+ <xsl:with-param name="table" select="$table"/>
3283
+ </xsl:call-template>
3284
+
3285
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
3030
3286
  <xsl:param name="table"/>
3031
3287
  <xsl:param name="cols-count"/>
3032
3288
  <xsl:param name="curr-col" select="1"/>
3033
3289
  <xsl:param name="width" select="0"/>
3034
3290
 
3291
+ <!-- table=<xsl:copy-of select="$table"/> -->
3292
+
3035
3293
  <xsl:if test="$curr-col &lt;= $cols-count">
3036
3294
  <xsl:variable name="widths">
3037
3295
  <xsl:choose>
@@ -3069,10 +3327,15 @@
3069
3327
  </xsl:for-each>
3070
3328
  </xsl:when>
3071
3329
  <xsl:otherwise>
3072
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
3330
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
3331
+
3332
+ <!-- <table><xsl:copy-of select="$table"/></table>
3333
+ -->
3334
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
3073
3335
  <xsl:variable name="td_text">
3074
3336
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3075
3337
  </xsl:variable>
3338
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
3076
3339
  <xsl:variable name="words">
3077
3340
  <xsl:variable name="string_with_added_zerospaces">
3078
3341
  <xsl:call-template name="add-zero-spaces-java">
@@ -3087,6 +3350,7 @@
3087
3350
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3088
3351
  </xsl:call-template>
3089
3352
  </xsl:variable>
3353
+ <!-- words=<xsl:copy-of select="$words"/> -->
3090
3354
  <xsl:variable name="max_length">
3091
3355
  <xsl:call-template name="max_length">
3092
3356
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -3111,6 +3375,8 @@
3111
3375
  </xsl:choose>
3112
3376
  </xsl:variable>
3113
3377
 
3378
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
3379
+
3114
3380
  <column>
3115
3381
  <xsl:for-each select="xalan:nodeset($widths)//width">
3116
3382
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3119,33 +3385,271 @@
3119
3385
  </xsl:if>
3120
3386
  </xsl:for-each>
3121
3387
  </column>
3122
- <xsl:call-template name="calculate-column-widths">
3388
+ <xsl:call-template name="calculate-column-widths-proportional">
3123
3389
  <xsl:with-param name="cols-count" select="$cols-count"/>
3124
3390
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
3125
3391
  <xsl:with-param name="table" select="$table"/>
3126
3392
  </xsl:call-template>
3127
3393
  </xsl:if>
3128
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
3394
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
3129
3395
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
3130
3396
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
3131
3397
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
3398
+
3399
+ <!-- if all capitals english letters or digits -->
3400
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
3401
+ <xsl:call-template name="repeat">
3402
+ <xsl:with-param name="char" select="'X'"/>
3403
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
3404
+ </xsl:call-template>
3405
+ </xsl:if>
3132
3406
  </xsl:template><xsl:template match="text()" mode="td_text">
3133
3407
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3134
3408
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3135
3409
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3136
3410
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3137
3411
  <xsl:value-of select="@target"/>
3138
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3139
- <xsl:variable name="mathml">
3140
- <xsl:for-each select="*">
3141
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3142
- <xsl:copy-of select="."/>
3143
- </xsl:if>
3412
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
3413
+ <xsl:if test="$isGenerateTableIF = 'false'">
3414
+ <xsl:variable name="mathml_">
3415
+ <xsl:for-each select="*">
3416
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3417
+ <xsl:copy-of select="."/>
3418
+ </xsl:if>
3419
+ </xsl:for-each>
3420
+ </xsl:variable>
3421
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
3422
+
3423
+ <xsl:variable name="math_text">
3424
+ <xsl:value-of select="normalize-space($mathml)"/>
3425
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
3426
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
3427
+ </xsl:variable>
3428
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3429
+ </xsl:if>
3430
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
3431
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
3432
+
3433
+ <!-- via intermediate format -->
3434
+
3435
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
3436
+
3437
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
3438
+
3439
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
3440
+
3441
+ <!-- get current table id -->
3442
+ <xsl:variable name="table_id" select="@id"/>
3443
+ <!-- find table by id in the file 'table_widths' -->
3444
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
3445
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
3446
+
3447
+ <!-- table='<xsl:copy-of select="$table"/>' -->
3448
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
3449
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
3450
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
3451
+
3452
+ <xsl:variable name="table_with_cell_widths_">
3453
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
3454
+ </xsl:variable>
3455
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
3456
+
3457
+ <!-- <xsl:if test="$table_if_debug = 'true'">
3458
+ <xsl:copy-of select="$table_with_cell_widths"/>
3459
+ </xsl:if> -->
3460
+
3461
+
3462
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
3463
+
3464
+ <xsl:variable name="column_widths_">
3465
+ <!-- iteration of columns -->
3466
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
3467
+ <xsl:variable name="pos" select="position()"/>
3468
+ <column>
3469
+ <xsl:attribute name="width_max">
3470
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
3471
+ <xsl:sort select="." data-type="number" order="descending"/>
3472
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3473
+ </xsl:for-each>
3474
+ </xsl:attribute>
3475
+ <xsl:attribute name="width_min">
3476
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
3477
+ <xsl:sort select="." data-type="number" order="descending"/>
3478
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3479
+ </xsl:for-each>
3480
+ </xsl:attribute>
3481
+ </column>
3144
3482
  </xsl:for-each>
3145
3483
  </xsl:variable>
3484
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
3485
+
3486
+ <!-- <column_widths>
3487
+ <xsl:copy-of select="$column_widths"/>
3488
+ </column_widths> -->
3489
+
3490
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
3491
+ <xsl:variable name="table_widths_">
3492
+ <table>
3493
+ <xsl:attribute name="width_max">
3494
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
3495
+ </xsl:attribute>
3496
+ <xsl:attribute name="width_min">
3497
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
3498
+ </xsl:attribute>
3499
+ </table>
3500
+ </xsl:variable>
3501
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
3502
+
3503
+ <xsl:variable name="page_width">
3504
+ <xsl:choose>
3505
+ <xsl:when test="$parent_table_page-width != ''">
3506
+ <xsl:value-of select="$parent_table_page-width"/>
3507
+ </xsl:when>
3508
+ <xsl:otherwise>
3509
+ <xsl:value-of select="@page-width"/>
3510
+ </xsl:otherwise>
3511
+ </xsl:choose>
3512
+ </xsl:variable>
3513
+
3514
+ <xsl:if test="$table_if_debug = 'true'">
3515
+ <table_width>
3516
+ <xsl:copy-of select="$table_widths"/>
3517
+ </table_width>
3518
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
3519
+ </xsl:if>
3520
+
3521
+
3522
+ <!-- There are three cases: -->
3523
+ <xsl:choose>
3524
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
3525
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
3526
+ <!-- call old algorithm -->
3527
+ <case1/>
3528
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
3529
+ <xsl:call-template name="calculate-column-widths-proportional">
3530
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3531
+ <xsl:with-param name="table" select="$table"/>
3532
+ </xsl:call-template> -->
3533
+ </xsl:when>
3534
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
3535
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
3536
+ <case2/>
3537
+ <autolayout/>
3538
+ <xsl:for-each select="$column_widths/column/@width_max">
3539
+ <column divider="100"><xsl:value-of select="."/></column>
3540
+ </xsl:for-each>
3541
+ </xsl:when>
3542
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
3543
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
3544
+ Lets also call D the difference between maximum and minimum width of the table.
3545
+ For each column, let d be the difference between maximum and minimum width of that column.
3546
+ Now set the column's width to the minimum width plus d times W over D.
3547
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3548
+ <xsl:when test="($table_widths/table/@width_max &gt; $page_width and $table_widths/table/@width_min &lt; $page_width) or ($table_widths/table/@width_min &gt;= $page_width)">
3549
+ <!-- difference between the available space and the minimum table width -->
3550
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
3551
+ <W><xsl:value-of select="$W"/></W>
3552
+ <!-- difference between maximum and minimum width of the table -->
3553
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
3554
+ <D><xsl:value-of select="$D"/></D>
3555
+ <case3/>
3556
+ <autolayout/>
3557
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
3558
+ <split_keep-within-line>true</split_keep-within-line>
3559
+ </xsl:if>
3560
+ <xsl:for-each select="$column_widths/column">
3561
+ <!-- difference between maximum and minimum width of that column. -->
3562
+ <xsl:variable name="d" select="@width_max - @width_min"/>
3563
+ <d><xsl:value-of select="$d"/></d>
3564
+ <width_min><xsl:value-of select="@width_min"/></width_min>
3565
+ <e><xsl:value-of select="$d * $W div $D"/></e>
3566
+ <!-- set the column's width to the minimum width plus d times W over D. -->
3567
+ <column divider="100">
3568
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3569
+ </column>
3570
+ </xsl:for-each>
3571
+
3572
+ </xsl:when>
3573
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
3574
+ </xsl:choose>
3575
+
3576
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
3577
+
3578
+ <!-- if nested 'dl' or 'table' -->
3579
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
3580
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
3581
+
3582
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
3583
+
3584
+ <xsl:variable name="parent_table_page-width_">
3585
+ <xsl:if test="$parent_table_id != ''">
3586
+ <!-- determine column number in the parent table -->
3587
+ <xsl:variable name="parent_table_column_number">
3588
+ <xsl:choose>
3589
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
3590
+ <xsl:otherwise> <!-- parent is table -->
3591
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
3592
+ </xsl:otherwise>
3593
+ </xsl:choose>
3594
+ </xsl:variable>
3595
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
3596
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3597
+ </xsl:if>
3598
+ </xsl:variable>
3599
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
3600
+
3601
+ <!-- get current table id -->
3602
+ <xsl:variable name="table_id" select="@id"/>
3603
+
3604
+ <xsl:choose>
3605
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
3606
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
3607
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
3608
+ </xsl:when>
3609
+ <xsl:otherwise>
3610
+ <!-- recalculate columns width based on parent table width -->
3611
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
3612
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
3613
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
3614
+ </xsl:call-template>
3615
+ </xsl:for-each>
3616
+ </xsl:otherwise>
3617
+ </xsl:choose>
3146
3618
 
3147
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3148
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3619
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3620
+ <xsl:copy>
3621
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3622
+ </xsl:copy>
3623
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
3624
+ <xsl:copy>
3625
+ <xsl:copy-of select="@*"/>
3626
+
3627
+ <!-- The maximum width is given by the widest line. -->
3628
+ <xsl:attribute name="width_max">
3629
+ <xsl:for-each select="p_len">
3630
+ <xsl:sort select="." data-type="number" order="descending"/>
3631
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3632
+ </xsl:for-each>
3633
+ </xsl:attribute>
3634
+
3635
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3636
+ <xsl:variable name="width_min">
3637
+ <xsl:for-each select="word_len">
3638
+ <xsl:sort select="." data-type="number" order="descending"/>
3639
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3640
+ </xsl:for-each>
3641
+ </xsl:variable>
3642
+ <xsl:attribute name="width_min">
3643
+ <xsl:value-of select="$width_min"/>
3644
+ </xsl:attribute>
3645
+
3646
+ <xsl:if test="$width_min = 0">
3647
+ <xsl:attribute name="width_min">1</xsl:attribute>
3648
+ </xsl:if>
3649
+
3650
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3651
+
3652
+ </xsl:copy>
3149
3653
  </xsl:template><xsl:template match="*[local-name()='thead']">
3150
3654
  <xsl:param name="cols-count"/>
3151
3655
  <fo:table-header>
@@ -3159,12 +3663,18 @@
3159
3663
  <fo:table-row>
3160
3664
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
3161
3665
 
3162
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3163
- <xsl:with-param name="continued">true</xsl:with-param>
3164
- </xsl:apply-templates>
3165
3666
 
3166
3667
 
3167
3668
 
3669
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3670
+ <xsl:with-param name="continued">true</xsl:with-param>
3671
+ </xsl:apply-templates>
3672
+
3673
+
3674
+
3675
+
3676
+
3677
+
3168
3678
  </fo:table-cell>
3169
3679
  </fo:table-row>
3170
3680
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3230,6 +3740,7 @@
3230
3740
  </xsl:for-each>
3231
3741
  </xsl:when>
3232
3742
  <xsl:otherwise>
3743
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
3233
3744
  <xsl:call-template name="insertTableColumnWidth">
3234
3745
  <xsl:with-param name="colwidths" select="$colwidths"/>
3235
3746
  </xsl:call-template>
@@ -3264,7 +3775,10 @@
3264
3775
 
3265
3776
 
3266
3777
  <!-- fn processing -->
3267
- <xsl:call-template name="table_fn_display"/>
3778
+
3779
+ <xsl:call-template name="table_fn_display"/>
3780
+
3781
+
3268
3782
 
3269
3783
  <!-- for PAS display Notes after footnotes -->
3270
3784
 
@@ -3274,6 +3788,9 @@
3274
3788
  </fo:table-body>
3275
3789
 
3276
3790
  </fo:table>
3791
+
3792
+
3793
+
3277
3794
  </xsl:if>
3278
3795
  </xsl:template><xsl:template match="*[local-name()='tbody']">
3279
3796
 
@@ -3309,6 +3826,52 @@
3309
3826
 
3310
3827
  </fo:table-body>
3311
3828
 
3829
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3830
+ <xsl:param name="table_or_dl">table</xsl:param>
3831
+ <xsl:apply-templates mode="process_table-if">
3832
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3833
+ </xsl:apply-templates>
3834
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3835
+ <xsl:param name="table_or_dl">table</xsl:param>
3836
+
3837
+ <fo:table-body>
3838
+ <xsl:for-each select="*[local-name() = 'tr']">
3839
+ <xsl:variable name="col_count" select="count(*)"/>
3840
+
3841
+ <!-- iteration for each tr/td -->
3842
+
3843
+ <xsl:choose>
3844
+ <xsl:when test="$table_or_dl = 'table'">
3845
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3846
+ <fo:table-row number-columns-spanned="{$col_count}">
3847
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3848
+ <xsl:call-template name="td"/>
3849
+ </fo:table-row>
3850
+ </xsl:for-each>
3851
+ </xsl:when>
3852
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3853
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3854
+ <xsl:variable name="is_dt" select="position() = 1"/>
3855
+
3856
+ <xsl:for-each select="*">
3857
+ <!-- <test><xsl:copy-of select="."/></test> -->
3858
+ <fo:table-row number-columns-spanned="{$col_count}">
3859
+ <xsl:choose>
3860
+ <xsl:when test="$is_dt">
3861
+ <xsl:call-template name="insert_dt_cell"/>
3862
+ </xsl:when>
3863
+ <xsl:otherwise>
3864
+ <xsl:call-template name="insert_dd_cell"/>
3865
+ </xsl:otherwise>
3866
+ </xsl:choose>
3867
+ </fo:table-row>
3868
+ </xsl:for-each>
3869
+ </xsl:for-each>
3870
+ </xsl:otherwise>
3871
+ </xsl:choose>
3872
+
3873
+ </xsl:for-each>
3874
+ </fo:table-body>
3312
3875
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3313
3876
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3314
3877
 
@@ -3316,6 +3879,9 @@
3316
3879
 
3317
3880
 
3318
3881
 
3882
+
3883
+
3884
+
3319
3885
 
3320
3886
 
3321
3887
  <xsl:call-template name="setTableRowAttributes"/>
@@ -3334,6 +3900,8 @@
3334
3900
 
3335
3901
 
3336
3902
 
3903
+
3904
+
3337
3905
  <xsl:variable name="number"><xsl:number/></xsl:variable>
3338
3906
  <xsl:if test="$number mod 2 = 0">
3339
3907
  <xsl:attribute name="background-color">rgb(254, 247, 228)</xsl:attribute>
@@ -3400,7 +3968,7 @@
3400
3968
  </xsl:choose>
3401
3969
  </xsl:attribute>
3402
3970
  </xsl:if>
3403
- </xsl:template><xsl:template match="*[local-name()='td']">
3971
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
3404
3972
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
3405
3973
  <xsl:call-template name="setTextAlignment">
3406
3974
  <xsl:with-param name="default">left</xsl:with-param>
@@ -3421,6 +3989,8 @@
3421
3989
 
3422
3990
 
3423
3991
 
3992
+
3993
+
3424
3994
 
3425
3995
 
3426
3996
 
@@ -3434,11 +4004,24 @@
3434
4004
 
3435
4005
  <xsl:call-template name="setTableCellAttributes"/>
3436
4006
 
4007
+ <xsl:if test="$isGenerateTableIF = 'true'">
4008
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4009
+ <xsl:attribute name="text-align">left</xsl:attribute>
4010
+ </xsl:if>
4011
+
3437
4012
  <fo:block>
3438
4013
 
4014
+ <xsl:if test="$isGenerateTableIF = 'true'">
4015
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4016
+ </xsl:if>
4017
+
4018
+
3439
4019
 
3440
4020
 
3441
4021
  <xsl:apply-templates/>
4022
+
4023
+ <xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
4024
+
3442
4025
  </fo:block>
3443
4026
  </fo:table-cell>
3444
4027
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -3479,7 +4062,11 @@
3479
4062
 
3480
4063
  <xsl:variable name="gen_id" select="generate-id(.)"/>
3481
4064
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3482
- <xsl:variable name="reference" select="@reference"/>
4065
+ <xsl:variable name="reference_">
4066
+ <xsl:value-of select="@reference"/>
4067
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4068
+ </xsl:variable>
4069
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
3483
4070
  <!-- fn sequence number in document -->
3484
4071
  <xsl:variable name="current_fn_number">
3485
4072
  <xsl:choose>
@@ -3554,7 +4141,7 @@
3554
4141
  <xsl:copy-of select="node()"/>
3555
4142
  </fn>
3556
4143
  </xsl:for-each>
3557
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
4144
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
3558
4145
  <xsl:sort select="@displayorder" data-type="number"/>
3559
4146
  <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3560
4147
  <!-- copy unique fn -->
@@ -3635,9 +4222,9 @@
3635
4222
  <!-- current hierarchy is 'figure' element -->
3636
4223
  <xsl:variable name="following_dl_colwidths">
3637
4224
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3638
- <xsl:variable name="html-table">
3639
- <xsl:variable name="doc_ns">
3640
-
4225
+ <xsl:variable name="simple-table">
4226
+ <!-- <xsl:variable name="doc_ns">
4227
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3641
4228
  </xsl:variable>
3642
4229
  <xsl:variable name="ns">
3643
4230
  <xsl:choose>
@@ -3648,7 +4235,7 @@
3648
4235
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3649
4236
  </xsl:otherwise>
3650
4237
  </xsl:choose>
3651
- </xsl:variable>
4238
+ </xsl:variable> -->
3652
4239
 
3653
4240
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3654
4241
  <tbody>
@@ -3659,7 +4246,7 @@
3659
4246
 
3660
4247
  <xsl:call-template name="calculate-column-widths">
3661
4248
  <xsl:with-param name="cols-count" select="2"/>
3662
- <xsl:with-param name="table" select="$html-table"/>
4249
+ <xsl:with-param name="table" select="$simple-table"/>
3663
4250
  </xsl:call-template>
3664
4251
 
3665
4252
  </xsl:if>
@@ -3837,12 +4424,31 @@
3837
4424
 
3838
4425
 
3839
4426
 
4427
+
4428
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
4429
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4430
+ </xsl:if>
4431
+
3840
4432
  <fo:block>
3841
4433
 
3842
4434
 
3843
4435
 
3844
4436
 
4437
+ <xsl:apply-templates select="*[local-name() = 'name']">
4438
+ <xsl:with-param name="process">true</xsl:with-param>
4439
+ </xsl:apply-templates>
4440
+
4441
+ <xsl:if test="$isGenerateTableIF = 'true'">
4442
+ <!-- to determine start of table -->
4443
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
4444
+ </xsl:if>
4445
+
3845
4446
  <fo:table width="95%" table-layout="fixed">
4447
+
4448
+ <xsl:if test="$isGenerateTableIF = 'true'">
4449
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
4450
+ </xsl:if>
4451
+
3846
4452
 
3847
4453
  <xsl:choose>
3848
4454
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3851,69 +4457,173 @@
3851
4457
 
3852
4458
  </xsl:when>
3853
4459
  </xsl:choose>
3854
- <!-- create virtual html table for dl/[dt and dd] -->
3855
- <xsl:variable name="html-table">
3856
- <xsl:variable name="doc_ns">
4460
+
4461
+
4462
+
4463
+ <xsl:choose>
4464
+ <xsl:when test="$isGenerateTableIF = 'true'">
4465
+ <!-- generate IF for table widths -->
4466
+ <!-- example:
4467
+ <tr>
4468
+ <td valign="top" align="left" id="tab-symdu_1_1">
4469
+ <p>Symbol</p>
4470
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
4471
+ </td>
4472
+ <td valign="top" align="left" id="tab-symdu_1_2">
4473
+ <p>Description</p>
4474
+ <word id="tab-symdu_1_2_word_1">Description</word>
4475
+ </td>
4476
+ </tr>
4477
+ -->
3857
4478
 
3858
- </xsl:variable>
3859
- <xsl:variable name="ns">
3860
- <xsl:choose>
3861
- <xsl:when test="normalize-space($doc_ns) != ''">
3862
- <xsl:value-of select="normalize-space($doc_ns)"/>
3863
- </xsl:when>
3864
- <xsl:otherwise>
3865
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3866
- </xsl:otherwise>
3867
- </xsl:choose>
3868
- </xsl:variable>
3869
- <tbody>
3870
- <xsl:apply-templates mode="dl"/>
3871
- </tbody>
3872
- </xsl:variable>
3873
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3874
- <xsl:variable name="colwidths">
3875
- <xsl:call-template name="calculate-column-widths">
3876
- <xsl:with-param name="cols-count" select="2"/>
3877
- <xsl:with-param name="table" select="$html-table"/>
3878
- </xsl:call-template>
3879
- </xsl:variable>
3880
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3881
- <xsl:variable name="maxlength_dt">
3882
- <xsl:call-template name="getMaxLength_dt"/>
3883
- </xsl:variable>
3884
- <xsl:variable name="isContainsKeepTogetherTag_">
3885
- false
3886
- </xsl:variable>
3887
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3888
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3889
- <xsl:call-template name="setColumnWidth_dl">
3890
- <xsl:with-param name="colwidths" select="$colwidths"/>
3891
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3892
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3893
- </xsl:call-template>
4479
+ <!-- create virtual html table for dl/[dt and dd] -->
4480
+ <xsl:variable name="simple-table">
4481
+
4482
+ <xsl:variable name="dl_table">
4483
+ <tbody>
4484
+ <xsl:apply-templates mode="dl_if">
4485
+ <xsl:with-param name="id" select="@id"/>
4486
+ </xsl:apply-templates>
4487
+ </tbody>
4488
+ </xsl:variable>
4489
+
4490
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
4491
+
4492
+ <!-- Step: replace <br/> to <p>...</p> -->
4493
+ <xsl:variable name="table_without_br">
4494
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
4495
+ </xsl:variable>
4496
+
4497
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
4498
+
4499
+ <!-- Step: add id to each cell -->
4500
+ <!-- add <word>...</word> for each word, image, math -->
4501
+ <xsl:variable name="simple-table-id">
4502
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
4503
+ <xsl:with-param name="id" select="@id"/>
4504
+ </xsl:apply-templates>
4505
+ </xsl:variable>
4506
+
4507
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
4508
+
4509
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4510
+
4511
+ </xsl:variable>
4512
+
4513
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
4514
+
4515
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
4516
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
4517
+ </xsl:apply-templates>
4518
+
4519
+ </xsl:when>
4520
+ <xsl:otherwise>
3894
4521
 
3895
- <fo:table-body>
3896
- <xsl:apply-templates>
3897
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3898
- </xsl:apply-templates>
3899
- </fo:table-body>
4522
+ <xsl:variable name="simple-table">
4523
+
4524
+ <xsl:variable name="dl_table">
4525
+ <tbody>
4526
+ <xsl:apply-templates mode="dl">
4527
+ <xsl:with-param name="id" select="@id"/>
4528
+ </xsl:apply-templates>
4529
+ </tbody>
4530
+ </xsl:variable>
4531
+
4532
+ <xsl:copy-of select="$dl_table"/>
4533
+ </xsl:variable>
4534
+
4535
+ <xsl:variable name="colwidths">
4536
+ <xsl:call-template name="calculate-column-widths">
4537
+ <xsl:with-param name="cols-count" select="2"/>
4538
+ <xsl:with-param name="table" select="$simple-table"/>
4539
+ </xsl:call-template>
4540
+ </xsl:variable>
4541
+
4542
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
4543
+ DEBUG
4544
+ colwidths=<xsl:copy-of select="$colwidths"/>
4545
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
4546
+
4547
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4548
+
4549
+ <xsl:variable name="maxlength_dt">
4550
+ <xsl:call-template name="getMaxLength_dt"/>
4551
+ </xsl:variable>
4552
+
4553
+ <xsl:variable name="isContainsKeepTogetherTag_">
4554
+ false
4555
+ </xsl:variable>
4556
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4557
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4558
+
4559
+
4560
+ <xsl:call-template name="setColumnWidth_dl">
4561
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4562
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4563
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4564
+ </xsl:call-template>
4565
+
4566
+ <fo:table-body>
4567
+
4568
+ <!-- DEBUG -->
4569
+ <xsl:if test="$table_if_debug = 'true'">
4570
+ <fo:table-row>
4571
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
4572
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
4573
+ </fo:table-cell>
4574
+ </fo:table-row>
4575
+ </xsl:if>
4576
+
4577
+ <xsl:apply-templates>
4578
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
4579
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
4580
+ </xsl:apply-templates>
4581
+
4582
+ </fo:table-body>
4583
+ </xsl:otherwise>
4584
+ </xsl:choose>
3900
4585
  </fo:table>
3901
4586
  </fo:block>
3902
4587
  </fo:block>
3903
4588
  </xsl:if> <!-- END: a few components -->
3904
4589
  </fo:block-container>
3905
4590
  </fo:block-container>
4591
+
4592
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
4593
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
4594
+ </xsl:if>
4595
+
4596
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4597
+ <xsl:param name="process">false</xsl:param>
4598
+ <xsl:if test="$process = 'true'">
4599
+ <fo:block xsl:use-attribute-sets="dl-name-style">
4600
+ <xsl:apply-templates/>
4601
+ </fo:block>
4602
+ </xsl:if>
3906
4603
  </xsl:template><xsl:template name="setColumnWidth_dl">
3907
4604
  <xsl:param name="colwidths"/>
3908
4605
  <xsl:param name="maxlength_dt"/>
3909
4606
  <xsl:param name="isContainsKeepTogetherTag"/>
4607
+
4608
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
4609
+
3910
4610
  <xsl:choose>
4611
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4612
+ <xsl:call-template name="insertTableColumnWidth">
4613
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4614
+ </xsl:call-template>
4615
+ </xsl:when>
3911
4616
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3912
4617
  <fo:table-column column-width="50%"/>
3913
4618
  <fo:table-column column-width="50%"/>
3914
4619
  </xsl:when>
3915
4620
  <xsl:otherwise>
3916
4621
  <xsl:choose>
4622
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4623
+ <xsl:call-template name="insertTableColumnWidth">
4624
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4625
+ </xsl:call-template>
4626
+ </xsl:when>
3917
4627
  <xsl:when test="$isContainsKeepTogetherTag">
3918
4628
  <xsl:call-template name="insertTableColumnWidth">
3919
4629
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3958,13 +4668,19 @@
3958
4668
  </xsl:choose>
3959
4669
  </xsl:template><xsl:template name="insertTableColumnWidth">
3960
4670
  <xsl:param name="colwidths"/>
4671
+
3961
4672
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3962
4673
  <xsl:choose>
3963
4674
  <xsl:when test=". = 1 or . = 0">
3964
4675
  <fo:table-column column-width="proportional-column-width(2)"/>
3965
4676
  </xsl:when>
3966
4677
  <xsl:otherwise>
3967
- <fo:table-column column-width="proportional-column-width({.})"/>
4678
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
4679
+ <xsl:variable name="divider">
4680
+ <xsl:value-of select="@divider"/>
4681
+ <xsl:if test="not(@divider)">1</xsl:if>
4682
+ </xsl:variable>
4683
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3968
4684
  </xsl:otherwise>
3969
4685
  </xsl:choose>
3970
4686
  </xsl:for-each>
@@ -4026,11 +4742,19 @@
4026
4742
  </fo:table-cell>
4027
4743
  </fo:table-row>
4028
4744
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
4745
+ <xsl:param name="id"/>
4746
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4029
4747
  <tr>
4030
4748
  <td>
4749
+ <xsl:attribute name="id">
4750
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4751
+ </xsl:attribute>
4031
4752
  <xsl:apply-templates/>
4032
4753
  </td>
4033
4754
  <td>
4755
+ <xsl:attribute name="id">
4756
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4757
+ </xsl:attribute>
4034
4758
 
4035
4759
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4036
4760
  <xsl:with-param name="process">true</xsl:with-param>
@@ -4041,47 +4765,129 @@
4041
4765
 
4042
4766
  </xsl:template><xsl:template match="*[local-name()='dt']">
4043
4767
  <xsl:param name="key_iso"/>
4768
+ <xsl:param name="split_keep-within-line"/>
4769
+
4770
+ <fo:table-row xsl:use-attribute-sets="dt-row-style">
4771
+ <xsl:call-template name="insert_dt_cell">
4772
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4773
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4774
+ </xsl:call-template>
4775
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4776
+ <xsl:call-template name="insert_dd_cell">
4777
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4778
+ </xsl:call-template>
4779
+ </xsl:for-each>
4780
+ </fo:table-row>
4781
+ </xsl:template><xsl:template name="insert_dt_cell">
4782
+ <xsl:param name="key_iso"/>
4783
+ <xsl:param name="split_keep-within-line"/>
4784
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4785
+
4786
+ <xsl:if test="$isGenerateTableIF = 'true'">
4787
+ <!-- border is mandatory, to calculate real width -->
4788
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4789
+ <xsl:attribute name="text-align">left</xsl:attribute>
4790
+ </xsl:if>
4791
+
4792
+
4793
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4794
+ <xsl:copy-of select="@id"/>
4795
+
4796
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4797
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4798
+ </xsl:if>
4799
+
4800
+
4801
+
4802
+ <xsl:apply-templates>
4803
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4804
+ </xsl:apply-templates>
4805
+
4806
+ <xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
4807
+
4808
+ </fo:block>
4809
+ </fo:table-cell>
4810
+ </xsl:template><xsl:template name="insert_dd_cell">
4811
+ <xsl:param name="split_keep-within-line"/>
4812
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4813
+
4814
+ <xsl:if test="$isGenerateTableIF = 'true'">
4815
+ <!-- border is mandatory, to calculate real width -->
4816
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4817
+ </xsl:if>
4044
4818
 
4045
- <fo:table-row xsl:use-attribute-sets="dt-row-style">
4046
- <fo:table-cell>
4819
+ <fo:block>
4820
+
4821
+ <xsl:if test="$isGenerateTableIF = 'true'">
4822
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4823
+ </xsl:if>
4824
+
4047
4825
 
4048
- <fo:block xsl:use-attribute-sets="dt-style">
4049
- <xsl:copy-of select="@id"/>
4050
-
4051
- <xsl:if test="normalize-space($key_iso) = 'true'">
4052
- <xsl:attribute name="margin-top">0</xsl:attribute>
4053
- </xsl:if>
4054
-
4055
-
4056
-
4057
- <xsl:apply-templates/>
4058
- </fo:block>
4059
- </fo:table-cell>
4060
- <fo:table-cell>
4061
- <fo:block>
4062
-
4063
4826
 
4064
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4065
- <xsl:with-param name="process">true</xsl:with-param>
4066
- </xsl:apply-templates>
4067
- </fo:block>
4068
- </fo:table-cell>
4069
- </fo:table-row>
4827
+ <xsl:choose>
4828
+ <xsl:when test="$isGenerateTableIF = 'true'">
4829
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4830
+ <xsl:with-param name="process">true</xsl:with-param>
4831
+ </xsl:apply-templates>
4832
+ </xsl:when>
4833
+ <xsl:otherwise>
4834
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4835
+ <xsl:with-param name="process">true</xsl:with-param>
4836
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4837
+ </xsl:apply-templates>
4838
+ </xsl:otherwise>
4839
+
4840
+ </xsl:choose>
4841
+
4842
+ <xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
4843
+
4844
+ </fo:block>
4845
+ </fo:table-cell>
4070
4846
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4071
4847
  <xsl:apply-templates/>
4072
4848
  </xsl:template><xsl:template match="*[local-name()='dd']">
4073
4849
  <xsl:param name="process">false</xsl:param>
4850
+ <xsl:param name="split_keep-within-line"/>
4074
4851
  <xsl:if test="$process = 'true'">
4075
4852
  <xsl:apply-templates select="@language"/>
4076
- <xsl:apply-templates/>
4853
+ <xsl:apply-templates>
4854
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4855
+ </xsl:apply-templates>
4077
4856
  </xsl:if>
4078
4857
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4079
4858
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4080
- </xsl:template><xsl:template match="*[local-name()='em']">
4859
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4860
+ <xsl:param name="id"/>
4861
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4862
+ <tr>
4863
+ <td>
4864
+ <xsl:copy-of select="node()"/>
4865
+ </td>
4866
+ <td>
4867
+
4868
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4869
+
4870
+ <!-- get paragraphs from nested 'dl' -->
4871
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4872
+
4873
+
4874
+ </td>
4875
+ </tr>
4876
+
4877
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4878
+ <xsl:for-each select="*[local-name() = 'dt']">
4879
+ <p>
4880
+ <xsl:copy-of select="node()"/>
4881
+ <xsl:text> </xsl:text>
4882
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4883
+ </p>
4884
+ </xsl:for-each>
4885
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
4081
4886
  <fo:inline font-style="italic">
4082
4887
  <xsl:apply-templates/>
4083
4888
  </fo:inline>
4084
4889
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4890
+ <xsl:param name="split_keep-within-line"/>
4085
4891
  <fo:inline font-weight="bold">
4086
4892
 
4087
4893
  <xsl:if test="not(parent::*[local-name() = 'termsource'])">
@@ -4089,7 +4895,9 @@
4089
4895
  <xsl:attribute name="color">black</xsl:attribute>
4090
4896
  </xsl:if>
4091
4897
 
4092
- <xsl:apply-templates/>
4898
+ <xsl:apply-templates>
4899
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4900
+ </xsl:apply-templates>
4093
4901
  </fo:inline>
4094
4902
  </xsl:template><xsl:template match="*[local-name()='padding']">
4095
4903
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -4110,7 +4918,7 @@
4110
4918
 
4111
4919
 
4112
4920
 
4113
-
4921
+ <!-- 10 -->
4114
4922
 
4115
4923
 
4116
4924
 
@@ -4295,6 +5103,10 @@
4295
5103
  <xsl:param name="text"/>
4296
5104
  <xsl:param name="separator" select="' '"/>
4297
5105
  <xsl:choose>
5106
+
5107
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
5108
+ <word><xsl:value-of select="normalize-space($text)"/></word>
5109
+ </xsl:when>
4298
5110
  <xsl:when test="not(contains($text, $separator))">
4299
5111
  <word>
4300
5112
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -4339,13 +5151,66 @@
4339
5151
  </xsl:when>
4340
5152
  <xsl:otherwise>
4341
5153
  <word>
4342
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
5154
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
5155
+ <xsl:choose>
5156
+ <xsl:when test="$isGenerateTableIF = 'true'">
5157
+ <xsl:value-of select="$word"/>
5158
+ </xsl:when>
5159
+ <xsl:otherwise>
5160
+ <xsl:value-of select="string-length($word)"/>
5161
+ </xsl:otherwise>
5162
+ </xsl:choose>
4343
5163
  </word>
4344
5164
  <xsl:call-template name="tokenize">
4345
5165
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4346
5166
  </xsl:call-template>
4347
5167
  </xsl:otherwise>
4348
5168
  </xsl:choose>
5169
+ </xsl:template><xsl:template name="tokenize_with_tags">
5170
+ <xsl:param name="tags"/>
5171
+ <xsl:param name="text"/>
5172
+ <xsl:param name="separator" select="' '"/>
5173
+ <xsl:choose>
5174
+
5175
+ <xsl:when test="not(contains($text, $separator))">
5176
+ <word>
5177
+ <xsl:call-template name="enclose_text_in_tags">
5178
+ <xsl:with-param name="text" select="normalize-space($text)"/>
5179
+ <xsl:with-param name="tags" select="$tags"/>
5180
+ </xsl:call-template>
5181
+ </word>
5182
+ </xsl:when>
5183
+ <xsl:otherwise>
5184
+ <word>
5185
+ <xsl:call-template name="enclose_text_in_tags">
5186
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
5187
+ <xsl:with-param name="tags" select="$tags"/>
5188
+ </xsl:call-template>
5189
+ </word>
5190
+ <xsl:call-template name="tokenize_with_tags">
5191
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5192
+ </xsl:call-template>
5193
+ </xsl:otherwise>
5194
+ </xsl:choose>
5195
+ </xsl:template><xsl:template name="enclose_text_in_tags">
5196
+ <xsl:param name="text"/>
5197
+ <xsl:param name="tags"/>
5198
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
5199
+
5200
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
5201
+
5202
+ <xsl:choose>
5203
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
5204
+ <xsl:otherwise>
5205
+ <xsl:element name="{$tag_name}">
5206
+ <xsl:call-template name="enclose_text_in_tags">
5207
+ <xsl:with-param name="text" select="$text"/>
5208
+ <xsl:with-param name="tags" select="$tags"/>
5209
+ <xsl:with-param name="num" select="$num + 1"/>
5210
+ </xsl:call-template>
5211
+ </xsl:element>
5212
+ </xsl:otherwise>
5213
+ </xsl:choose>
4349
5214
  </xsl:template><xsl:template name="max_length">
4350
5215
  <xsl:param name="words"/>
4351
5216
  <xsl:for-each select="$words//word">
@@ -4446,12 +5311,19 @@
4446
5311
  </xsl:otherwise>
4447
5312
  </xsl:choose>
4448
5313
  </xsl:template><xsl:template name="getSimpleTable">
5314
+ <xsl:param name="id"/>
5315
+
4449
5316
  <xsl:variable name="simple-table">
4450
5317
 
5318
+ <!-- Step 0. replace <br/> to <p>...</p> -->
5319
+ <xsl:variable name="table_without_br">
5320
+ <xsl:apply-templates mode="table-without-br"/>
5321
+ </xsl:variable>
5322
+
4451
5323
  <!-- Step 1. colspan processing -->
4452
5324
  <xsl:variable name="simple-table-colspan">
4453
5325
  <tbody>
4454
- <xsl:apply-templates mode="simple-table-colspan"/>
5326
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
4455
5327
  </tbody>
4456
5328
  </xsl:variable>
4457
5329
 
@@ -4460,10 +5332,67 @@
4460
5332
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
4461
5333
  </xsl:variable>
4462
5334
 
4463
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
4464
-
5335
+ <!-- Step 3: add id to each cell -->
5336
+ <!-- add <word>...</word> for each word, image, math -->
5337
+ <xsl:variable name="simple-table-id">
5338
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
5339
+ <xsl:with-param name="id" select="$id"/>
5340
+ </xsl:apply-templates>
5341
+ </xsl:variable>
5342
+
5343
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
5344
+
4465
5345
  </xsl:variable>
4466
5346
  <xsl:copy-of select="$simple-table"/>
5347
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
5348
+ <xsl:copy>
5349
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
5350
+ </xsl:copy>
5351
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
5352
+ <xsl:copy>
5353
+ <xsl:copy-of select="@*"/>
5354
+ <p>
5355
+ <xsl:copy-of select="node()"/>
5356
+ </p>
5357
+ </xsl:copy>
5358
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
5359
+ <xsl:copy>
5360
+ <xsl:copy-of select="@*"/>
5361
+ <xsl:for-each select="*[local-name()='br']">
5362
+ <xsl:variable name="current_id" select="generate-id()"/>
5363
+ <p>
5364
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
5365
+ <xsl:copy-of select="."/>
5366
+ </xsl:for-each>
5367
+ </p>
5368
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
5369
+ <p>
5370
+ <xsl:for-each select="following-sibling::node()">
5371
+ <xsl:copy-of select="."/>
5372
+ </xsl:for-each>
5373
+ </p>
5374
+ </xsl:if>
5375
+ </xsl:for-each>
5376
+ </xsl:copy>
5377
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
5378
+ <xsl:for-each select="*[local-name()='br']">
5379
+ <xsl:variable name="current_id" select="generate-id()"/>
5380
+ <p>
5381
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
5382
+ <xsl:copy-of select="."/>
5383
+ </xsl:for-each>
5384
+ </p>
5385
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
5386
+ <p>
5387
+ <xsl:for-each select="following-sibling::node()">
5388
+ <xsl:copy-of select="."/>
5389
+ </xsl:for-each>
5390
+ </p>
5391
+ </xsl:if>
5392
+ </xsl:for-each>
5393
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
5394
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
5395
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4467
5396
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4468
5397
  <xsl:apply-templates mode="simple-table-colspan"/>
4469
5398
  </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
@@ -4553,6 +5482,126 @@
4553
5482
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4554
5483
  <xsl:with-param name="previousRow" select="$newRow"/>
4555
5484
  </xsl:apply-templates>
5485
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
5486
+ <xsl:param name="id"/>
5487
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
5488
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
5489
+ <xsl:with-param name="id" select="$id_prefixed"/>
5490
+ </xsl:apply-templates>
5491
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
5492
+ <xsl:param name="id"/>
5493
+ <xsl:copy>
5494
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
5495
+ <xsl:with-param name="id" select="$id"/>
5496
+ </xsl:apply-templates>
5497
+ </xsl:copy>
5498
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
5499
+ <xsl:param name="id"/>
5500
+ <xsl:copy>
5501
+ <xsl:copy-of select="@*"/>
5502
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
5503
+ <xsl:apply-templates select="node()" mode="simple-table-id">
5504
+ <xsl:with-param name="id" select="$id"/>
5505
+ </xsl:apply-templates>
5506
+ </xsl:copy>
5507
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
5508
+ <xsl:param name="id"/>
5509
+ <xsl:copy>
5510
+ <xsl:copy-of select="@*"/>
5511
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
5512
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
5513
+ <xsl:attribute name="id">
5514
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
5515
+ </xsl:attribute>
5516
+
5517
+ <xsl:for-each select="*[local-name() = 'p']">
5518
+ <xsl:copy>
5519
+ <xsl:copy-of select="@*"/>
5520
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5521
+ <xsl:attribute name="id">
5522
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
5523
+ </xsl:attribute>
5524
+
5525
+ <xsl:copy-of select="node()"/>
5526
+ </xsl:copy>
5527
+ </xsl:for-each>
5528
+
5529
+
5530
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
5531
+
5532
+ <xsl:variable name="td_text">
5533
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
5534
+ </xsl:variable>
5535
+
5536
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
5537
+
5538
+ <xsl:variable name="words">
5539
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
5540
+ <word>
5541
+ <xsl:copy-of select="."/>
5542
+ </word>
5543
+ </xsl:for-each>
5544
+
5545
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
5546
+ <xsl:copy-of select="."/>
5547
+ </xsl:for-each>
5548
+
5549
+ </xsl:variable>
5550
+
5551
+ <xsl:for-each select="xalan:nodeset($words)/word">
5552
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5553
+ <xsl:copy>
5554
+ <xsl:attribute name="id">
5555
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
5556
+ </xsl:attribute>
5557
+ <xsl:copy-of select="node()"/>
5558
+ </xsl:copy>
5559
+ </xsl:for-each>
5560
+ </xsl:if>
5561
+ </xsl:copy>
5562
+
5563
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
5564
+ <xsl:copy>
5565
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5566
+ </xsl:copy>
5567
+ </xsl:template><xsl:template match="*[local-name() = 'stem' or local-name() = 'image']" mode="td_text_with_formatting"/><xsl:template match="*[local-name() = 'keep-together_within-line']/text()" mode="td_text_with_formatting">
5568
+ <xsl:variable name="formatting_tags">
5569
+ <xsl:call-template name="getFormattingTags"/>
5570
+ </xsl:variable>
5571
+ <word>
5572
+ <xsl:call-template name="enclose_text_in_tags">
5573
+ <xsl:with-param name="text" select="normalize-space(.)"/>
5574
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5575
+ </xsl:call-template>
5576
+ </word>
5577
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
5578
+
5579
+ <xsl:variable name="td_text" select="."/>
5580
+
5581
+ <xsl:variable name="string_with_added_zerospaces">
5582
+ <xsl:call-template name="add-zero-spaces-java">
5583
+ <xsl:with-param name="text" select="$td_text"/>
5584
+ </xsl:call-template>
5585
+ </xsl:variable>
5586
+
5587
+ <xsl:variable name="formatting_tags">
5588
+ <xsl:call-template name="getFormattingTags"/>
5589
+ </xsl:variable>
5590
+
5591
+ <!-- <word>text</word> -->
5592
+ <xsl:call-template name="tokenize_with_tags">
5593
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5594
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
5595
+ </xsl:call-template>
5596
+ </xsl:template><xsl:template name="getFormattingTags">
5597
+ <tags>
5598
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
5599
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
5600
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
5601
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
5602
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
5603
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
5604
+ </tags>
4556
5605
  </xsl:template><xsl:template name="getLang">
4557
5606
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4558
5607
  <xsl:variable name="language">
@@ -4746,6 +5795,10 @@
4746
5795
  </xsl:variable>
4747
5796
  <fo:inline xsl:use-attribute-sets="link-style">
4748
5797
 
5798
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5799
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5800
+ </xsl:if>
5801
+
4749
5802
 
4750
5803
 
4751
5804
 
@@ -4758,6 +5811,7 @@
4758
5811
  </xsl:if>
4759
5812
 
4760
5813
 
5814
+
4761
5815
  <xsl:choose>
4762
5816
  <xsl:when test="$target_text = ''">
4763
5817
  <xsl:apply-templates/>
@@ -5021,7 +6075,19 @@
5021
6075
  <xsl:value-of select="$suffix"/>
5022
6076
  </xsl:if>
5023
6077
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
5024
- <fo:inline><xsl:apply-templates/></fo:inline>
6078
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
6079
+ <xsl:choose>
6080
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
6081
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
6082
+ <xsl:apply-templates/>
6083
+ </fo:inline>
6084
+ </xsl:when>
6085
+ <xsl:otherwise>
6086
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
6087
+ <xsl:apply-templates/>
6088
+ </fo:block>
6089
+ </xsl:otherwise>
6090
+ </xsl:choose>
5025
6091
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
5026
6092
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
5027
6093
  <fo:block id="{@id}">
@@ -5838,7 +6904,7 @@
5838
6904
  </xsl:choose>
5839
6905
  </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'xref']" mode="contents">
5840
6906
  <xsl:value-of select="."/>
5841
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6907
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5842
6908
  <xsl:text> </xsl:text>
5843
6909
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5844
6910
  <xsl:copy>
@@ -5911,7 +6977,7 @@
5911
6977
 
5912
6978
 
5913
6979
 
5914
-
6980
+ <!-- 9 -->
5915
6981
 
5916
6982
 
5917
6983
 
@@ -6011,7 +7077,7 @@
6011
7077
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6012
7078
  <xsl:choose>
6013
7079
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6014
- <xsl:call-template name="interspers">
7080
+ <xsl:call-template name="interspers-java">
6015
7081
  <xsl:with-param name="str" select="."/>
6016
7082
  </xsl:call-template>
6017
7083
  </xsl:when>
@@ -6061,6 +7127,10 @@
6061
7127
  <xsl:with-param name="char" select="$char"/>
6062
7128
  </xsl:call-template>
6063
7129
  </xsl:if>
7130
+ </xsl:template><xsl:template name="interspers-java">
7131
+ <xsl:param name="str"/>
7132
+ <xsl:param name="char" select="$zero_width_space"/>
7133
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
6064
7134
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6065
7135
  <xsl:apply-templates mode="syntax_highlight"/>
6066
7136
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -6273,7 +7343,9 @@
6273
7343
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
6274
7344
  </xsl:if>
6275
7345
  <xsl:variable name="simple-table">
6276
- <xsl:call-template name="getSimpleTable"/>
7346
+ <xsl:call-template name="getSimpleTable">
7347
+ <xsl:with-param name="id" select="@id"/>
7348
+ </xsl:call-template>
6277
7349
  </xsl:variable>
6278
7350
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
6279
7351
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -6705,6 +7777,7 @@
6705
7777
 
6706
7778
 
6707
7779
 
7780
+
6708
7781
  1.5
6709
7782
 
6710
7783
 
@@ -7014,6 +8087,11 @@
7014
8087
  </xsl:otherwise>
7015
8088
  </xsl:choose>
7016
8089
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8090
+
8091
+ <xsl:apply-templates select="*[local-name() = 'name']">
8092
+ <xsl:with-param name="process">true</xsl:with-param>
8093
+ </xsl:apply-templates>
8094
+
7017
8095
  <fo:list-block xsl:use-attribute-sets="list-style">
7018
8096
 
7019
8097
 
@@ -7024,12 +8102,23 @@
7024
8102
 
7025
8103
 
7026
8104
 
8105
+ <xsl:if test="*[local-name() = 'name']">
8106
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8107
+ </xsl:if>
8108
+
7027
8109
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7028
8110
  </fo:list-block>
7029
8111
  <!-- <xsl:for-each select="./iho:note">
7030
8112
  <xsl:call-template name="note"/>
7031
8113
  </xsl:for-each> -->
7032
8114
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8115
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8116
+ <xsl:param name="process">false</xsl:param>
8117
+ <xsl:if test="$process = 'true'">
8118
+ <fo:block xsl:use-attribute-sets="list-name-style">
8119
+ <xsl:apply-templates/>
8120
+ </fo:block>
8121
+ </xsl:if>
7033
8122
  </xsl:template><xsl:template match="*[local-name()='li']">
7034
8123
  <fo:list-item xsl:use-attribute-sets="list-item-style">
7035
8124
  <xsl:copy-of select="@id"/>
@@ -7229,7 +8318,7 @@
7229
8318
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7230
8319
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7231
8320
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7232
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
8321
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
7233
8322
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7234
8323
  <!-- <row>
7235
8324
  <date>05-07-2013</date>
@@ -7307,27 +8396,25 @@
7307
8396
  <fo:block>
7308
8397
  <fo:inline>
7309
8398
 
7310
- <xsl:number format="1."/>
8399
+ <xsl:number format="1." count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
7311
8400
 
7312
8401
  </fo:inline>
7313
8402
  </fo:block>
7314
8403
  </fo:list-item-label>
7315
8404
  <fo:list-item-body start-indent="body-start()">
7316
8405
  <fo:block>
7317
- <xsl:if test="rsd:docidentifier">
8406
+ <xsl:variable name="docidentifier">
7318
8407
  <xsl:choose>
7319
8408
  <xsl:when test="rsd:docidentifier/@type = 'metanorma'"/>
7320
- <xsl:otherwise><fo:inline><xsl:value-of select="rsd:docidentifier[not(@type = 'metanorma-ordinal')]"/>, </fo:inline></xsl:otherwise>
8409
+ <xsl:otherwise>
8410
+ <xsl:value-of select="rsd:docidentifier[not(@type = 'metanorma-ordinal')]"/>
8411
+ </xsl:otherwise>
7321
8412
  </xsl:choose>
8413
+ </xsl:variable>
8414
+ <xsl:value-of select="$docidentifier"/>
8415
+ <xsl:if test="normalize-space($docidentifier) != '' and rsd:formattedref">
8416
+ <xsl:text>, </xsl:text>
7322
8417
  </xsl:if>
7323
- <xsl:choose>
7324
- <xsl:when test="rsd:title[@type = 'main' and @language = 'en']">
7325
- <xsl:apply-templates select="rsd:title[@type = 'main' and @language = 'en']"/>
7326
- </xsl:when>
7327
- <xsl:otherwise>
7328
- <xsl:apply-templates select="rsd:title"/>
7329
- </xsl:otherwise>
7330
- </xsl:choose>
7331
8418
  <xsl:apply-templates select="rsd:formattedref"/>
7332
8419
  </fo:block>
7333
8420
  </fo:list-item-body>
@@ -7338,42 +8425,16 @@
7338
8425
  </xsl:template><xsl:template name="processBibitem">
7339
8426
 
7340
8427
 
8428
+ <!-- start RSD bibitem processing -->
7341
8429
  <xsl:if test=".//rsd:fn">
7342
8430
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
7343
8431
  </xsl:if>
7344
- <xsl:value-of select="rsd:docidentifier"/>
8432
+ <xsl:variable name="docidentifier" select="rsd:docidentifier"/>
8433
+ <xsl:value-of select="$docidentifier"/>
7345
8434
  <xsl:apply-templates select="rsd:note"/>
7346
- <xsl:if test="rsd:docidentifier">, </xsl:if>
7347
- <xsl:choose>
7348
- <xsl:when test="rsd:formattedref">
7349
- <xsl:apply-templates select="rsd:formattedref"/>
7350
- </xsl:when>
7351
- <xsl:otherwise>
7352
- <xsl:for-each select="rsd:contributor[rsd:role/@type='publisher']/rsd:organization/rsd:name">
7353
- <xsl:apply-templates/>
7354
- <xsl:if test="position() != last()">, </xsl:if>
7355
- <xsl:if test="position() = last()">: </xsl:if>
7356
- </xsl:for-each>
7357
- <!-- rsd:docidentifier -->
7358
-
7359
- <xsl:choose>
7360
- <xsl:when test="rsd:title[@type = 'main' and @language = 'en']">
7361
- <fo:inline><xsl:apply-templates select="rsd:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text></fo:inline>
7362
- </xsl:when>
7363
- <xsl:otherwise>
7364
- <fo:inline><xsl:apply-templates select="rsd:title"/><xsl:text>. </xsl:text></fo:inline>
7365
- </xsl:otherwise>
7366
- </xsl:choose>
7367
-
7368
- <xsl:for-each select="rsd:contributor[rsd:role/@type='publisher']/rsd:organization/rsd:name">
7369
- <xsl:apply-templates/>
7370
- <xsl:if test="position() != last()">, </xsl:if>
7371
- </xsl:for-each>
7372
- <xsl:if test="rsd:date[@type='published']/rsd:on">
7373
- <xsl:text> (</xsl:text><xsl:value-of select="rsd:date[@type='published']/rsd:on"/><xsl:text>)</xsl:text>
7374
- </xsl:if>
7375
- </xsl:otherwise>
7376
- </xsl:choose>
8435
+ <xsl:if test="normalize-space($docidentifier) != '' and rsd:formattedref">, </xsl:if>
8436
+ <xsl:apply-templates select="rsd:formattedref"/>
8437
+ <!-- END RSD bibitem processing -->
7377
8438
 
7378
8439
  </xsl:template><xsl:template name="processBibitemDocId">
7379
8440
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
@@ -7682,12 +8743,16 @@
7682
8743
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
7683
8744
 
7684
8745
 
8746
+
8747
+
7685
8748
 
7686
8749
 
7687
8750
 
7688
8751
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
7689
8752
 
7690
8753
 
8754
+
8755
+
7691
8756
  <fo:block xsl:use-attribute-sets="admonition-name-style">
7692
8757
  <xsl:call-template name="displayAdmonitionName"/>
7693
8758
  </fo:block>
@@ -7700,25 +8765,32 @@
7700
8765
  </fo:block-container>
7701
8766
 
7702
8767
  </xsl:template><xsl:template name="displayAdmonitionName">
7703
-
8768
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
8769
+ <!-- <xsl:choose>
8770
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
8771
+ <xsl:choose>
8772
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
8773
+ <xsl:otherwise>
8774
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8775
+ </xsl:otherwise>
8776
+ </xsl:choose>
8777
+ </xsl:when>
8778
+ <xsl:otherwise>
7704
8779
  <xsl:apply-templates select="*[local-name() = 'name']"/>
7705
8780
  <xsl:if test="not(*[local-name() = 'name'])">
7706
8781
  <xsl:apply-templates select="@type"/>
7707
8782
  </xsl:if>
7708
-
7709
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7710
- <xsl:apply-templates/>
7711
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
7712
- <xsl:variable name="admonition_type_">
7713
- <xsl:call-template name="getLocalizedString">
7714
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
7715
- </xsl:call-template>
8783
+ </xsl:otherwise>
8784
+ </xsl:choose> -->
8785
+ <xsl:variable name="name">
8786
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7716
8787
  </xsl:variable>
7717
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
7718
- <xsl:value-of select="$admonition_type"/>
7719
- <xsl:if test="$admonition_type = ''">
7720
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
8788
+ <xsl:copy-of select="$name"/>
8789
+ <xsl:if test="normalize-space($name) != ''">
8790
+ <xsl:value-of select="$sep"/>
7721
8791
  </xsl:if>
8792
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8793
+ <xsl:apply-templates/>
7722
8794
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
7723
8795
 
7724
8796
  <fo:block xsl:use-attribute-sets="admonition-p-style">
@@ -7889,6 +8961,8 @@
7889
8961
  </xsl:when>
7890
8962
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
7891
8963
  </xsl:choose>
8964
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
8965
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
7892
8966
  </xsl:template><xsl:template name="printEdition">
7893
8967
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
7894
8968
  <xsl:text> </xsl:text>
@@ -7995,6 +9069,27 @@
7995
9069
  </xsl:when>
7996
9070
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
7997
9071
  </xsl:choose>
9072
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
9073
+ <xsl:param name="num"/>
9074
+ <xsl:variable name="monthStr">
9075
+ <xsl:choose>
9076
+ <xsl:when test="$num = '01'">january</xsl:when>
9077
+ <xsl:when test="$num = '02'">february</xsl:when>
9078
+ <xsl:when test="$num = '03'">march</xsl:when>
9079
+ <xsl:when test="$num = '04'">april</xsl:when>
9080
+ <xsl:when test="$num = '05'">may</xsl:when>
9081
+ <xsl:when test="$num = '06'">june</xsl:when>
9082
+ <xsl:when test="$num = '07'">july</xsl:when>
9083
+ <xsl:when test="$num = '08'">august</xsl:when>
9084
+ <xsl:when test="$num = '09'">september</xsl:when>
9085
+ <xsl:when test="$num = '10'">october</xsl:when>
9086
+ <xsl:when test="$num = '11'">november</xsl:when>
9087
+ <xsl:when test="$num = '12'">december</xsl:when>
9088
+ </xsl:choose>
9089
+ </xsl:variable>
9090
+ <xsl:call-template name="getLocalizedString">
9091
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
9092
+ </xsl:call-template>
7998
9093
  </xsl:template><xsl:template name="insertKeywords">
7999
9094
  <xsl:param name="sorting" select="'true'"/>
8000
9095
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -8191,6 +9286,7 @@
8191
9286
 
8192
9287
 
8193
9288
 
9289
+
8194
9290
  <xsl:value-of select="document('')//*/namespace::rsd"/>
8195
9291
 
8196
9292
 
@@ -8601,4 +9697,40 @@
8601
9697
  <xsl:value-of select="$value"/>
8602
9698
  </xsl:otherwise>
8603
9699
  </xsl:choose>
9700
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
9701
+ <xsl:param name="level">0</xsl:param>
9702
+
9703
+ <fo:block margin-left="{2*$level}mm">
9704
+ <xsl:text>
9705
+ &lt;</xsl:text>
9706
+ <xsl:value-of select="local-name()"/>
9707
+ <xsl:for-each select="@*">
9708
+ <xsl:text> </xsl:text>
9709
+ <xsl:value-of select="local-name()"/>
9710
+ <xsl:text>="</xsl:text>
9711
+ <xsl:value-of select="."/>
9712
+ <xsl:text>"</xsl:text>
9713
+ </xsl:for-each>
9714
+ <xsl:text>&gt;</xsl:text>
9715
+
9716
+ <xsl:if test="not(*)">
9717
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
9718
+ <xsl:text>&lt;/</xsl:text>
9719
+ <xsl:value-of select="local-name()"/>
9720
+ <xsl:text>&gt;</xsl:text>
9721
+ </xsl:if>
9722
+ </fo:block>
9723
+
9724
+ <xsl:if test="*">
9725
+ <fo:block>
9726
+ <xsl:apply-templates mode="print_as_xml">
9727
+ <xsl:with-param name="level" select="$level + 1"/>
9728
+ </xsl:apply-templates>
9729
+ </fo:block>
9730
+ <fo:block margin-left="{2*$level}mm">
9731
+ <xsl:text>&lt;/</xsl:text>
9732
+ <xsl:value-of select="local-name()"/>
9733
+ <xsl:text>&gt;</xsl:text>
9734
+ </fo:block>
9735
+ </xsl:if>
8604
9736
  </xsl:template></xsl:stylesheet>