metanorma-iec 2.1.0 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1641,6 +1641,7 @@
1641
1641
 
1642
1642
  <xsl:template match="iec:p" name="paragraph">
1643
1643
  <xsl:param name="inline" select="'false'"/>
1644
+ <xsl:param name="split_keep-within-line"/>
1644
1645
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
1645
1646
  <xsl:variable name="element-name">
1646
1647
  <xsl:choose>
@@ -1683,11 +1684,15 @@
1683
1684
  </xsl:if>
1684
1685
 
1685
1686
  <xsl:apply-templates select="@language"/>
1686
- <xsl:apply-templates/>
1687
+ <xsl:apply-templates>
1688
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
1689
+ </xsl:apply-templates>
1687
1690
  </xsl:element>
1688
1691
  </xsl:when>
1689
1692
  <xsl:otherwise>
1690
- <xsl:apply-templates/>
1693
+ <xsl:apply-templates>
1694
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
1695
+ </xsl:apply-templates>
1691
1696
  </xsl:otherwise>
1692
1697
  </xsl:choose>
1693
1698
 
@@ -1930,12 +1935,41 @@
1930
1935
  </xsl:copy>
1931
1936
  </xsl:template> -->
1932
1937
 
1933
- <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">
1938
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
1939
+ <xsl:for-each select="$table_widths_from_if//table">
1940
+ <xsl:copy>
1941
+ <xsl:copy-of select="@*"/>
1942
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
1943
+ </xsl:copy>
1944
+ </xsl:for-each>
1945
+ </xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
1946
+ false
1947
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
1934
1948
  <xsl:call-template name="getLang"/>
1935
- </xsl:variable><xsl:variable name="pageWidth_">
1936
- 210
1949
+ </xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
1950
+ <xsl:choose>
1951
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
1952
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
1953
+ </xsl:choose>
1954
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
1955
+ <xsl:choose>
1956
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
1957
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
1958
+ </xsl:choose>
1959
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
1960
+ <xsl:choose>
1961
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
1962
+ <xsl:otherwise>
1963
+ 210
1964
+ </xsl:otherwise>
1965
+ </xsl:choose>
1937
1966
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1938
- 297
1967
+ <xsl:choose>
1968
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
1969
+ <xsl:otherwise>
1970
+ 297
1971
+ </xsl:otherwise>
1972
+ </xsl:choose>
1939
1973
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1940
1974
  25
1941
1975
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -2053,14 +2087,15 @@
2053
2087
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2054
2088
  </xsl:otherwise>
2055
2089
  </xsl:choose>
2056
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:attribute-set name="root-style">
2090
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="font_noto_sans">Noto Sans, Noto Sans HK, Noto Sans JP, Noto Sans KR, Noto Sans SC, Noto Sans TC</xsl:variable><xsl:variable name="font_noto_sans_mono">Noto Sans Mono, Noto Sans Mono CJK HK, Noto Sans Mono CJK JP, Noto Sans Mono CJK KR, Noto Sans Mono CJK SC, Noto Sans Mono CJK TC</xsl:variable><xsl:variable name="font_noto_serif">Noto Serif, Noto Serif HK, Noto Serif JP, Noto Serif KR, Noto Serif SC, Noto Serif TC</xsl:variable><xsl:attribute-set name="root-style">
2057
2091
 
2058
2092
 
2059
2093
 
2060
2094
 
2061
2095
 
2062
2096
 
2063
- <xsl:attribute name="font-family">Arial, Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
2097
+ <xsl:attribute name="font-family">Arial, Times New Roman, STIX Two Math, <xsl:value-of select="$font_noto_sans"/></xsl:attribute>
2098
+ <xsl:attribute name="font-family-generic">Sans</xsl:attribute>
2064
2099
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2065
2100
 
2066
2101
 
@@ -2073,6 +2108,7 @@
2073
2108
 
2074
2109
 
2075
2110
 
2111
+
2076
2112
  </xsl:attribute-set><xsl:template name="insertRootStyle">
2077
2113
  <xsl:param name="root-style"/>
2078
2114
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
@@ -2084,17 +2120,60 @@
2084
2120
  </xsl:variable>
2085
2121
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
2086
2122
 
2123
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
2124
+
2087
2125
  <xsl:for-each select="$root-style_/root-style/@*">
2126
+
2088
2127
  <xsl:choose>
2089
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
2128
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
2129
+ <xsl:when test="local-name() = 'font-family'">
2130
+
2131
+ <xsl:variable name="font_regional_prefix">
2132
+ <xsl:choose>
2133
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
2134
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
2135
+ </xsl:choose>
2136
+ </xsl:variable>
2137
+
2090
2138
  <xsl:attribute name="{local-name()}">
2091
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2139
+
2140
+ <xsl:variable name="font_extended">
2141
+ <xsl:choose>
2142
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
2143
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
2144
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
2145
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
2146
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
2147
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
2148
+ </xsl:choose>
2149
+ </xsl:variable>
2150
+ <xsl:if test="normalize-space($font_extended) != ''">
2151
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
2152
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
2153
+ </xsl:if>
2154
+
2155
+ <xsl:value-of select="."/>
2156
+
2157
+ <xsl:if test="$additional_fonts != ''">
2158
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
2159
+ </xsl:if>
2092
2160
  </xsl:attribute>
2093
2161
  </xsl:when>
2094
2162
  <xsl:otherwise>
2095
2163
  <xsl:copy-of select="."/>
2096
2164
  </xsl:otherwise>
2097
2165
  </xsl:choose>
2166
+
2167
+ <!-- <xsl:choose>
2168
+ <xsl:when test="local-name() = 'font-family'">
2169
+ <xsl:attribute name="{local-name()}">
2170
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2171
+ </xsl:attribute>
2172
+ </xsl:when>
2173
+ <xsl:otherwise>
2174
+ <xsl:copy-of select="."/>
2175
+ </xsl:otherwise>
2176
+ </xsl:choose> -->
2098
2177
  </xsl:for-each>
2099
2178
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
2100
2179
 
@@ -2165,7 +2244,7 @@
2165
2244
 
2166
2245
 
2167
2246
 
2168
- <xsl:attribute name="font-family">Courier New</xsl:attribute>
2247
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2169
2248
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2170
2249
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
2171
2250
 
@@ -2173,6 +2252,7 @@
2173
2252
 
2174
2253
 
2175
2254
 
2255
+
2176
2256
 
2177
2257
 
2178
2258
 
@@ -2216,12 +2296,14 @@
2216
2296
 
2217
2297
 
2218
2298
 
2299
+
2219
2300
 
2220
2301
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2221
2302
 
2222
2303
 
2223
2304
 
2224
2305
 
2306
+
2225
2307
  <xsl:attribute name="space-before">8pt</xsl:attribute>
2226
2308
  <xsl:attribute name="space-after">8pt</xsl:attribute>
2227
2309
 
@@ -2258,6 +2340,7 @@
2258
2340
 
2259
2341
 
2260
2342
 
2343
+
2261
2344
 
2262
2345
 
2263
2346
 
@@ -2292,6 +2375,7 @@
2292
2375
 
2293
2376
  </xsl:attribute-set><xsl:variable name="table-border_">
2294
2377
 
2378
+
2295
2379
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
2296
2380
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2297
2381
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -2316,6 +2400,7 @@
2316
2400
 
2317
2401
 
2318
2402
 
2403
+
2319
2404
 
2320
2405
 
2321
2406
 
@@ -2346,6 +2431,7 @@
2346
2431
 
2347
2432
 
2348
2433
 
2434
+
2349
2435
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2350
2436
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2351
2437
 
@@ -2357,6 +2443,7 @@
2357
2443
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2358
2444
  <xsl:attribute name="space-before">12pt</xsl:attribute>
2359
2445
 
2446
+
2360
2447
 
2361
2448
 
2362
2449
 
@@ -2400,6 +2487,7 @@
2400
2487
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2401
2488
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2402
2489
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2490
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2403
2491
  <xsl:attribute name="display-align">center</xsl:attribute>
2404
2492
 
2405
2493
 
@@ -2422,6 +2510,7 @@
2422
2510
  <xsl:attribute name="display-align">center</xsl:attribute>
2423
2511
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2424
2512
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2513
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2425
2514
 
2426
2515
 
2427
2516
 
@@ -2438,6 +2527,7 @@
2438
2527
 
2439
2528
 
2440
2529
 
2530
+
2441
2531
  </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2442
2532
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2443
2533
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2452,7 +2542,7 @@
2452
2542
 
2453
2543
  <xsl:attribute name="border">solid black 0.5pt</xsl:attribute>
2454
2544
 
2455
-
2545
+
2456
2546
 
2457
2547
 
2458
2548
 
@@ -2470,6 +2560,7 @@
2470
2560
 
2471
2561
 
2472
2562
 
2563
+
2473
2564
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
2474
2565
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2475
2566
 
@@ -2477,12 +2568,14 @@
2477
2568
 
2478
2569
 
2479
2570
 
2571
+
2480
2572
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2481
2573
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2482
2574
  <xsl:attribute name="text-indent">-6mm</xsl:attribute>
2483
2575
  <xsl:attribute name="margin-left">6mm</xsl:attribute>
2484
2576
 
2485
2577
 
2578
+
2486
2579
  </xsl:attribute-set><xsl:attribute-set name="table-fn-number-style">
2487
2580
  <xsl:attribute name="font-size">80%</xsl:attribute>
2488
2581
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2501,6 +2594,7 @@
2501
2594
 
2502
2595
 
2503
2596
 
2597
+
2504
2598
  </xsl:attribute-set><xsl:attribute-set name="fn-container-body-style">
2505
2599
  <xsl:attribute name="text-indent">0</xsl:attribute>
2506
2600
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -2525,7 +2619,8 @@
2525
2619
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
2526
2620
 
2527
2621
 
2528
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
2622
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
2623
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
2529
2624
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
2530
2625
 
2531
2626
 
@@ -2539,6 +2634,29 @@
2539
2634
 
2540
2635
 
2541
2636
 
2637
+
2638
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
2639
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2640
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2641
+
2642
+
2643
+
2644
+
2645
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2646
+
2647
+
2648
+
2649
+
2650
+
2651
+
2652
+
2653
+
2654
+
2655
+
2656
+
2657
+
2658
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
2659
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
2542
2660
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2543
2661
 
