metanorma-ogc 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/html/htmlstyle.css +6 -0
  3. data/lib/isodoc/ogc/html/htmlstyle.scss +2 -0
  4. data/lib/isodoc/ogc/html/ogc.css +18 -12
  5. data/lib/isodoc/ogc/html/ogc.scss +16 -9
  6. data/lib/isodoc/ogc/html/ogc_wp.css +18 -12
  7. data/lib/isodoc/ogc/html/ogc_wp.scss +16 -9
  8. data/lib/isodoc/ogc/html/word_ogc_intro.html +2 -3
  9. data/lib/isodoc/ogc/html/word_ogc_intro_wp.html +1 -2
  10. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +17 -17
  11. data/lib/isodoc/ogc/i18n.rb +1 -1
  12. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1355 -329
  13. data/lib/isodoc/ogc/ogc.best-practice.xsl +1355 -329
  14. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1355 -329
  15. data/lib/isodoc/ogc/ogc.community-practice.xsl +1355 -329
  16. data/lib/isodoc/ogc/ogc.community-standard.xsl +1355 -329
  17. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1355 -329
  18. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1355 -329
  19. data/lib/isodoc/ogc/ogc.other.xsl +1355 -329
  20. data/lib/isodoc/ogc/ogc.policy.xsl +1355 -329
  21. data/lib/isodoc/ogc/ogc.reference-model.xsl +1355 -329
  22. data/lib/isodoc/ogc/ogc.release-notes.xsl +1355 -329
  23. data/lib/isodoc/ogc/ogc.standard.xsl +1355 -329
  24. data/lib/isodoc/ogc/ogc.test-suite.xsl +1355 -329
  25. data/lib/isodoc/ogc/ogc.user-guide.xsl +1355 -329
  26. data/lib/isodoc/ogc/ogc.white-paper.xsl +1339 -312
  27. data/lib/isodoc/ogc/presentation_xml_convert.rb +17 -2
  28. data/lib/isodoc/ogc/word_convert.rb +1 -1
  29. data/lib/metanorma/ogc/biblio.rng +134 -39
  30. data/lib/metanorma/ogc/isodoc.rng +16 -0
  31. data/lib/metanorma/ogc/version.rb +1 -1
  32. metadata +3 -3
@@ -252,7 +252,7 @@
252
252
 
253
253
 
254
254
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
255
- <xsl:for-each select="/*/*[local-name()='preface']/*">
255
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
256
256
  <xsl:sort select="@displayorder" data-type="number"/>
257
257
 
258
258
  <xsl:if test="local-name() = 'abstract' or local-name() = 'foreword' or local-name() = 'introduction'">
@@ -488,6 +488,7 @@
488
488
 
489
489
  <xsl:template match="ogc:p" name="paragraph">
490
490
  <xsl:param name="inline" select="'false'"/>
491
+ <xsl:param name="split_keep-within-line"/>
491
492
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
492
493
  <xsl:variable name="element-name">
493
494
  <xsl:choose>
@@ -518,7 +519,9 @@
518
519
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
519
520
  </xsl:if>
520
521
  <xsl:attribute name="line-height">115%</xsl:attribute>
521
- <xsl:apply-templates/>
522
+ <xsl:apply-templates>
523
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
524
+ </xsl:apply-templates>
522
525
  </xsl:element>
523
526
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
524
527
  <fo:block margin-bottom="12pt">
@@ -640,12 +643,41 @@
640
643
  </xsl:choose>
641
644
  </xsl:template>
642
645
 
643
- <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">
646
+ <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_">
647
+ <xsl:for-each select="$table_widths_from_if//table">
648
+ <xsl:copy>
649
+ <xsl:copy-of select="@*"/>
650
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
651
+ </xsl:copy>
652
+ </xsl:for-each>
653
+ </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_">
654
+ false
655
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
644
656
  <xsl:call-template name="getLang"/>
645
- </xsl:variable><xsl:variable name="pageWidth_">
646
- 215.9
657
+ </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_">
658
+ <xsl:choose>
659
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
660
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
661
+ </xsl:choose>
662
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
663
+ <xsl:choose>
664
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
665
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
666
+ </xsl:choose>
667
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
668
+ <xsl:choose>
669
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
670
+ <xsl:otherwise>
671
+ 215.9
672
+ </xsl:otherwise>
673
+ </xsl:choose>
647
674
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
648
- 279.4
675
+ <xsl:choose>
676
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
677
+ <xsl:otherwise>
678
+ 279.4
679
+ </xsl:otherwise>
680
+ </xsl:choose>
649
681
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
650
682
  25.4
651
683
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -759,7 +791,8 @@
759
791
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
760
792
  </xsl:otherwise>
761
793
  </xsl:choose>
762
- </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">
794
+ </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">
795
+
763
796
 
764
797
 
765
798
 
@@ -774,7 +807,8 @@
774
807
 
775
808
 
776
809
 
777
- <xsl:attribute name="font-family">Arial, STIX Two Math, Source Han Sans</xsl:attribute>
810
+ <xsl:attribute name="font-family">Arial, STIX Two Math, <xsl:value-of select="$font_noto_sans"/></xsl:attribute>
811
+ <xsl:attribute name="font-family-generic">Sans</xsl:attribute>
778
812
  <xsl:attribute name="font-size">11pt</xsl:attribute>
779
813
 
780
814
 
@@ -790,17 +824,60 @@
790
824
  </xsl:variable>
791
825
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
792
826
 
827
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
828
+
793
829
  <xsl:for-each select="$root-style_/root-style/@*">
830
+
794
831
  <xsl:choose>
795
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
832
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
833
+ <xsl:when test="local-name() = 'font-family'">
834
+
835
+ <xsl:variable name="font_regional_prefix">
836
+ <xsl:choose>
837
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
838
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
839
+ </xsl:choose>
840
+ </xsl:variable>
841
+
796
842
  <xsl:attribute name="{local-name()}">
797
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
843
+
844
+ <xsl:variable name="font_extended">
845
+ <xsl:choose>
846
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
847
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
848
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
849
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
850
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
851
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
852
+ </xsl:choose>
853
+ </xsl:variable>
854
+ <xsl:if test="normalize-space($font_extended) != ''">
855
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
856
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
857
+ </xsl:if>
858
+
859
+ <xsl:value-of select="."/>
860
+
861
+ <xsl:if test="$additional_fonts != ''">
862
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
863
+ </xsl:if>
798
864
  </xsl:attribute>
799
865
  </xsl:when>
800
866
  <xsl:otherwise>
801
867
  <xsl:copy-of select="."/>
802
868
  </xsl:otherwise>
803
869
  </xsl:choose>
870
+
871
+ <!-- <xsl:choose>
872
+ <xsl:when test="local-name() = 'font-family'">
873
+ <xsl:attribute name="{local-name()}">
874
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
875
+ </xsl:attribute>
876
+ </xsl:when>
877
+ <xsl:otherwise>
878
+ <xsl:copy-of select="."/>
879
+ </xsl:otherwise>
880
+ </xsl:choose> -->
804
881
  </xsl:for-each>
805
882
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
806
883
 
@@ -896,10 +973,11 @@
896
973
 
897
974
 
898
975
 
976
+
899
977
 
900
978
 
901
979
 
902
- <xsl:attribute name="font-family">Courier New</xsl:attribute>
980
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
903
981
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
904
982
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
905
983
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -983,6 +1061,7 @@
983
1061
 
984
1062
 
985
1063
 
1064
+
986
1065
 
987
1066
  </xsl:attribute-set><xsl:attribute-set name="example-style">
988
1067
 
@@ -994,6 +1073,7 @@
994
1073
 
995
1074
 
996
1075
 
1076
+
997
1077
  <xsl:attribute name="font-size">10pt</xsl:attribute>
998
1078
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
999
1079
  <xsl:attribute name="margin-right">12.5mm</xsl:attribute>
@@ -1021,6 +1101,7 @@
1021
1101
 
1022
1102
 
1023
1103
 
1104
+
1024
1105
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1025
1106
  <xsl:attribute name="text-align">center</xsl:attribute>
1026
1107
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1061,6 +1142,7 @@
1061
1142
 
1062
1143
  </xsl:attribute-set><xsl:variable name="table-border_">
1063
1144
 
1145
+
1064
1146
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
1065
1147
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1066
1148
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1081,6 +1163,7 @@
1081
1163
 
1082
1164
 
1083
1165
 
1166
+
1084
1167
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1085
1168
  <xsl:attribute name="space-after">12pt</xsl:attribute>
1086
1169
 
@@ -1110,6 +1193,7 @@
1110
1193
 
1111
1194
 
1112
1195
 
1196
+
1113
1197
 
1114
1198
 
1115
1199
 
@@ -1121,6 +1205,7 @@
1121
1205
 
1122
1206
 
1123
1207
 
1208
+
1124
1209
 
1125
1210
 
1126
1211
 
@@ -1167,6 +1252,7 @@
1167
1252
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1168
1253
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1169
1254
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1255
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1170
1256
  <xsl:attribute name="display-align">center</xsl:attribute>
1171
1257
 
1172
1258
 
@@ -1191,6 +1277,8 @@
1191
1277
  <xsl:attribute name="display-align">center</xsl:attribute>
1192
1278
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1193
1279
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1280
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1281
+
1194
1282
 
1195
1283
 
1196
1284
 
@@ -1220,7 +1308,7 @@
1220
1308
 
1221
1309
 
1222
1310
 
1223
-
1311
+
1224
1312
 
1225
1313
 
1226
1314
 
@@ -1235,6 +1323,7 @@
1235
1323
 
1236
1324
 
1237
1325
 
1326
+
1238
1327
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
1239
1328
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1240
1329
 
@@ -1243,6 +1332,8 @@
1243
1332
 
1244
1333
 
1245
1334
 
1335
+
1336
+
1246
1337
  </xsl:attribute-set><xsl:attribute-set name="table-fn-number-style">
1247
1338
  <xsl:attribute name="font-size">80%</xsl:attribute>
1248
1339
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1257,6 +1348,7 @@
1257
1348
 
1258
1349
 
1259
1350
 
1351
+
1260
1352
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1261
1353
 
1262
1354
 
@@ -1279,7 +1371,8 @@
1279
1371
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1280
1372
 
1281
1373
 
1282
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1374
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1375
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1283
1376
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1284
1377
 
1285
1378
 
@@ -1290,10 +1383,34 @@
1290
1383
 
1291
1384
 
1292
1385
 
1386
+
1293
1387
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1294
1388
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1295
1389
 
1296
1390
 
1391
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1392
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1393
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1394
+
1395
+
1396
+
1397
+
1398
+
1399
+
1400
+
1401
+
1402
+
1403
+
1404
+ <xsl:attribute name="color">rgb(68, 84, 106)</xsl:attribute>
1405
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1413
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1297
1414
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1298
1415
 
