metanorma-m3aawg 2.0.7 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,7 +28,13 @@
28
28
 
29
29
  <xsl:template match="/">
30
30
  <xsl:call-template name="namespaceCheck"/>
31
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
31
+ <fo:root xml:lang="{$lang}">
32
+ <xsl:variable name="root-style">
33
+ <root-style xsl:use-attribute-sets="root-style"/>
34
+ </xsl:variable>
35
+ <xsl:call-template name="insertRootStyle">
36
+ <xsl:with-param name="root-style" select="$root-style"/>
37
+ </xsl:call-template>
32
38
  <fo:layout-master-set>
33
39
 
34
40
  <!-- cover page -->
@@ -167,21 +173,18 @@
167
173
  </fo:block>
168
174
  <!-- Version 1.0 -->
169
175
  <fo:block font-size="12pt" margin-bottom="6pt">
170
- <xsl:variable name="title-edition">
171
- <xsl:call-template name="getTitle">
172
- <xsl:with-param name="name" select="'title-edition'"/>
176
+ <xsl:variable name="edition" select="normalize-space(/m3d:m3d-standard/m3d:bibdata/m3d:edition[normalize-space(@language) = ''])"/>
177
+ <xsl:if test="$edition != ''">
178
+ <xsl:call-template name="capitalize">
179
+ <xsl:with-param name="str">
180
+ <xsl:call-template name="getLocalizedString">
181
+ <xsl:with-param name="key">version</xsl:with-param>
182
+ </xsl:call-template>
183
+ </xsl:with-param>
173
184
  </xsl:call-template>
174
- </xsl:variable>
175
- <xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text>
176
- <xsl:variable name="edition" select="/m3d:m3d-standard/m3d:bibdata/m3d:edition"/>
177
- <xsl:choose>
178
- <xsl:when test="contains($edition, '.')">
179
- <xsl:value-of select="$edition"/>
180
- </xsl:when>
181
- <xsl:otherwise>
182
- <xsl:value-of select="$edition"/><xsl:text>.0</xsl:text>
183
- </xsl:otherwise>
184
- </xsl:choose>
185
+ <xsl:text>: </xsl:text>
186
+ <xsl:value-of select="$edition"/><xsl:if test="not(contains($edition, '.'))"><xsl:text>.0</xsl:text></xsl:if>
187
+ </xsl:if>
185
188
  </fo:block>
186
189
  <fo:block font-size="12pt" margin-bottom="12pt">
187
190
  <xsl:call-template name="convertDate">
@@ -544,6 +547,7 @@
544
547
 
545
548
  <xsl:template match="m3d:p" name="paragraph">
546
549
  <xsl:param name="inline" select="'false'"/>
550
+ <xsl:param name="split_keep-within-line"/>
547
551
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
548
552
  <xsl:variable name="element-name">
549
553
  <xsl:choose>
@@ -564,7 +568,9 @@
564
568
  </xsl:attribute>
565
569
  <xsl:attribute name="text-indent">0mm</xsl:attribute>
566
570
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
567
- <xsl:apply-templates/>
571
+ <xsl:apply-templates>
572
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
573
+ </xsl:apply-templates>
568
574
  </xsl:element>
569
575
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
570
576
  <xsl:choose>
@@ -642,25 +648,13 @@
642
648
  </xsl:template>
643
649
 
644
650
 
645
-
646
- <xsl:template match="mathml:math" priority="2">
647
- <fo:inline font-family="Cambria Math">
648
- <xsl:variable name="mathml">
649
- <xsl:apply-templates select="." mode="mathml"/>
650
- </xsl:variable>
651
- <fo:instream-foreign-object fox:alt-text="Math">
652
- <!-- <xsl:copy-of select="."/> -->
653
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
654
- </fo:instream-foreign-object>
655
- </fo:inline>
656
- </xsl:template>
657
-
658
-
659
651
  <xsl:variable name="Image-M3AAWG-Logo">
660
652
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAjUAAAA8CAYAAACehUt5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA99pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGE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nvXd9oIzfEjhw5cuTI0W8L1CAA0DauOxw5clQA6khe84PrCkeOHBWS/l+AAQACYD7v73Ou8wAAAABJRU5ErkJggg==</xsl:text>
661
653
  </xsl:variable>
662
654
 
663
- <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:variable name="lang">
655
+ <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:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
656
+ false
657
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
664
658
  <xsl:call-template name="getLang"/>
665
659
  </xsl:variable><xsl:variable name="pageWidth_">
666
660
  215.9
@@ -675,20 +669,7 @@
675
669
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
676
670
  23
677
671
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
678
-
679
- <title-edition lang="en">
680
-
681
- <xsl:text>Version</xsl:text>
682
-
683
- </title-edition>
684
672
 
685
- <title-edition lang="fr">
686
- <xsl:text>Édition </xsl:text>
687
- </title-edition>
688
-
689
- <title-edition lang="ru">
690
- <xsl:text>Издание </xsl:text>
691
- </title-edition>
692
673
 
693
674
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
694
675
  <title-toc lang="en">
@@ -769,7 +750,7 @@
769
750
  </xsl:variable><xsl:variable name="bibdata">
770
751
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
771
752
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
772
- </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
753
+ </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="hair_space"> </xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
773
754
  <xsl:param name="name"/>
774
755
  <xsl:param name="lang"/>
775
756
  <xsl:variable name="lang_">
@@ -812,7 +793,30 @@
812
793
 
813
794
 
814
795
 
815
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
796
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
797
+ <xsl:param name="root-style"/>
798
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
799
+
800
+ <xsl:variable name="additional_fonts_">
801
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
802
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
803
+ </xsl:for-each>
804
+ </xsl:variable>
805
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
806
+
807
+ <xsl:for-each select="$root-style_/root-style/@*">
808
+ <xsl:choose>
809
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
810
+ <xsl:attribute name="{local-name()}">
811
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
812
+ </xsl:attribute>
813
+ </xsl:when>
814
+ <xsl:otherwise>
815
+ <xsl:copy-of select="."/>
816
+ </xsl:otherwise>
817
+ </xsl:choose>
818
+ </xsl:for-each>
819
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
816
820
 
817
821
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
818
822
 
@@ -869,7 +873,6 @@
869
873
 
870
874
 
871
875
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
872
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
873
876
 
874
877
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
875
878
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -955,6 +958,7 @@
955
958
 
956
959
 
957
960
 
961
+
958
962
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
959
963
 
960
964
 
@@ -1107,6 +1111,7 @@
1107
1111
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1108
1112
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1109
1113
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1114
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1110
1115
  <xsl:attribute name="display-align">center</xsl:attribute>
1111
1116
 
1112
1117
 
@@ -1125,6 +1130,7 @@
1125
1130
  <xsl:attribute name="display-align">center</xsl:attribute>
1126
1131
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1127
1132
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1133
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1128
1134
 
1129
1135
 
1130
1136
 
@@ -1209,7 +1215,8 @@
1209
1215
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1210
1216
 
1211
1217
 
1212
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1218
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1219
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1213
1220
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1214
1221
 
1215
1222
 
@@ -1221,6 +1228,8 @@
1221
1228
 
1222
1229
 
1223
1230
 
1231
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1232
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1224
1233
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1225
1234
 
1226
1235
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1321,7 +1330,7 @@
1321
1330
 
1322
1331
 
1323
1332
 
1324
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1333
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1325
1334
 
1326
1335
 
1327
1336
 
@@ -1508,6 +1517,8 @@
1508
1517
  </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1509
1518
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1510
1519
 
1520
+ <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
1521
+
1511
1522
 
1512
1523
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1513
1524
 
@@ -2021,22 +2032,32 @@
2021
2032
  <xsl:sort select="@displayorder" data-type="number"/>
2022
2033
  <xsl:apply-templates select="."/>
2023
2034
  </xsl:for-each>
2024
- </xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
2025
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2026
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2027
- <xsl:call-template name="replace_fo_inline">
2028
- <xsl:with-param name="text" select="$text"/>
2029
- </xsl:call-template>
2030
- </xsl:template><xsl:template name="replace_fo_inline">
2035
+ </xsl:template><xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable><xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable><xsl:template match="text()" name="text">
2036
+
2037
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2038
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
2039
+ <xsl:call-template name="replace_fo_inline_tags">
2040
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2041
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2042
+ <xsl:with-param name="text" select="$text"/>
2043
+ </xsl:call-template>
2044
+
2045
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2046
+ <xsl:param name="tag_open"/>
2047
+ <xsl:param name="tag_close"/>
2031
2048
  <xsl:param name="text"/>
2032
2049
  <xsl:choose>
2033
2050
  <xsl:when test="contains($text, $tag_open)">
2034
2051
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2035
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2052
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2036
2053
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2037
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2038
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2039
- <xsl:call-template name="replace_fo_inline">
2054
+ <fo:inline keep-together.within-line="always">
2055
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2056
+ </fo:inline>
2057
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2058
+ <xsl:call-template name="replace_fo_inline_tags">
2059
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2060
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2040
2061
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2041
2062
  </xsl:call-template>
2042
2063
  </xsl:when>
@@ -2044,6 +2065,39 @@
2044
2065
  </xsl:choose>
2045
2066
  </xsl:template><xsl:template match="*[local-name()='br']">
2046
2067
  <xsl:value-of select="$linebreak"/>
2068
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2069
+ <xsl:param name="split_keep-within-line"/>
2070
+
2071
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2072
+ <xsl:choose>
2073
+
2074
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2075
+ <xsl:variable name="sep">_</xsl:variable>
2076
+ <xsl:variable name="items">
2077
+ <xsl:call-template name="split">
2078
+ <xsl:with-param name="pText" select="."/>
2079
+ <xsl:with-param name="sep" select="$sep"/>
2080
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2081
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2082
+ </xsl:call-template>
2083
+ </xsl:variable>
2084
+ <xsl:for-each select="xalan:nodeset($items)/item">
2085
+ <xsl:choose>
2086
+ <xsl:when test=". = $sep">
2087
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2088
+ </xsl:when>
2089
+ <xsl:otherwise>
2090
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2091
+ </xsl:otherwise>
2092
+ </xsl:choose>
2093
+ </xsl:for-each>
2094
+ </xsl:when>
2095
+
2096
+ <xsl:otherwise>
2097
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2098
+ </xsl:otherwise>
2099
+
2100
+ </xsl:choose>
2047
2101
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2048
2102
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2049
2103
  <xsl:apply-templates/>
@@ -2109,8 +2163,23 @@
2109
2163
  </xsl:call-template>
2110
2164
 
2111
2165
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2112
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2113
- <xsl:call-template name="add-zero-spaces-java"/>
2166
+ <xsl:choose>
2167
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2168
+ <xsl:value-of select="."/>
2169
+ </xsl:when>
2170
+ <xsl:otherwise>
2171
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2172
+ </xsl:otherwise>
2173
+ </xsl:choose>
2174
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2175
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2176
+ <!-- <xsl:copy-of select="$text"/> -->
2177
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2178
+ <xsl:choose>
2179
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2180
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2181
+ </xsl:choose>
2182
+ </xsl:for-each>
2114
2183
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2115
2184
 
2116
2185
  <xsl:variable name="table-preamble">
@@ -2120,9 +2189,14 @@
2120
2189
 