2544
2662
 
@@ -2577,6 +2695,7 @@
2577
2695
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2578
2696
  <xsl:attribute name="margin-bottom">9pt</xsl:attribute>
2579
2697
 
2698
+
2580
2699
 
2581
2700
 
2582
2701
 
@@ -2643,6 +2762,8 @@
2643
2762
 
2644
2763
 
2645
2764
 
2765
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
2766
+
2646
2767
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2647
2768
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
2648
2769
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -2693,6 +2814,7 @@
2693
2814
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2694
2815
 
2695
2816
 
2817
+
2696
2818
 
2697
2819
 
2698
2820
 
@@ -2739,6 +2861,7 @@
2739
2861
 
2740
2862
 
2741
2863
 
2864
+
2742
2865
  </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
2743
2866
  <xsl:attribute name="text-align">right</xsl:attribute>
2744
2867
 
@@ -2759,20 +2882,21 @@
2759
2882
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2760
2883
 
2761
2884
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2885
+ <xsl:attribute name="width">100%</xsl:attribute>
2886
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2887
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2762
2888
 
2763
2889
 
2764
2890
 
2765
2891
 
2766
2892
  <xsl:attribute name="width">75%</xsl:attribute>
2767
2893
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2768
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2769
2894
 
2770
-
2771
-
2895
+
2772
2896
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
2773
2897
 
2774
2898
 
2775
- <xsl:attribute name="font-family">Courier New</xsl:attribute>
2899
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2776
2900
 
2777
2901
 
2778
2902
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
@@ -2861,6 +2985,25 @@
2861
2985
 
2862
2986
 
2863
2987
 
2988
+
2989
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
2990
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2991
+
2992
+
2993
+
2994
+
2995
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2996
+
2997
+
2998
+
2999
+
3000
+
3001
+
3002
+
3003
+
3004
+
3005
+
3006
+
2864
3007
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2865
3008
 
2866
3009
 
@@ -2908,6 +3051,7 @@
2908
3051
 
2909
3052
 
2910
3053
 
3054
+
2911
3055
  </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2912
3056
  <xsl:attribute name="font-weight">normal</xsl:attribute>
2913
3057
  <xsl:attribute name="font-style">normal</xsl:attribute>
@@ -2934,6 +3078,7 @@
2934
3078
 
2935
3079
 
2936
3080
 
3081
+
2937
3082
  </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2938
3083
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2939
3084
 
@@ -2956,6 +3101,7 @@
2956
3101
 
2957
3102
 
2958
3103
 
3104
+
2959
3105
  </xsl:attribute-set><xsl:attribute-set name="admonition-style">
2960
3106
 
2961
3107
 
@@ -2977,12 +3123,13 @@
2977
3123
 
2978
3124
 
2979
3125
 
3126
+
2980
3127
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
3128
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3129
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2981
3130
 
2982
3131
 
2983
3132
 
2984
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2985
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2986
3133
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2987
3134
  <xsl:attribute name="padding">1mm</xsl:attribute>
2988
3135
  <xsl:attribute name="padding-top">2mm</xsl:attribute>
@@ -2994,6 +3141,7 @@
2994
3141
 
2995
3142
 
2996
3143
 
3144
+
2997
3145
  </xsl:attribute-set><xsl:attribute-set name="admonition-name-style">
2998
3146
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2999
3147
 
@@ -3021,6 +3169,7 @@
3021
3169
 
3022
3170
 
3023
3171
 
3172
+
3024
3173
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-style">
3025
3174
 
3026
3175
 
@@ -3060,6 +3209,7 @@
3060
3209
 
3061
3210
 
3062
3211
 
3212
+
3063
3213
  </xsl:attribute-set><xsl:attribute-set name="bibitem-non-normative-style">
3064
3214
 
3065
3215
 
@@ -3082,6 +3232,7 @@
3082
3232
 
3083
3233
 
3084
3234
 
3235
+
3085
3236
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-list-body-style">
3086
3237
 
3087
3238
 
@@ -3111,6 +3262,7 @@
3111
3262
 
3112
3263
 
3113
3264
 
3265
+
3114
3266
  </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-number-style">
3115
3267
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
3116
3268
 
@@ -3132,6 +3284,7 @@
3132
3284
 
3133
3285
 
3134
3286
 
3287
+
3135
3288
  </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-body-style">
3136
3289
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3137
3290
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -3150,6 +3303,7 @@
3150
3303
 
3151
3304
 
3152
3305
 
3306
+
3153
3307
  </xsl:attribute-set><xsl:attribute-set name="references-non-normative-style">
3154
3308
 
3155
3309
 
@@ -3269,13 +3423,13 @@
3269
3423
 
3270
3424
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
3271
3425
  <xsl:variable name="nodes_preface_">
3272
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3426
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3273
3427
  <node id="{@id}"/>
3274
3428
  </xsl:for-each>
3275
3429
  </xsl:variable>
3276
3430
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3277
3431
 
3278
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3432
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3279
3433
  <xsl:sort select="@displayorder" data-type="number"/>
3280
3434
 
3281
3435
  <!-- process Section's title -->
@@ -3341,7 +3495,7 @@
3341
3495
  </xsl:for-each>
3342
3496
  </figures>
3343
3497
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3344
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3498
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3345
3499
  <xsl:sort select="@displayorder" data-type="number"/>
3346
3500
  <xsl:apply-templates select="."/>
3347
3501
  </xsl:for-each>
@@ -3395,7 +3549,38 @@
3395
3549
  </xsl:template><xsl:template match="*[local-name()='br']">
3396
3550
  <xsl:value-of select="$linebreak"/>
3397
3551
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
3398
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3552
+ <xsl:param name="split_keep-within-line"/>
3553
+
3554
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
3555
+ <xsl:choose>
3556
+
3557
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
3558
+ <xsl:variable name="sep">_</xsl:variable>
3559
+ <xsl:variable name="items">
3560
+ <xsl:call-template name="split">
3561
+ <xsl:with-param name="pText" select="."/>
3562
+ <xsl:with-param name="sep" select="$sep"/>
3563
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
3564
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
3565
+ </xsl:call-template>
3566
+ </xsl:variable>
3567
+ <xsl:for-each select="xalan:nodeset($items)/item">
3568
+ <xsl:choose>
3569
+ <xsl:when test=". = $sep">
3570
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
3571
+ </xsl:when>
3572
+ <xsl:otherwise>
3573
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3574
+ </xsl:otherwise>
3575
+ </xsl:choose>
3576
+ </xsl:for-each>
3577
+ </xsl:when>
3578
+
3579
+ <xsl:otherwise>
3580
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3581
+ </xsl:otherwise>
3582
+
3583
+ </xsl:choose>
3399
3584
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
3400
3585
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
3401
3586
  <xsl:apply-templates/>
@@ -3490,9 +3675,14 @@
3490
3675
 
3491
3676
  <xsl:variable name="table">
3492
3677
 
3493
- <xsl:variable name="simple-table">
3494
- <xsl:call-template name="getSimpleTable"/>
3678
+ <xsl:variable name="simple-table">
3679
+ <xsl:call-template name="getSimpleTable">
3680
+ <xsl:with-param name="id" select="@id"/>
3681
+ </xsl:call-template>
3495
3682
  </xsl:variable>
3683
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
3684
+
3685
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
3496
3686
 
3497
3687
 
3498
3688
  <!-- Display table's name before table as standalone block -->
@@ -3515,7 +3705,23 @@
3515
3705
  </xsl:call-template>
3516
3706
  </xsl:if>
3517
3707
  </xsl:variable>
3518
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3708
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
3709
+
3710
+ <!-- DEBUG -->
3711
+ <xsl:if test="$table_if_debug = 'true'">
3712
+ <fo:block font-size="60%">
3713
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3714
+ </fo:block>
3715
+ </xsl:if>
3716
+
3717
+
3718
+ <!-- <xsl:copy-of select="$colwidths"/> -->
3719
+
3720
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3721
+ DEBUG
3722
+ colwidths=<xsl:copy-of select="$colwidths"/>
3723
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3724
+
3519
3725
 
3520
3726
 
3521
3727
  <xsl:variable name="margin-side">
@@ -3544,6 +3750,8 @@
3544
3750
 
3545
3751
 
3546
3752
 
3753
+
3754
+
3547
3755
 
3548
3756
 
3549
3757
 
@@ -3583,12 +3791,22 @@
3583
3791
 
3584
3792
 
3585
3793
 
3794
+
3795
+
3586
3796
  </xsl:element>
3587
3797
  </xsl:variable>
3588
3798
 
3799
+ <xsl:if test="$isGenerateTableIF = 'true'">
3800
+ <!-- to determine start of table -->
3801
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3802
+ </xsl:if>
3589
3803
 
3590
3804
  <fo:table id="{@id}">
3591
3805
 
3806
+ <xsl:if test="$isGenerateTableIF = 'true'">
3807
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3808
+ </xsl:if>
3809
+
3592
3810
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
3593
3811
  <xsl:attribute name="{local-name()}">
3594
3812
  <xsl:value-of select="."/>
@@ -3602,24 +3820,47 @@
3602
3820
 
3603
3821
 
3604
3822
  <xsl:choose>
3605
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3606
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3607
- <fo:table-column column-width="{@width}"/>
3608
- </xsl:for-each>
3823
+ <xsl:when test="$isGenerateTableIF = 'true'">
3824
+ <!-- generate IF for table widths -->
3825
+ <!-- example:
3826
+ <tr>
3827
+ <td valign="top" align="left" id="tab-symdu_1_1">
3828
+ <p>Symbol</p>
3829
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3830
+ </td>
3831
+ <td valign="top" align="left" id="tab-symdu_1_2">
3832
+ <p>Description</p>
3833
+ <word id="tab-symdu_1_2_word_1">Description</word>
3834
+ </td>
3835
+ </tr>
3836
+ -->
3837
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
3838
+
3609
3839
  </xsl:when>
3610
3840
  <xsl:otherwise>
3611
- <xsl:call-template name="insertTableColumnWidth">
3612
- <xsl:with-param name="colwidths" select="$colwidths"/>
3613
- </xsl:call-template>
3614
- </xsl:otherwise>
3615
- </xsl:choose>
3616
3841
 
