metanorma-ogc 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/html/htmlstyle.css +6 -0
  3. data/lib/isodoc/ogc/html/htmlstyle.scss +2 -0
  4. data/lib/isodoc/ogc/html/ogc.css +18 -12
  5. data/lib/isodoc/ogc/html/ogc.scss +16 -9
  6. data/lib/isodoc/ogc/html/ogc_wp.css +18 -12
  7. data/lib/isodoc/ogc/html/ogc_wp.scss +16 -9
  8. data/lib/isodoc/ogc/html/word_ogc_intro.html +2 -3
  9. data/lib/isodoc/ogc/html/word_ogc_intro_wp.html +1 -2
  10. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +17 -17
  11. data/lib/isodoc/ogc/i18n.rb +1 -1
  12. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1355 -329
  13. data/lib/isodoc/ogc/ogc.best-practice.xsl +1355 -329
  14. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1355 -329
  15. data/lib/isodoc/ogc/ogc.community-practice.xsl +1355 -329
  16. data/lib/isodoc/ogc/ogc.community-standard.xsl +1355 -329
  17. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1355 -329
  18. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1355 -329
  19. data/lib/isodoc/ogc/ogc.other.xsl +1355 -329
  20. data/lib/isodoc/ogc/ogc.policy.xsl +1355 -329
  21. data/lib/isodoc/ogc/ogc.reference-model.xsl +1355 -329
  22. data/lib/isodoc/ogc/ogc.release-notes.xsl +1355 -329
  23. data/lib/isodoc/ogc/ogc.standard.xsl +1355 -329
  24. data/lib/isodoc/ogc/ogc.test-suite.xsl +1355 -329
  25. data/lib/isodoc/ogc/ogc.user-guide.xsl +1355 -329
  26. data/lib/isodoc/ogc/ogc.white-paper.xsl +1339 -312
  27. data/lib/isodoc/ogc/presentation_xml_convert.rb +17 -2
  28. data/lib/isodoc/ogc/word_convert.rb +1 -1
  29. data/lib/metanorma/ogc/biblio.rng +134 -39
  30. data/lib/metanorma/ogc/isodoc.rng +16 -0
  31. data/lib/metanorma/ogc/version.rb +1 -1
  32. metadata +3 -3
@@ -221,7 +221,10 @@
221
221
  <xsl:with-param name="letter-spacing" select="0.3"/>
222
222
  </xsl:call-template>
223
223
  </fo:block>
224
- <fo:block font-size="10pt">External identifier of this OGC<fo:inline font-size="58%" baseline-shift="30%">®</fo:inline> document: <fo:inline font-weight="normal"><xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:docidentifier[@type='ogc-external']"/></fo:inline></fo:block>
224
+ <xsl:variable name="ogc_external" select="/ogc:ogc-standard/ogc:bibdata/ogc:docidentifier[@type='ogc-external']"/>
225
+ <xsl:if test="normalize-space($ogc_external) != ''">
226
+ <fo:block font-size="10pt">External identifier of this OGC<fo:inline font-size="58%" baseline-shift="30%">®</fo:inline> document: <fo:inline font-weight="normal"><xsl:value-of select="$ogc_external"/></fo:inline></fo:block>
227
+ </xsl:if>
225
228
  </fo:table-cell>
226
229
  <fo:table-cell text-align="right">
227
230
  <fo:block>
@@ -263,7 +266,7 @@
263
266
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($doctype))"/>
264
267
  </xsl:call-template>
265
268
  <xsl:value-of select="$linebreak"/>
266
- <xsl:variable name="docsubtype" select="normalize-space(/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:docsubtype)"/>
269
+ <xsl:variable name="docsubtype" select="normalize-space(/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:subdoctype)"/>
267
270
  <xsl:variable name="docsubtype_str">
268
271
  <xsl:choose>
269
272
  <xsl:when test="$docsubtype = 'implementation'">Implementation</xsl:when>
@@ -576,7 +579,7 @@
576
579
  <fo:block line-height="125%">
577
580
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
578
581
 
579
- <xsl:for-each select="/*/*[local-name()='preface']/*">
582
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
580
583
  <xsl:sort select="@displayorder" data-type="number"/>
581
584
 
582
585
  <xsl:if test="local-name() = 'foreword' or (local-name() = 'clause' and @type = 'security') or (local-name() = 'clause' and @type = 'submitting_orgs') or local-name() = 'introduction'">
@@ -969,6 +972,7 @@
969
972
 
970
973
  <xsl:template match="ogc:p" name="paragraph">
971
974
  <xsl:param name="inline" select="'false'"/>
975
+ <xsl:param name="split_keep-within-line"/>
972
976
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
973
977
  <xsl:variable name="element-name">
974
978
  <xsl:choose>
@@ -999,7 +1003,9 @@
999
1003
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
1000
1004
  </xsl:if>
1001
1005
 
1002
- <xsl:apply-templates/>
1006
+ <xsl:apply-templates>
1007
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
1008
+ </xsl:apply-templates>
1003
1009
  </xsl:element>
1004
1010
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
1005
1011
  <fo:block margin-bottom="12pt">
@@ -1461,12 +1467,41 @@
1461
1467
  </fo:static-content>
1462
1468
  </xsl:template>
1463
1469
 
1464
- <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">
1470
+ <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_">
1471
+ <xsl:for-each select="$table_widths_from_if//table">
1472
+ <xsl:copy>
1473
+ <xsl:copy-of select="@*"/>
1474
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
1475
+ </xsl:copy>
1476
+ </xsl:for-each>
1477
+ </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_">
1478
+ false
1479
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
1465
1480
  <xsl:call-template name="getLang"/>
1466
- </xsl:variable><xsl:variable name="pageWidth_">
1467
- 215.9
1481
+ </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_">
1482
+ <xsl:choose>
1483
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
1484
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
1485
+ </xsl:choose>
1486
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
1487
+ <xsl:choose>
1488
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
1489
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
1490
+ </xsl:choose>
1491
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
1492
+ <xsl:choose>
1493
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
1494
+ <xsl:otherwise>
1495
+ 215.9
1496
+ </xsl:otherwise>
1497
+ </xsl:choose>
1468
1498
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1469
- 279.4
1499
+ <xsl:choose>
1500
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
1501
+ <xsl:otherwise>
1502
+ 279.4
1503
+ </xsl:otherwise>
1504
+ </xsl:choose>
1470
1505
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1471
1506
  35
1472
1507
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -1580,7 +1615,7 @@
1580
1615
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1581
1616
  </xsl:otherwise>
1582
1617
  </xsl:choose>
1583
- </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">
1618
+ </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">
1584
1619
 
1585
1620
 
1586
1621
 
@@ -1594,7 +1629,9 @@
1594
1629
 
1595
1630
 
1596
1631
 
1597
- <xsl:attribute name="font-family">Lato, STIX Two Math, Source Han Sans</xsl:attribute>
1632
+
1633
+ <xsl:attribute name="font-family">Lato, STIX Two Math, <xsl:value-of select="$font_noto_sans"/></xsl:attribute>
1634
+ <xsl:attribute name="font-family-generic">Sans</xsl:attribute>
1598
1635
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1599
1636
  <xsl:attribute name="color"><xsl:value-of select="$color_main"/></xsl:attribute>
1600
1637
 
@@ -1612,17 +1649,60 @@
1612
1649
  </xsl:variable>
1613
1650
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
1614
1651
 
1652
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
1653
+
1615
1654
  <xsl:for-each select="$root-style_/root-style/@*">
1655
+
1616
1656
  <xsl:choose>
1617
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1657
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
1658
+ <xsl:when test="local-name() = 'font-family'">
1659
+
1660
+ <xsl:variable name="font_regional_prefix">
1661
+ <xsl:choose>
1662
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
1663
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
1664
+ </xsl:choose>
1665
+ </xsl:variable>
1666
+
1618
1667
  <xsl:attribute name="{local-name()}">
1619
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1668
+
1669
+ <xsl:variable name="font_extended">
1670
+ <xsl:choose>
1671
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
1672
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
1673
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
1674
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
1675
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
1676
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
1677
+ </xsl:choose>
1678
+ </xsl:variable>
1679
+ <xsl:if test="normalize-space($font_extended) != ''">
1680
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
1681
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
1682
+ </xsl:if>
1683
+
1684
+ <xsl:value-of select="."/>
1685
+
1686
+ <xsl:if test="$additional_fonts != ''">
1687
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1688
+ </xsl:if>
1620
1689
  </xsl:attribute>
1621
1690
  </xsl:when>
1622
1691
  <xsl:otherwise>
1623
1692
  <xsl:copy-of select="."/>
1624
1693
  </xsl:otherwise>
1625
1694
  </xsl:choose>
1695
+
1696
+ <!-- <xsl:choose>
1697
+ <xsl:when test="local-name() = 'font-family'">
1698
+ <xsl:attribute name="{local-name()}">
1699
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1700
+ </xsl:attribute>
1701
+ </xsl:when>
1702
+ <xsl:otherwise>
1703
+ <xsl:copy-of select="."/>
1704
+ </xsl:otherwise>
1705
+ </xsl:choose> -->
1626
1706
  </xsl:for-each>
1627
1707
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
1628
1708
 
@@ -1719,9 +1799,10 @@
1719
1799
 
1720
1800
 
1721
1801
 
1802
+
1722
1803
 
1723
1804
 
1724
- <xsl:attribute name="font-family">Fira Code</xsl:attribute>
1805
+ <xsl:attribute name="font-family">Fira Code, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1725
1806
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1726
1807
  <xsl:attribute name="line-height">113%</xsl:attribute>
1727
1808
 
@@ -1805,6 +1886,7 @@
1805
1886
 
1806
1887
 
1807
1888
 
1889
+
1808
1890
 
1809
1891
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1810
1892
 
@@ -1814,6 +1896,7 @@
1814
1896
 
1815
1897
 
1816
1898
 
1899
+
1817
1900
 
1818
1901
  <xsl:attribute name="margin-top">10pt</xsl:attribute>
1819
1902
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1841,6 +1924,7 @@
1841
1924
 
1842
1925
 
1843
1926
 
1927
+
1844
1928
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1845
1929
 
1846
1930
 
@@ -1878,6 +1962,7 @@
1878
1962
 
1879
1963
  </xsl:attribute-set><xsl:variable name="table-border_">
1880
1964
 
1965
+
1881
1966
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
1882
1967
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1883
1968
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1897,6 +1982,7 @@
1897
1982
 
1898
1983
 
1899
1984
 
1985
+
1900
1986
  <xsl:attribute name="space-after">12pt</xsl:attribute>
1901
1987
 
1902
1988
 
@@ -1925,6 +2011,7 @@
1925
2011
 
1926
2012
 
1927
2013
 
2014
+
1928
2015
 
1929
2016
 
1930
2017
 
@@ -1937,6 +2024,7 @@
1937
2024
 
1938
2025
 
1939
2026
 
2027
+
1940
2028
 
1941
2029
 
1942
2030
 
@@ -1985,6 +2073,7 @@
1985
2073
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1986
2074
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1987
2075
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2076
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1988
2077
  <xsl:attribute name="display-align">center</xsl:attribute>
1989
2078
 
1990
2079
 
@@ -2005,6 +2094,8 @@
2005
2094
  <xsl:attribute name="display-align">center</xsl:attribute>
