metanorma-iho 0.5.7 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,13 @@
33
33
  <xsl:template match="/">
34
34
 
35
35
  <xsl:variable name="xslfo">
36
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
36
+ <fo:root xml:lang="{$lang}">
37
+ <xsl:variable name="root-style">
38
+ <root-style xsl:use-attribute-sets="root-style"/>
39
+ </xsl:variable>
40
+ <xsl:call-template name="insertRootStyle">
41
+ <xsl:with-param name="root-style" select="$root-style"/>
42
+ </xsl:call-template>
37
43
  <fo:layout-master-set>
38
44
  <!-- cover page -->
39
45
  <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -129,7 +135,7 @@
129
135
  <fo:block>
130
136
  <xsl:value-of select="$docidentifier"/>
131
137
  <xsl:text> </xsl:text>
132
- <xsl:apply-templates select="/iho:iho-standard/iho:bibdata/iho:edition"/>
138
+ <xsl:apply-templates select="/iho:iho-standard/iho:bibdata/iho:edition[normalize-space(@language) = '']"/>
133
139
  </fo:block>
134
140
  </fo:block-container>
135
141
  </fo:table-cell>
@@ -457,12 +463,14 @@
457
463
 
458
464
 
459
465
  <xsl:template match="/iho:iho-standard/iho:bibdata/iho:edition">
460
- <xsl:variable name="title-edition">
461
- <xsl:call-template name="getTitle">
462
- <xsl:with-param name="name" select="'title-edition'"/>
463
- </xsl:call-template>
464
- </xsl:variable>
465
- <xsl:value-of select="$title-edition"/>
466
+ <xsl:call-template name="capitalize">
467
+ <xsl:with-param name="str">
468
+ <xsl:call-template name="getLocalizedString">
469
+ <xsl:with-param name="key">edition</xsl:with-param>
470
+ </xsl:call-template>
471
+ </xsl:with-param>
472
+ </xsl:call-template>
473
+ <xsl:text> </xsl:text>
466
474
  <xsl:apply-templates/>
467
475
  </xsl:template>
468
476
 
@@ -552,6 +560,7 @@
552
560
 
553
561
  <xsl:template match="iho:p" name="paragraph">
554
562
  <xsl:param name="inline" select="'false'"/>
563
+ <xsl:param name="split_keep-within-line"/>
555
564
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
556
565
  <xsl:variable name="element-name">
557
566
  <xsl:choose>
@@ -586,7 +595,9 @@
586
595
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
587
596
  </xsl:if>
588
597
 
589
- <xsl:apply-templates/>
598
+ <xsl:apply-templates>
599
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
600
+ </xsl:apply-templates>
590
601
  </xsl:element>
591
602
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
592
603
  <fo:block margin-bottom="12pt">
@@ -769,7 +780,9 @@
769
780
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAN8AAADfCAIAAAD5m5F7AAAAAXNSR0IArs4c6QAAAAlwSFlzAAAh1QAAIdUBBJy0nQAAPjlJREFUeAHtXQdAFEcX5qhH772IgIAgxYLYFRV7773EEjWWaKImplmS2BKT2BVjr9hFxN4bghRBpYn03nvn//aWW5cDkagcd//NxXB7uzNv3rz3zZs37S2noryoqqJQSoojRT5EAiImAdmqiqKyklSCThHTC2GHkoAsTwwwnMR2EkCInASkRY4jwhCRAF8CBJ18SZBv0ZMAQafo6YRwxJcAQSdfEuRb9CRA0Cl6OiEc8SVA0MmXBPkWPQkQdIqeTghHfAkQdPIlQb5FTwIEnaKnE8IRXwIEnXxJkG/RkwBBp+jphHDElwBBJ18S5Fv0JEDQKXo6IRzxJUDQyZcE+RY9CRB0ip5OCEd8CRB08iVBvkVPAgSdoqcTwhFfAgSdfEmQb9GTAEGn6OmEcMSXAEEnXxLkW/QkQNApejohHPElQNDJlwT5Fj0JEHSKnk4IR3wJEHTyJUG+RU8CBJ2ipxPCEV8CBJ18SZBv0ZMAQafo6YRwxJcAQSdfEuRb9CRA0Cl6OiEc8SVA0MmXBPkWPQkQdIqeTghHfAkQdPIlQb5FTwIEnaKnE8IRXwIEnXxJkG/RkwBBp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HKkGnxKlcjCpM0ClGypI4Vgk6JU7lYlRhgk4xUpbEsUrQKXEqF6MKE3SKkbIkjlWCTolTuRhVmKBTjJQlcawSdEqcysWowgSdYqQsiWP1f5V8zYCHJlYcAAAAAElFTkSuQmCC</xsl:text>
770
781
  </xsl:variable>
771
782
 
772
- <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">
783
+ <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_">
784
+ false
785
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
773
786
  <xsl:call-template name="getLang"/>
774
787
  </xsl:variable><xsl:variable name="pageWidth_">
775
788
  210
@@ -784,20 +797,7 @@
784
797
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
785
798
  25.4
786
799
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
787
-
788
- <title-edition lang="en">
789
-
790
- <xsl:text>Edition </xsl:text>
791
-
792
- </title-edition>
793
-
794
- <title-edition lang="fr">
795
- <xsl:text>Édition </xsl:text>
796
- </title-edition>
797
800
 
798
- <title-edition lang="ru">
799
- <xsl:text>Издание </xsl:text>
800
- </title-edition>
801
801
 
802
802
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
803
803
  <title-toc lang="en">
@@ -878,7 +878,7 @@
878
878
  </xsl:variable><xsl:variable name="bibdata">
879
879
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
880
880
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
881
- </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">
881
+ </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">
882
882
  <xsl:param name="name"/>
883
883
  <xsl:param name="lang"/>
884
884
  <xsl:variable name="lang_">
@@ -921,7 +921,30 @@
921
921
 
922
922
 
923
923
 
924
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
924
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
925
+ <xsl:param name="root-style"/>
926
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
927
+
928
+ <xsl:variable name="additional_fonts_">
929
+ <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']">
930
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
931
+ </xsl:for-each>
932
+ </xsl:variable>
933
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
934
+
935
+ <xsl:for-each select="$root-style_/root-style/@*">
936
+ <xsl:choose>
937
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
938
+ <xsl:attribute name="{local-name()}">
939
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
940
+ </xsl:attribute>
941
+ </xsl:when>
942
+ <xsl:otherwise>
943
+ <xsl:copy-of select="."/>
944
+ </xsl:otherwise>
945
+ </xsl:choose>
946
+ </xsl:for-each>
947
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
925
948
 
926
949
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
927
950
 
@@ -978,7 +1001,6 @@
978
1001
 
979
1002
 
980
1003
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
981
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
982
1004
 
983
1005
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
984
1006
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -1068,6 +1090,7 @@
1068
1090
 
1069
1091
 
1070
1092
 
1093
+
1071
1094
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1072
1095
 
1073
1096
 
@@ -1221,6 +1244,7 @@
1221
1244
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1222
1245
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1223
1246
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1247
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1224
1248
  <xsl:attribute name="display-align">center</xsl:attribute>
1225
1249
 
1226
1250
 
@@ -1239,6 +1263,7 @@
1239
1263
  <xsl:attribute name="display-align">center</xsl:attribute>
1240
1264
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1241
1265
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1266
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1242
1267
 
1243
1268
 
1244
1269
 
@@ -1327,7 +1352,8 @@
1327
1352
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1328
1353
 
1329
1354
 
1330
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1355
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1356
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1331
1357
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1332
1358
 
1333
1359
 
@@ -1342,6 +1368,8 @@
1342
1368
 
1343
1369
 
1344
1370
 
1371
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1372
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1345
1373
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1346
1374
 
1347
1375
 
@@ -1443,7 +1471,7 @@
1443
1471
 
1444
1472
 
1445
1473
 
1446
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1474
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1447
1475
 
1448
1476
 
1449
1477
 
@@ -2157,22 +2185,32 @@
2157
2185
  <xsl:sort select="@displayorder" data-type="number"/>
2158
2186
  <xsl:apply-templates select="."/>
2159
2187
  </xsl:for-each>
2160
- </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">
2161
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2162
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2163
- <xsl:call-template name="replace_fo_inline">
2164
- <xsl:with-param name="text" select="$text"/>
2165
- </xsl:call-template>
2166
- </xsl:template><xsl:template name="replace_fo_inline">
2188
+ </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">
2189
+
2190
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2191
+ <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))"/>
2192
+ <xsl:call-template name="replace_fo_inline_tags">
2193
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2194
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2195
+ <xsl:with-param name="text" select="$text"/>
2196
+ </xsl:call-template>
2197
+
2198
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2199
+ <xsl:param name="tag_open"/>
2200
+ <xsl:param name="tag_close"/>
2167
2201
  <xsl:param name="text"/>
2168
2202
  <xsl:choose>
2169
2203
  <xsl:when test="contains($text, $tag_open)">
2170
2204
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2171
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2205
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2172
2206
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2173
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2174
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2175
- <xsl:call-template name="replace_fo_inline">
2207
+ <fo:inline keep-together.within-line="always">
2208
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2209
+ </fo:inline>
2210
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2211
+ <xsl:call-template name="replace_fo_inline_tags">
2212
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2213
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2176
2214
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2177
2215
  </xsl:call-template>
2178
2216
  </xsl:when>
@@ -2180,6 +2218,39 @@
2180
2218
  </xsl:choose>
2181
2219
  </xsl:template><xsl:template match="*[local-name()='br']">
2182
2220
  <xsl:value-of select="$linebreak"/>
2221
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2222
+ <xsl:param name="split_keep-within-line"/>
2223
+
2224
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2225
+ <xsl:choose>
2226
+
2227
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2228
+ <xsl:variable name="sep">_</xsl:variable>
2229
+ <xsl:variable name="items">
2230
+ <xsl:call-template name="split">
2231
+ <xsl:with-param name="pText" select="."/>
2232
+ <xsl:with-param name="sep" select="$sep"/>
2233
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2234
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2235
+ </xsl:call-template>
2236
+ </xsl:variable>
2237
+ <xsl:for-each select="xalan:nodeset($items)/item">
2238
+ <xsl:choose>
2239
+ <xsl:when test=". = $sep">
2240
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2241
+ </xsl:when>
2242
+ <xsl:otherwise>
2243
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2244
+ </xsl:otherwise>
2245
+ </xsl:choose>
2246
+ </xsl:for-each>
2247
+ </xsl:when>
2248
+
2249
+ <xsl:otherwise>
2250
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2251
+ </xsl:otherwise>
2252
+
2253
+ </xsl:choose>
2183
2254
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2184
2255
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2185
2256
  <xsl:apply-templates/>
@@ -2245,8 +2316,23 @@
2245
2316
  </xsl:call-template>
2246
2317
 
2247
2318
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2248
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2249
- <xsl:call-template name="add-zero-spaces-java"/>
2319
+ <xsl:choose>
2320
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2321
+ <xsl:value-of select="."/>
2322
+ </xsl:when>
2323
+ <xsl:otherwise>
2324
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2325
+ </xsl:otherwise>
2326
+ </xsl:choose>
2327
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2328
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2329
+ <!-- <xsl:copy-of select="$text"/> -->
2330
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2331
+ <xsl:choose>
2332
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2333
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2334
+ </xsl:choose>
2335
+ </xsl:for-each>
2250
2336
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2251
2337
 
