metanorma-un 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -481,6 +481,7 @@
481
481
  </xsl:template>
482
482
 
483
483
  <xsl:template match="un:p" name="paragraph">
484
+ <xsl:param name="split_keep-within-line"/>
484
485
  <fo:block margin-bottom="6pt" line-height="122%">
485
486
  <xsl:if test="following-sibling::*">
486
487
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -491,7 +492,9 @@
491
492
  <xsl:otherwise>justify</xsl:otherwise>
492
493
  </xsl:choose>
493
494
  </xsl:attribute>
494
- <xsl:apply-templates/>
495
+ <xsl:apply-templates>
496
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
497
+ </xsl:apply-templates>
495
498
  </fo:block>
496
499
  </xsl:template>
497
500
 
@@ -833,7 +836,9 @@
833
836
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAJkAAAAmCAYAAADXwDkaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHR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Gs2TOrduuXKHbacDX+b65RuM+GowTjUAPQam8XjA6SNE23chcKnAvm/Fd/q/b+pCZF+Sl+P7vKGxdZ0/P/8TWFodKJUxzk/ABIcq6S4AN1w2JO8n5WfQ24WU8ynKdVem8l80QzUwx2y0exd1OefiZp2SwkH7fIApxnIhHgN/uwSnK9rHMGlTzW27fbttd6WZ4vyOjg6GU1zf67RY5eXlZTt37mz3PliWCaHL5ubmlm7QhsvK9sMi/W48Holu2rQxfTIvEVlcrPTjqe4EZ7CgwBdra9uSmtcPt6eta6FynHEJKYGv2Jd90s86AQpAwNJsRuT5xUAHrKK4IkCd9g6NQAQPIi8vz4f5o72tANZVgO/GMpe59RvrtQvt7JMQLS0dAyI9sst1m7uTuL28gqwJBqfh8pTaWOTqTIvSblYxVtTe2RnbvHlzg/fsEofcLK4oasda9edCs9An49viDe3tm3sS2YHA/gAL39Le/tU2lGFS0mphWYsBlhI432690j5UQnnB0DjXjuv/Pkr/knwu5fQOx46PR+RzPKz5FG+vOtVFmJn08mQq/ix17K4bM722kS3f8O0J0IOnwddK6jo7zqrx5f7EdckzAOrK/5erFeIorlh4YH/pthHXfac7449A8DVAaRXYTgUQ4wdj/xgw8ytFk7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO8nXeWcqW3QOHeLyryF/Q4L3BoEhzW+fOO0A12vewbTZxj6/yWeCqz4J31WY1ny3/F6UYkeY68LIzhtsxa8myZailU1K6HlxN/x9kjcPp+HcBBgAS2JZd+kqHSQAAAABJRU5ErkJggg==</xsl:text>
834
837
  </xsl:variable>
835
838
 
836
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
839
+ <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_">
840
+ false
841
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
837
842
  <xsl:call-template name="getLang"/>
838
843
  </xsl:variable><xsl:variable name="pageWidth_">
839
844
  210
@@ -1284,6 +1289,7 @@
1284
1289
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1285
1290
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1286
1291
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1292
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1287
1293
  <xsl:attribute name="display-align">center</xsl:attribute>
1288
1294
 
1289
1295
 
@@ -1312,6 +1318,7 @@
1312
1318
  <xsl:attribute name="display-align">center</xsl:attribute>
1313
1319
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1314
1320
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1321
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1315
1322
 
1316
1323
 
1317
1324
 
@@ -1406,7 +1413,8 @@
1406
1413
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1407
1414
 
1408
1415
 
1409
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1416
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1417
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1410
1418
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1411
1419
 
1412
1420
 
@@ -1418,6 +1426,8 @@
1418
1426
 
1419
1427
 
1420
1428
 
1429
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1430
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1421
1431
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1422
1432
 
1423
1433
 
@@ -2238,7 +2248,38 @@
2238
2248
  </xsl:template><xsl:template match="*[local-name()='br']">
2239
2249
  <xsl:value-of select="$linebreak"/>
2240
2250
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2241
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2251
+ <xsl:param name="split_keep-within-line"/>
2252
+
2253
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2254
+ <xsl:choose>
2255
+
2256
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2257
+ <xsl:variable name="sep">_</xsl:variable>
2258
+ <xsl:variable name="items">
2259
+ <xsl:call-template name="split">
2260
+ <xsl:with-param name="pText" select="."/>
2261
+ <xsl:with-param name="sep" select="$sep"/>
2262
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2263
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2264
+ </xsl:call-template>
2265
+ </xsl:variable>
2266
+ <xsl:for-each select="xalan:nodeset($items)/item">
2267
+ <xsl:choose>
2268
+ <xsl:when test=". = $sep">
2269
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2270
+ </xsl:when>
2271
+ <xsl:otherwise>
2272
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2273
+ </xsl:otherwise>
2274
+ </xsl:choose>
2275
+ </xsl:for-each>
2276
+ </xsl:when>
2277
+
2278
+ <xsl:otherwise>
2279
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2280
+ </xsl:otherwise>
2281
+
2282
+ </xsl:choose>
2242
2283
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2243
2284
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2244
2285
  <xsl:apply-templates/>
@@ -2330,9 +2371,14 @@
2330
2371
 
2331
2372
  <xsl:variable name="table">
2332
2373
 
2333
- <xsl:variable name="simple-table">
2334
- <xsl:call-template name="getSimpleTable"/>
2374
+ <xsl:variable name="simple-table">
2375
+ <xsl:call-template name="getSimpleTable">
2376
+ <xsl:with-param name="id" select="@id"/>
2377
+ </xsl:call-template>
2335
2378
  </xsl:variable>
2379
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2380
+
2381
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2336
2382
 
2337
2383
 
2338
2384
  <!-- Display table's name before table as standalone block -->
@@ -2355,7 +2401,23 @@
2355
2401
  </xsl:call-template>
2356
2402
  </xsl:if>
2357
2403
  </xsl:variable>
2358
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2404
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2405
+
2406
+ <!-- DEBUG -->
2407
+ <xsl:if test="$table_if_debug = 'true'">
2408
+ <fo:block font-size="60%">
2409
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2410
+ </fo:block>
2411
+ </xsl:if>
2412
+
2413
+
2414
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2415
+
2416
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2417
+ DEBUG
2418
+ colwidths=<xsl:copy-of select="$colwidths"/>
2419
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2420
+
2359
2421
 
2360
2422
 
2361
2423
  <xsl:variable name="margin-side">
@@ -2427,9 +2489,17 @@
2427
2489
  </xsl:element>
2428
2490
  </xsl:variable>
2429
2491
 
2492
+ <xsl:if test="$isGenerateTableIF = 'true'">
2493
+ <!-- to determine start of table -->
2494
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2495
+ </xsl:if>
2430
2496
 
2431
2497
  <fo:table id="{@id}">