2121
2190
  <xsl:variable name="table">
2122
2191
 
2123
- <xsl:variable name="simple-table">
2124
- <xsl:call-template name="getSimpleTable"/>
2192
+ <xsl:variable name="simple-table">
2193
+ <xsl:call-template name="getSimpleTable">
2194
+ <xsl:with-param name="id" select="@id"/>
2195
+ </xsl:call-template>
2125
2196
  </xsl:variable>
2197
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2198
+
2199
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2126
2200
 
2127
2201
 
2128
2202
  <!-- Display table's name before table as standalone block -->
@@ -2145,7 +2219,23 @@
2145
2219
  </xsl:call-template>
2146
2220
  </xsl:if>
2147
2221
  </xsl:variable>
2148
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2222
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2223
+
2224
+ <!-- DEBUG -->
2225
+ <xsl:if test="$table_if_debug = 'true'">
2226
+ <fo:block font-size="60%">
2227
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2228
+ </fo:block>
2229
+ </xsl:if>
2230
+
2231
+
2232
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2233
+
2234
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2235
+ DEBUG
2236
+ colwidths=<xsl:copy-of select="$colwidths"/>
2237
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2238
+
2149
2239
 
2150
2240
 
2151
2241
  <xsl:variable name="margin-side">
@@ -2212,9 +2302,17 @@
2212
2302
  </xsl:element>
2213
2303
  </xsl:variable>
2214
2304
 
2305
+ <xsl:if test="$isGenerateTableIF = 'true'">
2306
+ <!-- to determine start of table -->
2307
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2308
+ </xsl:if>
2215
2309
 
2216
2310
  <fo:table id="{@id}">
2217
2311
 
2312
+ <xsl:if test="$isGenerateTableIF = 'true'">
2313
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2314
+ </xsl:if>
2315
+
2218
2316
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2219
2317
  <xsl:attribute name="{local-name()}">
2220
2318
  <xsl:value-of select="."/>
@@ -2228,31 +2326,47 @@
2228
2326
 
2229
2327
 
2230
2328
  <xsl:choose>
2231
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2232
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2233
- <fo:table-column column-width="{@width}"/>
2234
- </xsl:for-each>
2329
+ <xsl:when test="$isGenerateTableIF = 'true'">
2330
+ <!-- generate IF for table widths -->
2331
+ <!-- example:
2332
+ <tr>
2333
+ <td valign="top" align="left" id="tab-symdu_1_1">
2334
+ <p>Symbol</p>
2335
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2336
+ </td>
2337
+ <td valign="top" align="left" id="tab-symdu_1_2">
2338
+ <p>Description</p>
2339
+ <word id="tab-symdu_1_2_word_1">Description</word>
2340
+ </td>
2341
+ </tr>
2342
+ -->
2343
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2344
+
2235
2345
  </xsl:when>
2236
2346
  <xsl:otherwise>
2237
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2238
- <xsl:choose>
2239
- <xsl:when test=". = 1 or . = 0">
2240
- <fo:table-column column-width="proportional-column-width(2)"/>
2241
- </xsl:when>
2242
- <xsl:otherwise>
2243
- <fo:table-column column-width="proportional-column-width({.})"/>
2244
- </xsl:otherwise>
2245
- </xsl:choose>
2246
- </xsl:for-each>
2247
- </xsl:otherwise>
2248
- </xsl:choose>
2249
2347
 
2250
- <xsl:choose>
2251
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2252
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2253
- </xsl:when>
2254
- <xsl:otherwise>
2255
- <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 -->
2348
+ <xsl:choose>
2349
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2350
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2351
+ <fo:table-column column-width="{@width}"/>
2352
+ </xsl:for-each>
2353
+ </xsl:when>
2354
+ <xsl:otherwise>
2355
+ <xsl:call-template name="insertTableColumnWidth">
2356
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2357
+ </xsl:call-template>
2358
+ </xsl:otherwise>
2359
+ </xsl:choose>
2360
+
2361
+ <xsl:choose>
2362
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2363
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2364
+ </xsl:when>
2365
+ <xsl:otherwise>
2366
+ <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 -->
2367
+ </xsl:otherwise>
2368
+ </xsl:choose>
2369
+
2256
2370
  </xsl:otherwise>
2257
2371
  </xsl:choose>
2258
2372
 
@@ -2355,11 +2469,22 @@
2355
2469
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2356
2470
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2357
2471
  </xsl:template><xsl:template name="calculate-column-widths">
2472
+ <xsl:param name="table"/>
2473
+ <xsl:param name="cols-count"/>
2474
+
2475
+ <xsl:call-template name="calculate-column-widths-proportional">
2476
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2477
+ <xsl:with-param name="table" select="$table"/>
2478
+ </xsl:call-template>
2479
+
2480
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2358
2481
  <xsl:param name="table"/>
2359
2482
  <xsl:param name="cols-count"/>
2360
2483
  <xsl:param name="curr-col" select="1"/>
2361
2484
  <xsl:param name="width" select="0"/>
2362
2485
 
2486
+ <!-- table=<xsl:copy-of select="$table"/> -->
2487
+
2363
2488
  <xsl:if test="$curr-col &lt;= $cols-count">
2364
2489
  <xsl:variable name="widths">
2365
2490
  <xsl:choose>
@@ -2397,16 +2522,22 @@
2397
2522
  </xsl:for-each>
2398
2523
  </xsl:when>
2399
2524
  <xsl:otherwise>
2400
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2525
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2526
+
2527
+ <!-- <table><xsl:copy-of select="$table"/></table>
2528
+ -->
2529
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2401
2530
  <xsl:variable name="td_text">
2402
2531
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2403
2532
  </xsl:variable>
2533
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2404
2534
  <xsl:variable name="words">
2405
2535
  <xsl:variable name="string_with_added_zerospaces">
2406
2536
  <xsl:call-template name="add-zero-spaces-java">
2407
2537
  <xsl:with-param name="text" select="$td_text"/>
2408
2538
  </xsl:call-template>
2409
2539
  </xsl:variable>
2540
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2410
2541
  <xsl:call-template name="tokenize">
2411
2542
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2412
2543
  <!-- 2009 thinspace -->
@@ -2414,11 +2545,13 @@
2414
2545
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2415
2546
  </xsl:call-template>
2416
2547
  </xsl:variable>
2548
+ <!-- words=<xsl:copy-of select="$words"/> -->
2417
2549
  <xsl:variable name="max_length">
2418
2550
  <xsl:call-template name="max_length">
2419
2551
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2420
2552
  </xsl:call-template>
2421
2553
  </xsl:variable>
2554
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2422
2555
  <width>
2423
2556
  <xsl:variable name="divider">
2424
2557
  <xsl:choose>
@@ -2437,6 +2570,8 @@
2437
2570
  </xsl:choose>
2438
2571
  </xsl:variable>
2439
2572
 
2573
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2574
+
2440
2575
  <column>
2441
2576
  <xsl:for-each select="xalan:nodeset($widths)//width">
2442
2577
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2445,29 +2580,327 @@
2445
2580
  </xsl:if>
2446
2581
  </xsl:for-each>
2447
2582
  </column>
2448
- <xsl:call-template name="calculate-column-widths">
2583
+ <xsl:call-template name="calculate-column-widths-proportional">
2449
2584
  <xsl:with-param name="cols-count" select="$cols-count"/>
2450
2585
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2451
2586
  <xsl:with-param name="table" select="$table"/>
2452
2587
  </xsl:call-template>
2453
2588
  </xsl:if>
2589
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2590
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2591
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2592
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2593
+
2594
+ <!-- if all capitals english letters or digits -->
2595
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2596
+ <xsl:call-template name="repeat">
2597
+ <xsl:with-param name="char" select="'X'"/>
2598
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2599
+ </xsl:call-template>
2600
+ </xsl:if>
2454
2601
  </xsl:template><xsl:template match="text()" mode="td_text">
2455
2602
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2456
2603
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2457
2604
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2458
2605
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2459
2606
  <xsl:value-of select="@target"/>
2460
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2461
- <xsl:variable name="mathml">
2462
- <xsl:for-each select="*">
2463
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2464
- <xsl:copy-of select="."/>
2607
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2608
+ <xsl:if test="$isGenerateTableIF = 'false'">
2609
+ <xsl:variable name="mathml_">
2610
+ <xsl:for-each select="*">
2611
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2612
+ <xsl:copy-of select="."/>
2613
+ </xsl:if>
2614
+ </xsl:for-each>
2615
+ </xsl:variable>
2616
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2617
+
2618
+ <xsl:variable name="math_text">
2619
+ <xsl:value-of select="normalize-space($mathml)"/>
2620
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2621
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2622
+ </xsl:variable>
2623
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2624
+ </xsl:if>
2625
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2626
+ <xsl:param name="table"/>
2627
+ <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
2628
+
2629
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2630
+
2631
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2632
+
2633
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2634
+
2635
+ <!-- get current table id -->
2636
+ <xsl:variable name="table_id" select="@id"/>
2637
+ <!-- find table by id in the file 'table_widths' -->
2638
+ <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2639
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
2640
+
2641
+
2642
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2643
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2644
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2645
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2646
+
2647
+ <xsl:variable name="table_with_cell_widths_">
2648
+ <xsl:choose>
2649
+ <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
2650
+
2651
+ <!-- Example: <column>10</column>
2652
+ <column>11</column>
2653
+ -->
2654
+ <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
2655
+ </xsl:when>
2656
+ <xsl:otherwise>
2657
+ <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
2658
+ </xsl:otherwise>
2659
+ </xsl:choose>
2660
+ </xsl:variable>
2661
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2662
+
2663
+ <xsl:if test="$table_if_debug = 'true'">
2664
+ <xsl:copy-of select="$table_with_cell_widths"/>
2665
+ </xsl:if>
2666
+
2667
+
2668
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2669
+
2670
+ <xsl:variable name="column_widths_">
2671
+ <!-- iteration of columns -->
2672
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2673
+ <xsl:variable name="pos" select="position()"/>
2674
+ <column>
2675
+ <xsl:attribute name="width_max">
2676
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2677
+ <xsl:sort select="." data-type="number" order="descending"/>
2678
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2679
+ </xsl:for-each>
2680
+ </xsl:attribute>
2681
+ <xsl:attribute name="width_min">
2682
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2683
+ <xsl:sort select="." data-type="number" order="descending"/>
2684
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2685
+ </xsl:for-each>
2686
+ </xsl:attribute>
2687
+ </column>
2688
+ </xsl:for-each>
2689
+ </xsl:variable>
2690
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2691
+
2692
+ <!-- <column_widths>
2693
+ <xsl:copy-of select="$column_widths"/>
2694
+ </column_widths> -->
2695
+
2696
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2697
+ <xsl:variable name="table_widths_">
2698
+ <table>
2699
+ <xsl:attribute name="width_max">
2700
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2701
+ </xsl:attribute>
2702
+ <xsl:attribute name="width_min">
2703
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2704
+ </xsl:attribute>
2705
+ </table>
2706
+ </xsl:variable>
2707
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2708
+
2709
+ <xsl:variable name="page_width">
2710
+ <xsl:choose>
2711
+ <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
2712
+ <xsl:otherwise>75</xsl:otherwise>
2713
+ </xsl:choose>
2714
+ </xsl:variable>
2715
+
2716
+ <xsl:if test="$table_if_debug = 'true'">
2717
+ <table_width>
2718
+ <xsl:copy-of select="$table_widths"/>
2719
+ </table_width>
2720
+ <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
2721
+ <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
2722
+ -->
2723
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2724
+ </xsl:if>
2725
+
2726
+
2727
+ <!-- There are three cases: -->
2728
+ <xsl:choose>
2729
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2730
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2731
+ <!-- call old algorithm -->
2732
+ <case1/>
2733
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2734
+ <xsl:call-template name="calculate-column-widths-proportional">
2735
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2736
+ <xsl:with-param name="table" select="$table"/>
2737
+ </xsl:call-template>
2738
+ </xsl:when>
2739
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2740
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2741
+ <case2/>
2742
+ <autolayout/>
2743
+ <xsl:for-each select="$column_widths/column/@width_max">
2744
+ <column divider="100"><xsl:value-of select="."/></column>
2745
+ </xsl:for-each>
2746
+ </xsl:when>
2747
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2748
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2749
+ Lets also call D the difference between maximum and minimum width of the table.
2750
+ For each column, let d be the difference between maximum and minimum width of that column.
2751
+ Now set the column's width to the minimum width plus d times W over D.
2752
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2753
+ <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)">
2754
+ <!-- difference between the available space and the minimum table width -->
2755
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2756
+ <W><xsl:value-of select="$W"/></W>
2757
+ <!-- difference between maximum and minimum width of the table -->
2758
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2759
+ <D><xsl:value-of select="$D"/></D>
2760
+ <case3/>
2761
+ <autolayout/>
2762
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2763
+ <split_keep-within-line>true</split_keep-within-line>
2764
+ </xsl:if>
2765
+ <xsl:for-each select="$column_widths/column">
2766
+ <!-- difference between maximum and minimum width of that column. -->
2767
+ <xsl:variable name="d" select="@width_max - @width_min"/>
2768
+ <d><xsl:value-of select="$d"/></d>
2769
+ <width_min><xsl:value-of select="@width_min"/></width_min>
2770
+ <e><xsl:value-of select="$d * $W div $D"/></e>
2771
+ <!-- set the column's width to the minimum width plus d times W over D. -->
2772
+ <column divider="100">
2773
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
2774
+ </column>
2775
+ </xsl:for-each>
2776
+
2777
+ </xsl:when>
2778
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
2779
+ </xsl:choose>
2780
+
2781
+
2782
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
2783
+ <xsl:copy>
2784
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
2785
+ </xsl:copy>
2786
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
2787
+ <xsl:copy>
2788
+ <xsl:copy-of select="@*"/>
2789
+
2790
+ <!-- The maximum width is given by the widest line. -->
2791
+ <xsl:variable name="widths_max">
2792
+ <xsl:for-each select=".//*[local-name() = 'p']">
2793
+ <xsl:call-template name="add_width"/>
2794
+ </xsl:for-each>
2795
+ <xsl:if test="not(*[local-name() = 'p'])">
2796
+ <xsl:call-template name="add_width"/>
2465
2797
  </xsl:if>