2006
2095
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2007
2096
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2097
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2098
+
2008
2099
 
2009
2100
 
2010
2101
 
@@ -2034,7 +2125,7 @@
2034
2125
 
2035
2126
 
2036
2127
 
2037
-
2128
+
2038
2129
 
2039
2130
 
2040
2131
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
@@ -2051,6 +2142,7 @@
2051
2142
 
2052
2143
 
2053
2144
 
2145
+
2054
2146
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
2055
2147
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2056
2148
 
@@ -2059,6 +2151,8 @@
2059
2151
 
2060
2152
 
2061
2153
 
2154
+
2155
+
2062
2156
  </xsl:attribute-set><xsl:attribute-set name="table-fn-number-style">
2063
2157
  <xsl:attribute name="font-size">80%</xsl:attribute>
2064
2158
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2073,6 +2167,7 @@
2073
2167
 
2074
2168
 
2075
2169
 
2170
+
2076
2171
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2077
2172
 
2078
2173
 
@@ -2097,7 +2192,8 @@
2097
2192
  <xsl:attribute name="min-height">8.5mm</xsl:attribute>
2098
2193
 
2099
2194
 
2100
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
2195
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
2196
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
2101
2197
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
2102
2198
 
2103
2199
 
@@ -2108,10 +2204,34 @@
2108
2204
 
2109
2205
 
2110
2206
 
2207
+
2111
2208
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
2112
2209
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2113
2210
 
2114
2211
 
2212
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
2213
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2214
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2215
+
2216
+
2217
+
2218
+
2219
+
2220
+
2221
+
2222
+
2223
+
2224
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2225
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
2226
+
2227
+
2228
+
2229
+
2230
+
2231
+
2232
+
2233
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
2234
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
2115
2235
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2116
2236
 
2117
2237
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2150,6 +2270,7 @@
2150
2270
 
2151
2271
 
2152
2272
 
2273
+
2153
2274
 
2154
2275
 
2155
2276
 
@@ -2223,6 +2344,10 @@
2223
2344
 
2224
2345
 
2225
2346
 
2347
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
2348
+
2349
+ <xsl:attribute name="space-before">4pt</xsl:attribute>
2350
+
2226
2351
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2227
2352
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
2228
2353
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -2274,6 +2399,7 @@
2274
2399
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2275
2400
 
2276
2401
 
2402
+
2277
2403
 
2278
2404
 
2279
2405
  <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
@@ -2321,6 +2447,7 @@
2321
2447
 
2322
2448
 
2323
2449
 
2450
+
2324
2451
  <xsl:attribute name="text-align">left</xsl:attribute>
2325
2452
 
2326
2453
 
@@ -2346,21 +2473,21 @@
2346
2473
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2347
2474
 
2348
2475
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2476
+ <xsl:attribute name="width">100%</xsl:attribute>
2477
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2478
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2349
2479
 
2350
2480
 
2351
- <xsl:attribute name="width">100%</xsl:attribute>
2352
2481
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2353
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2354
2482
 
2355
2483
 
2356
2484
 
2357
-
2358
-
2485
+
2359
2486
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
2360
2487
 
2361
2488
 
2362
2489
 
2363
- <xsl:attribute name="font-family">Fira Code</xsl:attribute>
2490
+ <xsl:attribute name="font-family">Fira Code, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2364
2491
 
2365
2492
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
2366
2493
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -2436,6 +2563,7 @@
2436
2563
 
2437
2564
 
2438
2565
 
2566
+
2439
2567
  <xsl:attribute name="provisional-distance-between-starts">12mm</xsl:attribute>
2440
2568
  <xsl:attribute name="space-after">12pt</xsl:attribute>
2441
2569
  <xsl:attribute name="line-height">115%</xsl:attribute>
@@ -2444,6 +2572,25 @@
2444
2572
 
2445
2573
 
2446
2574
 
2575
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
2576
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2577
+
2578
+
2579
+
2580
+
2581
+
2582
+
2583
+
2584
+
2585
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2586
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
2587
+
2588
+
2589
+
2590
+
2591
+
2592
+
2593
+
2447
2594
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2448
2595
 
2449
2596
 
@@ -2489,6 +2636,7 @@
2489
2636
 
2490
2637
 
2491
2638
 
2639
+
2492
2640
  <xsl:attribute name="font-size">65%</xsl:attribute>
2493
2641
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2494
2642
 
@@ -2514,6 +2662,7 @@
2514
2662
 
2515
2663
 
2516
2664
 
2665
+
2517
2666
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2518
2667
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2519
2668
  <xsl:attribute name="color"><xsl:value-of select="$color_main"/></xsl:attribute>
@@ -2540,6 +2689,7 @@
2540
2689
 
2541
2690
 
2542
2691
 
2692
+
2543
2693
  <xsl:attribute name="font-size">60%</xsl:attribute>
2544
2694
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2545
2695
 
@@ -2558,6 +2708,7 @@
2558
2708
 
2559
2709
 
2560
2710
 
2711
+
2561
2712
  <xsl:attribute name="border">0.5pt solid rgb(79, 129, 189)</xsl:attribute>
2562
2713
  <xsl:attribute name="color">rgb(79, 129, 189)</xsl:attribute>
2563
2714
  <xsl:attribute name="margin-left">16mm</xsl:attribute>
@@ -2568,6 +2719,9 @@
2568
2719
 
2569
2720
 
2570
2721
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
2722
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2723
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2724
+
2571
2725
 
2572
2726
 
2573
2727
 
@@ -2575,8 +2729,6 @@
2575
2729
 
2576
2730
 
2577
2731
 
2578
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2579
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2580
2732
  <xsl:attribute name="padding">2mm</xsl:attribute>
2581
2733
  <xsl:attribute name="padding-top">3mm</xsl:attribute>
2582
2734
 
@@ -2613,6 +2765,7 @@
2613
2765
 
2614
2766
 
2615
2767
 
2768
+
2616
2769
  <xsl:attribute name="font-style">italic</xsl:attribute>
2617
2770
 
2618
2771
 
@@ -2654,6 +2807,7 @@
2654
2807
 
2655
2808
 
2656
2809
 
2810
+
2657
2811
 
2658
2812
  <xsl:attribute name="provisional-distance-between-starts">13mm</xsl:attribute>
2659
2813
 
@@ -2676,6 +2830,7 @@
2676
2830
 
2677
2831
 
2678
2832
 
2833
+
2679
2834
 
2680
2835
  <xsl:attribute name="provisional-distance-between-starts">13mm</xsl:attribute>
2681
2836
 
@@ -2705,6 +2860,7 @@
2705
2860
 
2706
2861
 
2707
2862
 
2863
+
2708
2864
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2709
2865
 
2710
2866
 
@@ -2725,6 +2881,7 @@
2725
2881
 
2726
2882
 
2727
2883
 
2884
+
2728
2885
  <xsl:attribute name="font-size">60%</xsl:attribute>
2729
2886
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2730
2887
 
@@ -2745,6 +2902,7 @@
2745
2902
 
2746
2903
 
2747
2904
 
2905
+
2748
2906
  </xsl:attribute-set><xsl:attribute-set name="references-non-normative-style">
2749
2907
 
2750
2908
 
@@ -2858,13 +3016,13 @@
2858
3016
 
2859
3017
  </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">
2860
3018
  <xsl:variable name="nodes_preface_">
2861
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3019
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2862
3020
  <node id="{@id}"/>
2863
3021
  </xsl:for-each>
2864
3022
  </xsl:variable>
2865
3023
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2866
3024
 
2867
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3025
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2868
3026
  <xsl:sort select="@displayorder" data-type="number"/>
2869
3027
 
2870
3028
  <!-- process Section's title -->
@@ -2930,7 +3088,7 @@
2930
3088
  </xsl:for-each>
2931
3089
  </figures>
2932
3090
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2933
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3091
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2934
3092
  <xsl:sort select="@displayorder" data-type="number"/>
2935
3093
  <xsl:apply-templates select="."/>
2936
3094
  </xsl:for-each>
@@ -2984,7 +3142,38 @@
2984
3142
  </xsl:template><xsl:template match="*[local-name()='br']">
2985
3143
  <xsl:value-of select="$linebreak"/>
2986
3144
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2987
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3145
+ <xsl:param name="split_keep-within-line"/>
3146
+
3147
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
3148
+ <xsl:choose>
3149
+
3150
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
3151
+ <xsl:variable name="sep">_</xsl:variable>
3152
+ <xsl:variable name="items">
3153
+ <xsl:call-template name="split">
3154
+ <xsl:with-param name="pText" select="."/>
3155
+ <xsl:with-param name="sep" select="$sep"/>
3156
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
3157
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
3158
+ </xsl:call-template>
3159
+ </xsl:variable>
3160
+ <xsl:for-each select="xalan:nodeset($items)/item">
3161
+ <xsl:choose>
3162
+ <xsl:when test=". = $sep">
3163
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
3164
+ </xsl:when>
3165
+ <xsl:otherwise>
3166
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3167
+ </xsl:otherwise>
3168
+ </xsl:choose>
3169
+ </xsl:for-each>
3170
+ </xsl:when>
3171
+
3172
+ <xsl:otherwise>
3173
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3174
+ </xsl:otherwise>
3175
+
3176
+ </xsl:choose>
2988
3177
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2989
3178
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2990
3179
  <xsl:apply-templates/>
@@ -3098,9 +3287,14 @@
3098
3287
 
3099
3288
  <xsl:variable name="table">
3100
3289
 
3101
- <xsl:variable name="simple-table">
3102
- <xsl:call-template name="getSimpleTable"/>
3290
+ <xsl:variable name="simple-table">
3291
+ <xsl:call-template name="getSimpleTable">
3292
+ <xsl:with-param name="id" select="@id"/>
3293
+ </xsl:call-template>
3103
3294
  </xsl:variable>
3295
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
3296
+
3297
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
3104
3298
 
3105
3299
 
3106
3300
  <!-- Display table's name before table as standalone block -->
@@ -3123,7 +3317,23 @@
3123
3317
  </xsl:call-template>
3124
3318
  </xsl:if>
3125
3319
  </xsl:variable>
3126
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3320
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
3321
+
3322
+ <!-- DEBUG -->
3323
+ <xsl:if test="$table_if_debug = 'true'">
3324
+ <fo:block font-size="60%">
3325
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3326
+ </fo:block>
3327
+ </xsl:if>
3328
+
3329
+
3330
+ <!-- <xsl:copy-of select="$colwidths"/> -->
3331
+
3332
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3333
+ DEBUG
3334
+ colwidths=<xsl:copy-of select="$colwidths"/>
3335
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3336
+
3127
3337
 
3128
3338
 
3129
3339
  <xsl:variable name="margin-side">
@@ -3145,6 +3355,8 @@
3145
3355
 
3146
3356
 
3147
3357
 
3358
+
3359
+
3148
3360
 
3149
3361
 
3150
3362
 
@@ -3190,12 +3402,22 @@
3190
3402
 
3191
3403
 
3192
3404
 
3405
+
3406
+
3193
3407
  </xsl:element>
3194
3408
  </xsl:variable>
3195
3409
 
3410
+ <xsl:if test="$isGenerateTableIF = 'true'">
3411
+ <!-- to determine start of table -->
3412
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3413
+ </xsl:if>
3196
3414
 
3197
3415
  <fo:table id="{@id}">