2252
2338
  <xsl:variable name="table-preamble">
@@ -2256,9 +2342,14 @@
2256
2342
 
2257
2343
  <xsl:variable name="table">
2258
2344
 
2259
- <xsl:variable name="simple-table">
2260
- <xsl:call-template name="getSimpleTable"/>
2345
+ <xsl:variable name="simple-table">
2346
+ <xsl:call-template name="getSimpleTable">
2347
+ <xsl:with-param name="id" select="@id"/>
2348
+ </xsl:call-template>
2261
2349
  </xsl:variable>
2350
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2351
+
2352
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2262
2353
 
2263
2354
 
2264
2355
  <!-- Display table's name before table as standalone block -->
@@ -2281,7 +2372,23 @@
2281
2372
  </xsl:call-template>
2282
2373
  </xsl:if>
2283
2374
  </xsl:variable>
2284
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2375
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2376
+
2377
+ <!-- DEBUG -->
2378
+ <xsl:if test="$table_if_debug = 'true'">
2379
+ <fo:block font-size="60%">
2380
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2381
+ </fo:block>
2382
+ </xsl:if>
2383
+
2384
+
2385
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2386
+
2387
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2388
+ DEBUG
2389
+ colwidths=<xsl:copy-of select="$colwidths"/>
2390
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2391
+
2285
2392
 
2286
2393
 
2287
2394
  <xsl:variable name="margin-side">
@@ -2342,9 +2449,17 @@
2342
2449
  </xsl:element>
2343
2450
  </xsl:variable>
2344
2451
 
2452
+ <xsl:if test="$isGenerateTableIF = 'true'">
2453
+ <!-- to determine start of table -->
2454
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2455
+ </xsl:if>
2345
2456
 
2346
2457
  <fo:table id="{@id}">
2347
2458
 
2459
+ <xsl:if test="$isGenerateTableIF = 'true'">
2460
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2461
+ </xsl:if>
2462
+
2348
2463
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2349
2464
  <xsl:attribute name="{local-name()}">
2350
2465
  <xsl:value-of select="."/>
@@ -2358,31 +2473,47 @@
2358
2473
 
2359
2474
 
2360
2475
  <xsl:choose>
2361
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2362
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2363
- <fo:table-column column-width="{@width}"/>
2364
- </xsl:for-each>
2476
+ <xsl:when test="$isGenerateTableIF = 'true'">
2477
+ <!-- generate IF for table widths -->
2478
+ <!-- example:
2479
+ <tr>
2480
+ <td valign="top" align="left" id="tab-symdu_1_1">
2481
+ <p>Symbol</p>
2482
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2483
+ </td>
2484
+ <td valign="top" align="left" id="tab-symdu_1_2">
2485
+ <p>Description</p>
2486
+ <word id="tab-symdu_1_2_word_1">Description</word>
2487
+ </td>
2488
+ </tr>
2489
+ -->
2490
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2491
+
2365
2492
  </xsl:when>
2366
2493
  <xsl:otherwise>
2367
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2368
- <xsl:choose>
2369
- <xsl:when test=". = 1 or . = 0">
2370
- <fo:table-column column-width="proportional-column-width(2)"/>
2371
- </xsl:when>
2372
- <xsl:otherwise>
2373
- <fo:table-column column-width="proportional-column-width({.})"/>
2374
- </xsl:otherwise>
2375
- </xsl:choose>
2376
- </xsl:for-each>
2377
- </xsl:otherwise>
2378
- </xsl:choose>
2379
2494
 
2380
- <xsl:choose>
2381
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2382
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2383
- </xsl:when>
2384
- <xsl:otherwise>
2385
- <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 -->
2495
+ <xsl:choose>
2496
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2497
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2498
+ <fo:table-column column-width="{@width}"/>
2499
+ </xsl:for-each>
2500
+ </xsl:when>
2501
+ <xsl:otherwise>
2502
+ <xsl:call-template name="insertTableColumnWidth">
2503
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2504
+ </xsl:call-template>
2505
+ </xsl:otherwise>
2506
+ </xsl:choose>
2507
+
2508
+ <xsl:choose>
2509
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2510
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2511
+ </xsl:when>
2512
+ <xsl:otherwise>
2513
+ <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 -->
2514
+ </xsl:otherwise>
2515
+ </xsl:choose>
2516
+
2386
2517
  </xsl:otherwise>
2387
2518
  </xsl:choose>
2388
2519
 
@@ -2485,11 +2616,22 @@
2485
2616
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2486
2617
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2487
2618
  </xsl:template><xsl:template name="calculate-column-widths">
2619
+ <xsl:param name="table"/>
2620
+ <xsl:param name="cols-count"/>
2621
+
2622
+ <xsl:call-template name="calculate-column-widths-proportional">
2623
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2624
+ <xsl:with-param name="table" select="$table"/>
2625
+ </xsl:call-template>
2626
+
2627
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2488
2628
  <xsl:param name="table"/>
2489
2629
  <xsl:param name="cols-count"/>
2490
2630
  <xsl:param name="curr-col" select="1"/>
2491
2631
  <xsl:param name="width" select="0"/>
2492
2632
 
2633
+ <!-- table=<xsl:copy-of select="$table"/> -->
2634
+
2493
2635
  <xsl:if test="$curr-col &lt;= $cols-count">
2494
2636
  <xsl:variable name="widths">
2495
2637
  <xsl:choose>
@@ -2527,16 +2669,22 @@
2527
2669
  </xsl:for-each>
2528
2670
  </xsl:when>
2529
2671
  <xsl:otherwise>
2530
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2672
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2673
+
2674
+ <!-- <table><xsl:copy-of select="$table"/></table>
2675
+ -->
2676
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2531
2677
  <xsl:variable name="td_text">
2532
2678
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2533
2679
  </xsl:variable>
2680
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2534
2681
  <xsl:variable name="words">
2535
2682
  <xsl:variable name="string_with_added_zerospaces">
2536
2683
  <xsl:call-template name="add-zero-spaces-java">
2537
2684
  <xsl:with-param name="text" select="$td_text"/>
2538
2685
  </xsl:call-template>
2539
2686
  </xsl:variable>
2687
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2540
2688
  <xsl:call-template name="tokenize">
2541
2689
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2542
2690
  <!-- 2009 thinspace -->
@@ -2544,11 +2692,13 @@
2544
2692
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2545
2693
  </xsl:call-template>
2546
2694
  </xsl:variable>
2695
+ <!-- words=<xsl:copy-of select="$words"/> -->
2547
2696
  <xsl:variable name="max_length">
2548
2697
  <xsl:call-template name="max_length">
2549
2698
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2550
2699
  </xsl:call-template>
2551
2700
  </xsl:variable>
2701
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2552
2702
  <width>
2553
2703
  <xsl:variable name="divider">
2554
2704
  <xsl:choose>
@@ -2567,6 +2717,8 @@
2567
2717
  </xsl:choose>
2568
2718
  </xsl:variable>
2569
2719
 
2720
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2721
+
2570
2722
  <column>
2571
2723
  <xsl:for-each select="xalan:nodeset($widths)//width">
2572
2724
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2575,29 +2727,327 @@
2575
2727
  </xsl:if>
2576
2728
  </xsl:for-each>
2577
2729
  </column>
2578
- <xsl:call-template name="calculate-column-widths">
2730
+ <xsl:call-template name="calculate-column-widths-proportional">
2579
2731
  <xsl:with-param name="cols-count" select="$cols-count"/>
2580
2732
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2581
2733
  <xsl:with-param name="table" select="$table"/>
2582
2734
  </xsl:call-template>
2583
2735
  </xsl:if>
2736
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2737
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2738
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2739
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2740
+
2741
+ <!-- if all capitals english letters or digits -->
2742
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2743
+ <xsl:call-template name="repeat">
2744
+ <xsl:with-param name="char" select="'X'"/>
2745
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2746
+ </xsl:call-template>
2747
+ </xsl:if>
2584
2748
  </xsl:template><xsl:template match="text()" mode="td_text">
2585
2749
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2586
2750
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2587
2751
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2588
2752
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2589
2753
  <xsl:value-of select="@target"/>
