metanorma-itu 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1352,6 +1352,7 @@
1352
1352
  <!-- PARAGRAPHS -->
1353
1353
  <!-- ============================= -->
1354
1354
  <xsl:template match="itu:p | itu:sections/itu:p" name="paragraph">
1355
+ <xsl:param name="split_keep-within-line"/>
1355
1356
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
1356
1357
  <xsl:variable name="element-name">
1357
1358
  <xsl:choose>
@@ -1404,7 +1405,9 @@
1404
1405
  </fo:inline>
1405
1406
  </xsl:if>
1406
1407
 
1407
- <xsl:apply-templates/>
1408
+ <xsl:apply-templates>
1409
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
1410
+ </xsl:apply-templates>
1408
1411
  </xsl:element>
1409
1412
  <xsl:if test="$element-name = 'fo:inline'">
1410
1413
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
@@ -1684,7 +1687,7 @@
1684
1687
  </xsl:choose>
1685
1688
  </xsl:variable>
1686
1689
  <xsl:element name="{$element-name}">
1687
- <xsl:attribute name="font-family">Courier New</xsl:attribute>
1690
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1688
1691
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1689
1692
  <xsl:if test="local-name(..) != 'dt' and not(ancestor::itu:dd) and not(ancestor::itu:title)">
1690
1693
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1696,27 +1699,6 @@
1696
1699
  </xsl:element>
1697
1700
  </xsl:template>
1698
1701
 