3198
3416
 
3417
+ <xsl:if test="$isGenerateTableIF = 'true'">
3418
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3419
+ </xsl:if>
3420
+
3199
3421
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
3200
3422
  <xsl:attribute name="{local-name()}">
3201
3423
  <xsl:value-of select="."/>
@@ -3209,24 +3431,47 @@
3209
3431
 
3210
3432
 
3211
3433
  <xsl:choose>
3212
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3213
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3214
- <fo:table-column column-width="{@width}"/>
3215
- </xsl:for-each>
3434
+ <xsl:when test="$isGenerateTableIF = 'true'">
3435
+ <!-- generate IF for table widths -->
3436
+ <!-- example:
3437
+ <tr>
3438
+ <td valign="top" align="left" id="tab-symdu_1_1">
3439
+ <p>Symbol</p>
3440
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3441
+ </td>
3442
+ <td valign="top" align="left" id="tab-symdu_1_2">
3443
+ <p>Description</p>
3444
+ <word id="tab-symdu_1_2_word_1">Description</word>
3445
+ </td>
3446
+ </tr>
3447
+ -->
3448
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
3449
+
3216
3450
  </xsl:when>
3217
3451
  <xsl:otherwise>
3218
- <xsl:call-template name="insertTableColumnWidth">
3219
- <xsl:with-param name="colwidths" select="$colwidths"/>
3220
- </xsl:call-template>
3221
- </xsl:otherwise>
3222
- </xsl:choose>
3223
3452
 
3224
- <xsl:choose>
3225
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3226
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3227
- </xsl:when>
3228
- <xsl:otherwise>
3229
- <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 -->
3453
+ <xsl:choose>
3454
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3455
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3456
+ <fo:table-column column-width="{@width}"/>
3457
+ </xsl:for-each>
3458
+ </xsl:when>
3459
+ <xsl:otherwise>
3460
+ <xsl:call-template name="insertTableColumnWidth">
3461
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3462
+ </xsl:call-template>
3463
+ </xsl:otherwise>
3464
+ </xsl:choose>
3465
+
3466
+ <xsl:choose>
3467
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3468
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3469
+ </xsl:when>
3470
+ <xsl:otherwise>
3471
+ <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 -->
3472
+ </xsl:otherwise>
3473
+ </xsl:choose>
3474
+
3230
3475
  </xsl:otherwise>
3231
3476
  </xsl:choose>
3232
3477
 
@@ -3301,23 +3546,29 @@
3301
3546
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3302
3547
  <xsl:param name="continued"/>
3303
3548
  <xsl:if test="normalize-space() != ''">
3304
- <fo:block xsl:use-attribute-sets="table-name-style">
3305
-
3306
-
3307
-
3308
-
3549
+
3550
+
3309
3551
 
3310
- <xsl:choose>
3311
- <xsl:when test="$continued = 'true'">
3552
+ <fo:block xsl:use-attribute-sets="table-name-style">
3553
+
3312
3554
 
3313
- </xsl:when>
3314
- <xsl:otherwise>
3315
- <xsl:apply-templates/>
3316
- </xsl:otherwise>
3317
- </xsl:choose>
3318
-
3555
+
3556
+
3557
+
3558
+ <xsl:choose>
3559
+ <xsl:when test="$continued = 'true'">
3560
+
3561
+ </xsl:when>
3562
+ <xsl:otherwise>
3563
+ <xsl:apply-templates/>
3564
+ </xsl:otherwise>
3565
+ </xsl:choose>
3566
+
3567
+
3568
+ </fo:block>
3569
+
3319
3570
 
3320
- </fo:block>
3571
+
3321
3572
  </xsl:if>
3322
3573
  </xsl:template><xsl:template name="calculate-columns-numbers">
3323
3574
  <xsl:param name="table-row"/>
@@ -3326,11 +3577,22 @@
3326
3577
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3327
3578
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3328
3579
  </xsl:template><xsl:template name="calculate-column-widths">
3580
+ <xsl:param name="table"/>
3581
+ <xsl:param name="cols-count"/>
3582
+
3583
+ <xsl:call-template name="calculate-column-widths-proportional">
3584
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3585
+ <xsl:with-param name="table" select="$table"/>
3586
+ </xsl:call-template>
3587
+
3588
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
3329
3589
  <xsl:param name="table"/>
3330
3590
  <xsl:param name="cols-count"/>
3331
3591
  <xsl:param name="curr-col" select="1"/>
3332
3592
  <xsl:param name="width" select="0"/>
3333
3593
 
3594
+ <!-- table=<xsl:copy-of select="$table"/> -->
3595
+
3334
3596
  <xsl:if test="$curr-col &lt;= $cols-count">
3335
3597
  <xsl:variable name="widths">
3336
3598
  <xsl:choose>
@@ -3368,10 +3630,15 @@
3368
3630
  </xsl:for-each>
3369
3631
  </xsl:when>
3370
3632
  <xsl:otherwise>
3371
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
3633
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
3634
+
3635
+ <!-- <table><xsl:copy-of select="$table"/></table>
3636
+ -->
3637
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
3372
3638
  <xsl:variable name="td_text">
3373
3639
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3374
3640
  </xsl:variable>
3641
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
3375
3642
  <xsl:variable name="words">
3376
3643
  <xsl:variable name="string_with_added_zerospaces">
3377
3644
  <xsl:call-template name="add-zero-spaces-java">
@@ -3386,6 +3653,7 @@
3386
3653
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3387
3654
  </xsl:call-template>
3388
3655
  </xsl:variable>
3656
+ <!-- words=<xsl:copy-of select="$words"/> -->
3389
3657
  <xsl:variable name="max_length">
3390
3658
  <xsl:call-template name="max_length">
3391
3659
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -3410,6 +3678,8 @@
3410
3678
  </xsl:choose>
3411
3679
  </xsl:variable>
3412
3680
 
3681
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
3682
+
3413
3683
  <column>
3414
3684
  <xsl:for-each select="xalan:nodeset($widths)//width">
3415
3685
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3418,50 +3688,294 @@
3418
3688
  </xsl:if>
3419
3689
  </xsl:for-each>
3420
3690
  </column>
3421
- <xsl:call-template name="calculate-column-widths">
3691
+ <xsl:call-template name="calculate-column-widths-proportional">
3422
3692
  <xsl:with-param name="cols-count" select="$cols-count"/>
3423
3693
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
3424
3694
  <xsl:with-param name="table" select="$table"/>
3425
3695
  </xsl:call-template>
3426
3696
  </xsl:if>
3427
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
3697
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
3428
3698
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
3429
3699
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
3430
3700
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
3701
+
3702
+ <!-- if all capitals english letters or digits -->
3703
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
3704
+ <xsl:call-template name="repeat">
3705
+ <xsl:with-param name="char" select="'X'"/>
3706
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
3707
+ </xsl:call-template>
3708
+ </xsl:if>
3431
3709
  </xsl:template><xsl:template match="text()" mode="td_text">
3432
3710
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3433
3711
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3434
3712
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3435
3713
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3436
3714
  <xsl:value-of select="@target"/>
3437
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3438
- <xsl:variable name="mathml">
3439
- <xsl:for-each select="*">
3440
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3441
- <xsl:copy-of select="."/>
3442
- </xsl:if>
3715
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
3716
+ <xsl:if test="$isGenerateTableIF = 'false'">
3717
+ <xsl:variable name="mathml_">
3718
+ <xsl:for-each select="*">
3719
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3720
+ <xsl:copy-of select="."/>
3721
+ </xsl:if>
3722
+ </xsl:for-each>
3723
+ </xsl:variable>
3724
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
3725
+
3726
+ <xsl:variable name="math_text">
3727
+ <xsl:value-of select="normalize-space($mathml)"/>
3728
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
3729
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
3730
+ </xsl:variable>
3731
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3732
+ </xsl:if>
3733
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
3734
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
3735
+
3736
+ <!-- via intermediate format -->
3737
+
3738
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
3739
+
3740
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
3741
+
3742
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
3743
+
3744
+ <!-- get current table id -->
3745
+ <xsl:variable name="table_id" select="@id"/>
3746
+ <!-- find table by id in the file 'table_widths' -->
3747
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
3748
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
3749
+
3750
+ <!-- table='<xsl:copy-of select="$table"/>' -->
3751
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
3752
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
3753
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
3754
+
3755
+ <xsl:variable name="table_with_cell_widths_">
3756
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
3757
+ </xsl:variable>
3758
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
3759
+
3760
+ <!-- <xsl:if test="$table_if_debug = 'true'">
3761
+ <xsl:copy-of select="$table_with_cell_widths"/>
3762
+ </xsl:if> -->
3763
+
3764
+
3765
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
3766
+
3767
+ <xsl:variable name="column_widths_">
3768
+ <!-- iteration of columns -->
3769
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
3770
+ <xsl:variable name="pos" select="position()"/>
3771
+ <column>
3772
+ <xsl:attribute name="width_max">
3773
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
3774
+ <xsl:sort select="." data-type="number" order="descending"/>
3775
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3776
+ </xsl:for-each>
3777
+ </xsl:attribute>
3778
+ <xsl:attribute name="width_min">
3779
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
3780
+ <xsl:sort select="." data-type="number" order="descending"/>
3781
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3782
+ </xsl:for-each>
3783
+ </xsl:attribute>
3784
+ </column>
3443
3785
  </xsl:for-each>
3444
3786
  </xsl:variable>
3787
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
3445
3788
 
