metanorma-cc 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -455,6 +455,7 @@
455
455
 
456
456
  <xsl:template match="csd:p" name="paragraph">
457
457
  <xsl:param name="inline" select="'false'"/>
458
+ <xsl:param name="split_keep-within-line"/>
458
459
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
459
460
  <xsl:variable name="element-name">
460
461
  <xsl:choose>
@@ -480,7 +481,9 @@
480
481
  </xsl:choose>
481
482
  </xsl:attribute>
482
483
  <xsl:attribute name="line-height">115%</xsl:attribute>
483
- <xsl:apply-templates/>
484
+ <xsl:apply-templates>
485
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
486
+ </xsl:apply-templates>
484
487
  </xsl:element>
485
488
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
486
489
  <fo:block margin-bottom="12pt">
@@ -566,12 +569,41 @@
566
569
  </xsl:template>
567
570
 
568
571
 
569
- <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">
572
+ <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_">
573
+ <xsl:for-each select="$table_widths_from_if//table">
574
+ <xsl:copy>
575
+ <xsl:copy-of select="@*"/>
576
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
577
+ </xsl:copy>
578
+ </xsl:for-each>
579
+ </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_">
580
+ false
581
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
570
582
  <xsl:call-template name="getLang"/>
571
- </xsl:variable><xsl:variable name="pageWidth_">
572
- 210
583
+ </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_">
584
+ <xsl:choose>
585
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
586
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
587
+ </xsl:choose>
588
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
589
+ <xsl:choose>
590
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
591
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
592
+ </xsl:choose>
593
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
594
+ <xsl:choose>
595
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
596
+ <xsl:otherwise>
597
+ 210
598
+ </xsl:otherwise>
599
+ </xsl:choose>
573
600
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
574
- 297
601
+ <xsl:choose>
602
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
603
+ <xsl:otherwise>
604
+ 297
605
+ </xsl:otherwise>
606
+ </xsl:choose>
575
607
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
576
608
  19
577
609
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -685,12 +717,13 @@
685
717
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
686
718
  </xsl:otherwise>
687
719
  </xsl:choose>
688
- </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">
720
+ </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">
689
721
 
690
722
 
691
723
 
692
724
 
693
- <xsl:attribute name="font-family">Source Sans Pro, STIX Two Math, Source Han Sans</xsl:attribute>
725
+ <xsl:attribute name="font-family">Source Sans Pro, STIX Two Math, <xsl:value-of select="$font_noto_sans"/></xsl:attribute>
726
+ <xsl:attribute name="font-family-generic">Sans</xsl:attribute>
694
727
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
695
728
 
696
729
 
@@ -705,6 +738,7 @@
705
738
 
706
739
 
707
740
 
741
+
708
742
  </xsl:attribute-set><xsl:template name="insertRootStyle">
709
743
  <xsl:param name="root-style"/>
710
744
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
@@ -716,17 +750,60 @@
716
750
  </xsl:variable>
717
751
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
718
752
 
753
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
754
+
719
755
  <xsl:for-each select="$root-style_/root-style/@*">
756
+
720
757
  <xsl:choose>
721
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
758
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
759
+ <xsl:when test="local-name() = 'font-family'">
760
+
761
+ <xsl:variable name="font_regional_prefix">
762
+ <xsl:choose>
763
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
764
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
765
+ </xsl:choose>
766
+ </xsl:variable>
767
+
722
768
  <xsl:attribute name="{local-name()}">
723
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
769
+
770
+ <xsl:variable name="font_extended">
771
+ <xsl:choose>
772
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
773
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
774
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
775
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
776
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
777
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
778
+ </xsl:choose>
779
+ </xsl:variable>
780
+ <xsl:if test="normalize-space($font_extended) != ''">
781
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
782
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
783
+ </xsl:if>
784
+
785
+ <xsl:value-of select="."/>
786
+
787
+ <xsl:if test="$additional_fonts != ''">
788
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
789
+ </xsl:if>
724
790
  </xsl:attribute>
725
791
  </xsl:when>
726
792
  <xsl:otherwise>
727
793
  <xsl:copy-of select="."/>
728
794
  </xsl:otherwise>
729
795
  </xsl:choose>
796
+
797
+ <!-- <xsl:choose>
798
+ <xsl:when test="local-name() = 'font-family'">
799
+ <xsl:attribute name="{local-name()}">
800
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
801
+ </xsl:attribute>
802
+ </xsl:when>
803
+ <xsl:otherwise>
804
+ <xsl:copy-of select="."/>
805
+ </xsl:otherwise>
806
+ </xsl:choose> -->
730
807
  </xsl:for-each>
731
808
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
732
809
 
@@ -793,7 +870,7 @@
793
870
 
794
871
 
795
872
 
796
- <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
873
+ <xsl:attribute name="font-family">Source Code Pro, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
797
874
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
798
875
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
799
876
 
@@ -804,6 +881,7 @@
804
881
 
805
882
 
806
883
 
884
+
807
885
 
808
886
 
809
887
 
@@ -847,6 +925,7 @@
847
925
 
848
926
 
849
927
 
928
+
850
929
 
851
930
  </xsl:attribute-set><xsl:attribute-set name="example-style">
852
931
 
@@ -864,6 +943,7 @@
864
943
 
865
944
 
866
945
 
946
+
867
947
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
868
948
 
869
949
 
@@ -889,6 +969,7 @@
889
969
 
890
970
 
891
971
 
972
+
892
973
 
893
974
 
894
975
 
@@ -923,6 +1004,7 @@
923
1004
 
924
1005
  </xsl:attribute-set><xsl:variable name="table-border_">
925
1006
 
1007
+
926
1008
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
927
1009
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
928
1010
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -946,6 +1028,7 @@
946
1028
 
947
1029
 
948
1030
 
1031
+
949
1032
 
950
1033
 
951
1034
 
@@ -974,6 +1057,7 @@
974
1057
 
975
1058
 
976
1059
 
1060
+
977
1061
 
978
1062
 
979
1063
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
@@ -986,6 +1070,7 @@
986
1070
 
987
1071
 
988
1072
 
1073
+
989
1074
 
990
1075
 
991
1076
 
@@ -1023,6 +1108,7 @@
1023
1108
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1024
1109
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1025
1110
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1111
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1026
1112
  <xsl:attribute name="display-align">center</xsl:attribute>
1027
1113
 
1028
1114
 
@@ -1041,6 +1127,8 @@
1041
1127
  <xsl:attribute name="display-align">center</xsl:attribute>
1042
1128
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1043
1129
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1130
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1131
+
1044
1132
 
1045
1133
 
1046
1134
 
@@ -1066,7 +1154,7 @@
1066
1154
 
1067
1155
 
1068
1156
 
1069
-
1157
+
1070
1158
 
1071
1159
 
1072
1160
 
@@ -1081,6 +1169,7 @@
1081
1169
 
1082
1170
 
1083
1171
 
1172
+
1084
1173
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
1085
1174
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1086
1175
 
@@ -1089,6 +1178,8 @@
1089
1178
 
1090
1179
 
1091
1180
 
1181
+
1182
+
1092
1183
  </xsl:attribute-set><xsl:attribute-set name="table-fn-number-style">
1093
1184
  <xsl:attribute name="font-size">80%</xsl:attribute>
1094
1185
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1106,6 +1197,7 @@
1106
1197
 
1107
1198
 
1108
1199
 
1200
+
1109
1201
  </xsl:attribute-set><xsl:attribute-set name="fn-container-body-style">
1110
1202
  <xsl:attribute name="text-indent">0</xsl:attribute>
1111
1203
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -1125,7 +1217,8 @@
1125
1217
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1126
1218
 
1127
1219
 
1128
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1220
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1221
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1129
1222
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1130
1223
 
1131
1224
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
@@ -1139,6 +1232,29 @@
1139
1232
 
1140
1233
 
1141
1234
 
1235
+
1236
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1237
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1238
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1239
+
1240
+
1241
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1242
+
1243
+
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1257
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1142
1258
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1143
1259
 
1144
1260
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1181,6 +1297,7 @@
1181
1297
 
1182
1298
 
1183
1299
 
1300
+
1184
1301
 
1185
1302
 
1186
1303
 
@@ -1246,6 +1363,8 @@
1246
1363
 
1247
1364
 
1248
1365
 
1366
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
1367
+
1249
1368
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1250
1369
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
1251
1370
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -1291,6 +1410,7 @@
1291
1410
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1292
1411
 
1293
1412
 
1413
+
1294
1414
 
1295
1415
 
1296
1416
 
@@ -1340,6 +1460,7 @@
1340
1460
 
1341
1461
 
1342
1462
 
1463
+
1343
1464
  </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
1344
1465
  <xsl:attribute name="text-align">right</xsl:attribute>
1345
1466
 
@@ -1358,19 +1479,19 @@
1358
1479
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
1359
1480
 
1360
1481
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1482
+ <xsl:attribute name="width">100%</xsl:attribute>
1483
+ <xsl:attribute name="content-height">100%</xsl:attribute>
1484
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
1361
1485
 
1362
1486
 
1363
- <xsl:attribute name="width">100%</xsl:attribute>
1364
1487
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
1365
- <xsl:attribute name="scaling">uniform</xsl:attribute>
1366
1488
 
1367
1489
 
1368
1490
 
1369
-
1370
-
1491
+
1371
1492
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1372
1493
 
1373
- <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
1494
+ <xsl:attribute name="font-family">Source Code Pro, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1374
1495
 
1375
1496
 
1376
1497
 
@@ -1455,6 +1576,25 @@
1455
1576
 
1456
1577
 
1457
1578
 
1579
+
1580
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
1581
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1582
+
1583
+
1584
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1585
+
1586
+
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+
1597
+
1458
1598
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1459
1599
 
1460
1600
 