1699
-
1700
-
1701
- <!-- Examples:
1702
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
1703
- [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
1704
- -->
1705
- <xsl:template match="itu:annex//itu:bibitem" priority="3">
1706
- <fo:block margin-top="6pt" margin-left="10mm" text-indent="-10mm">
1707
- <fo:inline id="{@id}" padding-right="5mm">[<xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>]</fo:inline>
1708
- <xsl:text> </xsl:text>
1709
- <xsl:apply-templates select="itu:docidentifier[not(@type = 'metanorma-ordinal')]" mode="content"/>
1710
- <xsl:if test="node()[local-name(.) != current()/itu:docidentifier]">, </xsl:if>
1711
- <xsl:apply-templates/>
1712
- </fo:block>
1713
- </xsl:template>
1714
-
1715
- <xsl:template match="itu:docidentifier" mode="content">
1716
- <xsl:apply-templates/>
1717
- </xsl:template>
1718
- <xsl:template match="itu:docidentifier"/>
1719
-
1720
1702
 
1721
1703
  <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol" mode="list" priority="2">
1722
1704
  <xsl:if test="preceding-sibling::*[1][local-name() = 'title'] and $doctype != 'service-publication'">
@@ -2068,12 +2050,41 @@
2068
2050
  </xsl:if>
2069
2051
  </xsl:template>
2070
2052
 
2071
- <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">
2053
+ <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_">
2054
+ <xsl:for-each select="$table_widths_from_if//table">
2055
+ <xsl:copy>
2056
+ <xsl:copy-of select="@*"/>
2057
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
2058
+ </xsl:copy>
2059
+ </xsl:for-each>
2060
+ </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_">
2061
+ false
2062
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
2072
2063
  <xsl:call-template name="getLang"/>
2073
- </xsl:variable><xsl:variable name="pageWidth_">
2074
- 210
2064
+ </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_">
2065
+ <xsl:choose>
2066
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
2067
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
2068
+ </xsl:choose>
2069
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
2070
+ <xsl:choose>
2071
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
2072
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
2073
+ </xsl:choose>
2074
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
2075
+ <xsl:choose>
2076
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
2077
+ <xsl:otherwise>
2078
+ 210
2079
+ </xsl:otherwise>
2080
+ </xsl:choose>
2075
2081
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
2076
- 297
2082
+ <xsl:choose>
2083
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
2084
+ <xsl:otherwise>
2085
+ 297
2086
+ </xsl:otherwise>
2087
+ </xsl:choose>
2077
2088
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
2078
2089
  20
2079
2090
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -2185,7 +2196,7 @@
2185
2196
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2186
2197
  </xsl:otherwise>
2187
2198
  </xsl:choose>
2188
- </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">
2199
+ </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">
2189
2200
 
2190
2201
 
2191
2202
 
@@ -2195,7 +2206,9 @@
2195
2206
 
2196
2207
 
2197
2208
 
2198
- <xsl:attribute name="font-family">Times New Roman, STIX Two Math</xsl:attribute>
2209
+
2210
+ <xsl:attribute name="font-family">Times New Roman, STIX Two Math, <xsl:value-of select="$font_noto_serif"/></xsl:attribute>
2211
+ <xsl:attribute name="font-family-generic">Serif</xsl:attribute>
2199
2212
  <xsl:attribute name="font-size">12pt</xsl:attribute>
2200
2213
 
2201
2214
 
@@ -2216,17 +2229,60 @@
2216
2229
  </xsl:variable>
2217
2230
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
2218
2231
 
2232
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
2233
+
2219
2234
  <xsl:for-each select="$root-style_/root-style/@*">
2235
+
2220
2236
  <xsl:choose>
2221
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
2237
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
2238
+ <xsl:when test="local-name() = 'font-family'">
2239
+
2240
+ <xsl:variable name="font_regional_prefix">
2241
+ <xsl:choose>
2242
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
2243
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
2244
+ </xsl:choose>
2245
+ </xsl:variable>
2246
+
2222
2247
  <xsl:attribute name="{local-name()}">
2223
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2248
+
2249
+ <xsl:variable name="font_extended">
2250
+ <xsl:choose>
2251
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
2252
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
2253
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
2254
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
2255
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
2256
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
2257
+ </xsl:choose>
2258
+ </xsl:variable>
2259
+ <xsl:if test="normalize-space($font_extended) != ''">
2260
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
2261
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
2262
+ </xsl:if>
2263
+
2264
+ <xsl:value-of select="."/>
2265
+
2266
+ <xsl:if test="$additional_fonts != ''">
2267
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
2268
+ </xsl:if>
2224
2269
  </xsl:attribute>
2225
2270
  </xsl:when>
2226
2271
  <xsl:otherwise>
2227
2272
  <xsl:copy-of select="."/>
2228
2273
  </xsl:otherwise>
2229
2274
  </xsl:choose>
2275
+
2276
+ <!-- <xsl:choose>
2277
+ <xsl:when test="local-name() = 'font-family'">
2278
+ <xsl:attribute name="{local-name()}">
2279
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2280
+ </xsl:attribute>
2281
+ </xsl:when>
2282
+ <xsl:otherwise>
2283
+ <xsl:copy-of select="."/>
2284
+ </xsl:otherwise>
2285
+ </xsl:choose> -->
2230
2286
  </xsl:for-each>
2231
2287
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
2232
2288
 
@@ -2302,7 +2358,8 @@
2302
2358
 
2303
2359
 
2304
2360
 
2305
- <xsl:attribute name="font-family">Courier New</xsl:attribute>
2361
+
2362
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2306
2363
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
2307
2364
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2308
2365
 
@@ -2347,6 +2404,7 @@
2347
2404
 
2348
2405
 
2349
2406
 
2407
+
2350
2408
 
2351
2409
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2352
2410
 
@@ -2355,6 +2413,7 @@
2355
2413
 
2356
2414
 
2357
2415
 
2416
+
2358
2417
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2359
2418
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2360
2419
 
@@ -2379,6 +2438,7 @@
2379
2438
 
2380
2439
 
2381
2440
 
2441
+
2382
2442
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2383
2443
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2384
2444
 
@@ -2421,6 +2481,7 @@
2421
2481
 
2422
2482
  </xsl:attribute-set><xsl:variable name="table-border_">
2423
2483
 
2484
+
2424
2485
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
2425
2486
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2426
2487
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -2434,6 +2495,7 @@
2434
2495
 
2435
2496
 
2436
2497
 
2498
+
2437
2499
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2438
2500
  <xsl:attribute name="space-after">18pt</xsl:attribute>
2439
2501
 
@@ -2472,6 +2534,7 @@
2472
2534
 
2473
2535
 
2474
2536
 
2537
+
2475
2538
 
2476
2539
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2477
2540
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -2483,6 +2546,7 @@
2483
2546
 
2484
2547
 
2485
2548
 
2549
+
2486
2550
 
2487
2551
 
2488
2552
 
@@ -2520,6 +2584,7 @@
2520
2584
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2521
2585
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2522
2586
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2587
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2523
2588
  <xsl:attribute name="display-align">center</xsl:attribute>
2524
2589
 
2525
2590
 
@@ -2538,6 +2603,8 @@
2538
2603
  <xsl:attribute name="display-align">center</xsl:attribute>
2539
2604
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2540
2605
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2606
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2607
+
2541
2608
 
2542
2609
 
2543
2610
 
@@ -2565,7 +2632,7 @@
2565
2632
 
2566
2633
 
2567
2634
 
2568
-
2635
+
2569
2636
 
2570
2637
 
2571
2638
 
@@ -2580,6 +2647,7 @@
2580
2647
 
2581
2648
 
2582
2649
 
2650
+
2583
2651
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
2584
2652
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2585
2653
 
@@ -2588,6 +2656,8 @@
2588
2656
 
2589
2657
 
2590
2658
 
2659
+
2660
+
2591
2661
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
2592
2662
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
2593
2663
  <xsl:attribute name="text-indent">-5mm</xsl:attribute>
@@ -2604,6 +2674,7 @@
2604
2674
 
2605
2675
 
2606
2676
 
2677
+
2607
2678
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2608
2679
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
2609
2680
  <xsl:attribute name="font-size">70%</xsl:attribute>
@@ -2631,7 +2702,8 @@
2631
2702
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
2632
2703
 
2633
2704
 
2634
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
2705
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
2706
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
2635
2707
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
2636
2708
 
2637
2709
 
@@ -2643,6 +2715,29 @@
2643
2715
 
2644
2716
 
2645
2717
 
2718
+
2719
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
2720
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2721
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2722
+
2723
+
2724
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2725
+
2726
+
2727
+
2728
+
2729
+
2730
+
2731
+
2732
+
2733
+
2734
+
2735
+
2736
+
2737
+
2738
+
2739
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
2740
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
2646
2741
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2647
2742
 
2648
2743
 
@@ -2676,6 +2771,7 @@
2676
2771
 
2677
2772
 
2678
2773
 
2774
+
2679
2775
 
2680
2776
 
2681
2777
 
@@ -2743,6 +2839,8 @@
2743
2839
 
2744
2840
 
2745
2841
 
2842
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
2843
+
2746
2844
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2747
2845
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
2748
2846
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -2785,6 +2883,7 @@
2785
2883
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2786
2884
 
2787
2885
 
2886
+
2788
2887
 
2789
2888
 
2790
2889
 
@@ -2828,6 +2927,7 @@
2828
2927
 
2829
2928
 
2830
2929
 
2930
+
2831
2931
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2832
2932
 
2833
2933
 
@@ -2859,17 +2959,17 @@
2859
2959
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2860
2960
 
2861
2961
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2962
+ <xsl:attribute name="width">100%</xsl:attribute>
2963
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2964
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2862
2965
 
2863
2966
 
2864
2967
 
2865
2968
 
2866
2969
 
2867
2970
  <xsl:attribute name="width">75%</xsl:attribute>
2868
- <xsl:attribute name="content-height">100%</xsl:attribute>
2869
2971
  <xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
2870
- <xsl:attribute name="scaling">uniform</xsl:attribute>
2871
-
2872
-
2972
+
2873
2973
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
2874
2974
 
2875
2975
 
@@ -2950,6 +3050,25 @@
2950
3050
 
2951
3051
 
2952
3052
 
3053
+
3054
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
3055
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3056
+
3057
+
3058
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3059
+
3060
+
3061
+
3062
+
3063
+
3064
+
3065
+
3066
+
3067
+
3068
+
3069
+
3070
+
3071
+
2953
3072
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2954
3073
 
2955
3074
 
@@ -2990,6 +3109,7 @@
2990
3109
 
2991
3110
 
2992
3111
 
3112
+
2993
3113
  <xsl:attribute name="font-size">60%</xsl:attribute>
2994
3114
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2995
3115
 
@@ -3014,6 +3134,7 @@
3014
3134
 
3015
3135
 
3016
3136
 
3137
+
3017
3138
  <xsl:attribute name="font-size">11pt</xsl:attribute>
3018
3139
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3019
3140
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -3038,6 +3159,7 @@
3038
3159
 
3039
3160
 
3040
3161
 
3162
+
3041
3163
  <xsl:attribute name="font-size">85%</xsl:attribute>
3042
3164
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
3043
3165
  <xsl:attribute name="baseline-shift">30%</xsl:attribute>
@@ -3065,7 +3187,11 @@
3065
3187
 
3066
3188
 
3067
3189
 
3190
+
3068
3191
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
3192
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3193
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3194
+
3069
3195
 
3070
3196
 
3071
3197
 
@@ -3103,6 +3229,7 @@
3103
3229
 
3104
3230
 
3105
3231
 
3232
+
3106
3233
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-style">
3107
3234
 
3108
3235
 
@@ -3140,6 +3267,7 @@
3140
3267
 
3141
3268
 
3142
3269
 
3270
+
3143
3271
  </xsl:attribute-set><xsl:attribute-set name="bibitem-non-normative-style">
3144
3272
 
3145
3273
 
@@ -3163,6 +3291,7 @@
3163
3291
 
3164
3292
 
3165
3293
 
3294
+
3166
3295
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-list-body-style">
3167
3296
 
3168
3297
 
@@ -3190,6 +3319,7 @@
3190
3319
 
3191
3320
 
3192
3321
 
3322
+
3193
3323
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3194
3324
  <xsl:attribute name="baseline-shift">30%</xsl:attribute>
3195
3325
 
@@ -3211,6 +3341,7 @@
3211
3341
 
3212
3342
 
3213
3343
 
3344
+
3214
3345
  <xsl:attribute name="alignment-baseline">hanging</xsl:attribute>
3215
3346
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
3216
3347
 
@@ -3232,6 +3363,7 @@
3232
3363
 
3233
3364
 
3234
3365
 
3366
+
3235
3367
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
3236
3368
 
3237
3369
 
@@ -3349,13 +3481,13 @@
3349
3481
 
3350
3482
  </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">
3351
3483
  <xsl:variable name="nodes_preface_">
3352
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3484
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3353
3485
  <node id="{@id}"/>
3354
3486
  </xsl:for-each>
3355
3487
  </xsl:variable>
3356
3488
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3357
3489
 
3358
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3490
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3359
3491
  <xsl:sort select="@displayorder" data-type="number"/>
3360
3492
 
3361
3493
  <!-- process Section's title -->
@@ -3421,7 +3553,7 @@
3421
3553
  </xsl:for-each>
3422
3554
  </figures>
3423
3555
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3424
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3556
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3425
3557
  <xsl:sort select="@displayorder" data-type="number"/>
3426
3558
  <xsl:apply-templates select="."/>
3427
3559
  </xsl:for-each>
@@ -3475,7 +3607,38 @@
3475
3607
  </xsl:template><xsl:template match="*[local-name()='br']">
3476
3608
  <xsl:value-of select="$linebreak"/>
3477
3609
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
3478
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3610
+ <xsl:param name="split_keep-within-line"/>
3611
+
3612
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
3613
+ <xsl:choose>
3614
+
3615
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
3616
+ <xsl:variable name="sep">_</xsl:variable>
3617
+ <xsl:variable name="items">
3618
+ <xsl:call-template name="split">
3619
+ <xsl:with-param name="pText" select="."/>
3620
+ <xsl:with-param name="sep" select="$sep"/>
3621
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
3622
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
3623
+ </xsl:call-template>
3624
+ </xsl:variable>
3625
+ <xsl:for-each select="xalan:nodeset($items)/item">
3626
+ <xsl:choose>
3627
+ <xsl:when test=". = $sep">
3628
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
3629
+ </xsl:when>
3630
+ <xsl:otherwise>
3631
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3632
+ </xsl:otherwise>
3633
+ </xsl:choose>
3634
+ </xsl:for-each>
3635
+ </xsl:when>
3636
+
3637
+ <xsl:otherwise>
3638
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
3639
+ </xsl:otherwise>
3640
+
3641
+ </xsl:choose>
3479
3642
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
3480
3643
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
3481
3644
  <xsl:apply-templates/>
@@ -3580,9 +3743,14 @@
3580
3743
 
3581
3744
  <xsl:variable name="table">
3582
3745
 
3583
- <xsl:variable name="simple-table">
3584
- <xsl:call-template name="getSimpleTable"/>
3746
+ <xsl:variable name="simple-table">
3747
+ <xsl:call-template name="getSimpleTable">
3748
+ <xsl:with-param name="id" select="@id"/>
3749
+ </xsl:call-template>
3585
3750
  </xsl:variable>
3751
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
3752
+
3753
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
3586
3754
 
3587
3755
 
3588
3756
  <!-- Display table's name before table as standalone block -->
@@ -3605,7 +3773,23 @@
3605
3773
  </xsl:call-template>
3606
3774
  </xsl:if>
3607
3775
  </xsl:variable>
3608
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3776
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
3777
+
3778
+ <!-- DEBUG -->
3779
+ <xsl:if test="$table_if_debug = 'true'">
3780
+ <fo:block font-size="60%">
3781
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3782
+ </fo:block>
3783
+ </xsl:if>
3784
+
3785
+
3786
+ <!-- <xsl:copy-of select="$colwidths"/> -->
3787
+
3788
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3789
+ DEBUG
3790
+ colwidths=<xsl:copy-of select="$colwidths"/>
3791
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3792
+
3609
3793
 
3610
3794
 
3611
3795
  <xsl:variable name="margin-side">
@@ -3627,6 +3811,8 @@
3627
3811
 
3628
3812
 
3629
3813
 
3814
+
3815
+
3630
3816
  <xsl:if test="$doctype = 'service-publication' and $lang != 'ar'">
3631
3817
  <xsl:attribute name="font-family">Calibri</xsl:attribute>
3632
3818
  </xsl:if>
@@ -3663,6 +3849,8 @@
3663
3849
 
3664
3850
 
3665
3851
 
3852
+
3853
+
3666
3854
  <xsl:if test="$doctype = 'service-publication'">
3667
3855
  <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute>
3668
3856
  </xsl:if>
@@ -3674,9 +3862,17 @@
3674
3862
  </xsl:element>
3675
3863
  </xsl:variable>
3676
3864
 
3865
+ <xsl:if test="$isGenerateTableIF = 'true'">
3866
+ <!-- to determine start of table -->
3867
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3868
+ </xsl:if>
3677
3869
 
3678
3870
  <fo:table id="{@id}">
3679
3871
 
3872
+ <xsl:if test="$isGenerateTableIF = 'true'">
3873
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3874
+ </xsl:if>
3875
+
3680
3876
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
3681
3877
  <xsl:attribute name="{local-name()}">
3682
3878
  <xsl:value-of select="."/>
@@ -3690,24 +3886,47 @@
3690
3886
 
3691
3887
 
3692
3888
  <xsl:choose>
3693
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3694
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3695
- <fo:table-column column-width="{@width}"/>
3696
- </xsl:for-each>
3889
+ <xsl:when test="$isGenerateTableIF = 'true'">
3890
+ <!-- generate IF for table widths -->
3891
+ <!-- example:
3892
+ <tr>
3893
+ <td valign="top" align="left" id="tab-symdu_1_1">
3894
+ <p>Symbol</p>
3895
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3896
+ </td>
3897
+ <td valign="top" align="left" id="tab-symdu_1_2">
3898
+ <p>Description</p>
3899
+ <word id="tab-symdu_1_2_word_1">Description</word>
3900
+ </td>
3901
+ </tr>
3902
+ -->
3903
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
3904
+
3697
3905
  </xsl:when>
3698
3906
  <xsl:otherwise>
3699
- <xsl:call-template name="insertTableColumnWidth">
3700
- <xsl:with-param name="colwidths" select="$colwidths"/>
3701
- </xsl:call-template>
3702
- </xsl:otherwise>
3703
- </xsl:choose>
3704
3907
 
3705
- <xsl:choose>
3706
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3707
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3708
- </xsl:when>
3709
- <xsl:otherwise>
3710
- <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 -->
3908
+ <xsl:choose>
3909
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3910
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3911
+ <fo:table-column column-width="{@width}"/>
3912
+ </xsl:for-each>
3913
+ </xsl:when>
3914
+ <xsl:otherwise>
3915
+ <xsl:call-template name="insertTableColumnWidth">
3916
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3917
+ </xsl:call-template>
3918
+ </xsl:otherwise>
3919
+ </xsl:choose>
3920
+
3921
+ <xsl:choose>
3922
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3923
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3924
+ </xsl:when>
3925
+ <xsl:otherwise>
3926
+ <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 -->
3927
+ </xsl:otherwise>
3928
+ </xsl:choose>
3929
+
3711
3930
  </xsl:otherwise>
3712
3931
  </xsl:choose>
3713
3932
 
@@ -3785,23 +4004,29 @@
3785
4004
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3786
4005
  <xsl:param name="continued"/>
3787
4006
  <xsl:if test="normalize-space() != ''">
3788
- <fo:block xsl:use-attribute-sets="table-name-style">
3789
-
3790
-
3791
-
3792
-
4007
+
4008
+
3793
4009
 
3794
- <xsl:choose>
3795
- <xsl:when test="$continued = 'true'">
4010
+ <fo:block xsl:use-attribute-sets="table-name-style">
4011
+
3796
4012
 
3797
- </xsl:when>
3798
- <xsl:otherwise>
3799
- <xsl:apply-templates/>
3800
- </xsl:otherwise>
3801
- </xsl:choose>
3802
-
4013
+
4014
+
4015
+
4016
+ <xsl:choose>
4017
+ <xsl:when test="$continued = 'true'">
4018
+
4019
+ </xsl:when>
4020
+ <xsl:otherwise>
4021
+ <xsl:apply-templates/>
4022
+ </xsl:otherwise>
4023
+ </xsl:choose>
4024
+
4025
+
4026
+ </fo:block>
4027
+
3803
4028
 
3804
- </fo:block>
4029
+
3805
4030
  </xsl:if>
3806
4031
  </xsl:template><xsl:template name="calculate-columns-numbers">
3807
4032
  <xsl:param name="table-row"/>
@@ -3810,11 +4035,22 @@
3810
4035
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3811
4036
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3812
4037
  </xsl:template><xsl:template name="calculate-column-widths">
4038
+ <xsl:param name="table"/>
4039
+ <xsl:param name="cols-count"/>
4040
+
4041
+ <xsl:call-template name="calculate-column-widths-proportional">
4042
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4043
+ <xsl:with-param name="table" select="$table"/>
4044
+ </xsl:call-template>
4045
+
4046
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
3813
4047
  <xsl:param name="table"/>
3814
4048
  <xsl:param name="cols-count"/>
3815
4049
  <xsl:param name="curr-col" select="1"/>
3816
4050
  <xsl:param name="width" select="0"/>
3817
4051
 
4052
+ <!-- table=<xsl:copy-of select="$table"/> -->
4053
+
3818
4054
  <xsl:if test="$curr-col &lt;= $cols-count">
3819
4055
  <xsl:variable name="widths">
3820
4056
  <xsl:choose>
@@ -3852,10 +4088,15 @@
3852
4088
  </xsl:for-each>
3853
4089
  </xsl:when>
3854
4090
  <xsl:otherwise>
3855
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
4091
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
4092
+
4093
+ <!-- <table><xsl:copy-of select="$table"/></table>
4094
+ -->
4095
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
3856
4096
  <xsl:variable name="td_text">
3857
4097
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3858
4098
  </xsl:variable>
4099
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
3859
4100
  <xsl:variable name="words">
3860
4101
  <xsl:variable name="string_with_added_zerospaces">
3861
4102
  <xsl:call-template name="add-zero-spaces-java">
@@ -3870,6 +4111,7 @@
3870
4111
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3871
4112
  </xsl:call-template>
3872
4113
  </xsl:variable>
4114
+ <!-- words=<xsl:copy-of select="$words"/> -->
3873
4115
  <xsl:variable name="max_length">
3874
4116
  <xsl:call-template name="max_length">
3875
4117
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -3894,6 +4136,8 @@
3894
4136
  </xsl:choose>
3895
4137
  </xsl:variable>
3896
4138
 
4139
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
4140
+
3897
4141
  <column>
3898
4142
  <xsl:for-each select="xalan:nodeset($widths)//width">
3899
4143
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3902,33 +4146,271 @@
3902
4146
  </xsl:if>
3903
4147
  </xsl:for-each>
3904
4148
  </column>
3905
- <xsl:call-template name="calculate-column-widths">
4149
+ <xsl:call-template name="calculate-column-widths-proportional">
3906
4150
  <xsl:with-param name="cols-count" select="$cols-count"/>
3907
4151
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
3908
4152
  <xsl:with-param name="table" select="$table"/>
3909
4153
  </xsl:call-template>
3910
4154
  </xsl:if>
3911
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
4155
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
3912
4156
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
3913
4157
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
3914
4158
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
4159
+
4160
+ <!-- if all capitals english letters or digits -->
4161
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
4162
+ <xsl:call-template name="repeat">
4163
+ <xsl:with-param name="char" select="'X'"/>
4164
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
4165
+ </xsl:call-template>
4166
+ </xsl:if>
3915
4167
  </xsl:template><xsl:template match="text()" mode="td_text">
3916
4168
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3917
4169
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3918
4170
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3919
4171
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3920
4172
  <xsl:value-of select="@target"/>
3921
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3922
- <xsl:variable name="mathml">
3923
- <xsl:for-each select="*">
3924
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3925
- <xsl:copy-of select="."/>
3926
- </xsl:if>
4173
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
4174
+ <xsl:if test="$isGenerateTableIF = 'false'">
4175
+ <xsl:variable name="mathml_">
4176
+ <xsl:for-each select="*">
4177
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
4178
+ <xsl:copy-of select="."/>
4179
+ </xsl:if>
4180
+ </xsl:for-each>
4181
+ </xsl:variable>
4182
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
4183
+
4184
+ <xsl:variable name="math_text">
4185
+ <xsl:value-of select="normalize-space($mathml)"/>
4186
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
4187
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
4188
+ </xsl:variable>
4189
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
4190
+ </xsl:if>
4191
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
4192
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
4193
+
4194
+ <!-- via intermediate format -->
4195
+
4196
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
4197
+
4198
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
4199
+
4200
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
4201
+
4202
+ <!-- get current table id -->
4203
+ <xsl:variable name="table_id" select="@id"/>
4204
+ <!-- find table by id in the file 'table_widths' -->
4205
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
4206
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
4207
+
4208
+ <!-- table='<xsl:copy-of select="$table"/>' -->
4209
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
4210
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
4211
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
4212
+
4213
+ <xsl:variable name="table_with_cell_widths_">
4214
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
4215
+ </xsl:variable>
4216
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
4217
+
4218
+ <!-- <xsl:if test="$table_if_debug = 'true'">
4219
+ <xsl:copy-of select="$table_with_cell_widths"/>
4220
+ </xsl:if> -->
4221
+
4222
+
4223
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
4224
+
4225
+ <xsl:variable name="column_widths_">
4226
+ <!-- iteration of columns -->
4227
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
4228
+ <xsl:variable name="pos" select="position()"/>
4229
+ <column>
4230
+ <xsl:attribute name="width_max">
4231
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
4232
+ <xsl:sort select="." data-type="number" order="descending"/>
4233
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4234
+ </xsl:for-each>
4235
+ </xsl:attribute>
4236
+ <xsl:attribute name="width_min">
4237
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
4238
+ <xsl:sort select="." data-type="number" order="descending"/>
4239
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4240
+ </xsl:for-each>
4241
+ </xsl:attribute>
4242
+ </column>
3927
4243
  </xsl:for-each>
3928
4244
  </xsl:variable>
4245
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
4246
+
4247
+ <!-- <column_widths>
4248
+ <xsl:copy-of select="$column_widths"/>
4249
+ </column_widths> -->
3929
4250
 
3930
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3931
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
4251
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
4252
+ <xsl:variable name="table_widths_">
4253
+ <table>
4254
+ <xsl:attribute name="width_max">
4255
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
4256
+ </xsl:attribute>
4257
+ <xsl:attribute name="width_min">
4258
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
4259
+ </xsl:attribute>
4260
+ </table>
4261
+ </xsl:variable>
4262
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
4263
+
4264
+ <xsl:variable name="page_width">
4265
+ <xsl:choose>
4266
+ <xsl:when test="$parent_table_page-width != ''">
4267
+ <xsl:value-of select="$parent_table_page-width"/>
4268
+ </xsl:when>
4269
+ <xsl:otherwise>
4270
+ <xsl:value-of select="@page-width"/>
4271
+ </xsl:otherwise>
4272
+ </xsl:choose>
4273
+ </xsl:variable>
4274
+
4275
+ <xsl:if test="$table_if_debug = 'true'">
4276
+ <table_width>
4277
+ <xsl:copy-of select="$table_widths"/>
4278
+ </table_width>
4279
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
4280
+ </xsl:if>
4281
+
4282
+
4283
+ <!-- There are three cases: -->
4284
+ <xsl:choose>
4285
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
4286
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
4287
+ <!-- call old algorithm -->
4288
+ <case1/>
4289
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
4290
+ <xsl:call-template name="calculate-column-widths-proportional">
4291
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4292
+ <xsl:with-param name="table" select="$table"/>
4293
+ </xsl:call-template> -->
4294
+ </xsl:when>
4295
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
4296
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
4297
+ <case2/>
4298
+ <autolayout/>
4299
+ <xsl:for-each select="$column_widths/column/@width_max">
4300
+ <column divider="100"><xsl:value-of select="."/></column>
4301
+ </xsl:for-each>
4302
+ </xsl:when>
4303
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
4304
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
4305
+ Lets also call D the difference between maximum and minimum width of the table.
4306
+ For each column, let d be the difference between maximum and minimum width of that column.
4307
+ Now set the column's width to the minimum width plus d times W over D.
4308
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
4309
+ <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)">
4310
+ <!-- difference between the available space and the minimum table width -->
4311
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
4312
+ <W><xsl:value-of select="$W"/></W>
4313
+ <!-- difference between maximum and minimum width of the table -->
4314
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
4315
+ <D><xsl:value-of select="$D"/></D>
4316
+ <case3/>
4317
+ <autolayout/>
4318
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
4319
+ <split_keep-within-line>true</split_keep-within-line>
4320
+ </xsl:if>
4321
+ <xsl:for-each select="$column_widths/column">
4322
+ <!-- difference between maximum and minimum width of that column. -->
4323
+ <xsl:variable name="d" select="@width_max - @width_min"/>
4324
+ <d><xsl:value-of select="$d"/></d>
4325
+ <width_min><xsl:value-of select="@width_min"/></width_min>
4326
+ <e><xsl:value-of select="$d * $W div $D"/></e>
4327
+ <!-- set the column's width to the minimum width plus d times W over D. -->
4328
+ <column divider="100">
4329
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
4330
+ </column>
4331
+ </xsl:for-each>
4332
+
4333
+ </xsl:when>
4334
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
4335
+ </xsl:choose>
4336
+
4337
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
4338
+
4339
+ <!-- if nested 'dl' or 'table' -->
4340
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
4341
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
4342
+
4343
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
4344
+
4345
+ <xsl:variable name="parent_table_page-width_">
4346
+ <xsl:if test="$parent_table_id != ''">
4347
+ <!-- determine column number in the parent table -->
4348
+ <xsl:variable name="parent_table_column_number">
4349
+ <xsl:choose>
4350
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
4351
+ <xsl:otherwise> <!-- parent is table -->
4352
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
4353
+ </xsl:otherwise>
4354
+ </xsl:choose>
4355
+ </xsl:variable>
4356
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
4357
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
4358
+ </xsl:if>
4359
+ </xsl:variable>
4360
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
4361
+
4362
+ <!-- get current table id -->
4363
+ <xsl:variable name="table_id" select="@id"/>
4364
+
4365
+ <xsl:choose>
4366
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
4367
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
4368
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
4369
+ </xsl:when>
4370
+ <xsl:otherwise>
4371
+ <!-- recalculate columns width based on parent table width -->
4372
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
4373
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
4374
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
4375
+ </xsl:call-template>
4376
+ </xsl:for-each>
4377
+ </xsl:otherwise>
4378
+ </xsl:choose>
4379
+
4380
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
4381
+ <xsl:copy>
4382
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
4383
+ </xsl:copy>
4384
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
4385
+ <xsl:copy>
4386
+ <xsl:copy-of select="@*"/>
4387
+
4388
+ <!-- The maximum width is given by the widest line. -->
4389
+ <xsl:attribute name="width_max">
4390
+ <xsl:for-each select="p_len">
4391
+ <xsl:sort select="." data-type="number" order="descending"/>
4392
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4393
+ </xsl:for-each>
4394
+ </xsl:attribute>
4395
+
4396
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
4397
+ <xsl:variable name="width_min">
4398
+ <xsl:for-each select="word_len">
4399
+ <xsl:sort select="." data-type="number" order="descending"/>
4400
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4401
+ </xsl:for-each>
4402
+ </xsl:variable>
4403
+ <xsl:attribute name="width_min">
4404
+ <xsl:value-of select="$width_min"/>
4405
+ </xsl:attribute>
4406
+
4407
+ <xsl:if test="$width_min = 0">
4408
+ <xsl:attribute name="width_min">1</xsl:attribute>
4409
+ </xsl:if>
4410
+
4411
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
4412
+
4413
+ </xsl:copy>
3932
4414
  </xsl:template><xsl:template match="*[local-name()='thead']">