3446
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3447
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3448
- </xsl:template><xsl:template match="*[local-name()='thead']">
3449
- <xsl:param name="cols-count"/>
3450
- <fo:table-header>
3451
-
3452
-
3453
- <xsl:apply-templates/>
3454
- </fo:table-header>
3455
- </xsl:template><xsl:template name="table-header-title">
3456
- <xsl:param name="cols-count"/>
3457
- <!-- row for title -->
3458
- <fo:table-row>
3459
- <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">
3460
-
3461
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3462
- <xsl:with-param name="continued">true</xsl:with-param>
3463
- </xsl:apply-templates>
3789
+ <!-- <column_widths>
3790
+ <xsl:copy-of select="$column_widths"/>
3791
+ </column_widths> -->
3792
+
3793
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
3794
+ <xsl:variable name="table_widths_">
3795
+ <table>
3796
+ <xsl:attribute name="width_max">
3797
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
3798
+ </xsl:attribute>
3799
+ <xsl:attribute name="width_min">
3800
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
3801
+ </xsl:attribute>
3802
+ </table>
3803
+ </xsl:variable>
3804
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
3805
+
3806
+ <xsl:variable name="page_width">
3807
+ <xsl:choose>
3808
+ <xsl:when test="$parent_table_page-width != ''">
3809
+ <xsl:value-of select="$parent_table_page-width"/>
3810
+ </xsl:when>
3811
+ <xsl:otherwise>
3812
+ <xsl:value-of select="@page-width"/>
3813
+ </xsl:otherwise>
3814
+ </xsl:choose>
3815
+ </xsl:variable>
3816
+
3817
+ <xsl:if test="$table_if_debug = 'true'">
3818
+ <table_width>
3819
+ <xsl:copy-of select="$table_widths"/>
3820
+ </table_width>
3821
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
3822
+ </xsl:if>
3823
+
3824
+
3825
+ <!-- There are three cases: -->
3826
+ <xsl:choose>
3827
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
3828
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
3829
+ <!-- call old algorithm -->
3830
+ <case1/>
3831
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
3832
+ <xsl:call-template name="calculate-column-widths-proportional">
3833
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3834
+ <xsl:with-param name="table" select="$table"/>
3835
+ </xsl:call-template> -->
3836
+ </xsl:when>
3837
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
3838
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
3839
+ <case2/>
3840
+ <autolayout/>
3841
+ <xsl:for-each select="$column_widths/column/@width_max">
3842
+ <column divider="100"><xsl:value-of select="."/></column>
3843
+ </xsl:for-each>
3844
+ </xsl:when>
3845
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
3846
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
3847
+ Lets also call D the difference between maximum and minimum width of the table.
3848
+ For each column, let d be the difference between maximum and minimum width of that column.
3849
+ Now set the column's width to the minimum width plus d times W over D.
3850
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3851
+ <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)">
3852
+ <!-- difference between the available space and the minimum table width -->
3853
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
3854
+ <W><xsl:value-of select="$W"/></W>
3855
+ <!-- difference between maximum and minimum width of the table -->
3856
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
3857
+ <D><xsl:value-of select="$D"/></D>
3858
+ <case3/>
3859
+ <autolayout/>
3860
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
3861
+ <split_keep-within-line>true</split_keep-within-line>
3862
+ </xsl:if>
3863
+ <xsl:for-each select="$column_widths/column">
3864
+ <!-- difference between maximum and minimum width of that column. -->
3865
+ <xsl:variable name="d" select="@width_max - @width_min"/>
3866
+ <d><xsl:value-of select="$d"/></d>
3867
+ <width_min><xsl:value-of select="@width_min"/></width_min>
3868
+ <e><xsl:value-of select="$d * $W div $D"/></e>
3869
+ <!-- set the column's width to the minimum width plus d times W over D. -->
3870
+ <column divider="100">
3871
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3872
+ </column>
3873
+ </xsl:for-each>
3874
+
3875
+ </xsl:when>
3876
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
3877
+ </xsl:choose>
3878
+
3879
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
3880
+
3881
+ <!-- if nested 'dl' or 'table' -->
3882
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
3883
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
3884
+
3885
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
3886
+
3887
+ <xsl:variable name="parent_table_page-width_">
3888
+ <xsl:if test="$parent_table_id != ''">
3889
+ <!-- determine column number in the parent table -->
3890
+ <xsl:variable name="parent_table_column_number">
3891
+ <xsl:choose>
3892
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
3893
+ <xsl:otherwise> <!-- parent is table -->
3894
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
3895
+ </xsl:otherwise>
3896
+ </xsl:choose>
3897
+ </xsl:variable>
3898
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
3899
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3900
+ </xsl:if>
3901
+ </xsl:variable>
3902
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
3903
+
3904
+ <!-- get current table id -->
3905
+ <xsl:variable name="table_id" select="@id"/>
3906
+
3907
+ <xsl:choose>
3908
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
3909
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
3910
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
3911
+ </xsl:when>
3912
+ <xsl:otherwise>
3913
+ <!-- recalculate columns width based on parent table width -->
3914
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
3915
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
3916
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
3917
+ </xsl:call-template>
3918
+ </xsl:for-each>
3919
+ </xsl:otherwise>
3920
+ </xsl:choose>
3921
+
3922
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3923
+ <xsl:copy>
3924
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3925
+ </xsl:copy>
3926
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
3927
+ <xsl:copy>
3928
+ <xsl:copy-of select="@*"/>
3929
+
3930
+ <!-- The maximum width is given by the widest line. -->
3931
+ <xsl:attribute name="width_max">
3932
+ <xsl:for-each select="p_len">
3933
+ <xsl:sort select="." data-type="number" order="descending"/>
3934
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3935
+ </xsl:for-each>
3936
+ </xsl:attribute>
3937
+
3938
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3939
+ <xsl:variable name="width_min">
3940
+ <xsl:for-each select="word_len">
3941
+ <xsl:sort select="." data-type="number" order="descending"/>
3942
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3943
+ </xsl:for-each>
3944
+ </xsl:variable>
3945
+ <xsl:attribute name="width_min">
3946
+ <xsl:value-of select="$width_min"/>
3947
+ </xsl:attribute>
3948
+
3949
+ <xsl:if test="$width_min = 0">
3950
+ <xsl:attribute name="width_min">1</xsl:attribute>
3951
+ </xsl:if>
3952
+
3953
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3954
+
3955
+ </xsl:copy>
3956
+ </xsl:template><xsl:template match="*[local-name()='thead']">
3957
+ <xsl:param name="cols-count"/>
3958
+ <fo:table-header>
3959
+
3960
+
3961
+ <xsl:apply-templates/>
3962
+ </fo:table-header>
3963
+ </xsl:template><xsl:template name="table-header-title">
3964
+ <xsl:param name="cols-count"/>
3965
+ <!-- row for title -->
3966
+ <fo:table-row>
3967
+ <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">
3968
+
3969
+
3970
+
3971
+
3972
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3973
+ <xsl:with-param name="continued">true</xsl:with-param>
3974
+ </xsl:apply-templates>
3975
+
3976
+
3464
3977
 
3978
+
3465
3979
 
3466
3980
 
3467
3981
  </fo:table-cell>
@@ -3529,6 +4043,7 @@
3529
4043
  </xsl:for-each>
3530
4044
  </xsl:when>
3531
4045
  <xsl:otherwise>
4046
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
3532
4047
  <xsl:call-template name="insertTableColumnWidth">
3533
4048
  <xsl:with-param name="colwidths" select="$colwidths"/>
3534
4049
  </xsl:call-template>
@@ -3563,7 +4078,10 @@
3563
4078
 
3564
4079
 
3565
4080
  <!-- fn processing -->
3566
- <xsl:call-template name="table_fn_display"/>
4081
+
4082
+ <xsl:call-template name="table_fn_display"/>
4083
+
4084
+
3567
4085
 
3568
4086
  <!-- for PAS display Notes after footnotes -->
3569
4087
 
@@ -3573,6 +4091,9 @@
3573
4091
  </fo:table-body>
3574
4092
 
3575
4093
  </fo:table>
4094
+
4095
+
4096
+
3576
4097
  </xsl:if>
3577
4098
  </xsl:template><xsl:template match="*[local-name()='tbody']">
3578
4099
 
@@ -3608,6 +4129,52 @@
3608
4129
 
3609
4130
  </fo:table-body>
3610
4131
 
4132
+ </xsl:template><xsl:template match="/" mode="process_table-if">
4133
+ <xsl:param name="table_or_dl">table</xsl:param>
4134
+ <xsl:apply-templates mode="process_table-if">
4135
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
4136
+ </xsl:apply-templates>
4137
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
4138
+ <xsl:param name="table_or_dl">table</xsl:param>
4139
+
4140
+ <fo:table-body>
4141
+ <xsl:for-each select="*[local-name() = 'tr']">
4142
+ <xsl:variable name="col_count" select="count(*)"/>
4143
+
4144
+ <!-- iteration for each tr/td -->
4145
+
4146
+ <xsl:choose>
4147
+ <xsl:when test="$table_or_dl = 'table'">
4148
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
4149
+ <fo:table-row number-columns-spanned="{$col_count}">
4150
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
4151
+ <xsl:call-template name="td"/>
4152
+ </fo:table-row>
4153
+ </xsl:for-each>
4154
+ </xsl:when>
4155
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
4156
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
4157
+ <xsl:variable name="is_dt" select="position() = 1"/>
4158
+
4159
+ <xsl:for-each select="*">
4160
+ <!-- <test><xsl:copy-of select="."/></test> -->
4161
+ <fo:table-row number-columns-spanned="{$col_count}">
4162
+ <xsl:choose>
4163
+ <xsl:when test="$is_dt">
4164
+ <xsl:call-template name="insert_dt_cell"/>
4165
+ </xsl:when>
4166
+ <xsl:otherwise>
4167
+ <xsl:call-template name="insert_dd_cell"/>
4168
+ </xsl:otherwise>
4169
+ </xsl:choose>
4170
+ </fo:table-row>
4171
+ </xsl:for-each>
4172
+ </xsl:for-each>
4173
+ </xsl:otherwise>
4174
+ </xsl:choose>
4175
+
4176
+ </xsl:for-each>
4177
+ </fo:table-body>
3611
4178
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3612
4179
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3613
4180
 
@@ -3615,6 +4182,9 @@
3615
4182
 
3616
4183
 
3617
4184
 
4185
+
4186
+
4187
+
3618
4188
 
3619
4189
 
3620
4190
  <xsl:call-template name="setTableRowAttributes"/>
@@ -3631,6 +4201,8 @@
3631
4201
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3632
4202
 
3633
4203
 
4204
+
4205
+
3634
4206
  <xsl:variable name="number"><xsl:number/></xsl:variable>
3635
4207
  <xsl:if test="$number mod 2 = 0">
3636
4208
  <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
@@ -3699,7 +4271,7 @@
3699
4271
  </xsl:choose>
3700
4272
  </xsl:attribute>
3701
4273
  </xsl:if>
3702
- </xsl:template><xsl:template match="*[local-name()='td']">
4274
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
3703
4275
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
3704
4276
  <xsl:call-template name="setTextAlignment">
3705
4277
  <xsl:with-param name="default">left</xsl:with-param>
@@ -3720,6 +4292,8 @@
3720
4292
 
3721
4293
 
3722
4294
 
4295
+
4296
+
3723
4297
 
3724
4298
 
3725
4299
 
@@ -3733,11 +4307,24 @@
3733
4307
 
3734
4308
  <xsl:call-template name="setTableCellAttributes"/>
3735
4309
 
4310
+ <xsl:if test="$isGenerateTableIF = 'true'">
4311
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4312
+ <xsl:attribute name="text-align">left</xsl:attribute>
4313
+ </xsl:if>
4314
+
3736
4315
  <fo:block>
3737
4316
 
4317
+ <xsl:if test="$isGenerateTableIF = 'true'">
4318
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4319
+ </xsl:if>
4320
+
4321
+
3738
4322
 
3739
4323
 
3740
4324
  <xsl:apply-templates/>
4325
+
4326
+ <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"/> -->
4327
+
3741
4328
  </fo:block>
3742
4329
  </fo:table-cell>
3743
4330
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -3778,7 +4365,11 @@
3778
4365
 
3779
4366
  <xsl:variable name="gen_id" select="generate-id(.)"/>
3780
4367
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3781
- <xsl:variable name="reference" select="@reference"/>
4368
+ <xsl:variable name="reference_">
4369
+ <xsl:value-of select="@reference"/>
4370
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4371
+ </xsl:variable>
4372
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
3782
4373
  <!-- fn sequence number in document -->
3783
4374
  <xsl:variable name="current_fn_number">
3784
4375
  <xsl:choose>
@@ -3853,7 +4444,7 @@
3853
4444
  <xsl:copy-of select="node()"/>
3854
4445
  </fn>
3855
4446
  </xsl:for-each>
3856
- <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']/*">
4447
+ <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']/*">
3857
4448
  <xsl:sort select="@displayorder" data-type="number"/>
3858
4449
  <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])]">
3859
4450
  <!-- copy unique fn -->
@@ -3940,9 +4531,9 @@
3940
4531
  <!-- current hierarchy is 'figure' element -->