1299
1416
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1336,6 +1453,7 @@
1336
1453
 
1337
1454
 
1338
1455
 
1456
+
1339
1457
 
1340
1458
 
1341
1459
 
@@ -1407,6 +1525,10 @@
1407
1525
 
1408
1526
 
1409
1527
 
1528
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
1529
+
1530
+ <xsl:attribute name="space-before">4pt</xsl:attribute>
1531
+
1410
1532
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1411
1533
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
1412
1534
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -1458,6 +1580,7 @@
1458
1580
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1459
1581
 
1460
1582
 
1583
+
1461
1584
 
1462
1585
 
1463
1586
 
@@ -1506,6 +1629,7 @@
1506
1629
 
1507
1630
 
1508
1631
 
1632
+
1509
1633
  <xsl:attribute name="text-align">left</xsl:attribute>
1510
1634
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
1511
1635
 
@@ -1531,20 +1655,20 @@
1531
1655
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
1532
1656
 
1533
1657
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1658
+ <xsl:attribute name="width">100%</xsl:attribute>
1659
+ <xsl:attribute name="content-height">100%</xsl:attribute>
1660
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
1534
1661
 
1535
1662
 
1536
- <xsl:attribute name="width">100%</xsl:attribute>
1537
1663
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
1538
- <xsl:attribute name="scaling">uniform</xsl:attribute>
1539
1664
 
1540
1665
 
1541
1666
 
1542
-
1543
-
1667
+
1544
1668
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1545
1669
 
1546
1670
 
1547
- <xsl:attribute name="font-family">Courier New</xsl:attribute>
1671
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1548
1672
 
1549
1673
 
1550
1674
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
@@ -1625,6 +1749,7 @@
1625
1749
 
1626
1750
 
1627
1751
 
1752
+
1628
1753
  <xsl:attribute name="provisional-distance-between-starts">6.5mm</xsl:attribute>
1629
1754
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1630
1755
  <xsl:attribute name="line-height">115%</xsl:attribute>
@@ -1632,6 +1757,25 @@
1632
1757
 
1633
1758
 
1634
1759
 
1760
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
1761
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1762
+
1763
+
1764
+
1765
+
1766
+
1767
+
1768
+
1769
+
1770
+
1771
+ <xsl:attribute name="color">rgb(68, 84, 106)</xsl:attribute>
1772
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1773
+
1774
+
1775
+
1776
+
1777
+
1778
+
1635
1779
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1636
1780
 
1637
1781
 
@@ -1679,6 +1823,7 @@
1679
1823
 
1680
1824
 
1681
1825
 
1826
+
1682
1827
  <xsl:attribute name="font-size">65%</xsl:attribute>
1683
1828
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1684
1829
 
@@ -1705,6 +1850,7 @@
1705
1850
 
1706
1851
 
1707
1852
 
1853
+
1708
1854
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1709
1855
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1710
1856
  <xsl:attribute name="color">black</xsl:attribute>
@@ -1729,6 +1875,7 @@
1729
1875
 
1730
1876
 
1731
1877
 
1878
+
1732
1879
  <xsl:attribute name="font-size">60%</xsl:attribute>
1733
1880
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1734
1881
 
@@ -1747,6 +1894,7 @@
1747
1894
 
1748
1895
 
1749
1896
 
1897
+
1750
1898
  <xsl:attribute name="border">0.5pt solid rgb(79, 129, 189)</xsl:attribute>
1751
1899
  <xsl:attribute name="color">rgb(79, 129, 189)</xsl:attribute>
1752
1900
  <xsl:attribute name="margin-left">16mm</xsl:attribute>
@@ -1757,6 +1905,9 @@
1757
1905
 
1758
1906
 
1759
1907
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
1908
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
1909
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
1910
+
1760
1911
 
1761
1912
 
1762
1913
 
@@ -1764,8 +1915,6 @@
1764
1915
 
1765
1916
 
1766
1917
 
1767
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1768
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1769
1918
  <xsl:attribute name="padding">2mm</xsl:attribute>
1770
1919
  <xsl:attribute name="padding-top">3mm</xsl:attribute>
1771
1920
 
@@ -1802,6 +1951,7 @@
1802
1951
 
1803
1952
 
1804
1953
 
1954
+
1805
1955
  <xsl:attribute name="font-style">italic</xsl:attribute>
1806
1956
 
1807
1957
 
@@ -1844,6 +1994,7 @@
1844
1994
 
1845
1995
 
1846
1996
 
1997
+
1847
1998
 
1848
1999
 
1849
2000
 
@@ -1865,6 +2016,7 @@
1865
2016
 
1866
2017
 
1867
2018
 
2019
+
1868
2020
 
1869
2021
 
1870
2022
 
@@ -1892,6 +2044,7 @@
1892
2044
 
1893
2045
 
1894
2046
 
2047
+
1895
2048
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1896
2049
 
1897
2050
 
@@ -1912,6 +2065,7 @@
1912
2065
 
1913
2066
 
1914
2067
 
2068
+
1915
2069
  <xsl:attribute name="font-size">60%</xsl:attribute>
1916
2070
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1917
2071
 
@@ -1932,6 +2086,7 @@
1932
2086
 
1933
2087
 
1934
2088
 
2089
+
1935
2090
  </xsl:attribute-set><xsl:attribute-set name="references-non-normative-style">
1936
2091
 
1937
2092
 
@@ -2045,13 +2200,13 @@
2045
2200
 
2046
2201
  </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">
2047
2202
  <xsl:variable name="nodes_preface_">
2048
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2203
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2049
2204
  <node id="{@id}"/>
2050
2205
  </xsl:for-each>
2051
2206
  </xsl:variable>
2052
2207
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2053
2208
 
2054
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2209
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2055
2210
  <xsl:sort select="@displayorder" data-type="number"/>
2056
2211
 
2057
2212
  <!-- process Section's title -->
@@ -2117,7 +2272,7 @@
2117
2272
  </xsl:for-each>
2118
2273
  </figures>
2119
2274
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2120
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2275
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2121
2276
  <xsl:sort select="@displayorder" data-type="number"/>
2122
2277
  <xsl:apply-templates select="."/>
2123
2278
  </xsl:for-each>
@@ -2171,7 +2326,38 @@
2171
2326
  </xsl:template><xsl:template match="*[local-name()='br']">
2172
2327
  <xsl:value-of select="$linebreak"/>
2173
2328
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2174
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2329
+ <xsl:param name="split_keep-within-line"/>
2330
+
2331
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2332
+ <xsl:choose>
2333
+
2334
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2335
+ <xsl:variable name="sep">_</xsl:variable>
2336
+ <xsl:variable name="items">
2337
+ <xsl:call-template name="split">
2338
+ <xsl:with-param name="pText" select="."/>
2339
+ <xsl:with-param name="sep" select="$sep"/>
2340
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2341
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2342
+ </xsl:call-template>
2343
+ </xsl:variable>
2344
+ <xsl:for-each select="xalan:nodeset($items)/item">
2345
+ <xsl:choose>
2346
+ <xsl:when test=". = $sep">
2347
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2348
+ </xsl:when>
2349
+ <xsl:otherwise>
2350
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2351
+ </xsl:otherwise>
2352
+ </xsl:choose>
2353
+ </xsl:for-each>
2354
+ </xsl:when>
2355
+
2356
+ <xsl:otherwise>
2357
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2358
+ </xsl:otherwise>
2359
+
2360
+ </xsl:choose>
2175
2361
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2176
2362
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2177
2363
  <xsl:apply-templates/>
@@ -2306,9 +2492,14 @@
2306
2492
 
2307
2493
  <xsl:variable name="table">
2308
2494
 
2309
- <xsl:variable name="simple-table">
2310
- <xsl:call-template name="getSimpleTable"/>
2495
+ <xsl:variable name="simple-table">
2496
+ <xsl:call-template name="getSimpleTable">
2497
+ <xsl:with-param name="id" select="@id"/>
2498
+ </xsl:call-template>
2311
2499
  </xsl:variable>
2500
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2501
+
2502
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2312
2503
 
2313
2504
 
2314
2505
  <!-- Display table's name before table as standalone block -->
@@ -2329,7 +2520,23 @@
2329
2520
  </xsl:call-template>
2330
2521
  </xsl:if>
2331
2522
  </xsl:variable>
2332
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2523
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2524
+
2525
+ <!-- DEBUG -->
2526
+ <xsl:if test="$table_if_debug = 'true'">
2527
+ <fo:block font-size="60%">
2528
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2529
+ </fo:block>
2530
+ </xsl:if>
2531
+
2532
+
2533
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2534
+
2535
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2536
+ DEBUG
2537
+ colwidths=<xsl:copy-of select="$colwidths"/>
2538
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2539
+
2333
2540
 
2334
2541
 
2335
2542
  <xsl:variable name="margin-side">
@@ -2351,6 +2558,8 @@
2351
2558
 
2352
2559
 
2353
2560
 
2561
+
2562
+
2354
2563
 
2355
2564
 
2356
2565
 
@@ -2392,12 +2601,22 @@
2392
2601
 
2393
2602
 
2394
2603
 
2604
+
2605
+
2395
2606
  </xsl:element>
2396
2607
  </xsl:variable>
2397
2608
 
2609
+ <xsl:if test="$isGenerateTableIF = 'true'">
2610
+ <!-- to determine start of table -->
2611
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2612
+ </xsl:if>
2398
2613
 
2399
2614
  <fo:table id="{@id}">
2400
2615
 
2616
+ <xsl:if test="$isGenerateTableIF = 'true'">
2617
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2618
+ </xsl:if>
2619
+
2401
2620
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2402
2621
  <xsl:attribute name="{local-name()}">
2403
2622
  <xsl:value-of select="."/>
@@ -2411,24 +2630,47 @@
2411
2630
 
2412
2631
 
2413
2632
  <xsl:choose>
2414
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2415
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2416
- <fo:table-column column-width="{@width}"/>
2417
- </xsl:for-each>
2633
+ <xsl:when test="$isGenerateTableIF = 'true'">
2634
+ <!-- generate IF for table widths -->
2635
+ <!-- example:
2636
+ <tr>
2637
+ <td valign="top" align="left" id="tab-symdu_1_1">
2638
+ <p>Symbol</p>
2639
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2640
+ </td>
2641
+ <td valign="top" align="left" id="tab-symdu_1_2">
2642
+ <p>Description</p>
2643
+ <word id="tab-symdu_1_2_word_1">Description</word>
2644
+ </td>
2645
+ </tr>
2646
+ -->
2647
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2648
+
2418
2649
  </xsl:when>
2419
2650
  <xsl:otherwise>
2420
- <xsl:call-template name="insertTableColumnWidth">
2421
- <xsl:with-param name="colwidths" select="$colwidths"/>
2422
- </xsl:call-template>
2423
- </xsl:otherwise>
2424
- </xsl:choose>
2425
2651
 