3617
- <xsl:choose>
3618
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3619
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3620
- </xsl:when>
3621
- <xsl:otherwise>
3622
- <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 -->
3842
+ <xsl:choose>
3843
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3844
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3845
+ <fo:table-column column-width="{@width}"/>
3846
+ </xsl:for-each>
3847
+ </xsl:when>
3848
+ <xsl:otherwise>
3849
+ <xsl:call-template name="insertTableColumnWidth">
3850
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3851
+ </xsl:call-template>
3852
+ </xsl:otherwise>
3853
+ </xsl:choose>
3854
+
3855
+ <xsl:choose>
3856
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3857
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3858
+ </xsl:when>
3859
+ <xsl:otherwise>
3860
+ <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 -->
3861
+ </xsl:otherwise>
3862
+ </xsl:choose>
3863
+
3623
3864
  </xsl:otherwise>
3624
3865
  </xsl:choose>
3625
3866
 
@@ -3697,23 +3938,29 @@
3697
3938
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3698
3939
  <xsl:param name="continued"/>
3699
3940
  <xsl:if test="normalize-space() != ''">
3700
- <fo:block xsl:use-attribute-sets="table-name-style">
3701
-
3702
-
3703
-
3704
-
3941
+
3942
+
3705
3943
 
3706
- <xsl:choose>
3707
- <xsl:when test="$continued = 'true'">
3944
+ <fo:block xsl:use-attribute-sets="table-name-style">
3945
+
3708
3946
 
3709
- </xsl:when>
3710
- <xsl:otherwise>
3711
- <xsl:apply-templates/>
3712
- </xsl:otherwise>
3713
- </xsl:choose>
3714
-
3947
+
3948
+
3949
+
3950
+ <xsl:choose>
3951
+ <xsl:when test="$continued = 'true'">
3952
+
3953
+ </xsl:when>
3954
+ <xsl:otherwise>
3955
+ <xsl:apply-templates/>
3956
+ </xsl:otherwise>
3957
+ </xsl:choose>
3958
+
3959
+
3960
+ </fo:block>
3961
+
3715
3962
 
3716
- </fo:block>
3963
+
3717
3964
  </xsl:if>
3718
3965
  </xsl:template><xsl:template name="calculate-columns-numbers">
3719
3966
  <xsl:param name="table-row"/>
@@ -3722,11 +3969,22 @@
3722
3969
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3723
3970
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3724
3971
  </xsl:template><xsl:template name="calculate-column-widths">
3972
+ <xsl:param name="table"/>
3973
+ <xsl:param name="cols-count"/>
3974
+
3975
+ <xsl:call-template name="calculate-column-widths-proportional">
3976
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3977
+ <xsl:with-param name="table" select="$table"/>
3978
+ </xsl:call-template>
3979
+
3980
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
3725
3981
  <xsl:param name="table"/>
3726
3982
  <xsl:param name="cols-count"/>
3727
3983
  <xsl:param name="curr-col" select="1"/>
3728
3984
  <xsl:param name="width" select="0"/>
3729
3985
 
3986
+ <!-- table=<xsl:copy-of select="$table"/> -->
3987
+
3730
3988
  <xsl:if test="$curr-col &lt;= $cols-count">
3731
3989
  <xsl:variable name="widths">
3732
3990
  <xsl:choose>
@@ -3764,10 +4022,15 @@
3764
4022
  </xsl:for-each>
3765
4023
  </xsl:when>
3766
4024
  <xsl:otherwise>
3767
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
4025
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
4026
+
4027
+ <!-- <table><xsl:copy-of select="$table"/></table>
4028
+ -->
4029
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
3768
4030
  <xsl:variable name="td_text">
3769
4031
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3770
4032
  </xsl:variable>
4033
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
3771
4034
  <xsl:variable name="words">
3772
4035
  <xsl:variable name="string_with_added_zerospaces">
3773
4036
  <xsl:call-template name="add-zero-spaces-java">
@@ -3782,6 +4045,7 @@
3782
4045
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3783
4046
  </xsl:call-template>
3784
4047
  </xsl:variable>
4048
+ <!-- words=<xsl:copy-of select="$words"/> -->
3785
4049
  <xsl:variable name="max_length">
3786
4050
  <xsl:call-template name="max_length">
3787
4051
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -3806,6 +4070,8 @@
3806
4070
  </xsl:choose>
3807
4071
  </xsl:variable>
3808
4072
 
4073
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
4074
+
3809
4075
  <column>
3810
4076
  <xsl:for-each select="xalan:nodeset($widths)//width">
3811
4077
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3814,33 +4080,271 @@
3814
4080
  </xsl:if>
3815
4081
  </xsl:for-each>
3816
4082
  </column>
3817
- <xsl:call-template name="calculate-column-widths">
4083
+ <xsl:call-template name="calculate-column-widths-proportional">
3818
4084
  <xsl:with-param name="cols-count" select="$cols-count"/>
3819
4085
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
3820
4086
  <xsl:with-param name="table" select="$table"/>
3821
4087
  </xsl:call-template>
3822
4088
  </xsl:if>
3823
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
4089
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
3824
4090
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
3825
4091
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
3826
4092
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
4093
+
4094
+ <!-- if all capitals english letters or digits -->
4095
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
4096
+ <xsl:call-template name="repeat">
4097
+ <xsl:with-param name="char" select="'X'"/>
4098
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
4099
+ </xsl:call-template>
4100
+ </xsl:if>
3827
4101
  </xsl:template><xsl:template match="text()" mode="td_text">
3828
4102
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3829
4103
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3830
4104
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3831
4105
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3832
4106
  <xsl:value-of select="@target"/>
3833
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3834
- <xsl:variable name="mathml">
3835
- <xsl:for-each select="*">
3836
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3837
- <xsl:copy-of select="."/>
3838
- </xsl:if>
4107
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
4108
+ <xsl:if test="$isGenerateTableIF = 'false'">
4109
+ <xsl:variable name="mathml_">
4110
+ <xsl:for-each select="*">
4111
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
4112
+ <xsl:copy-of select="."/>
4113
+ </xsl:if>
4114
+ </xsl:for-each>
4115
+ </xsl:variable>
4116
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
4117
+
4118
+ <xsl:variable name="math_text">
4119
+ <xsl:value-of select="normalize-space($mathml)"/>
4120
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
4121
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
4122
+ </xsl:variable>
4123
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
4124
+ </xsl:if>
4125
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
4126
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
4127
+
4128
+ <!-- via intermediate format -->
4129
+
4130
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
4131
+
4132
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
4133
+
4134
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
4135
+
4136
+ <!-- get current table id -->
4137
+ <xsl:variable name="table_id" select="@id"/>
4138
+ <!-- find table by id in the file 'table_widths' -->
4139
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
4140
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
4141
+
4142
+ <!-- table='<xsl:copy-of select="$table"/>' -->
4143
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
4144
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
4145
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
4146
+
4147
+ <xsl:variable name="table_with_cell_widths_">
4148
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
4149
+ </xsl:variable>
4150
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
4151
+
4152
+ <!-- <xsl:if test="$table_if_debug = 'true'">
4153
+ <xsl:copy-of select="$table_with_cell_widths"/>
4154
+ </xsl:if> -->
4155
+
4156
+
4157
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
4158
+
4159
+ <xsl:variable name="column_widths_">
4160
+ <!-- iteration of columns -->
4161
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
4162
+ <xsl:variable name="pos" select="position()"/>
4163
+ <column>
4164
+ <xsl:attribute name="width_max">
4165
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
4166
+ <xsl:sort select="." data-type="number" order="descending"/>
4167
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4168
+ </xsl:for-each>
4169
+ </xsl:attribute>
4170
+ <xsl:attribute name="width_min">
4171
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
4172
+ <xsl:sort select="." data-type="number" order="descending"/>
4173
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4174
+ </xsl:for-each>
4175
+ </xsl:attribute>
4176
+ </column>
3839
4177
  </xsl:for-each>
3840
4178
  </xsl:variable>
4179
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
4180
+
4181
+ <!-- <column_widths>
4182
+ <xsl:copy-of select="$column_widths"/>
4183
+ </column_widths> -->
4184
+
4185
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
4186
+ <xsl:variable name="table_widths_">
4187
+ <table>
4188
+ <xsl:attribute name="width_max">
4189
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
4190
+ </xsl:attribute>
4191
+ <xsl:attribute name="width_min">
4192
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
4193
+ </xsl:attribute>
4194
+ </table>
4195
+ </xsl:variable>
4196
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
4197
+
4198
+ <xsl:variable name="page_width">
4199
+ <xsl:choose>
4200
+ <xsl:when test="$parent_table_page-width != ''">
4201
+ <xsl:value-of select="$parent_table_page-width"/>
4202
+ </xsl:when>
4203
+ <xsl:otherwise>
4204
+ <xsl:value-of select="@page-width"/>
4205
+ </xsl:otherwise>
4206
+ </xsl:choose>
4207
+ </xsl:variable>
4208
+
4209
+ <xsl:if test="$table_if_debug = 'true'">
4210
+ <table_width>
4211
+ <xsl:copy-of select="$table_widths"/>
4212
+ </table_width>
4213
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
4214
+ </xsl:if>
4215
+
4216
+
4217
+ <!-- There are three cases: -->
4218
+ <xsl:choose>
4219
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
4220
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
4221
+ <!-- call old algorithm -->
4222
+ <case1/>
4223
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
4224
+ <xsl:call-template name="calculate-column-widths-proportional">
4225
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4226
+ <xsl:with-param name="table" select="$table"/>
4227
+ </xsl:call-template> -->
4228
+ </xsl:when>
4229
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
4230
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
4231
+ <case2/>
4232
+ <autolayout/>
4233
+ <xsl:for-each select="$column_widths/column/@width_max">
4234
+ <column divider="100"><xsl:value-of select="."/></column>
4235
+ </xsl:for-each>
4236
+ </xsl:when>
4237
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
4238
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
4239
+ Lets also call D the difference between maximum and minimum width of the table.
4240
+ For each column, let d be the difference between maximum and minimum width of that column.
4241
+ Now set the column's width to the minimum width plus d times W over D.
4242
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
4243
+ <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)">
4244
+ <!-- difference between the available space and the minimum table width -->
4245
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
4246
+ <W><xsl:value-of select="$W"/></W>
4247
+ <!-- difference between maximum and minimum width of the table -->
4248
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
4249
+ <D><xsl:value-of select="$D"/></D>
4250
+ <case3/>
4251
+ <autolayout/>
4252
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
4253
+ <split_keep-within-line>true</split_keep-within-line>
4254
+ </xsl:if>
4255
+ <xsl:for-each select="$column_widths/column">
4256
+ <!-- difference between maximum and minimum width of that column. -->
4257
+ <xsl:variable name="d" select="@width_max - @width_min"/>
4258
+ <d><xsl:value-of select="$d"/></d>
4259
+ <width_min><xsl:value-of select="@width_min"/></width_min>
4260
+ <e><xsl:value-of select="$d * $W div $D"/></e>
4261
+ <!-- set the column's width to the minimum width plus d times W over D. -->
4262
+ <column divider="100">
4263
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4264
+ </column>
4265
+ </xsl:for-each>
4266
+
4267
+ </xsl:when>
4268
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
4269
+ </xsl:choose>
4270
+
4271
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
4272
+
4273
+ <!-- if nested 'dl' or 'table' -->
4274
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
4275
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
4276
+
4277
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
4278
+
4279
+ <xsl:variable name="parent_table_page-width_">
4280
+ <xsl:if test="$parent_table_id != ''">
4281
+ <!-- determine column number in the parent table -->
4282
+ <xsl:variable name="parent_table_column_number">
4283
+ <xsl:choose>
4284
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
4285
+ <xsl:otherwise> <!-- parent is table -->
4286
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
4287
+ </xsl:otherwise>
4288
+ </xsl:choose>
4289
+ </xsl:variable>
4290
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
4291
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
4292
+ </xsl:if>
4293
+ </xsl:variable>
4294
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
4295
+
4296
+ <!-- get current table id -->
4297
+ <xsl:variable name="table_id" select="@id"/>
4298
+
4299
+ <xsl:choose>
4300
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
4301
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
4302
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
4303
+ </xsl:when>
4304
+ <xsl:otherwise>
4305
+ <!-- recalculate columns width based on parent table width -->
4306
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
4307
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
4308
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
4309
+ </xsl:call-template>
4310
+ </xsl:for-each>
4311
+ </xsl:otherwise>
4312
+ </xsl:choose>
3841
4313
 