2590
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2591
- <xsl:variable name="mathml">
2592
- <xsl:for-each select="*">
2593
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2594
- <xsl:copy-of select="."/>
2754
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2755
+ <xsl:if test="$isGenerateTableIF = 'false'">
2756
+ <xsl:variable name="mathml_">
2757
+ <xsl:for-each select="*">
2758
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2759
+ <xsl:copy-of select="."/>
2760
+ </xsl:if>
2761
+ </xsl:for-each>
2762
+ </xsl:variable>
2763
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2764
+
2765
+ <xsl:variable name="math_text">
2766
+ <xsl:value-of select="normalize-space($mathml)"/>
2767
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2768
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2769
+ </xsl:variable>
2770
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2771
+ </xsl:if>
2772
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2773
+ <xsl:param name="table"/>
2774
+ <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
2775
+
2776
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2777
+
2778
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2779
+
2780
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2781
+
2782
+ <!-- get current table id -->
2783
+ <xsl:variable name="table_id" select="@id"/>
2784
+ <!-- find table by id in the file 'table_widths' -->
2785
+ <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2786
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
2787
+
2788
+
2789
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2790
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2791
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2792
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2793
+
2794
+ <xsl:variable name="table_with_cell_widths_">
2795
+ <xsl:choose>
2796
+ <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
2797
+
2798
+ <!-- Example: <column>10</column>
2799
+ <column>11</column>
2800
+ -->
2801
+ <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
2802
+ </xsl:when>
2803
+ <xsl:otherwise>
2804
+ <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
2805
+ </xsl:otherwise>
2806
+ </xsl:choose>
2807
+ </xsl:variable>
2808
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2809
+
2810
+ <xsl:if test="$table_if_debug = 'true'">
2811
+ <xsl:copy-of select="$table_with_cell_widths"/>
2812
+ </xsl:if>
2813
+
2814
+
2815
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2816
+
2817
+ <xsl:variable name="column_widths_">
2818
+ <!-- iteration of columns -->
2819
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2820
+ <xsl:variable name="pos" select="position()"/>
2821
+ <column>
2822
+ <xsl:attribute name="width_max">
2823
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2824
+ <xsl:sort select="." data-type="number" order="descending"/>
2825
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2826
+ </xsl:for-each>
2827
+ </xsl:attribute>
2828
+ <xsl:attribute name="width_min">
2829
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2830
+ <xsl:sort select="." data-type="number" order="descending"/>
2831
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2832
+ </xsl:for-each>
2833
+ </xsl:attribute>
2834
+ </column>
2835
+ </xsl:for-each>
2836
+ </xsl:variable>
2837
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2838
+
2839
+ <!-- <column_widths>
2840
+ <xsl:copy-of select="$column_widths"/>
2841
+ </column_widths> -->
2842
+
2843
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2844
+ <xsl:variable name="table_widths_">
2845
+ <table>
2846
+ <xsl:attribute name="width_max">
2847
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2848
+ </xsl:attribute>
2849
+ <xsl:attribute name="width_min">
2850
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2851
+ </xsl:attribute>
2852
+ </table>
2853
+ </xsl:variable>
2854
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2855
+
2856
+ <xsl:variable name="page_width">
2857
+ <xsl:choose>
2858
+ <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
2859
+ <xsl:otherwise>75</xsl:otherwise>
2860
+ </xsl:choose>
2861
+ </xsl:variable>
2862
+
2863
+ <xsl:if test="$table_if_debug = 'true'">
2864
+ <table_width>
2865
+ <xsl:copy-of select="$table_widths"/>
2866
+ </table_width>
2867
+ <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
2868
+ <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
2869
+ -->
2870
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2871
+ </xsl:if>
2872
+
2873
+
2874
+ <!-- There are three cases: -->
2875
+ <xsl:choose>
2876
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2877
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2878
+ <!-- call old algorithm -->
2879
+ <case1/>
2880
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2881
+ <xsl:call-template name="calculate-column-widths-proportional">
2882
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2883
+ <xsl:with-param name="table" select="$table"/>
2884
+ </xsl:call-template>
2885
+ </xsl:when>
2886
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2887
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2888
+ <case2/>
2889
+ <autolayout/>
2890
+ <xsl:for-each select="$column_widths/column/@width_max">
2891
+ <column divider="100"><xsl:value-of select="."/></column>
2892
+ </xsl:for-each>
2893
+ </xsl:when>
2894
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2895
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2896
+ Lets also call D the difference between maximum and minimum width of the table.
2897
+ For each column, let d be the difference between maximum and minimum width of that column.
2898
+ Now set the column's width to the minimum width plus d times W over D.
2899
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2900
+ <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)">
2901
+ <!-- difference between the available space and the minimum table width -->
2902
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2903
+ <W><xsl:value-of select="$W"/></W>
2904
+ <!-- difference between maximum and minimum width of the table -->
2905
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2906
+ <D><xsl:value-of select="$D"/></D>
2907
+ <case3/>
2908
+ <autolayout/>
2909
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2910
+ <split_keep-within-line>true</split_keep-within-line>
2911
+ </xsl:if>
2912
+ <xsl:for-each select="$column_widths/column">
2913
+ <!-- difference between maximum and minimum width of that column. -->
2914
+ <xsl:variable name="d" select="@width_max - @width_min"/>
2915
+ <d><xsl:value-of select="$d"/></d>
2916
+ <width_min><xsl:value-of select="@width_min"/></width_min>
2917
+ <e><xsl:value-of select="$d * $W div $D"/></e>
2918
+ <!-- set the column's width to the minimum width plus d times W over D. -->
2919
+ <column divider="100">
2920
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
2921
+ </column>
2922
+ </xsl:for-each>
2923
+
2924
+ </xsl:when>
2925
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
2926
+ </xsl:choose>
2927
+
2928
+
2929
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
2930
+ <xsl:copy>
2931
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
2932
+ </xsl:copy>
2933
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
2934
+ <xsl:copy>
2935
+ <xsl:copy-of select="@*"/>
2936
+
2937
+ <!-- The maximum width is given by the widest line. -->
2938
+ <xsl:variable name="widths_max">
2939
+ <xsl:for-each select=".//*[local-name() = 'p']">
2940
+ <xsl:call-template name="add_width"/>
2941
+ </xsl:for-each>
2942
+ <xsl:if test="not(*[local-name() = 'p'])">
2943
+ <xsl:call-template name="add_width"/>
2595
2944
  </xsl:if>
2945
+ </xsl:variable>
2946
+ <xsl:variable name="width_max">
2947
+ <xsl:for-each select="xalan:nodeset($widths_max)//width">
2948
+ <xsl:sort select="." data-type="number" order="descending"/>
2949
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2950
+ </xsl:for-each>
2951
+ </xsl:variable>
2952
+ <xsl:attribute name="width_max">
2953
+ <xsl:value-of select="$width_max"/>
2954
+ </xsl:attribute>
2955
+
2956
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2957
+ <!-- To do: image width -->
2958
+ <xsl:variable name="td_text">
2959
+ <xsl:apply-templates select="." mode="td_text"/>
2960
+ </xsl:variable>
2961
+ <xsl:variable name="words">
2962
+ <xsl:variable name="string_with_added_zerospaces">
2963
+ <xsl:call-template name="add-zero-spaces-java">
2964
+ <xsl:with-param name="text" select="$td_text"/>
2965
+ </xsl:call-template>
2966
+ </xsl:variable>
2967
+ <xsl:call-template name="tokenize">
2968
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2969
+ </xsl:call-template>
2970
+ </xsl:variable>
2971
+
2972
+ <xsl:variable name="max_word_length">
2973
+ <xsl:call-template name="max_length">
2974
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2975
+ </xsl:call-template>
2976
+ </xsl:variable>
2977
+ <xsl:variable name="width_min">
2978
+ <xsl:value-of select="$max_word_length"/>
2979
+ </xsl:variable>
2980
+ <xsl:attribute name="width_min">
2981
+ <xsl:value-of select="$width_min"/>
2982
+ </xsl:attribute>
2983
+ <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
2984
+ <xsl:if test="$width_min &gt; $width_max">
2985
+ <xsl:attribute name="width_max">
2986
+ <xsl:value-of select="$width_min"/>
2987
+ </xsl:attribute>
2988
+ </xsl:if>
2989
+ <xsl:if test="$width_min = 0">
2990
+ <xsl:attribute name="width_min">1</xsl:attribute>
2991
+ </xsl:if>
2992
+
2993
+ <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
2994
+
2995
+ </xsl:copy>
2996
+ </xsl:template><xsl:template name="add_width">
2997
+ <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
2998
+ <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
2999
+
3000
+ <xsl:variable name="p_text_len">
3001
+ <xsl:choose>
3002
+ <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
3003
+ <xsl:value-of select="$p_text_len_ * 1.5"/>
3004
+ </xsl:when>
3005
+ <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
3006
+ </xsl:choose>
3007
+ </xsl:variable>
3008
+
3009
+ <xsl:variable name="math_addon_text">
3010
+ <xsl:for-each select=".//*[local-name() = 'math']">
3011
+ <xsl:apply-templates mode="td_text"/>
2596
3012
  </xsl:for-each>
2597
3013
  </xsl:variable>
3014
+ <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
2598
3015
 
2599
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2600
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3016
+ <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
3017
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3018
+ <xsl:copy>
3019
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3020
+ </xsl:copy>
3021
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
3022
+ <xsl:copy>
3023
+ <xsl:copy-of select="@*"/>
3024
+
3025
+ <!-- The maximum width is given by the widest line. -->
3026
+ <xsl:attribute name="width_max">
3027
+ <xsl:for-each select="p_len">
3028
+ <xsl:sort select="." data-type="number" order="descending"/>
3029
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3030
+ </xsl:for-each>
3031
+ </xsl:attribute>
3032
+
3033
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3034
+ <xsl:variable name="width_min">
3035
+ <xsl:for-each select="word_len">
3036
+ <xsl:sort select="." data-type="number" order="descending"/>
3037
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3038
+ </xsl:for-each>
3039
+ </xsl:variable>
3040
+ <xsl:attribute name="width_min">
3041
+ <xsl:value-of select="$width_min"/>
3042
+ </xsl:attribute>
3043
+
3044
+ <xsl:if test="$width_min = 0">
3045
+ <xsl:attribute name="width_min">1</xsl:attribute>
3046
+ </xsl:if>
3047
+
3048
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3049
+
3050
+ </xsl:copy>
2601
3051
  </xsl:template><xsl:template match="*[local-name()='thead']">
2602
3052
  <xsl:param name="cols-count"/>
2603
3053
  <fo:table-header>
@@ -2682,16 +3132,10 @@
2682
3132
  </xsl:for-each>
2683
3133
  </xsl:when>
2684
3134
  <xsl:otherwise>
2685
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2686
- <xsl:choose>
2687
- <xsl:when test=". = 1 or . = 0">
2688
- <fo:table-column column-width="proportional-column-width(2)"/>
2689
- </xsl:when>
2690
- <xsl:otherwise>
2691
- <fo:table-column column-width="proportional-column-width({.})"/>
2692
- </xsl:otherwise>
2693
- </xsl:choose>
2694
- </xsl:for-each>
3135
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
3136
+ <xsl:call-template name="insertTableColumnWidth">
3137
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3138
+ </xsl:call-template>
2695
3139
  </xsl:otherwise>
2696
3140
  </xsl:choose>
2697
3141
 
@@ -2768,6 +3212,52 @@
2768
3212
 
2769
3213
  </fo:table-body>
2770
3214
 
3215
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3216
+ <xsl:param name="table_or_dl">table</xsl:param>
3217
+ <xsl:apply-templates mode="process_table-if">
3218
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3219
+ </xsl:apply-templates>
3220
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3221
+ <xsl:param name="table_or_dl">table</xsl:param>
3222
+
3223
+ <fo:table-body>
3224
+ <xsl:for-each select="*[local-name() = 'tr']">
3225
+ <xsl:variable name="col_count" select="count(*)"/>
3226
+
3227
+ <!-- iteration for each tr/td -->
3228
+
3229
+ <xsl:choose>
3230
+ <xsl:when test="$table_or_dl = 'table'">
3231
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3232
+ <fo:table-row number-columns-spanned="{$col_count}">
3233
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3234
+ <xsl:call-template name="td"/>
3235
+ </fo:table-row>
3236
+ </xsl:for-each>
3237
+ </xsl:when>
3238
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3239
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3240
+ <xsl:variable name="is_dt" select="position() = 1"/>
3241
+
3242
+ <xsl:for-each select="*">
3243
+ <!-- <test><xsl:copy-of select="."/></test> -->
3244
+ <fo:table-row number-columns-spanned="{$col_count}">
3245
+ <xsl:choose>
3246
+ <xsl:when test="$is_dt">
3247
+ <xsl:call-template name="insert_dt_cell"/>
3248
+ </xsl:when>
3249
+ <xsl:otherwise>
3250
+ <xsl:call-template name="insert_dd_cell"/>
3251
+ </xsl:otherwise>
3252
+ </xsl:choose>
3253
+ </fo:table-row>
3254
+ </xsl:for-each>
3255
+ </xsl:for-each>
3256
+ </xsl:otherwise>
3257
+ </xsl:choose>
3258
+
3259
+ </xsl:for-each>
3260
+ </fo:table-body>
2771
3261
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2772
3262
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2773
3263
 
@@ -2854,7 +3344,7 @@
2854
3344
  </xsl:choose>
2855
3345
  </xsl:attribute>
2856
3346
  </xsl:if>
2857
- </xsl:template><xsl:template match="*[local-name()='td']">
3347
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2858
3348
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2859
3349
  <xsl:call-template name="setTextAlignment">
2860
3350
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2888,11 +3378,24 @@
2888
3378
 
2889
3379
  <xsl:call-template name="setTableCellAttributes"/>
2890
3380
 