@@ -1502,6 +1642,7 @@
1502
1642
 
1503
1643
 
1504
1644
 
1645
+
1505
1646
  </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1506
1647
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1507
1648
  <xsl:attribute name="font-style">normal</xsl:attribute>
@@ -1528,6 +1669,7 @@
1528
1669
 
1529
1670
 
1530
1671
 
1672
+
1531
1673
  </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1532
1674
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1533
1675
 
@@ -1550,6 +1692,7 @@
1550
1692
 
1551
1693
 
1552
1694
 
1695
+
1553
1696
  </xsl:attribute-set><xsl:attribute-set name="admonition-style">
1554
1697
 
1555
1698
 
@@ -1568,7 +1711,11 @@
1568
1711
 
1569
1712
 
1570
1713
 
1714
+
1571
1715
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
1716
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
1717
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
1718
+
1572
1719
 
1573
1720
 
1574
1721
 
@@ -1606,6 +1753,7 @@
1606
1753
 
1607
1754
 
1608
1755
 
1756
+
1609
1757
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-style">
1610
1758
 
1611
1759
 
@@ -1643,6 +1791,7 @@
1643
1791
 
1644
1792
 
1645
1793
 
1794
+
1646
1795
  </xsl:attribute-set><xsl:attribute-set name="bibitem-non-normative-style">
1647
1796
 
1648
1797
 
@@ -1664,6 +1813,7 @@
1664
1813
 
1665
1814
 
1666
1815
 
1816
+
1667
1817
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-list-body-style">
1668
1818
 
1669
1819
 
@@ -1692,6 +1842,7 @@
1692
1842
 
1693
1843
 
1694
1844
 
1845
+
1695
1846
  </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-number-style">
1696
1847
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1697
1848
 
@@ -1713,6 +1864,7 @@
1713
1864
 
1714
1865
 
1715
1866
 
1867
+
1716
1868
  </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-body-style">
1717
1869
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1718
1870
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1728,6 +1880,7 @@
1728
1880
 
1729
1881
 
1730
1882
 
1883
+
1731
1884
  </xsl:attribute-set><xsl:attribute-set name="references-non-normative-style">
1732
1885
 
1733
1886
 
@@ -1839,13 +1992,13 @@
1839
1992
 
1840
1993
  </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">
1841
1994
  <xsl:variable name="nodes_preface_">
1842
- <xsl:for-each select="/*/*[local-name()='preface']/*">
1995
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1843
1996
  <node id="{@id}"/>
1844
1997
  </xsl:for-each>
1845
1998
  </xsl:variable>
1846
1999
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
1847
2000
 
1848
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2001
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1849
2002
  <xsl:sort select="@displayorder" data-type="number"/>
1850
2003
 
1851
2004
  <!-- process Section's title -->
@@ -1911,7 +2064,7 @@
1911
2064
  </xsl:for-each>
1912
2065
  </figures>
1913
2066
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1914
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2067
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1915
2068
  <xsl:sort select="@displayorder" data-type="number"/>
1916
2069
  <xsl:apply-templates select="."/>
1917
2070
  </xsl:for-each>
@@ -1965,7 +2118,38 @@
1965
2118
  </xsl:template><xsl:template match="*[local-name()='br']">
1966
2119
  <xsl:value-of select="$linebreak"/>
1967
2120
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
1968
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2121
+ <xsl:param name="split_keep-within-line"/>
2122
+
2123
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2124
+ <xsl:choose>
2125
+
2126
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2127
+ <xsl:variable name="sep">_</xsl:variable>
2128
+ <xsl:variable name="items">
2129
+ <xsl:call-template name="split">
2130
+ <xsl:with-param name="pText" select="."/>
2131
+ <xsl:with-param name="sep" select="$sep"/>
2132
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2133
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2134
+ </xsl:call-template>
2135
+ </xsl:variable>
2136
+ <xsl:for-each select="xalan:nodeset($items)/item">
2137
+ <xsl:choose>
2138
+ <xsl:when test=". = $sep">
2139
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2140
+ </xsl:when>
2141
+ <xsl:otherwise>
2142
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2143
+ </xsl:otherwise>
2144
+ </xsl:choose>
2145
+ </xsl:for-each>
2146
+ </xsl:when>
2147
+
2148
+ <xsl:otherwise>
2149
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2150
+ </xsl:otherwise>
2151
+
2152
+ </xsl:choose>
1969
2153
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
1970
2154
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
1971
2155
  <xsl:apply-templates/>
@@ -2057,9 +2241,14 @@
2057
2241
 
2058
2242
  <xsl:variable name="table">
2059
2243
 
2060
- <xsl:variable name="simple-table">
2061
- <xsl:call-template name="getSimpleTable"/>
2244
+ <xsl:variable name="simple-table">
2245
+ <xsl:call-template name="getSimpleTable">
2246
+ <xsl:with-param name="id" select="@id"/>
2247
+ </xsl:call-template>
2062
2248
  </xsl:variable>
2249
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2250
+
2251
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2063
2252
 
2064
2253
 
2065
2254
  <!-- Display table's name before table as standalone block -->
@@ -2082,7 +2271,23 @@
2082
2271
  </xsl:call-template>
2083
2272
  </xsl:if>
2084
2273
  </xsl:variable>
2085
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2274
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2275
+
2276
+ <!-- DEBUG -->
2277
+ <xsl:if test="$table_if_debug = 'true'">
2278
+ <fo:block font-size="60%">
2279
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2280
+ </fo:block>
2281
+ </xsl:if>
2282
+
2283
+
2284
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2285
+
2286
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2287
+ DEBUG
2288
+ colwidths=<xsl:copy-of select="$colwidths"/>
2289
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2290
+
2086
2291
 
2087
2292
 
2088
2293
  <xsl:variable name="margin-side">
@@ -2107,6 +2312,8 @@
2107
2312
 
2108
2313
 
2109
2314
 
2315
+
2316
+
2110
2317
 
2111
2318
 
2112
2319
 
@@ -2146,12 +2353,22 @@
2146
2353
 
2147
2354
 
2148
2355
 
2356
+
2357
+
2149
2358
  </xsl:element>
2150
2359
  </xsl:variable>
2151
2360
 
2361
+ <xsl:if test="$isGenerateTableIF = 'true'">
2362
+ <!-- to determine start of table -->
2363
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2364
+ </xsl:if>
2152
2365
 
2153
2366
  <fo:table id="{@id}">
2154
2367
 
2368
+ <xsl:if test="$isGenerateTableIF = 'true'">
2369
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2370
+ </xsl:if>
2371
+
2155
2372
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2156
2373
  <xsl:attribute name="{local-name()}">
2157
2374
  <xsl:value-of select="."/>
@@ -2165,24 +2382,47 @@
2165
2382
 
2166
2383
 
2167
2384
  <xsl:choose>
2168
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2169
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2170
- <fo:table-column column-width="{@width}"/>
2171
- </xsl:for-each>
2385
+ <xsl:when test="$isGenerateTableIF = 'true'">
2386
+ <!-- generate IF for table widths -->
2387
+ <!-- example:
2388
+ <tr>
2389
+ <td valign="top" align="left" id="tab-symdu_1_1">
2390
+ <p>Symbol</p>
2391
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2392
+ </td>
2393
+ <td valign="top" align="left" id="tab-symdu_1_2">
2394
+ <p>Description</p>
2395
+ <word id="tab-symdu_1_2_word_1">Description</word>
2396
+ </td>
2397
+ </tr>
2398
+ -->
2399
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2400
+
2172
2401
  </xsl:when>
2173
2402
  <xsl:otherwise>
2174
- <xsl:call-template name="insertTableColumnWidth">
2175
- <xsl:with-param name="colwidths" select="$colwidths"/>
2176
- </xsl:call-template>
2177
- </xsl:otherwise>
2178
- </xsl:choose>
2179
2403
 
2180
- <xsl:choose>
2181
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2182
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2183
- </xsl:when>
2184
- <xsl:otherwise>
2185
- <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 -->
2404
+ <xsl:choose>
2405
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2406
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2407
+ <fo:table-column column-width="{@width}"/>
2408
+ </xsl:for-each>
2409
+ </xsl:when>
2410
+ <xsl:otherwise>
2411
+ <xsl:call-template name="insertTableColumnWidth">
2412
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2413
+ </xsl:call-template>
2414
+ </xsl:otherwise>
2415
+ </xsl:choose>
2416
+
2417
+ <xsl:choose>
2418
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2419
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2420
+ </xsl:when>
2421
+ <xsl:otherwise>
2422
+ <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 -->
2423
+ </xsl:otherwise>
2424
+ </xsl:choose>
2425
+
2186
2426
  </xsl:otherwise>
2187
2427
  </xsl:choose>
2188
2428
 
@@ -2260,23 +2500,29 @@
2260
2500
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2261
2501
  <xsl:param name="continued"/>
2262
2502
  <xsl:if test="normalize-space() != ''">
2263
- <fo:block xsl:use-attribute-sets="table-name-style">
2264
-
2265
-
2266
-
2267
-
2503
+
2504
+
2268
2505
 
2269
- <xsl:choose>
2270
- <xsl:when test="$continued = 'true'">
2506
+ <fo:block xsl:use-attribute-sets="table-name-style">
2507
+
2271
2508
 
2272
- </xsl:when>
2273
- <xsl:otherwise>
2274
- <xsl:apply-templates/>
2275
- </xsl:otherwise>
2276
- </xsl:choose>
2277
-
2509
+
2510
+
2511
+
2512
+ <xsl:choose>
2513
+ <xsl:when test="$continued = 'true'">
2514
+
2515
+ </xsl:when>
2516
+ <xsl:otherwise>
2517
+ <xsl:apply-templates/>
2518
+ </xsl:otherwise>
2519
+ </xsl:choose>
2520
+
2521
+
2522
+ </fo:block>
2523
+
2278
2524
 