2426
- <xsl:choose>
2427
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2428
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2429
- </xsl:when>
2430
- <xsl:otherwise>
2431
- <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 -->
2652
+ <xsl:choose>
2653
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2654
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2655
+ <fo:table-column column-width="{@width}"/>
2656
+ </xsl:for-each>
2657
+ </xsl:when>
2658
+ <xsl:otherwise>
2659
+ <xsl:call-template name="insertTableColumnWidth">
2660
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2661
+ </xsl:call-template>
2662
+ </xsl:otherwise>
2663
+ </xsl:choose>
2664
+
2665
+ <xsl:choose>
2666
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2667
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2668
+ </xsl:when>
2669
+ <xsl:otherwise>
2670
+ <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 -->
2671
+ </xsl:otherwise>
2672
+ </xsl:choose>
2673
+
2432
2674
  </xsl:otherwise>
2433
2675
  </xsl:choose>
2434
2676
 
@@ -2505,23 +2747,29 @@
2505
2747
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2506
2748
  <xsl:param name="continued"/>
2507
2749
  <xsl:if test="normalize-space() != ''">
2508
- <fo:block xsl:use-attribute-sets="table-name-style">
2509
-
2510
-
2511
-
2512
-
2750
+
2751
+
2513
2752
 
2514
- <xsl:choose>
2515
- <xsl:when test="$continued = 'true'">
2753
+ <fo:block xsl:use-attribute-sets="table-name-style">
2754
+
2516
2755
 
2517
- </xsl:when>
2518
- <xsl:otherwise>
2519
- <xsl:apply-templates/>
2520
- </xsl:otherwise>
2521
- </xsl:choose>
2522
-
2756
+
2757
+
2758
+
2759
+ <xsl:choose>
2760
+ <xsl:when test="$continued = 'true'">
2761
+
2762
+ </xsl:when>
2763
+ <xsl:otherwise>
2764
+ <xsl:apply-templates/>
2765
+ </xsl:otherwise>
2766
+ </xsl:choose>
2767
+
2768
+
2769
+ </fo:block>
2770
+
2523
2771
 
2524
- </fo:block>
2772
+
2525
2773
  </xsl:if>
2526
2774
  </xsl:template><xsl:template name="calculate-columns-numbers">
2527
2775
  <xsl:param name="table-row"/>
@@ -2530,11 +2778,22 @@
2530
2778
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2531
2779
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2532
2780
  </xsl:template><xsl:template name="calculate-column-widths">
2781
+ <xsl:param name="table"/>
2782
+ <xsl:param name="cols-count"/>
2783
+
2784
+ <xsl:call-template name="calculate-column-widths-proportional">
2785
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2786
+ <xsl:with-param name="table" select="$table"/>
2787
+ </xsl:call-template>
2788
+
2789
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2533
2790
  <xsl:param name="table"/>
2534
2791
  <xsl:param name="cols-count"/>
2535
2792
  <xsl:param name="curr-col" select="1"/>
2536
2793
  <xsl:param name="width" select="0"/>
2537
2794
 
2795
+ <!-- table=<xsl:copy-of select="$table"/> -->
2796
+
2538
2797
  <xsl:if test="$curr-col &lt;= $cols-count">
2539
2798
  <xsl:variable name="widths">
2540
2799
  <xsl:choose>
@@ -2572,10 +2831,15 @@
2572
2831
  </xsl:for-each>
2573
2832
  </xsl:when>
2574
2833
  <xsl:otherwise>
2575
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2834
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2835
+
2836
+ <!-- <table><xsl:copy-of select="$table"/></table>
2837
+ -->
2838
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2576
2839
  <xsl:variable name="td_text">
2577
2840
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2578
2841
  </xsl:variable>
2842
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2579
2843
  <xsl:variable name="words">
2580
2844
  <xsl:variable name="string_with_added_zerospaces">
2581
2845
  <xsl:call-template name="add-zero-spaces-java">
@@ -2590,6 +2854,7 @@
2590
2854
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2591
2855
  </xsl:call-template>
2592
2856
  </xsl:variable>
2857
+ <!-- words=<xsl:copy-of select="$words"/> -->
2593
2858
  <xsl:variable name="max_length">
2594
2859
  <xsl:call-template name="max_length">
2595
2860
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -2614,6 +2879,8 @@
2614
2879
  </xsl:choose>
2615
2880
  </xsl:variable>
2616
2881
 
2882
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2883
+
2617
2884
  <column>
2618
2885
  <xsl:for-each select="xalan:nodeset($widths)//width">
2619
2886
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2622,33 +2889,271 @@
2622
2889
  </xsl:if>
2623
2890
  </xsl:for-each>
2624
2891
  </column>
2625
- <xsl:call-template name="calculate-column-widths">
2892
+ <xsl:call-template name="calculate-column-widths-proportional">
2626
2893
  <xsl:with-param name="cols-count" select="$cols-count"/>
2627
2894
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2628
2895
  <xsl:with-param name="table" select="$table"/>
2629
2896
  </xsl:call-template>
2630
2897
  </xsl:if>
2631
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
2898
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2632
2899
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2633
2900
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2634
2901
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2902
+
2903
+ <!-- if all capitals english letters or digits -->
2904
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2905
+ <xsl:call-template name="repeat">
2906
+ <xsl:with-param name="char" select="'X'"/>
2907
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2908
+ </xsl:call-template>
2909
+ </xsl:if>
2635
2910
  </xsl:template><xsl:template match="text()" mode="td_text">
2636
2911
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2637
2912
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2638
2913
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2639
2914
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2640
2915
  <xsl:value-of select="@target"/>
2641
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2642
- <xsl:variable name="mathml">
2643
- <xsl:for-each select="*">
2644
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2645
- <xsl:copy-of select="."/>
2646
- </xsl:if>
2916
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2917
+ <xsl:if test="$isGenerateTableIF = 'false'">
2918
+ <xsl:variable name="mathml_">
2919
+ <xsl:for-each select="*">
2920
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2921
+ <xsl:copy-of select="."/>
2922
+ </xsl:if>
2923
+ </xsl:for-each>
2924
+ </xsl:variable>
2925
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2926
+
2927
+ <xsl:variable name="math_text">
2928
+ <xsl:value-of select="normalize-space($mathml)"/>
2929
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2930
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2931
+ </xsl:variable>
2932
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2933
+ </xsl:if>
2934
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2935
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2936
+
2937
+ <!-- via intermediate format -->
2938
+
2939
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2940
+
2941
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2942
+
2943
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2944
+
2945
+ <!-- get current table id -->
2946
+ <xsl:variable name="table_id" select="@id"/>
2947
+ <!-- find table by id in the file 'table_widths' -->
2948
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2949
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2950
+
2951
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2952
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2953
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2954
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2955
+
2956
+ <xsl:variable name="table_with_cell_widths_">
2957
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2958
+ </xsl:variable>
2959
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2960
+
2961
+ <!-- <xsl:if test="$table_if_debug = 'true'">
2962
+ <xsl:copy-of select="$table_with_cell_widths"/>
2963
+ </xsl:if> -->
2964
+
2965
+
2966
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2967
+
2968
+ <xsl:variable name="column_widths_">
2969
+ <!-- iteration of columns -->
2970
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2971
+ <xsl:variable name="pos" select="position()"/>
2972
+ <column>
2973
+ <xsl:attribute name="width_max">
2974
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2975
+ <xsl:sort select="." data-type="number" order="descending"/>
2976
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2977
+ </xsl:for-each>
2978
+ </xsl:attribute>
2979
+ <xsl:attribute name="width_min">
2980
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2981
+ <xsl:sort select="." data-type="number" order="descending"/>
2982
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2983
+ </xsl:for-each>
2984
+ </xsl:attribute>
2985
+ </column>
2647
2986
  </xsl:for-each>
2648
2987
  </xsl:variable>
2988
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2989
+
2990
+ <!-- <column_widths>
2991
+ <xsl:copy-of select="$column_widths"/>
2992
+ </column_widths> -->
2993
+
2994
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2995
+ <xsl:variable name="table_widths_">
2996
+ <table>
2997
+ <xsl:attribute name="width_max">
2998
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2999
+ </xsl:attribute>
3000
+ <xsl:attribute name="width_min">
3001
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
3002
+ </xsl:attribute>
3003
+ </table>
3004
+ </xsl:variable>
3005
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
3006
+
3007
+ <xsl:variable name="page_width">
3008
+ <xsl:choose>
3009
+ <xsl:when test="$parent_table_page-width != ''">
3010
+ <xsl:value-of select="$parent_table_page-width"/>
3011
+ </xsl:when>
3012
+ <xsl:otherwise>
3013
+ <xsl:value-of select="@page-width"/>
3014
+ </xsl:otherwise>
3015
+ </xsl:choose>
3016
+ </xsl:variable>
3017
+
3018
+ <xsl:if test="$table_if_debug = 'true'">
3019
+ <table_width>
3020
+ <xsl:copy-of select="$table_widths"/>
3021
+ </table_width>
3022
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
3023
+ </xsl:if>
2649
3024
 