2798
+ </xsl:variable>
2799
+ <xsl:variable name="width_max">
2800
+ <xsl:for-each select="xalan:nodeset($widths_max)//width">
2801
+ <xsl:sort select="." data-type="number" order="descending"/>
2802
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2803
+ </xsl:for-each>
2804
+ </xsl:variable>
2805
+ <xsl:attribute name="width_max">
2806
+ <xsl:value-of select="$width_max"/>
2807
+ </xsl:attribute>
2808
+
2809
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2810
+ <!-- To do: image width -->
2811
+ <xsl:variable name="td_text">
2812
+ <xsl:apply-templates select="." mode="td_text"/>
2813
+ </xsl:variable>
2814
+ <xsl:variable name="words">
2815
+ <xsl:variable name="string_with_added_zerospaces">
2816
+ <xsl:call-template name="add-zero-spaces-java">
2817
+ <xsl:with-param name="text" select="$td_text"/>
2818
+ </xsl:call-template>
2819
+ </xsl:variable>
2820
+ <xsl:call-template name="tokenize">
2821
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2822
+ </xsl:call-template>
2823
+ </xsl:variable>
2824
+
2825
+ <xsl:variable name="max_word_length">
2826
+ <xsl:call-template name="max_length">
2827
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2828
+ </xsl:call-template>
2829
+ </xsl:variable>
2830
+ <xsl:variable name="width_min">
2831
+ <xsl:value-of select="$max_word_length"/>
2832
+ </xsl:variable>
2833
+ <xsl:attribute name="width_min">
2834
+ <xsl:value-of select="$width_min"/>
2835
+ </xsl:attribute>
2836
+ <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
2837
+ <xsl:if test="$width_min &gt; $width_max">
2838
+ <xsl:attribute name="width_max">
2839
+ <xsl:value-of select="$width_min"/>
2840
+ </xsl:attribute>
2841
+ </xsl:if>
2842
+ <xsl:if test="$width_min = 0">
2843
+ <xsl:attribute name="width_min">1</xsl:attribute>
2844
+ </xsl:if>
2845
+
2846
+ <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
2847
+
2848
+ </xsl:copy>
2849
+ </xsl:template><xsl:template name="add_width">
2850
+ <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
2851
+ <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
2852
+
2853
+ <xsl:variable name="p_text_len">
2854
+ <xsl:choose>
2855
+ <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
2856
+ <xsl:value-of select="$p_text_len_ * 1.5"/>
2857
+ </xsl:when>
2858
+ <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
2859
+ </xsl:choose>
2860
+ </xsl:variable>
2861
+
2862
+ <xsl:variable name="math_addon_text">
2863
+ <xsl:for-each select=".//*[local-name() = 'math']">
2864
+ <xsl:apply-templates mode="td_text"/>
2466
2865
  </xsl:for-each>
2467
2866
  </xsl:variable>
2867
+ <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
2468
2868
 
2469
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2470
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2869
+ <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
2870
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
2871
+ <xsl:copy>
2872
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
2873
+ </xsl:copy>
2874
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
2875
+ <xsl:copy>
2876
+ <xsl:copy-of select="@*"/>
2877
+
2878
+ <!-- The maximum width is given by the widest line. -->
2879
+ <xsl:attribute name="width_max">
2880
+ <xsl:for-each select="p_len">
2881
+ <xsl:sort select="." data-type="number" order="descending"/>
2882
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2883
+ </xsl:for-each>
2884
+ </xsl:attribute>
2885
+
2886
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2887
+ <xsl:variable name="width_min">
2888
+ <xsl:for-each select="word_len">
2889
+ <xsl:sort select="." data-type="number" order="descending"/>
2890
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2891
+ </xsl:for-each>
2892
+ </xsl:variable>
2893
+ <xsl:attribute name="width_min">
2894
+ <xsl:value-of select="$width_min"/>
2895
+ </xsl:attribute>
2896
+
2897
+ <xsl:if test="$width_min = 0">
2898
+ <xsl:attribute name="width_min">1</xsl:attribute>
2899
+ </xsl:if>
2900
+
2901
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
2902
+
2903
+ </xsl:copy>
2471
2904
  </xsl:template><xsl:template match="*[local-name()='thead']">
2472
2905
  <xsl:param name="cols-count"/>
2473
2906
  <fo:table-header>
@@ -2552,16 +2985,10 @@
2552
2985
  </xsl:for-each>
2553
2986
  </xsl:when>
2554
2987
  <xsl:otherwise>
2555
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2556
- <xsl:choose>
2557
- <xsl:when test=". = 1 or . = 0">
2558
- <fo:table-column column-width="proportional-column-width(2)"/>
2559
- </xsl:when>
2560
- <xsl:otherwise>
2561
- <fo:table-column column-width="proportional-column-width({.})"/>
2562
- </xsl:otherwise>
2563
- </xsl:choose>
2564
- </xsl:for-each>
2988
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
2989
+ <xsl:call-template name="insertTableColumnWidth">
2990
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2991
+ </xsl:call-template>
2565
2992
  </xsl:otherwise>
2566
2993
  </xsl:choose>
2567
2994
 
@@ -2638,20 +3065,66 @@
2638
3065
 
2639
3066
  </fo:table-body>
2640
3067
 
2641
- </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2642
- <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3068
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3069
+ <xsl:param name="table_or_dl">table</xsl:param>
3070
+ <xsl:apply-templates mode="process_table-if">
3071
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3072
+ </xsl:apply-templates>
3073
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3074
+ <xsl:param name="table_or_dl">table</xsl:param>
2643
3075
 
2644
-
2645
-
2646
-
3076
+ <fo:table-body>
3077
+ <xsl:for-each select="*[local-name() = 'tr']">
3078
+ <xsl:variable name="col_count" select="count(*)"/>
2647
3079
 
2648
-
2649
-
2650
- <xsl:call-template name="setTableRowAttributes"/>
2651
-
2652
- <xsl:apply-templates/>
2653
- </fo:table-row>
2654
- </xsl:template><xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3080
+ <!-- iteration for each tr/td -->
3081
+
3082
+ <xsl:choose>
3083
+ <xsl:when test="$table_or_dl = 'table'">
3084
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3085
+ <fo:table-row number-columns-spanned="{$col_count}">
3086
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3087
+ <xsl:call-template name="td"/>
3088
+ </fo:table-row>
3089
+ </xsl:for-each>
3090
+ </xsl:when>
3091
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3092
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3093
+ <xsl:variable name="is_dt" select="position() = 1"/>
3094
+
3095
+ <xsl:for-each select="*">
3096
+ <!-- <test><xsl:copy-of select="."/></test> -->
3097
+ <fo:table-row number-columns-spanned="{$col_count}">
3098
+ <xsl:choose>
3099
+ <xsl:when test="$is_dt">
3100
+ <xsl:call-template name="insert_dt_cell"/>
3101
+ </xsl:when>
3102
+ <xsl:otherwise>
3103
+ <xsl:call-template name="insert_dd_cell"/>
3104
+ </xsl:otherwise>
3105
+ </xsl:choose>
3106
+ </fo:table-row>
3107
+ </xsl:for-each>
3108
+ </xsl:for-each>
3109
+ </xsl:otherwise>
3110
+ </xsl:choose>
3111
+
3112
+ </xsl:for-each>
3113
+ </fo:table-body>
3114
+ </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3115
+ <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3116
+
3117
+
3118
+
3119
+
3120
+
3121
+
3122
+
3123
+ <xsl:call-template name="setTableRowAttributes"/>
3124
+
3125
+ <xsl:apply-templates/>
3126
+ </fo:table-row>
3127
+ </xsl:template><xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
2655
3128
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
2656
3129
 
2657
3130
  <xsl:call-template name="setTableRowAttributes"/>
@@ -2724,7 +3197,7 @@
2724
3197
  </xsl:choose>
2725
3198
  </xsl:attribute>
2726
3199
  </xsl:if>
2727
- </xsl:template><xsl:template match="*[local-name()='td']">
3200
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2728
3201
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2729
3202
  <xsl:call-template name="setTextAlignment">
2730
3203
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2758,11 +3231,24 @@
2758
3231
 