2279
- </fo:block>
2525
+
2280
2526
  </xsl:if>
2281
2527
  </xsl:template><xsl:template name="calculate-columns-numbers">
2282
2528
  <xsl:param name="table-row"/>
@@ -2285,11 +2531,22 @@
2285
2531
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2286
2532
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2287
2533
  </xsl:template><xsl:template name="calculate-column-widths">
2534
+ <xsl:param name="table"/>
2535
+ <xsl:param name="cols-count"/>
2536
+
2537
+ <xsl:call-template name="calculate-column-widths-proportional">
2538
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2539
+ <xsl:with-param name="table" select="$table"/>
2540
+ </xsl:call-template>
2541
+
2542
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2288
2543
  <xsl:param name="table"/>
2289
2544
  <xsl:param name="cols-count"/>
2290
2545
  <xsl:param name="curr-col" select="1"/>
2291
2546
  <xsl:param name="width" select="0"/>
2292
2547
 
2548
+ <!-- table=<xsl:copy-of select="$table"/> -->
2549
+
2293
2550
  <xsl:if test="$curr-col &lt;= $cols-count">
2294
2551
  <xsl:variable name="widths">
2295
2552
  <xsl:choose>
@@ -2327,10 +2584,15 @@
2327
2584
  </xsl:for-each>
2328
2585
  </xsl:when>
2329
2586
  <xsl:otherwise>
2330
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2587
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2588
+
2589
+ <!-- <table><xsl:copy-of select="$table"/></table>
2590
+ -->
2591
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2331
2592
  <xsl:variable name="td_text">
2332
2593
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2333
2594
  </xsl:variable>
2595
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2334
2596
  <xsl:variable name="words">
2335
2597
  <xsl:variable name="string_with_added_zerospaces">
2336
2598
  <xsl:call-template name="add-zero-spaces-java">
@@ -2345,6 +2607,7 @@
2345
2607
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2346
2608
  </xsl:call-template>
2347
2609
  </xsl:variable>
2610
+ <!-- words=<xsl:copy-of select="$words"/> -->
2348
2611
  <xsl:variable name="max_length">
2349
2612
  <xsl:call-template name="max_length">
2350
2613
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -2369,6 +2632,8 @@
2369
2632
  </xsl:choose>
2370
2633
  </xsl:variable>
2371
2634
 
2635
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2636
+
2372
2637
  <column>
2373
2638
  <xsl:for-each select="xalan:nodeset($widths)//width">
2374
2639
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2377,33 +2642,271 @@
2377
2642
  </xsl:if>
2378
2643
  </xsl:for-each>
2379
2644
  </column>
2380
- <xsl:call-template name="calculate-column-widths">
2645
+ <xsl:call-template name="calculate-column-widths-proportional">
2381
2646
  <xsl:with-param name="cols-count" select="$cols-count"/>
2382
2647
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2383
2648
  <xsl:with-param name="table" select="$table"/>
2384
2649
  </xsl:call-template>
2385
2650
  </xsl:if>
2386
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
2651
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2387
2652
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2388
2653
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2389
2654
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2655
+
2656
+ <!-- if all capitals english letters or digits -->
2657
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2658
+ <xsl:call-template name="repeat">
2659
+ <xsl:with-param name="char" select="'X'"/>
2660
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2661
+ </xsl:call-template>
2662
+ </xsl:if>
2390
2663
  </xsl:template><xsl:template match="text()" mode="td_text">
2391
2664
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2392
2665
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2393
2666
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2394
2667
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2395
2668
  <xsl:value-of select="@target"/>
2396
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2397
- <xsl:variable name="mathml">
2398
- <xsl:for-each select="*">
2399
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2400
- <xsl:copy-of select="."/>
2401
- </xsl:if>
2669
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2670
+ <xsl:if test="$isGenerateTableIF = 'false'">
2671
+ <xsl:variable name="mathml_">
2672
+ <xsl:for-each select="*">
2673
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2674
+ <xsl:copy-of select="."/>
2675
+ </xsl:if>
2676
+ </xsl:for-each>
2677
+ </xsl:variable>
2678
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2679
+
2680
+ <xsl:variable name="math_text">
2681
+ <xsl:value-of select="normalize-space($mathml)"/>
2682
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2683
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2684
+ </xsl:variable>
2685
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2686
+ </xsl:if>
2687
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2688
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2689
+
2690
+ <!-- via intermediate format -->
2691
+
2692
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2693
+
2694
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2695
+
2696
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2697
+
2698
+ <!-- get current table id -->
2699
+ <xsl:variable name="table_id" select="@id"/>
2700
+ <!-- find table by id in the file 'table_widths' -->
2701
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2702
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2703
+
2704
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2705
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2706
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2707
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2708
+
2709
+ <xsl:variable name="table_with_cell_widths_">
2710
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2711
+ </xsl:variable>
2712
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2713
+
2714
+ <!-- <xsl:if test="$table_if_debug = 'true'">
2715
+ <xsl:copy-of select="$table_with_cell_widths"/>
2716
+ </xsl:if> -->
2717
+
2718
+
2719
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2720
+
2721
+ <xsl:variable name="column_widths_">
2722
+ <!-- iteration of columns -->
2723
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2724
+ <xsl:variable name="pos" select="position()"/>
2725
+ <column>
2726
+ <xsl:attribute name="width_max">
2727
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2728
+ <xsl:sort select="." data-type="number" order="descending"/>
2729
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2730
+ </xsl:for-each>
2731
+ </xsl:attribute>
2732
+ <xsl:attribute name="width_min">
2733
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2734
+ <xsl:sort select="." data-type="number" order="descending"/>
2735
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2736
+ </xsl:for-each>
2737
+ </xsl:attribute>
2738
+ </column>
2402
2739
  </xsl:for-each>
2403
2740
  </xsl:variable>
2741
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2742
+
2743
+ <!-- <column_widths>
2744
+ <xsl:copy-of select="$column_widths"/>
2745
+ </column_widths> -->
2746
+
2747
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2748
+ <xsl:variable name="table_widths_">
2749
+ <table>
2750
+ <xsl:attribute name="width_max">
2751
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2752
+ </xsl:attribute>
2753
+ <xsl:attribute name="width_min">
2754
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2755
+ </xsl:attribute>
2756
+ </table>
2757
+ </xsl:variable>
2758
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2404
2759
 
2405
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2406
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2760
+ <xsl:variable name="page_width">
2761
+ <xsl:choose>
2762
+ <xsl:when test="$parent_table_page-width != ''">
2763
+ <xsl:value-of select="$parent_table_page-width"/>
2764
+ </xsl:when>
2765
+ <xsl:otherwise>
2766
+ <xsl:value-of select="@page-width"/>
2767
+ </xsl:otherwise>
2768
+ </xsl:choose>
2769
+ </xsl:variable>
2770
+
2771
+ <xsl:if test="$table_if_debug = 'true'">
2772
+ <table_width>
2773
+ <xsl:copy-of select="$table_widths"/>
2774
+ </table_width>
2775
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2776
+ </xsl:if>
2777
+
2778
+
2779
+ <!-- There are three cases: -->
2780
+ <xsl:choose>
2781
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2782
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2783
+ <!-- call old algorithm -->
2784
+ <case1/>
2785
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2786
+ <xsl:call-template name="calculate-column-widths-proportional">
2787
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2788
+ <xsl:with-param name="table" select="$table"/>
2789
+ </xsl:call-template> -->
2790
+ </xsl:when>
2791
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2792
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2793
+ <case2/>
2794
+ <autolayout/>
2795
+ <xsl:for-each select="$column_widths/column/@width_max">
2796
+ <column divider="100"><xsl:value-of select="."/></column>
2797
+ </xsl:for-each>
2798
+ </xsl:when>
2799
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2800
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2801
+ Lets also call D the difference between maximum and minimum width of the table.
2802
+ For each column, let d be the difference between maximum and minimum width of that column.
2803
+ Now set the column's width to the minimum width plus d times W over D.
2804
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2805
+ <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)">
2806
+ <!-- difference between the available space and the minimum table width -->
2807
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2808
+ <W><xsl:value-of select="$W"/></W>
2809
+ <!-- difference between maximum and minimum width of the table -->
2810
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2811
+ <D><xsl:value-of select="$D"/></D>
2812
+ <case3/>
2813
+ <autolayout/>
2814
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2815
+ <split_keep-within-line>true</split_keep-within-line>
2816
+ </xsl:if>
2817
+ <xsl:for-each select="$column_widths/column">
2818
+ <!-- difference between maximum and minimum width of that column. -->
2819
+ <xsl:variable name="d" select="@width_max - @width_min"/>
2820
+ <d><xsl:value-of select="$d"/></d>
2821
+ <width_min><xsl:value-of select="@width_min"/></width_min>
2822
+ <e><xsl:value-of select="$d * $W div $D"/></e>
2823
+ <!-- set the column's width to the minimum width plus d times W over D. -->
2824
+ <column divider="100">
2825
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
2826
+ </column>
2827
+ </xsl:for-each>
2828
+
2829
+ </xsl:when>
2830
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
2831
+ </xsl:choose>
2832
+
2833
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
2834
+
2835
+ <!-- if nested 'dl' or 'table' -->
2836
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
2837
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
2838
+
2839
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2840
+
2841
+ <xsl:variable name="parent_table_page-width_">
2842
+ <xsl:if test="$parent_table_id != ''">
2843
+ <!-- determine column number in the parent table -->
2844
+ <xsl:variable name="parent_table_column_number">
2845
+ <xsl:choose>
2846
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2847
+ <xsl:otherwise> <!-- parent is table -->
2848
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2849
+ </xsl:otherwise>
2850
+ </xsl:choose>
2851
+ </xsl:variable>
2852
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
2853
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2854
+ </xsl:if>
2855
+ </xsl:variable>
2856
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
2857
+
2858
+ <!-- get current table id -->
2859
+ <xsl:variable name="table_id" select="@id"/>
2860
+
2861
+ <xsl:choose>
2862
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
2863
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
2864
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
2865
+ </xsl:when>
2866
+ <xsl:otherwise>
2867
+ <!-- recalculate columns width based on parent table width -->
2868
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
2869
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
2870
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
2871
+ </xsl:call-template>
2872
+ </xsl:for-each>
2873
+ </xsl:otherwise>
2874
+ </xsl:choose>
2875
+
2876
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
2877
+ <xsl:copy>
2878
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
2879
+ </xsl:copy>
2880
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
2881
+ <xsl:copy>
2882
+ <xsl:copy-of select="@*"/>
2883
+
2884
+ <!-- The maximum width is given by the widest line. -->
2885
+ <xsl:attribute name="width_max">
2886
+ <xsl:for-each select="p_len">
2887
+ <xsl:sort select="." data-type="number" order="descending"/>
2888
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2889
+ </xsl:for-each>
2890
+ </xsl:attribute>
2891
+
2892
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2893
+ <xsl:variable name="width_min">
2894
+ <xsl:for-each select="word_len">
2895
+ <xsl:sort select="." data-type="number" order="descending"/>
2896
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2897
+ </xsl:for-each>
2898
+ </xsl:variable>
2899
+ <xsl:attribute name="width_min">
2900
+ <xsl:value-of select="$width_min"/>
2901
+ </xsl:attribute>
2902
+
2903
+ <xsl:if test="$width_min = 0">
2904
+ <xsl:attribute name="width_min">1</xsl:attribute>
2905
+ </xsl:if>
2906
+
2907
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
2908
+
2909
+ </xsl:copy>
2407
2910
  </xsl:template><xsl:template match="*[local-name()='thead']">