3381
+ <xsl:if test="$isGenerateTableIF = 'true'">
3382
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3383
+ <xsl:attribute name="text-align">left</xsl:attribute>
3384
+ </xsl:if>
3385
+
2891
3386
  <fo:block>
2892
3387
 
3388
+ <xsl:if test="$isGenerateTableIF = 'true'">
3389
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3390
+ </xsl:if>
3391
+
3392
+
3393
+
2893
3394
 
2894
-
2895
3395
  <xsl:apply-templates/>
3396
+
3397
+ <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"/> -->
3398
+
2896
3399
  </fo:block>
2897
3400
  </fo:table-cell>
2898
3401
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -3089,9 +3592,9 @@
3089
3592
  <!-- current hierarchy is 'figure' element -->
3090
3593
  <xsl:variable name="following_dl_colwidths">
3091
3594
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3092
- <xsl:variable name="html-table">
3093
- <xsl:variable name="doc_ns">
3094
-
3595
+ <xsl:variable name="simple-table">
3596
+ <!-- <xsl:variable name="doc_ns">
3597
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3095
3598
  </xsl:variable>
3096
3599
  <xsl:variable name="ns">
3097
3600
  <xsl:choose>
@@ -3102,7 +3605,7 @@
3102
3605
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3103
3606
  </xsl:otherwise>
3104
3607
  </xsl:choose>
3105
- </xsl:variable>
3608
+ </xsl:variable> -->
3106
3609
 
3107
3610
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3108
3611
  <tbody>
@@ -3113,7 +3616,7 @@
3113
3616
 
3114
3617
  <xsl:call-template name="calculate-column-widths">
3115
3618
  <xsl:with-param name="cols-count" select="2"/>
3116
- <xsl:with-param name="table" select="$html-table"/>
3619
+ <xsl:with-param name="table" select="$simple-table"/>
3117
3620
  </xsl:call-template>
3118
3621
 
3119
3622
  </xsl:if>
@@ -3232,8 +3735,10 @@
3232
3735
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3233
3736
  </xsl:variable>
3234
3737
 
3738
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3739
+
3235
3740
  <xsl:choose>
3236
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3741
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3237
3742
 
3238
3743
  <fo:block margin-bottom="12pt" text-align="left">
3239
3744
 
@@ -3248,7 +3753,7 @@
3248
3753
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3249
3754
  </fo:block>
3250
3755
 
3251
- </xsl:when>
3756
+ </xsl:when> <!-- END: only one component -->
3252
3757
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3253
3758
  <fo:block margin-bottom="12pt" text-align="left">
3254
3759
 
@@ -3262,8 +3767,8 @@
3262
3767
  </xsl:variable>
3263
3768
  <xsl:value-of select="$title-where"/>
3264
3769
  </fo:block>
3265
- </xsl:when>
3266
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3770
+ </xsl:when> <!-- END: a few components -->
3771
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3267
3772
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3268
3773
 
3269
3774
 
@@ -3276,11 +3781,11 @@
3276
3781
  </xsl:variable>
3277
3782
  <xsl:value-of select="$title-key"/>
3278
3783
  </fo:block>
3279
- </xsl:when>
3784
+ </xsl:when> <!-- END: definition list in a figure -->
3280
3785
  </xsl:choose>
3281
3786
 
3282
3787
  <!-- a few components -->
3283
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3788
+ <xsl:if test="$onlyOneComponent = 'false'">
3284
3789
  <fo:block>
3285
3790
 
3286
3791
 
@@ -3295,7 +3800,18 @@
3295
3800
  <xsl:attribute name="margin-left">-3.5mm</xsl:attribute>
3296
3801
 
3297
3802
 
3803
+
3804
+ <xsl:if test="$isGenerateTableIF = 'true'">
3805
+ <!-- to determine start of table -->
3806
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3807
+ </xsl:if>
3808
+
3298
3809
  <fo:table width="95%" table-layout="fixed">
3810
+
3811
+ <xsl:if test="$isGenerateTableIF = 'true'">
3812
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3813
+ </xsl:if>
3814
+
3299
3815
 
3300
3816
  <xsl:choose>
3301
3817
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3304,54 +3820,143 @@
3304
3820
 
3305
3821
  </xsl:when>
3306
3822
  </xsl:choose>
3307
- <!-- create virtual html table for dl/[dt and dd] -->
3308
- <xsl:variable name="html-table">
3309
- <xsl:variable name="doc_ns">
3823
+
3824
+
3825
+ <xsl:choose>
3826
+ <xsl:when test="$isGenerateTableIF = 'true'">
3827
+ <!-- generate IF for table widths -->
3828
+ <!-- example:
3829
+ <tr>
3830
+ <td valign="top" align="left" id="tab-symdu_1_1">
3831
+ <p>Symbol</p>
3832
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3833
+ </td>
3834
+ <td valign="top" align="left" id="tab-symdu_1_2">
3835
+ <p>Description</p>
3836
+ <word id="tab-symdu_1_2_word_1">Description</word>
3837
+ </td>
3838
+ </tr>
3839
+ -->
3310
3840
 
3311
- </xsl:variable>
3312
- <xsl:variable name="ns">
3313
- <xsl:choose>
3314
- <xsl:when test="normalize-space($doc_ns) != ''">
3315
- <xsl:value-of select="normalize-space($doc_ns)"/>
3316
- </xsl:when>
3317
- <xsl:otherwise>
3318
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3319
- </xsl:otherwise>
3320
- </xsl:choose>
3321
- </xsl:variable>
3322
- <tbody>
3323
- <xsl:apply-templates mode="dl"/>
3324
- </tbody>
3325
- </xsl:variable>
3326
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3327
- <xsl:variable name="colwidths">
3328
- <xsl:call-template name="calculate-column-widths">
3329
- <xsl:with-param name="cols-count" select="2"/>
3330
- <xsl:with-param name="table" select="$html-table"/>
3331
- </xsl:call-template>
3332
- </xsl:variable>
3333
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3334
- <xsl:variable name="maxlength_dt">
3335
- <xsl:call-template name="getMaxLength_dt"/>
3336
- </xsl:variable>
3337
- <xsl:call-template name="setColumnWidth_dl">
3338
- <xsl:with-param name="colwidths" select="$colwidths"/>
3339
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3340
- </xsl:call-template>
3341
- <fo:table-body>
3342
- <xsl:apply-templates>
3343
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3344
- </xsl:apply-templates>
3345
- </fo:table-body>
3841
+ <!-- create virtual html table for dl/[dt and dd] -->
3842
+ <xsl:variable name="simple-table">
3843
+
3844
+ <xsl:variable name="dl_table">
3845
+ <tbody>
3846
+ <xsl:apply-templates mode="dl_if">
3847
+ <xsl:with-param name="id" select="@id"/>
3848
+ </xsl:apply-templates>
3849
+ </tbody>
3850
+ </xsl:variable>
3851
+
3852
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3853
+
3854
+ <!-- Step: replace <br/> to <p>...</p> -->
3855
+ <xsl:variable name="table_without_br">
3856
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3857
+ </xsl:variable>
3858
+
3859
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3860
+
3861
+ <!-- Step: add id to each cell -->
3862
+ <!-- add <word>...</word> for each word, image, math -->
3863
+ <xsl:variable name="simple-table-id">
3864
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3865
+ <xsl:with-param name="id" select="@id"/>
3866
+ </xsl:apply-templates>
3867
+ </xsl:variable>
3868
+
3869
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3870
+
3871
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3872
+
3873
+ </xsl:variable>
3874
+
3875
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3876
+
3877
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3878
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3879
+ </xsl:apply-templates>
3880
+
3881
+ </xsl:when>
3882
+ <xsl:otherwise>
3883
+
3884
+ <xsl:variable name="simple-table">
3885
+
3886
+ <xsl:variable name="dl_table">
3887
+ <tbody>
3888
+ <xsl:apply-templates mode="dl">
3889
+ <xsl:with-param name="id" select="@id"/>
3890
+ </xsl:apply-templates>
3891
+ </tbody>
3892
+ </xsl:variable>
3893
+
3894
+ <xsl:copy-of select="$dl_table"/>
3895
+ </xsl:variable>
3896
+
3897
+ <xsl:variable name="colwidths">
3898
+ <xsl:call-template name="calculate-column-widths">
3899
+ <xsl:with-param name="cols-count" select="2"/>
3900
+ <xsl:with-param name="table" select="$simple-table"/>
3901
+ </xsl:call-template>
3902
+ </xsl:variable>
3903
+
3904
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3905
+ DEBUG
3906
+ colwidths=<xsl:copy-of select="$colwidths"/>
3907
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3908
+
3909
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3910
+
3911
+ <xsl:variable name="maxlength_dt">
3912
+ <xsl:call-template name="getMaxLength_dt"/>
3913
+ </xsl:variable>
3914
+
3915
+ <xsl:variable name="isContainsKeepTogetherTag_">
3916
+ false
3917
+ </xsl:variable>
3918
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3919
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3920
+
3921
+
3922
+ <xsl:call-template name="setColumnWidth_dl">
3923
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3924
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3925
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3926
+ </xsl:call-template>
3927
+
3928
+ <fo:table-body>
3929
+
3930
+ <!-- DEBUG -->
3931
+ <xsl:if test="$table_if_debug = 'true'">
3932
+ <fo:table-row>
3933
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
3934
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3935
+ </fo:table-cell>
3936
+ </fo:table-row>
3937
+ </xsl:if>
3938
+
3939
+ <xsl:apply-templates>
3940
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3941
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
3942
+ </xsl:apply-templates>
3943
+
3944
+ </fo:table-body>
3945
+ </xsl:otherwise>
3946
+ </xsl:choose>
3346
3947
  </fo:table>
3347
3948
  </fo:block>
3348
3949
  </fo:block>
3349
- </xsl:if>
3950
+ </xsl:if> <!-- END: a few components -->
3350
3951
  </fo:block-container>
3351
3952
  </fo:block-container>
3352
3953
  </xsl:template><xsl:template name="setColumnWidth_dl">
3353
3954
  <xsl:param name="colwidths"/>
3354
3955
  <xsl:param name="maxlength_dt"/>
3956
+ <xsl:param name="isContainsKeepTogetherTag"/>
3957
+
3958
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
3959
+
3355
3960
  <xsl:choose>
3356
3961
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3357
3962
  <fo:table-column column-width="50%"/>
@@ -3359,6 +3964,16 @@
3359
3964
  </xsl:when>
3360
3965
  <xsl:otherwise>
3361
3966
  <xsl:choose>
3967
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3968
+ <xsl:call-template name="insertTableColumnWidth">
3969
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3970
+ </xsl:call-template>
3971
+ </xsl:when>
3972
+ <xsl:when test="$isContainsKeepTogetherTag">
3973
+ <xsl:call-template name="insertTableColumnWidth">
3974
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3975
+ </xsl:call-template>
3976
+ </xsl:when>
3362
3977
  <!-- to set width check most wide chars like `W` -->
3363
3978
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3364
3979
  <fo:table-column column-width="7%"/>
@@ -3389,20 +4004,31 @@
3389
4004
  <fo:table-column column-width="60%"/>
3390
4005
  </xsl:when>
3391
4006
  <xsl:otherwise>