3941
4532
  <xsl:variable name="following_dl_colwidths">
3942
4533
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3943
- <xsl:variable name="html-table">
3944
- <xsl:variable name="doc_ns">
3945
-
4534
+ <xsl:variable name="simple-table">
4535
+ <!-- <xsl:variable name="doc_ns">
4536
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3946
4537
  </xsl:variable>
3947
4538
  <xsl:variable name="ns">
3948
4539
  <xsl:choose>
@@ -3953,7 +4544,7 @@
3953
4544
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3954
4545
  </xsl:otherwise>
3955
4546
  </xsl:choose>
3956
- </xsl:variable>
4547
+ </xsl:variable> -->
3957
4548
 
3958
4549
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3959
4550
  <tbody>
@@ -3964,7 +4555,7 @@
3964
4555
 
3965
4556
  <xsl:call-template name="calculate-column-widths">
3966
4557
  <xsl:with-param name="cols-count" select="2"/>
3967
- <xsl:with-param name="table" select="$html-table"/>
4558
+ <xsl:with-param name="table" select="$simple-table"/>
3968
4559
  </xsl:call-template>
3969
4560
 
3970
4561
  </xsl:if>
@@ -4144,12 +4735,31 @@
4144
4735
 
4145
4736
 
4146
4737
 
4738
+
4739
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
4740
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4741
+ </xsl:if>
4742
+
4147
4743
  <fo:block>
4148
4744
 
4149
4745
 
4150
4746
 
4151
4747
 
4748
+ <xsl:apply-templates select="*[local-name() = 'name']">
4749
+ <xsl:with-param name="process">true</xsl:with-param>
4750
+ </xsl:apply-templates>
4751
+
4752
+ <xsl:if test="$isGenerateTableIF = 'true'">
4753
+ <!-- to determine start of table -->
4754
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
4755
+ </xsl:if>
4756
+
4152
4757
  <fo:table width="95%" table-layout="fixed">
4758
+
4759
+ <xsl:if test="$isGenerateTableIF = 'true'">
4760
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
4761
+ </xsl:if>
4762
+
4153
4763
 
4154
4764
  <xsl:choose>
4155
4765
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -4158,69 +4768,173 @@
4158
4768
 
4159
4769
  </xsl:when>
4160
4770
  </xsl:choose>
4161
- <!-- create virtual html table for dl/[dt and dd] -->
4162
- <xsl:variable name="html-table">
4163
- <xsl:variable name="doc_ns">
4771
+
4772
+
4773
+
4774
+ <xsl:choose>
4775
+ <xsl:when test="$isGenerateTableIF = 'true'">
4776
+ <!-- generate IF for table widths -->
4777
+ <!-- example:
4778
+ <tr>
4779
+ <td valign="top" align="left" id="tab-symdu_1_1">
4780
+ <p>Symbol</p>
4781
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
4782
+ </td>
4783
+ <td valign="top" align="left" id="tab-symdu_1_2">
4784
+ <p>Description</p>
4785
+ <word id="tab-symdu_1_2_word_1">Description</word>
4786
+ </td>
4787
+ </tr>
4788
+ -->
4164
4789
 
4165
- </xsl:variable>
4166
- <xsl:variable name="ns">
4167
- <xsl:choose>
4168
- <xsl:when test="normalize-space($doc_ns) != ''">
4169
- <xsl:value-of select="normalize-space($doc_ns)"/>
4170
- </xsl:when>
4171
- <xsl:otherwise>
4172
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4173
- </xsl:otherwise>
4174
- </xsl:choose>
4175
- </xsl:variable>
4176
- <tbody>
4177
- <xsl:apply-templates mode="dl"/>
4178
- </tbody>
4179
- </xsl:variable>
4180
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
4181
- <xsl:variable name="colwidths">
4182
- <xsl:call-template name="calculate-column-widths">
4183
- <xsl:with-param name="cols-count" select="2"/>
4184
- <xsl:with-param name="table" select="$html-table"/>
4185
- </xsl:call-template>
4186
- </xsl:variable>
4187
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
4188
- <xsl:variable name="maxlength_dt">
4189
- <xsl:call-template name="getMaxLength_dt"/>
4190
- </xsl:variable>
4191
- <xsl:variable name="isContainsKeepTogetherTag_">
4192
- false
4193
- </xsl:variable>
4194
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4195
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4196
- <xsl:call-template name="setColumnWidth_dl">
4197
- <xsl:with-param name="colwidths" select="$colwidths"/>
4198
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4199
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4200
- </xsl:call-template>
4790
+ <!-- create virtual html table for dl/[dt and dd] -->
4791
+ <xsl:variable name="simple-table">
4792
+
4793
+ <xsl:variable name="dl_table">
4794
+ <tbody>
4795
+ <xsl:apply-templates mode="dl_if">
4796
+ <xsl:with-param name="id" select="@id"/>
4797
+ </xsl:apply-templates>
4798
+ </tbody>
4799
+ </xsl:variable>
4800
+
4801
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
4802
+
4803
+ <!-- Step: replace <br/> to <p>...</p> -->
4804
+ <xsl:variable name="table_without_br">
4805
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
4806
+ </xsl:variable>
4807
+
4808
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
4809
+
4810
+ <!-- Step: add id to each cell -->
4811
+ <!-- add <word>...</word> for each word, image, math -->
4812
+ <xsl:variable name="simple-table-id">
4813
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
4814
+ <xsl:with-param name="id" select="@id"/>
4815
+ </xsl:apply-templates>
4816
+ </xsl:variable>
4817
+
4818
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
4819
+
4820
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4821
+
4822
+ </xsl:variable>
4823
+
4824
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
4825
+
4826
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
4827
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
4828
+ </xsl:apply-templates>
4829
+
4830
+ </xsl:when>
4831
+ <xsl:otherwise>
4201
4832
 
4202
- <fo:table-body>
4203
- <xsl:apply-templates>
4204
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
4205
- </xsl:apply-templates>
4206
- </fo:table-body>
4833
+ <xsl:variable name="simple-table">
4834
+
4835
+ <xsl:variable name="dl_table">
4836
+ <tbody>
4837
+ <xsl:apply-templates mode="dl">
4838
+ <xsl:with-param name="id" select="@id"/>
4839
+ </xsl:apply-templates>
4840
+ </tbody>
4841
+ </xsl:variable>
4842
+
4843
+ <xsl:copy-of select="$dl_table"/>
4844
+ </xsl:variable>
4845
+
4846
+ <xsl:variable name="colwidths">
4847
+ <xsl:call-template name="calculate-column-widths">
4848
+ <xsl:with-param name="cols-count" select="2"/>
4849
+ <xsl:with-param name="table" select="$simple-table"/>
4850
+ </xsl:call-template>
4851
+ </xsl:variable>
4852
+
4853
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
4854
+ DEBUG
4855
+ colwidths=<xsl:copy-of select="$colwidths"/>
4856
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
4857
+
4858
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4859
+
4860
+ <xsl:variable name="maxlength_dt">
4861
+ <xsl:call-template name="getMaxLength_dt"/>
4862
+ </xsl:variable>
4863
+
4864
+ <xsl:variable name="isContainsKeepTogetherTag_">
4865
+ false
4866
+ </xsl:variable>
4867
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4868
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4869
+
4870
+
4871
+ <xsl:call-template name="setColumnWidth_dl">
4872
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4873
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4874
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4875
+ </xsl:call-template>
4876
+
4877
+ <fo:table-body>
4878
+
4879
+ <!-- DEBUG -->
4880
+ <xsl:if test="$table_if_debug = 'true'">
4881
+ <fo:table-row>
4882
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
4883
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
4884
+ </fo:table-cell>
4885
+ </fo:table-row>
4886
+ </xsl:if>
4887
+
4888
+ <xsl:apply-templates>
4889
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
4890
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
4891
+ </xsl:apply-templates>
4892
+
4893
+ </fo:table-body>
4894
+ </xsl:otherwise>
4895
+ </xsl:choose>
4207
4896
  </fo:table>
4208
4897
  </fo:block>
4209
4898
  </fo:block>
4210
4899
  </xsl:if> <!-- END: a few components -->
4211
4900
  </fo:block-container>
4212
4901
  </fo:block-container>
4902
+
4903
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
4904
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
4905
+ </xsl:if>
4906
+
4907
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4908
+ <xsl:param name="process">false</xsl:param>
4909
+ <xsl:if test="$process = 'true'">
4910
+ <fo:block xsl:use-attribute-sets="dl-name-style">
4911
+ <xsl:apply-templates/>
4912
+ </fo:block>
4913
+ </xsl:if>
4213
4914
  </xsl:template><xsl:template name="setColumnWidth_dl">
4214
4915
  <xsl:param name="colwidths"/>
4215
4916
  <xsl:param name="maxlength_dt"/>
4216
4917
  <xsl:param name="isContainsKeepTogetherTag"/>
4918
+
4919
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
4920
+
4217
4921
  <xsl:choose>
4922
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4923
+ <xsl:call-template name="insertTableColumnWidth">
4924
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4925
+ </xsl:call-template>
4926
+ </xsl:when>
4218
4927
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4219
4928
  <fo:table-column column-width="50%"/>
4220
4929
  <fo:table-column column-width="50%"/>
4221
4930
  </xsl:when>
4222
4931
  <xsl:otherwise>
4223
4932
  <xsl:choose>
4933
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4934
+ <xsl:call-template name="insertTableColumnWidth">
4935
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4936
+ </xsl:call-template>
4937
+ </xsl:when>
4224
4938
  <xsl:when test="$isContainsKeepTogetherTag">
4225
4939
  <xsl:call-template name="insertTableColumnWidth">
4226
4940
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -4265,13 +4979,19 @@
4265
4979
  </xsl:choose>
4266
4980
  </xsl:template><xsl:template name="insertTableColumnWidth">
4267
4981
  <xsl:param name="colwidths"/>
4982
+
4268
4983
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
4269
4984
  <xsl:choose>
4270
4985
  <xsl:when test=". = 1 or . = 0">
4271
4986
  <fo:table-column column-width="proportional-column-width(2)"/>
4272
4987
  </xsl:when>
4273
4988
  <xsl:otherwise>
4274
- <fo:table-column column-width="proportional-column-width({.})"/>
4989
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
4990
+ <xsl:variable name="divider">
4991
+ <xsl:value-of select="@divider"/>
4992
+ <xsl:if test="not(@divider)">1</xsl:if>
4993
+ </xsl:variable>
4994
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
4275
4995
  </xsl:otherwise>
4276
4996
  </xsl:choose>
4277
4997
  </xsl:for-each>
@@ -4333,11 +5053,19 @@
4333
5053
  </fo:table-cell>
4334
5054
  </fo:table-row>
4335
5055
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
5056
+ <xsl:param name="id"/>
5057
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4336
5058
  <tr>
4337
5059
  <td>
5060
+ <xsl:attribute name="id">
5061
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5062
+ </xsl:attribute>
4338
5063
  <xsl:apply-templates/>
4339
5064
  </td>
4340
5065
  <td>
5066
+ <xsl:attribute name="id">
5067
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
5068
+ </xsl:attribute>
4341
5069
 
4342
5070
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4343
5071
  <xsl:with-param name="process">true</xsl:with-param>
@@ -4348,50 +5076,134 @@
4348
5076
 