3933
4415
  <xsl:param name="cols-count"/>
3934
4416
  <fo:table-header>
@@ -3942,12 +4424,18 @@
3942
4424
  <fo:table-row>
3943
4425
  <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">
3944
4426
 
3945
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3946
- <xsl:with-param name="continued">true</xsl:with-param>
3947
- </xsl:apply-templates>
3948
4427
 
3949
4428
 
3950
4429
 
4430
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
4431
+ <xsl:with-param name="continued">true</xsl:with-param>
4432
+ </xsl:apply-templates>
4433
+
4434
+
4435
+
4436
+
4437
+
4438
+
3951
4439
  </fo:table-cell>
3952
4440
  </fo:table-row>
3953
4441
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -4019,6 +4507,7 @@
4019
4507
  </xsl:for-each>
4020
4508
  </xsl:when>
4021
4509
  <xsl:otherwise>
4510
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
4022
4511
  <xsl:call-template name="insertTableColumnWidth">
4023
4512
  <xsl:with-param name="colwidths" select="$colwidths"/>
4024
4513
  </xsl:call-template>
@@ -4066,7 +4555,10 @@
4066
4555
 
4067
4556
 
4068
4557
  <!-- fn processing -->
4069
- <xsl:call-template name="table_fn_display"/>
4558
+
4559
+ <xsl:call-template name="table_fn_display"/>
4560
+
4561
+
4070
4562
 