3392
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3393
- <xsl:choose>
3394
- <xsl:when test=". = 1 or . = 0">
3395
- <fo:table-column column-width="proportional-column-width(2)"/>
3396
- </xsl:when>
3397
- <xsl:otherwise>
3398
- <fo:table-column column-width="proportional-column-width({.})"/>
3399
- </xsl:otherwise>
3400
- </xsl:choose>
3401
- </xsl:for-each>
4007
+ <xsl:call-template name="insertTableColumnWidth">
4008
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4009
+ </xsl:call-template>
3402
4010
  </xsl:otherwise>
3403
4011
  </xsl:choose>
3404
4012
  </xsl:otherwise>
3405
4013
  </xsl:choose>
4014
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4015
+ <xsl:param name="colwidths"/>
4016
+
4017
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4018
+ <xsl:choose>
4019
+ <xsl:when test=". = 1 or . = 0">
4020
+ <fo:table-column column-width="proportional-column-width(2)"/>
4021
+ </xsl:when>
4022
+ <xsl:otherwise>
4023
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
4024
+ <xsl:variable name="divider">
4025
+ <xsl:value-of select="@divider"/>
4026
+ <xsl:if test="not(@divider)">1</xsl:if>
4027
+ </xsl:variable>
4028
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
4029
+ </xsl:otherwise>
4030
+ </xsl:choose>
4031
+ </xsl:for-each>
3406
4032
  </xsl:template><xsl:template name="getMaxLength_dt">
3407
4033
  <xsl:variable name="lengths">
3408
4034
  <xsl:for-each select="*[local-name()='dt']">
@@ -3426,7 +4052,6 @@
3426
4052
  <xsl:value-of select="$maxLength"/>
3427
4053
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3428
4054
  <xsl:param name="key_iso"/>
3429
-
3430
4055
  <!-- <tr>
3431
4056
  <td>NOTE</td>
3432
4057
  <td>
@@ -3434,27 +4059,47 @@
3434
4059
  </td>
3435
4060
  </tr>
3436
4061
  -->
3437
- <fo:table-row>
4062
+ <!-- OLD Variant -->
4063
+ <!-- <fo:table-row>
3438
4064
  <fo:table-cell>
3439
4065
  <fo:block margin-top="6pt">
3440
4066
  <xsl:if test="normalize-space($key_iso) = 'true'">
3441
4067
  <xsl:attribute name="margin-top">0</xsl:attribute>
3442
4068
  </xsl:if>
3443
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4069
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3444
4070
  </fo:block>
3445
4071
  </fo:table-cell>
3446
4072
  <fo:table-cell>
3447
4073
  <fo:block>
3448
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4074
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
4075
+ </fo:block>
4076
+ </fo:table-cell>
4077
+ </fo:table-row> -->
4078
+ <!-- <tr>
4079
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
4080
+ </tr>
4081
+ -->
4082
+ <fo:table-row>
4083
+ <fo:table-cell number-columns-spanned="2">
4084
+ <fo:block>
4085
+ <xsl:call-template name="note"/>
3449
4086
  </fo:block>
3450
4087
  </fo:table-cell>
3451
4088
  </fo:table-row>
3452
4089
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
4090
+ <xsl:param name="id"/>
4091
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3453
4092
  <tr>
3454
4093
  <td>
4094
+ <xsl:attribute name="id">
4095
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4096
+ </xsl:attribute>
3455
4097
  <xsl:apply-templates/>
3456
4098
  </td>
3457
4099
  <td>
4100
+ <xsl:attribute name="id">
4101
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4102
+ </xsl:attribute>
3458
4103
 
3459
4104
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3460
4105
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3465,50 +4110,122 @@
3465
4110
 
3466
4111
  </xsl:template><xsl:template match="*[local-name()='dt']">
3467
4112
  <xsl:param name="key_iso"/>
4113
+ <xsl:param name="split_keep-within-line"/>
3468
4114
 
3469
4115
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3470
- <fo:table-cell>
4116
+ <xsl:call-template name="insert_dt_cell">
4117
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4118
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4119
+ </xsl:call-template>
4120
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4121
+ <xsl:call-template name="insert_dd_cell">
4122
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4123
+ </xsl:call-template>
4124
+ </xsl:for-each>
4125
+ </fo:table-row>
4126
+ </xsl:template><xsl:template name="insert_dt_cell">
4127
+ <xsl:param name="key_iso"/>
4128
+ <xsl:param name="split_keep-within-line"/>
4129
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4130
+
4131
+ <xsl:if test="$isGenerateTableIF = 'true'">
4132
+ <!-- border is mandatory, to calculate real width -->
4133
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4134
+ <xsl:attribute name="text-align">left</xsl:attribute>
4135
+ </xsl:if>
4136
+
4137
+
4138
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4139
+ <xsl:copy-of select="@id"/>
4140
+
4141
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4142
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4143
+ </xsl:if>
4144
+
4145
+
4146
+
4147
+ <xsl:apply-templates>
4148
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4149
+ </xsl:apply-templates>
4150
+
4151
+ <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"/> -->
4152
+
4153
+ </fo:block>
4154
+ </fo:table-cell>
4155
+ </xsl:template><xsl:template name="insert_dd_cell">
4156
+ <xsl:param name="split_keep-within-line"/>
4157
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4158
+
4159
+ <xsl:if test="$isGenerateTableIF = 'true'">
4160
+ <!-- border is mandatory, to calculate real width -->
4161
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4162
+ </xsl:if>
4163
+
4164
+ <fo:block>
4165
+
4166
+ <xsl:if test="$isGenerateTableIF = 'true'">
4167
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4168
+ </xsl:if>
4169
+
3471
4170
 
3472
- <fo:block xsl:use-attribute-sets="dt-style">
3473
- <xsl:copy-of select="@id"/>
3474
-
3475
- <xsl:if test="normalize-space($key_iso) = 'true'">
3476
- <xsl:attribute name="margin-top">0</xsl:attribute>
3477
- </xsl:if>
3478
-
3479
-
3480
-
3481
- <xsl:apply-templates/>
3482
- </fo:block>
3483
- </fo:table-cell>
3484
- <fo:table-cell>
3485
- <fo:block>
3486
-
3487
4171
 
3488
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3489
- <xsl:with-param name="process">true</xsl:with-param>
3490
- </xsl:apply-templates>
3491
- </fo:block>
3492
- </fo:table-cell>
3493
- </fo:table-row>
4172
+ <xsl:choose>
4173
+ <xsl:when test="$isGenerateTableIF = 'true'">
4174
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4175
+ <xsl:with-param name="process">true</xsl:with-param>
4176
+ </xsl:apply-templates>
4177
+ </xsl:when>
4178
+ <xsl:otherwise>
4179
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4180
+ <xsl:with-param name="process">true</xsl:with-param>
4181
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4182
+ </xsl:apply-templates>
4183
+ </xsl:otherwise>
4184
+
4185
+ </xsl:choose>
4186
+
4187
+ <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"/> -->
4188
+
4189
+ </fo:block>
4190
+ </fo:table-cell>
3494
4191
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3495
4192
  <xsl:apply-templates/>
3496
4193
  </xsl:template><xsl:template match="*[local-name()='dd']">
3497
4194
  <xsl:param name="process">false</xsl:param>
4195
+ <xsl:param name="split_keep-within-line"/>
3498
4196
  <xsl:if test="$process = 'true'">
3499
4197
  <xsl:apply-templates select="@language"/>
3500
- <xsl:apply-templates/>
4198
+ <xsl:apply-templates>
4199
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4200
+ </xsl:apply-templates>
3501
4201
  </xsl:if>
3502
4202
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3503
4203
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3504
- </xsl:template><xsl:template match="*[local-name()='em']">
4204
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4205
+ <xsl:param name="id"/>
4206
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4207
+ <tr>
4208
+ <td>
4209
+ <xsl:copy-of select="node()"/>
4210
+ </td>
4211
+ <td>
4212
+
4213
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
4214
+
4215
+ </td>
4216
+ </tr>
4217
+
4218
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
3505
4219
  <fo:inline font-style="italic">
3506
4220
  <xsl:apply-templates/>
3507
4221
  </fo:inline>
3508
4222
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4223
+ <xsl:param name="split_keep-within-line"/>
3509
4224
  <fo:inline font-weight="bold">
3510
4225
 
3511
- <xsl:apply-templates/>
4226
+ <xsl:apply-templates>
4227
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4228
+ </xsl:apply-templates>
3512
4229
  </fo:inline>
3513
4230
  </xsl:template><xsl:template match="*[local-name()='padding']">
3514
4231
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3547,13 +4264,15 @@
3547
4264
  <xsl:choose>
3548
4265
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3549
4266
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3550
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4267
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3551
4268
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3552
4269
  </xsl:choose>
3553
4270
  </xsl:attribute>
3554
4271
  </xsl:if>
3555
4272
  <xsl:apply-templates/>
3556
4273
  </fo:inline>
4274
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4275
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3557
4276
  </xsl:template><xsl:template match="*[local-name()='underline']">
3558
4277
  <fo:inline text-decoration="underline">
3559
4278
  <xsl:apply-templates/>
@@ -3701,54 +4420,120 @@
3701
4420
  <fo:block break-after="page"/>
3702
4421
  <fo:block> </fo:block>
3703
4422
  <fo:block break-after="page"/>
4423
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
4424
+ <xsl:apply-templates/>
3704
4425
  </xsl:template><xsl:template name="tokenize">
3705
4426
  <xsl:param name="text"/>
3706
4427
  <xsl:param name="separator" select="' '"/>
3707
4428
  <xsl:choose>
4429
+
4430
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4431
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4432
+ </xsl:when>
3708
4433
  <xsl:when test="not(contains($text, $separator))">
3709
4434
  <word>
3710
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3711
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3712
4435
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3713
- <xsl:variable name="len_str">
3714
- <xsl:choose>
3715
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3716
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3717
- </xsl:when>
3718
- <xsl:otherwise>
3719
- <xsl:value-of select="$len_str_tmp"/>
3720
- </xsl:otherwise>
3721
- </xsl:choose>
3722
- </xsl:variable>
3723
-
3724
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3725
- <xsl:message>
3726
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3727
- len_str=<xsl:value-of select="$len_str"/>
3728
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3729
- </xsl:message>
3730
- </xsl:if> -->
3731
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3732
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3733
4436
  <xsl:choose>
3734
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3735
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4437
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
4438
+ <xsl:value-of select="$len_str_tmp"/>
3736
4439
  </xsl:when>
3737
4440
  <xsl:otherwise>
3738
- <xsl:value-of select="$len_str"/>
4441
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4442
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4443
+ <xsl:variable name="len_str">
4444
+ <xsl:choose>
4445
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4446
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
4447
+ </xsl:when>
4448
+ <xsl:otherwise>
4449
+ <xsl:value-of select="$len_str_tmp"/>
4450
+ </xsl:otherwise>
4451
+ </xsl:choose>
4452
+ </xsl:variable>
4453
+
4454
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4455
+ <xsl:message>
4456
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4457
+ len_str=<xsl:value-of select="$len_str"/>
4458
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4459
+ </xsl:message>
4460
+ </xsl:if> -->
4461
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4462
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
4463
+ <xsl:choose>
4464
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4465
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4466
+ </xsl:when>
4467
+ <xsl:otherwise>
4468
+ <xsl:value-of select="$len_str"/>
4469
+ </xsl:otherwise>
4470
+ </xsl:choose>
3739
4471
  </xsl:otherwise>