4349
5077
  </xsl:template><xsl:template match="*[local-name()='dt']">
4350
5078
  <xsl:param name="key_iso"/>
5079
+ <xsl:param name="split_keep-within-line"/>
4351
5080
 
4352
5081
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4353
- <fo:table-cell>
5082
+ <xsl:call-template name="insert_dt_cell">
5083
+ <xsl:with-param name="key_iso" select="$key_iso"/>
5084
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5085
+ </xsl:call-template>
5086
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
5087
+ <xsl:call-template name="insert_dd_cell">
5088
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5089
+ </xsl:call-template>
5090
+ </xsl:for-each>
5091
+ </fo:table-row>
5092
+ </xsl:template><xsl:template name="insert_dt_cell">
5093
+ <xsl:param name="key_iso"/>
5094
+ <xsl:param name="split_keep-within-line"/>
5095
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
5096
+
5097
+ <xsl:if test="$isGenerateTableIF = 'true'">
5098
+ <!-- border is mandatory, to calculate real width -->
5099
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5100
+ <xsl:attribute name="text-align">left</xsl:attribute>
5101
+ </xsl:if>
5102
+
5103
+
5104
+ <fo:block xsl:use-attribute-sets="dt-block-style">
5105
+ <xsl:copy-of select="@id"/>
5106
+
5107
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5108
+ <xsl:attribute name="margin-top">0</xsl:attribute>
5109
+ </xsl:if>
5110
+
5111
+
5112
+
5113
+ <xsl:apply-templates>
5114
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5115
+ </xsl:apply-templates>
5116
+
5117
+ <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"/> -->
5118
+
5119
+ </fo:block>
5120
+ </fo:table-cell>
5121
+ </xsl:template><xsl:template name="insert_dd_cell">
5122
+ <xsl:param name="split_keep-within-line"/>
5123
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
5124
+
5125
+ <xsl:if test="$isGenerateTableIF = 'true'">
5126
+ <!-- border is mandatory, to calculate real width -->
5127
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5128
+ </xsl:if>
5129
+
5130
+ <fo:block>
5131
+
5132
+ <xsl:if test="$isGenerateTableIF = 'true'">
5133
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5134
+ </xsl:if>
5135
+
4354
5136
 
4355
- <fo:block xsl:use-attribute-sets="dt-style">
4356
- <xsl:copy-of select="@id"/>
4357
-
4358
- <xsl:if test="normalize-space($key_iso) = 'true'">
4359
- <xsl:attribute name="margin-top">0</xsl:attribute>
4360
- </xsl:if>
4361
-
4362
-
4363
-
4364
- <xsl:apply-templates/>
4365
- </fo:block>
4366
- </fo:table-cell>
4367
- <fo:table-cell>
4368
- <fo:block>
4369
-
4370
5137
 
4371
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4372
- <xsl:with-param name="process">true</xsl:with-param>
4373
- </xsl:apply-templates>
4374
- </fo:block>
4375
- </fo:table-cell>
4376
- </fo:table-row>
5138
+ <xsl:choose>
5139
+ <xsl:when test="$isGenerateTableIF = 'true'">
5140
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
5141
+ <xsl:with-param name="process">true</xsl:with-param>
5142
+ </xsl:apply-templates>
5143
+ </xsl:when>
5144
+ <xsl:otherwise>
5145
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
5146
+ <xsl:with-param name="process">true</xsl:with-param>
5147
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5148
+ </xsl:apply-templates>
5149
+ </xsl:otherwise>
5150
+
5151
+ </xsl:choose>
5152
+
5153
+ <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"/> -->
5154
+
5155
+ </fo:block>
5156
+ </fo:table-cell>
4377
5157
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4378
5158
  <xsl:apply-templates/>
4379
5159
  </xsl:template><xsl:template match="*[local-name()='dd']">
4380
5160
  <xsl:param name="process">false</xsl:param>
5161
+ <xsl:param name="split_keep-within-line"/>
4381
5162
  <xsl:if test="$process = 'true'">
4382
5163
  <xsl:apply-templates select="@language"/>
4383
- <xsl:apply-templates/>
5164
+ <xsl:apply-templates>
5165
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5166
+ </xsl:apply-templates>
4384
5167
  </xsl:if>
4385
5168
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4386
5169
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4387
- </xsl:template><xsl:template match="*[local-name()='em']">
5170
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
5171
+ <xsl:param name="id"/>
5172
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
5173
+ <tr>
5174
+ <td>
5175
+ <xsl:copy-of select="node()"/>
5176
+ </td>
5177
+ <td>
5178
+
5179
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5180
+
5181
+ <!-- get paragraphs from nested 'dl' -->
5182
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5183
+
5184
+
5185
+ </td>
5186
+ </tr>
5187
+
5188
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5189
+ <xsl:for-each select="*[local-name() = 'dt']">
5190
+ <p>
5191
+ <xsl:copy-of select="node()"/>
5192
+ <xsl:text> </xsl:text>
5193
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
5194
+ </p>
5195
+ </xsl:for-each>
5196
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
4388
5197
  <fo:inline font-style="italic">
4389
5198
  <xsl:apply-templates/>
4390
5199
  </fo:inline>
4391
5200
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
5201
+ <xsl:param name="split_keep-within-line"/>
4392
5202
  <fo:inline font-weight="bold">
4393
5203
 
4394
- <xsl:apply-templates/>
5204
+ <xsl:apply-templates>
5205
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5206
+ </xsl:apply-templates>
4395
5207
  </fo:inline>
4396
5208
  </xsl:template><xsl:template match="*[local-name()='padding']">
4397
5209
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -4412,7 +5224,7 @@
4412
5224
 
4413
5225
 
4414
5226
 
4415
-
5227
+ <!-- 10 -->
4416
5228
 
4417
5229
 
4418
5230
 
@@ -4592,6 +5404,10 @@
4592
5404
  <xsl:param name="text"/>
4593
5405
  <xsl:param name="separator" select="' '"/>
4594
5406
  <xsl:choose>
5407
+
5408
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
5409
+ <word><xsl:value-of select="normalize-space($text)"/></word>
5410
+ </xsl:when>
4595
5411
  <xsl:when test="not(contains($text, $separator))">
4596
5412
  <word>
4597
5413
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -4636,13 +5452,66 @@
4636
5452
  </xsl:when>
4637
5453
  <xsl:otherwise>
4638
5454
  <word>
4639
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
5455
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
5456
+ <xsl:choose>
5457
+ <xsl:when test="$isGenerateTableIF = 'true'">
5458
+ <xsl:value-of select="$word"/>
5459
+ </xsl:when>
5460
+ <xsl:otherwise>
5461
+ <xsl:value-of select="string-length($word)"/>
5462
+ </xsl:otherwise>
5463
+ </xsl:choose>
4640
5464
  </word>
4641
5465
  <xsl:call-template name="tokenize">
4642
5466
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4643
5467
  </xsl:call-template>
4644
5468
  </xsl:otherwise>
4645
5469
  </xsl:choose>
5470
+ </xsl:template><xsl:template name="tokenize_with_tags">
5471
+ <xsl:param name="tags"/>
5472
+ <xsl:param name="text"/>
5473
+ <xsl:param name="separator" select="' '"/>
5474
+ <xsl:choose>
5475
+
5476
+ <xsl:when test="not(contains($text, $separator))">
5477
+ <word>
5478
+ <xsl:call-template name="enclose_text_in_tags">
5479
+ <xsl:with-param name="text" select="normalize-space($text)"/>
5480
+ <xsl:with-param name="tags" select="$tags"/>
5481
+ </xsl:call-template>
5482
+ </word>
5483
+ </xsl:when>
5484
+ <xsl:otherwise>
5485
+ <word>
5486
+ <xsl:call-template name="enclose_text_in_tags">
5487
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
5488
+ <xsl:with-param name="tags" select="$tags"/>
5489
+ </xsl:call-template>
5490
+ </word>
5491
+ <xsl:call-template name="tokenize_with_tags">
5492
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5493
+ </xsl:call-template>
5494
+ </xsl:otherwise>
5495
+ </xsl:choose>
5496
+ </xsl:template><xsl:template name="enclose_text_in_tags">
5497
+ <xsl:param name="text"/>
5498
+ <xsl:param name="tags"/>
5499
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
5500
+
5501
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
5502
+
5503
+ <xsl:choose>
5504
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
5505
+ <xsl:otherwise>
5506
+ <xsl:element name="{$tag_name}">
5507
+ <xsl:call-template name="enclose_text_in_tags">
5508
+ <xsl:with-param name="text" select="$text"/>
5509
+ <xsl:with-param name="tags" select="$tags"/>
5510
+ <xsl:with-param name="num" select="$num + 1"/>
5511
+ </xsl:call-template>
5512
+ </xsl:element>
5513
+ </xsl:otherwise>
5514
+ </xsl:choose>
4646
5515
  </xsl:template><xsl:template name="max_length">
4647
5516
  <xsl:param name="words"/>
4648
5517
  <xsl:for-each select="$words//word">
@@ -4743,12 +5612,19 @@
4743
5612
  </xsl:otherwise>
4744
5613
  </xsl:choose>
4745
5614
  </xsl:template><xsl:template name="getSimpleTable">
5615
+ <xsl:param name="id"/>
5616
+
4746
5617
  <xsl:variable name="simple-table">
4747
5618
 
5619
+ <!-- Step 0. replace <br/> to <p>...</p> -->
5620
+ <xsl:variable name="table_without_br">
5621
+ <xsl:apply-templates mode="table-without-br"/>
5622
+ </xsl:variable>
5623
+
4748
5624
  <!-- Step 1. colspan processing -->
4749
5625
  <xsl:variable name="simple-table-colspan">
4750
5626
  <tbody>
4751
- <xsl:apply-templates mode="simple-table-colspan"/>
5627
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
4752
5628
  </tbody>
4753
5629
  </xsl:variable>
4754
5630
 
@@ -4757,10 +5633,67 @@
4757
5633
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
4758
5634
  </xsl:variable>
4759
5635
 
4760
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
4761
-
5636
+ <!-- Step 3: add id to each cell -->
5637
+ <!-- add <word>...</word> for each word, image, math -->
5638
+ <xsl:variable name="simple-table-id">
5639
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
5640
+ <xsl:with-param name="id" select="$id"/>
5641
+ </xsl:apply-templates>
5642
+ </xsl:variable>
5643
+
5644
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
5645
+
4762
5646
  </xsl:variable>
4763
5647
  <xsl:copy-of select="$simple-table"/>