2408
2911
  <xsl:param name="cols-count"/>
2409
2912
  <fo:table-header>
@@ -2417,12 +2920,18 @@
2417
2920
  <fo:table-row>
2418
2921
  <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">
2419
2922
 
2420
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
2421
- <xsl:with-param name="continued">true</xsl:with-param>
2422
- </xsl:apply-templates>
2423
2923
 
2424
2924
 
2425
2925
 
2926
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
2927
+ <xsl:with-param name="continued">true</xsl:with-param>
2928
+ </xsl:apply-templates>
2929
+
2930
+
2931
+
2932
+
2933
+
2934
+
2426
2935
  </fo:table-cell>
2427
2936
  </fo:table-row>
2428
2937
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2488,6 +2997,7 @@
2488
2997
  </xsl:for-each>
2489
2998
  </xsl:when>
2490
2999
  <xsl:otherwise>
3000
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
2491
3001
  <xsl:call-template name="insertTableColumnWidth">
2492
3002
  <xsl:with-param name="colwidths" select="$colwidths"/>
2493
3003
  </xsl:call-template>
@@ -2522,7 +3032,10 @@
2522
3032
 
2523
3033
 
2524
3034
  <!-- fn processing -->
2525
- <xsl:call-template name="table_fn_display"/>
3035
+
3036
+ <xsl:call-template name="table_fn_display"/>
3037
+
3038
+
2526
3039
 
2527
3040
  <!-- for PAS display Notes after footnotes -->
2528
3041
 
@@ -2532,6 +3045,9 @@
2532
3045
  </fo:table-body>
2533
3046
 
2534
3047
  </fo:table>
3048
+
3049
+
3050
+
2535
3051
  </xsl:if>
2536
3052
  </xsl:template><xsl:template match="*[local-name()='tbody']">
2537
3053
 
@@ -2567,6 +3083,52 @@
2567
3083
 
2568
3084
  </fo:table-body>
2569
3085
 
3086
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3087
+ <xsl:param name="table_or_dl">table</xsl:param>
3088
+ <xsl:apply-templates mode="process_table-if">
3089
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3090
+ </xsl:apply-templates>
3091
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3092
+ <xsl:param name="table_or_dl">table</xsl:param>
3093
+
3094
+ <fo:table-body>
3095
+ <xsl:for-each select="*[local-name() = 'tr']">
3096
+ <xsl:variable name="col_count" select="count(*)"/>
3097
+
3098
+ <!-- iteration for each tr/td -->
3099
+
3100
+ <xsl:choose>
3101
+ <xsl:when test="$table_or_dl = 'table'">
3102
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3103
+ <fo:table-row number-columns-spanned="{$col_count}">
3104
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3105
+ <xsl:call-template name="td"/>
3106
+ </fo:table-row>
3107
+ </xsl:for-each>
3108
+ </xsl:when>
3109
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3110
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3111
+ <xsl:variable name="is_dt" select="position() = 1"/>
3112
+
3113
+ <xsl:for-each select="*">
3114
+ <!-- <test><xsl:copy-of select="."/></test> -->
3115
+ <fo:table-row number-columns-spanned="{$col_count}">
3116
+ <xsl:choose>
3117
+ <xsl:when test="$is_dt">
3118
+ <xsl:call-template name="insert_dt_cell"/>
3119
+ </xsl:when>
3120
+ <xsl:otherwise>
3121
+ <xsl:call-template name="insert_dd_cell"/>
3122
+ </xsl:otherwise>
3123
+ </xsl:choose>
3124
+ </fo:table-row>
3125
+ </xsl:for-each>
3126
+ </xsl:for-each>
3127
+ </xsl:otherwise>
3128
+ </xsl:choose>
3129
+
3130
+ </xsl:for-each>
3131
+ </fo:table-body>
2570
3132
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2571
3133
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2572
3134
 
@@ -2574,6 +3136,9 @@
2574
3136
 
2575
3137
 
2576
3138
 
3139
+
3140
+
3141
+
2577
3142
 
2578
3143
 
2579
3144
  <xsl:call-template name="setTableRowAttributes"/>
@@ -2593,6 +3158,8 @@
2593
3158
 
2594
3159
 
2595
3160
 
3161
+
3162
+
2596
3163
  <xsl:call-template name="setTableRowAttributes"/>
2597
3164
  <xsl:apply-templates/>
2598
3165
  </fo:table-row>
@@ -2653,7 +3220,7 @@
2653
3220
  </xsl:choose>
2654
3221
  </xsl:attribute>
2655
3222
  </xsl:if>
2656
- </xsl:template><xsl:template match="*[local-name()='td']">
3223
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2657
3224
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2658
3225
  <xsl:call-template name="setTextAlignment">
2659
3226
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2674,6 +3241,8 @@
2674
3241
 
2675
3242
 
2676
3243
 
3244
+
3245
+
2677
3246
 
2678
3247
 
2679
3248
 
@@ -2687,11 +3256,24 @@
2687
3256
 
2688
3257
  <xsl:call-template name="setTableCellAttributes"/>
2689
3258
 
3259
+ <xsl:if test="$isGenerateTableIF = 'true'">
3260
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3261
+ <xsl:attribute name="text-align">left</xsl:attribute>
3262
+ </xsl:if>
3263
+
2690
3264
  <fo:block>
2691
3265
 
3266
+ <xsl:if test="$isGenerateTableIF = 'true'">
3267
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3268
+ </xsl:if>
3269
+
3270
+
2692
3271
 
2693
3272
 
2694
3273
  <xsl:apply-templates/>
3274
+
3275
+ <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"/> -->
3276
+
2695
3277
  </fo:block>
2696
3278
  </fo:table-cell>
2697
3279
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -2732,7 +3314,11 @@
2732
3314
 
2733
3315
  <xsl:variable name="gen_id" select="generate-id(.)"/>
2734
3316
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2735
- <xsl:variable name="reference" select="@reference"/>
3317
+ <xsl:variable name="reference_">
3318
+ <xsl:value-of select="@reference"/>
3319
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
3320
+ </xsl:variable>
3321
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
2736
3322
  <!-- fn sequence number in document -->
2737
3323
  <xsl:variable name="current_fn_number">
2738
3324
  <xsl:choose>
@@ -2807,7 +3393,7 @@
2807
3393
  <xsl:copy-of select="node()"/>
2808
3394
  </fn>
2809
3395
  </xsl:for-each>
2810
- <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']/*">
3396
+ <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']/*">
2811
3397
  <xsl:sort select="@displayorder" data-type="number"/>
2812
3398
  <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])]">
2813
3399
  <!-- copy unique fn -->
@@ -2888,9 +3474,9 @@
2888
3474
  <!-- current hierarchy is 'figure' element -->
2889
3475
  <xsl:variable name="following_dl_colwidths">
2890
3476
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2891
- <xsl:variable name="html-table">
2892
- <xsl:variable name="doc_ns">
2893
-
3477
+ <xsl:variable name="simple-table">
3478
+ <!-- <xsl:variable name="doc_ns">
3479
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
2894
3480
  </xsl:variable>
2895
3481
  <xsl:variable name="ns">
2896
3482
  <xsl:choose>
@@ -2901,7 +3487,7 @@
2901
3487
  <xsl:value-of select="substring-before(name(/*), '-')"/>
2902
3488
  </xsl:otherwise>
2903
3489
  </xsl:choose>
2904
- </xsl:variable>
3490
+ </xsl:variable> -->
2905
3491
 
2906
3492
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2907
3493
  <tbody>
@@ -2912,7 +3498,7 @@
2912
3498
 
2913
3499
  <xsl:call-template name="calculate-column-widths">
2914
3500
  <xsl:with-param name="cols-count" select="2"/>
2915
- <xsl:with-param name="table" select="$html-table"/>
3501
+ <xsl:with-param name="table" select="$simple-table"/>
2916
3502
  </xsl:call-template>
2917
3503
 
2918
3504
  </xsl:if>