2432
2498
 
2499
+ <xsl:if test="$isGenerateTableIF = 'true'">
2500
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2501
+ </xsl:if>
2502
+
2433
2503
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2434
2504
  <xsl:attribute name="{local-name()}">
2435
2505
  <xsl:value-of select="."/>
@@ -2443,24 +2513,47 @@
2443
2513
 
2444
2514
 
2445
2515
  <xsl:choose>
2446
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2447
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2448
- <fo:table-column column-width="{@width}"/>
2449
- </xsl:for-each>
2516
+ <xsl:when test="$isGenerateTableIF = 'true'">
2517
+ <!-- generate IF for table widths -->
2518
+ <!-- example:
2519
+ <tr>
2520
+ <td valign="top" align="left" id="tab-symdu_1_1">
2521
+ <p>Symbol</p>
2522
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2523
+ </td>
2524
+ <td valign="top" align="left" id="tab-symdu_1_2">
2525
+ <p>Description</p>
2526
+ <word id="tab-symdu_1_2_word_1">Description</word>
2527
+ </td>
2528
+ </tr>
2529
+ -->
2530
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2531
+
2450
2532
  </xsl:when>
2451
2533
  <xsl:otherwise>
2452
- <xsl:call-template name="insertTableColumnWidth">
2453
- <xsl:with-param name="colwidths" select="$colwidths"/>
2454
- </xsl:call-template>
2455
- </xsl:otherwise>
2456
- </xsl:choose>
2457
2534
 
2458
- <xsl:choose>
2459
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2460
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2461
- </xsl:when>
2462
- <xsl:otherwise>
2463
- <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 -->
2535
+ <xsl:choose>
2536
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2537
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2538
+ <fo:table-column column-width="{@width}"/>
2539
+ </xsl:for-each>
2540
+ </xsl:when>
2541
+ <xsl:otherwise>
2542
+ <xsl:call-template name="insertTableColumnWidth">
2543
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2544
+ </xsl:call-template>
2545
+ </xsl:otherwise>
2546
+ </xsl:choose>
2547
+
2548
+ <xsl:choose>
2549
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2550
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2551
+ </xsl:when>
2552
+ <xsl:otherwise>
2553
+ <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 -->
2554
+ </xsl:otherwise>
2555
+ </xsl:choose>
2556
+
2464
2557
  </xsl:otherwise>
2465
2558
  </xsl:choose>
2466
2559
 
@@ -2560,11 +2653,22 @@
2560
2653
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2561
2654
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2562
2655
  </xsl:template><xsl:template name="calculate-column-widths">
2656
+ <xsl:param name="table"/>
2657
+ <xsl:param name="cols-count"/>
2658
+
2659
+ <xsl:call-template name="calculate-column-widths-proportional">
2660
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2661
+ <xsl:with-param name="table" select="$table"/>
2662
+ </xsl:call-template>
2663
+
2664
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2563
2665
  <xsl:param name="table"/>
2564
2666
  <xsl:param name="cols-count"/>
2565
2667
  <xsl:param name="curr-col" select="1"/>
2566
2668
  <xsl:param name="width" select="0"/>
2567
2669
 
2670
+ <!-- table=<xsl:copy-of select="$table"/> -->
2671
+
2568
2672
  <xsl:if test="$curr-col &lt;= $cols-count">
2569
2673
  <xsl:variable name="widths">
2570
2674
  <xsl:choose>
@@ -2602,10 +2706,15 @@
2602
2706
  </xsl:for-each>
2603
2707
  </xsl:when>
2604
2708
  <xsl:otherwise>
2605
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2709
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2710
+
2711
+ <!-- <table><xsl:copy-of select="$table"/></table>
2712
+ -->
2713
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2606
2714
  <xsl:variable name="td_text">
2607
2715
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2608
2716
  </xsl:variable>
2717
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2609
2718
  <xsl:variable name="words">
2610
2719
  <xsl:variable name="string_with_added_zerospaces">
2611
2720
  <xsl:call-template name="add-zero-spaces-java">
@@ -2620,6 +2729,7 @@
2620
2729
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2621
2730
  </xsl:call-template>
2622
2731
  </xsl:variable>
2732
+ <!-- words=<xsl:copy-of select="$words"/> -->
2623
2733
  <xsl:variable name="max_length">
2624
2734
  <xsl:call-template name="max_length">
2625
2735
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -2644,6 +2754,8 @@
2644
2754
  </xsl:choose>
2645
2755
  </xsl:variable>
2646
2756
 
2757
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2758
+
2647
2759
  <column>
2648
2760
  <xsl:for-each select="xalan:nodeset($widths)//width">
2649
2761
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2652,33 +2764,327 @@
2652
2764
  </xsl:if>
2653
2765
  </xsl:for-each>
2654
2766
  </column>
2655
- <xsl:call-template name="calculate-column-widths">
2767
+ <xsl:call-template name="calculate-column-widths-proportional">
2656
2768
  <xsl:with-param name="cols-count" select="$cols-count"/>
2657
2769
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2658
2770
  <xsl:with-param name="table" select="$table"/>
2659
2771
  </xsl:call-template>
2660
2772
  </xsl:if>
2661
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
2773
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2662
2774
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2663
2775
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2664
2776
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2777
+
2778
+ <!-- if all capitals english letters or digits -->
2779
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2780
+ <xsl:call-template name="repeat">
2781
+ <xsl:with-param name="char" select="'X'"/>
2782
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2783
+ </xsl:call-template>
2784
+ </xsl:if>
2665
2785
  </xsl:template><xsl:template match="text()" mode="td_text">
2666
2786
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2667
2787
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2668
2788
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2669
2789
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2670
2790
  <xsl:value-of select="@target"/>