2759
3232
  <xsl:call-template name="setTableCellAttributes"/>
2760
3233
 
3234
+ <xsl:if test="$isGenerateTableIF = 'true'">
3235
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3236
+ <xsl:attribute name="text-align">left</xsl:attribute>
3237
+ </xsl:if>
3238
+
2761
3239
  <fo:block>
2762
3240
 
3241
+ <xsl:if test="$isGenerateTableIF = 'true'">
3242
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3243
+ </xsl:if>
3244
+
3245
+
2763
3246
 
2764
3247
 
2765
3248
  <xsl:apply-templates/>
3249
+
3250
+ <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"/> -->
3251
+
2766
3252
  </fo:block>
2767
3253
  </fo:table-cell>
2768
3254
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -2959,9 +3445,9 @@
2959
3445
  <!-- current hierarchy is 'figure' element -->
2960
3446
  <xsl:variable name="following_dl_colwidths">
2961
3447
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2962
- <xsl:variable name="html-table">
2963
- <xsl:variable name="doc_ns">
2964
-
3448
+ <xsl:variable name="simple-table">
3449
+ <!-- <xsl:variable name="doc_ns">
3450
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
2965
3451
  </xsl:variable>
2966
3452
  <xsl:variable name="ns">
2967
3453
  <xsl:choose>
@@ -2972,7 +3458,7 @@
2972
3458
  <xsl:value-of select="substring-before(name(/*), '-')"/>
2973
3459
  </xsl:otherwise>
2974
3460
  </xsl:choose>
2975
- </xsl:variable>
3461
+ </xsl:variable> -->
2976
3462
 
2977
3463
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2978
3464
  <tbody>
@@ -2983,7 +3469,7 @@
2983
3469
 
2984
3470
  <xsl:call-template name="calculate-column-widths">
2985
3471
  <xsl:with-param name="cols-count" select="2"/>
2986
- <xsl:with-param name="table" select="$html-table"/>
3472
+ <xsl:with-param name="table" select="$simple-table"/>
2987
3473
  </xsl:call-template>
2988
3474
 
2989
3475
  </xsl:if>
@@ -3102,8 +3588,10 @@
3102
3588
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3103
3589
  </xsl:variable>
3104
3590
 
3591
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3592
+
3105
3593
  <xsl:choose>
3106
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3594
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3107
3595
 
3108
3596
  <fo:block margin-bottom="12pt" text-align="left">
3109
3597
 
@@ -3118,7 +3606,7 @@
3118
3606
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3119
3607
  </fo:block>
3120
3608
 
3121
- </xsl:when>
3609
+ </xsl:when> <!-- END: only one component -->
3122
3610
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3123
3611
  <fo:block margin-bottom="12pt" text-align="left">
3124
3612
 
@@ -3132,8 +3620,8 @@
3132
3620
  </xsl:variable>
3133
3621
  <xsl:value-of select="$title-where"/>
3134
3622
  </fo:block>
3135
- </xsl:when>
3136
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3623
+ </xsl:when> <!-- END: a few components -->
3624
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3137
3625
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3138
3626
 
3139
3627
 
@@ -3146,11 +3634,11 @@
3146
3634
  </xsl:variable>
3147
3635
  <xsl:value-of select="$title-key"/>
3148
3636
  </fo:block>
3149
- </xsl:when>
3637
+ </xsl:when> <!-- END: definition list in a figure -->
3150
3638
  </xsl:choose>
3151
3639
 
3152
3640
  <!-- a few components -->
3153
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3641
+ <xsl:if test="$onlyOneComponent = 'false'">
3154
3642
  <fo:block>
3155
3643
 
3156
3644
 
@@ -3161,7 +3649,18 @@
3161
3649
 
3162
3650
 
3163
3651
 
3652
+
3653
+ <xsl:if test="$isGenerateTableIF = 'true'">
3654
+ <!-- to determine start of table -->
3655
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3656
+ </xsl:if>
3657
+
3164
3658
  <fo:table width="95%" table-layout="fixed">
3659
+
3660
+ <xsl:if test="$isGenerateTableIF = 'true'">
3661
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3662
+ </xsl:if>
3663
+
3165
3664
 
3166
3665
  <xsl:choose>
3167
3666
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3170,54 +3669,143 @@
3170
3669
 
3171
3670
  </xsl:when>
3172
3671
  </xsl:choose>
3173
- <!-- create virtual html table for dl/[dt and dd] -->
3174
- <xsl:variable name="html-table">
3175
- <xsl:variable name="doc_ns">
3672
+
3673
+
3674
+ <xsl:choose>
3675
+ <xsl:when test="$isGenerateTableIF = 'true'">
3676
+ <!-- generate IF for table widths -->
3677
+ <!-- example:
3678
+ <tr>
3679
+ <td valign="top" align="left" id="tab-symdu_1_1">
3680
+ <p>Symbol</p>
3681
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3682
+ </td>
3683
+ <td valign="top" align="left" id="tab-symdu_1_2">
3684
+ <p>Description</p>
3685
+ <word id="tab-symdu_1_2_word_1">Description</word>
3686
+ </td>
3687
+ </tr>
3688
+ -->
3176
3689
 
3177
- </xsl:variable>
3178
- <xsl:variable name="ns">
3179
- <xsl:choose>
3180
- <xsl:when test="normalize-space($doc_ns) != ''">
3181
- <xsl:value-of select="normalize-space($doc_ns)"/>
3182
- </xsl:when>
3183
- <xsl:otherwise>
3184
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3185
- </xsl:otherwise>
3186
- </xsl:choose>
3187
- </xsl:variable>
3188
- <tbody>
3189
- <xsl:apply-templates mode="dl"/>
3190
- </tbody>
3191
- </xsl:variable>
3192
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3193
- <xsl:variable name="colwidths">
3194
- <xsl:call-template name="calculate-column-widths">
3195
- <xsl:with-param name="cols-count" select="2"/>
3196
- <xsl:with-param name="table" select="$html-table"/>
3197
- </xsl:call-template>
3198
- </xsl:variable>
3199
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3200
- <xsl:variable name="maxlength_dt">
3201
- <xsl:call-template name="getMaxLength_dt"/>
3202
- </xsl:variable>
3203
- <xsl:call-template name="setColumnWidth_dl">
3204
- <xsl:with-param name="colwidths" select="$colwidths"/>
3205
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3206
- </xsl:call-template>
3207
- <fo:table-body>
3208
- <xsl:apply-templates>
3209
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3210
- </xsl:apply-templates>
3211
- </fo:table-body>
3690
+ <!-- create virtual html table for dl/[dt and dd] -->
3691
+ <xsl:variable name="simple-table">
3692
+
3693
+ <xsl:variable name="dl_table">
3694
+ <tbody>
3695
+ <xsl:apply-templates mode="dl_if">
3696
+ <xsl:with-param name="id" select="@id"/>
3697
+ </xsl:apply-templates>
3698
+ </tbody>
3699
+ </xsl:variable>
3700
+
3701
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3702
+
3703
+ <!-- Step: replace <br/> to <p>...</p> -->
3704
+ <xsl:variable name="table_without_br">
3705
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3706
+ </xsl:variable>
3707
+
3708
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3709
+
3710
+ <!-- Step: add id to each cell -->
3711
+ <!-- add <word>...</word> for each word, image, math -->
3712
+ <xsl:variable name="simple-table-id">
3713
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3714
+ <xsl:with-param name="id" select="@id"/>
3715
+ </xsl:apply-templates>
3716
+ </xsl:variable>
3717
+
3718
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3719
+
3720
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3721
+
3722
+ </xsl:variable>
3723
+
3724
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3725
+
3726
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3727
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3728
+ </xsl:apply-templates>
3729
+
3730
+ </xsl:when>
3731
+ <xsl:otherwise>
3732
+
3733
+ <xsl:variable name="simple-table">
3734
+
3735
+ <xsl:variable name="dl_table">
3736
+ <tbody>
3737
+ <xsl:apply-templates mode="dl">
3738
+ <xsl:with-param name="id" select="@id"/>
3739
+ </xsl:apply-templates>
3740
+ </tbody>
3741
+ </xsl:variable>
3742
+
3743
+ <xsl:copy-of select="$dl_table"/>
3744
+ </xsl:variable>
3745
+
3746
+ <xsl:variable name="colwidths">
3747
+ <xsl:call-template name="calculate-column-widths">
3748
+ <xsl:with-param name="cols-count" select="2"/>
3749
+ <xsl:with-param name="table" select="$simple-table"/>
3750
+ </xsl:call-template>
3751
+ </xsl:variable>
3752
+
3753
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3754
+ DEBUG
3755
+ colwidths=<xsl:copy-of select="$colwidths"/>
3756
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3757
+
3758
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3759
+
3760
+ <xsl:variable name="maxlength_dt">
3761
+ <xsl:call-template name="getMaxLength_dt"/>
3762
+ </xsl:variable>
3763
+
3764
+ <xsl:variable name="isContainsKeepTogetherTag_">
3765
+ false
3766
+ </xsl:variable>
3767
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3768
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3769
+
3770
+
3771
+ <xsl:call-template name="setColumnWidth_dl">
3772
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3773
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3774
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3775
+ </xsl:call-template>
3776
+
3777
+ <fo:table-body>
3778
+
3779
+ <!-- DEBUG -->
3780
+ <xsl:if test="$table_if_debug = 'true'">
3781
+ <fo:table-row>
3782
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
3783
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3784
+ </fo:table-cell>
3785
+ </fo:table-row>
3786
+ </xsl:if>
3787
+
3788
+ <xsl:apply-templates>
3789
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3790
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
3791
+ </xsl:apply-templates>
3792
+
3793
+ </fo:table-body>
3794
+ </xsl:otherwise>
3795
+ </xsl:choose>
3212
3796
  </fo:table>
3213
3797
  </fo:block>
3214
3798
  </fo:block>
3215
- </xsl:if>
3799
+ </xsl:if> <!-- END: a few components -->
3216
3800
  </fo:block-container>
3217
3801
  </fo:block-container>
3218
3802
  </xsl:template><xsl:template name="setColumnWidth_dl">
3219
3803
  <xsl:param name="colwidths"/>
3220
3804
  <xsl:param name="maxlength_dt"/>
3805
+ <xsl:param name="isContainsKeepTogetherTag"/>
3806
+
3807
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
3808
+
3221
3809
  <xsl:choose>
3222
3810
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3223
3811
  <fo:table-column column-width="50%"/>
@@ -3225,6 +3813,16 @@
3225
3813
  </xsl:when>
3226
3814
  <xsl:otherwise>
3227
3815
  <xsl:choose>
3816
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3817
+ <xsl:call-template name="insertTableColumnWidth">
3818
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3819
+ </xsl:call-template>
3820
+ </xsl:when>
3821
+ <xsl:when test="$isContainsKeepTogetherTag">
3822
+ <xsl:call-template name="insertTableColumnWidth">
3823
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3824
+ </xsl:call-template>
3825
+ </xsl:when>
3228
3826
  <!-- to set width check most wide chars like `W` -->
3229
3827
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3230
3828
  <fo:table-column column-width="7%"/>
@@ -3255,20 +3853,31 @@
3255
3853
  <fo:table-column column-width="60%"/>