@@ -3087,12 +3673,31 @@
3087
3673
 
3088
3674
 
3089
3675
 
3676
+
3677
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3678
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3679
+ </xsl:if>
3680
+
3090
3681
  <fo:block>
3091
3682
 
3092
3683
 
3093
3684
 
3094
3685
 
3686
+ <xsl:apply-templates select="*[local-name() = 'name']">
3687
+ <xsl:with-param name="process">true</xsl:with-param>
3688
+ </xsl:apply-templates>
3689
+
3690
+ <xsl:if test="$isGenerateTableIF = 'true'">
3691
+ <!-- to determine start of table -->
3692
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3693
+ </xsl:if>
3694
+
3095
3695
  <fo:table width="95%" table-layout="fixed">
3696
+
3697
+ <xsl:if test="$isGenerateTableIF = 'true'">
3698
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3699
+ </xsl:if>
3700
+
3096
3701
 
3097
3702
  <xsl:choose>
3098
3703
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3101,69 +3706,173 @@
3101
3706
 
3102
3707
  </xsl:when>
3103
3708
  </xsl:choose>
3104
- <!-- create virtual html table for dl/[dt and dd] -->
3105
- <xsl:variable name="html-table">
3106
- <xsl:variable name="doc_ns">
3709
+
3710
+
3711
+
3712
+ <xsl:choose>
3713
+ <xsl:when test="$isGenerateTableIF = 'true'">
3714
+ <!-- generate IF for table widths -->
3715
+ <!-- example:
3716
+ <tr>
3717
+ <td valign="top" align="left" id="tab-symdu_1_1">
3718
+ <p>Symbol</p>
3719
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3720
+ </td>
3721
+ <td valign="top" align="left" id="tab-symdu_1_2">
3722
+ <p>Description</p>
3723
+ <word id="tab-symdu_1_2_word_1">Description</word>
3724
+ </td>
3725
+ </tr>
3726
+ -->
3107
3727
 
3108
- </xsl:variable>
3109
- <xsl:variable name="ns">
3110
- <xsl:choose>
3111
- <xsl:when test="normalize-space($doc_ns) != ''">
3112
- <xsl:value-of select="normalize-space($doc_ns)"/>
3113
- </xsl:when>
3114
- <xsl:otherwise>
3115
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3116
- </xsl:otherwise>
3117
- </xsl:choose>
3118
- </xsl:variable>
3119
- <tbody>
3120
- <xsl:apply-templates mode="dl"/>
3121
- </tbody>
3122
- </xsl:variable>
3123
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3124
- <xsl:variable name="colwidths">
3125
- <xsl:call-template name="calculate-column-widths">
3126
- <xsl:with-param name="cols-count" select="2"/>
3127
- <xsl:with-param name="table" select="$html-table"/>
3128
- </xsl:call-template>
3129
- </xsl:variable>
3130
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3131
- <xsl:variable name="maxlength_dt">
3132
- <xsl:call-template name="getMaxLength_dt"/>
3133
- </xsl:variable>
3134
- <xsl:variable name="isContainsKeepTogetherTag_">
3135
- false
3136
- </xsl:variable>
3137
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3138
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3139
- <xsl:call-template name="setColumnWidth_dl">
3140
- <xsl:with-param name="colwidths" select="$colwidths"/>
3141
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3142
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3143
- </xsl:call-template>
3728
+ <!-- create virtual html table for dl/[dt and dd] -->
3729
+ <xsl:variable name="simple-table">
3730
+
3731
+ <xsl:variable name="dl_table">
3732
+ <tbody>
3733
+ <xsl:apply-templates mode="dl_if">
3734
+ <xsl:with-param name="id" select="@id"/>
3735
+ </xsl:apply-templates>
3736
+ </tbody>
3737
+ </xsl:variable>
3738
+
3739
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3740
+
3741
+ <!-- Step: replace <br/> to <p>...</p> -->
3742
+ <xsl:variable name="table_without_br">
3743
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3744
+ </xsl:variable>
3745
+
3746
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3747
+
3748
+ <!-- Step: add id to each cell -->
3749
+ <!-- add <word>...</word> for each word, image, math -->
3750
+ <xsl:variable name="simple-table-id">
3751
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3752
+ <xsl:with-param name="id" select="@id"/>
3753
+ </xsl:apply-templates>
3754
+ </xsl:variable>
3755
+
3756
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3757
+
3758
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3759
+
3760
+ </xsl:variable>
3761
+
3762
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3763
+
3764
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3765
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3766
+ </xsl:apply-templates>
3767
+
3768
+ </xsl:when>
3769
+ <xsl:otherwise>
3144
3770
 
3145
- <fo:table-body>
3146
- <xsl:apply-templates>
3147
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3148
- </xsl:apply-templates>
3149
- </fo:table-body>
3771
+ <xsl:variable name="simple-table">
3772
+
3773
+ <xsl:variable name="dl_table">
3774
+ <tbody>
3775
+ <xsl:apply-templates mode="dl">
3776
+ <xsl:with-param name="id" select="@id"/>
3777
+ </xsl:apply-templates>
3778
+ </tbody>
3779
+ </xsl:variable>
3780
+
3781
+ <xsl:copy-of select="$dl_table"/>
3782
+ </xsl:variable>
3783
+
3784
+ <xsl:variable name="colwidths">
3785
+ <xsl:call-template name="calculate-column-widths">
3786
+ <xsl:with-param name="cols-count" select="2"/>
3787
+ <xsl:with-param name="table" select="$simple-table"/>
3788
+ </xsl:call-template>
3789
+ </xsl:variable>
3790
+
3791
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3792
+ DEBUG
3793
+ colwidths=<xsl:copy-of select="$colwidths"/>
3794
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3795
+
3796
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3797
+
3798
+ <xsl:variable name="maxlength_dt">
3799
+ <xsl:call-template name="getMaxLength_dt"/>
3800
+ </xsl:variable>
3801
+
3802
+ <xsl:variable name="isContainsKeepTogetherTag_">
3803
+ false
3804
+ </xsl:variable>
3805
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3806
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3807
+
3808
+
3809
+ <xsl:call-template name="setColumnWidth_dl">
3810
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3811
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3812
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3813
+ </xsl:call-template>
3814
+
3815
+ <fo:table-body>
3816
+
3817
+ <!-- DEBUG -->
3818
+ <xsl:if test="$table_if_debug = 'true'">
3819
+ <fo:table-row>
3820
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
3821
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3822
+ </fo:table-cell>
3823
+ </fo:table-row>
3824
+ </xsl:if>
3825
+
3826
+ <xsl:apply-templates>
3827
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3828
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
3829
+ </xsl:apply-templates>
3830
+
3831
+ </fo:table-body>
3832
+ </xsl:otherwise>
3833
+ </xsl:choose>
3150
3834
  </fo:table>
3151
3835
  </fo:block>
3152
3836
  </fo:block>
3153
3837
  </xsl:if> <!-- END: a few components -->
3154
3838
  </fo:block-container>
3155
3839
  </fo:block-container>
3840
+
3841
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
3842
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
3843
+ </xsl:if>
3844
+
3845
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3846
+ <xsl:param name="process">false</xsl:param>
3847
+ <xsl:if test="$process = 'true'">
3848
+ <fo:block xsl:use-attribute-sets="dl-name-style">
3849
+ <xsl:apply-templates/>
3850
+ </fo:block>
3851
+ </xsl:if>
3156
3852
  </xsl:template><xsl:template name="setColumnWidth_dl">
3157
3853
  <xsl:param name="colwidths"/>
3158
3854
  <xsl:param name="maxlength_dt"/>
3159
3855
  <xsl:param name="isContainsKeepTogetherTag"/>
3856
+
3857
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
3858
+
3160
3859
  <xsl:choose>
3860
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3861
+ <xsl:call-template name="insertTableColumnWidth">
3862
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3863
+ </xsl:call-template>
3864
+ </xsl:when>
3161
3865
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3162
3866
  <fo:table-column column-width="50%"/>
3163
3867
  <fo:table-column column-width="50%"/>
3164
3868
  </xsl:when>
3165
3869
  <xsl:otherwise>
3166
3870
  <xsl:choose>
3871
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3872
+ <xsl:call-template name="insertTableColumnWidth">
3873
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3874
+ </xsl:call-template>
3875
+ </xsl:when>
3167
3876
  <xsl:when test="$isContainsKeepTogetherTag">
3168
3877
  <xsl:call-template name="insertTableColumnWidth">
3169
3878
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3208,13 +3917,19 @@
3208
3917
  </xsl:choose>
3209
3918
  </xsl:template><xsl:template name="insertTableColumnWidth">
3210
3919
  <xsl:param name="colwidths"/>
3920
+
3211
3921
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3212
3922
  <xsl:choose>
3213
3923
  <xsl:when test=". = 1 or . = 0">
3214
3924
  <fo:table-column column-width="proportional-column-width(2)"/>
3215
3925
  </xsl:when>
3216
3926
  <xsl:otherwise>
3217
- <fo:table-column column-width="proportional-column-width({.})"/>
3927
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
3928
+ <xsl:variable name="divider">
3929
+ <xsl:value-of select="@divider"/>
3930
+ <xsl:if test="not(@divider)">1</xsl:if>
3931
+ </xsl:variable>
3932
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3218
3933
  </xsl:otherwise>
3219
3934
  </xsl:choose>
3220
3935
  </xsl:for-each>
@@ -3276,11 +3991,19 @@
3276
3991
  </fo:table-cell>
3277
3992
  </fo:table-row>
3278
3993
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3994
+ <xsl:param name="id"/>
3995
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3279
3996
  <tr>
3280
3997
  <td>
3998
+ <xsl:attribute name="id">
3999
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4000
+ </xsl:attribute>
3281
4001
  <xsl:apply-templates/>