2671
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2672
- <xsl:variable name="mathml">
2673
- <xsl:for-each select="*">
2674
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2675
- <xsl:copy-of select="."/>
2791
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2792
+ <xsl:if test="$isGenerateTableIF = 'false'">
2793
+ <xsl:variable name="mathml_">
2794
+ <xsl:for-each select="*">
2795
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2796
+ <xsl:copy-of select="."/>
2797
+ </xsl:if>
2798
+ </xsl:for-each>
2799
+ </xsl:variable>
2800
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2801
+
2802
+ <xsl:variable name="math_text">
2803
+ <xsl:value-of select="normalize-space($mathml)"/>
2804
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2805
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2806
+ </xsl:variable>
2807
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2808
+ </xsl:if>
2809
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2810
+ <xsl:param name="table"/>
2811
+ <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
2812
+
2813
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2814
+
2815
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2816
+
2817
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2818
+
2819
+ <!-- get current table id -->
2820
+ <xsl:variable name="table_id" select="@id"/>
2821
+ <!-- find table by id in the file 'table_widths' -->
2822
+ <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2823
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
2824
+
2825
+
2826
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2827
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2828
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2829
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2830
+
2831
+ <xsl:variable name="table_with_cell_widths_">
2832
+ <xsl:choose>
2833
+ <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
2834
+
2835
+ <!-- Example: <column>10</column>
2836
+ <column>11</column>
2837
+ -->
2838
+ <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
2839
+ </xsl:when>
2840
+ <xsl:otherwise>
2841
+ <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
2842
+ </xsl:otherwise>
2843
+ </xsl:choose>
2844
+ </xsl:variable>
2845
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2846
+
2847
+ <xsl:if test="$table_if_debug = 'true'">
2848
+ <xsl:copy-of select="$table_with_cell_widths"/>
2849
+ </xsl:if>
2850
+
2851
+
2852
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2853
+
2854
+ <xsl:variable name="column_widths_">
2855
+ <!-- iteration of columns -->
2856
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2857
+ <xsl:variable name="pos" select="position()"/>
2858
+ <column>
2859
+ <xsl:attribute name="width_max">
2860
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2861
+ <xsl:sort select="." data-type="number" order="descending"/>
2862
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2863
+ </xsl:for-each>
2864
+ </xsl:attribute>
2865
+ <xsl:attribute name="width_min">
2866
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2867
+ <xsl:sort select="." data-type="number" order="descending"/>
2868
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2869
+ </xsl:for-each>
2870
+ </xsl:attribute>
2871
+ </column>
2872
+ </xsl:for-each>
2873
+ </xsl:variable>
2874
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2875
+
2876
+ <!-- <column_widths>
2877
+ <xsl:copy-of select="$column_widths"/>
2878
+ </column_widths> -->
2879
+
2880
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2881
+ <xsl:variable name="table_widths_">
2882
+ <table>
2883
+ <xsl:attribute name="width_max">
2884
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2885
+ </xsl:attribute>
2886
+ <xsl:attribute name="width_min">
2887
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2888
+ </xsl:attribute>
2889
+ </table>
2890
+ </xsl:variable>
2891
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2892
+
2893
+ <xsl:variable name="page_width">
2894
+ <xsl:choose>
2895
+ <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
2896
+ <xsl:otherwise>75</xsl:otherwise>
2897
+ </xsl:choose>
2898
+ </xsl:variable>
2899
+
2900
+ <xsl:if test="$table_if_debug = 'true'">
2901
+ <table_width>
2902
+ <xsl:copy-of select="$table_widths"/>
2903
+ </table_width>
2904
+ <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
2905
+ <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
2906
+ -->
2907
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2908
+ </xsl:if>
2909
+
2910
+
2911
+ <!-- There are three cases: -->
2912
+ <xsl:choose>
2913
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2914
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2915
+ <!-- call old algorithm -->
2916
+ <case1/>
2917
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2918
+ <xsl:call-template name="calculate-column-widths-proportional">
2919
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2920
+ <xsl:with-param name="table" select="$table"/>
2921
+ </xsl:call-template>
2922
+ </xsl:when>
2923
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2924
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2925
+ <case2/>
2926
+ <autolayout/>
2927
+ <xsl:for-each select="$column_widths/column/@width_max">
2928
+ <column divider="100"><xsl:value-of select="."/></column>
2929
+ </xsl:for-each>
2930
+ </xsl:when>
2931
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2932
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2933
+ Lets also call D the difference between maximum and minimum width of the table.
2934
+ For each column, let d be the difference between maximum and minimum width of that column.
2935
+ Now set the column's width to the minimum width plus d times W over D.
2936
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2937
+ <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)">
2938
+ <!-- difference between the available space and the minimum table width -->
2939
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2940
+ <W><xsl:value-of select="$W"/></W>
2941
+ <!-- difference between maximum and minimum width of the table -->
2942
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2943
+ <D><xsl:value-of select="$D"/></D>
2944
+ <case3/>
2945
+ <autolayout/>
2946
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2947
+ <split_keep-within-line>true</split_keep-within-line>
2948
+ </xsl:if>
2949
+ <xsl:for-each select="$column_widths/column">
2950
+ <!-- difference between maximum and minimum width of that column. -->
2951
+ <xsl:variable name="d" select="@width_max - @width_min"/>
2952
+ <d><xsl:value-of select="$d"/></d>
2953
+ <width_min><xsl:value-of select="@width_min"/></width_min>
2954
+ <e><xsl:value-of select="$d * $W div $D"/></e>
2955
+ <!-- set the column's width to the minimum width plus d times W over D. -->
2956
+ <column divider="100">
2957
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
2958
+ </column>
2959
+ </xsl:for-each>
2960
+
2961
+ </xsl:when>
2962
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
2963
+ </xsl:choose>
2964
+
2965
+
2966
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
2967
+ <xsl:copy>
2968
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
2969
+ </xsl:copy>
2970
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
2971
+ <xsl:copy>
2972
+ <xsl:copy-of select="@*"/>
2973
+
2974
+ <!-- The maximum width is given by the widest line. -->
2975
+ <xsl:variable name="widths_max">
2976
+ <xsl:for-each select=".//*[local-name() = 'p']">
2977
+ <xsl:call-template name="add_width"/>
2978
+ </xsl:for-each>
2979
+ <xsl:if test="not(*[local-name() = 'p'])">
2980
+ <xsl:call-template name="add_width"/>
2676
2981
  </xsl:if>
2982
+ </xsl:variable>
2983
+ <xsl:variable name="width_max">
2984
+ <xsl:for-each select="xalan:nodeset($widths_max)//width">
2985
+ <xsl:sort select="." data-type="number" order="descending"/>
2986
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2987
+ </xsl:for-each>
2988
+ </xsl:variable>
2989
+ <xsl:attribute name="width_max">
2990
+ <xsl:value-of select="$width_max"/>
2991
+ </xsl:attribute>
2992
+
2993
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2994
+ <!-- To do: image width -->
2995
+ <xsl:variable name="td_text">
2996
+ <xsl:apply-templates select="." mode="td_text"/>
2997
+ </xsl:variable>
2998
+ <xsl:variable name="words">
2999
+ <xsl:variable name="string_with_added_zerospaces">
3000
+ <xsl:call-template name="add-zero-spaces-java">
3001
+ <xsl:with-param name="text" select="$td_text"/>
3002
+ </xsl:call-template>
3003
+ </xsl:variable>
3004
+ <xsl:call-template name="tokenize">
3005
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3006
+ </xsl:call-template>
3007
+ </xsl:variable>
3008
+
3009
+ <xsl:variable name="max_word_length">
3010
+ <xsl:call-template name="max_length">
3011
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
3012
+ </xsl:call-template>
3013
+ </xsl:variable>
3014
+ <xsl:variable name="width_min">
3015
+ <xsl:value-of select="$max_word_length"/>
3016
+ </xsl:variable>
3017
+ <xsl:attribute name="width_min">
3018
+ <xsl:value-of select="$width_min"/>
3019
+ </xsl:attribute>
3020
+ <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
3021
+ <xsl:if test="$width_min &gt; $width_max">
3022
+ <xsl:attribute name="width_max">
3023
+ <xsl:value-of select="$width_min"/>
3024
+ </xsl:attribute>
3025
+ </xsl:if>
3026
+ <xsl:if test="$width_min = 0">
3027
+ <xsl:attribute name="width_min">1</xsl:attribute>
3028
+ </xsl:if>
3029
+
3030
+ <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
3031
+
3032
+ </xsl:copy>
3033
+ </xsl:template><xsl:template name="add_width">
3034
+ <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
3035
+ <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
3036
+
3037
+ <xsl:variable name="p_text_len">
3038
+ <xsl:choose>
3039
+ <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
3040
+ <xsl:value-of select="$p_text_len_ * 1.5"/>
3041
+ </xsl:when>
3042
+ <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
3043
+ </xsl:choose>
3044
+ </xsl:variable>
3045
+
3046
+ <xsl:variable name="math_addon_text">
3047
+ <xsl:for-each select=".//*[local-name() = 'math']">
3048
+ <xsl:apply-templates mode="td_text"/>
2677
3049
  </xsl:for-each>