4071
4563
  <!-- for PAS display Notes after footnotes -->
4072
4564
 
@@ -4076,6 +4568,9 @@
4076
4568
  </fo:table-body>
4077
4569
 
4078
4570
  </fo:table>
4571
+
4572
+
4573
+
4079
4574
  </xsl:if>
4080
4575
  </xsl:template><xsl:template match="*[local-name()='tbody']">
4081
4576
 
@@ -4111,6 +4606,52 @@
4111
4606
 
4112
4607
  </fo:table-body>
4113
4608
 
4609
+ </xsl:template><xsl:template match="/" mode="process_table-if">
4610
+ <xsl:param name="table_or_dl">table</xsl:param>
4611
+ <xsl:apply-templates mode="process_table-if">
4612
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
4613
+ </xsl:apply-templates>
4614
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
4615
+ <xsl:param name="table_or_dl">table</xsl:param>
4616
+
4617
+ <fo:table-body>
4618
+ <xsl:for-each select="*[local-name() = 'tr']">
4619
+ <xsl:variable name="col_count" select="count(*)"/>
4620
+
4621
+ <!-- iteration for each tr/td -->
4622
+
4623
+ <xsl:choose>
4624
+ <xsl:when test="$table_or_dl = 'table'">
4625
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
4626
+ <fo:table-row number-columns-spanned="{$col_count}">
4627
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
4628
+ <xsl:call-template name="td"/>
4629
+ </fo:table-row>
4630
+ </xsl:for-each>
4631
+ </xsl:when>
4632
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
4633
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
4634
+ <xsl:variable name="is_dt" select="position() = 1"/>
4635
+
4636
+ <xsl:for-each select="*">
4637
+ <!-- <test><xsl:copy-of select="."/></test> -->
4638
+ <fo:table-row number-columns-spanned="{$col_count}">
4639
+ <xsl:choose>
4640
+ <xsl:when test="$is_dt">
4641
+ <xsl:call-template name="insert_dt_cell"/>
4642
+ </xsl:when>
4643
+ <xsl:otherwise>
4644
+ <xsl:call-template name="insert_dd_cell"/>
4645
+ </xsl:otherwise>
4646
+ </xsl:choose>
4647
+ </fo:table-row>
4648
+ </xsl:for-each>
4649
+ </xsl:for-each>
4650
+ </xsl:otherwise>
4651
+ </xsl:choose>
4652
+
4653
+ </xsl:for-each>
4654
+ </fo:table-body>
4114
4655
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4115
4656
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4116
4657
 
@@ -4118,6 +4659,9 @@
4118
4659
 
4119
4660
 
4120
4661
 
4662
+
4663
+
4664
+
4121
4665
 
4122
4666
  <xsl:if test="$doctype = 'service-publication'">
4123
4667
  <xsl:attribute name="border-bottom">1.1pt solid black</xsl:attribute>
@@ -4141,6 +4685,8 @@
4141
4685
 
4142
4686
 
4143
4687
 
4688
+
4689
+
4144
4690
  <xsl:call-template name="setTableRowAttributes"/>
4145
4691
  <xsl:apply-templates/>
4146
4692
  </fo:table-row>
@@ -4216,7 +4762,7 @@
4216
4762
  </xsl:choose>
4217
4763
  </xsl:attribute>
4218
4764
  </xsl:if>
4219
- </xsl:template><xsl:template match="*[local-name()='td']">
4765
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
4220
4766
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
4221
4767
  <xsl:call-template name="setTextAlignment">
4222
4768
  <xsl:with-param name="default">left</xsl:with-param>
@@ -4237,6 +4783,8 @@
4237
4783
 
4238
4784
 
4239
4785
 
4786
+
4787
+
4240
4788
  <xsl:if test="ancestor::*[local-name()='preface']">
4241
4789
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
4242
4790
  </xsl:if>
@@ -4258,11 +4806,24 @@
4258
4806
 
4259
4807
  <xsl:call-template name="setTableCellAttributes"/>
4260
4808
 
4809
+ <xsl:if test="$isGenerateTableIF = 'true'">
4810
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4811
+ <xsl:attribute name="text-align">left</xsl:attribute>
4812
+ </xsl:if>
4813
+
4261
4814
  <fo:block>
4262
4815
 
4816
+ <xsl:if test="$isGenerateTableIF = 'true'">
4817
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4818
+ </xsl:if>
4819
+
4820
+
4263
4821
 
4264
4822
 
4265
4823
  <xsl:apply-templates/>
4824
+
4825
+ <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"/> -->
4826
+
4266
4827
  </fo:block>
4267
4828
  </fo:table-cell>
4268
4829
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -4303,7 +4864,11 @@
4303
4864
 
4304
4865
  <xsl:variable name="gen_id" select="generate-id(.)"/>
4305
4866
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4306
- <xsl:variable name="reference" select="@reference"/>
4867
+ <xsl:variable name="reference_">
4868
+ <xsl:value-of select="@reference"/>
4869
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4870
+ </xsl:variable>
4871
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
4307
4872
  <!-- fn sequence number in document -->
4308
4873
  <xsl:variable name="current_fn_number">
4309
4874
  <xsl:choose>
@@ -4382,7 +4947,7 @@
4382
4947
  <xsl:copy-of select="node()"/>
4383
4948
  </fn>
4384
4949
  </xsl:for-each>
4385
- <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']/*">
4950
+ <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']/*">
4386
4951
  <xsl:sort select="@displayorder" data-type="number"/>
4387
4952
  <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])]">
4388
4953
  <!-- copy unique fn -->
@@ -4469,9 +5034,9 @@
4469
5034
  <!-- current hierarchy is 'figure' element -->
4470
5035
  <xsl:variable name="following_dl_colwidths">
4471
5036
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4472
- <xsl:variable name="html-table">
4473
- <xsl:variable name="doc_ns">
4474
-
5037
+ <xsl:variable name="simple-table">
5038
+ <!-- <xsl:variable name="doc_ns">
5039
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4475
5040
  </xsl:variable>
4476
5041
  <xsl:variable name="ns">
4477
5042
  <xsl:choose>
@@ -4482,7 +5047,7 @@
4482
5047
  <xsl:value-of select="substring-before(name(/*), '-')"/>
4483
5048
  </xsl:otherwise>
4484
5049
  </xsl:choose>
4485
- </xsl:variable>
5050
+ </xsl:variable> -->
4486
5051
 
4487
5052
  <xsl:for-each select="*[local-name() = 'dl'][1]">
4488
5053
  <tbody>
@@ -4493,7 +5058,7 @@
4493
5058
 
4494
5059
  <xsl:call-template name="calculate-column-widths">
4495
5060
  <xsl:with-param name="cols-count" select="2"/>
4496
- <xsl:with-param name="table" select="$html-table"/>
5061
+ <xsl:with-param name="table" select="$simple-table"/>
4497
5062
  </xsl:call-template>