3842
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3843
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
4314
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
4315
+ <xsl:copy>
4316
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
4317
+ </xsl:copy>
4318
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
4319
+ <xsl:copy>
4320
+ <xsl:copy-of select="@*"/>
4321
+
4322
+ <!-- The maximum width is given by the widest line. -->
4323
+ <xsl:attribute name="width_max">
4324
+ <xsl:for-each select="p_len">
4325
+ <xsl:sort select="." data-type="number" order="descending"/>
4326
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4327
+ </xsl:for-each>
4328
+ </xsl:attribute>
4329
+
4330
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
4331
+ <xsl:variable name="width_min">
4332
+ <xsl:for-each select="word_len">
4333
+ <xsl:sort select="." data-type="number" order="descending"/>
4334
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4335
+ </xsl:for-each>
4336
+ </xsl:variable>
4337
+ <xsl:attribute name="width_min">
4338
+ <xsl:value-of select="$width_min"/>
4339
+ </xsl:attribute>
4340
+
4341
+ <xsl:if test="$width_min = 0">
4342
+ <xsl:attribute name="width_min">1</xsl:attribute>
4343
+ </xsl:if>
4344
+
4345
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
4346
+
4347
+ </xsl:copy>
3844
4348
  </xsl:template><xsl:template match="*[local-name()='thead']">
3845
4349
  <xsl:param name="cols-count"/>
3846
4350
  <fo:table-header>
@@ -3854,12 +4358,18 @@
3854
4358
  <fo:table-row>
3855
4359
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
3856
4360
 
3857
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3858
- <xsl:with-param name="continued">true</xsl:with-param>
3859
- </xsl:apply-templates>
3860
4361
 
3861
4362
 
3862
4363
 
4364
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
4365
+ <xsl:with-param name="continued">true</xsl:with-param>
4366
+ </xsl:apply-templates>
4367
+
4368
+
4369
+
4370
+
4371
+
4372
+
3863
4373
  </fo:table-cell>
3864
4374
  </fo:table-row>
3865
4375
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3925,6 +4435,7 @@
3925
4435
  </xsl:for-each>
3926
4436
  </xsl:when>
3927
4437
  <xsl:otherwise>
4438
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
3928
4439
  <xsl:call-template name="insertTableColumnWidth">
3929
4440
  <xsl:with-param name="colwidths" select="$colwidths"/>
3930
4441
  </xsl:call-template>
@@ -3969,7 +4480,10 @@
3969
4480
 
3970
4481
 
3971
4482
  <!-- fn processing -->
3972
- <xsl:call-template name="table_fn_display"/>
4483
+
4484
+ <xsl:call-template name="table_fn_display"/>
4485
+
4486
+
3973
4487
 
3974
4488
  <!-- for PAS display Notes after footnotes -->
3975
4489
 
@@ -3979,6 +4493,9 @@
3979
4493
  </fo:table-body>
3980
4494
 
3981
4495
  </fo:table>
4496
+
4497
+
4498
+
3982
4499
  </xsl:if>
3983
4500
  </xsl:template><xsl:template match="*[local-name()='tbody']">
3984
4501
 
@@ -4014,6 +4531,52 @@
4014
4531
 
4015
4532
  </fo:table-body>
4016
4533
 
4534
+ </xsl:template><xsl:template match="/" mode="process_table-if">
4535
+ <xsl:param name="table_or_dl">table</xsl:param>
4536
+ <xsl:apply-templates mode="process_table-if">
4537
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
4538
+ </xsl:apply-templates>
4539
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
4540
+ <xsl:param name="table_or_dl">table</xsl:param>
4541
+
4542
+ <fo:table-body>
4543
+ <xsl:for-each select="*[local-name() = 'tr']">
4544
+ <xsl:variable name="col_count" select="count(*)"/>
4545
+
4546
+ <!-- iteration for each tr/td -->
4547
+
4548
+ <xsl:choose>
4549
+ <xsl:when test="$table_or_dl = 'table'">
4550
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
4551
+ <fo:table-row number-columns-spanned="{$col_count}">
4552
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
4553
+ <xsl:call-template name="td"/>
4554
+ </fo:table-row>
4555
+ </xsl:for-each>
4556
+ </xsl:when>
4557
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
4558
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
4559
+ <xsl:variable name="is_dt" select="position() = 1"/>
4560
+
4561
+ <xsl:for-each select="*">
4562
+ <!-- <test><xsl:copy-of select="."/></test> -->
4563
+ <fo:table-row number-columns-spanned="{$col_count}">
4564
+ <xsl:choose>
4565
+ <xsl:when test="$is_dt">
4566
+ <xsl:call-template name="insert_dt_cell"/>
4567
+ </xsl:when>
4568
+ <xsl:otherwise>
4569
+ <xsl:call-template name="insert_dd_cell"/>
4570
+ </xsl:otherwise>
4571
+ </xsl:choose>
4572
+ </fo:table-row>
4573
+ </xsl:for-each>
4574
+ </xsl:for-each>
4575
+ </xsl:otherwise>
4576
+ </xsl:choose>
4577
+
4578
+ </xsl:for-each>
4579
+ </fo:table-body>
4017
4580
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4018
4581
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4019
4582
 
@@ -4021,6 +4584,9 @@
4021
4584
 
4022
4585
 
4023
4586
 
4587
+
4588
+
4589
+
4024
4590
 
4025
4591
 
4026
4592
  <xsl:call-template name="setTableRowAttributes"/>
@@ -4040,6 +4606,8 @@
4040
4606
 
4041
4607
 
4042
4608
 
4609
+
4610
+
4043
4611
  <xsl:call-template name="setTableRowAttributes"/>
4044
4612
  <xsl:apply-templates/>
4045
4613
  </fo:table-row>
@@ -4105,7 +4673,7 @@
4105
4673
  </xsl:choose>
4106
4674
  </xsl:attribute>
4107
4675
  </xsl:if>
4108
- </xsl:template><xsl:template match="*[local-name()='td']">
4676
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
4109
4677
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
4110
4678
  <xsl:call-template name="setTextAlignment">
4111
4679
  <xsl:with-param name="default">left</xsl:with-param>
@@ -4130,6 +4698,8 @@
4130
4698
 
4131
4699
 
4132
4700
 
4701
+
4702
+
4133
4703
 
4134
4704
 
4135
4705
 
@@ -4143,11 +4713,24 @@
4143
4713
 
4144
4714
  <xsl:call-template name="setTableCellAttributes"/>
4145
4715
 
4716
+ <xsl:if test="$isGenerateTableIF = 'true'">
4717
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4718
+ <xsl:attribute name="text-align">left</xsl:attribute>
4719
+ </xsl:if>
4720
+
4146
4721
  <fo:block>
4147
4722
 
4723
+ <xsl:if test="$isGenerateTableIF = 'true'">
4724
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4725
+ </xsl:if>
4726
+
4727
+
4148
4728
 
4149
4729
 
4150
4730
  <xsl:apply-templates/>
4731
+
4732
+ <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"/> -->
4733
+
4151
4734
  </fo:block>
4152
4735
  </fo:table-cell>
4153
4736
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -4188,7 +4771,11 @@
4188
4771
 
4189
4772
  <xsl:variable name="gen_id" select="generate-id(.)"/>
4190
4773
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4191
- <xsl:variable name="reference" select="@reference"/>
4774
+ <xsl:variable name="reference_">
4775
+ <xsl:value-of select="@reference"/>
4776
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4777
+ </xsl:variable>
4778
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
4192
4779
  <!-- fn sequence number in document -->
4193
4780
  <xsl:variable name="current_fn_number">
4194
4781
  <xsl:choose>
@@ -4263,7 +4850,7 @@
4263
4850
  <xsl:copy-of select="node()"/>
4264
4851
  </fn>
4265
4852
  </xsl:for-each>
4266
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
4853
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
4267
4854
  <xsl:sort select="@displayorder" data-type="number"/>
4268
4855
  <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4269
4856
  <!-- copy unique fn -->
@@ -4344,9 +4931,9 @@
4344
4931
  <!-- current hierarchy is 'figure' element -->
4345
4932
  <xsl:variable name="following_dl_colwidths">