2678
3050
  </xsl:variable>
3051
+ <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
2679
3052
 
2680
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2681
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3053
+ <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
3054
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3055
+ <xsl:copy>
3056
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3057
+ </xsl:copy>
3058
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
3059
+ <xsl:copy>
3060
+ <xsl:copy-of select="@*"/>
3061
+
3062
+ <!-- The maximum width is given by the widest line. -->
3063
+ <xsl:attribute name="width_max">
3064
+ <xsl:for-each select="p_len">
3065
+ <xsl:sort select="." data-type="number" order="descending"/>
3066
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3067
+ </xsl:for-each>
3068
+ </xsl:attribute>
3069
+
3070
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3071
+ <xsl:variable name="width_min">
3072
+ <xsl:for-each select="word_len">
3073
+ <xsl:sort select="." data-type="number" order="descending"/>
3074
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3075
+ </xsl:for-each>
3076
+ </xsl:variable>
3077
+ <xsl:attribute name="width_min">
3078
+ <xsl:value-of select="$width_min"/>
3079
+ </xsl:attribute>
3080
+
3081
+ <xsl:if test="$width_min = 0">
3082
+ <xsl:attribute name="width_min">1</xsl:attribute>
3083
+ </xsl:if>
3084
+
3085
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3086
+
3087
+ </xsl:copy>
2682
3088
  </xsl:template><xsl:template match="*[local-name()='thead']">
2683
3089
  <xsl:param name="cols-count"/>
2684
3090
  <fo:table-header>
@@ -2763,6 +3169,7 @@
2763
3169
  </xsl:for-each>
2764
3170
  </xsl:when>
2765
3171
  <xsl:otherwise>
3172
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
2766
3173
  <xsl:call-template name="insertTableColumnWidth">
2767
3174
  <xsl:with-param name="colwidths" select="$colwidths"/>
2768
3175
  </xsl:call-template>
@@ -2842,6 +3249,52 @@
2842
3249
 
2843
3250
  </fo:table-body>
2844
3251
 
3252
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3253
+ <xsl:param name="table_or_dl">table</xsl:param>
3254
+ <xsl:apply-templates mode="process_table-if">
3255
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3256
+ </xsl:apply-templates>
3257
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3258
+ <xsl:param name="table_or_dl">table</xsl:param>
3259
+
3260
+ <fo:table-body>
3261
+ <xsl:for-each select="*[local-name() = 'tr']">
3262
+ <xsl:variable name="col_count" select="count(*)"/>
3263
+
3264
+ <!-- iteration for each tr/td -->
3265
+
3266
+ <xsl:choose>
3267
+ <xsl:when test="$table_or_dl = 'table'">
3268
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3269
+ <fo:table-row number-columns-spanned="{$col_count}">
3270
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3271
+ <xsl:call-template name="td"/>
3272
+ </fo:table-row>
3273
+ </xsl:for-each>
3274
+ </xsl:when>
3275
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3276
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3277
+ <xsl:variable name="is_dt" select="position() = 1"/>
3278
+
3279
+ <xsl:for-each select="*">
3280
+ <!-- <test><xsl:copy-of select="."/></test> -->
3281
+ <fo:table-row number-columns-spanned="{$col_count}">
3282
+ <xsl:choose>
3283
+ <xsl:when test="$is_dt">
3284
+ <xsl:call-template name="insert_dt_cell"/>
3285
+ </xsl:when>
3286
+ <xsl:otherwise>
3287
+ <xsl:call-template name="insert_dd_cell"/>
3288
+ </xsl:otherwise>
3289
+ </xsl:choose>
3290
+ </fo:table-row>
3291
+ </xsl:for-each>
3292
+ </xsl:for-each>
3293
+ </xsl:otherwise>
3294
+ </xsl:choose>
3295
+
3296
+ </xsl:for-each>
3297
+ </fo:table-body>
2845
3298
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2846
3299
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2847
3300
 
@@ -2932,7 +3385,7 @@
2932
3385
  </xsl:choose>
2933
3386
  </xsl:attribute>
2934
3387
  </xsl:if>
2935
- </xsl:template><xsl:template match="*[local-name()='td']">
3388
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2936
3389
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2937
3390
  <xsl:call-template name="setTextAlignment">
2938
3391
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2966,11 +3419,24 @@
2966
3419
 
2967
3420
  <xsl:call-template name="setTableCellAttributes"/>
2968
3421
 
3422
+ <xsl:if test="$isGenerateTableIF = 'true'">
3423
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3424
+ <xsl:attribute name="text-align">left</xsl:attribute>
3425
+ </xsl:if>
3426
+
2969
3427
  <fo:block>
2970
3428
 
3429
+ <xsl:if test="$isGenerateTableIF = 'true'">
3430
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3431
+ </xsl:if>
3432
+
3433
+
2971
3434
 
2972
3435
 
2973
3436
  <xsl:apply-templates/>
3437
+
3438
+ <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"/> -->
3439
+
2974
3440
  </fo:block>
2975
3441
  </fo:table-cell>
2976
3442
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -3171,9 +3637,9 @@
3171
3637
  <!-- current hierarchy is 'figure' element -->
3172
3638
  <xsl:variable name="following_dl_colwidths">
3173
3639
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3174
- <xsl:variable name="html-table">
3175
- <xsl:variable name="doc_ns">
3176
-
3640
+ <xsl:variable name="simple-table">
3641
+ <!-- <xsl:variable name="doc_ns">
3642
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3177
3643
  </xsl:variable>
3178
3644
  <xsl:variable name="ns">
3179
3645
  <xsl:choose>
@@ -3184,7 +3650,7 @@
3184
3650
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3185
3651
  </xsl:otherwise>