4498
5063
 
4499
5064
  </xsl:if>
@@ -4674,12 +5239,31 @@
4674
5239
 
4675
5240
 
4676
5241
 
5242
+
5243
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
5244
+ <xsl:attribute name="margin-top">0</xsl:attribute>
5245
+ </xsl:if>
5246
+
4677
5247
  <fo:block>
4678
5248
 
4679
5249
 
4680
5250
 
4681
5251
 
5252
+ <xsl:apply-templates select="*[local-name() = 'name']">
5253
+ <xsl:with-param name="process">true</xsl:with-param>
5254
+ </xsl:apply-templates>
5255
+
5256
+ <xsl:if test="$isGenerateTableIF = 'true'">
5257
+ <!-- to determine start of table -->
5258
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
5259
+ </xsl:if>
5260
+
4682
5261
  <fo:table width="95%" table-layout="fixed">
5262
+
5263
+ <xsl:if test="$isGenerateTableIF = 'true'">
5264
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
5265
+ </xsl:if>
5266
+
4683
5267
 
4684
5268
  <xsl:choose>
4685
5269
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -4688,69 +5272,173 @@
4688
5272
 
4689
5273
  </xsl:when>
4690
5274
  </xsl:choose>
4691
- <!-- create virtual html table for dl/[dt and dd] -->
4692
- <xsl:variable name="html-table">
4693
- <xsl:variable name="doc_ns">
5275
+
5276
+
5277
+
5278
+ <xsl:choose>
5279
+ <xsl:when test="$isGenerateTableIF = 'true'">
5280
+ <!-- generate IF for table widths -->
5281
+ <!-- example:
5282
+ <tr>
5283
+ <td valign="top" align="left" id="tab-symdu_1_1">
5284
+ <p>Symbol</p>
5285
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
5286
+ </td>
5287
+ <td valign="top" align="left" id="tab-symdu_1_2">
5288
+ <p>Description</p>
5289
+ <word id="tab-symdu_1_2_word_1">Description</word>
5290
+ </td>
5291
+ </tr>
5292
+ -->
4694
5293
 
4695
- </xsl:variable>
4696
- <xsl:variable name="ns">
4697
- <xsl:choose>
4698
- <xsl:when test="normalize-space($doc_ns) != ''">
4699
- <xsl:value-of select="normalize-space($doc_ns)"/>
4700
- </xsl:when>
4701
- <xsl:otherwise>
4702
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4703
- </xsl:otherwise>
4704
- </xsl:choose>
4705
- </xsl:variable>
4706
- <tbody>
4707
- <xsl:apply-templates mode="dl"/>
4708
- </tbody>
4709
- </xsl:variable>
4710
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
4711
- <xsl:variable name="colwidths">
4712
- <xsl:call-template name="calculate-column-widths">
4713
- <xsl:with-param name="cols-count" select="2"/>
4714
- <xsl:with-param name="table" select="$html-table"/>
4715
- </xsl:call-template>
4716
- </xsl:variable>
4717
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
4718
- <xsl:variable name="maxlength_dt">
4719
- <xsl:call-template name="getMaxLength_dt"/>
4720
- </xsl:variable>
4721
- <xsl:variable name="isContainsKeepTogetherTag_">
4722
- false
4723
- </xsl:variable>
4724
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4725
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4726
- <xsl:call-template name="setColumnWidth_dl">
4727
- <xsl:with-param name="colwidths" select="$colwidths"/>
4728
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4729
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4730
- </xsl:call-template>
5294
+ <!-- create virtual html table for dl/[dt and dd] -->
5295
+ <xsl:variable name="simple-table">
5296
+
5297
+ <xsl:variable name="dl_table">
5298
+ <tbody>
5299
+ <xsl:apply-templates mode="dl_if">
5300
+ <xsl:with-param name="id" select="@id"/>
5301
+ </xsl:apply-templates>
5302
+ </tbody>
5303
+ </xsl:variable>
5304
+
5305
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
5306
+
5307
+ <!-- Step: replace <br/> to <p>...</p> -->
5308
+ <xsl:variable name="table_without_br">
5309
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
5310
+ </xsl:variable>
5311
+
5312
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
5313
+
5314
+ <!-- Step: add id to each cell -->
5315
+ <!-- add <word>...</word> for each word, image, math -->
5316
+ <xsl:variable name="simple-table-id">
5317
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
5318
+ <xsl:with-param name="id" select="@id"/>
5319
+ </xsl:apply-templates>
5320
+ </xsl:variable>
5321
+
5322
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
5323
+
5324
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
5325
+
5326
+ </xsl:variable>
5327
+
5328
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
5329
+
5330
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
5331
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
5332
+ </xsl:apply-templates>
5333
+
5334
+ </xsl:when>
5335
+ <xsl:otherwise>
4731
5336
 
4732
- <fo:table-body>
4733
- <xsl:apply-templates>
4734
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
4735
- </xsl:apply-templates>
4736
- </fo:table-body>
5337
+ <xsl:variable name="simple-table">
5338
+
5339
+ <xsl:variable name="dl_table">
5340
+ <tbody>
5341
+ <xsl:apply-templates mode="dl">
5342
+ <xsl:with-param name="id" select="@id"/>
5343
+ </xsl:apply-templates>
5344
+ </tbody>
5345
+ </xsl:variable>
5346
+
5347
+ <xsl:copy-of select="$dl_table"/>
5348
+ </xsl:variable>
5349
+
5350
+ <xsl:variable name="colwidths">
5351
+ <xsl:call-template name="calculate-column-widths">
5352
+ <xsl:with-param name="cols-count" select="2"/>
5353
+ <xsl:with-param name="table" select="$simple-table"/>
5354
+ </xsl:call-template>
5355
+ </xsl:variable>
5356
+
5357
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
5358
+ DEBUG
5359
+ colwidths=<xsl:copy-of select="$colwidths"/>
5360
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
5361
+
5362
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
5363
+
5364
+ <xsl:variable name="maxlength_dt">
5365
+ <xsl:call-template name="getMaxLength_dt"/>
5366
+ </xsl:variable>
5367
+
5368
+ <xsl:variable name="isContainsKeepTogetherTag_">
5369
+ false
5370
+ </xsl:variable>
5371
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
5372
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
5373
+
5374
+
5375
+ <xsl:call-template name="setColumnWidth_dl">
5376
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5377
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5378
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5379
+ </xsl:call-template>
5380
+
5381
+ <fo:table-body>
5382
+
5383
+ <!-- DEBUG -->
5384
+ <xsl:if test="$table_if_debug = 'true'">
5385
+ <fo:table-row>
5386
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
5387
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
5388
+ </fo:table-cell>
5389
+ </fo:table-row>
5390
+ </xsl:if>
5391
+
5392
+ <xsl:apply-templates>
5393
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
5394
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
5395
+ </xsl:apply-templates>
5396
+
5397
+ </fo:table-body>
5398
+ </xsl:otherwise>
5399
+ </xsl:choose>
4737
5400
  </fo:table>
4738
5401
  </fo:block>
4739
5402
  </fo:block>
4740
5403
  </xsl:if> <!-- END: a few components -->
4741
5404
  </fo:block-container>
4742
5405
  </fo:block-container>
5406
+
5407
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
5408
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
5409
+ </xsl:if>
5410
+
5411
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5412
+ <xsl:param name="process">false</xsl:param>
5413
+ <xsl:if test="$process = 'true'">
5414
+ <fo:block xsl:use-attribute-sets="dl-name-style">
5415
+ <xsl:apply-templates/>
5416
+ </fo:block>
5417
+ </xsl:if>
4743
5418
  </xsl:template><xsl:template name="setColumnWidth_dl">
4744
5419
  <xsl:param name="colwidths"/>
4745
5420
  <xsl:param name="maxlength_dt"/>
4746
5421
  <xsl:param name="isContainsKeepTogetherTag"/>
5422
+
5423
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5424
+
4747
5425
  <xsl:choose>
5426
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5427
+ <xsl:call-template name="insertTableColumnWidth">
5428
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5429
+ </xsl:call-template>
5430
+ </xsl:when>
4748
5431
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4749
5432
  <fo:table-column column-width="50%"/>
4750
5433
  <fo:table-column column-width="50%"/>
4751
5434
  </xsl:when>
4752
5435
  <xsl:otherwise>
4753
5436
  <xsl:choose>
5437
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5438
+ <xsl:call-template name="insertTableColumnWidth">
5439
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5440
+ </xsl:call-template>
5441
+ </xsl:when>
4754
5442
  <xsl:when test="$isContainsKeepTogetherTag">
4755
5443
  <xsl:call-template name="insertTableColumnWidth">
4756
5444
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -4795,13 +5483,19 @@
4795
5483
  </xsl:choose>
4796
5484
  </xsl:template><xsl:template name="insertTableColumnWidth">
4797
5485
  <xsl:param name="colwidths"/>
5486
+
4798
5487
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
4799
5488
  <xsl:choose>
4800
5489
  <xsl:when test=". = 1 or . = 0">
4801
5490
  <fo:table-column column-width="proportional-column-width(2)"/>
4802
5491
  </xsl:when>
4803
5492
  <xsl:otherwise>
4804
- <fo:table-column column-width="proportional-column-width({.})"/>
5493
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
5494
+ <xsl:variable name="divider">
5495
+ <xsl:value-of select="@divider"/>
5496
+ <xsl:if test="not(@divider)">1</xsl:if>
5497
+ </xsl:variable>
5498
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
4805
5499
  </xsl:otherwise>
4806
5500
  </xsl:choose>
4807
5501
  </xsl:for-each>
@@ -4863,75 +5557,167 @@
4863
5557
  </fo:table-cell>
4864
5558
  </fo:table-row>
4865
5559
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
5560
+ <xsl:param name="id"/>
5561
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4866
5562
  <tr>
4867
5563
  <td>
5564
+ <xsl:attribute name="id">
5565
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5566
+ </xsl:attribute>
4868
5567
  <xsl:apply-templates/>
4869
5568
  </td>
4870
5569
  <td>
5570
+ <xsl:attribute name="id">
5571
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
5572
+ </xsl:attribute>
4871
5573
 
4872
5574
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4873
5575
  <xsl:with-param name="process">true</xsl:with-param>
4874
5576
  </xsl:apply-templates>