2650
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2651
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3025
+
3026
+ <!-- There are three cases: -->
3027
+ <xsl:choose>
3028
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
3029
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
3030
+ <!-- call old algorithm -->
3031
+ <case1/>
3032
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
3033
+ <xsl:call-template name="calculate-column-widths-proportional">
3034
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3035
+ <xsl:with-param name="table" select="$table"/>
3036
+ </xsl:call-template> -->
3037
+ </xsl:when>
3038
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
3039
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
3040
+ <case2/>
3041
+ <autolayout/>
3042
+ <xsl:for-each select="$column_widths/column/@width_max">
3043
+ <column divider="100"><xsl:value-of select="."/></column>
3044
+ </xsl:for-each>
3045
+ </xsl:when>
3046
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
3047
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
3048
+ Lets also call D the difference between maximum and minimum width of the table.
3049
+ For each column, let d be the difference between maximum and minimum width of that column.
3050
+ Now set the column's width to the minimum width plus d times W over D.
3051
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3052
+ <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)">
3053
+ <!-- difference between the available space and the minimum table width -->
3054
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
3055
+ <W><xsl:value-of select="$W"/></W>
3056
+ <!-- difference between maximum and minimum width of the table -->
3057
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
3058
+ <D><xsl:value-of select="$D"/></D>
3059
+ <case3/>
3060
+ <autolayout/>
3061
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
3062
+ <split_keep-within-line>true</split_keep-within-line>
3063
+ </xsl:if>
3064
+ <xsl:for-each select="$column_widths/column">
3065
+ <!-- difference between maximum and minimum width of that column. -->
3066
+ <xsl:variable name="d" select="@width_max - @width_min"/>
3067
+ <d><xsl:value-of select="$d"/></d>
3068
+ <width_min><xsl:value-of select="@width_min"/></width_min>
3069
+ <e><xsl:value-of select="$d * $W div $D"/></e>
3070
+ <!-- set the column's width to the minimum width plus d times W over D. -->
3071
+ <column divider="100">
3072
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3073
+ </column>
3074
+ </xsl:for-each>
3075
+
3076
+ </xsl:when>
3077
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
3078
+ </xsl:choose>
3079
+
3080
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
3081
+
3082
+ <!-- if nested 'dl' or 'table' -->
3083
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
3084
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
3085
+
3086
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
3087
+
3088
+ <xsl:variable name="parent_table_page-width_">
3089
+ <xsl:if test="$parent_table_id != ''">
3090
+ <!-- determine column number in the parent table -->
3091
+ <xsl:variable name="parent_table_column_number">
3092
+ <xsl:choose>
3093
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
3094
+ <xsl:otherwise> <!-- parent is table -->
3095
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
3096
+ </xsl:otherwise>
3097
+ </xsl:choose>
3098
+ </xsl:variable>
3099
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
3100
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3101
+ </xsl:if>
3102
+ </xsl:variable>
3103
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
3104
+
3105
+ <!-- get current table id -->
3106
+ <xsl:variable name="table_id" select="@id"/>
3107
+
3108
+ <xsl:choose>
3109
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
3110
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
3111
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
3112
+ </xsl:when>
3113
+ <xsl:otherwise>
3114
+ <!-- recalculate columns width based on parent table width -->
3115
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
3116
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
3117
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
3118
+ </xsl:call-template>
3119
+ </xsl:for-each>
3120
+ </xsl:otherwise>
3121
+ </xsl:choose>
3122
+
3123
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3124
+ <xsl:copy>
3125
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3126
+ </xsl:copy>
3127
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
3128
+ <xsl:copy>
3129
+ <xsl:copy-of select="@*"/>
3130
+
3131
+ <!-- The maximum width is given by the widest line. -->
3132
+ <xsl:attribute name="width_max">
3133
+ <xsl:for-each select="p_len">
3134
+ <xsl:sort select="." data-type="number" order="descending"/>
3135
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3136
+ </xsl:for-each>
3137
+ </xsl:attribute>
3138
+
3139
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3140
+ <xsl:variable name="width_min">
3141
+ <xsl:for-each select="word_len">
3142
+ <xsl:sort select="." data-type="number" order="descending"/>
3143
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3144
+ </xsl:for-each>
3145
+ </xsl:variable>
3146
+ <xsl:attribute name="width_min">
3147
+ <xsl:value-of select="$width_min"/>
3148
+ </xsl:attribute>
3149
+
3150
+ <xsl:if test="$width_min = 0">
3151
+ <xsl:attribute name="width_min">1</xsl:attribute>
3152
+ </xsl:if>
3153
+
3154
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3155
+
3156
+ </xsl:copy>
2652
3157
  </xsl:template><xsl:template match="*[local-name()='thead']">
2653
3158
  <xsl:param name="cols-count"/>
2654
3159
  <fo:table-header>
@@ -2662,12 +3167,18 @@
2662
3167
  <fo:table-row>
2663
3168
  <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">
2664
3169
 
2665
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
2666
- <xsl:with-param name="continued">true</xsl:with-param>
2667
- </xsl:apply-templates>
2668
3170
 
2669
3171
 
2670
3172
 
3173
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3174
+ <xsl:with-param name="continued">true</xsl:with-param>
3175
+ </xsl:apply-templates>
3176
+
3177
+
3178
+
3179
+
3180
+
3181
+
2671
3182
  </fo:table-cell>
2672
3183
  </fo:table-row>
2673
3184
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2733,6 +3244,7 @@
2733
3244
  </xsl:for-each>
2734
3245
  </xsl:when>
2735
3246
  <xsl:otherwise>
3247
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
2736
3248
  <xsl:call-template name="insertTableColumnWidth">
2737
3249
  <xsl:with-param name="colwidths" select="$colwidths"/>
2738
3250
  </xsl:call-template>
@@ -2767,7 +3279,10 @@
2767
3279
 
2768
3280
 
2769
3281
  <!-- fn processing -->
2770
- <xsl:call-template name="table_fn_display"/>
3282
+
3283
+ <xsl:call-template name="table_fn_display"/>
3284
+
3285
+
2771
3286
 
2772
3287
  <!-- for PAS display Notes after footnotes -->
2773
3288
 
@@ -2777,6 +3292,9 @@
2777
3292
  </fo:table-body>
2778
3293
 
2779
3294
  </fo:table>
3295
+
3296
+
3297
+
2780
3298
  </xsl:if>
2781
3299
  </xsl:template><xsl:template match="*[local-name()='tbody']">
2782
3300
 
@@ -2812,6 +3330,52 @@
2812
3330
 
2813
3331
  </fo:table-body>
2814
3332
 
3333
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3334
+ <xsl:param name="table_or_dl">table</xsl:param>
3335
+ <xsl:apply-templates mode="process_table-if">
3336
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3337
+ </xsl:apply-templates>
3338
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3339
+ <xsl:param name="table_or_dl">table</xsl:param>
3340
+
3341
+ <fo:table-body>
3342
+ <xsl:for-each select="*[local-name() = 'tr']">
3343
+ <xsl:variable name="col_count" select="count(*)"/>
3344
+
3345
+ <!-- iteration for each tr/td -->
3346
+
3347
+ <xsl:choose>
3348
+ <xsl:when test="$table_or_dl = 'table'">
3349
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3350
+ <fo:table-row number-columns-spanned="{$col_count}">
3351
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3352
+ <xsl:call-template name="td"/>
3353
+ </fo:table-row>
3354
+ </xsl:for-each>
3355
+ </xsl:when>
3356
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3357
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3358
+ <xsl:variable name="is_dt" select="position() = 1"/>
3359
+
3360
+ <xsl:for-each select="*">
3361
+ <!-- <test><xsl:copy-of select="."/></test> -->
3362
+ <fo:table-row number-columns-spanned="{$col_count}">
3363
+ <xsl:choose>
3364
+ <xsl:when test="$is_dt">
3365
+ <xsl:call-template name="insert_dt_cell"/>
3366
+ </xsl:when>
3367
+ <xsl:otherwise>
3368
+ <xsl:call-template name="insert_dd_cell"/>
3369
+ </xsl:otherwise>
3370
+ </xsl:choose>
3371
+ </fo:table-row>
3372
+ </xsl:for-each>
3373
+ </xsl:for-each>
3374
+ </xsl:otherwise>
3375
+ </xsl:choose>
3376
+
3377
+ </xsl:for-each>
3378
+ </fo:table-body>
2815
3379
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2816
3380
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2817
3381
 
@@ -2819,6 +3383,9 @@
2819
3383
 
2820
3384
 
2821
3385
 
3386
+
3387
+
3388
+
2822
3389
 
2823
3390
 
2824
3391
  <xsl:call-template name="setTableRowAttributes"/>
@@ -2838,6 +3405,8 @@
2838
3405
 
2839
3406
 
2840
3407
 
3408
+
3409
+
2841
3410
  <xsl:call-template name="setTableRowAttributes"/>
2842
3411
  <xsl:apply-templates/>
2843
3412
  </fo:table-row>
@@ -2898,7 +3467,7 @@
2898
3467
  </xsl:choose>
2899
3468
  </xsl:attribute>
2900
3469
  </xsl:if>
2901
- </xsl:template><xsl:template match="*[local-name()='td']">
3470
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2902
3471
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2903
3472
  <xsl:call-template name="setTextAlignment">
2904
3473
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2919,6 +3488,8 @@
2919
3488
 
2920
3489
 
2921
3490
 
3491
+
3492
+
2922
3493
 
2923
3494
 
2924
3495
 
@@ -2932,11 +3503,24 @@
2932
3503
 
2933
3504
  <xsl:call-template name="setTableCellAttributes"/>
2934
3505
 
3506
+ <xsl:if test="$isGenerateTableIF = 'true'">
3507
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3508
+ <xsl:attribute name="text-align">left</xsl:attribute>
3509
+ </xsl:if>
3510
+
2935
3511
  <fo:block>
2936
3512
 
3513
+ <xsl:if test="$isGenerateTableIF = 'true'">
3514
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3515
+ </xsl:if>
3516
+
3517
+
2937
3518
 
2938
3519
 
2939
3520
  <xsl:apply-templates/>
3521
+
3522
+ <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"/> -->
3523
+
2940
3524
  </fo:block>
2941
3525
  </fo:table-cell>
2942
3526
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -2977,7 +3561,11 @@
2977
3561
 
2978
3562
  <xsl:variable name="gen_id" select="generate-id(.)"/>
2979
3563
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2980
- <xsl:variable name="reference" select="@reference"/>
3564
+ <xsl:variable name="reference_">
3565
+ <xsl:value-of select="@reference"/>
3566
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
3567
+ </xsl:variable>
3568
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
2981
3569
  <!-- fn sequence number in document -->
2982
3570
  <xsl:variable name="current_fn_number">
2983
3571
  <xsl:choose>
@@ -3052,7 +3640,7 @@
3052
3640
  <xsl:copy-of select="node()"/>
3053
3641
  </fn>
3054
3642
  </xsl:for-each>
3055
- <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']/*">
3643
+ <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']/*">
3056
3644
  <xsl:sort select="@displayorder" data-type="number"/>
3057
3645
  <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])]">
3058
3646
  <!-- copy unique fn -->
@@ -3139,9 +3727,9 @@
3139
3727
  <!-- current hierarchy is 'figure' element -->
3140
3728
  <xsl:variable name="following_dl_colwidths">
3141
3729
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3142
- <xsl:variable name="html-table">
3143
- <xsl:variable name="doc_ns">
3144
-
3730
+ <xsl:variable name="simple-table">
3731
+ <!-- <xsl:variable name="doc_ns">
3732
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3145
3733
  </xsl:variable>
3146
3734
  <xsl:variable name="ns">
3147
3735
  <xsl:choose>
@@ -3152,7 +3740,7 @@
3152
3740
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3153
3741
  </xsl:otherwise>
3154
3742
  </xsl:choose>
3155
- </xsl:variable>
3743
+ </xsl:variable> -->
3156
3744
 
3157
3745
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3158
3746
  <tbody>
@@ -3163,7 +3751,7 @@
3163
3751
 
3164
3752
  <xsl:call-template name="calculate-column-widths">
3165
3753
  <xsl:with-param name="cols-count" select="2"/>
3166
- <xsl:with-param name="table" select="$html-table"/>
3754
+ <xsl:with-param name="table" select="$simple-table"/>
3167
3755
  </xsl:call-template>
3168
3756
 
3169
3757
  </xsl:if>
@@ -3343,12 +3931,31 @@
3343
3931
 
3344
3932
 
3345
3933
 
3934
+
3935
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3936
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3937
+ </xsl:if>
3938
+
3346
3939
  <fo:block>