4346
4933
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4347
- <xsl:variable name="html-table">
4348
- <xsl:variable name="doc_ns">
4349
-
4934
+ <xsl:variable name="simple-table">
4935
+ <!-- <xsl:variable name="doc_ns">
4936
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4350
4937
  </xsl:variable>
4351
4938
  <xsl:variable name="ns">
4352
4939
  <xsl:choose>
@@ -4357,7 +4944,7 @@
4357
4944
  <xsl:value-of select="substring-before(name(/*), '-')"/>
4358
4945
  </xsl:otherwise>
4359
4946
  </xsl:choose>
4360
- </xsl:variable>
4947
+ </xsl:variable> -->
4361
4948
 
4362
4949
  <xsl:for-each select="*[local-name() = 'dl'][1]">
4363
4950
  <tbody>
@@ -4368,7 +4955,7 @@
4368
4955
 
4369
4956
  <xsl:call-template name="calculate-column-widths">
4370
4957
  <xsl:with-param name="cols-count" select="2"/>
4371
- <xsl:with-param name="table" select="$html-table"/>
4958
+ <xsl:with-param name="table" select="$simple-table"/>
4372
4959
  </xsl:call-template>
4373
4960
 
4374
4961
  </xsl:if>
@@ -4562,12 +5149,31 @@
4562
5149
 
4563
5150
 
4564
5151
 
5152
+
5153
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
5154
+ <xsl:attribute name="margin-top">0</xsl:attribute>
5155
+ </xsl:if>
5156
+
4565
5157
  <fo:block>
4566
5158
 
4567
5159
 
4568
5160
 
4569
5161
 
5162
+ <xsl:apply-templates select="*[local-name() = 'name']">
5163
+ <xsl:with-param name="process">true</xsl:with-param>
5164
+ </xsl:apply-templates>
5165
+
5166
+ <xsl:if test="$isGenerateTableIF = 'true'">
5167
+ <!-- to determine start of table -->
5168
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
5169
+ </xsl:if>
5170
+
4570
5171
  <fo:table width="95%" table-layout="fixed">
5172
+
5173
+ <xsl:if test="$isGenerateTableIF = 'true'">
5174
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
5175
+ </xsl:if>
5176
+
4571
5177
 
4572
5178
  <xsl:choose>
4573
5179
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -4578,69 +5184,173 @@
4578
5184
 
4579
5185
  </xsl:when>
4580
5186
  </xsl:choose>
4581
- <!-- create virtual html table for dl/[dt and dd] -->
4582
- <xsl:variable name="html-table">
4583
- <xsl:variable name="doc_ns">
5187
+
5188
+
5189
+
5190
+ <xsl:choose>
5191
+ <xsl:when test="$isGenerateTableIF = 'true'">
5192
+ <!-- generate IF for table widths -->
5193
+ <!-- example:
5194
+ <tr>
5195
+ <td valign="top" align="left" id="tab-symdu_1_1">
5196
+ <p>Symbol</p>
5197
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
5198
+ </td>
5199
+ <td valign="top" align="left" id="tab-symdu_1_2">
5200
+ <p>Description</p>
5201
+ <word id="tab-symdu_1_2_word_1">Description</word>
5202
+ </td>
5203
+ </tr>
5204
+ -->
4584
5205
 
4585
- </xsl:variable>
4586
- <xsl:variable name="ns">
4587
- <xsl:choose>
4588
- <xsl:when test="normalize-space($doc_ns) != ''">
4589
- <xsl:value-of select="normalize-space($doc_ns)"/>
4590
- </xsl:when>
4591
- <xsl:otherwise>
4592
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4593
- </xsl:otherwise>
4594
- </xsl:choose>
4595
- </xsl:variable>
4596
- <tbody>
4597
- <xsl:apply-templates mode="dl"/>
4598
- </tbody>
4599
- </xsl:variable>
4600
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
4601
- <xsl:variable name="colwidths">
4602
- <xsl:call-template name="calculate-column-widths">
4603
- <xsl:with-param name="cols-count" select="2"/>
4604
- <xsl:with-param name="table" select="$html-table"/>
4605
- </xsl:call-template>
4606
- </xsl:variable>
4607
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
4608
- <xsl:variable name="maxlength_dt">
4609
- <xsl:call-template name="getMaxLength_dt"/>
4610
- </xsl:variable>
4611
- <xsl:variable name="isContainsKeepTogetherTag_">
4612
- false
4613
- </xsl:variable>
4614
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4615
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4616
- <xsl:call-template name="setColumnWidth_dl">
4617
- <xsl:with-param name="colwidths" select="$colwidths"/>
4618
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4619
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4620
- </xsl:call-template>
5206
+ <!-- create virtual html table for dl/[dt and dd] -->
5207
+ <xsl:variable name="simple-table">
5208
+
5209
+ <xsl:variable name="dl_table">
5210
+ <tbody>
5211
+ <xsl:apply-templates mode="dl_if">
5212
+ <xsl:with-param name="id" select="@id"/>
5213
+ </xsl:apply-templates>
5214
+ </tbody>
5215
+ </xsl:variable>
5216
+
5217
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
5218
+
5219
+ <!-- Step: replace <br/> to <p>...</p> -->
5220
+ <xsl:variable name="table_without_br">
5221
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
5222
+ </xsl:variable>
5223
+
5224
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
5225
+
5226
+ <!-- Step: add id to each cell -->
5227
+ <!-- add <word>...</word> for each word, image, math -->
5228
+ <xsl:variable name="simple-table-id">
5229
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
5230
+ <xsl:with-param name="id" select="@id"/>
5231
+ </xsl:apply-templates>
5232
+ </xsl:variable>
5233
+
5234
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
5235
+
5236
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
5237
+
5238
+ </xsl:variable>
5239
+
5240
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
5241
+
5242
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
5243
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
5244
+ </xsl:apply-templates>
5245
+
5246
+ </xsl:when>
5247
+ <xsl:otherwise>
4621
5248
 
4622
- <fo:table-body>
4623
- <xsl:apply-templates>
4624
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
4625
- </xsl:apply-templates>
4626
- </fo:table-body>
5249
+ <xsl:variable name="simple-table">
5250
+
5251
+ <xsl:variable name="dl_table">
5252
+ <tbody>
5253
+ <xsl:apply-templates mode="dl">
5254
+ <xsl:with-param name="id" select="@id"/>
5255
+ </xsl:apply-templates>
5256
+ </tbody>
5257
+ </xsl:variable>
5258
+
5259
+ <xsl:copy-of select="$dl_table"/>
5260
+ </xsl:variable>
5261
+
5262
+ <xsl:variable name="colwidths">
5263
+ <xsl:call-template name="calculate-column-widths">
5264
+ <xsl:with-param name="cols-count" select="2"/>
5265
+ <xsl:with-param name="table" select="$simple-table"/>
5266
+ </xsl:call-template>
5267
+ </xsl:variable>
5268
+
5269
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
5270
+ DEBUG
5271
+ colwidths=<xsl:copy-of select="$colwidths"/>
5272
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
5273
+
5274
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
5275
+
5276
+ <xsl:variable name="maxlength_dt">
5277
+ <xsl:call-template name="getMaxLength_dt"/>
5278
+ </xsl:variable>
5279
+
5280
+ <xsl:variable name="isContainsKeepTogetherTag_">
5281
+ false
5282
+ </xsl:variable>
5283
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
5284
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
5285
+
5286
+
5287
+ <xsl:call-template name="setColumnWidth_dl">
5288
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5289
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5290
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5291
+ </xsl:call-template>
5292
+
5293
+ <fo:table-body>
5294
+
5295
+ <!-- DEBUG -->
5296
+ <xsl:if test="$table_if_debug = 'true'">
5297
+ <fo:table-row>
5298
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
5299
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
5300
+ </fo:table-cell>
5301
+ </fo:table-row>
5302
+ </xsl:if>
5303
+
5304
+ <xsl:apply-templates>
5305
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
5306
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
5307
+ </xsl:apply-templates>
5308
+
5309
+ </fo:table-body>
5310
+ </xsl:otherwise>
5311
+ </xsl:choose>
4627
5312
  </fo:table>
4628
5313
  </fo:block>
4629
5314
  </fo:block>
4630
5315
  </xsl:if> <!-- END: a few components -->
4631
5316
  </fo:block-container>
4632
5317
  </fo:block-container>
5318
+
5319
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
5320
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
5321
+ </xsl:if>
5322
+
5323
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5324
+ <xsl:param name="process">false</xsl:param>
5325
+ <xsl:if test="$process = 'true'">
5326
+ <fo:block xsl:use-attribute-sets="dl-name-style">
5327
+ <xsl:apply-templates/>
5328
+ </fo:block>
5329
+ </xsl:if>
4633
5330
  </xsl:template><xsl:template name="setColumnWidth_dl">
4634
5331
  <xsl:param name="colwidths"/>
4635
5332
  <xsl:param name="maxlength_dt"/>
4636
5333
  <xsl:param name="isContainsKeepTogetherTag"/>
5334
+
5335
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5336
+
4637
5337
  <xsl:choose>
5338
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5339
+ <xsl:call-template name="insertTableColumnWidth">
5340
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5341
+ </xsl:call-template>
5342
+ </xsl:when>
4638
5343
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4639
5344
  <fo:table-column column-width="50%"/>
4640
5345
  <fo:table-column column-width="50%"/>
4641
5346
  </xsl:when>
4642
5347
  <xsl:otherwise>
4643
5348
  <xsl:choose>
5349
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5350
+ <xsl:call-template name="insertTableColumnWidth">
5351
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5352
+ </xsl:call-template>
5353
+ </xsl:when>
4644
5354
  <xsl:when test="$isContainsKeepTogetherTag">
4645
5355
  <xsl:call-template name="insertTableColumnWidth">
4646
5356
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -4685,13 +5395,19 @@
4685
5395
  </xsl:choose>
4686
5396
  </xsl:template><xsl:template name="insertTableColumnWidth">
4687
5397
  <xsl:param name="colwidths"/>
5398
+
4688
5399
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
4689
5400
  <xsl:choose>
4690
5401
  <xsl:when test=". = 1 or . = 0">
4691
5402
  <fo:table-column column-width="proportional-column-width(2)"/>
4692
5403
  </xsl:when>
4693
5404
  <xsl:otherwise>