4875
-
4876
- </td>
4877
- </tr>
4878
-
4879
- </xsl:template><xsl:template match="*[local-name()='dt']">
4880
- <xsl:param name="key_iso"/>
4881
-
4882
- <fo:table-row xsl:use-attribute-sets="dt-row-style">
4883
- <fo:table-cell>
5577
+
5578
+ </td>
5579
+ </tr>
5580
+
5581
+ </xsl:template><xsl:template match="*[local-name()='dt']">
5582
+ <xsl:param name="key_iso"/>
5583
+ <xsl:param name="split_keep-within-line"/>
5584
+
5585
+ <fo:table-row xsl:use-attribute-sets="dt-row-style">
5586
+ <xsl:call-template name="insert_dt_cell">
5587
+ <xsl:with-param name="key_iso" select="$key_iso"/>
5588
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5589
+ </xsl:call-template>
5590
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
5591
+ <xsl:call-template name="insert_dd_cell">
5592
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5593
+ </xsl:call-template>
5594
+ </xsl:for-each>
5595
+ </fo:table-row>
5596
+ </xsl:template><xsl:template name="insert_dt_cell">
5597
+ <xsl:param name="key_iso"/>
5598
+ <xsl:param name="split_keep-within-line"/>
5599
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
5600
+
5601
+ <xsl:if test="$isGenerateTableIF = 'true'">
5602
+ <!-- border is mandatory, to calculate real width -->
5603
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5604
+ <xsl:attribute name="text-align">left</xsl:attribute>
5605
+ </xsl:if>
5606
+
5607
+
5608
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
5609
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
5610
+ </xsl:if>
5611
+
5612
+ <fo:block xsl:use-attribute-sets="dt-block-style">
5613
+ <xsl:copy-of select="@id"/>
5614
+
5615
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5616
+ <xsl:attribute name="margin-top">0</xsl:attribute>
5617
+ </xsl:if>
5618
+
5619
+
5620
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
5621
+ <xsl:attribute name="text-align">right</xsl:attribute>
5622
+ </xsl:if>
5623
+
5624
+
5625
+ <xsl:apply-templates>
5626
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5627
+ </xsl:apply-templates>
5628
+
5629
+ <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"/> -->
5630
+
5631
+ </fo:block>
5632
+ </fo:table-cell>
5633
+ </xsl:template><xsl:template name="insert_dd_cell">
5634
+ <xsl:param name="split_keep-within-line"/>
5635
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
5636
+
5637
+ <xsl:if test="$isGenerateTableIF = 'true'">
5638
+ <!-- border is mandatory, to calculate real width -->
5639
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5640
+ </xsl:if>
5641
+
5642
+ <fo:block>
5643
+
5644
+ <xsl:if test="$isGenerateTableIF = 'true'">
5645
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5646
+ </xsl:if>
5647
+
5648
+
5649
+ <xsl:attribute name="text-align">justify</xsl:attribute>
5650
+
5651
+
5652
+ <xsl:choose>
5653
+ <xsl:when test="$isGenerateTableIF = 'true'">
5654
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
5655
+ <xsl:with-param name="process">true</xsl:with-param>
5656
+ </xsl:apply-templates>
5657
+ </xsl:when>
5658
+ <xsl:otherwise>
5659
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
5660
+ <xsl:with-param name="process">true</xsl:with-param>
5661
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5662
+ </xsl:apply-templates>
5663
+ </xsl:otherwise>
4884
5664
 
4885
- <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
4886
- <xsl:attribute name="padding-right">3mm</xsl:attribute>
4887
- </xsl:if>
5665
+ </xsl:choose>
4888
5666
 
4889
- <fo:block xsl:use-attribute-sets="dt-style">
4890
- <xsl:copy-of select="@id"/>
4891
-
4892
- <xsl:if test="normalize-space($key_iso) = 'true'">
4893
- <xsl:attribute name="margin-top">0</xsl:attribute>
4894
- </xsl:if>
4895
-
4896
-
4897
- <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
4898
- <xsl:attribute name="text-align">right</xsl:attribute>
4899
- </xsl:if>
4900
-
4901
-
4902
- <xsl:apply-templates/>
4903
- </fo:block>
4904
- </fo:table-cell>
4905
- <fo:table-cell>
4906
- <fo:block>
4907
-
4908
- <xsl:attribute name="text-align">justify</xsl:attribute>
4909
-
4910
-
4911
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4912
- <xsl:with-param name="process">true</xsl:with-param>
4913
- </xsl:apply-templates>
4914
- </fo:block>
4915
- </fo:table-cell>
4916
- </fo:table-row>
5667
+ <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"/> -->
5668
+
5669
+ </fo:block>
5670
+ </fo:table-cell>
4917
5671
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4918
5672
  <xsl:apply-templates/>
4919
5673
  </xsl:template><xsl:template match="*[local-name()='dd']">
4920
5674
  <xsl:param name="process">false</xsl:param>
5675
+ <xsl:param name="split_keep-within-line"/>
4921
5676
  <xsl:if test="$process = 'true'">
4922
5677
  <xsl:apply-templates select="@language"/>
4923
- <xsl:apply-templates/>
5678
+ <xsl:apply-templates>
5679
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5680
+ </xsl:apply-templates>
4924
5681
  </xsl:if>
4925
5682
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4926
5683
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4927
- </xsl:template><xsl:template match="*[local-name()='em']">
5684
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
5685
+ <xsl:param name="id"/>
5686
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
5687
+ <tr>
5688
+ <td>
5689
+ <xsl:copy-of select="node()"/>
5690
+ </td>
5691
+ <td>
5692
+
5693
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5694
+
5695
+ <!-- get paragraphs from nested 'dl' -->
5696
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5697
+
5698
+
5699
+ </td>
5700
+ </tr>
5701
+
5702
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5703
+ <xsl:for-each select="*[local-name() = 'dt']">
5704
+ <p>
5705
+ <xsl:copy-of select="node()"/>
5706
+ <xsl:text> </xsl:text>
5707
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
5708
+ </p>
5709
+ </xsl:for-each>
5710
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
4928
5711
  <fo:inline font-style="italic">
4929
5712
  <xsl:apply-templates/>
4930
5713
  </fo:inline>
4931
5714
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
5715
+ <xsl:param name="split_keep-within-line"/>
4932
5716
  <fo:inline font-weight="bold">
4933
5717
 
4934
- <xsl:apply-templates/>
5718
+ <xsl:apply-templates>
5719
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5720
+ </xsl:apply-templates>
4935
5721
  </fo:inline>
4936
5722
  </xsl:template><xsl:template match="*[local-name()='padding']">
4937
5723
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -4952,7 +5738,7 @@
4952
5738
 
4953
5739
 
4954
5740
 
4955
-
5741
+ <!-- 10 -->
4956
5742
 
4957
5743
 
4958
5744
 
@@ -5132,6 +5918,10 @@
5132
5918
  <xsl:param name="text"/>
5133
5919
  <xsl:param name="separator" select="' '"/>
5134
5920
  <xsl:choose>
5921
+
5922
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
5923
+ <word><xsl:value-of select="normalize-space($text)"/></word>
5924
+ </xsl:when>
5135
5925
  <xsl:when test="not(contains($text, $separator))">
5136
5926
  <word>
5137
5927
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -5176,13 +5966,66 @@
5176
5966
  </xsl:when>
5177
5967
  <xsl:otherwise>
5178
5968
  <word>
5179
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
5969
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
5970
+ <xsl:choose>
5971
+ <xsl:when test="$isGenerateTableIF = 'true'">
5972
+ <xsl:value-of select="$word"/>
5973
+ </xsl:when>
5974
+ <xsl:otherwise>
5975
+ <xsl:value-of select="string-length($word)"/>
5976
+ </xsl:otherwise>
5977
+ </xsl:choose>
5180
5978
  </word>
5181
5979
  <xsl:call-template name="tokenize">
5182
5980
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5183
5981
  </xsl:call-template>
5184
5982
  </xsl:otherwise>
5185
5983
  </xsl:choose>
5984
+ </xsl:template><xsl:template name="tokenize_with_tags">
5985
+ <xsl:param name="tags"/>
5986
+ <xsl:param name="text"/>
5987
+ <xsl:param name="separator" select="' '"/>
5988
+ <xsl:choose>
5989
+
5990
+ <xsl:when test="not(contains($text, $separator))">
5991
+ <word>
5992
+ <xsl:call-template name="enclose_text_in_tags">
5993
+ <xsl:with-param name="text" select="normalize-space($text)"/>
5994
+ <xsl:with-param name="tags" select="$tags"/>
5995
+ </xsl:call-template>
5996
+ </word>
5997
+ </xsl:when>
5998
+ <xsl:otherwise>
5999
+ <word>
6000
+ <xsl:call-template name="enclose_text_in_tags">
6001
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
6002
+ <xsl:with-param name="tags" select="$tags"/>
6003
+ </xsl:call-template>
6004
+ </word>
6005
+ <xsl:call-template name="tokenize_with_tags">
6006
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
6007
+ </xsl:call-template>
6008
+ </xsl:otherwise>
6009
+ </xsl:choose>
6010
+ </xsl:template><xsl:template name="enclose_text_in_tags">
6011
+ <xsl:param name="text"/>
6012
+ <xsl:param name="tags"/>
6013
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
6014
+
6015
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
6016
+
6017
+ <xsl:choose>
6018
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
6019
+ <xsl:otherwise>
6020
+ <xsl:element name="{$tag_name}">
6021
+ <xsl:call-template name="enclose_text_in_tags">
6022
+ <xsl:with-param name="text" select="$text"/>
6023
+ <xsl:with-param name="tags" select="$tags"/>
6024
+ <xsl:with-param name="num" select="$num + 1"/>
6025
+ </xsl:call-template>
6026
+ </xsl:element>
6027
+ </xsl:otherwise>
6028
+ </xsl:choose>
5186
6029
  </xsl:template><xsl:template name="max_length">
5187
6030
  <xsl:param name="words"/>
5188
6031
  <xsl:for-each select="$words//word">
@@ -5283,12 +6126,19 @@
5283
6126
  </xsl:otherwise>
5284
6127
  </xsl:choose>
5285
6128
  </xsl:template><xsl:template name="getSimpleTable">
6129
+ <xsl:param name="id"/>
6130
+
5286
6131
  <xsl:variable name="simple-table">
5287
6132
 
6133
+ <!-- Step 0. replace <br/> to <p>...</p> -->
6134
+ <xsl:variable name="table_without_br">
6135
+ <xsl:apply-templates mode="table-without-br"/>
6136
+ </xsl:variable>
6137
+
5288
6138
  <!-- Step 1. colspan processing -->
5289
6139
  <xsl:variable name="simple-table-colspan">
5290
6140
  <tbody>
5291
- <xsl:apply-templates mode="simple-table-colspan"/>
6141
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
5292
6142
  </tbody>