3186
3652
  </xsl:choose>
3187
- </xsl:variable>
3653
+ </xsl:variable> -->
3188
3654
 
3189
3655
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3190
3656
  <tbody>
@@ -3195,7 +3661,7 @@
3195
3661
 
3196
3662
  <xsl:call-template name="calculate-column-widths">
3197
3663
  <xsl:with-param name="cols-count" select="2"/>
3198
- <xsl:with-param name="table" select="$html-table"/>
3664
+ <xsl:with-param name="table" select="$simple-table"/>
3199
3665
  </xsl:call-template>
3200
3666
 
3201
3667
  </xsl:if>
@@ -3375,7 +3841,18 @@
3375
3841
 
3376
3842
 
3377
3843
 
3844
+
3845
+ <xsl:if test="$isGenerateTableIF = 'true'">
3846
+ <!-- to determine start of table -->
3847
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3848
+ </xsl:if>
3849
+
3378
3850
  <fo:table width="95%" table-layout="fixed">
3851
+
3852
+ <xsl:if test="$isGenerateTableIF = 'true'">
3853
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3854
+ </xsl:if>
3855
+
3379
3856
 
3380
3857
  <xsl:choose>
3381
3858
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3384,52 +3861,130 @@
3384
3861
 
3385
3862
  </xsl:when>
3386
3863
  </xsl:choose>
3387
- <!-- create virtual html table for dl/[dt and dd] -->
3388
- <xsl:variable name="html-table">
3389
- <xsl:variable name="doc_ns">
3864
+
3865
+
3866
+ <xsl:choose>
3867
+ <xsl:when test="$isGenerateTableIF = 'true'">
3868
+ <!-- generate IF for table widths -->
3869
+ <!-- example:
3870
+ <tr>
3871
+ <td valign="top" align="left" id="tab-symdu_1_1">
3872
+ <p>Symbol</p>
3873
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3874
+ </td>
3875
+ <td valign="top" align="left" id="tab-symdu_1_2">
3876
+ <p>Description</p>
3877
+ <word id="tab-symdu_1_2_word_1">Description</word>
3878
+ </td>
3879
+ </tr>
3880
+ -->
3390
3881
 
3391
- </xsl:variable>
3392
- <xsl:variable name="ns">
3393
- <xsl:choose>
3394
- <xsl:when test="normalize-space($doc_ns) != ''">
3395
- <xsl:value-of select="normalize-space($doc_ns)"/>
3396
- </xsl:when>
3397
- <xsl:otherwise>
3398
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3399
- </xsl:otherwise>
3400
- </xsl:choose>
3401
- </xsl:variable>
3402
- <tbody>
3403
- <xsl:apply-templates mode="dl"/>
3404
- </tbody>
3405
- </xsl:variable>
3406
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3407
- <xsl:variable name="colwidths">
3408
- <xsl:call-template name="calculate-column-widths">
3409
- <xsl:with-param name="cols-count" select="2"/>
3410
- <xsl:with-param name="table" select="$html-table"/>
3411
- </xsl:call-template>
3412
- </xsl:variable>
3413
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3414
- <xsl:variable name="maxlength_dt">
3415
- <xsl:call-template name="getMaxLength_dt"/>
3416
- </xsl:variable>
3417
- <xsl:variable name="isContainsKeepTogetherTag_">
3418
- false
3419
- </xsl:variable>
3420
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3421
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3422
- <xsl:call-template name="setColumnWidth_dl">
3423
- <xsl:with-param name="colwidths" select="$colwidths"/>
3424
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3425
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3426
- </xsl:call-template>
3882
+ <!-- create virtual html table for dl/[dt and dd] -->
3883
+ <xsl:variable name="simple-table">
3884
+
3885
+ <xsl:variable name="dl_table">
3886
+ <tbody>
3887
+ <xsl:apply-templates mode="dl_if">
3888
+ <xsl:with-param name="id" select="@id"/>
3889
+ </xsl:apply-templates>
3890
+ </tbody>
3891
+ </xsl:variable>
3892
+
3893
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3894
+
3895
+ <!-- Step: replace <br/> to <p>...</p> -->
3896
+ <xsl:variable name="table_without_br">
3897
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3898
+ </xsl:variable>
3899
+
3900
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3901
+
3902
+ <!-- Step: add id to each cell -->
3903
+ <!-- add <word>...</word> for each word, image, math -->
3904
+ <xsl:variable name="simple-table-id">
3905
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3906
+ <xsl:with-param name="id" select="@id"/>
3907
+ </xsl:apply-templates>
3908
+ </xsl:variable>
3909
+
3910
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3911
+
3912
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3913
+
3914
+ </xsl:variable>
3915
+
3916
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3917
+
3918
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3919
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3920
+ </xsl:apply-templates>
3921
+
3922
+ </xsl:when>
3923
+ <xsl:otherwise>
3427
3924
 
3428
- <fo:table-body>
3429
- <xsl:apply-templates>
3430
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3431
- </xsl:apply-templates>
3432
- </fo:table-body>
3925
+ <xsl:variable name="simple-table">
3926
+
3927
+ <xsl:variable name="dl_table">
3928
+ <tbody>
3929
+ <xsl:apply-templates mode="dl">
3930
+ <xsl:with-param name="id" select="@id"/>
3931
+ </xsl:apply-templates>
3932
+ </tbody>
3933
+ </xsl:variable>
3934
+
3935
+ <xsl:copy-of select="$dl_table"/>
3936
+ </xsl:variable>
3937
+
3938
+ <xsl:variable name="colwidths">
3939
+ <xsl:call-template name="calculate-column-widths">
3940
+ <xsl:with-param name="cols-count" select="2"/>
3941
+ <xsl:with-param name="table" select="$simple-table"/>
3942
+ </xsl:call-template>
3943
+ </xsl:variable>
3944
+
3945
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3946
+ DEBUG
3947
+ colwidths=<xsl:copy-of select="$colwidths"/>
3948
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3949
+
3950
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3951
+
3952
+ <xsl:variable name="maxlength_dt">
3953
+ <xsl:call-template name="getMaxLength_dt"/>
3954
+ </xsl:variable>
3955
+
3956
+ <xsl:variable name="isContainsKeepTogetherTag_">
3957
+ false
3958
+ </xsl:variable>
3959
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3960
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3961
+
3962
+
3963
+ <xsl:call-template name="setColumnWidth_dl">
3964
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3965
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3966
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3967
+ </xsl:call-template>
3968
+
3969
+ <fo:table-body>
3970
+
3971
+ <!-- DEBUG -->
3972
+ <xsl:if test="$table_if_debug = 'true'">
3973
+ <fo:table-row>
3974
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
3975
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3976
+ </fo:table-cell>
3977
+ </fo:table-row>
3978
+ </xsl:if>
3979
+
3980
+ <xsl:apply-templates>
3981
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3982
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
3983
+ </xsl:apply-templates>
3984
+
3985
+ </fo:table-body>
3986
+ </xsl:otherwise>
3987
+ </xsl:choose>
3433
3988
  </fo:table>