4694
- <fo:table-column column-width="proportional-column-width({.})"/>
5405
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
5406
+ <xsl:variable name="divider">
5407
+ <xsl:value-of select="@divider"/>
5408
+ <xsl:if test="not(@divider)">1</xsl:if>
5409
+ </xsl:variable>
5410
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
4695
5411
  </xsl:otherwise>
4696
5412
  </xsl:choose>
4697
5413
  </xsl:for-each>
@@ -4753,11 +5469,19 @@
4753
5469
  </fo:table-cell>
4754
5470
  </fo:table-row>
4755
5471
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
5472
+ <xsl:param name="id"/>
5473
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4756
5474
  <tr>
4757
5475
  <td>
5476
+ <xsl:attribute name="id">
5477
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5478
+ </xsl:attribute>
4758
5479
  <xsl:apply-templates/>
4759
5480
  </td>
4760
5481
  <td>
5482
+ <xsl:attribute name="id">
5483
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
5484
+ </xsl:attribute>
4761
5485
 
4762
5486
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4763
5487
  <xsl:with-param name="process">true</xsl:with-param>
@@ -4766,52 +5490,136 @@
4766
5490
  </td>
4767
5491
  </tr>
4768
5492
 
4769
- </xsl:template><xsl:template match="*[local-name()='dt']">
4770
- <xsl:param name="key_iso"/>
5493
+ </xsl:template><xsl:template match="*[local-name()='dt']">
5494
+ <xsl:param name="key_iso"/>
5495
+ <xsl:param name="split_keep-within-line"/>
5496
+
5497
+ <fo:table-row xsl:use-attribute-sets="dt-row-style">
5498
+ <xsl:call-template name="insert_dt_cell">
5499
+ <xsl:with-param name="key_iso" select="$key_iso"/>
5500
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5501
+ </xsl:call-template>
5502
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
5503
+ <xsl:call-template name="insert_dd_cell">
5504
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5505
+ </xsl:call-template>
5506
+ </xsl:for-each>
5507
+ </fo:table-row>
5508
+ </xsl:template><xsl:template name="insert_dt_cell">
5509
+ <xsl:param name="key_iso"/>
5510
+ <xsl:param name="split_keep-within-line"/>
5511
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
5512
+
5513
+ <xsl:if test="$isGenerateTableIF = 'true'">
5514
+ <!-- border is mandatory, to calculate real width -->
5515
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5516
+ <xsl:attribute name="text-align">left</xsl:attribute>
5517
+ </xsl:if>
5518
+
5519
+
5520
+ <fo:block xsl:use-attribute-sets="dt-block-style">
5521
+ <xsl:copy-of select="@id"/>
5522
+
5523
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5524
+ <xsl:attribute name="margin-top">0</xsl:attribute>
5525
+ </xsl:if>
5526
+
5527
+
5528
+
5529
+ <xsl:apply-templates>
5530
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5531
+ </xsl:apply-templates>
5532
+
5533
+ <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"/> -->
5534
+
5535
+ </fo:block>
5536
+ </fo:table-cell>
5537
+ </xsl:template><xsl:template name="insert_dd_cell">
5538
+ <xsl:param name="split_keep-within-line"/>
5539
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
5540
+
5541
+ <xsl:if test="$isGenerateTableIF = 'true'">
5542
+ <!-- border is mandatory, to calculate real width -->
5543
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5544
+ </xsl:if>
4771
5545
 
4772
- <fo:table-row xsl:use-attribute-sets="dt-row-style">
4773
- <fo:table-cell>
5546
+ <fo:block>
5547
+
5548
+ <xsl:if test="$isGenerateTableIF = 'true'">
5549
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5550
+ </xsl:if>
5551
+
4774
5552
 
4775
- <fo:block xsl:use-attribute-sets="dt-style">
4776
- <xsl:copy-of select="@id"/>
4777
-
4778
- <xsl:if test="normalize-space($key_iso) = 'true'">
4779
- <xsl:attribute name="margin-top">0</xsl:attribute>
4780
- </xsl:if>
4781
-
4782
-
4783
-
4784
- <xsl:apply-templates/>
4785
- </fo:block>
4786
- </fo:table-cell>
4787
- <fo:table-cell>
4788
- <fo:block>
4789
-
4790
5553
 
4791
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4792
- <xsl:with-param name="process">true</xsl:with-param>
4793
- </xsl:apply-templates>
4794
- </fo:block>
4795
- </fo:table-cell>
4796
- </fo:table-row>
5554
+ <xsl:choose>
5555
+ <xsl:when test="$isGenerateTableIF = 'true'">
5556
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
5557
+ <xsl:with-param name="process">true</xsl:with-param>
5558
+ </xsl:apply-templates>
5559
+ </xsl:when>
5560
+ <xsl:otherwise>
5561
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
5562
+ <xsl:with-param name="process">true</xsl:with-param>
5563
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5564
+ </xsl:apply-templates>
5565
+ </xsl:otherwise>
5566
+
5567
+ </xsl:choose>
5568
+
5569
+ <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"/> -->
5570
+
5571
+ </fo:block>
5572
+ </fo:table-cell>
4797
5573
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4798
5574
  <xsl:apply-templates/>
4799
5575
  </xsl:template><xsl:template match="*[local-name()='dd']">
4800
5576
  <xsl:param name="process">false</xsl:param>
5577
+ <xsl:param name="split_keep-within-line"/>
4801
5578
  <xsl:if test="$process = 'true'">
4802
5579
  <xsl:apply-templates select="@language"/>
4803
- <xsl:apply-templates/>
5580
+ <xsl:apply-templates>
5581
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5582
+ </xsl:apply-templates>
4804
5583
  </xsl:if>
4805
5584
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4806
5585
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4807
- </xsl:template><xsl:template match="*[local-name()='em']">
5586
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
5587
+ <xsl:param name="id"/>
5588
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
5589
+ <tr>
5590
+ <td>
5591
+ <xsl:copy-of select="node()"/>
5592
+ </td>
5593
+ <td>
5594
+
5595
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5596
+
5597
+ <!-- get paragraphs from nested 'dl' -->
5598
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5599
+
5600
+
5601
+ </td>
5602
+ </tr>
5603
+
5604
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5605
+ <xsl:for-each select="*[local-name() = 'dt']">
5606
+ <p>
5607
+ <xsl:copy-of select="node()"/>
5608
+ <xsl:text> </xsl:text>
5609
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
5610
+ </p>
5611
+ </xsl:for-each>
5612
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
4808
5613
  <fo:inline font-style="italic">
4809
5614
  <xsl:apply-templates/>
4810
5615
  </fo:inline>
4811
5616
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
5617
+ <xsl:param name="split_keep-within-line"/>
4812
5618
  <fo:inline font-weight="bold">
4813
5619
 
4814
- <xsl:apply-templates/>
5620
+ <xsl:apply-templates>
5621
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5622
+ </xsl:apply-templates>
4815
5623
  </fo:inline>
4816
5624
  </xsl:template><xsl:template match="*[local-name()='padding']">
4817
5625
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -4832,7 +5640,7 @@
4832
5640
 
4833
5641
  10
4834
5642
 
4835
-
5643
+ <!-- 10 -->
4836
5644
 
4837
5645
 
4838
5646
 
@@ -5012,6 +5820,10 @@
5012
5820
  <xsl:param name="text"/>
5013
5821
  <xsl:param name="separator" select="' '"/>
5014
5822
  <xsl:choose>
5823
+
5824
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
5825
+ <word><xsl:value-of select="normalize-space($text)"/></word>
5826
+ </xsl:when>
5015
5827
  <xsl:when test="not(contains($text, $separator))">
5016
5828
  <word>
5017
5829
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -5056,13 +5868,66 @@
5056
5868
  </xsl:when>
5057
5869
  <xsl:otherwise>
5058
5870
  <word>
5059
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
5871
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
5872
+ <xsl:choose>
5873
+ <xsl:when test="$isGenerateTableIF = 'true'">
5874
+ <xsl:value-of select="$word"/>
5875
+ </xsl:when>
5876
+ <xsl:otherwise>
5877
+ <xsl:value-of select="string-length($word)"/>
5878
+ </xsl:otherwise>
5879
+ </xsl:choose>
5060
5880
  </word>
5061
5881
  <xsl:call-template name="tokenize">
5062
5882
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5063
5883
  </xsl:call-template>
5064
5884
  </xsl:otherwise>
5065
5885
  </xsl:choose>
5886
+ </xsl:template><xsl:template name="tokenize_with_tags">
5887
+ <xsl:param name="tags"/>
5888
+ <xsl:param name="text"/>
5889
+ <xsl:param name="separator" select="' '"/>
5890
+ <xsl:choose>
5891
+
5892
+ <xsl:when test="not(contains($text, $separator))">
5893
+ <word>
5894
+ <xsl:call-template name="enclose_text_in_tags">
5895
+ <xsl:with-param name="text" select="normalize-space($text)"/>
5896
+ <xsl:with-param name="tags" select="$tags"/>
5897
+ </xsl:call-template>
5898
+ </word>
5899
+ </xsl:when>
5900
+ <xsl:otherwise>
5901
+ <word>
5902
+ <xsl:call-template name="enclose_text_in_tags">
5903
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
5904
+ <xsl:with-param name="tags" select="$tags"/>
5905
+ </xsl:call-template>
5906
+ </word>
5907
+ <xsl:call-template name="tokenize_with_tags">
5908
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5909
+ </xsl:call-template>
5910
+ </xsl:otherwise>
5911
+ </xsl:choose>
5912
+ </xsl:template><xsl:template name="enclose_text_in_tags">
5913
+ <xsl:param name="text"/>
5914
+ <xsl:param name="tags"/>
5915
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
5916
+
5917
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
5918
+
5919
+ <xsl:choose>
5920
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
5921
+ <xsl:otherwise>
5922
+ <xsl:element name="{$tag_name}">
5923
+ <xsl:call-template name="enclose_text_in_tags">
5924
+ <xsl:with-param name="text" select="$text"/>
5925
+ <xsl:with-param name="tags" select="$tags"/>
5926
+ <xsl:with-param name="num" select="$num + 1"/>
5927
+ </xsl:call-template>
5928
+ </xsl:element>
5929
+ </xsl:otherwise>
5930
+ </xsl:choose>
5066
5931
  </xsl:template><xsl:template name="max_length">
5067
5932
  <xsl:param name="words"/>