3282
4002
  </td>
3283
4003
  <td>
4004
+ <xsl:attribute name="id">
4005
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4006
+ </xsl:attribute>
3284
4007
 
3285
4008
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3286
4009
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3289,52 +4012,136 @@
3289
4012
  </td>
3290
4013
  </tr>
3291
4014
 
3292
- </xsl:template><xsl:template match="*[local-name()='dt']">
3293
- <xsl:param name="key_iso"/>
4015
+ </xsl:template><xsl:template match="*[local-name()='dt']">
4016
+ <xsl:param name="key_iso"/>
4017
+ <xsl:param name="split_keep-within-line"/>
4018
+
4019
+ <fo:table-row xsl:use-attribute-sets="dt-row-style">
4020
+ <xsl:call-template name="insert_dt_cell">
4021
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4022
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4023
+ </xsl:call-template>
4024
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4025
+ <xsl:call-template name="insert_dd_cell">
4026
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4027
+ </xsl:call-template>
4028
+ </xsl:for-each>
4029
+ </fo:table-row>
4030
+ </xsl:template><xsl:template name="insert_dt_cell">
4031
+ <xsl:param name="key_iso"/>
4032
+ <xsl:param name="split_keep-within-line"/>
4033
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4034
+
4035
+ <xsl:if test="$isGenerateTableIF = 'true'">
4036
+ <!-- border is mandatory, to calculate real width -->
4037
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4038
+ <xsl:attribute name="text-align">left</xsl:attribute>
4039
+ </xsl:if>
4040
+
4041
+
4042
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4043
+ <xsl:copy-of select="@id"/>
4044
+
4045
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4046
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4047
+ </xsl:if>
4048
+
4049
+
4050
+
4051
+ <xsl:apply-templates>
4052
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4053
+ </xsl:apply-templates>
4054
+
4055
+ <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"/> -->
4056
+
4057
+ </fo:block>
4058
+ </fo:table-cell>
4059
+ </xsl:template><xsl:template name="insert_dd_cell">
4060
+ <xsl:param name="split_keep-within-line"/>
4061
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4062
+
4063
+ <xsl:if test="$isGenerateTableIF = 'true'">
4064
+ <!-- border is mandatory, to calculate real width -->
4065
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4066
+ </xsl:if>
3294
4067
 
3295
- <fo:table-row xsl:use-attribute-sets="dt-row-style">
3296
- <fo:table-cell>
4068
+ <fo:block>
4069
+
4070
+ <xsl:if test="$isGenerateTableIF = 'true'">
4071
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4072
+ </xsl:if>
4073
+
3297
4074
 
3298
- <fo:block xsl:use-attribute-sets="dt-style">
3299
- <xsl:copy-of select="@id"/>
3300
-
3301
- <xsl:if test="normalize-space($key_iso) = 'true'">
3302
- <xsl:attribute name="margin-top">0</xsl:attribute>
3303
- </xsl:if>
3304
-
3305
-
3306
-
3307
- <xsl:apply-templates/>
3308
- </fo:block>
3309
- </fo:table-cell>
3310
- <fo:table-cell>
3311
- <fo:block>
3312
-
3313
4075
 
3314
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3315
- <xsl:with-param name="process">true</xsl:with-param>
3316
- </xsl:apply-templates>
3317
- </fo:block>
3318
- </fo:table-cell>
3319
- </fo:table-row>
4076
+ <xsl:choose>
4077
+ <xsl:when test="$isGenerateTableIF = 'true'">
4078
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4079
+ <xsl:with-param name="process">true</xsl:with-param>
4080
+ </xsl:apply-templates>
4081
+ </xsl:when>
4082
+ <xsl:otherwise>
4083
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4084
+ <xsl:with-param name="process">true</xsl:with-param>
4085
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4086
+ </xsl:apply-templates>
4087
+ </xsl:otherwise>
4088
+
4089
+ </xsl:choose>
4090
+
4091
+ <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"/> -->
4092
+
4093
+ </fo:block>
4094
+ </fo:table-cell>
3320
4095
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3321
4096
  <xsl:apply-templates/>
3322
4097
  </xsl:template><xsl:template match="*[local-name()='dd']">
3323
4098
  <xsl:param name="process">false</xsl:param>
4099
+ <xsl:param name="split_keep-within-line"/>
3324
4100
  <xsl:if test="$process = 'true'">
3325
4101
  <xsl:apply-templates select="@language"/>
3326
- <xsl:apply-templates/>
4102
+ <xsl:apply-templates>
4103
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4104
+ </xsl:apply-templates>
3327
4105
  </xsl:if>
3328
4106
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3329
4107
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3330
- </xsl:template><xsl:template match="*[local-name()='em']">
4108
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4109
+ <xsl:param name="id"/>
4110
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4111
+ <tr>
4112
+ <td>
4113
+ <xsl:copy-of select="node()"/>
4114
+ </td>
4115
+ <td>
4116
+
4117
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4118
+
4119
+ <!-- get paragraphs from nested 'dl' -->
4120
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4121
+
4122
+
4123
+ </td>
4124
+ </tr>
4125
+
4126
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4127
+ <xsl:for-each select="*[local-name() = 'dt']">
4128
+ <p>
4129
+ <xsl:copy-of select="node()"/>
4130
+ <xsl:text> </xsl:text>
4131
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4132
+ </p>
4133
+ </xsl:for-each>
4134
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
3331
4135
  <fo:inline font-style="italic">
3332
4136
  <xsl:apply-templates/>
3333
4137
  </fo:inline>
3334
4138
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4139
+ <xsl:param name="split_keep-within-line"/>
3335
4140
  <fo:inline font-weight="bold">
3336
4141
 
3337
- <xsl:apply-templates/>
4142
+ <xsl:apply-templates>
4143
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4144
+ </xsl:apply-templates>
3338
4145
  </fo:inline>
3339
4146
  </xsl:template><xsl:template match="*[local-name()='padding']">
3340
4147
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3355,7 +4162,7 @@
3355
4162
 
3356
4163
 
3357
4164
 
3358
-
4165
+ <!-- 10 -->
3359
4166
 
3360
4167
 
3361
4168
 
@@ -3535,6 +4342,10 @@
3535
4342
  <xsl:param name="text"/>
3536
4343
  <xsl:param name="separator" select="' '"/>
3537
4344
  <xsl:choose>
4345
+
4346
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4347
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4348
+ </xsl:when>
3538
4349
  <xsl:when test="not(contains($text, $separator))">
3539
4350
  <word>
3540
4351
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -3579,13 +4390,66 @@
3579
4390
  </xsl:when>
3580
4391
  <xsl:otherwise>
3581
4392
  <word>
3582
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4393
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4394
+ <xsl:choose>
4395
+ <xsl:when test="$isGenerateTableIF = 'true'">
4396
+ <xsl:value-of select="$word"/>
4397
+ </xsl:when>
4398
+ <xsl:otherwise>
4399
+ <xsl:value-of select="string-length($word)"/>
4400
+ </xsl:otherwise>
4401
+ </xsl:choose>
3583
4402
  </word>
3584
4403
  <xsl:call-template name="tokenize">
3585
4404
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3586
4405
  </xsl:call-template>
3587
4406
  </xsl:otherwise>
3588
4407
  </xsl:choose>
4408
+ </xsl:template><xsl:template name="tokenize_with_tags">
4409
+ <xsl:param name="tags"/>
4410
+ <xsl:param name="text"/>
4411
+ <xsl:param name="separator" select="' '"/>
4412
+ <xsl:choose>
4413
+
4414
+ <xsl:when test="not(contains($text, $separator))">
4415
+ <word>
4416
+ <xsl:call-template name="enclose_text_in_tags">
4417
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4418
+ <xsl:with-param name="tags" select="$tags"/>
4419
+ </xsl:call-template>
4420
+ </word>
4421
+ </xsl:when>
4422
+ <xsl:otherwise>
4423
+ <word>
4424
+ <xsl:call-template name="enclose_text_in_tags">
4425
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4426
+ <xsl:with-param name="tags" select="$tags"/>
4427
+ </xsl:call-template>
4428
+ </word>
4429
+ <xsl:call-template name="tokenize_with_tags">
4430
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4431
+ </xsl:call-template>
4432
+ </xsl:otherwise>
4433
+ </xsl:choose>
4434
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4435
+ <xsl:param name="text"/>
4436
+ <xsl:param name="tags"/>
4437
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4438
+
4439
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4440
+
4441
+ <xsl:choose>
4442
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4443
+ <xsl:otherwise>
4444
+ <xsl:element name="{$tag_name}">
4445
+ <xsl:call-template name="enclose_text_in_tags">
4446
+ <xsl:with-param name="text" select="$text"/>
4447
+ <xsl:with-param name="tags" select="$tags"/>
4448
+ <xsl:with-param name="num" select="$num + 1"/>
4449
+ </xsl:call-template>
4450
+ </xsl:element>
4451
+ </xsl:otherwise>
4452
+ </xsl:choose>
3589
4453
  </xsl:template><xsl:template name="max_length">
3590
4454
  <xsl:param name="words"/>
3591
4455
  <xsl:for-each select="$words//word">
@@ -3686,12 +4550,19 @@
3686
4550
  </xsl:otherwise>
3687
4551
  </xsl:choose>
3688
4552
  </xsl:template><xsl:template name="getSimpleTable">
4553
+ <xsl:param name="id"/>
4554
+
3689
4555
  <xsl:variable name="simple-table">
3690
4556
 
4557
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4558
+ <xsl:variable name="table_without_br">
4559
+ <xsl:apply-templates mode="table-without-br"/>
4560
+ </xsl:variable>
4561
+
3691
4562
  <!-- Step 1. colspan processing -->
3692
4563
  <xsl:variable name="simple-table-colspan">
3693
4564
  <tbody>