3434
3989
  </fo:block>
3435
3990
  </fo:block>
@@ -3440,6 +3995,9 @@
3440
3995
  <xsl:param name="colwidths"/>
3441
3996
  <xsl:param name="maxlength_dt"/>
3442
3997
  <xsl:param name="isContainsKeepTogetherTag"/>
3998
+
3999
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
4000
+
3443
4001
  <xsl:choose>
3444
4002
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3445
4003
  <fo:table-column column-width="50%"/>
@@ -3447,6 +4005,11 @@
3447
4005
  </xsl:when>
3448
4006
  <xsl:otherwise>
3449
4007
  <xsl:choose>
4008
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4009
+ <xsl:call-template name="insertTableColumnWidth">
4010
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4011
+ </xsl:call-template>
4012
+ </xsl:when>
3450
4013
  <xsl:when test="$isContainsKeepTogetherTag">
3451
4014
  <xsl:call-template name="insertTableColumnWidth">
3452
4015
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3491,13 +4054,19 @@
3491
4054
  </xsl:choose>
3492
4055
  </xsl:template><xsl:template name="insertTableColumnWidth">
3493
4056
  <xsl:param name="colwidths"/>
4057
+
3494
4058
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3495
4059
  <xsl:choose>
3496
4060
  <xsl:when test=". = 1 or . = 0">
3497
4061
  <fo:table-column column-width="proportional-column-width(2)"/>
3498
4062
  </xsl:when>
3499
4063
  <xsl:otherwise>
3500
- <fo:table-column column-width="proportional-column-width({.})"/>
4064
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
4065
+ <xsl:variable name="divider">
4066
+ <xsl:value-of select="@divider"/>
4067
+ <xsl:if test="not(@divider)">1</xsl:if>
4068
+ </xsl:variable>
4069
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3501
4070
  </xsl:otherwise>
3502
4071
  </xsl:choose>
3503
4072
  </xsl:for-each>
@@ -3559,11 +4128,19 @@
3559
4128
  </fo:table-cell>
3560
4129
  </fo:table-row>
3561
4130
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
4131
+ <xsl:param name="id"/>
4132
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3562
4133
  <tr>
3563
4134
  <td>
4135
+ <xsl:attribute name="id">
4136
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4137
+ </xsl:attribute>
3564
4138
  <xsl:apply-templates/>
3565
4139
  </td>
3566
4140
  <td>
4141
+ <xsl:attribute name="id">
4142
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4143
+ </xsl:attribute>
3567
4144
 
3568
4145
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3569
4146
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3574,50 +4151,122 @@
3574
4151
 
3575
4152
  </xsl:template><xsl:template match="*[local-name()='dt']">
3576
4153
  <xsl:param name="key_iso"/>
4154
+ <xsl:param name="split_keep-within-line"/>
3577
4155
 
3578
4156
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3579
- <fo:table-cell>
4157
+ <xsl:call-template name="insert_dt_cell">
4158
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4159
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4160
+ </xsl:call-template>
4161
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4162
+ <xsl:call-template name="insert_dd_cell">
4163
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4164
+ </xsl:call-template>
4165
+ </xsl:for-each>
4166
+ </fo:table-row>
4167
+ </xsl:template><xsl:template name="insert_dt_cell">
4168
+ <xsl:param name="key_iso"/>
4169
+ <xsl:param name="split_keep-within-line"/>
4170
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4171
+
4172
+ <xsl:if test="$isGenerateTableIF = 'true'">
4173
+ <!-- border is mandatory, to calculate real width -->
4174
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4175
+ <xsl:attribute name="text-align">left</xsl:attribute>
4176
+ </xsl:if>
4177
+
4178
+
4179
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4180
+ <xsl:copy-of select="@id"/>
4181
+
4182
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4183
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4184
+ </xsl:if>
4185
+
4186
+
4187
+
4188
+ <xsl:apply-templates>
4189
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4190
+ </xsl:apply-templates>
4191
+
4192
+ <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"/> -->
4193
+
4194
+ </fo:block>
4195
+ </fo:table-cell>
4196
+ </xsl:template><xsl:template name="insert_dd_cell">
4197
+ <xsl:param name="split_keep-within-line"/>
4198
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4199
+
4200
+ <xsl:if test="$isGenerateTableIF = 'true'">
4201
+ <!-- border is mandatory, to calculate real width -->
4202
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4203
+ </xsl:if>
4204
+
4205
+ <fo:block>
4206
+
4207
+ <xsl:if test="$isGenerateTableIF = 'true'">
4208
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4209
+ </xsl:if>
4210
+
3580
4211
 
3581
- <fo:block xsl:use-attribute-sets="dt-style">
3582
- <xsl:copy-of select="@id"/>
3583
-
3584
- <xsl:if test="normalize-space($key_iso) = 'true'">
3585
- <xsl:attribute name="margin-top">0</xsl:attribute>
3586
- </xsl:if>
3587
-
3588
-
3589
-
3590
- <xsl:apply-templates/>
3591
- </fo:block>
3592
- </fo:table-cell>
3593
- <fo:table-cell>
3594
- <fo:block>
3595
-
3596
4212
 
3597
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3598
- <xsl:with-param name="process">true</xsl:with-param>
3599
- </xsl:apply-templates>
3600
- </fo:block>
3601
- </fo:table-cell>
3602
- </fo:table-row>
4213
+ <xsl:choose>
4214
+ <xsl:when test="$isGenerateTableIF = 'true'">
4215
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4216
+ <xsl:with-param name="process">true</xsl:with-param>
4217
+ </xsl:apply-templates>
4218
+ </xsl:when>
4219
+ <xsl:otherwise>
4220
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4221
+ <xsl:with-param name="process">true</xsl:with-param>
4222
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4223
+ </xsl:apply-templates>
4224
+ </xsl:otherwise>
4225
+
4226
+ </xsl:choose>
4227
+
4228
+ <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"/> -->
4229
+
4230
+ </fo:block>
4231
+ </fo:table-cell>
3603
4232
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3604
4233
  <xsl:apply-templates/>
3605
4234
  </xsl:template><xsl:template match="*[local-name()='dd']">
3606
4235
  <xsl:param name="process">false</xsl:param>
4236
+ <xsl:param name="split_keep-within-line"/>
3607
4237
  <xsl:if test="$process = 'true'">
3608
4238
  <xsl:apply-templates select="@language"/>
3609
- <xsl:apply-templates/>
4239
+ <xsl:apply-templates>
4240
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4241
+ </xsl:apply-templates>
3610
4242
  </xsl:if>