5068
5933
  <xsl:for-each select="$words//word">
@@ -5163,12 +6028,19 @@
5163
6028
  </xsl:otherwise>
5164
6029
  </xsl:choose>
5165
6030
  </xsl:template><xsl:template name="getSimpleTable">
6031
+ <xsl:param name="id"/>
6032
+
5166
6033
  <xsl:variable name="simple-table">
5167
6034
 
6035
+ <!-- Step 0. replace <br/> to <p>...</p> -->
6036
+ <xsl:variable name="table_without_br">
6037
+ <xsl:apply-templates mode="table-without-br"/>
6038
+ </xsl:variable>
6039
+
5168
6040
  <!-- Step 1. colspan processing -->
5169
6041
  <xsl:variable name="simple-table-colspan">
5170
6042
  <tbody>
5171
- <xsl:apply-templates mode="simple-table-colspan"/>
6043
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
5172
6044
  </tbody>
5173
6045
  </xsl:variable>
5174
6046
 
@@ -5177,10 +6049,67 @@
5177
6049
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
5178
6050
  </xsl:variable>
5179
6051
 
5180
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
5181
-
6052
+ <!-- Step 3: add id to each cell -->
6053
+ <!-- add <word>...</word> for each word, image, math -->
6054
+ <xsl:variable name="simple-table-id">
6055
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
6056
+ <xsl:with-param name="id" select="$id"/>
6057
+ </xsl:apply-templates>
6058
+ </xsl:variable>
6059
+
6060
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
6061
+
5182
6062
  </xsl:variable>
5183
6063
  <xsl:copy-of select="$simple-table"/>
6064
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
6065
+ <xsl:copy>
6066
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
6067
+ </xsl:copy>
6068
+ </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">
6069
+ <xsl:copy>
6070
+ <xsl:copy-of select="@*"/>
6071
+ <p>
6072
+ <xsl:copy-of select="node()"/>
6073
+ </p>
6074
+ </xsl:copy>
6075
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
6076
+ <xsl:copy>
6077
+ <xsl:copy-of select="@*"/>
6078
+ <xsl:for-each select="*[local-name()='br']">
6079
+ <xsl:variable name="current_id" select="generate-id()"/>
6080
+ <p>
6081
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
6082
+ <xsl:copy-of select="."/>
6083
+ </xsl:for-each>
6084
+ </p>
6085
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
6086
+ <p>
6087
+ <xsl:for-each select="following-sibling::node()">
6088
+ <xsl:copy-of select="."/>
6089
+ </xsl:for-each>
6090
+ </p>
6091
+ </xsl:if>
6092
+ </xsl:for-each>
6093
+ </xsl:copy>
6094
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
6095
+ <xsl:for-each select="*[local-name()='br']">
6096
+ <xsl:variable name="current_id" select="generate-id()"/>
6097
+ <p>
6098
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
6099
+ <xsl:copy-of select="."/>
6100
+ </xsl:for-each>
6101
+ </p>
6102
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
6103
+ <p>
6104
+ <xsl:for-each select="following-sibling::node()">
6105
+ <xsl:copy-of select="."/>
6106
+ </xsl:for-each>
6107
+ </p>
6108
+ </xsl:if>
6109
+ </xsl:for-each>
6110
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
6111
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
6112
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
5184
6113
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
5185
6114
  <xsl:apply-templates mode="simple-table-colspan"/>
5186
6115
  </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">
@@ -5270,6 +6199,126 @@
5270
6199
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5271
6200
  <xsl:with-param name="previousRow" select="$newRow"/>
5272
6201
  </xsl:apply-templates>
6202
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
6203
+ <xsl:param name="id"/>
6204
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
6205
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
6206
+ <xsl:with-param name="id" select="$id_prefixed"/>
6207
+ </xsl:apply-templates>
6208
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
6209
+ <xsl:param name="id"/>
6210
+ <xsl:copy>
6211
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
6212
+ <xsl:with-param name="id" select="$id"/>
6213
+ </xsl:apply-templates>
6214
+ </xsl:copy>
6215
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
6216
+ <xsl:param name="id"/>
6217
+ <xsl:copy>
6218
+ <xsl:copy-of select="@*"/>
6219
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
6220
+ <xsl:apply-templates select="node()" mode="simple-table-id">
6221
+ <xsl:with-param name="id" select="$id"/>
6222
+ </xsl:apply-templates>
6223
+ </xsl:copy>
6224
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
6225
+ <xsl:param name="id"/>
6226
+ <xsl:copy>
6227
+ <xsl:copy-of select="@*"/>
6228
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
6229
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
6230
+ <xsl:attribute name="id">
6231
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
6232
+ </xsl:attribute>
6233
+
6234
+ <xsl:for-each select="*[local-name() = 'p']">
6235
+ <xsl:copy>
6236
+ <xsl:copy-of select="@*"/>
6237
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
6238
+ <xsl:attribute name="id">
6239
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
6240
+ </xsl:attribute>
6241
+
6242
+ <xsl:copy-of select="node()"/>
6243
+ </xsl:copy>
6244
+ </xsl:for-each>
6245
+
6246
+
6247
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
6248
+
6249
+ <xsl:variable name="td_text">
6250
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
6251
+ </xsl:variable>
6252
+
6253
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
6254
+
6255
+ <xsl:variable name="words">
6256
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
6257
+ <word>
6258
+ <xsl:copy-of select="."/>
6259
+ </word>
6260
+ </xsl:for-each>
6261
+
6262
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
6263
+ <xsl:copy-of select="."/>
6264
+ </xsl:for-each>
6265
+
6266
+ </xsl:variable>
6267
+
6268
+ <xsl:for-each select="xalan:nodeset($words)/word">
6269
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
6270
+ <xsl:copy>
6271
+ <xsl:attribute name="id">
6272
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
6273
+ </xsl:attribute>
6274
+ <xsl:copy-of select="node()"/>
6275
+ </xsl:copy>
6276
+ </xsl:for-each>
6277
+ </xsl:if>
6278
+ </xsl:copy>
6279
+
6280
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
6281
+ <xsl:copy>
6282
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
6283
+ </xsl:copy>
6284
+ </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">
6285
+ <xsl:variable name="formatting_tags">
6286
+ <xsl:call-template name="getFormattingTags"/>
6287
+ </xsl:variable>
6288
+ <word>
6289
+ <xsl:call-template name="enclose_text_in_tags">
6290
+ <xsl:with-param name="text" select="normalize-space(.)"/>
6291
+ <xsl:with-param name="tags" select="$formatting_tags"/>
6292
+ </xsl:call-template>
6293
+ </word>
6294
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
6295
+
6296
+ <xsl:variable name="td_text" select="."/>
6297
+
6298
+ <xsl:variable name="string_with_added_zerospaces">
6299
+ <xsl:call-template name="add-zero-spaces-java">
6300
+ <xsl:with-param name="text" select="$td_text"/>
6301
+ </xsl:call-template>
6302
+ </xsl:variable>
6303
+
6304
+ <xsl:variable name="formatting_tags">
6305
+ <xsl:call-template name="getFormattingTags"/>
6306
+ </xsl:variable>
6307
+
6308
+ <!-- <word>text</word> -->
6309
+ <xsl:call-template name="tokenize_with_tags">
6310
+ <xsl:with-param name="tags" select="$formatting_tags"/>
6311
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
6312
+ </xsl:call-template>
6313
+ </xsl:template><xsl:template name="getFormattingTags">
6314
+ <tags>
6315
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
6316
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
6317
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
6318
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
6319
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
6320
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
6321
+ </tags>
5273
6322
  </xsl:template><xsl:template name="getLang">
5274
6323
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5275
6324
  <xsl:variable name="language">
@@ -5463,6 +6512,10 @@
5463
6512
  </xsl:variable>
5464
6513
  <fo:inline xsl:use-attribute-sets="link-style">
5465
6514
 
6515
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
6516
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6517
+ </xsl:if>
6518
+
5466
6519
 
5467
6520
 
5468
6521
 
@@ -5473,6 +6526,7 @@
5473
6526
 
5474
6527
 
5475
6528
 
6529
+
5476
6530
  <xsl:choose>
5477
6531
  <xsl:when test="$target_text = ''">
5478
6532
  <xsl:apply-templates/>
@@ -5729,7 +6783,19 @@
5729
6783
  <xsl:value-of select="$suffix"/>
5730
6784
  </xsl:if>
5731
6785
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
5732
- <fo:inline><xsl:apply-templates/></fo:inline>
6786
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
6787
+ <xsl:choose>
6788
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
6789
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
6790
+ <xsl:apply-templates/>
6791
+ </fo:inline>
6792
+ </xsl:when>
6793
+ <xsl:otherwise>
6794
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
6795
+ <xsl:apply-templates/>
6796
+ </fo:block>
6797
+ </xsl:otherwise>
6798
+ </xsl:choose>
5733
6799
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
5734
6800
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
5735
6801
  <fo:block id="{@id}">
@@ -6555,7 +7621,7 @@
6555
7621
  </xsl:choose>
6556
7622
  </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">
6557
7623
  <xsl:value-of select="."/>
6558
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
7624
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6559
7625
  <xsl:text> </xsl:text>
6560
7626
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
6561
7627
  <xsl:copy>
@@ -6626,7 +7692,7 @@
6626
7692
 
6627
7693
  9
6628
7694
 
6629
-
7695
+ <!-- 9 -->
6630
7696
 
6631
7697
 
6632
7698
 
@@ -6710,7 +7776,7 @@
6710
7776
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6711
7777
  <xsl:choose>
6712
7778
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6713
- <xsl:call-template name="interspers">
7779
+ <xsl:call-template name="interspers-java">
6714
7780
  <xsl:with-param name="str" select="."/>
6715
7781
  </xsl:call-template>
6716
7782
  </xsl:when>
@@ -6760,6 +7826,10 @@
6760
7826
  <xsl:with-param name="char" select="$char"/>
6761
7827
  </xsl:call-template>
6762
7828
  </xsl:if>
7829
+ </xsl:template><xsl:template name="interspers-java">
7830
+ <xsl:param name="str"/>
7831
+ <xsl:param name="char" select="$zero_width_space"/>
7832
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
6763
7833
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6764
7834
  <xsl:apply-templates mode="syntax_highlight"/>