3256
3854
  </xsl:when>
3257
3855
  <xsl:otherwise>
3258
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3259
- <xsl:choose>
3260
- <xsl:when test=". = 1 or . = 0">
3261
- <fo:table-column column-width="proportional-column-width(2)"/>
3262
- </xsl:when>
3263
- <xsl:otherwise>
3264
- <fo:table-column column-width="proportional-column-width({.})"/>
3265
- </xsl:otherwise>
3266
- </xsl:choose>
3267
- </xsl:for-each>
3856
+ <xsl:call-template name="insertTableColumnWidth">
3857
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3858
+ </xsl:call-template>
3268
3859
  </xsl:otherwise>
3269
3860
  </xsl:choose>
3270
3861
  </xsl:otherwise>
3271
3862
  </xsl:choose>
3863
+ </xsl:template><xsl:template name="insertTableColumnWidth">
3864
+ <xsl:param name="colwidths"/>
3865
+
3866
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3867
+ <xsl:choose>
3868
+ <xsl:when test=". = 1 or . = 0">
3869
+ <fo:table-column column-width="proportional-column-width(2)"/>
3870
+ </xsl:when>
3871
+ <xsl:otherwise>
3872
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
3873
+ <xsl:variable name="divider">
3874
+ <xsl:value-of select="@divider"/>
3875
+ <xsl:if test="not(@divider)">1</xsl:if>
3876
+ </xsl:variable>
3877
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3878
+ </xsl:otherwise>
3879
+ </xsl:choose>
3880
+ </xsl:for-each>
3272
3881
  </xsl:template><xsl:template name="getMaxLength_dt">
3273
3882
  <xsl:variable name="lengths">
3274
3883
  <xsl:for-each select="*[local-name()='dt']">
@@ -3292,7 +3901,6 @@
3292
3901
  <xsl:value-of select="$maxLength"/>
3293
3902
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3294
3903
  <xsl:param name="key_iso"/>
3295
-
3296
3904
  <!-- <tr>
3297
3905
  <td>NOTE</td>
3298
3906
  <td>
@@ -3300,27 +3908,47 @@
3300
3908
  </td>
3301
3909
  </tr>
3302
3910
  -->
3303
- <fo:table-row>
3911
+ <!-- OLD Variant -->
3912
+ <!-- <fo:table-row>
3304
3913
  <fo:table-cell>
3305
3914
  <fo:block margin-top="6pt">
3306
3915
  <xsl:if test="normalize-space($key_iso) = 'true'">
3307
3916
  <xsl:attribute name="margin-top">0</xsl:attribute>
3308
3917
  </xsl:if>
3309
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3918
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3310
3919
  </fo:block>
3311
3920
  </fo:table-cell>
3312
3921
  <fo:table-cell>
3313
3922
  <fo:block>
3314
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3923
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
3924
+ </fo:block>
3925
+ </fo:table-cell>
3926
+ </fo:table-row> -->
3927
+ <!-- <tr>
3928
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
3929
+ </tr>
3930
+ -->
3931
+ <fo:table-row>
3932
+ <fo:table-cell number-columns-spanned="2">
3933
+ <fo:block>
3934
+ <xsl:call-template name="note"/>
3315
3935
  </fo:block>
3316
3936
  </fo:table-cell>
3317
3937
  </fo:table-row>
3318
3938
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3939
+ <xsl:param name="id"/>
3940
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3319
3941
  <tr>
3320
3942
  <td>
3943
+ <xsl:attribute name="id">
3944
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
3945
+ </xsl:attribute>
3321
3946
  <xsl:apply-templates/>
3322
3947
  </td>
3323
3948
  <td>
3949
+ <xsl:attribute name="id">
3950
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
3951
+ </xsl:attribute>
3324
3952
 
3325
3953
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3326
3954
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3331,50 +3959,122 @@
3331
3959
 
3332
3960
  </xsl:template><xsl:template match="*[local-name()='dt']">
3333
3961
  <xsl:param name="key_iso"/>
3962
+ <xsl:param name="split_keep-within-line"/>
3334
3963
 
3335
3964
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3336
- <fo:table-cell>
3965
+ <xsl:call-template name="insert_dt_cell">
3966
+ <xsl:with-param name="key_iso" select="$key_iso"/>
3967
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
3968
+ </xsl:call-template>
3969
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
3970
+ <xsl:call-template name="insert_dd_cell">
3971
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
3972
+ </xsl:call-template>
3973
+ </xsl:for-each>
3974
+ </fo:table-row>
3975
+ </xsl:template><xsl:template name="insert_dt_cell">
3976
+ <xsl:param name="key_iso"/>
3977
+ <xsl:param name="split_keep-within-line"/>
3978
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
3979
+
3980
+ <xsl:if test="$isGenerateTableIF = 'true'">
3981
+ <!-- border is mandatory, to calculate real width -->
3982
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
3983
+ <xsl:attribute name="text-align">left</xsl:attribute>
3984
+ </xsl:if>
3985
+
3986
+
3987
+ <fo:block xsl:use-attribute-sets="dt-block-style">
3988
+ <xsl:copy-of select="@id"/>
3989
+
3990
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3991
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3992
+ </xsl:if>
3993
+
3994
+
3995
+
3996
+ <xsl:apply-templates>
3997
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
3998
+ </xsl:apply-templates>
3999
+
4000
+ <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"/> -->
4001
+
4002
+ </fo:block>
4003
+ </fo:table-cell>
4004
+ </xsl:template><xsl:template name="insert_dd_cell">
4005
+ <xsl:param name="split_keep-within-line"/>
4006
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4007
+
4008
+ <xsl:if test="$isGenerateTableIF = 'true'">
4009
+ <!-- border is mandatory, to calculate real width -->
4010
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4011
+ </xsl:if>
4012
+
4013
+ <fo:block>
4014
+
4015
+ <xsl:if test="$isGenerateTableIF = 'true'">
4016
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4017
+ </xsl:if>
4018
+
3337
4019
 
3338
- <fo:block xsl:use-attribute-sets="dt-style">
3339
- <xsl:copy-of select="@id"/>
3340
-
3341
- <xsl:if test="normalize-space($key_iso) = 'true'">
3342
- <xsl:attribute name="margin-top">0</xsl:attribute>
3343
- </xsl:if>
3344
-
3345
-
3346
-
3347
- <xsl:apply-templates/>
3348
- </fo:block>
3349
- </fo:table-cell>
3350
- <fo:table-cell>
3351
- <fo:block>
3352
-
3353
4020
 
3354
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3355
- <xsl:with-param name="process">true</xsl:with-param>
3356
- </xsl:apply-templates>
3357
- </fo:block>
3358
- </fo:table-cell>
3359
- </fo:table-row>
4021
+ <xsl:choose>
4022
+ <xsl:when test="$isGenerateTableIF = 'true'">
4023
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4024
+ <xsl:with-param name="process">true</xsl:with-param>
4025
+ </xsl:apply-templates>
4026
+ </xsl:when>
4027
+ <xsl:otherwise>
4028
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4029
+ <xsl:with-param name="process">true</xsl:with-param>
4030
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4031
+ </xsl:apply-templates>
4032
+ </xsl:otherwise>
4033
+
4034
+ </xsl:choose>
4035
+
4036
+ <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"/> -->
4037
+
4038
+ </fo:block>
4039
+ </fo:table-cell>
3360
4040
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3361
4041
  <xsl:apply-templates/>
3362
4042
  </xsl:template><xsl:template match="*[local-name()='dd']">
3363
4043
  <xsl:param name="process">false</xsl:param>
4044
+ <xsl:param name="split_keep-within-line"/>
3364
4045
  <xsl:if test="$process = 'true'">
3365
4046
  <xsl:apply-templates select="@language"/>
3366
- <xsl:apply-templates/>
4047
+ <xsl:apply-templates>
4048
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4049
+ </xsl:apply-templates>
3367
4050
  </xsl:if>
3368
4051
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3369
4052
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3370
- </xsl:template><xsl:template match="*[local-name()='em']">
4053
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4054
+ <xsl:param name="id"/>
4055
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4056
+ <tr>
4057
+ <td>
4058
+ <xsl:copy-of select="node()"/>
4059
+ </td>
4060
+ <td>
4061
+
4062
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
4063
+
4064
+ </td>
4065
+ </tr>
4066
+
4067
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
3371
4068
  <fo:inline font-style="italic">
3372
4069
  <xsl:apply-templates/>
3373
4070
  </fo:inline>
3374
4071
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4072
+ <xsl:param name="split_keep-within-line"/>
3375
4073
  <fo:inline font-weight="bold">
3376
4074
 
3377
- <xsl:apply-templates/>
4075
+ <xsl:apply-templates>
4076
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4077
+ </xsl:apply-templates>
3378
4078
  </fo:inline>
3379
4079
  </xsl:template><xsl:template match="*[local-name()='padding']">
3380
4080
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3418,13 +4118,15 @@
3418
4118
  <xsl:choose>
3419
4119
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3420
4120
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3421
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4121
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3422
4122
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3423
4123
  </xsl:choose>
3424
4124
  </xsl:attribute>
3425
4125
  </xsl:if>
3426
4126
  <xsl:apply-templates/>
3427
4127
  </fo:inline>
4128
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4129
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3428
4130
  </xsl:template><xsl:template match="*[local-name()='underline']">
3429
4131
  <fo:inline text-decoration="underline">
3430
4132
  <xsl:apply-templates/>
@@ -3572,54 +4274,120 @@
3572
4274
  <fo:block break-after="page"/>
3573
4275
  <fo:block> </fo:block>
3574
4276
  <fo:block break-after="page"/>
4277
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
4278
+ <xsl:apply-templates/>
3575
4279
  </xsl:template><xsl:template name="tokenize">
3576
4280
  <xsl:param name="text"/>
3577
4281
  <xsl:param name="separator" select="' '"/>
3578
4282
  <xsl:choose>
4283
+
4284
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4285
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4286
+ </xsl:when>
3579
4287
  <xsl:when test="not(contains($text, $separator))">
3580
4288
  <word>
3581
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3582
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3583
4289
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3584
- <xsl:variable name="len_str">
3585
- <xsl:choose>
3586
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3587
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3588
- </xsl:when>
3589
- <xsl:otherwise>
3590
- <xsl:value-of select="$len_str_tmp"/>
3591
- </xsl:otherwise>
3592
- </xsl:choose>
3593
- </xsl:variable>
3594
-
3595
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3596
- <xsl:message>
3597
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3598
- len_str=<xsl:value-of select="$len_str"/>
3599
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3600
- </xsl:message>
3601
- </xsl:if> -->
3602
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3603
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3604
4290
  <xsl:choose>
3605
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3606
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4291
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
4292
+ <xsl:value-of select="$len_str_tmp"/>
3607
4293
  </xsl:when>
3608
4294
  <xsl:otherwise>