3611
4243
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3612
4244
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3613
- </xsl:template><xsl:template match="*[local-name()='em']">
4245
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4246
+ <xsl:param name="id"/>
4247
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4248
+ <tr>
4249
+ <td>
4250
+ <xsl:copy-of select="node()"/>
4251
+ </td>
4252
+ <td>
4253
+
4254
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
4255
+
4256
+ </td>
4257
+ </tr>
4258
+
4259
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
3614
4260
  <fo:inline font-style="italic">
3615
4261
  <xsl:apply-templates/>
3616
4262
  </fo:inline>
3617
4263
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4264
+ <xsl:param name="split_keep-within-line"/>
3618
4265
  <fo:inline font-weight="bold">
3619
4266
 
3620
- <xsl:apply-templates/>
4267
+ <xsl:apply-templates>
4268
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4269
+ </xsl:apply-templates>
3621
4270
  </fo:inline>
3622
4271
  </xsl:template><xsl:template match="*[local-name()='padding']">
3623
4272
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3818,6 +4467,10 @@
3818
4467
  <xsl:param name="text"/>
3819
4468
  <xsl:param name="separator" select="' '"/>
3820
4469
  <xsl:choose>
4470
+
4471
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4472
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4473
+ </xsl:when>
3821
4474
  <xsl:when test="not(contains($text, $separator))">
3822
4475
  <word>
3823
4476
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -3862,13 +4515,66 @@
3862
4515
  </xsl:when>
3863
4516
  <xsl:otherwise>
3864
4517
  <word>
3865
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4518
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4519
+ <xsl:choose>
4520
+ <xsl:when test="$isGenerateTableIF = 'true'">
4521
+ <xsl:value-of select="$word"/>
4522
+ </xsl:when>
4523
+ <xsl:otherwise>
4524
+ <xsl:value-of select="string-length($word)"/>
4525
+ </xsl:otherwise>
4526
+ </xsl:choose>
3866
4527
  </word>
3867
4528
  <xsl:call-template name="tokenize">
3868
4529
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3869
4530
  </xsl:call-template>
3870
4531
  </xsl:otherwise>
3871
4532
  </xsl:choose>
4533
+ </xsl:template><xsl:template name="tokenize_with_tags">
4534
+ <xsl:param name="tags"/>
4535
+ <xsl:param name="text"/>
4536
+ <xsl:param name="separator" select="' '"/>
4537
+ <xsl:choose>
4538
+
4539
+ <xsl:when test="not(contains($text, $separator))">
4540
+ <word>
4541
+ <xsl:call-template name="enclose_text_in_tags">
4542
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4543
+ <xsl:with-param name="tags" select="$tags"/>
4544
+ </xsl:call-template>
4545
+ </word>
4546
+ </xsl:when>
4547
+ <xsl:otherwise>
4548
+ <word>
4549
+ <xsl:call-template name="enclose_text_in_tags">
4550
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4551
+ <xsl:with-param name="tags" select="$tags"/>
4552
+ </xsl:call-template>
4553
+ </word>
4554
+ <xsl:call-template name="tokenize_with_tags">
4555
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4556
+ </xsl:call-template>
4557
+ </xsl:otherwise>
4558
+ </xsl:choose>
4559
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4560
+ <xsl:param name="text"/>
4561
+ <xsl:param name="tags"/>
4562
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4563
+
4564
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4565
+
4566
+ <xsl:choose>
4567
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4568
+ <xsl:otherwise>
4569
+ <xsl:element name="{$tag_name}">
4570
+ <xsl:call-template name="enclose_text_in_tags">
4571
+ <xsl:with-param name="text" select="$text"/>
4572
+ <xsl:with-param name="tags" select="$tags"/>
4573
+ <xsl:with-param name="num" select="$num + 1"/>
4574
+ </xsl:call-template>
4575
+ </xsl:element>
4576
+ </xsl:otherwise>
4577
+ </xsl:choose>
3872
4578
  </xsl:template><xsl:template name="max_length">
3873
4579
  <xsl:param name="words"/>
3874
4580
  <xsl:for-each select="$words//word">
@@ -3969,12 +4675,19 @@
3969
4675
  </xsl:otherwise>
3970
4676
  </xsl:choose>
3971
4677
  </xsl:template><xsl:template name="getSimpleTable">
4678
+ <xsl:param name="id"/>
4679
+
3972
4680
  <xsl:variable name="simple-table">
3973
4681
 
4682
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4683
+ <xsl:variable name="table_without_br">
4684
+ <xsl:apply-templates mode="table-without-br"/>
4685
+ </xsl:variable>
4686
+
3974
4687
  <!-- Step 1. colspan processing -->
3975
4688
  <xsl:variable name="simple-table-colspan">
3976
4689
  <tbody>
3977
- <xsl:apply-templates mode="simple-table-colspan"/>
4690
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3978
4691
  </tbody>
3979
4692
  </xsl:variable>
3980
4693
 
@@ -3983,10 +4696,67 @@
3983
4696
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3984
4697
  </xsl:variable>
3985
4698
 
3986
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3987
-
4699
+ <!-- Step 3: add id to each cell -->
4700
+ <!-- add <word>...</word> for each word, image, math -->
4701
+ <xsl:variable name="simple-table-id">
4702
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4703
+ <xsl:with-param name="id" select="$id"/>
4704
+ </xsl:apply-templates>
4705
+ </xsl:variable>
4706
+
4707
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4708
+
3988
4709
  </xsl:variable>
3989
4710
  <xsl:copy-of select="$simple-table"/>
4711
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4712
+ <xsl:copy>
4713
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4714
+ </xsl:copy>
4715
+ </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">
4716
+ <xsl:copy>
4717
+ <xsl:copy-of select="@*"/>
4718
+ <p>
4719
+ <xsl:copy-of select="node()"/>
4720
+ </p>
4721
+ </xsl:copy>
4722
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4723
+ <xsl:copy>
4724
+ <xsl:copy-of select="@*"/>
4725
+ <xsl:for-each select="*[local-name()='br']">
4726
+ <xsl:variable name="current_id" select="generate-id()"/>
4727
+ <p>
4728
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4729
+ <xsl:copy-of select="."/>
4730
+ </xsl:for-each>
4731
+ </p>
4732
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4733
+ <p>
4734
+ <xsl:for-each select="following-sibling::node()">
4735
+ <xsl:copy-of select="."/>
4736
+ </xsl:for-each>
4737
+ </p>
4738
+ </xsl:if>
4739
+ </xsl:for-each>
4740
+ </xsl:copy>
4741
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4742
+ <xsl:for-each select="*[local-name()='br']">
4743
+ <xsl:variable name="current_id" select="generate-id()"/>
4744
+ <p>
4745
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4746
+ <xsl:copy-of select="."/>
4747
+ </xsl:for-each>
4748
+ </p>
4749
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4750
+ <p>
4751
+ <xsl:for-each select="following-sibling::node()">
4752
+ <xsl:copy-of select="."/>
4753
+ </xsl:for-each>
4754
+ </p>
4755
+ </xsl:if>
4756
+ </xsl:for-each>
4757
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4758
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4759
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3990
4760
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3991
4761
  <xsl:apply-templates mode="simple-table-colspan"/>