5293
6143
  </xsl:variable>
5294
6144
 
@@ -5297,10 +6147,67 @@
5297
6147
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
5298
6148
  </xsl:variable>
5299
6149
 
5300
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
5301
-
6150
+ <!-- Step 3: add id to each cell -->
6151
+ <!-- add <word>...</word> for each word, image, math -->
6152
+ <xsl:variable name="simple-table-id">
6153
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
6154
+ <xsl:with-param name="id" select="$id"/>
6155
+ </xsl:apply-templates>
6156
+ </xsl:variable>
6157
+
6158
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
6159
+
5302
6160
  </xsl:variable>
5303
6161
  <xsl:copy-of select="$simple-table"/>
6162
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
6163
+ <xsl:copy>
6164
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
6165
+ </xsl:copy>
6166
+ </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">
6167
+ <xsl:copy>
6168
+ <xsl:copy-of select="@*"/>
6169
+ <p>
6170
+ <xsl:copy-of select="node()"/>
6171
+ </p>
6172
+ </xsl:copy>
6173
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
6174
+ <xsl:copy>
6175
+ <xsl:copy-of select="@*"/>
6176
+ <xsl:for-each select="*[local-name()='br']">
6177
+ <xsl:variable name="current_id" select="generate-id()"/>
6178
+ <p>
6179
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
6180
+ <xsl:copy-of select="."/>
6181
+ </xsl:for-each>
6182
+ </p>
6183
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
6184
+ <p>
6185
+ <xsl:for-each select="following-sibling::node()">
6186
+ <xsl:copy-of select="."/>
6187
+ </xsl:for-each>
6188
+ </p>
6189
+ </xsl:if>
6190
+ </xsl:for-each>
6191
+ </xsl:copy>
6192
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
6193
+ <xsl:for-each select="*[local-name()='br']">
6194
+ <xsl:variable name="current_id" select="generate-id()"/>
6195
+ <p>
6196
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
6197
+ <xsl:copy-of select="."/>
6198
+ </xsl:for-each>
6199
+ </p>
6200
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
6201
+ <p>
6202
+ <xsl:for-each select="following-sibling::node()">
6203
+ <xsl:copy-of select="."/>
6204
+ </xsl:for-each>
6205
+ </p>
6206
+ </xsl:if>
6207
+ </xsl:for-each>
6208
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
6209
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
6210
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
5304
6211
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
5305
6212
  <xsl:apply-templates mode="simple-table-colspan"/>
5306
6213
  </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">
@@ -5390,6 +6297,126 @@
5390
6297
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5391
6298
  <xsl:with-param name="previousRow" select="$newRow"/>
5392
6299
  </xsl:apply-templates>
6300
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
6301
+ <xsl:param name="id"/>
6302
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
6303
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
6304
+ <xsl:with-param name="id" select="$id_prefixed"/>
6305
+ </xsl:apply-templates>
6306
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
6307
+ <xsl:param name="id"/>
6308
+ <xsl:copy>
6309
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
6310
+ <xsl:with-param name="id" select="$id"/>
6311
+ </xsl:apply-templates>
6312
+ </xsl:copy>
6313
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
6314
+ <xsl:param name="id"/>
6315
+ <xsl:copy>
6316
+ <xsl:copy-of select="@*"/>
6317
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
6318
+ <xsl:apply-templates select="node()" mode="simple-table-id">
6319
+ <xsl:with-param name="id" select="$id"/>
6320
+ </xsl:apply-templates>
6321
+ </xsl:copy>
6322
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
6323
+ <xsl:param name="id"/>
6324
+ <xsl:copy>
6325
+ <xsl:copy-of select="@*"/>
6326
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
6327
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
6328
+ <xsl:attribute name="id">
6329
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
6330
+ </xsl:attribute>
6331
+
6332
+ <xsl:for-each select="*[local-name() = 'p']">
6333
+ <xsl:copy>
6334
+ <xsl:copy-of select="@*"/>
6335
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
6336
+ <xsl:attribute name="id">
6337
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
6338
+ </xsl:attribute>
6339
+
6340
+ <xsl:copy-of select="node()"/>
6341
+ </xsl:copy>
6342
+ </xsl:for-each>
6343
+
6344
+
6345
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
6346
+
6347
+ <xsl:variable name="td_text">
6348
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
6349
+ </xsl:variable>
6350
+
6351
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
6352
+
6353
+ <xsl:variable name="words">
6354
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
6355
+ <word>
6356
+ <xsl:copy-of select="."/>
6357
+ </word>
6358
+ </xsl:for-each>
6359
+
6360
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
6361
+ <xsl:copy-of select="."/>
6362
+ </xsl:for-each>
6363
+
6364
+ </xsl:variable>
6365
+
6366
+ <xsl:for-each select="xalan:nodeset($words)/word">
6367
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
6368
+ <xsl:copy>
6369
+ <xsl:attribute name="id">
6370
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
6371
+ </xsl:attribute>
6372
+ <xsl:copy-of select="node()"/>
6373
+ </xsl:copy>
6374
+ </xsl:for-each>
6375
+ </xsl:if>
6376
+ </xsl:copy>
6377
+
6378
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
6379
+ <xsl:copy>
6380
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
6381
+ </xsl:copy>
6382
+ </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">
6383
+ <xsl:variable name="formatting_tags">
6384
+ <xsl:call-template name="getFormattingTags"/>
6385
+ </xsl:variable>
6386
+ <word>
6387
+ <xsl:call-template name="enclose_text_in_tags">
6388
+ <xsl:with-param name="text" select="normalize-space(.)"/>
6389
+ <xsl:with-param name="tags" select="$formatting_tags"/>
6390
+ </xsl:call-template>
6391
+ </word>
6392
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
6393
+
6394
+ <xsl:variable name="td_text" select="."/>
6395
+
6396
+ <xsl:variable name="string_with_added_zerospaces">
6397
+ <xsl:call-template name="add-zero-spaces-java">
6398
+ <xsl:with-param name="text" select="$td_text"/>
6399
+ </xsl:call-template>
6400
+ </xsl:variable>
6401
+
6402
+ <xsl:variable name="formatting_tags">
6403
+ <xsl:call-template name="getFormattingTags"/>
6404
+ </xsl:variable>
6405
+
6406
+ <!-- <word>text</word> -->
6407
+ <xsl:call-template name="tokenize_with_tags">
6408
+ <xsl:with-param name="tags" select="$formatting_tags"/>
6409
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
6410
+ </xsl:call-template>
6411
+ </xsl:template><xsl:template name="getFormattingTags">
6412
+ <tags>
6413
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
6414
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
6415
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
6416
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
6417
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
6418
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
6419
+ </tags>
5393
6420
  </xsl:template><xsl:template name="getLang">
5394
6421
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5395
6422
  <xsl:variable name="language">
@@ -5583,6 +6610,11 @@
5583
6610
  </xsl:variable>
5584
6611
  <fo:inline xsl:use-attribute-sets="link-style">
5585
6612
 
6613
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
6614
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6615
+ </xsl:if>
6616
+
6617
+
5586
6618
 
5587
6619
 
5588
6620
 
@@ -5851,7 +6883,19 @@
5851
6883
  <xsl:value-of select="$suffix"/>
5852
6884
  </xsl:if>
5853
6885
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
5854
- <fo:inline><xsl:apply-templates/></fo:inline>
6886
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
6887
+ <xsl:choose>
6888
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
6889
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
6890
+ <xsl:apply-templates/>
6891
+ </fo:inline>
6892
+ </xsl:when>
6893
+ <xsl:otherwise>
6894
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
6895
+ <xsl:apply-templates/>
6896
+ </fo:block>
6897
+ </xsl:otherwise>
6898
+ </xsl:choose>
5855
6899
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
5856
6900
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
5857
6901
  <fo:block id="{@id}">
@@ -6668,7 +7712,7 @@
6668
7712
  </xsl:choose>
6669
7713
  </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">
6670
7714
  <xsl:value-of select="."/>
6671
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
7715
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6672
7716
  <xsl:text> </xsl:text>
6673
7717
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
6674
7718
  <xsl:copy>
@@ -6739,7 +7783,7 @@
6739
7783
 
6740
7784
 
6741
7785
 
6742
-
7786
+ <!-- 9 -->
6743
7787
 
6744
7788
 
6745
7789
  10
@@ -6823,7 +7867,7 @@
6823
7867
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6824
7868
  <xsl:choose>
6825
7869
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6826
- <xsl:call-template name="interspers">
7870
+ <xsl:call-template name="interspers-java">
6827
7871
  <xsl:with-param name="str" select="."/>
6828
7872
  </xsl:call-template>
6829
7873
  </xsl:when>
@@ -6873,6 +7917,10 @@
6873
7917
  <xsl:with-param name="char" select="$char"/>
6874
7918
  </xsl:call-template>
6875
7919
  </xsl:if>
7920
+ </xsl:template><xsl:template name="interspers-java">
7921
+ <xsl:param name="str"/>
7922
+ <xsl:param name="char" select="$zero_width_space"/>
7923
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
6876
7924
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6877
7925
  <xsl:apply-templates mode="syntax_highlight"/>
6878
7926
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -7085,7 +8133,9 @@
7085
8133
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
7086
8134
  </xsl:if>
7087
8135
  <xsl:variable name="simple-table">
7088
- <xsl:call-template name="getSimpleTable"/>
8136
+ <xsl:call-template name="getSimpleTable">
8137
+ <xsl:with-param name="id" select="@id"/>
8138
+ </xsl:call-template>
7089
8139
  </xsl:variable>
7090
8140
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
7091
8141
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -7501,6 +8551,7 @@
7501
8551
 
7502
8552
 
7503
8553
 
8554
+
7504
8555
  <xsl:choose>
7505
8556
  <xsl:when test="$depth = 5">7</xsl:when>
7506
8557
  <xsl:when test="$depth = 4">10</xsl:when>
@@ -7830,6 +8881,11 @@
7830
8881
  </xsl:otherwise>
7831
8882
  </xsl:choose>
7832
8883
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8884
+
8885
+ <xsl:apply-templates select="*[local-name() = 'name']">
8886
+ <xsl:with-param name="process">true</xsl:with-param>
8887
+ </xsl:apply-templates>
8888
+
7833
8889
  <fo:list-block xsl:use-attribute-sets="list-style">
7834
8890
 
7835
8891
 
@@ -7840,12 +8896,23 @@
7840
8896
 
7841
8897
 
7842
8898
 
8899
+ <xsl:if test="*[local-name() = 'name']">
8900
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8901
+ </xsl:if>
8902
+
7843
8903
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7844
8904
  </fo:list-block>