3694
- <xsl:apply-templates mode="simple-table-colspan"/>
4565
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3695
4566
  </tbody>
3696
4567
  </xsl:variable>
3697
4568
 
@@ -3700,10 +4571,67 @@
3700
4571
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3701
4572
  </xsl:variable>
3702
4573
 
3703
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3704
-
4574
+ <!-- Step 3: add id to each cell -->
4575
+ <!-- add <word>...</word> for each word, image, math -->
4576
+ <xsl:variable name="simple-table-id">
4577
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4578
+ <xsl:with-param name="id" select="$id"/>
4579
+ </xsl:apply-templates>
4580
+ </xsl:variable>
4581
+
4582
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4583
+
3705
4584
  </xsl:variable>
3706
4585
  <xsl:copy-of select="$simple-table"/>
4586
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4587
+ <xsl:copy>
4588
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4589
+ </xsl:copy>
4590
+ </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">
4591
+ <xsl:copy>
4592
+ <xsl:copy-of select="@*"/>
4593
+ <p>
4594
+ <xsl:copy-of select="node()"/>
4595
+ </p>
4596
+ </xsl:copy>
4597
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4598
+ <xsl:copy>
4599
+ <xsl:copy-of select="@*"/>
4600
+ <xsl:for-each select="*[local-name()='br']">
4601
+ <xsl:variable name="current_id" select="generate-id()"/>
4602
+ <p>
4603
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4604
+ <xsl:copy-of select="."/>
4605
+ </xsl:for-each>
4606
+ </p>
4607
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4608
+ <p>
4609
+ <xsl:for-each select="following-sibling::node()">
4610
+ <xsl:copy-of select="."/>
4611
+ </xsl:for-each>
4612
+ </p>
4613
+ </xsl:if>
4614
+ </xsl:for-each>
4615
+ </xsl:copy>
4616
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4617
+ <xsl:for-each select="*[local-name()='br']">
4618
+ <xsl:variable name="current_id" select="generate-id()"/>
4619
+ <p>
4620
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4621
+ <xsl:copy-of select="."/>
4622
+ </xsl:for-each>
4623
+ </p>
4624
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4625
+ <p>
4626
+ <xsl:for-each select="following-sibling::node()">
4627
+ <xsl:copy-of select="."/>
4628
+ </xsl:for-each>
4629
+ </p>
4630
+ </xsl:if>
4631
+ </xsl:for-each>
4632
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4633
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4634
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3707
4635
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3708
4636
  <xsl:apply-templates mode="simple-table-colspan"/>
3709
4637
  </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">
@@ -3793,6 +4721,126 @@
3793
4721
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3794
4722
  <xsl:with-param name="previousRow" select="$newRow"/>
3795
4723
  </xsl:apply-templates>
4724
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4725
+ <xsl:param name="id"/>
4726
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4727
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4728
+ <xsl:with-param name="id" select="$id_prefixed"/>
4729
+ </xsl:apply-templates>
4730
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4731
+ <xsl:param name="id"/>
4732
+ <xsl:copy>
4733
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4734
+ <xsl:with-param name="id" select="$id"/>
4735
+ </xsl:apply-templates>
4736
+ </xsl:copy>
4737
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4738
+ <xsl:param name="id"/>
4739
+ <xsl:copy>
4740
+ <xsl:copy-of select="@*"/>
4741
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4742
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4743
+ <xsl:with-param name="id" select="$id"/>
4744
+ </xsl:apply-templates>
4745
+ </xsl:copy>
4746
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4747
+ <xsl:param name="id"/>
4748
+ <xsl:copy>
4749
+ <xsl:copy-of select="@*"/>
4750
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4751
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4752
+ <xsl:attribute name="id">
4753
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4754
+ </xsl:attribute>
4755
+
4756
+ <xsl:for-each select="*[local-name() = 'p']">
4757
+ <xsl:copy>
4758
+ <xsl:copy-of select="@*"/>
4759
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4760
+ <xsl:attribute name="id">
4761
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4762
+ </xsl:attribute>
4763
+
4764
+ <xsl:copy-of select="node()"/>
4765
+ </xsl:copy>
4766
+ </xsl:for-each>
4767
+
4768
+
4769
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4770
+
4771
+ <xsl:variable name="td_text">
4772
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4773
+ </xsl:variable>
4774
+
4775
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4776
+
4777
+ <xsl:variable name="words">
4778
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4779
+ <word>
4780
+ <xsl:copy-of select="."/>
4781
+ </word>
4782
+ </xsl:for-each>
4783
+
4784
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4785
+ <xsl:copy-of select="."/>
4786
+ </xsl:for-each>
4787
+
4788
+ </xsl:variable>
4789
+
4790
+ <xsl:for-each select="xalan:nodeset($words)/word">
4791
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4792
+ <xsl:copy>
4793
+ <xsl:attribute name="id">
4794
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4795
+ </xsl:attribute>
4796
+ <xsl:copy-of select="node()"/>
4797
+ </xsl:copy>
4798
+ </xsl:for-each>
4799
+ </xsl:if>
4800
+ </xsl:copy>
4801
+
4802
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
4803
+ <xsl:copy>
4804
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
4805
+ </xsl:copy>
4806
+ </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">
4807
+ <xsl:variable name="formatting_tags">
4808
+ <xsl:call-template name="getFormattingTags"/>
4809
+ </xsl:variable>
4810
+ <word>
4811
+ <xsl:call-template name="enclose_text_in_tags">
4812
+ <xsl:with-param name="text" select="normalize-space(.)"/>
4813
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4814
+ </xsl:call-template>
4815
+ </word>
4816
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
4817
+
4818
+ <xsl:variable name="td_text" select="."/>
4819
+
4820
+ <xsl:variable name="string_with_added_zerospaces">
4821
+ <xsl:call-template name="add-zero-spaces-java">
4822
+ <xsl:with-param name="text" select="$td_text"/>
4823
+ </xsl:call-template>
4824
+ </xsl:variable>
4825
+
4826
+ <xsl:variable name="formatting_tags">
4827
+ <xsl:call-template name="getFormattingTags"/>
4828
+ </xsl:variable>
4829
+
4830
+ <!-- <word>text</word> -->
4831
+ <xsl:call-template name="tokenize_with_tags">
4832
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4833
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4834
+ </xsl:call-template>
4835
+ </xsl:template><xsl:template name="getFormattingTags">
4836
+ <tags>
4837
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
4838
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
4839
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
4840
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
4841
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
4842
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
4843
+ </tags>
3796
4844
  </xsl:template><xsl:template name="getLang">
3797
4845
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3798
4846
  <xsl:variable name="language">
@@ -3986,6 +5034,11 @@
3986
5034
  </xsl:variable>
3987
5035
  <fo:inline xsl:use-attribute-sets="link-style">
3988
5036
 
5037
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5038
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5039
+ </xsl:if>
5040
+
5041
+
3989
5042
 
3990
5043
 
3991
5044
 
@@ -4246,7 +5299,19 @@
4246
5299
  <xsl:value-of select="$suffix"/>
4247
5300
  </xsl:if>
4248
5301
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
4249
- <fo:inline><xsl:apply-templates/></fo:inline>
5302
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5303
+ <xsl:choose>
5304
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
5305
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
5306
+ <xsl:apply-templates/>
5307
+ </fo:inline>
5308
+ </xsl:when>
5309
+ <xsl:otherwise>
5310
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
5311
+ <xsl:apply-templates/>
5312
+ </fo:block>
5313
+ </xsl:otherwise>
5314
+ </xsl:choose>
4250
5315
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
4251
5316
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
4252
5317
  <fo:block id="{@id}">
@@ -5063,7 +6128,7 @@
5063
6128
  </xsl:choose>
5064
6129
  </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">
5065
6130
  <xsl:value-of select="."/>
5066
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6131
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5067
6132
  <xsl:text> </xsl:text>
5068
6133
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5069
6134
  <xsl:copy>
@@ -5134,7 +6199,7 @@
5134
6199
 
5135
6200
 
5136
6201
 
5137
-
6202
+ <!-- 9 -->
5138
6203
 
5139
6204
 
5140
6205
 
@@ -5218,7 +6283,7 @@
5218
6283
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5219
6284
  <xsl:choose>
5220
6285
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5221
- <xsl:call-template name="interspers">
6286
+ <xsl:call-template name="interspers-java">
5222
6287
  <xsl:with-param name="str" select="."/>
5223
6288
  </xsl:call-template>
5224
6289
  </xsl:when>
@@ -5268,6 +6333,10 @@
5268
6333
  <xsl:with-param name="char" select="$char"/>
5269
6334
  </xsl:call-template>
5270
6335
  </xsl:if>
6336
+ </xsl:template><xsl:template name="interspers-java">
6337
+ <xsl:param name="str"/>
6338
+ <xsl:param name="char" select="$zero_width_space"/>
6339
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
5271
6340
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5272
6341
  <xsl:apply-templates mode="syntax_highlight"/>
5273
6342
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5480,7 +6549,9 @@
5480
6549
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5481
6550
  </xsl:if>
5482
6551
  <xsl:variable name="simple-table">
5483
- <xsl:call-template name="getSimpleTable"/>
6552
+ <xsl:call-template name="getSimpleTable">
6553
+ <xsl:with-param name="id" select="@id"/>
6554
+ </xsl:call-template>
5484
6555
  </xsl:variable>
5485
6556
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5486
6557
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -5916,6 +6987,7 @@
5916
6987
 
5917
6988
 
5918
6989
 
6990
+
5919
6991
  </xsl:variable>
5920
6992
 
5921
6993
  <xsl:variable name="padding-right">
@@ -6223,6 +7295,11 @@
6223
7295
  </xsl:otherwise>
6224
7296
  </xsl:choose>