3347
3940
 
3348
3941
 
3349
3942
 
3350
3943
 
3944
+ <xsl:apply-templates select="*[local-name() = 'name']">
3945
+ <xsl:with-param name="process">true</xsl:with-param>
3946
+ </xsl:apply-templates>
3947
+
3948
+ <xsl:if test="$isGenerateTableIF = 'true'">
3949
+ <!-- to determine start of table -->
3950
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3951
+ </xsl:if>
3952
+
3351
3953
  <fo:table width="95%" table-layout="fixed">
3954
+
3955
+ <xsl:if test="$isGenerateTableIF = 'true'">
3956
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3957
+ </xsl:if>
3958
+
3352
3959
 
3353
3960
  <xsl:choose>
3354
3961
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3357,69 +3964,173 @@
3357
3964
 
3358
3965
  </xsl:when>
3359
3966
  </xsl:choose>
3360
- <!-- create virtual html table for dl/[dt and dd] -->
3361
- <xsl:variable name="html-table">
3362
- <xsl:variable name="doc_ns">
3967
+
3968
+
3969
+
3970
+ <xsl:choose>
3971
+ <xsl:when test="$isGenerateTableIF = 'true'">
3972
+ <!-- generate IF for table widths -->
3973
+ <!-- example:
3974
+ <tr>
3975
+ <td valign="top" align="left" id="tab-symdu_1_1">
3976
+ <p>Symbol</p>
3977
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3978
+ </td>
3979
+ <td valign="top" align="left" id="tab-symdu_1_2">
3980
+ <p>Description</p>
3981
+ <word id="tab-symdu_1_2_word_1">Description</word>
3982
+ </td>
3983
+ </tr>
3984
+ -->
3363
3985
 
3364
- </xsl:variable>
3365
- <xsl:variable name="ns">
3366
- <xsl:choose>
3367
- <xsl:when test="normalize-space($doc_ns) != ''">
3368
- <xsl:value-of select="normalize-space($doc_ns)"/>
3369
- </xsl:when>
3370
- <xsl:otherwise>
3371
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3372
- </xsl:otherwise>
3373
- </xsl:choose>
3374
- </xsl:variable>
3375
- <tbody>
3376
- <xsl:apply-templates mode="dl"/>
3377
- </tbody>
3378
- </xsl:variable>
3379
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3380
- <xsl:variable name="colwidths">
3381
- <xsl:call-template name="calculate-column-widths">
3382
- <xsl:with-param name="cols-count" select="2"/>
3383
- <xsl:with-param name="table" select="$html-table"/>
3384
- </xsl:call-template>
3385
- </xsl:variable>
3386
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3387
- <xsl:variable name="maxlength_dt">
3388
- <xsl:call-template name="getMaxLength_dt"/>
3389
- </xsl:variable>
3390
- <xsl:variable name="isContainsKeepTogetherTag_">
3391
- false
3392
- </xsl:variable>
3393
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3394
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3395
- <xsl:call-template name="setColumnWidth_dl">
3396
- <xsl:with-param name="colwidths" select="$colwidths"/>
3397
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3398
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3399
- </xsl:call-template>
3986
+ <!-- create virtual html table for dl/[dt and dd] -->
3987
+ <xsl:variable name="simple-table">
3988
+
3989
+ <xsl:variable name="dl_table">
3990
+ <tbody>
3991
+ <xsl:apply-templates mode="dl_if">
3992
+ <xsl:with-param name="id" select="@id"/>
3993
+ </xsl:apply-templates>
3994
+ </tbody>
3995
+ </xsl:variable>
3996
+
3997
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3998
+
3999
+ <!-- Step: replace <br/> to <p>...</p> -->
4000
+ <xsl:variable name="table_without_br">
4001
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
4002
+ </xsl:variable>
4003
+
4004
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
4005
+
4006
+ <!-- Step: add id to each cell -->
4007
+ <!-- add <word>...</word> for each word, image, math -->
4008
+ <xsl:variable name="simple-table-id">
4009
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
4010
+ <xsl:with-param name="id" select="@id"/>
4011
+ </xsl:apply-templates>
4012
+ </xsl:variable>
4013
+
4014
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
4015
+
4016
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4017
+
4018
+ </xsl:variable>
4019
+
4020
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
4021
+
4022
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
4023
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
4024
+ </xsl:apply-templates>
4025
+
4026
+ </xsl:when>
4027
+ <xsl:otherwise>
3400
4028
 
3401
- <fo:table-body>
3402
- <xsl:apply-templates>
3403
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3404
- </xsl:apply-templates>
3405
- </fo:table-body>
4029
+ <xsl:variable name="simple-table">
4030
+
4031
+ <xsl:variable name="dl_table">
4032
+ <tbody>
4033
+ <xsl:apply-templates mode="dl">
4034
+ <xsl:with-param name="id" select="@id"/>
4035
+ </xsl:apply-templates>
4036
+ </tbody>
4037
+ </xsl:variable>
4038
+
4039
+ <xsl:copy-of select="$dl_table"/>
4040
+ </xsl:variable>
4041
+
4042
+ <xsl:variable name="colwidths">
4043
+ <xsl:call-template name="calculate-column-widths">
4044
+ <xsl:with-param name="cols-count" select="2"/>
4045
+ <xsl:with-param name="table" select="$simple-table"/>
4046
+ </xsl:call-template>
4047
+ </xsl:variable>
4048
+
4049
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
4050
+ DEBUG
4051
+ colwidths=<xsl:copy-of select="$colwidths"/>
4052
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
4053
+
4054
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4055
+
4056
+ <xsl:variable name="maxlength_dt">
4057
+ <xsl:call-template name="getMaxLength_dt"/>
4058
+ </xsl:variable>
4059
+
4060
+ <xsl:variable name="isContainsKeepTogetherTag_">
4061
+ false
4062
+ </xsl:variable>
4063
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4064
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4065
+
4066
+
4067
+ <xsl:call-template name="setColumnWidth_dl">
4068
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4069
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4070
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4071
+ </xsl:call-template>
4072
+
4073
+ <fo:table-body>
4074
+
4075
+ <!-- DEBUG -->
4076
+ <xsl:if test="$table_if_debug = 'true'">
4077
+ <fo:table-row>
4078
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
4079
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
4080
+ </fo:table-cell>
4081
+ </fo:table-row>
4082
+ </xsl:if>
4083
+
4084
+ <xsl:apply-templates>
4085
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
4086
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
4087
+ </xsl:apply-templates>
4088
+
4089
+ </fo:table-body>
4090
+ </xsl:otherwise>
4091
+ </xsl:choose>
3406
4092
  </fo:table>
3407
4093
  </fo:block>
3408
4094
  </fo:block>
3409
4095
  </xsl:if> <!-- END: a few components -->
3410
4096
  </fo:block-container>
3411
4097
  </fo:block-container>
4098
+
4099
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
4100
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
4101
+ </xsl:if>
4102
+
4103
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4104
+ <xsl:param name="process">false</xsl:param>
4105
+ <xsl:if test="$process = 'true'">
4106
+ <fo:block xsl:use-attribute-sets="dl-name-style">
4107
+ <xsl:apply-templates/>
4108
+ </fo:block>
4109
+ </xsl:if>
3412
4110
  </xsl:template><xsl:template name="setColumnWidth_dl">
3413
4111
  <xsl:param name="colwidths"/>
3414
4112
  <xsl:param name="maxlength_dt"/>
3415
4113
  <xsl:param name="isContainsKeepTogetherTag"/>
4114
+
4115
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
4116
+
3416
4117
  <xsl:choose>
4118
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4119
+ <xsl:call-template name="insertTableColumnWidth">
4120
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4121
+ </xsl:call-template>
4122
+ </xsl:when>
3417
4123
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3418
4124
  <fo:table-column column-width="50%"/>
3419
4125
  <fo:table-column column-width="50%"/>
3420
4126
  </xsl:when>
3421
4127
  <xsl:otherwise>
3422
4128
  <xsl:choose>
4129
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4130
+ <xsl:call-template name="insertTableColumnWidth">
4131
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4132
+ </xsl:call-template>
4133
+ </xsl:when>
3423
4134
  <xsl:when test="$isContainsKeepTogetherTag">
3424
4135
  <xsl:call-template name="insertTableColumnWidth">
3425
4136
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3464,13 +4175,19 @@
3464
4175
  </xsl:choose>
3465
4176
  </xsl:template><xsl:template name="insertTableColumnWidth">
3466
4177
  <xsl:param name="colwidths"/>
4178
+
3467
4179
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3468
4180
  <xsl:choose>
3469
4181
  <xsl:when test=". = 1 or . = 0">
3470
4182
  <fo:table-column column-width="proportional-column-width(2)"/>
3471
4183
  </xsl:when>
3472
4184
  <xsl:otherwise>
3473
- <fo:table-column column-width="proportional-column-width({.})"/>
4185
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
4186
+ <xsl:variable name="divider">
4187
+ <xsl:value-of select="@divider"/>
4188
+ <xsl:if test="not(@divider)">1</xsl:if>
4189
+ </xsl:variable>
4190
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3474
4191
  </xsl:otherwise>
3475
4192
  </xsl:choose>
3476
4193
  </xsl:for-each>
@@ -3532,11 +4249,19 @@
3532
4249
  </fo:table-cell>
3533
4250
  </fo:table-row>
3534
4251
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
4252
+ <xsl:param name="id"/>
4253
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3535
4254
  <tr>
3536
4255
  <td>
4256
+ <xsl:attribute name="id">
4257
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4258
+ </xsl:attribute>
3537
4259
  <xsl:apply-templates/>
3538
4260
  </td>
3539
4261
  <td>
4262
+ <xsl:attribute name="id">
4263
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4264
+ </xsl:attribute>
3540
4265
 
3541
4266
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3542
4267
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3547,50 +4272,134 @@
3547
4272
 
3548
4273
  </xsl:template><xsl:template match="*[local-name()='dt']">
3549
4274
  <xsl:param name="key_iso"/>
4275
+ <xsl:param name="split_keep-within-line"/>
3550
4276
 