3609
- <xsl:value-of select="$len_str"/>
4295
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4296
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4297
+ <xsl:variable name="len_str">
4298
+ <xsl:choose>
4299
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4300
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
4301
+ </xsl:when>
4302
+ <xsl:otherwise>
4303
+ <xsl:value-of select="$len_str_tmp"/>
4304
+ </xsl:otherwise>
4305
+ </xsl:choose>
4306
+ </xsl:variable>
4307
+
4308
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4309
+ <xsl:message>
4310
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4311
+ len_str=<xsl:value-of select="$len_str"/>
4312
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4313
+ </xsl:message>
4314
+ </xsl:if> -->
4315
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4316
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
4317
+ <xsl:choose>
4318
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4319
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4320
+ </xsl:when>
4321
+ <xsl:otherwise>
4322
+ <xsl:value-of select="$len_str"/>
4323
+ </xsl:otherwise>
4324
+ </xsl:choose>
3610
4325
  </xsl:otherwise>
3611
4326
  </xsl:choose>
3612
4327
  </word>
3613
4328
  </xsl:when>
3614
4329
  <xsl:otherwise>
3615
4330
  <word>
3616
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4331
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4332
+ <xsl:choose>
4333
+ <xsl:when test="$isGenerateTableIF = 'true'">
4334
+ <xsl:value-of select="$word"/>
4335
+ </xsl:when>
4336
+ <xsl:otherwise>
4337
+ <xsl:value-of select="string-length($word)"/>
4338
+ </xsl:otherwise>
4339
+ </xsl:choose>
3617
4340
  </word>
3618
4341
  <xsl:call-template name="tokenize">
3619
4342
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3620
4343
  </xsl:call-template>
3621
4344
  </xsl:otherwise>
3622
4345
  </xsl:choose>
4346
+ </xsl:template><xsl:template name="tokenize_with_tags">
4347
+ <xsl:param name="tags"/>
4348
+ <xsl:param name="text"/>
4349
+ <xsl:param name="separator" select="' '"/>
4350
+ <xsl:choose>
4351
+
4352
+ <xsl:when test="not(contains($text, $separator))">
4353
+ <word>
4354
+ <xsl:call-template name="enclose_text_in_tags">
4355
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4356
+ <xsl:with-param name="tags" select="$tags"/>
4357
+ </xsl:call-template>
4358
+ </word>
4359
+ </xsl:when>
4360
+ <xsl:otherwise>
4361
+ <word>
4362
+ <xsl:call-template name="enclose_text_in_tags">
4363
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4364
+ <xsl:with-param name="tags" select="$tags"/>
4365
+ </xsl:call-template>
4366
+ </word>
4367
+ <xsl:call-template name="tokenize_with_tags">
4368
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4369
+ </xsl:call-template>
4370
+ </xsl:otherwise>
4371
+ </xsl:choose>
4372
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4373
+ <xsl:param name="text"/>
4374
+ <xsl:param name="tags"/>
4375
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4376
+
4377
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4378
+
4379
+ <xsl:choose>
4380
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4381
+ <xsl:otherwise>
4382
+ <xsl:element name="{$tag_name}">
4383
+ <xsl:call-template name="enclose_text_in_tags">
4384
+ <xsl:with-param name="text" select="$text"/>
4385
+ <xsl:with-param name="tags" select="$tags"/>
4386
+ <xsl:with-param name="num" select="$num + 1"/>
4387
+ </xsl:call-template>
4388
+ </xsl:element>
4389
+ </xsl:otherwise>
4390
+ </xsl:choose>
3623
4391
  </xsl:template><xsl:template name="max_length">
3624
4392
  <xsl:param name="words"/>
3625
4393
  <xsl:for-each select="$words//word">
@@ -3692,36 +4460,47 @@
3692
4460
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3693
4461
  <xsl:param name="text" select="."/>
3694
4462
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4463
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3695
4464
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4465
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3696
4466
  <xsl:variable name="zero-space">​</xsl:variable>
3697
4467
  <xsl:choose>
3698
4468
  <xsl:when test="contains($text, $zero-space-after-equals)">
3699
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4469
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3700
4470
  <xsl:value-of select="$zero-space-after-equals"/>
3701
4471
  <xsl:value-of select="$zero-space"/>
3702
4472
  <xsl:call-template name="add-zero-spaces-equal">
3703
4473
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3704
- </xsl:call-template>
4474
+ </xsl:call-template> -->
4475
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3705
4476
  </xsl:when>
3706
4477
  <xsl:when test="contains($text, $zero-space-after-equal)">
3707
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4478
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3708
4479
  <xsl:value-of select="$zero-space-after-equal"/>
3709
4480
  <xsl:value-of select="$zero-space"/>
3710
4481
  <xsl:call-template name="add-zero-spaces-equal">
3711
4482
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3712
- </xsl:call-template>
4483
+ </xsl:call-template> -->
4484
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3713
4485
  </xsl:when>
3714
4486
  <xsl:otherwise>
3715
4487
  <xsl:value-of select="$text"/>
3716
4488
  </xsl:otherwise>
3717
4489
  </xsl:choose>
3718
4490
  </xsl:template><xsl:template name="getSimpleTable">
4491
+ <xsl:param name="id"/>
4492
+
3719
4493
  <xsl:variable name="simple-table">
3720
4494
 
4495
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4496
+ <xsl:variable name="table_without_br">
4497
+ <xsl:apply-templates mode="table-without-br"/>
4498
+ </xsl:variable>
4499
+
3721
4500
  <!-- Step 1. colspan processing -->
3722
4501
  <xsl:variable name="simple-table-colspan">
3723
4502
  <tbody>
3724
- <xsl:apply-templates mode="simple-table-colspan"/>
4503
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3725
4504
  </tbody>
3726
4505
  </xsl:variable>
3727
4506
 
@@ -3730,10 +4509,67 @@
3730
4509
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3731
4510
  </xsl:variable>
3732
4511
 
3733
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3734
-
4512
+ <!-- Step 3: add id to each cell -->
4513
+ <!-- add <word>...</word> for each word, image, math -->
4514
+ <xsl:variable name="simple-table-id">
4515
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4516
+ <xsl:with-param name="id" select="$id"/>
4517
+ </xsl:apply-templates>
4518
+ </xsl:variable>
4519
+
4520
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4521
+
3735
4522
  </xsl:variable>
3736
4523
  <xsl:copy-of select="$simple-table"/>
4524
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4525
+ <xsl:copy>
4526
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4527
+ </xsl:copy>
4528
+ </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">
4529
+ <xsl:copy>
4530
+ <xsl:copy-of select="@*"/>
4531
+ <p>
4532
+ <xsl:copy-of select="node()"/>
4533
+ </p>
4534
+ </xsl:copy>
4535
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4536
+ <xsl:copy>
4537
+ <xsl:copy-of select="@*"/>
4538
+ <xsl:for-each select="*[local-name()='br']">
4539
+ <xsl:variable name="current_id" select="generate-id()"/>
4540
+ <p>
4541
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4542
+ <xsl:copy-of select="."/>
4543
+ </xsl:for-each>
4544
+ </p>
4545
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4546
+ <p>
4547
+ <xsl:for-each select="following-sibling::node()">
4548
+ <xsl:copy-of select="."/>
4549
+ </xsl:for-each>
4550
+ </p>
4551
+ </xsl:if>
4552
+ </xsl:for-each>
4553
+ </xsl:copy>
4554
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4555
+ <xsl:for-each select="*[local-name()='br']">
4556
+ <xsl:variable name="current_id" select="generate-id()"/>
4557
+ <p>
4558
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4559
+ <xsl:copy-of select="."/>
4560
+ </xsl:for-each>
4561
+ </p>
4562
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4563
+ <p>
4564
+ <xsl:for-each select="following-sibling::node()">
4565
+ <xsl:copy-of select="."/>
4566
+ </xsl:for-each>
4567
+ </p>
4568
+ </xsl:if>
4569
+ </xsl:for-each>
4570
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4571
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4572
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3737
4573
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3738
4574
  <xsl:apply-templates mode="simple-table-colspan"/>
3739
4575
  </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">
@@ -3823,6 +4659,126 @@
3823
4659
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3824
4660
  <xsl:with-param name="previousRow" select="$newRow"/>
3825
4661
  </xsl:apply-templates>
4662
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4663
+ <xsl:param name="id"/>
4664
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4665
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4666
+ <xsl:with-param name="id" select="$id_prefixed"/>
4667
+ </xsl:apply-templates>
4668
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4669
+ <xsl:param name="id"/>
4670
+ <xsl:copy>
4671
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4672
+ <xsl:with-param name="id" select="$id"/>
4673
+ </xsl:apply-templates>
4674
+ </xsl:copy>
4675
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4676
+ <xsl:param name="id"/>
4677
+ <xsl:copy>
4678
+ <xsl:copy-of select="@*"/>
4679
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4680
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4681
+ <xsl:with-param name="id" select="$id"/>
4682
+ </xsl:apply-templates>
4683
+ </xsl:copy>
4684
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4685
+ <xsl:param name="id"/>
4686
+ <xsl:copy>
4687
+ <xsl:copy-of select="@*"/>
4688
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4689
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4690
+ <xsl:attribute name="id">
4691
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4692
+ </xsl:attribute>
4693
+
4694
+ <xsl:for-each select="*[local-name() = 'p']">
4695
+ <xsl:copy>
4696
+ <xsl:copy-of select="@*"/>
4697
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4698
+ <xsl:attribute name="id">
4699
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4700
+ </xsl:attribute>
4701
+
4702
+ <xsl:copy-of select="node()"/>
4703
+ </xsl:copy>
4704
+ </xsl:for-each>
4705
+
4706
+
4707
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4708
+
4709
+ <xsl:variable name="td_text">
4710
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4711
+ </xsl:variable>
4712
+
4713
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4714
+
4715
+ <xsl:variable name="words">
4716
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4717
+ <word>
4718
+ <xsl:copy-of select="."/>
4719
+ </word>
4720
+ </xsl:for-each>
4721
+
4722
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4723
+ <xsl:copy-of select="."/>
4724
+ </xsl:for-each>
4725
+
4726
+ </xsl:variable>
4727
+
4728
+ <xsl:for-each select="xalan:nodeset($words)/word">
4729
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4730
+ <xsl:copy>
4731
+ <xsl:attribute name="id">
4732
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4733
+ </xsl:attribute>
4734
+ <xsl:copy-of select="node()"/>
4735
+ </xsl:copy>
4736
+ </xsl:for-each>
4737
+ </xsl:if>
4738
+ </xsl:copy>
4739
+
4740
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
4741
+ <xsl:copy>
4742
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
4743
+ </xsl:copy>
4744
+ </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">
4745
+ <xsl:variable name="formatting_tags">
4746
+ <xsl:call-template name="getFormattingTags"/>
4747
+ </xsl:variable>
4748
+ <word>
4749
+ <xsl:call-template name="enclose_text_in_tags">
4750
+ <xsl:with-param name="text" select="normalize-space(.)"/>
4751
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4752
+ </xsl:call-template>
4753
+ </word>
4754
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
4755
+
4756
+ <xsl:variable name="td_text" select="."/>
4757
+
4758
+ <xsl:variable name="string_with_added_zerospaces">
4759
+ <xsl:call-template name="add-zero-spaces-java">
4760
+ <xsl:with-param name="text" select="$td_text"/>
4761
+ </xsl:call-template>
4762
+ </xsl:variable>
4763
+
4764
+ <xsl:variable name="formatting_tags">
4765
+ <xsl:call-template name="getFormattingTags"/>
4766
+ </xsl:variable>
4767
+
4768
+ <!-- <word>text</word> -->
4769
+ <xsl:call-template name="tokenize_with_tags">
4770
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4771
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4772
+ </xsl:call-template>
4773
+ </xsl:template><xsl:template name="getFormattingTags">
4774
+ <tags>
4775
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
4776
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
4777
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
4778
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
4779
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
4780
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
4781
+ </tags>
3826
4782
  </xsl:template><xsl:template name="getLang">