3740
4472
  </xsl:choose>
3741
4473
  </word>
3742
4474
  </xsl:when>
3743
4475
  <xsl:otherwise>
3744
4476
  <word>
3745
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4477
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4478
+ <xsl:choose>
4479
+ <xsl:when test="$isGenerateTableIF = 'true'">
4480
+ <xsl:value-of select="$word"/>
4481
+ </xsl:when>
4482
+ <xsl:otherwise>
4483
+ <xsl:value-of select="string-length($word)"/>
4484
+ </xsl:otherwise>
4485
+ </xsl:choose>
3746
4486
  </word>
3747
4487
  <xsl:call-template name="tokenize">
3748
4488
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3749
4489
  </xsl:call-template>
3750
4490
  </xsl:otherwise>
3751
4491
  </xsl:choose>
4492
+ </xsl:template><xsl:template name="tokenize_with_tags">
4493
+ <xsl:param name="tags"/>
4494
+ <xsl:param name="text"/>
4495
+ <xsl:param name="separator" select="' '"/>
4496
+ <xsl:choose>
4497
+
4498
+ <xsl:when test="not(contains($text, $separator))">
4499
+ <word>
4500
+ <xsl:call-template name="enclose_text_in_tags">
4501
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4502
+ <xsl:with-param name="tags" select="$tags"/>
4503
+ </xsl:call-template>
4504
+ </word>
4505
+ </xsl:when>
4506
+ <xsl:otherwise>
4507
+ <word>
4508
+ <xsl:call-template name="enclose_text_in_tags">
4509
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4510
+ <xsl:with-param name="tags" select="$tags"/>
4511
+ </xsl:call-template>
4512
+ </word>
4513
+ <xsl:call-template name="tokenize_with_tags">
4514
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4515
+ </xsl:call-template>
4516
+ </xsl:otherwise>
4517
+ </xsl:choose>
4518
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4519
+ <xsl:param name="text"/>
4520
+ <xsl:param name="tags"/>
4521
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4522
+
4523
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4524
+
4525
+ <xsl:choose>
4526
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4527
+ <xsl:otherwise>
4528
+ <xsl:element name="{$tag_name}">
4529
+ <xsl:call-template name="enclose_text_in_tags">
4530
+ <xsl:with-param name="text" select="$text"/>
4531
+ <xsl:with-param name="tags" select="$tags"/>
4532
+ <xsl:with-param name="num" select="$num + 1"/>
4533
+ </xsl:call-template>
4534
+ </xsl:element>
4535
+ </xsl:otherwise>
4536
+ </xsl:choose>
3752
4537
  </xsl:template><xsl:template name="max_length">
3753
4538
  <xsl:param name="words"/>
3754
4539
  <xsl:for-each select="$words//word">
@@ -3821,36 +4606,47 @@
3821
4606
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3822
4607
  <xsl:param name="text" select="."/>
3823
4608
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4609
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3824
4610
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4611
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3825
4612
  <xsl:variable name="zero-space">​</xsl:variable>
3826
4613
  <xsl:choose>
3827
4614
  <xsl:when test="contains($text, $zero-space-after-equals)">
3828
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4615
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3829
4616
  <xsl:value-of select="$zero-space-after-equals"/>
3830
4617
  <xsl:value-of select="$zero-space"/>
3831
4618
  <xsl:call-template name="add-zero-spaces-equal">
3832
4619
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3833
- </xsl:call-template>
4620
+ </xsl:call-template> -->
4621
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3834
4622
  </xsl:when>
3835
4623
  <xsl:when test="contains($text, $zero-space-after-equal)">
3836
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4624
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3837
4625
  <xsl:value-of select="$zero-space-after-equal"/>
3838
4626
  <xsl:value-of select="$zero-space"/>
3839
4627
  <xsl:call-template name="add-zero-spaces-equal">
3840
4628
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3841
- </xsl:call-template>
4629
+ </xsl:call-template> -->
4630
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3842
4631
  </xsl:when>
3843
4632
  <xsl:otherwise>
3844
4633
  <xsl:value-of select="$text"/>
3845
4634
  </xsl:otherwise>
3846
4635
  </xsl:choose>
3847
4636
  </xsl:template><xsl:template name="getSimpleTable">
4637
+ <xsl:param name="id"/>
4638
+
3848
4639
  <xsl:variable name="simple-table">
3849
4640
 
4641
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4642
+ <xsl:variable name="table_without_br">
4643
+ <xsl:apply-templates mode="table-without-br"/>
4644
+ </xsl:variable>
4645
+
3850
4646
  <!-- Step 1. colspan processing -->
3851
4647
  <xsl:variable name="simple-table-colspan">
3852
4648
  <tbody>
3853
- <xsl:apply-templates mode="simple-table-colspan"/>
4649
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3854
4650
  </tbody>
3855
4651
  </xsl:variable>
3856
4652
 
@@ -3859,10 +4655,67 @@
3859
4655
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3860
4656
  </xsl:variable>
3861
4657
 
3862
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3863
-
4658
+ <!-- Step 3: add id to each cell -->
4659
+ <!-- add <word>...</word> for each word, image, math -->
4660
+ <xsl:variable name="simple-table-id">
4661
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4662
+ <xsl:with-param name="id" select="$id"/>
4663
+ </xsl:apply-templates>
4664
+ </xsl:variable>
4665
+
4666
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4667
+
3864
4668
  </xsl:variable>
3865
4669
  <xsl:copy-of select="$simple-table"/>
4670
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4671
+ <xsl:copy>
4672
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4673
+ </xsl:copy>
4674
+ </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">
4675
+ <xsl:copy>
4676
+ <xsl:copy-of select="@*"/>
4677
+ <p>
4678
+ <xsl:copy-of select="node()"/>
4679
+ </p>
4680
+ </xsl:copy>
4681
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4682
+ <xsl:copy>
4683
+ <xsl:copy-of select="@*"/>
4684
+ <xsl:for-each select="*[local-name()='br']">
4685
+ <xsl:variable name="current_id" select="generate-id()"/>
4686
+ <p>
4687
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4688
+ <xsl:copy-of select="."/>
4689
+ </xsl:for-each>
4690
+ </p>
4691
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4692
+ <p>
4693
+ <xsl:for-each select="following-sibling::node()">
4694
+ <xsl:copy-of select="."/>
4695
+ </xsl:for-each>
4696
+ </p>
4697
+ </xsl:if>
4698
+ </xsl:for-each>
4699
+ </xsl:copy>
4700
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4701
+ <xsl:for-each select="*[local-name()='br']">
4702
+ <xsl:variable name="current_id" select="generate-id()"/>
4703
+ <p>
4704
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4705
+ <xsl:copy-of select="."/>
4706
+ </xsl:for-each>
4707
+ </p>
4708
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4709
+ <p>
4710
+ <xsl:for-each select="following-sibling::node()">
4711
+ <xsl:copy-of select="."/>
4712
+ </xsl:for-each>
4713
+ </p>
4714
+ </xsl:if>
4715
+ </xsl:for-each>
4716
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4717
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4718
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3866
4719
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3867
4720
  <xsl:apply-templates mode="simple-table-colspan"/>
3868
4721
  </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">
@@ -3952,6 +4805,126 @@
3952
4805
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3953
4806
  <xsl:with-param name="previousRow" select="$newRow"/>
3954
4807
  </xsl:apply-templates>
4808
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4809
+ <xsl:param name="id"/>
4810
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4811
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4812
+ <xsl:with-param name="id" select="$id_prefixed"/>
4813
+ </xsl:apply-templates>
4814
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4815
+ <xsl:param name="id"/>
4816
+ <xsl:copy>
4817
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4818
+ <xsl:with-param name="id" select="$id"/>
4819
+ </xsl:apply-templates>
4820
+ </xsl:copy>
4821
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4822
+ <xsl:param name="id"/>
4823
+ <xsl:copy>
4824
+ <xsl:copy-of select="@*"/>
4825
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4826
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4827
+ <xsl:with-param name="id" select="$id"/>
4828
+ </xsl:apply-templates>
4829
+ </xsl:copy>
4830
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4831
+ <xsl:param name="id"/>
4832
+ <xsl:copy>
4833
+ <xsl:copy-of select="@*"/>
4834
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4835
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4836
+ <xsl:attribute name="id">
4837
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4838
+ </xsl:attribute>
4839
+
4840
+ <xsl:for-each select="*[local-name() = 'p']">
4841
+ <xsl:copy>
4842
+ <xsl:copy-of select="@*"/>
4843
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4844
+ <xsl:attribute name="id">
4845
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4846
+ </xsl:attribute>
4847
+
4848
+ <xsl:copy-of select="node()"/>
4849
+ </xsl:copy>
4850
+ </xsl:for-each>
4851
+
4852
+
4853
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4854
+
4855
+ <xsl:variable name="td_text">
4856
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4857
+ </xsl:variable>
4858
+
4859
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4860
+
4861
+ <xsl:variable name="words">
4862
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4863
+ <word>
4864
+ <xsl:copy-of select="."/>
4865
+ </word>
4866
+ </xsl:for-each>
4867
+
4868
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4869
+ <xsl:copy-of select="."/>
4870
+ </xsl:for-each>
4871
+
4872
+ </xsl:variable>
4873
+
4874
+ <xsl:for-each select="xalan:nodeset($words)/word">
4875
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4876
+ <xsl:copy>
4877
+ <xsl:attribute name="id">
4878
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4879
+ </xsl:attribute>
4880
+ <xsl:copy-of select="node()"/>
4881
+ </xsl:copy>
4882
+ </xsl:for-each>
4883
+ </xsl:if>
4884
+ </xsl:copy>
4885
+
4886
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
4887
+ <xsl:copy>
4888
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
4889
+ </xsl:copy>
4890
+ </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">
4891
+ <xsl:variable name="formatting_tags">
4892
+ <xsl:call-template name="getFormattingTags"/>
4893
+ </xsl:variable>
4894
+ <word>
4895
+ <xsl:call-template name="enclose_text_in_tags">
4896
+ <xsl:with-param name="text" select="normalize-space(.)"/>
4897
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4898
+ </xsl:call-template>
4899
+ </word>
4900
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
4901
+
4902
+ <xsl:variable name="td_text" select="."/>
4903
+
4904
+ <xsl:variable name="string_with_added_zerospaces">
4905
+ <xsl:call-template name="add-zero-spaces-java">
4906
+ <xsl:with-param name="text" select="$td_text"/>
4907
+ </xsl:call-template>
4908
+ </xsl:variable>
4909
+
4910
+ <xsl:variable name="formatting_tags">
4911
+ <xsl:call-template name="getFormattingTags"/>
4912
+ </xsl:variable>
4913
+
4914
+ <!-- <word>text</word> -->
4915
+ <xsl:call-template name="tokenize_with_tags">
4916
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4917
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4918
+ </xsl:call-template>
4919
+ </xsl:template><xsl:template name="getFormattingTags">
4920
+ <tags>
4921
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
4922
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
4923
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
4924
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
4925
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
4926
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
4927
+ </tags>
3955
4928
  </xsl:template><xsl:template name="getLang">