6225
7297
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7298
+
7299
+ <xsl:apply-templates select="*[local-name() = 'name']">
7300
+ <xsl:with-param name="process">true</xsl:with-param>
7301
+ </xsl:apply-templates>
7302
+
6226
7303
  <fo:list-block xsl:use-attribute-sets="list-style">
6227
7304
 
6228
7305
 
@@ -6237,12 +7314,23 @@
6237
7314
 
6238
7315
 
6239
7316
 
7317
+ <xsl:if test="*[local-name() = 'name']">
7318
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7319
+ </xsl:if>
7320
+
6240
7321
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6241
7322
  </fo:list-block>
6242
7323
  <!-- <xsl:for-each select="./iho:note">
6243
7324
  <xsl:call-template name="note"/>
6244
7325
  </xsl:for-each> -->
6245
7326
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
7327
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
7328
+ <xsl:param name="process">false</xsl:param>
7329
+ <xsl:if test="$process = 'true'">
7330
+ <fo:block xsl:use-attribute-sets="list-name-style">
7331
+ <xsl:apply-templates/>
7332
+ </fo:block>
7333
+ </xsl:if>
6246
7334
  </xsl:template><xsl:template match="*[local-name()='li']">
6247
7335
  <fo:list-item xsl:use-attribute-sets="list-item-style">
6248
7336
  <xsl:copy-of select="@id"/>
@@ -6442,7 +7530,7 @@
6442
7530
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
6443
7531
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
6444
7532
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
6445
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
7533
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6446
7534
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6447
7535
  <!-- <row>
6448
7536
  <date>05-07-2013</date>
@@ -6513,7 +7601,7 @@
6513
7601
 
6514
7602
  </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
6515
7603
 
6516
- <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
7604
+ <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
6517
7605
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
6518
7606
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
6519
7607
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
@@ -6524,7 +7612,9 @@
6524
7612
 
6525
7613
  <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
6526
7614
  <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
6527
- <xsl:number format="[1]"/>
7615
+
7616
+ <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
7617
+
6528
7618
  </xsl:if>
6529
7619
 
6530
7620
  </fo:inline>
@@ -6546,26 +7636,23 @@
6546
7636
  <xsl:if test=".//*[local-name() = 'fn']">
6547
7637
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
6548
7638
  </xsl:if>
7639
+
7640
+ <!-- display document identifier, not number [1] -->
6549
7641
  <xsl:variable name="docidentifier">
6550
7642
  <xsl:choose>
6551
7643
  <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
6552
7644
  <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
6553
7645
  </xsl:choose>
6554
7646
  </xsl:variable>
6555
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
7647
+ <xsl:value-of select="$docidentifier"/>
7648
+
6556
7649
  <xsl:apply-templates select="*[local-name() = 'note']"/>
6557
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6558
- <xsl:choose>
6559
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
6560
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
6561
- </xsl:when>
6562
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
6563
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
6564
- </xsl:when>
6565
- <xsl:otherwise>
6566
- <xsl:apply-templates select="*[local-name() = 'title']"/>
6567
- </xsl:otherwise>
6568
- </xsl:choose>
7650
+
7651
+ <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
7652
+ <xsl:text>,</xsl:text>
7653
+ <xsl:text> </xsl:text>
7654
+ </xsl:if>
7655
+
6569
7656
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6570
7657
  <!-- end bibitem processing -->
6571
7658
 
@@ -6877,36 +7964,58 @@
6877
7964
 
6878
7965
 
6879
7966
 
7967
+ <xsl:if test="@type = 'editorial'">
7968
+ <xsl:attribute name="color">green</xsl:attribute>
7969
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
7970
+
7971
+ <!-- <xsl:variable name="note-style">
7972
+ <style xsl:use-attribute-sets="note-style"></style>
7973
+ </xsl:variable>
7974
+ <xsl:for-each select="xalan:nodeset($note-style)//style/@*">
7975
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
7976
+ </xsl:for-each> -->
7977
+ </xsl:if>
7978
+
7979
+
6880
7980
 
6881
7981
 
6882
7982
 
6883
- <xsl:call-template name="displayAdmonitionName"/>
6884
- <xsl:text> — </xsl:text>
7983
+
7984
+ <xsl:call-template name="displayAdmonitionName">
7985
+ <xsl:with-param name="sep"> — </xsl:with-param>
7986
+ </xsl:call-template>
6885
7987
 
6886
7988
 
6887
7989
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6888
7990
  </fo:block>
6889
7991
 
6890
7992
  </xsl:template><xsl:template name="displayAdmonitionName">
6891
-
7993
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
7994
+ <!-- <xsl:choose>
7995
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
7996
+ <xsl:choose>
7997
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
7998
+ <xsl:otherwise>
7999
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8000
+ </xsl:otherwise>
8001
+ </xsl:choose>
8002
+ </xsl:when>
8003
+ <xsl:otherwise>
6892
8004
  <xsl:apply-templates select="*[local-name() = 'name']"/>
6893
8005
  <xsl:if test="not(*[local-name() = 'name'])">
6894
8006
  <xsl:apply-templates select="@type"/>
6895
8007
  </xsl:if>
6896
-
6897
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
6898
- <xsl:apply-templates/>
6899
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
6900
- <xsl:variable name="admonition_type_">
6901
- <xsl:call-template name="getLocalizedString">
6902
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
6903
- </xsl:call-template>
8008
+ </xsl:otherwise>
8009
+ </xsl:choose> -->
8010
+ <xsl:variable name="name">
8011
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
6904
8012
  </xsl:variable>
6905
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
6906
- <xsl:value-of select="$admonition_type"/>
6907
- <xsl:if test="$admonition_type = ''">
6908
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
8013
+ <xsl:copy-of select="$name"/>
8014
+ <xsl:if test="normalize-space($name) != ''">
8015
+ <xsl:value-of select="$sep"/>
6909
8016
  </xsl:if>
8017
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8018
+ <xsl:apply-templates/>
6910
8019
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
6911
8020
 
6912
8021
  <fo:block xsl:use-attribute-sets="admonition-p-style">
@@ -7077,6 +8186,8 @@
7077
8186
  </xsl:when>
7078
8187
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
7079
8188
  </xsl:choose>
8189
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
8190
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
7080
8191
  </xsl:template><xsl:template name="printEdition">
7081
8192
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
7082
8193
  <xsl:text> </xsl:text>
@@ -7183,6 +8294,27 @@
7183
8294
  </xsl:when>
7184
8295
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
7185
8296
  </xsl:choose>
8297
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
8298
+ <xsl:param name="num"/>
8299
+ <xsl:variable name="monthStr">
8300
+ <xsl:choose>
8301
+ <xsl:when test="$num = '01'">january</xsl:when>
8302
+ <xsl:when test="$num = '02'">february</xsl:when>
8303
+ <xsl:when test="$num = '03'">march</xsl:when>
8304
+ <xsl:when test="$num = '04'">april</xsl:when>
8305
+ <xsl:when test="$num = '05'">may</xsl:when>
8306
+ <xsl:when test="$num = '06'">june</xsl:when>
8307
+ <xsl:when test="$num = '07'">july</xsl:when>
8308
+ <xsl:when test="$num = '08'">august</xsl:when>
8309
+ <xsl:when test="$num = '09'">september</xsl:when>
8310
+ <xsl:when test="$num = '10'">october</xsl:when>
8311
+ <xsl:when test="$num = '11'">november</xsl:when>
8312
+ <xsl:when test="$num = '12'">december</xsl:when>
8313
+ </xsl:choose>
8314
+ </xsl:variable>
8315
+ <xsl:call-template name="getLocalizedString">
8316
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
8317
+ </xsl:call-template>
7186
8318
  </xsl:template><xsl:template name="insertKeywords">
7187
8319
  <xsl:param name="sorting" select="'true'"/>
7188
8320
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -7381,6 +8513,7 @@
7381
8513
 
7382
8514
 
7383
8515
 
8516
+
7384
8517
  <xsl:value-of select="document('')//*/namespace::csd"/>
7385
8518
 
7386
8519
 
@@ -7789,4 +8922,40 @@
7789
8922
  <xsl:value-of select="$value"/>
7790
8923
  </xsl:otherwise>
7791
8924
  </xsl:choose>
8925
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
8926
+ <xsl:param name="level">0</xsl:param>
8927
+
8928
+ <fo:block margin-left="{2*$level}mm">
8929
+ <xsl:text>
8930
+ &lt;</xsl:text>
8931
+ <xsl:value-of select="local-name()"/>
8932
+ <xsl:for-each select="@*">
8933
+ <xsl:text> </xsl:text>
8934
+ <xsl:value-of select="local-name()"/>
8935
+ <xsl:text>="</xsl:text>
8936
+ <xsl:value-of select="."/>
8937
+ <xsl:text>"</xsl:text>
8938
+ </xsl:for-each>
8939
+ <xsl:text>&gt;</xsl:text>
8940
+
8941
+ <xsl:if test="not(*)">
8942
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
8943
+ <xsl:text>&lt;/</xsl:text>
8944
+ <xsl:value-of select="local-name()"/>
8945
+ <xsl:text>&gt;</xsl:text>
8946
+ </xsl:if>
8947
+ </fo:block>
8948
+
8949
+ <xsl:if test="*">
8950
+ <fo:block>
8951
+ <xsl:apply-templates mode="print_as_xml">
8952
+ <xsl:with-param name="level" select="$level + 1"/>
8953
+ </xsl:apply-templates>
8954
+ </fo:block>
8955
+ <fo:block margin-left="{2*$level}mm">
8956
+ <xsl:text>&lt;/</xsl:text>
8957
+ <xsl:value-of select="local-name()"/>
8958
+ <xsl:text>&gt;</xsl:text>
8959
+ </fo:block>
8960
+ </xsl:if>
7792
8961
  </xsl:template></xsl:stylesheet>