3827
4783
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3828
4784
  <xsl:variable name="language">
@@ -3877,6 +4833,9 @@
3877
4833
  <xsl:variable name="isDeleted" select="@deleted"/>
3878
4834
 
3879
4835
  <fo:inline xsl:use-attribute-sets="mathml-style">
4836
+
4837
+
4838
+
3880
4839
 
3881
4840
 
3882
4841
  <xsl:call-template name="setTrackChangesStyles">
@@ -3884,48 +4843,80 @@
3884
4843
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3885
4844
  </xsl:call-template>
3886
4845
 
4846
+ <xsl:if test="$add_math_as_text = 'true'">
4847
+ <!-- insert helper tag -->
4848
+ <!-- set unique font-size (fiction) -->
4849
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4850
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
4851
+ </xsl:if>
3887
4852
 
3888
-
3889
- <xsl:variable name="mathml">
3890
- <xsl:apply-templates select="." mode="mathml"/>
4853
+ <xsl:variable name="mathml_content">
4854
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3891
4855
  </xsl:variable>
3892
- <fo:instream-foreign-object fox:alt-text="Math">
3893
4856
 
4857
+
4858
+ <xsl:call-template name="mathml_instream_object">
4859
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4860
+ </xsl:call-template>
3894
4861
 
3895
-
3896
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3897
- <xsl:variable name="comment_text_">
3898
- <xsl:choose>
3899
- <xsl:when test="normalize-space($comment_text_following) != ''">
3900
- <xsl:value-of select="$comment_text_following"/>
3901
- </xsl:when>
3902
- <xsl:otherwise>
3903
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3904
- </xsl:otherwise>
3905
- </xsl:choose>
3906
- </xsl:variable>
3907
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3908
-
3909
- <xsl:if test="normalize-space($comment_text) != ''">
3910
- <!-- put Mathin Alternate Text -->
3911
- <xsl:attribute name="fox:alt-text">
3912
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3913
- </xsl:attribute>
3914
- </xsl:if>
3915
-
3916
- <xsl:variable name="mathml_content">
3917
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
3918
- </xsl:variable>
3919
- <!-- put MathML in Actual Text -->
3920
- <xsl:attribute name="fox:actual-text">
3921
- <xsl:value-of select="$mathml_content"/>
3922
- </xsl:attribute>
3923
-
3924
-
3925
-
3926
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
3927
- </fo:instream-foreign-object>
4862
+
3928
4863
  </fo:inline>
4864
+ </xsl:template><xsl:template name="getMathml_comment_text">
4865
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4866
+ <xsl:variable name="comment_text_">
4867
+ <xsl:choose>
4868
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4869
+ <xsl:value-of select="$comment_text_following"/>
4870
+ </xsl:when>
4871
+ <xsl:otherwise>
4872
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4873
+ </xsl:otherwise>
4874
+ </xsl:choose>
4875
+ </xsl:variable>
4876
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4877
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4878
+ <xsl:value-of select="$comment_text"/>
4879
+ </xsl:template><xsl:template name="mathml_instream_object">
4880
+ <xsl:param name="comment_text"/>
4881
+ <xsl:param name="mathml_content"/>
4882
+
4883
+ <xsl:variable name="comment_text_">
4884
+ <xsl:choose>
4885
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4886
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4887
+ </xsl:choose>
4888
+ </xsl:variable>
4889
+
4890
+ <xsl:variable name="mathml">
4891
+ <xsl:apply-templates select="." mode="mathml"/>
4892
+ </xsl:variable>
4893
+
4894
+ <fo:instream-foreign-object fox:alt-text="Math">
4895
+
4896
+
4897
+
4898
+
4899
+
4900
+
4901
+
4902
+ <!-- put MathML in Actual Text -->
4903
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4904
+ <xsl:attribute name="fox:actual-text">
4905
+ <xsl:value-of select="$mathml_content"/>
4906
+ </xsl:attribute>
4907
+
4908
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4909
+ <xsl:if test="normalize-space($comment_text_) != ''">
4910
+ <!-- put Mathin Alternate Text -->
4911
+ <xsl:attribute name="fox:alt-text">
4912
+ <xsl:value-of select="$comment_text_"/>
4913
+ </xsl:attribute>
4914
+ </xsl:if>
4915
+ <!-- </xsl:if> -->
4916
+
4917
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4918
+
4919
+ </fo:instream-foreign-object>
3929
4920
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3930
4921
  <!-- <xsl:text>a+b</xsl:text> -->
3931
4922
  <xsl:text>&lt;</xsl:text>
@@ -3956,7 +4947,9 @@
3956
4947
  <!-- replace start and end spaces to non-break space -->
3957
4948
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3958
4949
  </xsl:copy>
3959
- </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4950
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="mathml:mtd/mathml:mo/text()[. = '/']" mode="mathml">
4951
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
4952
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3960
4953
  <xsl:variable name="target">
3961
4954
  <xsl:choose>
3962
4955
  <xsl:when test="@updatetype = 'true'">
@@ -4185,7 +5178,12 @@
4185
5178
 
4186
5179
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4187
5180
 
5181
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5182
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5183
+ </xsl:if>
5184
+
4188
5185
 
5186
+
4189
5187
 
4190
5188
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4191
5189
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -4548,18 +5546,33 @@
4548
5546
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4549
5547
  <xsl:copy>
4550
5548
  <xsl:apply-templates select="@*" mode="svg_update"/>
4551
- <xsl:variable name="viewbox">
5549
+ <xsl:variable name="viewbox_">
4552
5550
  <xsl:call-template name="split">
4553
5551
  <xsl:with-param name="pText" select="@viewBox"/>
4554
5552
  <xsl:with-param name="sep" select="' '"/>
4555
5553
  </xsl:call-template>
4556
5554
  </xsl:variable>
5555
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5556
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5557
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5558
+
4557
5559
  <xsl:attribute name="width">
4558
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5560
+ <xsl:choose>
5561
+ <xsl:when test="$width != ''">
5562
+ <xsl:value-of select="round($width)"/>
5563
+ </xsl:when>
5564
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5565
+ </xsl:choose>
4559
5566
  </xsl:attribute>
4560
5567
  <xsl:attribute name="height">
4561
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5568
+ <xsl:choose>
5569
+ <xsl:when test="$height != ''">
5570
+ <xsl:value-of select="round($height)"/>
5571
+ </xsl:when>
5572
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5573
+ </xsl:choose>
4562
5574
  </xsl:attribute>
5575
+
4563
5576
  <xsl:apply-templates mode="svg_update"/>
4564
5577
  </xsl:copy>
4565
5578
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4754,7 +5767,11 @@
4754
5767
  <xsl:apply-templates mode="bookmarks"/>
4755
5768
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4756
5769
  <xsl:apply-templates select="."/>
4757
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5770
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'span']" mode="contents">
5771
+ <xsl:apply-templates mode="contents"/>
5772
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5773
+ <xsl:apply-templates mode="bookmarks"/>
5774
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
4758
5775
  <xsl:apply-templates mode="bookmarks"/>
4759
5776
  </xsl:template><xsl:template name="addBookmarks">
4760
5777
  <xsl:param name="contents"/>
@@ -5036,7 +6053,9 @@
5036
6053
  <xsl:apply-templates/>
5037
6054
  </xsl:otherwise>
5038
6055
  </xsl:choose>
5039
- </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() = 'tab']" mode="contents_item">
6056
+ </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">
6057
+ <xsl:value-of select="."/>
6058
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5040
6059
  <xsl:text> </xsl:text>
5041
6060
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5042
6061
  <xsl:copy>
@@ -5067,9 +6086,22 @@
5067
6086
  </xsl:when>
5068
6087
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5069
6088
  </xsl:choose>
6089
+ </xsl:template><xsl:template match="text()" mode="contents_item">
6090
+ <xsl:call-template name="keep_together_standard_number"/>
6091
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
6092
+ <xsl:apply-templates mode="contents_item"/>
5070
6093
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5071
6094
 
5072
6095
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6096
+
6097
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6098
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6099
+ </xsl:if>
6100
+
6101
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6102
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6103
+ </xsl:if>
6104
+
5073
6105
  <xsl:copy-of select="@id"/>
5074
6106
 
5075
6107
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5169,17 +6201,15 @@
5169
6201
 
5170
6202
  <!-- split text by zero-width space -->
5171
6203
  <xsl:variable name="text_step4">
5172
- <xsl:call-template name="split">
6204
+ <xsl:call-template name="split_for_interspers">
5173
6205
  <xsl:with-param name="pText" select="$text_step3"/>
5174
6206
  <xsl:with-param name="sep" select="$zero_width_space"/>
5175
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5176
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5177
6207
  </xsl:call-template>
5178
6208
  </xsl:variable>
5179
6209
 
5180
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6210
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5181
6211
  <xsl:choose>
5182
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6212
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5183
6213
  <xsl:call-template name="interspers">
5184
6214
  <xsl:with-param name="str" select="."/>
5185
6215
  </xsl:call-template>
@@ -5190,6 +6220,30 @@
5190
6220
  </xsl:choose>
5191
6221
  </xsl:for-each>
5192
6222
 
6223
+ </xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
6224
+ <xsl:param name="pText" select="."/>
6225
+ <xsl:param name="sep" select="','"/>
6226
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6227
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6228
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6229
+ <xsl:call-template name="replace_tag_interspers">
6230
+ <xsl:with-param name="text" select="$text"/>
6231
+ </xsl:call-template>
6232
+ </xsl:template><xsl:template name="replace_tag_interspers">
6233
+ <xsl:param name="text"/>
6234
+ <xsl:choose>
6235
+ <xsl:when test="contains($text, $interspers_tag_open)">
6236
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6237
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6238
+ <interspers>
6239
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6240
+ </interspers>
6241
+ <xsl:call-template name="replace_tag_interspers">
6242
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6243
+ </xsl:call-template>
6244
+ </xsl:when>
6245
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6246
+ </xsl:choose>
5193
6247
  </xsl:template><xsl:template name="interspers">
5194
6248
  <xsl:param name="str"/>
5195
6249
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5418,7 +6472,9 @@
5418
6472
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5419
6473
  </xsl:if>
5420
6474
  <xsl:variable name="simple-table">
5421
- <xsl:call-template name="getSimpleTable"/>
6475
+ <xsl:call-template name="getSimpleTable">
6476
+ <xsl:with-param name="id" select="@id"/>
6477
+ </xsl:call-template>
5422
6478
  </xsl:variable>
5423
6479
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5424
6480
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -5525,39 +6581,67 @@
5525
6581
  </xsl:otherwise>
5526
6582
  </xsl:choose>
5527
6583
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5528
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5529
-
6584
+
6585
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
6586
+
5530
6587
 
6588
+
5531
6589
  <xsl:variable name="fo_element">
5532
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6590
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5533
6591
  inline