7845
8905
  <!-- <xsl:for-each select="./iho:note">
7846
8906
  <xsl:call-template name="note"/>
7847
8907
  </xsl:for-each> -->
7848
8908
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8909
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8910
+ <xsl:param name="process">false</xsl:param>
8911
+ <xsl:if test="$process = 'true'">
8912
+ <fo:block xsl:use-attribute-sets="list-name-style">
8913
+ <xsl:apply-templates/>
8914
+ </fo:block>
8915
+ </xsl:if>
7849
8916
  </xsl:template><xsl:template match="*[local-name()='li']">
7850
8917
  <fo:list-item xsl:use-attribute-sets="list-item-style">
7851
8918
  <xsl:copy-of select="@id"/>
@@ -8045,7 +9112,7 @@
8045
9112
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
8046
9113
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
8047
9114
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
8048
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
9115
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
8049
9116
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
8050
9117
  <!-- <row>
8051
9118
  <date>05-07-2013</date>
@@ -8125,7 +9192,7 @@
8125
9192
  </xsl:template><xsl:template name="processBibitem">
8126
9193
 
8127
9194
 
8128
-
9195
+
8129
9196
  <!-- Example: [ITU-T A.23] ITU-T A.23, Recommendation ITU-T A.23, Annex A (2014), Guide for ITU-T and ISO/IEC JTC 1 cooperation. -->
8130
9197
  <xsl:if test="$doctype = 'implementers-guide'">
8131
9198
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -8133,46 +9200,26 @@
8133
9200
  </xsl:if>
8134
9201
 
8135
9202
  <xsl:variable name="bibitem_label">
8136
- <xsl:choose>
8137
- <xsl:when test="itu:docidentifier[@type = 'metanorma']">
8138
- <xsl:value-of select="itu:docidentifier[@type = 'metanorma']"/>
8139
- </xsl:when>
8140
- <xsl:otherwise>
8141
- <fo:inline padding-right="5mm">
8142
- <xsl:text>[</xsl:text>
8143
- <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>
8144
- <xsl:text>] </xsl:text>
8145
- </fo:inline>
8146
- </xsl:otherwise>
8147
- </xsl:choose>
9203
+ <xsl:value-of select="itu:docidentifier[@type = 'metanorma']"/>
9204
+ <xsl:if test="not(itu:docidentifier[@type = 'metanorma'])">
9205
+ <fo:inline padding-right="5mm">
9206
+ <xsl:text>[</xsl:text>
9207
+ <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>
9208
+ <xsl:text>] </xsl:text>
9209
+ </fo:inline>
9210
+ </xsl:if>
8148
9211
  </xsl:variable>
8149
9212
 
8150
9213
  <xsl:variable name="bibitem_body">
8151
9214
  <xsl:text> </xsl:text>
8152
9215
  <xsl:choose>
8153
9216
  <xsl:when test="itu:docidentifier[@type = 'metanorma']">
8154
- <xsl:if test="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]">
8155
- <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"/>
8156
- <xsl:text>, </xsl:text>
8157
- </xsl:if>
9217
+ <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"/>
8158
9218
  </xsl:when>
8159
9219
  <xsl:otherwise>
8160
9220
  <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>
8161
- <xsl:if test="itu:title">
8162
- <xsl:text>, </xsl:text>
8163
- </xsl:if>
8164
9221
  </xsl:otherwise>
8165
9222
  </xsl:choose>
8166
- <xsl:if test="itu:title">
8167
- <xsl:choose>
8168
- <xsl:when test="itu:title[@type = 'main' and @language = 'en']">
8169
- <xsl:apply-templates select="itu:title[@type = 'main' and @language = 'en']"/>
8170
- </xsl:when>
8171
- <xsl:otherwise>
8172
- <xsl:apply-templates select="itu:title"/>
8173
- </xsl:otherwise>
8174
- </xsl:choose>
8175
- </xsl:if>
8176
9223
  <xsl:if test="itu:formattedref and not(itu:docidentifier[@type = 'metanorma'])">, </xsl:if>
8177
9224
  <xsl:apply-templates select="itu:formattedref"/>
8178
9225
  </xsl:variable>
@@ -8189,7 +9236,7 @@
8189
9236
  </fo:table-row>
8190
9237
  </fo:table-body>
8191
9238
  </fo:table>
8192
- </xsl:when>
9239
+ </xsl:when> <!-- $doctype = 'implementers-guide' -->
8193
9240
  <xsl:otherwise>
8194
9241
  <xsl:copy-of select="$bibitem_label"/>
8195
9242
  <xsl:copy-of select="$bibitem_body"/>
@@ -8496,12 +9543,16 @@
8496
9543
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
8497
9544
 
8498
9545
 
9546
+
9547
+
8499
9548
 
8500
9549
 
8501
9550
 
8502
9551
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
8503
9552
 
8504
9553
 
9554
+
9555
+
8505
9556
  <fo:block xsl:use-attribute-sets="admonition-name-style">
8506
9557
  <xsl:call-template name="displayAdmonitionName"/>
8507
9558
  </fo:block>
@@ -8514,25 +9565,32 @@
8514
9565
  </fo:block-container>
8515
9566
 
8516
9567
  </xsl:template><xsl:template name="displayAdmonitionName">
8517
-
9568
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
9569
+ <!-- <xsl:choose>
9570
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
9571
+ <xsl:choose>
9572
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
9573
+ <xsl:otherwise>
9574
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9575
+ </xsl:otherwise>
9576
+ </xsl:choose>
9577
+ </xsl:when>
9578
+ <xsl:otherwise>
8518
9579
  <xsl:apply-templates select="*[local-name() = 'name']"/>
8519
9580
  <xsl:if test="not(*[local-name() = 'name'])">
8520
9581
  <xsl:apply-templates select="@type"/>
8521
9582
  </xsl:if>
8522
-
8523
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8524
- <xsl:apply-templates/>
8525
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
8526
- <xsl:variable name="admonition_type_">
8527
- <xsl:call-template name="getLocalizedString">
8528
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
8529
- </xsl:call-template>
9583
+ </xsl:otherwise>
9584
+ </xsl:choose> -->
9585
+ <xsl:variable name="name">
9586
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8530
9587
  </xsl:variable>
8531
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
8532
- <xsl:value-of select="$admonition_type"/>
8533
- <xsl:if test="$admonition_type = ''">
8534
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
9588
+ <xsl:copy-of select="$name"/>
9589
+ <xsl:if test="normalize-space($name) != ''">
9590
+ <xsl:value-of select="$sep"/>
8535
9591
  </xsl:if>
9592
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
9593
+ <xsl:apply-templates/>
8536
9594
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
8537
9595
 
8538
9596
  <fo:block xsl:use-attribute-sets="admonition-p-style">
@@ -8703,6 +9761,8 @@
8703
9761
  </xsl:when>
8704
9762
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8705
9763
  </xsl:choose>
9764
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
9765
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
8706
9766
  </xsl:template><xsl:template name="printEdition">
8707
9767
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8708
9768
  <xsl:text> </xsl:text>
@@ -8809,6 +9869,27 @@
8809
9869
  </xsl:when>
8810
9870
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
8811
9871
  </xsl:choose>
9872
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
9873
+ <xsl:param name="num"/>
9874
+ <xsl:variable name="monthStr">
9875
+ <xsl:choose>
9876
+ <xsl:when test="$num = '01'">january</xsl:when>
9877
+ <xsl:when test="$num = '02'">february</xsl:when>
9878
+ <xsl:when test="$num = '03'">march</xsl:when>
9879
+ <xsl:when test="$num = '04'">april</xsl:when>
9880
+ <xsl:when test="$num = '05'">may</xsl:when>
9881
+ <xsl:when test="$num = '06'">june</xsl:when>
9882
+ <xsl:when test="$num = '07'">july</xsl:when>
9883
+ <xsl:when test="$num = '08'">august</xsl:when>
9884
+ <xsl:when test="$num = '09'">september</xsl:when>
9885
+ <xsl:when test="$num = '10'">october</xsl:when>
9886
+ <xsl:when test="$num = '11'">november</xsl:when>
9887
+ <xsl:when test="$num = '12'">december</xsl:when>
9888
+ </xsl:choose>
9889
+ </xsl:variable>
9890
+ <xsl:call-template name="getLocalizedString">
9891
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
9892
+ </xsl:call-template>
8812
9893
  </xsl:template><xsl:template name="insertKeywords">
8813
9894
  <xsl:param name="sorting" select="'true'"/>
8814
9895
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -9001,6 +10082,7 @@
9001
10082
 
9002
10083
 
9003
10084
 
10085
+
9004
10086
  <xsl:value-of select="document('')//*/namespace::itu"/>
9005
10087
 
9006
10088
 
@@ -9415,4 +10497,40 @@
9415
10497
  <xsl:value-of select="$value"/>
9416
10498
  </xsl:otherwise>
9417
10499
  </xsl:choose>
10500
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
10501
+ <xsl:param name="level">0</xsl:param>
10502
+
10503
+ <fo:block margin-left="{2*$level}mm">
10504
+ <xsl:text>
10505
+ &lt;</xsl:text>
10506
+ <xsl:value-of select="local-name()"/>
10507
+ <xsl:for-each select="@*">
10508
+ <xsl:text> </xsl:text>
10509
+ <xsl:value-of select="local-name()"/>
10510
+ <xsl:text>="</xsl:text>
10511
+ <xsl:value-of select="."/>
10512
+ <xsl:text>"</xsl:text>
10513
+ </xsl:for-each>
10514
+ <xsl:text>&gt;</xsl:text>
10515
+
10516
+ <xsl:if test="not(*)">
10517
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
10518
+ <xsl:text>&lt;/</xsl:text>
10519
+ <xsl:value-of select="local-name()"/>
10520
+ <xsl:text>&gt;</xsl:text>
10521
+ </xsl:if>
10522
+ </fo:block>
10523
+
10524
+ <xsl:if test="*">
10525
+ <fo:block>
10526
+ <xsl:apply-templates mode="print_as_xml">
10527
+ <xsl:with-param name="level" select="$level + 1"/>
10528
+ </xsl:apply-templates>
10529
+ </fo:block>
10530
+ <fo:block margin-left="{2*$level}mm">
10531
+ <xsl:text>&lt;/</xsl:text>
10532
+ <xsl:value-of select="local-name()"/>
10533
+ <xsl:text>&gt;</xsl:text>
10534
+ </fo:block>
10535
+ </xsl:if>
9418
10536
  </xsl:template></xsl:stylesheet>