3551
4277
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3552
- <fo:table-cell>
4278
+ <xsl:call-template name="insert_dt_cell">
4279
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4280
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4281
+ </xsl:call-template>
4282
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4283
+ <xsl:call-template name="insert_dd_cell">
4284
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4285
+ </xsl:call-template>
4286
+ </xsl:for-each>
4287
+ </fo:table-row>
4288
+ </xsl:template><xsl:template name="insert_dt_cell">
4289
+ <xsl:param name="key_iso"/>
4290
+ <xsl:param name="split_keep-within-line"/>
4291
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4292
+
4293
+ <xsl:if test="$isGenerateTableIF = 'true'">
4294
+ <!-- border is mandatory, to calculate real width -->
4295
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4296
+ <xsl:attribute name="text-align">left</xsl:attribute>
4297
+ </xsl:if>
4298
+
4299
+
4300
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4301
+ <xsl:copy-of select="@id"/>
4302
+
4303
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4304
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4305
+ </xsl:if>
4306
+
4307
+
4308
+
4309
+ <xsl:apply-templates>
4310
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4311
+ </xsl:apply-templates>
4312
+
4313
+ <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"/> -->
4314
+
4315
+ </fo:block>
4316
+ </fo:table-cell>
4317
+ </xsl:template><xsl:template name="insert_dd_cell">
4318
+ <xsl:param name="split_keep-within-line"/>
4319
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4320
+
4321
+ <xsl:if test="$isGenerateTableIF = 'true'">
4322
+ <!-- border is mandatory, to calculate real width -->
4323
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4324
+ </xsl:if>
4325
+
4326
+ <fo:block>
4327
+
4328
+ <xsl:if test="$isGenerateTableIF = 'true'">
4329
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4330
+ </xsl:if>
4331
+
3553
4332
 
3554
- <fo:block xsl:use-attribute-sets="dt-style">
3555
- <xsl:copy-of select="@id"/>
3556
-
3557
- <xsl:if test="normalize-space($key_iso) = 'true'">
3558
- <xsl:attribute name="margin-top">0</xsl:attribute>
3559
- </xsl:if>
3560
-
3561
-
3562
-
3563
- <xsl:apply-templates/>
3564
- </fo:block>
3565
- </fo:table-cell>
3566
- <fo:table-cell>
3567
- <fo:block>
3568
-
3569
4333
 
3570
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3571
- <xsl:with-param name="process">true</xsl:with-param>
3572
- </xsl:apply-templates>
3573
- </fo:block>
3574
- </fo:table-cell>
3575
- </fo:table-row>
4334
+ <xsl:choose>
4335
+ <xsl:when test="$isGenerateTableIF = 'true'">
4336
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4337
+ <xsl:with-param name="process">true</xsl:with-param>
4338
+ </xsl:apply-templates>
4339
+ </xsl:when>
4340
+ <xsl:otherwise>
4341
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4342
+ <xsl:with-param name="process">true</xsl:with-param>
4343
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4344
+ </xsl:apply-templates>
4345
+ </xsl:otherwise>
4346
+
4347
+ </xsl:choose>
4348
+
4349
+ <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"/> -->
4350
+
4351
+ </fo:block>
4352
+ </fo:table-cell>
3576
4353
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3577
4354
  <xsl:apply-templates/>
3578
4355
  </xsl:template><xsl:template match="*[local-name()='dd']">
3579
4356
  <xsl:param name="process">false</xsl:param>
4357
+ <xsl:param name="split_keep-within-line"/>
3580
4358
  <xsl:if test="$process = 'true'">
3581
4359
  <xsl:apply-templates select="@language"/>
3582
- <xsl:apply-templates/>
4360
+ <xsl:apply-templates>
4361
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4362
+ </xsl:apply-templates>
3583
4363
  </xsl:if>
3584
4364
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3585
4365
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3586
- </xsl:template><xsl:template match="*[local-name()='em']">
4366
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4367
+ <xsl:param name="id"/>
4368
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4369
+ <tr>
4370
+ <td>
4371
+ <xsl:copy-of select="node()"/>
4372
+ </td>
4373
+ <td>
4374
+
4375
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4376
+
4377
+ <!-- get paragraphs from nested 'dl' -->
4378
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4379
+
4380
+
4381
+ </td>
4382
+ </tr>
4383
+
4384
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4385
+ <xsl:for-each select="*[local-name() = 'dt']">
4386
+ <p>
4387
+ <xsl:copy-of select="node()"/>
4388
+ <xsl:text> </xsl:text>
4389
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4390
+ </p>
4391
+ </xsl:for-each>
4392
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
3587
4393
  <fo:inline font-style="italic">
3588
4394
  <xsl:apply-templates/>
3589
4395
  </fo:inline>
3590
4396
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4397
+ <xsl:param name="split_keep-within-line"/>
3591
4398
  <fo:inline font-weight="bold">
3592
4399
 
3593
- <xsl:apply-templates/>
4400
+ <xsl:apply-templates>
4401
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4402
+ </xsl:apply-templates>
3594
4403
  </fo:inline>
3595
4404
  </xsl:template><xsl:template match="*[local-name()='padding']">
3596
4405
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3611,7 +4420,7 @@
3611
4420
 
3612
4421
 
3613
4422
 
3614
-
4423
+ <!-- 10 -->
3615
4424
 
3616
4425
 
3617
4426
 
@@ -3791,6 +4600,10 @@
3791
4600
  <xsl:param name="text"/>
3792
4601
  <xsl:param name="separator" select="' '"/>
3793
4602
  <xsl:choose>
4603
+
4604
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4605
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4606
+ </xsl:when>
3794
4607
  <xsl:when test="not(contains($text, $separator))">
3795
4608
  <word>
3796
4609
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -3835,13 +4648,66 @@
3835
4648
  </xsl:when>
3836
4649
  <xsl:otherwise>
3837
4650
  <word>
3838
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4651
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4652
+ <xsl:choose>
4653
+ <xsl:when test="$isGenerateTableIF = 'true'">
4654
+ <xsl:value-of select="$word"/>
4655
+ </xsl:when>
4656
+ <xsl:otherwise>
4657
+ <xsl:value-of select="string-length($word)"/>
4658
+ </xsl:otherwise>
4659
+ </xsl:choose>
3839
4660
  </word>
3840
4661
  <xsl:call-template name="tokenize">
3841
4662
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3842
4663
  </xsl:call-template>
3843
4664
  </xsl:otherwise>
3844
4665
  </xsl:choose>
4666
+ </xsl:template><xsl:template name="tokenize_with_tags">
4667
+ <xsl:param name="tags"/>
4668
+ <xsl:param name="text"/>
4669
+ <xsl:param name="separator" select="' '"/>
4670
+ <xsl:choose>
4671
+
4672
+ <xsl:when test="not(contains($text, $separator))">
4673
+ <word>
4674
+ <xsl:call-template name="enclose_text_in_tags">
4675
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4676
+ <xsl:with-param name="tags" select="$tags"/>
4677
+ </xsl:call-template>
4678
+ </word>
4679
+ </xsl:when>
4680
+ <xsl:otherwise>
4681
+ <word>
4682
+ <xsl:call-template name="enclose_text_in_tags">
4683
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4684
+ <xsl:with-param name="tags" select="$tags"/>
4685
+ </xsl:call-template>
4686
+ </word>
4687
+ <xsl:call-template name="tokenize_with_tags">
4688
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4689
+ </xsl:call-template>
4690
+ </xsl:otherwise>
4691
+ </xsl:choose>
4692
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4693
+ <xsl:param name="text"/>
4694
+ <xsl:param name="tags"/>
4695
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4696
+
4697
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4698
+
4699
+ <xsl:choose>
4700
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4701
+ <xsl:otherwise>
4702
+ <xsl:element name="{$tag_name}">
4703
+ <xsl:call-template name="enclose_text_in_tags">
4704
+ <xsl:with-param name="text" select="$text"/>
4705
+ <xsl:with-param name="tags" select="$tags"/>
4706
+ <xsl:with-param name="num" select="$num + 1"/>
4707
+ </xsl:call-template>
4708
+ </xsl:element>
4709
+ </xsl:otherwise>
4710
+ </xsl:choose>
3845
4711
  </xsl:template><xsl:template name="max_length">
3846
4712
  <xsl:param name="words"/>
3847
4713
  <xsl:for-each select="$words//word">
@@ -3942,12 +4808,19 @@
3942
4808
  </xsl:otherwise>
3943
4809
  </xsl:choose>
3944
4810
  </xsl:template><xsl:template name="getSimpleTable">
4811
+ <xsl:param name="id"/>
4812
+
3945
4813
  <xsl:variable name="simple-table">
3946
4814
 
4815
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4816
+ <xsl:variable name="table_without_br">
4817
+ <xsl:apply-templates mode="table-without-br"/>
4818
+ </xsl:variable>
4819
+
3947
4820
  <!-- Step 1. colspan processing -->
3948
4821
  <xsl:variable name="simple-table-colspan">
3949
4822
  <tbody>
3950
- <xsl:apply-templates mode="simple-table-colspan"/>
4823
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3951
4824
  </tbody>
3952
4825
  </xsl:variable>
3953
4826
 
@@ -3956,10 +4829,67 @@
3956
4829
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3957
4830
  </xsl:variable>
3958
4831
 
3959
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3960
-
4832
+ <!-- Step 3: add id to each cell -->
4833
+ <!-- add <word>...</word> for each word, image, math -->
4834
+ <xsl:variable name="simple-table-id">
4835
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4836
+ <xsl:with-param name="id" select="$id"/>
4837
+ </xsl:apply-templates>
4838
+ </xsl:variable>
4839
+
4840
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4841
+
3961
4842
  </xsl:variable>
3962
4843
  <xsl:copy-of select="$simple-table"/>
4844
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4845
+ <xsl:copy>
4846
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4847
+ </xsl:copy>
4848
+ </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">
4849
+ <xsl:copy>
4850
+ <xsl:copy-of select="@*"/>
4851
+ <p>
4852
+ <xsl:copy-of select="node()"/>
4853
+ </p>
4854
+ </xsl:copy>
4855
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4856
+ <xsl:copy>
4857
+ <xsl:copy-of select="@*"/>
4858
+ <xsl:for-each select="*[local-name()='br']">
4859
+ <xsl:variable name="current_id" select="generate-id()"/>
4860
+ <p>
4861
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4862
+ <xsl:copy-of select="."/>
4863
+ </xsl:for-each>
4864
+ </p>
4865
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4866
+ <p>
4867
+ <xsl:for-each select="following-sibling::node()">
4868
+ <xsl:copy-of select="."/>
4869
+ </xsl:for-each>
4870
+ </p>
4871
+ </xsl:if>
4872
+ </xsl:for-each>
4873
+ </xsl:copy>
4874
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4875
+ <xsl:for-each select="*[local-name()='br']">
4876
+ <xsl:variable name="current_id" select="generate-id()"/>
4877
+ <p>
4878
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4879
+ <xsl:copy-of select="."/>
4880
+ </xsl:for-each>
4881
+ </p>
4882
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4883
+ <p>
4884
+ <xsl:for-each select="following-sibling::node()">
4885
+ <xsl:copy-of select="."/>
4886
+ </xsl:for-each>
4887
+ </p>
4888
+ </xsl:if>
4889
+ </xsl:for-each>
4890
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4891
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4892
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3963
4893
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3964
4894
  <xsl:apply-templates mode="simple-table-colspan"/>
3965
4895
  </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">
@@ -4049,6 +4979,126 @@
4049
4979
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4050
4980
  <xsl:with-param name="previousRow" select="$newRow"/>