5534
6592
  </xsl:variable>
5535
6593
 
5536
- <!-- display 'EXAMPLE' -->
5537
- <xsl:apply-templates select="*[local-name()='name']">
5538
- <xsl:with-param name="fo_element" select="$fo_element"/>
5539
- </xsl:apply-templates>
6594
+ <fo:block-container margin-left="0mm">
5540
6595
 
5541
- <xsl:choose>
5542
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5543
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5544
- <fo:block-container margin-left="0mm" margin-right="0mm">
5545
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6596
+ <xsl:choose>
6597
+
6598
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6599
+
6600
+ <!-- display name 'EXAMPLE' in a separate block -->
6601
+ <fo:block>
6602
+ <xsl:apply-templates select="*[local-name()='name']">
5546
6603
  <xsl:with-param name="fo_element" select="$fo_element"/>
5547
6604
  </xsl:apply-templates>
6605
+ </fo:block>
6606
+
6607
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6608
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6609
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6610
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6611
+ </xsl:apply-templates>
6612
+ </fo:block-container>
5548
6613
  </fo:block-container>
5549
- </fo:block-container>
5550
- </xsl:when>
5551
- <xsl:otherwise>
5552
- <fo:inline>
5553
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5554
- <xsl:with-param name="fo_element" select="$fo_element"/>
5555
- </xsl:apply-templates>
5556
- </fo:inline>
5557
- </xsl:otherwise>
5558
- </xsl:choose>
5559
-
5560
- </fo:block>
6614
+ </xsl:when> <!-- end block -->
6615
+
6616
+ <xsl:otherwise> <!-- inline -->
6617
+
6618
+ <!-- display 'EXAMPLE' and first element in the same line -->
6619
+ <fo:block>
6620
+ <xsl:apply-templates select="*[local-name()='name']">
6621
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6622
+ </xsl:apply-templates>
6623
+ <fo:inline>
6624
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
6625
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6626
+ </xsl:apply-templates>
6627
+ </fo:inline>
6628
+ </fo:block>
6629
+
6630
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
6631
+ <!-- display further elements in blocks -->
6632
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6633
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6634
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
6635
+ <xsl:with-param name="fo_element" select="'block'"/>
6636
+ </xsl:apply-templates>
6637
+ </fo:block-container>
6638
+ </fo:block-container>
6639
+ </xsl:if>
6640
+ </xsl:otherwise> <!-- end inline -->
6641
+
6642
+ </xsl:choose>
6643
+ </fo:block-container>
6644
+ </fo:block-container>
5561
6645
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5562
6646
  <xsl:param name="fo_element">block</xsl:param>
5563
6647
 
@@ -5589,10 +6673,16 @@
5589
6673
  </xsl:variable>
5590
6674
  <xsl:choose>
5591
6675
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5592
- <fo:block xsl:use-attribute-sets="example-p-style">
5593
-
5594
- <xsl:apply-templates/>
5595
- </fo:block>
6676
+ <fo:block-container>
6677
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
6678
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6679
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6680
+ </xsl:if>
6681
+ <fo:block xsl:use-attribute-sets="example-p-style">
6682
+
6683
+ <xsl:apply-templates/>
6684
+ </fo:block>
6685
+ </fo:block-container>
5596
6686
  </xsl:when>
5597
6687
  <xsl:otherwise>
5598
6688
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -5637,7 +6727,7 @@
5637
6727
  </xsl:otherwise>
5638
6728
  </xsl:choose> -->
5639
6729
  </fo:block>
5640
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6730
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
5641
6731
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5642
6732
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5643
6733
  <xsl:if test="normalize-space() != ''">
@@ -5773,7 +6863,16 @@
5773
6863
  </fo:inline>
5774
6864
  </xsl:when>
5775
6865
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5776
- <fo:inline><xsl:apply-templates/></fo:inline>
6866
+
6867
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
6868
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
6869
+ <xsl:choose>
6870
+ <xsl:when test="$uri_src != ''">
6871
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
6872
+ </xsl:when>
6873
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
6874
+ </xsl:choose>
6875
+
5777
6876
  </xsl:otherwise>
5778
6877
  </xsl:choose>
5779
6878
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -5954,10 +7053,24 @@
5954
7053
 
5955
7054
  </fo:block>
5956
7055
  <xsl:apply-templates/>
5957
- </xsl:template><xsl:template match="*[local-name() = 'review']">
7056
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
5958
7057
  <!-- comment 2019-11-29 -->
5959
7058
  <!-- <fo:block font-weight="bold">Review:</fo:block>
5960
7059
  <xsl:apply-templates /> -->
7060
+
7061
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
7062
+
7063
+ <xsl:choose>
7064
+ <!-- if there isn't the attribute '@from', then -->
7065
+ <xsl:when test="$id_from = ''">
7066
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7067
+ </xsl:when>
7068
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
7069
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
7070
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7071
+ </xsl:when>
7072
+ </xsl:choose>
7073
+
5961
7074
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
5962
7075
  <!-- 0xA0 to space replacement -->
5963
7076
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6318,7 +7431,10 @@
6318
7431
  <!-- to split by '_' and other chars -->
6319
7432
  <xsl:call-template name="add-zero-spaces-java"/>
6320
7433
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6321
- <fo:inline id="{@id}" font-size="1pt"/>
7434
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7435
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7436
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7437
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6322
7438
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6323
7439
  <!-- <row>
6324
7440
  <date>05-07-2013</date>
@@ -6865,6 +7981,120 @@
6865
7981
  <xsl:apply-templates select="." mode="update_xml_step1"/>
6866
7982
  </xsl:for-each>
6867
7983
  </xsl:copy>
7984
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
7985
+ <xsl:apply-templates mode="update_xml_step1"/>
7986
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
7987
+ <xsl:copy>
7988
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
7989
+ </xsl:copy>
7990
+ </xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable><xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
7991
+
7992
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
7993
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
7994
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7995
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7996
+ <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
7997
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
7998
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7999
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8000
+ <xsl:with-param name="text" select="$text_"/>
8001
+ </xsl:call-template></text></xsl:variable>
8002
+
8003
+ <xsl:variable name="parent" select="local-name(..)"/>
8004
+
8005
+ <xsl:variable name="text2">
8006
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
8007
+ <xsl:copy-of select="."/>
8008
+ </xsl:for-each></text>
8009
+ </xsl:variable>
8010
+
8011
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
8012
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
8013
+ <xsl:variable name="text3">
8014
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
8015
+ <xsl:choose>
8016
+ <xsl:when test="self::text()">
8017
+ <xsl:variable name="text_units_" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
8018
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
8019
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8020
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8021
+ <xsl:with-param name="text" select="$text_units_"/>
8022
+ </xsl:call-template></text></xsl:variable>
8023
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
8024
+ </xsl:when>
8025
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8026
+ </xsl:choose>
8027
+ </xsl:for-each></text>
8028
+ </xsl:variable>
8029
+
8030
+ <xsl:choose>
8031
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
8032
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
8033
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
8034
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
8035
+ <xsl:choose>
8036
+ <xsl:when test="self::text()">
8037
+ <xsl:variable name="text_dots_" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
8038
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
8039
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8040
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8041
+ <xsl:with-param name="text" select="$text_dots_"/>
8042
+ </xsl:call-template></text></xsl:variable>
8043
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
8044
+ </xsl:when>
8045
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8046
+ </xsl:choose>
8047
+ </xsl:for-each>
8048
+ </xsl:when>
8049
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
8050
+ </xsl:choose>
8051
+
8052
+ </xsl:template><xsl:template name="replace_text_tags">
8053
+ <xsl:param name="tag_open"/>
8054
+ <xsl:param name="tag_close"/>
8055
+ <xsl:param name="text"/>
8056
+ <xsl:choose>
8057
+ <xsl:when test="contains($text, $tag_open)">
8058
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
8059
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
8060
+
8061
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
8062
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
8063
+ </xsl:element>
8064
+
8065
+ <xsl:call-template name="replace_text_tags">
8066
+ <xsl:with-param name="tag_open" select="$tag_open"/>
8067
+ <xsl:with-param name="tag_close" select="$tag_close"/>
8068
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
8069
+ </xsl:call-template>
8070
+ </xsl:when>
8071
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8072
+ </xsl:choose>
8073
+ </xsl:template><xsl:template name="printEdition">
8074
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8075
+ <xsl:text> </xsl:text>
8076
+ <xsl:choose>
8077
+ <xsl:when test="$edition_i18n != ''">
8078
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
8079
+ <xsl:call-template name="capitalize">
8080
+ <xsl:with-param name="str" select="$edition_i18n"/>
8081
+ </xsl:call-template>
8082
+ </xsl:when>
8083
+ <xsl:otherwise>
8084
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
8085
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
8086
+ <xsl:call-template name="capitalize">
8087
+ <xsl:with-param name="str">
8088
+ <xsl:call-template name="getLocalizedString">
8089
+ <xsl:with-param name="key">edition</xsl:with-param>
8090
+ </xsl:call-template>
8091
+ </xsl:with-param>
8092
+ </xsl:call-template>
8093
+ <xsl:text> </xsl:text>
8094
+ <xsl:value-of select="$edition"/>
8095
+ </xsl:if>
8096
+ </xsl:otherwise>
8097
+ </xsl:choose>
6868
8098
  </xsl:template><xsl:template name="convertDate">
6869
8099
  <xsl:param name="date"/>
6870
8100
  <xsl:param name="format" select="'short'"/>
@@ -7552,4 +8782,40 @@
7552
8782
  <xsl:value-of select="$value"/>
7553
8783
  </xsl:otherwise>
7554
8784
  </xsl:choose>
8785
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
8786
+ <xsl:param name="level">0</xsl:param>
8787
+
8788
+ <fo:block margin-left="{2*$level}mm">
8789
+ <xsl:text>
8790
+ &lt;</xsl:text>
8791
+ <xsl:value-of select="local-name()"/>
8792
+ <xsl:for-each select="@*">
8793
+ <xsl:text> </xsl:text>
8794
+ <xsl:value-of select="local-name()"/>
8795
+ <xsl:text>="</xsl:text>
8796
+ <xsl:value-of select="."/>
8797
+ <xsl:text>"</xsl:text>
8798
+ </xsl:for-each>
8799
+ <xsl:text>&gt;</xsl:text>
8800
+
8801
+ <xsl:if test="not(*)">
8802
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
8803
+ <xsl:text>&lt;/</xsl:text>
8804
+ <xsl:value-of select="local-name()"/>
8805
+ <xsl:text>&gt;</xsl:text>
8806
+ </xsl:if>
8807
+ </fo:block>
8808
+
8809
+ <xsl:if test="*">
8810
+ <fo:block>
8811
+ <xsl:apply-templates mode="print_as_xml">
8812
+ <xsl:with-param name="level" select="$level + 1"/>
8813
+ </xsl:apply-templates>
8814
+ </fo:block>
8815
+ <fo:block margin-left="{2*$level}mm">
8816
+ <xsl:text>&lt;/</xsl:text>
8817
+ <xsl:value-of select="local-name()"/>
8818
+ <xsl:text>&gt;</xsl:text>
8819
+ </fo:block>
8820
+ </xsl:if>
7555
8821
  </xsl:template></xsl:stylesheet>