5648
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
5649
+ <xsl:copy>
5650
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
5651
+ </xsl:copy>
5652
+ </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">
5653
+ <xsl:copy>
5654
+ <xsl:copy-of select="@*"/>
5655
+ <p>
5656
+ <xsl:copy-of select="node()"/>
5657
+ </p>
5658
+ </xsl:copy>
5659
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
5660
+ <xsl:copy>
5661
+ <xsl:copy-of select="@*"/>
5662
+ <xsl:for-each select="*[local-name()='br']">
5663
+ <xsl:variable name="current_id" select="generate-id()"/>
5664
+ <p>
5665
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
5666
+ <xsl:copy-of select="."/>
5667
+ </xsl:for-each>
5668
+ </p>
5669
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
5670
+ <p>
5671
+ <xsl:for-each select="following-sibling::node()">
5672
+ <xsl:copy-of select="."/>
5673
+ </xsl:for-each>
5674
+ </p>
5675
+ </xsl:if>
5676
+ </xsl:for-each>
5677
+ </xsl:copy>
5678
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
5679
+ <xsl:for-each select="*[local-name()='br']">
5680
+ <xsl:variable name="current_id" select="generate-id()"/>
5681
+ <p>
5682
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
5683
+ <xsl:copy-of select="."/>
5684
+ </xsl:for-each>
5685
+ </p>
5686
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
5687
+ <p>
5688
+ <xsl:for-each select="following-sibling::node()">
5689
+ <xsl:copy-of select="."/>
5690
+ </xsl:for-each>
5691
+ </p>
5692
+ </xsl:if>
5693
+ </xsl:for-each>
5694
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
5695
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
5696
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4764
5697
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4765
5698
  <xsl:apply-templates mode="simple-table-colspan"/>
4766
5699
  </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">
@@ -4850,6 +5783,126 @@
4850
5783
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4851
5784
  <xsl:with-param name="previousRow" select="$newRow"/>
4852
5785
  </xsl:apply-templates>
5786
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
5787
+ <xsl:param name="id"/>
5788
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
5789
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
5790
+ <xsl:with-param name="id" select="$id_prefixed"/>
5791
+ </xsl:apply-templates>
5792
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
5793
+ <xsl:param name="id"/>
5794
+ <xsl:copy>
5795
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
5796
+ <xsl:with-param name="id" select="$id"/>
5797
+ </xsl:apply-templates>
5798
+ </xsl:copy>
5799
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
5800
+ <xsl:param name="id"/>
5801
+ <xsl:copy>
5802
+ <xsl:copy-of select="@*"/>
5803
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
5804
+ <xsl:apply-templates select="node()" mode="simple-table-id">
5805
+ <xsl:with-param name="id" select="$id"/>
5806
+ </xsl:apply-templates>
5807
+ </xsl:copy>
5808
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
5809
+ <xsl:param name="id"/>
5810
+ <xsl:copy>
5811
+ <xsl:copy-of select="@*"/>
5812
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
5813
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
5814
+ <xsl:attribute name="id">
5815
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
5816
+ </xsl:attribute>
5817
+
5818
+ <xsl:for-each select="*[local-name() = 'p']">
5819
+ <xsl:copy>
5820
+ <xsl:copy-of select="@*"/>
5821
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5822
+ <xsl:attribute name="id">
5823
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
5824
+ </xsl:attribute>
5825
+
5826
+ <xsl:copy-of select="node()"/>
5827
+ </xsl:copy>
5828
+ </xsl:for-each>
5829
+
5830
+
5831
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
5832
+
5833
+ <xsl:variable name="td_text">
5834
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
5835
+ </xsl:variable>
5836
+
5837
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
5838
+
5839
+ <xsl:variable name="words">
5840
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
5841
+ <word>
5842
+ <xsl:copy-of select="."/>
5843
+ </word>
5844
+ </xsl:for-each>
5845
+
5846
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
5847
+ <xsl:copy-of select="."/>
5848
+ </xsl:for-each>
5849
+
5850
+ </xsl:variable>
5851
+
5852
+ <xsl:for-each select="xalan:nodeset($words)/word">
5853
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5854
+ <xsl:copy>
5855
+ <xsl:attribute name="id">
5856
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
5857
+ </xsl:attribute>
5858
+ <xsl:copy-of select="node()"/>
5859
+ </xsl:copy>
5860
+ </xsl:for-each>
5861
+ </xsl:if>
5862
+ </xsl:copy>
5863
+
5864
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
5865
+ <xsl:copy>
5866
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5867
+ </xsl:copy>
5868
+ </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">
5869
+ <xsl:variable name="formatting_tags">
5870
+ <xsl:call-template name="getFormattingTags"/>
5871
+ </xsl:variable>
5872
+ <word>
5873
+ <xsl:call-template name="enclose_text_in_tags">
5874
+ <xsl:with-param name="text" select="normalize-space(.)"/>
5875
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5876
+ </xsl:call-template>
5877
+ </word>
5878
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
5879
+
5880
+ <xsl:variable name="td_text" select="."/>
5881
+
5882
+ <xsl:variable name="string_with_added_zerospaces">
5883
+ <xsl:call-template name="add-zero-spaces-java">
5884
+ <xsl:with-param name="text" select="$td_text"/>
5885
+ </xsl:call-template>
5886
+ </xsl:variable>
5887
+
5888
+ <xsl:variable name="formatting_tags">
5889
+ <xsl:call-template name="getFormattingTags"/>
5890
+ </xsl:variable>
5891
+
5892
+ <!-- <word>text</word> -->
5893
+ <xsl:call-template name="tokenize_with_tags">
5894
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5895
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
5896
+ </xsl:call-template>
5897
+ </xsl:template><xsl:template name="getFormattingTags">
5898
+ <tags>
5899
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
5900
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
5901
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
5902
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
5903
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
5904
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
5905
+ </tags>
4853
5906
  </xsl:template><xsl:template name="getLang">
4854
5907
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4855
5908
  <xsl:variable name="language">
@@ -5043,6 +6096,11 @@
5043
6096
  </xsl:variable>
5044
6097
  <fo:inline xsl:use-attribute-sets="link-style">
5045
6098
 
6099
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
6100
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6101
+ </xsl:if>
6102
+
6103
+
5046
6104
 
5047
6105
 
5048
6106
 
@@ -5311,7 +6369,19 @@
5311
6369
  <xsl:value-of select="$suffix"/>
5312
6370
  </xsl:if>
5313
6371
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
5314
- <fo:inline><xsl:apply-templates/></fo:inline>
6372
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
6373
+ <xsl:choose>
6374
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
6375
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
6376
+ <xsl:apply-templates/>
6377
+ </fo:inline>
6378
+ </xsl:when>
6379
+ <xsl:otherwise>
6380
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
6381
+ <xsl:apply-templates/>
6382
+ </fo:block>
6383
+ </xsl:otherwise>
6384
+ </xsl:choose>
5315
6385
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
5316
6386
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
5317
6387
  <fo:block id="{@id}">
@@ -6143,7 +7213,7 @@
6143
7213
  </xsl:choose>
6144
7214
  </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">
6145
7215
  <xsl:value-of select="."/>
6146
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
7216
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6147
7217
  <xsl:text> </xsl:text>
6148
7218
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
6149
7219
  <xsl:copy>
@@ -6218,7 +7288,7 @@
6218
7288
 
6219
7289
 
6220
7290
 
6221
-
7291
+ <!-- 9 -->
6222
7292
 
6223
7293
 
6224
7294
 
@@ -6310,7 +7380,7 @@
6310
7380
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6311
7381
  <xsl:choose>
6312
7382
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6313
- <xsl:call-template name="interspers">
7383
+ <xsl:call-template name="interspers-java">
6314
7384
  <xsl:with-param name="str" select="."/>
6315
7385
  </xsl:call-template>
6316
7386
  </xsl:when>
@@ -6360,6 +7430,10 @@
6360
7430
  <xsl:with-param name="char" select="$char"/>
6361
7431
  </xsl:call-template>
6362
7432
  </xsl:if>
7433
+ </xsl:template><xsl:template name="interspers-java">
7434
+ <xsl:param name="str"/>
7435
+ <xsl:param name="char" select="$zero_width_space"/>
7436
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
6363
7437
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6364
7438
  <xsl:apply-templates mode="syntax_highlight"/>
6365
7439
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -6580,7 +7654,9 @@
6580
7654
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
6581
7655
  </xsl:if>
6582
7656
  <xsl:variable name="simple-table">
6583
- <xsl:call-template name="getSimpleTable"/>
7657
+ <xsl:call-template name="getSimpleTable">
7658
+ <xsl:with-param name="id" select="@id"/>
7659
+ </xsl:call-template>
6584
7660
  </xsl:variable>
6585
7661
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
6586
7662
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -7003,6 +8079,7 @@
7003
8079
 
7004
8080
 
7005
8081
 
8082
+
7006
8083
  <xsl:choose>
7007
8084
  <xsl:when test="$depth = 2">2</xsl:when>
7008
8085
  <xsl:otherwise>1</xsl:otherwise>
@@ -7316,6 +8393,11 @@
7316
8393
  </xsl:otherwise>
7317
8394
  </xsl:choose>
7318
8395
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8396
+
8397
+ <xsl:apply-templates select="*[local-name() = 'name']">
8398
+ <xsl:with-param name="process">true</xsl:with-param>
8399
+ </xsl:apply-templates>
8400
+
7319
8401
  <fo:list-block xsl:use-attribute-sets="list-style">
7320
8402
 
7321
8403
 
@@ -7326,12 +8408,23 @@
7326
8408
 
7327
8409
 
7328
8410
 
8411
+ <xsl:if test="*[local-name() = 'name']">
8412
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8413
+ </xsl:if>
8414
+
7329
8415
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7330
8416
  </fo:list-block>
7331
8417
  <!-- <xsl:for-each select="./iho:note">
7332
8418
  <xsl:call-template name="note"/>
7333
8419
  </xsl:for-each> -->
7334
8420
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8421
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8422
+ <xsl:param name="process">false</xsl:param>
8423
+ <xsl:if test="$process = 'true'">
8424
+ <fo:block xsl:use-attribute-sets="list-name-style">
8425
+ <xsl:apply-templates/>
8426
+ </fo:block>
8427
+ </xsl:if>
7335
8428
  </xsl:template><xsl:template match="*[local-name()='li']">
7336
8429
  <fo:list-item xsl:use-attribute-sets="list-item-style">
7337
8430
  <xsl:copy-of select="@id"/>
@@ -7539,7 +8632,7 @@
7539
8632
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7540
8633
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7541
8634
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7542
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
8635
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
7543
8636
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7544
8637
  <!-- <row>
7545
8638
  <date>05-07-2013</date>
@@ -7610,7 +8703,7 @@
7610
8703
 
7611
8704
  </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
7612
8705
 
7613
- <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
8706
+ <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
7614
8707
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
7615
8708
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
7616
8709
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
@@ -7619,7 +8712,7 @@
7619
8712
  <fo:block>
7620
8713
  <fo:inline>
7621
8714
 
7622
- <xsl:number format="1."/>
8715
+ <xsl:number format="1." count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
7623
8716
 
7624
8717
  </fo:inline>
7625
8718
  </fo:block>
@@ -7640,145 +8733,7 @@
7640
8733
  <xsl:if test=".//ogc:fn">
7641
8734
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
7642
8735
  </xsl:if>