3956
4929
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3957
4930
  <xsl:variable name="language">
@@ -4006,6 +4979,9 @@
4006
4979
  <xsl:variable name="isDeleted" select="@deleted"/>
4007
4980
 
4008
4981
  <fo:inline xsl:use-attribute-sets="mathml-style">
4982
+
4983
+
4984
+
4009
4985
 
4010
4986
 
4011
4987
  <xsl:call-template name="setTrackChangesStyles">
@@ -4013,48 +4989,80 @@
4013
4989
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4014
4990
  </xsl:call-template>
4015
4991
 
4992
+ <xsl:if test="$add_math_as_text = 'true'">
4993
+ <!-- insert helper tag -->
4994
+ <!-- set unique font-size (fiction) -->
4995
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4996
+ <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 -->
4997
+ </xsl:if>
4016
4998
 
4017
-
4018
- <xsl:variable name="mathml">
4019
- <xsl:apply-templates select="." mode="mathml"/>
4999
+ <xsl:variable name="mathml_content">
5000
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4020
5001
  </xsl:variable>
4021
- <fo:instream-foreign-object fox:alt-text="Math">
4022
5002
 
5003
+
5004
+ <xsl:call-template name="mathml_instream_object">
5005
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
5006
+ </xsl:call-template>
4023
5007
 
4024
-
4025
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4026
- <xsl:variable name="comment_text_">
4027
- <xsl:choose>
4028
- <xsl:when test="normalize-space($comment_text_following) != ''">
4029
- <xsl:value-of select="$comment_text_following"/>
4030
- </xsl:when>
4031
- <xsl:otherwise>
4032
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4033
- </xsl:otherwise>
4034
- </xsl:choose>
4035
- </xsl:variable>
4036
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4037
-
4038
- <xsl:if test="normalize-space($comment_text) != ''">
4039
- <!-- put Mathin Alternate Text -->
4040
- <xsl:attribute name="fox:alt-text">
4041
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4042
- </xsl:attribute>
4043
- </xsl:if>
4044
-
4045
- <xsl:variable name="mathml_content">
4046
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4047
- </xsl:variable>
4048
- <!-- put MathML in Actual Text -->
4049
- <xsl:attribute name="fox:actual-text">
4050
- <xsl:value-of select="$mathml_content"/>
4051
- </xsl:attribute>
4052
-
4053
-
4054
-
4055
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4056
- </fo:instream-foreign-object>
5008
+
4057
5009
  </fo:inline>
5010
+ </xsl:template><xsl:template name="getMathml_comment_text">
5011
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5012
+ <xsl:variable name="comment_text_">
5013
+ <xsl:choose>
5014
+ <xsl:when test="normalize-space($comment_text_following) != ''">
5015
+ <xsl:value-of select="$comment_text_following"/>
5016
+ </xsl:when>
5017
+ <xsl:otherwise>
5018
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5019
+ </xsl:otherwise>
5020
+ </xsl:choose>
5021
+ </xsl:variable>
5022
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5023
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
5024
+ <xsl:value-of select="$comment_text"/>
5025
+ </xsl:template><xsl:template name="mathml_instream_object">
5026
+ <xsl:param name="comment_text"/>
5027
+ <xsl:param name="mathml_content"/>
5028
+
5029
+ <xsl:variable name="comment_text_">
5030
+ <xsl:choose>
5031
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5032
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5033
+ </xsl:choose>
5034
+ </xsl:variable>
5035
+
5036
+ <xsl:variable name="mathml">
5037
+ <xsl:apply-templates select="." mode="mathml"/>
5038
+ </xsl:variable>
5039
+
5040
+ <fo:instream-foreign-object fox:alt-text="Math">
5041
+
5042
+
5043
+
5044
+
5045
+
5046
+
5047
+
5048
+ <!-- put MathML in Actual Text -->
5049
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5050
+ <xsl:attribute name="fox:actual-text">
5051
+ <xsl:value-of select="$mathml_content"/>
5052
+ </xsl:attribute>
5053
+
5054
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5055
+ <xsl:if test="normalize-space($comment_text_) != ''">
5056
+ <!-- put Mathin Alternate Text -->
5057
+ <xsl:attribute name="fox:alt-text">
5058
+ <xsl:value-of select="$comment_text_"/>
5059
+ </xsl:attribute>
5060
+ </xsl:if>
5061
+ <!-- </xsl:if> -->
5062
+
5063
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
5064
+
5065
+ </fo:instream-foreign-object>
4058
5066
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4059
5067
  <!-- <xsl:text>a+b</xsl:text> -->
4060
5068
  <xsl:text>&lt;</xsl:text>
@@ -4085,7 +5093,9 @@
4085
5093
  <!-- replace start and end spaces to non-break space -->
4086
5094
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4087
5095
  </xsl:copy>
4088
- </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">
5096
+ </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">
5097
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5098
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4089
5099
  <xsl:variable name="target">
4090
5100
  <xsl:choose>
4091
5101
  <xsl:when test="@updatetype = 'true'">
@@ -4318,7 +5328,12 @@
4318
5328
 
4319
5329
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4320
5330
 
5331
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5332
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5333
+ </xsl:if>
5334
+
4321
5335
 
5336
+
4322
5337
 
4323
5338
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4324
5339
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -4675,18 +5690,33 @@
4675
5690
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4676
5691
  <xsl:copy>
4677
5692
  <xsl:apply-templates select="@*" mode="svg_update"/>
4678
- <xsl:variable name="viewbox">
5693
+ <xsl:variable name="viewbox_">
4679
5694
  <xsl:call-template name="split">
4680
5695
  <xsl:with-param name="pText" select="@viewBox"/>
4681
5696
  <xsl:with-param name="sep" select="' '"/>
4682
5697
  </xsl:call-template>
4683
5698
  </xsl:variable>
5699
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5700
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5701
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5702
+
4684
5703
  <xsl:attribute name="width">
4685
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5704
+ <xsl:choose>
5705
+ <xsl:when test="$width != ''">
5706
+ <xsl:value-of select="round($width)"/>
5707
+ </xsl:when>
5708
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5709
+ </xsl:choose>
4686
5710
  </xsl:attribute>
4687
5711
  <xsl:attribute name="height">
4688
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5712
+ <xsl:choose>
5713
+ <xsl:when test="$height != ''">
5714
+ <xsl:value-of select="round($height)"/>
5715
+ </xsl:when>
5716
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5717
+ </xsl:choose>
4689
5718
  </xsl:attribute>
5719
+
4690
5720
  <xsl:apply-templates mode="svg_update"/>
4691
5721
  </xsl:copy>
4692
5722
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4881,7 +5911,11 @@
4881
5911
  <xsl:apply-templates mode="bookmarks"/>
4882
5912
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4883
5913
  <xsl:apply-templates select="."/>
4884
- </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">
5914
+ </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">
5915
+ <xsl:apply-templates mode="contents"/>
5916
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5917
+ <xsl:apply-templates mode="bookmarks"/>
5918
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
4885
5919
  <xsl:apply-templates mode="bookmarks"/>
4886
5920
  </xsl:template><xsl:template name="addBookmarks">
4887
5921
  <xsl:param name="contents"/>
@@ -5163,7 +6197,9 @@
5163
6197
  <xsl:apply-templates/>
5164
6198
  </xsl:otherwise>
5165
6199
  </xsl:choose>
5166
- </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">
6200
+ </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">
6201
+ <xsl:value-of select="."/>
6202
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5167
6203
  <xsl:text> </xsl:text>
5168
6204
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5169
6205
  <xsl:copy>
@@ -5194,9 +6230,22 @@
5194
6230
  </xsl:when>
5195
6231
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5196
6232
  </xsl:choose>
6233
+ </xsl:template><xsl:template match="text()" mode="contents_item">
6234
+ <xsl:call-template name="keep_together_standard_number"/>
6235
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
6236
+ <xsl:apply-templates mode="contents_item"/>
5197
6237
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5198
6238
 
5199
6239
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6240
+
6241
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6242
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6243
+ </xsl:if>
6244
+
6245
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6246
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6247
+ </xsl:if>
6248
+
5200
6249
  <xsl:copy-of select="@id"/>
5201
6250
 
5202
6251
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5296,17 +6345,15 @@
5296
6345
 
5297
6346
  <!-- split text by zero-width space -->
5298
6347
  <xsl:variable name="text_step4">
5299
- <xsl:call-template name="split">
6348
+ <xsl:call-template name="split_for_interspers">
5300
6349
  <xsl:with-param name="pText" select="$text_step3"/>
5301
6350
  <xsl:with-param name="sep" select="$zero_width_space"/>
5302
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5303
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5304
6351
  </xsl:call-template>
5305
6352
  </xsl:variable>
5306
6353
 
5307
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6354
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5308
6355
  <xsl:choose>
5309
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6356
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5310
6357
  <xsl:call-template name="interspers">
5311
6358
  <xsl:with-param name="str" select="."/>
5312
6359
  </xsl:call-template>
@@ -5317,6 +6364,30 @@
5317
6364
  </xsl:choose>
5318
6365
  </xsl:for-each>
5319
6366
 
6367
+ </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">
6368
+ <xsl:param name="pText" select="."/>
6369
+ <xsl:param name="sep" select="','"/>
6370
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6371
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6372
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6373
+ <xsl:call-template name="replace_tag_interspers">
6374
+ <xsl:with-param name="text" select="$text"/>
6375
+ </xsl:call-template>
6376
+ </xsl:template><xsl:template name="replace_tag_interspers">
6377
+ <xsl:param name="text"/>
6378
+ <xsl:choose>
6379
+ <xsl:when test="contains($text, $interspers_tag_open)">
6380
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6381
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6382
+ <interspers>
6383
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6384
+ </interspers>
6385
+ <xsl:call-template name="replace_tag_interspers">
6386
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6387
+ </xsl:call-template>
6388
+ </xsl:when>
6389
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6390
+ </xsl:choose>
5320
6391
  </xsl:template><xsl:template name="interspers">
5321
6392
  <xsl:param name="str"/>
5322
6393
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5545,7 +6616,9 @@
5545
6616
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5546
6617
  </xsl:if>
5547
6618
  <xsl:variable name="simple-table">
5548
- <xsl:call-template name="getSimpleTable"/>
6619
+ <xsl:call-template name="getSimpleTable">
6620
+ <xsl:with-param name="id" select="@id"/>
6621
+ </xsl:call-template>
5549
6622
  </xsl:variable>
5550
6623
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5551
6624
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -5652,39 +6725,67 @@
5652
6725
  </xsl:otherwise>
5653
6726
  </xsl:choose>
5654
6727
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5655
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5656
-
6728
+
6729
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
6730
+
5657
6731
 
6732
+
5658
6733
  <xsl:variable name="fo_element">
5659
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6734
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5660
6735
  block
5661
6736
  </xsl:variable>
5662
6737
 