4051
4981
  </xsl:apply-templates>
4982
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4983
+ <xsl:param name="id"/>
4984
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4985
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4986
+ <xsl:with-param name="id" select="$id_prefixed"/>
4987
+ </xsl:apply-templates>
4988
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4989
+ <xsl:param name="id"/>
4990
+ <xsl:copy>
4991
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4992
+ <xsl:with-param name="id" select="$id"/>
4993
+ </xsl:apply-templates>
4994
+ </xsl:copy>
4995
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4996
+ <xsl:param name="id"/>
4997
+ <xsl:copy>
4998
+ <xsl:copy-of select="@*"/>
4999
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
5000
+ <xsl:apply-templates select="node()" mode="simple-table-id">
5001
+ <xsl:with-param name="id" select="$id"/>
5002
+ </xsl:apply-templates>
5003
+ </xsl:copy>
5004
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
5005
+ <xsl:param name="id"/>
5006
+ <xsl:copy>
5007
+ <xsl:copy-of select="@*"/>
5008
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
5009
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
5010
+ <xsl:attribute name="id">
5011
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
5012
+ </xsl:attribute>
5013
+
5014
+ <xsl:for-each select="*[local-name() = 'p']">
5015
+ <xsl:copy>
5016
+ <xsl:copy-of select="@*"/>
5017
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5018
+ <xsl:attribute name="id">
5019
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
5020
+ </xsl:attribute>
5021
+
5022
+ <xsl:copy-of select="node()"/>
5023
+ </xsl:copy>
5024
+ </xsl:for-each>
5025
+
5026
+
5027
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
5028
+
5029
+ <xsl:variable name="td_text">
5030
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
5031
+ </xsl:variable>
5032
+
5033
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
5034
+
5035
+ <xsl:variable name="words">
5036
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
5037
+ <word>
5038
+ <xsl:copy-of select="."/>
5039
+ </word>
5040
+ </xsl:for-each>
5041
+
5042
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
5043
+ <xsl:copy-of select="."/>
5044
+ </xsl:for-each>
5045
+
5046
+ </xsl:variable>
5047
+
5048
+ <xsl:for-each select="xalan:nodeset($words)/word">
5049
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5050
+ <xsl:copy>
5051
+ <xsl:attribute name="id">
5052
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
5053
+ </xsl:attribute>
5054
+ <xsl:copy-of select="node()"/>
5055
+ </xsl:copy>
5056
+ </xsl:for-each>
5057
+ </xsl:if>
5058
+ </xsl:copy>
5059
+
5060
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
5061
+ <xsl:copy>
5062
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5063
+ </xsl:copy>
5064
+ </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">
5065
+ <xsl:variable name="formatting_tags">
5066
+ <xsl:call-template name="getFormattingTags"/>
5067
+ </xsl:variable>
5068
+ <word>
5069
+ <xsl:call-template name="enclose_text_in_tags">
5070
+ <xsl:with-param name="text" select="normalize-space(.)"/>
5071
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5072
+ </xsl:call-template>
5073
+ </word>
5074
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
5075
+
5076
+ <xsl:variable name="td_text" select="."/>
5077
+
5078
+ <xsl:variable name="string_with_added_zerospaces">
5079
+ <xsl:call-template name="add-zero-spaces-java">
5080
+ <xsl:with-param name="text" select="$td_text"/>
5081
+ </xsl:call-template>
5082
+ </xsl:variable>
5083
+
5084
+ <xsl:variable name="formatting_tags">
5085
+ <xsl:call-template name="getFormattingTags"/>
5086
+ </xsl:variable>
5087
+
5088
+ <!-- <word>text</word> -->
5089
+ <xsl:call-template name="tokenize_with_tags">
5090
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5091
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
5092
+ </xsl:call-template>
5093
+ </xsl:template><xsl:template name="getFormattingTags">
5094
+ <tags>
5095
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
5096
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
5097
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
5098
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
5099
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
5100
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
5101
+ </tags>
4052
5102
  </xsl:template><xsl:template name="getLang">
4053
5103
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4054
5104
  <xsl:variable name="language">
@@ -4242,6 +5292,11 @@
4242
5292
  </xsl:variable>
4243
5293
  <fo:inline xsl:use-attribute-sets="link-style">
4244
5294
 
5295
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5296
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5297
+ </xsl:if>
5298
+
5299
+
4245
5300
 
4246
5301
 
4247
5302
 
@@ -4508,7 +5563,19 @@
4508
5563
  <xsl:value-of select="$suffix"/>
4509
5564
  </xsl:if>
4510
5565
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
4511
- <fo:inline><xsl:apply-templates/></fo:inline>
5566
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5567
+ <xsl:choose>
5568
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
5569
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
5570
+ <xsl:apply-templates/>
5571
+ </fo:inline>
5572
+ </xsl:when>
5573
+ <xsl:otherwise>
5574
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
5575
+ <xsl:apply-templates/>
5576
+ </fo:block>
5577
+ </xsl:otherwise>
5578
+ </xsl:choose>
4512
5579
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
4513
5580
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
4514
5581
  <fo:block id="{@id}">
@@ -5314,7 +6381,7 @@
5314
6381
  </xsl:choose>
5315
6382
  </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">
5316
6383
  <xsl:value-of select="."/>
5317
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6384
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5318
6385
  <xsl:text> </xsl:text>
5319
6386
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5320
6387
  <xsl:copy>
@@ -5385,7 +6452,7 @@
5385
6452
 
5386
6453
 
5387
6454
 
5388
-
6455
+ <!-- 9 -->
5389
6456
 
5390
6457
 
5391
6458
 
@@ -5469,7 +6536,7 @@
5469
6536
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5470
6537
  <xsl:choose>
5471
6538
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5472
- <xsl:call-template name="interspers">
6539
+ <xsl:call-template name="interspers-java">
5473
6540
  <xsl:with-param name="str" select="."/>
5474
6541
  </xsl:call-template>
5475
6542
  </xsl:when>
@@ -5519,6 +6586,10 @@
5519
6586
  <xsl:with-param name="char" select="$char"/>
5520
6587
  </xsl:call-template>
5521
6588
  </xsl:if>
6589
+ </xsl:template><xsl:template name="interspers-java">
6590
+ <xsl:param name="str"/>
6591
+ <xsl:param name="char" select="$zero_width_space"/>
6592
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
5522
6593
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5523
6594
  <xsl:apply-templates mode="syntax_highlight"/>
5524
6595
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5739,7 +6810,9 @@
5739
6810
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5740
6811
  </xsl:if>
5741
6812
  <xsl:variable name="simple-table">
5742
- <xsl:call-template name="getSimpleTable"/>
6813
+ <xsl:call-template name="getSimpleTable">
6814
+ <xsl:with-param name="id" select="@id"/>
6815
+ </xsl:call-template>
5743
6816
  </xsl:variable>
5744
6817
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5745
6818
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -6166,6 +7239,7 @@
6166
7239
 
6167
7240
 
6168
7241
 
7242
+
6169
7243
  <xsl:choose>
6170
7244
  <xsl:when test="$depth &gt;= 5"/>
6171
7245
  <xsl:when test="$depth &gt;= 4">5</xsl:when>
@@ -6487,6 +7561,11 @@
6487
7561
  </xsl:otherwise>
6488
7562
  </xsl:choose>
6489
7563
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7564
+
7565
+ <xsl:apply-templates select="*[local-name() = 'name']">
7566
+ <xsl:with-param name="process">true</xsl:with-param>
7567
+ </xsl:apply-templates>
7568
+
6490
7569
  <fo:list-block xsl:use-attribute-sets="list-style">
6491
7570
 
6492
7571
 
@@ -6497,12 +7576,23 @@
6497
7576
 
6498
7577
 
6499
7578
 
7579
+ <xsl:if test="*[local-name() = 'name']">
7580
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7581
+ </xsl:if>
7582
+
6500
7583
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6501
7584
  </fo:list-block>
6502
7585
  <!-- <xsl:for-each select="./iho:note">
6503
7586
  <xsl:call-template name="note"/>
6504
7587
  </xsl:for-each> -->
6505
7588
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
7589
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
7590
+ <xsl:param name="process">false</xsl:param>
7591
+ <xsl:if test="$process = 'true'">
7592
+ <fo:block xsl:use-attribute-sets="list-name-style">
7593
+ <xsl:apply-templates/>
7594
+ </fo:block>
7595
+ </xsl:if>
6506
7596
  </xsl:template><xsl:template match="*[local-name()='li']">
6507
7597
  <fo:list-item xsl:use-attribute-sets="list-item-style">
6508
7598
  <xsl:copy-of select="@id"/>
@@ -6702,7 +7792,7 @@
6702
7792
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
6703
7793
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
6704
7794
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
6705
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
7795
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6706
7796
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6707
7797
  <!-- <row>
6708
7798
  <date>05-07-2013</date>
@@ -6773,7 +7863,7 @@
6773
7863
 
6774
7864
  </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
6775
7865
 
6776
- <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
7866
+ <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
6777
7867
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
6778
7868
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
6779
7869
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
@@ -6784,7 +7874,9 @@
6784
7874
 
6785
7875
  <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
6786
7876
  <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
6787
- <xsl:number format="[1]"/>
7877
+
7878
+ <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
7879
+
6788
7880
  </xsl:if>
6789
7881
 
6790
7882
  </fo:inline>
@@ -6806,143 +7898,7 @@
6806
7898
  <xsl:if test=".//ogc:fn">
6807
7899
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
6808
7900
  </xsl:if>