3992
4762
  </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">
@@ -4076,6 +4846,126 @@
4076
4846
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4077
4847
  <xsl:with-param name="previousRow" select="$newRow"/>
4078
4848
  </xsl:apply-templates>
4849
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4850
+ <xsl:param name="id"/>
4851
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4852
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4853
+ <xsl:with-param name="id" select="$id_prefixed"/>
4854
+ </xsl:apply-templates>
4855
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4856
+ <xsl:param name="id"/>
4857
+ <xsl:copy>
4858
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4859
+ <xsl:with-param name="id" select="$id"/>
4860
+ </xsl:apply-templates>
4861
+ </xsl:copy>
4862
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4863
+ <xsl:param name="id"/>
4864
+ <xsl:copy>
4865
+ <xsl:copy-of select="@*"/>
4866
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4867
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4868
+ <xsl:with-param name="id" select="$id"/>
4869
+ </xsl:apply-templates>
4870
+ </xsl:copy>
4871
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4872
+ <xsl:param name="id"/>
4873
+ <xsl:copy>
4874
+ <xsl:copy-of select="@*"/>
4875
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4876
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4877
+ <xsl:attribute name="id">
4878
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4879
+ </xsl:attribute>
4880
+
4881
+ <xsl:for-each select="*[local-name() = 'p']">
4882
+ <xsl:copy>
4883
+ <xsl:copy-of select="@*"/>
4884
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4885
+ <xsl:attribute name="id">
4886
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4887
+ </xsl:attribute>
4888
+
4889
+ <xsl:copy-of select="node()"/>
4890
+ </xsl:copy>
4891
+ </xsl:for-each>
4892
+
4893
+
4894
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4895
+
4896
+ <xsl:variable name="td_text">
4897
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4898
+ </xsl:variable>
4899
+
4900
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4901
+
4902
+ <xsl:variable name="words">
4903
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4904
+ <word>
4905
+ <xsl:copy-of select="."/>
4906
+ </word>
4907
+ </xsl:for-each>
4908
+
4909
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4910
+ <xsl:copy-of select="."/>
4911
+ </xsl:for-each>
4912
+
4913
+ </xsl:variable>
4914
+
4915
+ <xsl:for-each select="xalan:nodeset($words)/word">
4916
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4917
+ <xsl:copy>
4918
+ <xsl:attribute name="id">
4919
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4920
+ </xsl:attribute>
4921
+ <xsl:copy-of select="node()"/>
4922
+ </xsl:copy>
4923
+ </xsl:for-each>
4924
+ </xsl:if>
4925
+ </xsl:copy>
4926
+
4927
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
4928
+ <xsl:copy>
4929
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
4930
+ </xsl:copy>
4931
+ </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">
4932
+ <xsl:variable name="formatting_tags">
4933
+ <xsl:call-template name="getFormattingTags"/>
4934
+ </xsl:variable>
4935
+ <word>
4936
+ <xsl:call-template name="enclose_text_in_tags">
4937
+ <xsl:with-param name="text" select="normalize-space(.)"/>
4938
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4939
+ </xsl:call-template>
4940
+ </word>
4941
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
4942
+
4943
+ <xsl:variable name="td_text" select="."/>
4944
+
4945
+ <xsl:variable name="string_with_added_zerospaces">
4946
+ <xsl:call-template name="add-zero-spaces-java">
4947
+ <xsl:with-param name="text" select="$td_text"/>
4948
+ </xsl:call-template>
4949
+ </xsl:variable>
4950
+
4951
+ <xsl:variable name="formatting_tags">
4952
+ <xsl:call-template name="getFormattingTags"/>
4953
+ </xsl:variable>
4954
+
4955
+ <!-- <word>text</word> -->
4956
+ <xsl:call-template name="tokenize_with_tags">
4957
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4958
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4959
+ </xsl:call-template>
4960
+ </xsl:template><xsl:template name="getFormattingTags">
4961
+ <tags>
4962
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
4963
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
4964
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
4965
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
4966
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
4967
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
4968
+ </tags>
4079
4969
  </xsl:template><xsl:template name="getLang">
4080
4970
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4081
4971
  <xsl:variable name="language">
@@ -5781,7 +6671,9 @@
5781
6671
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5782
6672
  </xsl:if>
5783
6673
  <xsl:variable name="simple-table">
5784
- <xsl:call-template name="getSimpleTable"/>
6674
+ <xsl:call-template name="getSimpleTable">
6675
+ <xsl:with-param name="id" select="@id"/>
6676
+ </xsl:call-template>
5785
6677
  </xsl:variable>
5786
6678
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5787
6679
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -6741,7 +7633,7 @@
6741
7633
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
6742
7634
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
6743
7635
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
6744
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
7636
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6745
7637
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6746
7638
  <!-- <row>
6747
7639
  <date>05-07-2013</date>
@@ -8060,4 +8952,40 @@
8060
8952
  <xsl:value-of select="$value"/>
8061
8953
  </xsl:otherwise>
8062
8954
  </xsl:choose>
8955
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
8956
+ <xsl:param name="level">0</xsl:param>
8957
+
8958
+ <fo:block margin-left="{2*$level}mm">
8959
+ <xsl:text>
8960
+ &lt;</xsl:text>
8961
+ <xsl:value-of select="local-name()"/>
8962
+ <xsl:for-each select="@*">
8963
+ <xsl:text> </xsl:text>
8964
+ <xsl:value-of select="local-name()"/>
8965
+ <xsl:text>="</xsl:text>
8966
+ <xsl:value-of select="."/>
8967
+ <xsl:text>"</xsl:text>
8968
+ </xsl:for-each>
8969
+ <xsl:text>&gt;</xsl:text>
8970
+
8971
+ <xsl:if test="not(*)">
8972
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
8973
+ <xsl:text>&lt;/</xsl:text>
8974
+ <xsl:value-of select="local-name()"/>
8975
+ <xsl:text>&gt;</xsl:text>
8976
+ </xsl:if>
8977
+ </fo:block>
8978
+
8979
+ <xsl:if test="*">
8980
+ <fo:block>
8981
+ <xsl:apply-templates mode="print_as_xml">
8982
+ <xsl:with-param name="level" select="$level + 1"/>
8983
+ </xsl:apply-templates>
8984
+ </fo:block>
8985
+ <fo:block margin-left="{2*$level}mm">
8986
+ <xsl:text>&lt;/</xsl:text>
8987
+ <xsl:value-of select="local-name()"/>
8988
+ <xsl:text>&gt;</xsl:text>
8989
+ </fo:block>
8990
+ </xsl:if>
8063
8991
  </xsl:template></xsl:stylesheet>