5663
- <!-- display 'EXAMPLE' -->
5664
- <xsl:apply-templates select="*[local-name()='name']">
5665
- <xsl:with-param name="fo_element" select="$fo_element"/>
5666
- </xsl:apply-templates>
6738
+ <fo:block-container margin-left="0mm">
5667
6739
 
5668
- <xsl:choose>
5669
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5670
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5671
- <fo:block-container margin-left="0mm" margin-right="0mm">
5672
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6740
+ <xsl:choose>
6741
+
6742
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6743
+
6744
+ <!-- display name 'EXAMPLE' in a separate block -->
6745
+ <fo:block>
6746
+ <xsl:apply-templates select="*[local-name()='name']">
5673
6747
  <xsl:with-param name="fo_element" select="$fo_element"/>
5674
6748
  </xsl:apply-templates>
6749
+ </fo:block>
6750
+
6751
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6752
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6753
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6754
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6755
+ </xsl:apply-templates>
6756
+ </fo:block-container>
5675
6757
  </fo:block-container>
5676
- </fo:block-container>
5677
- </xsl:when>
5678
- <xsl:otherwise>
5679
- <fo:inline>
5680
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5681
- <xsl:with-param name="fo_element" select="$fo_element"/>
5682
- </xsl:apply-templates>
5683
- </fo:inline>
5684
- </xsl:otherwise>
5685
- </xsl:choose>
5686
-
5687
- </fo:block>
6758
+ </xsl:when> <!-- end block -->
6759
+
6760
+ <xsl:otherwise> <!-- inline -->
6761
+
6762
+ <!-- display 'EXAMPLE' and first element in the same line -->
6763
+ <fo:block>
6764
+ <xsl:apply-templates select="*[local-name()='name']">
6765
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6766
+ </xsl:apply-templates>
6767
+ <fo:inline>
6768
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
6769
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6770
+ </xsl:apply-templates>
6771
+ </fo:inline>
6772
+ </fo:block>
6773
+
6774
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
6775
+ <!-- display further elements in blocks -->
6776
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6777
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6778
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
6779
+ <xsl:with-param name="fo_element" select="'block'"/>
6780
+ </xsl:apply-templates>
6781
+ </fo:block-container>
6782
+ </fo:block-container>
6783
+ </xsl:if>
6784
+ </xsl:otherwise> <!-- end inline -->
6785
+
6786
+ </xsl:choose>
6787
+ </fo:block-container>
6788
+ </fo:block-container>
5688
6789
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5689
6790
  <xsl:param name="fo_element">block</xsl:param>
5690
6791
 
@@ -5716,10 +6817,16 @@
5716
6817
  </xsl:variable>
5717
6818
  <xsl:choose>
5718
6819
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5719
- <fo:block xsl:use-attribute-sets="example-p-style">
5720
-
5721
- <xsl:apply-templates/>
5722
- </fo:block>
6820
+ <fo:block-container>
6821
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
6822
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6823
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6824
+ </xsl:if>
6825
+ <fo:block xsl:use-attribute-sets="example-p-style">
6826
+
6827
+ <xsl:apply-templates/>
6828
+ </fo:block>
6829
+ </fo:block-container>
5723
6830
  </xsl:when>
5724
6831
  <xsl:otherwise>
5725
6832
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -5764,7 +6871,7 @@
5764
6871
  </xsl:otherwise>
5765
6872
  </xsl:choose> -->
5766
6873
  </fo:block>
5767
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6874
+ </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">
5768
6875
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5769
6876
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5770
6877
  <xsl:if test="normalize-space() != ''">
@@ -5901,7 +7008,16 @@
5901
7008
  </fo:inline>
5902
7009
  </xsl:when>
5903
7010
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5904
- <fo:inline><xsl:apply-templates/></fo:inline>
7011
+
7012
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
7013
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
7014
+ <xsl:choose>
7015
+ <xsl:when test="$uri_src != ''">
7016
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
7017
+ </xsl:when>
7018
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
7019
+ </xsl:choose>
7020
+
5905
7021
  </xsl:otherwise>
5906
7022
  </xsl:choose>
5907
7023
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -6073,10 +7189,24 @@
6073
7189
 
6074
7190
  </fo:block>
6075
7191
  <xsl:apply-templates/>
6076
- </xsl:template><xsl:template match="*[local-name() = 'review']">
7192
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
6077
7193
  <!-- comment 2019-11-29 -->
6078
7194
  <!-- <fo:block font-weight="bold">Review:</fo:block>
6079
7195
  <xsl:apply-templates /> -->
7196
+
7197
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
7198
+
7199
+ <xsl:choose>
7200
+ <!-- if there isn't the attribute '@from', then -->
7201
+ <xsl:when test="$id_from = ''">
7202
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7203
+ </xsl:when>
7204
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
7205
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
7206
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7207
+ </xsl:when>
7208
+ </xsl:choose>
7209
+
6080
7210
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6081
7211
  <!-- 0xA0 to space replacement -->
6082
7212
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6433,7 +7563,10 @@
6433
7563
  <!-- to split by '_' and other chars -->
6434
7564
  <xsl:call-template name="add-zero-spaces-java"/>
6435
7565
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6436
- <fo:inline id="{@id}" font-size="1pt"/>
7566
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7567
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7568
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7569
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6437
7570
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6438
7571
  <!-- <row>
6439
7572
  <date>05-07-2013</date>
@@ -7046,6 +8179,120 @@
7046
8179
  <xsl:apply-templates select="." mode="update_xml_step1"/>
7047
8180
  </xsl:for-each>
7048
8181
  </xsl:copy>
8182
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
8183
+ <xsl:apply-templates mode="update_xml_step1"/>
8184
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
8185
+ <xsl:copy>
8186
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
8187
+ </xsl:copy>
8188
+ </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">
8189
+
8190
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
8191
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
8192
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8193
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8194
+ <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))"/>
8195
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
8196
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8197
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8198
+ <xsl:with-param name="text" select="$text_"/>
8199
+ </xsl:call-template></text></xsl:variable>
8200
+
8201
+ <xsl:variable name="parent" select="local-name(..)"/>
8202
+
8203
+ <xsl:variable name="text2">
8204
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
8205
+ <xsl:copy-of select="."/>
8206
+ </xsl:for-each></text>
8207
+ </xsl:variable>
8208
+
8209
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
8210
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
8211
+ <xsl:variable name="text3">
8212
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
8213
+ <xsl:choose>
8214
+ <xsl:when test="self::text()">
8215
+ <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))"/>
8216
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
8217
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8218
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8219
+ <xsl:with-param name="text" select="$text_units_"/>
8220
+ </xsl:call-template></text></xsl:variable>
8221
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
8222
+ </xsl:when>
8223
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8224
+ </xsl:choose>
8225
+ </xsl:for-each></text>
8226
+ </xsl:variable>
8227
+
8228
+ <xsl:choose>
8229
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
8230
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
8231
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
8232
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
8233
+ <xsl:choose>
8234
+ <xsl:when test="self::text()">
8235
+ <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))"/>
8236
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
8237
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8238
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8239
+ <xsl:with-param name="text" select="$text_dots_"/>
8240
+ </xsl:call-template></text></xsl:variable>
8241
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
8242
+ </xsl:when>
8243
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8244
+ </xsl:choose>
8245
+ </xsl:for-each>
8246
+ </xsl:when>
8247
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
8248
+ </xsl:choose>
8249
+
8250
+ </xsl:template><xsl:template name="replace_text_tags">
8251
+ <xsl:param name="tag_open"/>
8252
+ <xsl:param name="tag_close"/>
8253
+ <xsl:param name="text"/>
8254
+ <xsl:choose>
8255
+ <xsl:when test="contains($text, $tag_open)">
8256
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
8257
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
8258
+
8259
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
8260
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
8261
+ </xsl:element>
8262
+
8263
+ <xsl:call-template name="replace_text_tags">
8264
+ <xsl:with-param name="tag_open" select="$tag_open"/>
8265
+ <xsl:with-param name="tag_close" select="$tag_close"/>
8266
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
8267
+ </xsl:call-template>
8268
+ </xsl:when>
8269
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8270
+ </xsl:choose>
8271
+ </xsl:template><xsl:template name="printEdition">
8272
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8273
+ <xsl:text> </xsl:text>
8274
+ <xsl:choose>
8275
+ <xsl:when test="$edition_i18n != ''">
8276
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
8277
+ <xsl:call-template name="capitalize">
8278
+ <xsl:with-param name="str" select="$edition_i18n"/>
8279
+ </xsl:call-template>
8280
+ </xsl:when>
8281
+ <xsl:otherwise>
8282
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
8283
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
8284
+ <xsl:call-template name="capitalize">
8285
+ <xsl:with-param name="str">
8286
+ <xsl:call-template name="getLocalizedString">
8287
+ <xsl:with-param name="key">edition</xsl:with-param>
8288
+ </xsl:call-template>
8289
+ </xsl:with-param>
8290
+ </xsl:call-template>
8291
+ <xsl:text> </xsl:text>
8292
+ <xsl:value-of select="$edition"/>
8293
+ </xsl:if>
8294
+ </xsl:otherwise>
8295
+ </xsl:choose>
7049
8296
  </xsl:template><xsl:template name="convertDate">
7050
8297
  <xsl:param name="date"/>
7051
8298
  <xsl:param name="format" select="'short'"/>
@@ -7733,4 +8980,40 @@
7733
8980
  <xsl:value-of select="$value"/>
7734
8981
  </xsl:otherwise>
7735
8982
  </xsl:choose>
8983
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
8984
+ <xsl:param name="level">0</xsl:param>
8985
+
8986
+ <fo:block margin-left="{2*$level}mm">
8987
+ <xsl:text>
8988
+ &lt;</xsl:text>
8989
+ <xsl:value-of select="local-name()"/>
8990
+ <xsl:for-each select="@*">
8991
+ <xsl:text> </xsl:text>
8992
+ <xsl:value-of select="local-name()"/>
8993
+ <xsl:text>="</xsl:text>
8994
+ <xsl:value-of select="."/>
8995
+ <xsl:text>"</xsl:text>
8996
+ </xsl:for-each>
8997
+ <xsl:text>&gt;</xsl:text>
8998
+
8999
+ <xsl:if test="not(*)">
9000
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
9001
+ <xsl:text>&lt;/</xsl:text>
9002
+ <xsl:value-of select="local-name()"/>
9003
+ <xsl:text>&gt;</xsl:text>
9004
+ </xsl:if>
9005
+ </fo:block>
9006
+
9007
+ <xsl:if test="*">
9008
+ <fo:block>
9009
+ <xsl:apply-templates mode="print_as_xml">
9010
+ <xsl:with-param name="level" select="$level + 1"/>
9011
+ </xsl:apply-templates>
9012
+ </fo:block>
9013
+ <fo:block margin-left="{2*$level}mm">
9014
+ <xsl:text>&lt;/</xsl:text>
9015
+ <xsl:value-of select="local-name()"/>
9016
+ <xsl:text>&gt;</xsl:text>
9017
+ </fo:block>
9018
+ </xsl:if>
7736
9019
  </xsl:template></xsl:stylesheet>