6809
- <xsl:choose>
6810
- <xsl:when test="*[local-name() = 'formattedref']">
6811
- <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6812
- </xsl:when>
6813
- <xsl:otherwise>
6814
- <xsl:variable name="personalAuthors">
6815
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'person']">
6816
- <xsl:call-template name="processPersonalAuthor"/>
6817
- </xsl:for-each>
6818
- <xsl:if test="not(*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'person'])">
6819
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']/*[local-name() = 'person']">
6820
- <xsl:call-template name="processPersonalAuthor"/>
6821
- </xsl:for-each>
6822
- </xsl:if>
6823
- </xsl:variable>
6824
-
6825
- <xsl:variable name="city" select="*[local-name() = 'place']"/>
6826
- <xsl:variable name="year">
6827
- <xsl:choose>
6828
- <xsl:when test="*[local-name() = 'date'][@type = 'published']">
6829
- <xsl:for-each select="*[local-name() = 'date'][@type = 'published']">
6830
- <xsl:call-template name="renderDate"/>
6831
- </xsl:for-each>
6832
- </xsl:when>
6833
- <xsl:when test="*[local-name() = 'date'][@type = 'issued']">
6834
- <xsl:for-each select="*[local-name() = 'date'][@type = 'issued']">
6835
- <xsl:call-template name="renderDate"/>
6836
- </xsl:for-each>
6837
- </xsl:when>
6838
- <xsl:when test="*[local-name() = 'date'][@type = 'circulated']">
6839
- <xsl:for-each select="*[local-name() = 'date'][@type = 'circulated']">
6840
- <xsl:call-template name="renderDate"/>
6841
- </xsl:for-each>
6842
- </xsl:when>
6843
- <xsl:otherwise>
6844
- <xsl:for-each select="*[local-name() = 'date']">
6845
- <xsl:call-template name="renderDate"/>
6846
- </xsl:for-each>
6847
- </xsl:otherwise>
6848
- </xsl:choose>
6849
- </xsl:variable>
6850
-
6851
- <xsl:variable name="uri" select="*[local-name() = 'uri']"/>
6852
-
6853
-
6854
- <!-- citation structure:
6855
- {personal names | organisation}: {document identifier}, {title}. {publisher}, {city} ({year})
6856
- -->
6857
-
6858
- <!-- Author(s) -->
6859
- <xsl:choose>
6860
- <xsl:when test="xalan:nodeset($personalAuthors)//author">
6861
- <xsl:for-each select="xalan:nodeset($personalAuthors)//author">
6862
- <xsl:apply-templates/>
6863
- <xsl:if test="position() != last()">, </xsl:if>
6864
- </xsl:for-each>
6865
- <xsl:text>: </xsl:text>
6866
- </xsl:when>
6867
- <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'abbreviation']">
6868
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'abbreviation']">
6869
- <xsl:value-of select="."/>
6870
- <xsl:if test="position() != last()">/</xsl:if>
6871
- </xsl:for-each>
6872
- <xsl:text>: </xsl:text>
6873
- </xsl:when>
6874
- <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
6875
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
6876
- <xsl:value-of select="."/>
6877
- <xsl:if test="position() != last()">, </xsl:if>
6878
- </xsl:for-each>
6879
- <xsl:text>: </xsl:text>
6880
- </xsl:when>
6881
- </xsl:choose>
6882
-
6883
-
6884
- <xsl:variable name="document_identifier">
6885
- <xsl:call-template name="processBibitemDocId"/>
6886
- </xsl:variable>
6887
-
6888
- <xsl:value-of select="$document_identifier"/>
6889
-
6890
- <xsl:apply-templates select="*[local-name() = 'note']"/>
6891
-
6892
- <xsl:variable name="isDraft">
6893
- <xsl:variable name="stage" select="normalize-space(*[local-name() = 'status']/*[local-name() = 'stage'])"/>
6894
- <xsl:if test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization'][*[local-name() = 'name']/text() = 'Open Geospatial Consortium'] and $stage != '' and $stage != 'published' and $stage != 'deprecated' and $stage != 'retired'">true</xsl:if>
6895
- </xsl:variable>
6896
-
6897
- <xsl:if test="$isDraft = 'true'">
6898
- <xsl:text> (Draft)</xsl:text>
6899
- </xsl:if>
6900
-
6901
- <xsl:text>, </xsl:text>
6902
-
6903
- <xsl:choose>
6904
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
6905
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
6906
- </xsl:when>
6907
- <xsl:otherwise>
6908
- <xsl:apply-templates select="*[local-name() = 'title']"/>
6909
- </xsl:otherwise>
6910
- </xsl:choose>
6911
-
6912
- <xsl:text>. </xsl:text>
6913
-
6914
- <xsl:if test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
6915
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name']">
6916
- <xsl:value-of select="."/>
6917
- <xsl:if test="position() != last()">, </xsl:if>
6918
- </xsl:for-each>
6919
- <xsl:if test="normalize-space($city) != ''">, </xsl:if>
6920
- </xsl:if>
6921
-
6922
- <xsl:value-of select="$city"/>
6923
-
6924
- <xsl:if test="(*[local-name() = 'contributor'][*[local-name() = 'role']/@type = 'publisher']/*[local-name() = 'organization']/*[local-name() = 'name'] or normalize-space($city) != '') and normalize-space($year) != ''">
6925
- <xsl:text> </xsl:text>
6926
- </xsl:if>
6927
-
6928
- <xsl:if test="normalize-space($year) != ''">
6929
- <xsl:text>(</xsl:text>
6930
- <xsl:value-of select="$year"/>
6931
- <xsl:text>). </xsl:text>
6932
- </xsl:if>
6933
-
6934
- <xsl:if test="normalize-space($uri) != ''">
6935
- <fo:inline>
6936
-
6937
- <xsl:text> </xsl:text>
6938
- <fo:basic-link external-destination="{$uri}" fox:alt-text="{$uri}">
6939
- <xsl:value-of select="$uri"/>
6940
- </fo:basic-link>
6941
- </fo:inline>
6942
- </xsl:if>
6943
-
6944
- </xsl:otherwise>
6945
- </xsl:choose>
7901
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6946
7902
  <!-- end OGC bibitem processing-->
6947
7903
 
6948
7904
  </xsl:template><xsl:template name="processBibitemDocId">
@@ -7252,12 +8208,16 @@
7252
8208
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
7253
8209
 
7254
8210
 
8211
+
8212
+
7255
8213
 
7256
8214
 
7257
8215
 
7258
8216
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
7259
8217
 
7260
8218
 
8219
+
8220
+
7261
8221
  <fo:block xsl:use-attribute-sets="admonition-name-style">
7262
8222
  <xsl:call-template name="displayAdmonitionName"/>
7263
8223
  </fo:block>
@@ -7270,25 +8230,32 @@
7270
8230
  </fo:block-container>
7271
8231
 
7272
8232
  </xsl:template><xsl:template name="displayAdmonitionName">
7273
-
8233
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
8234
+ <!-- <xsl:choose>
8235
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
8236
+ <xsl:choose>
8237
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
8238
+ <xsl:otherwise>
8239
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8240
+ </xsl:otherwise>
8241
+ </xsl:choose>
8242
+ </xsl:when>
8243
+ <xsl:otherwise>
7274
8244
  <xsl:apply-templates select="*[local-name() = 'name']"/>
7275
8245
  <xsl:if test="not(*[local-name() = 'name'])">
7276
8246
  <xsl:apply-templates select="@type"/>
7277
8247
  </xsl:if>
7278
-
7279
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7280
- <xsl:apply-templates/>
7281
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
7282
- <xsl:variable name="admonition_type_">
7283
- <xsl:call-template name="getLocalizedString">
7284
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
7285
- </xsl:call-template>
8248
+ </xsl:otherwise>
8249
+ </xsl:choose> -->
8250
+ <xsl:variable name="name">
8251
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7286
8252
  </xsl:variable>
7287
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
7288
- <xsl:value-of select="$admonition_type"/>
7289
- <xsl:if test="$admonition_type = ''">
7290
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
8253
+ <xsl:copy-of select="$name"/>
8254
+ <xsl:if test="normalize-space($name) != ''">
8255
+ <xsl:value-of select="$sep"/>
7291
8256
  </xsl:if>
8257
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8258
+ <xsl:apply-templates/>
7292
8259
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
7293
8260
 
7294
8261
  <fo:block xsl:use-attribute-sets="admonition-p-style">
@@ -7459,6 +8426,8 @@
7459
8426
  </xsl:when>
7460
8427
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
7461
8428
  </xsl:choose>
8429
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
8430
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
7462
8431
  </xsl:template><xsl:template name="printEdition">
7463
8432
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
7464
8433
  <xsl:text> </xsl:text>
@@ -7565,6 +8534,27 @@
7565
8534
  </xsl:when>
7566
8535
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
7567
8536
  </xsl:choose>
8537
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
8538
+ <xsl:param name="num"/>
8539
+ <xsl:variable name="monthStr">
8540
+ <xsl:choose>
8541
+ <xsl:when test="$num = '01'">january</xsl:when>
8542
+ <xsl:when test="$num = '02'">february</xsl:when>
8543
+ <xsl:when test="$num = '03'">march</xsl:when>
8544
+ <xsl:when test="$num = '04'">april</xsl:when>
8545
+ <xsl:when test="$num = '05'">may</xsl:when>
8546
+ <xsl:when test="$num = '06'">june</xsl:when>
8547
+ <xsl:when test="$num = '07'">july</xsl:when>
8548
+ <xsl:when test="$num = '08'">august</xsl:when>
8549
+ <xsl:when test="$num = '09'">september</xsl:when>
8550
+ <xsl:when test="$num = '10'">october</xsl:when>
8551
+ <xsl:when test="$num = '11'">november</xsl:when>
8552
+ <xsl:when test="$num = '12'">december</xsl:when>
8553
+ </xsl:choose>
8554
+ </xsl:variable>
8555
+ <xsl:call-template name="getLocalizedString">
8556
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
8557
+ </xsl:call-template>
7568
8558
  </xsl:template><xsl:template name="insertKeywords">
7569
8559
  <xsl:param name="sorting" select="'true'"/>
7570
8560
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -7760,6 +8750,7 @@
7760
8750
 
7761
8751
 
7762
8752
 
8753
+
7763
8754
  <xsl:value-of select="document('')//*/namespace::ogc"/>
7764
8755
 
7765
8756
 
@@ -8171,4 +9162,40 @@
8171
9162
  <xsl:value-of select="$value"/>
8172
9163
  </xsl:otherwise>
8173
9164
  </xsl:choose>
9165
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
9166
+ <xsl:param name="level">0</xsl:param>
9167
+
9168
+ <fo:block margin-left="{2*$level}mm">
9169
+ <xsl:text>
9170
+ &lt;</xsl:text>
9171
+ <xsl:value-of select="local-name()"/>
9172
+ <xsl:for-each select="@*">
9173
+ <xsl:text> </xsl:text>
9174
+ <xsl:value-of select="local-name()"/>
9175
+ <xsl:text>="</xsl:text>
9176
+ <xsl:value-of select="."/>
9177
+ <xsl:text>"</xsl:text>
9178
+ </xsl:for-each>
9179
+ <xsl:text>&gt;</xsl:text>
9180
+
9181
+ <xsl:if test="not(*)">
9182
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
9183
+ <xsl:text>&lt;/</xsl:text>
9184
+ <xsl:value-of select="local-name()"/>
9185
+ <xsl:text>&gt;</xsl:text>
9186
+ </xsl:if>
9187
+ </fo:block>
9188
+
9189
+ <xsl:if test="*">
9190
+ <fo:block>
9191
+ <xsl:apply-templates mode="print_as_xml">
9192
+ <xsl:with-param name="level" select="$level + 1"/>
9193
+ </xsl:apply-templates>
9194
+ </fo:block>
9195
+ <fo:block margin-left="{2*$level}mm">
9196
+ <xsl:text>&lt;/</xsl:text>
9197
+ <xsl:value-of select="local-name()"/>
9198
+ <xsl:text>&gt;</xsl:text>
9199
+ </fo:block>
9200
+ </xsl:if>
8174
9201
  </xsl:template></xsl:stylesheet>