7643
- <xsl:choose>
7644
- <xsl:when test="*[local-name() = 'formattedref']">
7645
- <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
7646
- </xsl:when>
7647
- <xsl:otherwise>
7648
- <xsl:variable name="personalAuthors">
7649
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'person']">
7650
- <xsl:call-template name="processPersonalAuthor"/>
7651
- </xsl:for-each>
7652
- <xsl:if test="not(*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'person'])">
7653
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']/*[local-name() = 'person']">
7654
- <xsl:call-template name="processPersonalAuthor"/>
7655
- </xsl:for-each>
7656
- </xsl:if>
7657
- </xsl:variable>
7658
-
7659
- <xsl:variable name="city" select="*[local-name() = 'place']"/>
7660
- <xsl:variable name="year">
7661
- <xsl:choose>
7662
- <xsl:when test="*[local-name() = 'date'][@type = 'published']">
7663
- <xsl:for-each select="*[local-name() = 'date'][@type = 'published']">
7664
- <xsl:call-template name="renderDate"/>
7665
- </xsl:for-each>
7666
- </xsl:when>
7667
- <xsl:when test="*[local-name() = 'date'][@type = 'issued']">
7668
- <xsl:for-each select="*[local-name() = 'date'][@type = 'issued']">
7669
- <xsl:call-template name="renderDate"/>
7670
- </xsl:for-each>
7671
- </xsl:when>
7672
- <xsl:when test="*[local-name() = 'date'][@type = 'circulated']">
7673
- <xsl:for-each select="*[local-name() = 'date'][@type = 'circulated']">
7674
- <xsl:call-template name="renderDate"/>
7675
- </xsl:for-each>
7676
- </xsl:when>
7677
- <xsl:otherwise>
7678
- <xsl:for-each select="*[local-name() = 'date']">
7679
- <xsl:call-template name="renderDate"/>
7680
- </xsl:for-each>
7681
- </xsl:otherwise>
7682
- </xsl:choose>
7683
- </xsl:variable>
7684
-
7685
- <xsl:variable name="uri" select="*[local-name() = 'uri']"/>
7686
-
7687
-
7688
- <!-- citation structure:
7689
- {personal names | organisation}: {document identifier}, {title}. {publisher}, {city} ({year})
7690
- -->
7691
-
7692
- <!-- Author(s) -->
7693
- <xsl:choose>
7694
- <xsl:when test="xalan:nodeset($personalAuthors)//author">
7695
- <xsl:for-each select="xalan:nodeset($personalAuthors)//author">
7696
- <xsl:apply-templates/>
7697
- <xsl:if test="position() != last()">, </xsl:if>
7698
- </xsl:for-each>
7699
- <xsl:text>: </xsl:text>
7700
- </xsl:when>
7701
- <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'abbreviation']">
7702
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'abbreviation']">
7703
- <xsl:value-of select="."/>
7704
- <xsl:if test="position() != last()">/</xsl:if>
7705
- </xsl:for-each>
7706
- <xsl:text>: </xsl:text>
7707
- </xsl:when>
7708
- <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
7709
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
7710
- <xsl:value-of select="."/>
7711
- <xsl:if test="position() != last()">, </xsl:if>
7712
- </xsl:for-each>
7713
- <xsl:text>: </xsl:text>
7714
- </xsl:when>
7715
- </xsl:choose>
7716
-
7717
-
7718
- <xsl:variable name="document_identifier">
7719
- <xsl:call-template name="processBibitemDocId"/>
7720
- </xsl:variable>
7721
-
7722
- <xsl:value-of select="$document_identifier"/>
7723
-
7724
- <xsl:apply-templates select="*[local-name() = 'note']"/>
7725
-
7726
- <xsl:variable name="isDraft">
7727
- <xsl:variable name="stage" select="normalize-space(*[local-name() = 'status']/*[local-name() = 'stage'])"/>
7728
- <xsl:if test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization'][*[local-name() = 'name']/text() = 'Open Geospatial Consortium'] and $stage != '' and $stage != 'published' and $stage != 'deprecated' and $stage != 'retired'">true</xsl:if>
7729
- </xsl:variable>
7730
-
7731
- <xsl:if test="$isDraft = 'true'">
7732
- <xsl:text> (Draft)</xsl:text>
7733
- </xsl:if>
7734
-
7735
- <xsl:text>, </xsl:text>
7736
-
7737
- <xsl:choose>
7738
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
7739
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
7740
- </xsl:when>
7741
- <xsl:otherwise>
7742
- <xsl:apply-templates select="*[local-name() = 'title']"/>
7743
- </xsl:otherwise>
7744
- </xsl:choose>
7745
-
7746
- <xsl:text>. </xsl:text>
7747
-
7748
- <xsl:if test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
7749
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
7750
- <xsl:value-of select="."/>
7751
- <xsl:if test="position() != last()">, </xsl:if>
7752
- </xsl:for-each>
7753
- <xsl:if test="normalize-space($city) != ''">, </xsl:if>
7754
- </xsl:if>
7755
-
7756
- <xsl:value-of select="$city"/>
7757
-
7758
- <xsl:if test="(*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name'] or normalize-space($city) != '') and normalize-space($year) != ''">
7759
- <xsl:text> </xsl:text>
7760
- </xsl:if>
7761
-
7762
- <xsl:if test="normalize-space($year) != ''">
7763
- <xsl:text>(</xsl:text>
7764
- <xsl:value-of select="$year"/>
7765
- <xsl:text>). </xsl:text>
7766
- </xsl:if>
7767
-
7768
- <xsl:if test="normalize-space($uri) != ''">
7769
- <fo:inline>
7770
-
7771
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
7772
-
7773
- <xsl:text> </xsl:text>
7774
- <fo:basic-link external-destination="{$uri}" fox:alt-text="{$uri}">
7775
- <xsl:value-of select="$uri"/>
7776
- </fo:basic-link>
7777
- </fo:inline>
7778
- </xsl:if>
7779
-
7780
- </xsl:otherwise>
7781
- </xsl:choose>
8736
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
7782
8737
  <!-- end OGC bibitem processing-->
7783
8738
 
7784
8739
  </xsl:template><xsl:template name="processBibitemDocId">
@@ -8088,12 +9043,16 @@
8088
9043
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
8089
9044
 
8090
9045
 
9046
+
9047
+
8091
9048
 
8092
9049
 
8093
9050
 
8094
9051
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
8095
9052
 
8096
9053
 
9054
+
9055
+
8097
9056
  <fo:block xsl:use-attribute-sets="admonition-name-style">
8098
9057
  <xsl:call-template name="displayAdmonitionName"/>
8099
9058
  </fo:block>
@@ -8106,25 +9065,32 @@
8106
9065
  </fo:block-container>
8107
9066
 
8108
9067
  </xsl:template><xsl:template name="displayAdmonitionName">
8109
-
9068
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
9069
+ <!-- <xsl:choose>
9070
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
9071
+ <xsl:choose>
9072
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
9073
+ <xsl:otherwise>
9074
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9075
+ </xsl:otherwise>
9076
+ </xsl:choose>
9077
+ </xsl:when>
9078
+ <xsl:otherwise>
8110
9079
  <xsl:apply-templates select="*[local-name() = 'name']"/>
8111
9080
  <xsl:if test="not(*[local-name() = 'name'])">
8112
9081
  <xsl:apply-templates select="@type"/>
8113
9082
  </xsl:if>
8114
-
8115
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8116
- <xsl:apply-templates/>
8117
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
8118
- <xsl:variable name="admonition_type_">
8119
- <xsl:call-template name="getLocalizedString">
8120
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
8121
- </xsl:call-template>
9083
+ </xsl:otherwise>
9084
+ </xsl:choose> -->
9085
+ <xsl:variable name="name">
9086
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8122
9087
  </xsl:variable>
8123
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
8124
- <xsl:value-of select="$admonition_type"/>
8125
- <xsl:if test="$admonition_type = ''">
8126
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
9088
+ <xsl:copy-of select="$name"/>
9089
+ <xsl:if test="normalize-space($name) != ''">
9090
+ <xsl:value-of select="$sep"/>
8127
9091
  </xsl:if>
9092
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
9093
+ <xsl:apply-templates/>
8128
9094
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
8129
9095
 
8130
9096
  <fo:block xsl:use-attribute-sets="admonition-p-style">
@@ -8295,6 +9261,8 @@
8295
9261
  </xsl:when>
8296
9262
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8297
9263
  </xsl:choose>
9264
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
9265
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
8298
9266
  </xsl:template><xsl:template name="printEdition">
8299
9267
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8300
9268
  <xsl:text> </xsl:text>
@@ -8401,6 +9369,27 @@
8401
9369
  </xsl:when>
8402
9370
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
8403
9371
  </xsl:choose>
9372
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
9373
+ <xsl:param name="num"/>
9374
+ <xsl:variable name="monthStr">
9375
+ <xsl:choose>
9376
+ <xsl:when test="$num = '01'">january</xsl:when>
9377
+ <xsl:when test="$num = '02'">february</xsl:when>
9378
+ <xsl:when test="$num = '03'">march</xsl:when>
9379
+ <xsl:when test="$num = '04'">april</xsl:when>
9380
+ <xsl:when test="$num = '05'">may</xsl:when>
9381
+ <xsl:when test="$num = '06'">june</xsl:when>
9382
+ <xsl:when test="$num = '07'">july</xsl:when>
9383
+ <xsl:when test="$num = '08'">august</xsl:when>
9384
+ <xsl:when test="$num = '09'">september</xsl:when>
9385
+ <xsl:when test="$num = '10'">october</xsl:when>
9386
+ <xsl:when test="$num = '11'">november</xsl:when>
9387
+ <xsl:when test="$num = '12'">december</xsl:when>
9388
+ </xsl:choose>
9389
+ </xsl:variable>
9390
+ <xsl:call-template name="getLocalizedString">
9391
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
9392
+ </xsl:call-template>
8404
9393
  </xsl:template><xsl:template name="insertKeywords">
8405
9394
  <xsl:param name="sorting" select="'true'"/>
8406
9395
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -8596,6 +9585,7 @@
8596
9585
 
8597
9586
 
8598
9587
 
9588
+
8599
9589
  <xsl:value-of select="document('')//*/namespace::ogc"/>
8600
9590
 
8601
9591
 
@@ -9007,4 +9997,40 @@
9007
9997
  <xsl:value-of select="$value"/>
9008
9998
  </xsl:otherwise>
9009
9999
  </xsl:choose>
10000
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
10001
+ <xsl:param name="level">0</xsl:param>
10002
+
10003
+ <fo:block margin-left="{2*$level}mm">
10004
+ <xsl:text>
10005
+ &lt;</xsl:text>
10006
+ <xsl:value-of select="local-name()"/>
10007
+ <xsl:for-each select="@*">
10008
+ <xsl:text> </xsl:text>
10009
+ <xsl:value-of select="local-name()"/>
10010
+ <xsl:text>="</xsl:text>
10011
+ <xsl:value-of select="."/>
10012
+ <xsl:text>"</xsl:text>
10013
+ </xsl:for-each>
10014
+ <xsl:text>&gt;</xsl:text>
10015
+
10016
+ <xsl:if test="not(*)">
10017
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
10018
+ <xsl:text>&lt;/</xsl:text>
10019
+ <xsl:value-of select="local-name()"/>
10020
+ <xsl:text>&gt;</xsl:text>
10021
+ </xsl:if>
10022
+ </fo:block>
10023
+
10024
+ <xsl:if test="*">
10025
+ <fo:block>
10026
+ <xsl:apply-templates mode="print_as_xml">
10027
+ <xsl:with-param name="level" select="$level + 1"/>
10028
+ </xsl:apply-templates>
10029
+ </fo:block>
10030
+ <fo:block margin-left="{2*$level}mm">
10031
+ <xsl:text>&lt;/</xsl:text>
10032
+ <xsl:value-of select="local-name()"/>
10033
+ <xsl:text>&gt;</xsl:text>
10034
+ </fo:block>
10035
+ </xsl:if>
9010
10036
  </xsl:template></xsl:stylesheet>