6765
7835
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -6972,7 +8042,9 @@
6972
8042
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
6973
8043
  </xsl:if>
6974
8044
  <xsl:variable name="simple-table">
6975
- <xsl:call-template name="getSimpleTable"/>
8045
+ <xsl:call-template name="getSimpleTable">
8046
+ <xsl:with-param name="id" select="@id"/>
8047
+ </xsl:call-template>
6976
8048
  </xsl:variable>
6977
8049
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
6978
8050
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -7412,6 +8484,7 @@
7412
8484
 
7413
8485
 
7414
8486
 
8487
+
7415
8488
  </xsl:variable>
7416
8489
 
7417
8490
  <xsl:variable name="padding-right">
@@ -7715,6 +8788,11 @@
7715
8788
  </xsl:otherwise>
7716
8789
  </xsl:choose>
7717
8790
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8791
+
8792
+ <xsl:apply-templates select="*[local-name() = 'name']">
8793
+ <xsl:with-param name="process">true</xsl:with-param>
8794
+ </xsl:apply-templates>
8795
+
7718
8796
  <fo:list-block xsl:use-attribute-sets="list-style">
7719
8797
 
7720
8798
 
@@ -7732,12 +8810,23 @@
7732
8810
 
7733
8811
 
7734
8812
 
8813
+ <xsl:if test="*[local-name() = 'name']">
8814
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8815
+ </xsl:if>
8816
+
7735
8817
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7736
8818
  </fo:list-block>
7737
8819
  <!-- <xsl:for-each select="./iho:note">
7738
8820
  <xsl:call-template name="note"/>
7739
8821
  </xsl:for-each> -->
7740
8822
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8823
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8824
+ <xsl:param name="process">false</xsl:param>
8825
+ <xsl:if test="$process = 'true'">
8826
+ <fo:block xsl:use-attribute-sets="list-name-style">
8827
+ <xsl:apply-templates/>
8828
+ </fo:block>
8829
+ </xsl:if>
7741
8830
  </xsl:template><xsl:template match="*[local-name()='li']">
7742
8831
  <fo:list-item xsl:use-attribute-sets="list-item-style">
7743
8832
  <xsl:copy-of select="@id"/>
@@ -7937,7 +9026,7 @@
7937
9026
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7938
9027
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7939
9028
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7940
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
9029
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
7941
9030
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7942
9031
  <!-- <row>
7943
9032
  <date>05-07-2013</date>
@@ -8013,7 +9102,7 @@
8013
9102
 
8014
9103
  </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
8015
9104
 
8016
- <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
9105
+ <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
8017
9106
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
8018
9107
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
8019
9108
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
@@ -8024,7 +9113,9 @@
8024
9113
 
8025
9114
  <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
8026
9115
  <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
8027
- <xsl:number format="[1]"/>
9116
+
9117
+ <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
9118
+
8028
9119
  </xsl:if>
8029
9120
 
8030
9121
  </fo:inline>
@@ -8046,26 +9137,23 @@
8046
9137
  <xsl:if test=".//*[local-name() = 'fn']">
8047
9138
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8048
9139
  </xsl:if>
9140
+
9141
+ <!-- display document identifier, not number [1] -->
8049
9142
  <xsl:variable name="docidentifier">
8050
9143
  <xsl:choose>
8051
9144
  <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
8052
9145
  <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
8053
9146
  </xsl:choose>
8054
9147
  </xsl:variable>
8055
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
9148
+ <xsl:value-of select="$docidentifier"/>
9149
+
8056
9150
  <xsl:apply-templates select="*[local-name() = 'note']"/>
8057
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
8058
- <xsl:choose>
8059
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
8060
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
8061
- </xsl:when>
8062
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
8063
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
8064
- </xsl:when>
8065
- <xsl:otherwise>
8066
- <xsl:apply-templates select="*[local-name() = 'title']"/>
8067
- </xsl:otherwise>
8068
- </xsl:choose>
9151
+
9152
+ <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
9153
+ <xsl:text>,</xsl:text>
9154
+ <xsl:text> </xsl:text>
9155
+ </xsl:if>
9156
+
8069
9157
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8070
9158
  <!-- end bibitem processing -->
8071
9159
 
@@ -8369,16 +9457,21 @@
8369
9457
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
8370
9458
 
8371
9459
 
9460
+
9461
+
8372
9462
 
8373
9463
 
8374
9464
 
8375
9465
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
8376
9466
 
8377
9467
 
9468
+
9469
+
8378
9470
  <fo:block text-align="justify">
8379
9471
  <fo:inline>
8380
- <xsl:call-template name="displayAdmonitionName"/>
8381
- <xsl:text> – </xsl:text>
9472
+ <xsl:call-template name="displayAdmonitionName">
9473
+ <xsl:with-param name="sep"> – </xsl:with-param>
9474
+ </xsl:call-template>
8382
9475
  </fo:inline>
8383
9476
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8384
9477
  </fo:block>
@@ -8388,25 +9481,32 @@
8388
9481
  </fo:block-container>
8389
9482
 
8390
9483
  </xsl:template><xsl:template name="displayAdmonitionName">
8391
-
9484
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
9485
+ <!-- <xsl:choose>
9486
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
9487
+ <xsl:choose>
9488
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
9489
+ <xsl:otherwise>
9490
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9491
+ </xsl:otherwise>
9492
+ </xsl:choose>
9493
+ </xsl:when>
9494
+ <xsl:otherwise>
8392
9495
  <xsl:apply-templates select="*[local-name() = 'name']"/>
8393
9496
  <xsl:if test="not(*[local-name() = 'name'])">
8394
9497
  <xsl:apply-templates select="@type"/>
8395
9498
  </xsl:if>
8396
-
8397
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8398
- <xsl:apply-templates/>
8399
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
8400
- <xsl:variable name="admonition_type_">
8401
- <xsl:call-template name="getLocalizedString">
8402
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
8403
- </xsl:call-template>
9499
+ </xsl:otherwise>
9500
+ </xsl:choose> -->
9501
+ <xsl:variable name="name">
9502
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8404
9503
  </xsl:variable>
8405
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
8406
- <xsl:value-of select="$admonition_type"/>
8407
- <xsl:if test="$admonition_type = ''">
8408
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
9504
+ <xsl:copy-of select="$name"/>
9505
+ <xsl:if test="normalize-space($name) != ''">
9506
+ <xsl:value-of select="$sep"/>
8409
9507
  </xsl:if>
9508
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
9509
+ <xsl:apply-templates/>
8410
9510
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
8411
9511
  <!-- processing for admonition/p found in the template for 'p' -->
8412
9512
  <xsl:call-template name="paragraph"/>
@@ -8572,6 +9672,8 @@
8572
9672
  </xsl:when>
8573
9673
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8574
9674
  </xsl:choose>
9675
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
9676
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
8575
9677
  </xsl:template><xsl:template name="printEdition">
8576
9678
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8577
9679
  <xsl:text> </xsl:text>
@@ -8678,6 +9780,27 @@
8678
9780
  </xsl:when>
8679
9781
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
8680
9782
  </xsl:choose>
9783
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
9784
+ <xsl:param name="num"/>
9785
+ <xsl:variable name="monthStr">
9786
+ <xsl:choose>
9787
+ <xsl:when test="$num = '01'">january</xsl:when>
9788
+ <xsl:when test="$num = '02'">february</xsl:when>
9789
+ <xsl:when test="$num = '03'">march</xsl:when>
9790
+ <xsl:when test="$num = '04'">april</xsl:when>
9791
+ <xsl:when test="$num = '05'">may</xsl:when>
9792
+ <xsl:when test="$num = '06'">june</xsl:when>
9793
+ <xsl:when test="$num = '07'">july</xsl:when>
9794
+ <xsl:when test="$num = '08'">august</xsl:when>
9795
+ <xsl:when test="$num = '09'">september</xsl:when>
9796
+ <xsl:when test="$num = '10'">october</xsl:when>
9797
+ <xsl:when test="$num = '11'">november</xsl:when>
9798
+ <xsl:when test="$num = '12'">december</xsl:when>
9799
+ </xsl:choose>
9800
+ </xsl:variable>
9801
+ <xsl:call-template name="getLocalizedString">
9802
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
9803
+ </xsl:call-template>
8681
9804
  </xsl:template><xsl:template name="insertKeywords">
8682
9805
  <xsl:param name="sorting" select="'true'"/>
8683
9806
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -8879,6 +10002,7 @@
8879
10002
 
8880
10003
 
8881
10004
 
10005
+
8882
10006
 
8883
10007
 
8884
10008
 
@@ -9284,4 +10408,40 @@
9284
10408
  <xsl:value-of select="$value"/>
9285
10409
  </xsl:otherwise>
9286
10410
  </xsl:choose>
10411
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
10412
+ <xsl:param name="level">0</xsl:param>
10413
+
10414
+ <fo:block margin-left="{2*$level}mm">
10415
+ <xsl:text>
10416
+ &lt;</xsl:text>
10417
+ <xsl:value-of select="local-name()"/>
10418
+ <xsl:for-each select="@*">
10419
+ <xsl:text> </xsl:text>
10420
+ <xsl:value-of select="local-name()"/>
10421
+ <xsl:text>="</xsl:text>
10422
+ <xsl:value-of select="."/>
10423
+ <xsl:text>"</xsl:text>
10424
+ </xsl:for-each>
10425
+ <xsl:text>&gt;</xsl:text>
10426
+
10427
+ <xsl:if test="not(*)">
10428
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
10429
+ <xsl:text>&lt;/</xsl:text>
10430
+ <xsl:value-of select="local-name()"/>
10431
+ <xsl:text>&gt;</xsl:text>
10432
+ </xsl:if>
10433
+ </fo:block>
10434
+
10435
+ <xsl:if test="*">
10436
+ <fo:block>
10437
+ <xsl:apply-templates mode="print_as_xml">
10438
+ <xsl:with-param name="level" select="$level + 1"/>
10439
+ </xsl:apply-templates>
10440
+ </fo:block>
10441
+ <fo:block margin-left="{2*$level}mm">
10442
+ <xsl:text>&lt;/</xsl:text>
10443
+ <xsl:value-of select="local-name()"/>
10444
+ <xsl:text>&gt;</xsl:text>
10445
+ </fo:block>
10446
+ </xsl:if>
9287
10447
  </xsl:template></xsl:stylesheet>