metanorma-un 0.9.0 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@
14
14
  <contents>
15
15
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
16
16
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
17
- <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
17
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']" mode="contents"/>
18
18
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
19
19
 
20
20
  <xsl:apply-templates select="/un:un-standard/un:sections/*" mode="contents"/>
@@ -289,10 +289,10 @@
289
289
  </xsl:if>
290
290
 
291
291
  <!-- Preface Pages (except Abstract, that showed in Summary on cover page`) -->
292
- <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract')]">
292
+ <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() != 'note' or local-name() != 'admonition')]">
293
293
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
294
294
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
295
- <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
295
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']"/>
296
296
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
297
297
  <fo:block break-after="page"/>
298
298
  </xsl:if>
@@ -481,6 +481,7 @@
481
481
  </xsl:template>
482
482
 
483
483
  <xsl:template match="un:p" name="paragraph">
484
+ <xsl:param name="split_keep-within-line"/>
484
485
  <fo:block margin-bottom="6pt" line-height="122%">
485
486
  <xsl:if test="following-sibling::*">
486
487
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -491,7 +492,9 @@
491
492
  <xsl:otherwise>justify</xsl:otherwise>
492
493
  </xsl:choose>
493
494
  </xsl:attribute>
494
- <xsl:apply-templates/>
495
+ <xsl:apply-templates>
496
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
497
+ </xsl:apply-templates>
495
498
  </fo:block>
496
499
  </xsl:template>
497
500
 
@@ -679,86 +682,8 @@
679
682
  </fo:block-container>
680
683
  </xsl:template>
681
684
 
682
- <!-- Examples:
683
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
684
- [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
685
- -->
686
- <xsl:template match="un:annex//un:bibitem">
687
- <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
688
- <xsl:if test="un:formattedref">
689
- <xsl:choose>
690
- <xsl:when test="un:docidentifier[@type = 'metanorma']">
691
- <xsl:attribute name="margin-left">0</xsl:attribute>
692
- <xsl:attribute name="text-indent">0</xsl:attribute>
693
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
694
- <!-- create list -->
695
- <fo:list-block>
696
- <fo:list-item>
697
- <fo:list-item-label end-indent="label-end()">
698
- <fo:block>
699
- <xsl:apply-templates select="un:docidentifier[@type = 'metanorma']" mode="process"/>
700
- </fo:block>
701
- </fo:list-item-label>
702
- <fo:list-item-body start-indent="body-start()">
703
- <fo:block margin-left="3mm">
704
- <xsl:apply-templates select="un:formattedref"/>
705
- </fo:block>
706
- </fo:list-item-body>
707
- </fo:list-item>
708
- </fo:list-block>
709
- </xsl:when>
710
- <xsl:otherwise>
711
- <xsl:apply-templates select="un:formattedref"/>
712
- <xsl:apply-templates select="un:docidentifier[(@type != 'metanorma' and @type != 'metanorma-ordinal') or not(@type)]" mode="process"/>
713
- </xsl:otherwise>
714
- </xsl:choose>
715
- </xsl:if>
716
- <xsl:if test="un:title">
717
- <xsl:for-each select="un:contributor">
718
- <xsl:value-of select="un:organization/un:name"/>
719
- <xsl:if test="position() != last()">, </xsl:if>
720
- </xsl:for-each>
721
- <xsl:text> (</xsl:text>
722
- <xsl:variable name="date">
723
- <xsl:choose>
724
- <xsl:when test="un:date[@type='issued']">
725
- <xsl:value-of select="un:date[@type='issued']/un:on"/>
726
- </xsl:when>
727
- <xsl:otherwise>
728
- <xsl:value-of select="un:date/un:on"/>
729
- </xsl:otherwise>
730
- </xsl:choose>
731
- </xsl:variable>
732
- <xsl:value-of select="$date"/>
733
- <xsl:text>) </xsl:text>
734
- <fo:inline font-style="italic"><xsl:value-of select="un:title"/></fo:inline>
735
- <xsl:if test="un:contributor[un:role/@type='publisher']/un:organization/un:name">
736
- <xsl:text> (</xsl:text><xsl:value-of select="un:contributor[un:role/@type='publisher']/un:organization/un:name"/><xsl:text>)</xsl:text>
737
- </xsl:if>
738
- <xsl:text>, </xsl:text>
739
- <xsl:value-of select="$date"/>
740
- <xsl:text>. </xsl:text>
741
- <xsl:value-of select="un:docidentifier"/>
742
- <xsl:value-of select="$linebreak"/>
743
- <xsl:value-of select="un:uri"/>
744
- </xsl:if>
745
- </fo:block>
746
- </xsl:template>
747
-
748
- <xsl:template match="un:annex//un:bibitem//un:formattedref">
749
- <xsl:apply-templates/>
750
- </xsl:template>
751
-
752
- <xsl:template match="un:docidentifier[@type = 'metanorma' or @type = 'metanorma-ordinal']" mode="process">
753
- <xsl:apply-templates/>
754
- </xsl:template>
755
- <xsl:template match="un:docidentifier[(@type != 'metanorma' and @type != 'metanorma-ordinal') or not(@type)]" mode="process">
756
- <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
757
- </xsl:template>
758
- <xsl:template match="un:docidentifier"/>
759
685
 
760
686
 
761
-
762
687
  <xsl:template match="un:dl" priority="2">
763
688
  <fo:block-container margin-left="0mm">
764
689
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -833,12 +758,41 @@
833
758
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAJkAAAAmCAYAAADXwDkaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJNaWNyb3NvZnTCriBXb3JkIDIwMTYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzM0NUVBQ0U2RUMzMTFFQUIzQjg4RDg3OEE1NEI2QzAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzM0NUVBQ0Y2RUMzMTFFQUIzQjg4RDg3OEE1NEI2QzAiPiA8ZGM6Y3JlYXRvcj4gPHJkZjpTZXE+IDxyZGY6bGk+RGhhbmplZTwvcmRmOmxpPiA8L3JkZjpTZXE+IDwvZGM6Y3JlYXRvcj4gPGRjOnRpdGxlPiA8cmRmOkFsdD4gPHJkZjpsaSB4bWw6bGFuZz0ieC1kZWZhdWx0Ij4xODAxNzYzPC9yZGY6bGk+IDwvcmRmOkFsdD4gPC9kYzp0aXRsZT4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVm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</xsl:text>
834
759
  </xsl:variable>
835
760
 
836
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
761
+ <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_">
762
+ <xsl:for-each select="$table_widths_from_if//table">
763
+ <xsl:copy>
764
+ <xsl:copy-of select="@*"/>
765
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
766
+ </xsl:copy>
767
+ </xsl:for-each>
768
+ </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_">
769
+ false
770
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
837
771
  <xsl:call-template name="getLang"/>
838
- </xsl:variable><xsl:variable name="pageWidth_">
839
- 210
772
+ </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_">
773
+ <xsl:choose>
774
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
775
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
776
+ </xsl:choose>
777
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
778
+ <xsl:choose>
779
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
780
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
781
+ </xsl:choose>
782
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
783
+ <xsl:choose>
784
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
785
+ <xsl:otherwise>
786
+ 210
787
+ </xsl:otherwise>
788
+ </xsl:choose>
840
789
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
841
- 297
790
+ <xsl:choose>
791
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
792
+ <xsl:otherwise>
793
+ 297
794
+ </xsl:otherwise>
795
+ </xsl:choose>
842
796
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
843
797
  40
844
798
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -950,7 +904,8 @@
950
904
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
951
905
  </xsl:otherwise>
952
906
  </xsl:choose>
953
- </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">
907
+ </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">
908
+
954
909
 
955
910
 
956
911
 
@@ -967,7 +922,8 @@
967
922
 
968
923
 
969
924
 
970
- <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
925
+ <xsl:attribute name="font-family">Times New Roman, STIX Two Math, <xsl:value-of select="$font_noto_serif"/></xsl:attribute>
926
+ <xsl:attribute name="font-family-generic">Serif</xsl:attribute>
971
927
  <xsl:attribute name="font-size">10pt</xsl:attribute>
972
928
 
973
929
  </xsl:attribute-set><xsl:template name="insertRootStyle">
@@ -981,17 +937,60 @@
981
937
  </xsl:variable>
982
938
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
983
939
 
940
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
941
+
984
942
  <xsl:for-each select="$root-style_/root-style/@*">
943
+
985
944
  <xsl:choose>
986
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
945
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
946
+ <xsl:when test="local-name() = 'font-family'">
947
+
948
+ <xsl:variable name="font_regional_prefix">
949
+ <xsl:choose>
950
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
951
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
952
+ </xsl:choose>
953
+ </xsl:variable>
954
+
987
955
  <xsl:attribute name="{local-name()}">
988
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
956
+
957
+ <xsl:variable name="font_extended">
958
+ <xsl:choose>
959
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
960
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
961
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
962
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
963
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
964
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
965
+ </xsl:choose>
966
+ </xsl:variable>
967
+ <xsl:if test="normalize-space($font_extended) != ''">
968
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
969
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
970
+ </xsl:if>
971
+
972
+ <xsl:value-of select="."/>
973
+
974
+ <xsl:if test="$additional_fonts != ''">
975
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
976
+ </xsl:if>
989
977
  </xsl:attribute>
990
978
  </xsl:when>
991
979
  <xsl:otherwise>
992
980
  <xsl:copy-of select="."/>
993
981
  </xsl:otherwise>
994
982
  </xsl:choose>
983
+
984
+ <!-- <xsl:choose>
985
+ <xsl:when test="local-name() = 'font-family'">
986
+ <xsl:attribute name="{local-name()}">
987
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
988
+ </xsl:attribute>
989
+ </xsl:when>
990
+ <xsl:otherwise>
991
+ <xsl:copy-of select="."/>
992
+ </xsl:otherwise>
993
+ </xsl:choose> -->
995
994
  </xsl:for-each>
996
995
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
997
996
 
@@ -1062,13 +1061,14 @@
1062
1061
 
1063
1062
 
1064
1063
 
1064
+
1065
1065
 
1066
1066
 
1067
1067
 
1068
1068
 
1069
1069
 
1070
1070
 
1071
- <xsl:attribute name="font-family">Courier New</xsl:attribute>
1071
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1072
1072
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1073
1073
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1074
1074
 
@@ -1106,6 +1106,7 @@
1106
1106
 
1107
1107
 
1108
1108
 
1109
+
1109
1110
 
1110
1111
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1111
1112
 
@@ -1121,6 +1122,7 @@
1121
1122
 
1122
1123
 
1123
1124
 
1125
+
1124
1126
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1125
1127
 
1126
1128
 
@@ -1140,6 +1142,7 @@
1140
1142
 
1141
1143
 
1142
1144
 
1145
+
1143
1146
 
1144
1147
 
1145
1148
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -1180,6 +1183,7 @@
1180
1183
 
1181
1184
  </xsl:attribute-set><xsl:variable name="table-border_">
1182
1185
 
1186
+
1183
1187
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
1184
1188
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1185
1189
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1202,6 +1206,7 @@
1202
1206
 
1203
1207
 
1204
1208
 
1209
+
1205
1210
  <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1206
1211
  <xsl:attribute name="font-size">8pt</xsl:attribute>
1207
1212
 
@@ -1231,6 +1236,7 @@
1231
1236
 
1232
1237
 
1233
1238
 
1239
+
1234
1240
  <xsl:attribute name="border-top">0.5pt solid black</xsl:attribute>
1235
1241
 
1236
1242
 
@@ -1240,6 +1246,7 @@
1240
1246
 
1241
1247
 
1242
1248
 
1249
+
1243
1250
 
1244
1251
 
1245
1252
 
@@ -1284,6 +1291,7 @@
1284
1291
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1285
1292
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1286
1293
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1294
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1287
1295
  <xsl:attribute name="display-align">center</xsl:attribute>
1288
1296
 
1289
1297
 
@@ -1312,6 +1320,8 @@
1312
1320
  <xsl:attribute name="display-align">center</xsl:attribute>
1313
1321
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1314
1322
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1323
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1324
+
1315
1325
 
1316
1326
 
1317
1327
 
@@ -1345,7 +1355,7 @@
1345
1355
 
1346
1356
 
1347
1357
 
1348
-
1358
+
1349
1359
 
1350
1360
 
1351
1361
 
@@ -1360,6 +1370,7 @@
1360
1370
 
1361
1371
 
1362
1372
 
1373
+
1363
1374
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
1364
1375
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1365
1376
 
@@ -1368,6 +1379,8 @@
1368
1379
 
1369
1380
 
1370
1381
 
1382
+
1383
+
1371
1384
  </xsl:attribute-set><xsl:attribute-set name="table-fn-number-style">
1372
1385
  <xsl:attribute name="font-size">80%</xsl:attribute>
1373
1386
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1383,6 +1396,7 @@
1383
1396
 
1384
1397
 
1385
1398
 
1399
+
1386
1400
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1387
1401
 
1388
1402
  </xsl:attribute-set><xsl:attribute-set name="fn-container-body-style">
@@ -1406,7 +1420,8 @@
1406
1420
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1407
1421
 
1408
1422
 
1409
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1423
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1424
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1410
1425
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1411
1426
 
1412
1427
 
@@ -1418,6 +1433,29 @@
1418
1433
 
1419
1434
 
1420
1435
 
1436
+
1437
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1438
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1439
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+
1451
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1452
+
1453
+
1454
+
1455
+
1456
+
1457
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1458
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1421
1459
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1422
1460
 
1423
1461
 
@@ -1447,6 +1485,7 @@
1447
1485
 
1448
1486
 
1449
1487
 
1488
+
1450
1489
 
1451
1490
 
1452
1491
 
@@ -1514,6 +1553,8 @@
1514
1553
 
1515
1554
 
1516
1555
 
1556
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
1557
+
1517
1558
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1518
1559
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
1519
1560
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -1554,6 +1595,7 @@
1554
1595
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1555
1596
 
1556
1597
 
1598
+
1557
1599
 
1558
1600
 
1559
1601
 
@@ -1598,6 +1640,7 @@
1598
1640
 
1599
1641
 
1600
1642
 
1643
+
1601
1644
  </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
1602
1645
  <xsl:attribute name="text-align">right</xsl:attribute>
1603
1646
 
@@ -1620,17 +1663,16 @@
1620
1663
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
1621
1664
 
1622
1665
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1666
+ <xsl:attribute name="width">100%</xsl:attribute>
1667
+ <xsl:attribute name="content-height">100%</xsl:attribute>
1668
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
1623
1669
 
1624
1670
 
1625
1671
 
1626
- <xsl:attribute name="width">100%</xsl:attribute>
1627
- <xsl:attribute name="content-height">100%</xsl:attribute>
1628
1672
  <xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
1629
- <xsl:attribute name="scaling">uniform</xsl:attribute>
1630
1673
 
1631
1674
 
1632
-
1633
-
1675
+
1634
1676
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1635
1677
 
1636
1678
 
@@ -1708,10 +1750,29 @@
1708
1750
 
1709
1751
 
1710
1752
 
1753
+
1711
1754
  <xsl:attribute name="provisional-distance-between-starts">4mm</xsl:attribute>
1712
1755
  <xsl:attribute name="margin-left">-8mm</xsl:attribute>
1713
1756
 
1714
1757
 
1758
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
1759
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1760
+
1761
+
1762
+
1763
+
1764
+
1765
+
1766
+
1767
+
1768
+
1769
+
1770
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1771
+
1772
+
1773
+
1774
+
1775
+
1715
1776
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1716
1777
 
1717
1778
 
@@ -1755,6 +1816,7 @@
1755
1816
 
1756
1817
 
1757
1818
 
1819
+
1758
1820
  <xsl:attribute name="font-size">60%</xsl:attribute>
1759
1821
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1760
1822
 
@@ -1781,6 +1843,7 @@
1781
1843
 
1782
1844
 
1783
1845
 
1846
+
1784
1847
  <xsl:attribute name="font-size">9pt</xsl:attribute>
1785
1848
  <xsl:attribute name="text-align">justify</xsl:attribute>
1786
1849
  <xsl:attribute name="line-height">125%</xsl:attribute>
@@ -1805,6 +1868,7 @@
1805
1868
 
1806
1869
 
1807
1870
 
1871
+
1808
1872
  <xsl:attribute name="font-size">60%</xsl:attribute>
1809
1873
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1810
1874
  <xsl:attribute name="padding-right">8mm</xsl:attribute>
@@ -1824,6 +1888,7 @@
1824
1888
 
1825
1889
 
1826
1890
 
1891
+
1827
1892
  <xsl:attribute name="border">0.25pt solid black</xsl:attribute>
1828
1893
  <xsl:attribute name="margin-left">-3mm</xsl:attribute>
1829
1894
  <xsl:attribute name="margin-right">-3mm</xsl:attribute>
@@ -1832,6 +1897,9 @@
1832
1897
 
1833
1898
 
1834
1899
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
1900
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
1901
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
1902
+
1835
1903
 
1836
1904
 
1837
1905
 
@@ -1876,6 +1944,7 @@
1876
1944
 
1877
1945
 
1878
1946
 
1947
+
1879
1948
  <xsl:attribute name="text-align">justify</xsl:attribute>
1880
1949
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1881
1950
  <xsl:attribute name="line-height">122%</xsl:attribute>
@@ -1918,6 +1987,7 @@
1918
1987
 
1919
1988
 
1920
1989
 
1990
+
1921
1991
  </xsl:attribute-set><xsl:attribute-set name="bibitem-non-normative-style">
1922
1992
 
1923
1993
 
@@ -1937,6 +2007,7 @@
1937
2007
 
1938
2008
 
1939
2009
 
2010
+
1940
2011
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-list-body-style">
1941
2012
 
1942
2013
 
@@ -1963,6 +2034,7 @@
1963
2034
 
1964
2035
 
1965
2036
 
2037
+
1966
2038
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1967
2039
 
1968
2040
  </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-number-style">
@@ -1983,6 +2055,7 @@
1983
2055
 
1984
2056
 
1985
2057
 
2058
+
1986
2059
  <xsl:attribute name="font-size">60%</xsl:attribute>
1987
2060
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1988
2061
 
@@ -2001,6 +2074,7 @@
2001
2074
 
2002
2075
 
2003
2076
 
2077
+
2004
2078
  </xsl:attribute-set><xsl:attribute-set name="references-non-normative-style">
2005
2079
 
2006
2080
 
@@ -2112,13 +2186,13 @@
2112
2186
 
2113
2187
  </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">
2114
2188
  <xsl:variable name="nodes_preface_">
2115
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2189
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2116
2190
  <node id="{@id}"/>
2117
2191
  </xsl:for-each>
2118
2192
  </xsl:variable>
2119
2193
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2120
2194
 
2121
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2195
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2122
2196
  <xsl:sort select="@displayorder" data-type="number"/>
2123
2197
 
2124
2198
  <!-- process Section's title -->
@@ -2184,7 +2258,7 @@
2184
2258
  </xsl:for-each>
2185
2259
  </figures>
2186
2260
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2187
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2261
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2188
2262
  <xsl:sort select="@displayorder" data-type="number"/>
2189
2263
  <xsl:apply-templates select="."/>
2190
2264
  </xsl:for-each>
@@ -2238,7 +2312,38 @@
2238
2312
  </xsl:template><xsl:template match="*[local-name()='br']">
2239
2313
  <xsl:value-of select="$linebreak"/>
2240
2314
  </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2241
- <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2315
+ <xsl:param name="split_keep-within-line"/>
2316
+
2317
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2318
+ <xsl:choose>
2319
+
2320
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2321
+ <xsl:variable name="sep">_</xsl:variable>
2322
+ <xsl:variable name="items">
2323
+ <xsl:call-template name="split">
2324
+ <xsl:with-param name="pText" select="."/>
2325
+ <xsl:with-param name="sep" select="$sep"/>
2326
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2327
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2328
+ </xsl:call-template>
2329
+ </xsl:variable>
2330
+ <xsl:for-each select="xalan:nodeset($items)/item">
2331
+ <xsl:choose>
2332
+ <xsl:when test=". = $sep">
2333
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2334
+ </xsl:when>
2335
+ <xsl:otherwise>
2336
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2337
+ </xsl:otherwise>
2338
+ </xsl:choose>
2339
+ </xsl:for-each>
2340
+ </xsl:when>
2341
+
2342
+ <xsl:otherwise>
2343
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2344
+ </xsl:otherwise>
2345
+
2346
+ </xsl:choose>
2242
2347
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2243
2348
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2244
2349
  <xsl:apply-templates/>
@@ -2330,9 +2435,14 @@
2330
2435
 
2331
2436
  <xsl:variable name="table">
2332
2437
 
2333
- <xsl:variable name="simple-table">
2334
- <xsl:call-template name="getSimpleTable"/>
2438
+ <xsl:variable name="simple-table">
2439
+ <xsl:call-template name="getSimpleTable">
2440
+ <xsl:with-param name="id" select="@id"/>
2441
+ </xsl:call-template>
2335
2442
  </xsl:variable>
2443
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2444
+
2445
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2336
2446
 
2337
2447
 
2338
2448
  <!-- Display table's name before table as standalone block -->
@@ -2355,7 +2465,23 @@
2355
2465
  </xsl:call-template>
2356
2466
  </xsl:if>
2357
2467
  </xsl:variable>
2358
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2468
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2469
+
2470
+ <!-- DEBUG -->
2471
+ <xsl:if test="$table_if_debug = 'true'">
2472
+ <fo:block font-size="60%">
2473
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2474
+ </fo:block>
2475
+ </xsl:if>
2476
+
2477
+
2478
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2479
+
2480
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2481
+ DEBUG
2482
+ colwidths=<xsl:copy-of select="$colwidths"/>
2483
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2484
+
2359
2485
 
2360
2486
 
2361
2487
  <xsl:variable name="margin-side">
@@ -2380,6 +2506,8 @@
2380
2506
 
2381
2507
 
2382
2508
 
2509
+
2510
+
2383
2511
 
2384
2512
 
2385
2513
 
@@ -2424,12 +2552,22 @@
2424
2552
 
2425
2553
 
2426
2554
 
2555
+
2556
+
2427
2557
  </xsl:element>
2428
2558
  </xsl:variable>
2429
2559
 
2560
+ <xsl:if test="$isGenerateTableIF = 'true'">
2561
+ <!-- to determine start of table -->
2562
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2563
+ </xsl:if>
2430
2564
 
2431
2565
  <fo:table id="{@id}">
2432
2566
 
2567
+ <xsl:if test="$isGenerateTableIF = 'true'">
2568
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2569
+ </xsl:if>
2570
+
2433
2571
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2434
2572
  <xsl:attribute name="{local-name()}">
2435
2573
  <xsl:value-of select="."/>
@@ -2443,24 +2581,47 @@
2443
2581
 
2444
2582
 
2445
2583
  <xsl:choose>
2446
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2447
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2448
- <fo:table-column column-width="{@width}"/>
2449
- </xsl:for-each>
2584
+ <xsl:when test="$isGenerateTableIF = 'true'">
2585
+ <!-- generate IF for table widths -->
2586
+ <!-- example:
2587
+ <tr>
2588
+ <td valign="top" align="left" id="tab-symdu_1_1">
2589
+ <p>Symbol</p>
2590
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2591
+ </td>
2592
+ <td valign="top" align="left" id="tab-symdu_1_2">
2593
+ <p>Description</p>
2594
+ <word id="tab-symdu_1_2_word_1">Description</word>
2595
+ </td>
2596
+ </tr>
2597
+ -->
2598
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2599
+
2450
2600
  </xsl:when>
2451
2601
  <xsl:otherwise>
2452
- <xsl:call-template name="insertTableColumnWidth">
2453
- <xsl:with-param name="colwidths" select="$colwidths"/>
2454
- </xsl:call-template>
2455
- </xsl:otherwise>
2456
- </xsl:choose>
2457
2602
 
2458
- <xsl:choose>
2459
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2460
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2461
- </xsl:when>
2462
- <xsl:otherwise>
2463
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
2603
+ <xsl:choose>
2604
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2605
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2606
+ <fo:table-column column-width="{@width}"/>
2607
+ </xsl:for-each>
2608
+ </xsl:when>
2609
+ <xsl:otherwise>
2610
+ <xsl:call-template name="insertTableColumnWidth">
2611
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2612
+ </xsl:call-template>
2613
+ </xsl:otherwise>
2614
+ </xsl:choose>
2615
+
2616
+ <xsl:choose>
2617
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2618
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2619
+ </xsl:when>
2620
+ <xsl:otherwise>
2621
+ <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 -->
2622
+ </xsl:otherwise>
2623
+ </xsl:choose>
2624
+
2464
2625
  </xsl:otherwise>
2465
2626
  </xsl:choose>
2466
2627
 
@@ -2535,23 +2696,29 @@
2535
2696
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2536
2697
  <xsl:param name="continued"/>
2537
2698
  <xsl:if test="normalize-space() != ''">
2538
- <fo:block xsl:use-attribute-sets="table-name-style">
2539
-
2540
-
2541
-
2542
-
2699
+
2700
+
2543
2701
 
2544
- <xsl:choose>
2545
- <xsl:when test="$continued = 'true'">
2702
+ <fo:block xsl:use-attribute-sets="table-name-style">
2703
+
2546
2704
 
2547
- </xsl:when>
2548
- <xsl:otherwise>
2549
- <xsl:apply-templates/>
2550
- </xsl:otherwise>
2551
- </xsl:choose>
2552
-
2705
+
2706
+
2707
+
2708
+ <xsl:choose>
2709
+ <xsl:when test="$continued = 'true'">
2710
+
2711
+ </xsl:when>
2712
+ <xsl:otherwise>
2713
+ <xsl:apply-templates/>
2714
+ </xsl:otherwise>
2715
+ </xsl:choose>
2716
+
2717
+
2718
+ </fo:block>
2719
+
2553
2720
 
2554
- </fo:block>
2721
+
2555
2722
  </xsl:if>
2556
2723
  </xsl:template><xsl:template name="calculate-columns-numbers">
2557
2724
  <xsl:param name="table-row"/>
@@ -2560,11 +2727,22 @@
2560
2727
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2561
2728
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2562
2729
  </xsl:template><xsl:template name="calculate-column-widths">
2730
+ <xsl:param name="table"/>
2731
+ <xsl:param name="cols-count"/>
2732
+
2733
+ <xsl:call-template name="calculate-column-widths-proportional">
2734
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2735
+ <xsl:with-param name="table" select="$table"/>
2736
+ </xsl:call-template>
2737
+
2738
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2563
2739
  <xsl:param name="table"/>
2564
2740
  <xsl:param name="cols-count"/>
2565
2741
  <xsl:param name="curr-col" select="1"/>
2566
2742
  <xsl:param name="width" select="0"/>
2567
2743
 
2744
+ <!-- table=<xsl:copy-of select="$table"/> -->
2745
+
2568
2746
  <xsl:if test="$curr-col &lt;= $cols-count">
2569
2747
  <xsl:variable name="widths">
2570
2748
  <xsl:choose>
@@ -2602,10 +2780,15 @@
2602
2780
  </xsl:for-each>
2603
2781
  </xsl:when>
2604
2782
  <xsl:otherwise>
2605
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2783
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2784
+
2785
+ <!-- <table><xsl:copy-of select="$table"/></table>
2786
+ -->
2787
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2606
2788
  <xsl:variable name="td_text">
2607
2789
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2608
2790
  </xsl:variable>
2791
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2609
2792
  <xsl:variable name="words">
2610
2793
  <xsl:variable name="string_with_added_zerospaces">
2611
2794
  <xsl:call-template name="add-zero-spaces-java">
@@ -2620,6 +2803,7 @@
2620
2803
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2621
2804
  </xsl:call-template>
2622
2805
  </xsl:variable>
2806
+ <!-- words=<xsl:copy-of select="$words"/> -->
2623
2807
  <xsl:variable name="max_length">
2624
2808
  <xsl:call-template name="max_length">
2625
2809
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
@@ -2644,6 +2828,8 @@
2644
2828
  </xsl:choose>
2645
2829
  </xsl:variable>
2646
2830
 
2831
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2832
+
2647
2833
  <column>
2648
2834
  <xsl:for-each select="xalan:nodeset($widths)//width">
2649
2835
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2652,33 +2838,271 @@
2652
2838
  </xsl:if>
2653
2839
  </xsl:for-each>
2654
2840
  </column>
2655
- <xsl:call-template name="calculate-column-widths">
2841
+ <xsl:call-template name="calculate-column-widths-proportional">
2656
2842
  <xsl:with-param name="cols-count" select="$cols-count"/>
2657
2843
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2658
2844
  <xsl:with-param name="table" select="$table"/>
2659
2845
  </xsl:call-template>
2660
2846
  </xsl:if>
2661
- </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
2847
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2662
2848
  <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2663
2849
  <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2664
2850
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2851
+
2852
+ <!-- if all capitals english letters or digits -->
2853
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2854
+ <xsl:call-template name="repeat">
2855
+ <xsl:with-param name="char" select="'X'"/>
2856
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2857
+ </xsl:call-template>
2858
+ </xsl:if>
2665
2859
  </xsl:template><xsl:template match="text()" mode="td_text">
2666
2860
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2667
2861
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2668
2862
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2669
2863
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2670
2864
  <xsl:value-of select="@target"/>
2671
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2672
- <xsl:variable name="mathml">
2673
- <xsl:for-each select="*">
2674
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2675
- <xsl:copy-of select="."/>
2676
- </xsl:if>
2865
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2866
+ <xsl:if test="$isGenerateTableIF = 'false'">
2867
+ <xsl:variable name="mathml_">
2868
+ <xsl:for-each select="*">
2869
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2870
+ <xsl:copy-of select="."/>
2871
+ </xsl:if>
2872
+ </xsl:for-each>
2873
+ </xsl:variable>
2874
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2875
+
2876
+ <xsl:variable name="math_text">
2877
+ <xsl:value-of select="normalize-space($mathml)"/>
2878
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2879
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2880
+ </xsl:variable>
2881
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2882
+ </xsl:if>
2883
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2884
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2885
+
2886
+ <!-- via intermediate format -->
2887
+
2888
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2889
+
2890
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2891
+
2892
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2893
+
2894
+ <!-- get current table id -->
2895
+ <xsl:variable name="table_id" select="@id"/>
2896
+ <!-- find table by id in the file 'table_widths' -->
2897
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2898
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2899
+
2900
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2901
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2902
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2903
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2904
+
2905
+ <xsl:variable name="table_with_cell_widths_">
2906
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2907
+ </xsl:variable>
2908
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2909
+
2910
+ <!-- <xsl:if test="$table_if_debug = 'true'">
2911
+ <xsl:copy-of select="$table_with_cell_widths"/>
2912
+ </xsl:if> -->
2913
+
2914
+
2915
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2916
+
2917
+ <xsl:variable name="column_widths_">
2918
+ <!-- iteration of columns -->
2919
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2920
+ <xsl:variable name="pos" select="position()"/>
2921
+ <column>
2922
+ <xsl:attribute name="width_max">
2923
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2924
+ <xsl:sort select="." data-type="number" order="descending"/>
2925
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2926
+ </xsl:for-each>
2927
+ </xsl:attribute>
2928
+ <xsl:attribute name="width_min">
2929
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2930
+ <xsl:sort select="." data-type="number" order="descending"/>
2931
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2932
+ </xsl:for-each>
2933
+ </xsl:attribute>
2934
+ </column>
2677
2935
  </xsl:for-each>
2678
2936
  </xsl:variable>
2937
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2938
+
2939
+ <!-- <column_widths>
2940
+ <xsl:copy-of select="$column_widths"/>
2941
+ </column_widths> -->
2942
+
2943
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2944
+ <xsl:variable name="table_widths_">
2945
+ <table>
2946
+ <xsl:attribute name="width_max">
2947
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2948
+ </xsl:attribute>
2949
+ <xsl:attribute name="width_min">
2950
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2951
+ </xsl:attribute>
2952
+ </table>
2953
+ </xsl:variable>
2954
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2955
+
2956
+ <xsl:variable name="page_width">
2957
+ <xsl:choose>
2958
+ <xsl:when test="$parent_table_page-width != ''">
2959
+ <xsl:value-of select="$parent_table_page-width"/>
2960
+ </xsl:when>
2961
+ <xsl:otherwise>
2962
+ <xsl:value-of select="@page-width"/>
2963
+ </xsl:otherwise>
2964
+ </xsl:choose>
2965
+ </xsl:variable>
2966
+
2967
+ <xsl:if test="$table_if_debug = 'true'">
2968
+ <table_width>
2969
+ <xsl:copy-of select="$table_widths"/>
2970
+ </table_width>
2971
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2972
+ </xsl:if>
2973
+
2679
2974
 
2680
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2681
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2975
+ <!-- There are three cases: -->
2976
+ <xsl:choose>
2977
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2978
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2979
+ <!-- call old algorithm -->
2980
+ <case1/>
2981
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2982
+ <xsl:call-template name="calculate-column-widths-proportional">
2983
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2984
+ <xsl:with-param name="table" select="$table"/>
2985
+ </xsl:call-template> -->
2986
+ </xsl:when>
2987
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2988
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2989
+ <case2/>
2990
+ <autolayout/>
2991
+ <xsl:for-each select="$column_widths/column/@width_max">
2992
+ <column divider="100"><xsl:value-of select="."/></column>
2993
+ </xsl:for-each>
2994
+ </xsl:when>
2995
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2996
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2997
+ Lets also call D the difference between maximum and minimum width of the table.
2998
+ For each column, let d be the difference between maximum and minimum width of that column.
2999
+ Now set the column's width to the minimum width plus d times W over D.
3000
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3001
+ <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)">
3002
+ <!-- difference between the available space and the minimum table width -->
3003
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
3004
+ <W><xsl:value-of select="$W"/></W>
3005
+ <!-- difference between maximum and minimum width of the table -->
3006
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
3007
+ <D><xsl:value-of select="$D"/></D>
3008
+ <case3/>
3009
+ <autolayout/>
3010
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
3011
+ <split_keep-within-line>true</split_keep-within-line>
3012
+ </xsl:if>
3013
+ <xsl:for-each select="$column_widths/column">
3014
+ <!-- difference between maximum and minimum width of that column. -->
3015
+ <xsl:variable name="d" select="@width_max - @width_min"/>
3016
+ <d><xsl:value-of select="$d"/></d>
3017
+ <width_min><xsl:value-of select="@width_min"/></width_min>
3018
+ <e><xsl:value-of select="$d * $W div $D"/></e>
3019
+ <!-- set the column's width to the minimum width plus d times W over D. -->
3020
+ <column divider="100">
3021
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
3022
+ </column>
3023
+ </xsl:for-each>
3024
+
3025
+ </xsl:when>
3026
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
3027
+ </xsl:choose>
3028
+
3029
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
3030
+
3031
+ <!-- if nested 'dl' or 'table' -->
3032
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
3033
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
3034
+
3035
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
3036
+
3037
+ <xsl:variable name="parent_table_page-width_">
3038
+ <xsl:if test="$parent_table_id != ''">
3039
+ <!-- determine column number in the parent table -->
3040
+ <xsl:variable name="parent_table_column_number">
3041
+ <xsl:choose>
3042
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
3043
+ <xsl:otherwise> <!-- parent is table -->
3044
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
3045
+ </xsl:otherwise>
3046
+ </xsl:choose>
3047
+ </xsl:variable>
3048
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
3049
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3050
+ </xsl:if>
3051
+ </xsl:variable>
3052
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
3053
+
3054
+ <!-- get current table id -->
3055
+ <xsl:variable name="table_id" select="@id"/>
3056
+
3057
+ <xsl:choose>
3058
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
3059
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
3060
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
3061
+ </xsl:when>
3062
+ <xsl:otherwise>
3063
+ <!-- recalculate columns width based on parent table width -->
3064
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
3065
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
3066
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
3067
+ </xsl:call-template>
3068
+ </xsl:for-each>
3069
+ </xsl:otherwise>
3070
+ </xsl:choose>
3071
+
3072
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3073
+ <xsl:copy>
3074
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3075
+ </xsl:copy>
3076
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
3077
+ <xsl:copy>
3078
+ <xsl:copy-of select="@*"/>
3079
+
3080
+ <!-- The maximum width is given by the widest line. -->
3081
+ <xsl:attribute name="width_max">
3082
+ <xsl:for-each select="p_len">
3083
+ <xsl:sort select="." data-type="number" order="descending"/>
3084
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3085
+ </xsl:for-each>
3086
+ </xsl:attribute>
3087
+
3088
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3089
+ <xsl:variable name="width_min">
3090
+ <xsl:for-each select="word_len">
3091
+ <xsl:sort select="." data-type="number" order="descending"/>
3092
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3093
+ </xsl:for-each>
3094
+ </xsl:variable>
3095
+ <xsl:attribute name="width_min">
3096
+ <xsl:value-of select="$width_min"/>
3097
+ </xsl:attribute>
3098
+
3099
+ <xsl:if test="$width_min = 0">
3100
+ <xsl:attribute name="width_min">1</xsl:attribute>
3101
+ </xsl:if>
3102
+
3103
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3104
+
3105
+ </xsl:copy>
2682
3106
  </xsl:template><xsl:template match="*[local-name()='thead']">
2683
3107
  <xsl:param name="cols-count"/>
2684
3108
  <fo:table-header>
@@ -2692,12 +3116,18 @@
2692
3116
  <fo:table-row>
2693
3117
  <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">
2694
3118
 
2695
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
2696
- <xsl:with-param name="continued">true</xsl:with-param>
2697
- </xsl:apply-templates>
2698
3119
 
2699
3120
 
2700
3121
 
3122
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3123
+ <xsl:with-param name="continued">true</xsl:with-param>
3124
+ </xsl:apply-templates>
3125
+
3126
+
3127
+
3128
+
3129
+
3130
+
2701
3131
  </fo:table-cell>
2702
3132
  </fo:table-row>
2703
3133
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2763,6 +3193,7 @@
2763
3193
  </xsl:for-each>
2764
3194
  </xsl:when>
2765
3195
  <xsl:otherwise>
3196
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
2766
3197
  <xsl:call-template name="insertTableColumnWidth">
2767
3198
  <xsl:with-param name="colwidths" select="$colwidths"/>
2768
3199
  </xsl:call-template>
@@ -2797,7 +3228,10 @@
2797
3228
 
2798
3229
 
2799
3230
  <!-- fn processing -->
2800
- <xsl:call-template name="table_fn_display"/>
3231
+
3232
+ <xsl:call-template name="table_fn_display"/>
3233
+
3234
+
2801
3235
 
2802
3236
  <!-- for PAS display Notes after footnotes -->
2803
3237
 
@@ -2807,6 +3241,9 @@
2807
3241
  </fo:table-body>
2808
3242
 
2809
3243
  </fo:table>
3244
+
3245
+
3246
+
2810
3247
  </xsl:if>
2811
3248
  </xsl:template><xsl:template match="*[local-name()='tbody']">
2812
3249
 
@@ -2842,6 +3279,52 @@
2842
3279
 
2843
3280
  </fo:table-body>
2844
3281
 
3282
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3283
+ <xsl:param name="table_or_dl">table</xsl:param>
3284
+ <xsl:apply-templates mode="process_table-if">
3285
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3286
+ </xsl:apply-templates>
3287
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3288
+ <xsl:param name="table_or_dl">table</xsl:param>
3289
+
3290
+ <fo:table-body>
3291
+ <xsl:for-each select="*[local-name() = 'tr']">
3292
+ <xsl:variable name="col_count" select="count(*)"/>
3293
+
3294
+ <!-- iteration for each tr/td -->
3295
+
3296
+ <xsl:choose>
3297
+ <xsl:when test="$table_or_dl = 'table'">
3298
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3299
+ <fo:table-row number-columns-spanned="{$col_count}">
3300
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3301
+ <xsl:call-template name="td"/>
3302
+ </fo:table-row>
3303
+ </xsl:for-each>
3304
+ </xsl:when>
3305
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3306
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3307
+ <xsl:variable name="is_dt" select="position() = 1"/>
3308
+
3309
+ <xsl:for-each select="*">
3310
+ <!-- <test><xsl:copy-of select="."/></test> -->
3311
+ <fo:table-row number-columns-spanned="{$col_count}">
3312
+ <xsl:choose>
3313
+ <xsl:when test="$is_dt">
3314
+ <xsl:call-template name="insert_dt_cell"/>
3315
+ </xsl:when>
3316
+ <xsl:otherwise>
3317
+ <xsl:call-template name="insert_dd_cell"/>
3318
+ </xsl:otherwise>
3319
+ </xsl:choose>
3320
+ </fo:table-row>
3321
+ </xsl:for-each>
3322
+ </xsl:for-each>
3323
+ </xsl:otherwise>
3324
+ </xsl:choose>
3325
+
3326
+ </xsl:for-each>
3327
+ </fo:table-body>
2845
3328
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2846
3329
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2847
3330
 
@@ -2849,6 +3332,9 @@
2849
3332
 
2850
3333
 
2851
3334
 
3335
+
3336
+
3337
+
2852
3338
 
2853
3339
 
2854
3340
  <xsl:call-template name="setTableRowAttributes"/>
@@ -2868,6 +3354,8 @@
2868
3354
 
2869
3355
 
2870
3356
 
3357
+
3358
+
2871
3359
  <xsl:call-template name="setTableRowAttributes"/>
2872
3360
  <xsl:apply-templates/>
2873
3361
  </fo:table-row>
@@ -2932,7 +3420,7 @@
2932
3420
  </xsl:choose>
2933
3421
  </xsl:attribute>
2934
3422
  </xsl:if>
2935
- </xsl:template><xsl:template match="*[local-name()='td']">
3423
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2936
3424
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2937
3425
  <xsl:call-template name="setTextAlignment">
2938
3426
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2953,6 +3441,8 @@
2953
3441
 
2954
3442
 
2955
3443
 
3444
+
3445
+
2956
3446
 
2957
3447
 
2958
3448
 
@@ -2966,11 +3456,24 @@
2966
3456
 
2967
3457
  <xsl:call-template name="setTableCellAttributes"/>
2968
3458
 
3459
+ <xsl:if test="$isGenerateTableIF = 'true'">
3460
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3461
+ <xsl:attribute name="text-align">left</xsl:attribute>
3462
+ </xsl:if>
3463
+
2969
3464
  <fo:block>
2970
3465
 
3466
+ <xsl:if test="$isGenerateTableIF = 'true'">
3467
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3468
+ </xsl:if>
3469
+
3470
+
2971
3471
 
2972
3472
 
2973
3473
  <xsl:apply-templates/>
3474
+
3475
+ <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"/> -->
3476
+
2974
3477
  </fo:block>
2975
3478
  </fo:table-cell>
2976
3479
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -3015,7 +3518,11 @@
3015
3518
 
3016
3519
  <xsl:variable name="gen_id" select="generate-id(.)"/>
3017
3520
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3018
- <xsl:variable name="reference" select="@reference"/>
3521
+ <xsl:variable name="reference_">
3522
+ <xsl:value-of select="@reference"/>
3523
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
3524
+ </xsl:variable>
3525
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
3019
3526
  <!-- fn sequence number in document -->
3020
3527
  <xsl:variable name="current_fn_number">
3021
3528
  <xsl:choose>
@@ -3090,7 +3597,7 @@
3090
3597
  <xsl:copy-of select="node()"/>
3091
3598
  </fn>
3092
3599
  </xsl:for-each>
3093
- <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']/*">
3600
+ <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']/*">
3094
3601
  <xsl:sort select="@displayorder" data-type="number"/>
3095
3602
  <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])]">
3096
3603
  <!-- copy unique fn -->
@@ -3171,9 +3678,9 @@
3171
3678
  <!-- current hierarchy is 'figure' element -->
3172
3679
  <xsl:variable name="following_dl_colwidths">
3173
3680
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3174
- <xsl:variable name="html-table">
3175
- <xsl:variable name="doc_ns">
3176
-
3681
+ <xsl:variable name="simple-table">
3682
+ <!-- <xsl:variable name="doc_ns">
3683
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3177
3684
  </xsl:variable>
3178
3685
  <xsl:variable name="ns">
3179
3686
  <xsl:choose>
@@ -3184,7 +3691,7 @@
3184
3691
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3185
3692
  </xsl:otherwise>
3186
3693
  </xsl:choose>
3187
- </xsl:variable>
3694
+ </xsl:variable> -->
3188
3695
 
3189
3696
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3190
3697
  <tbody>
@@ -3195,7 +3702,7 @@
3195
3702
 
3196
3703
  <xsl:call-template name="calculate-column-widths">
3197
3704
  <xsl:with-param name="cols-count" select="2"/>
3198
- <xsl:with-param name="table" select="$html-table"/>
3705
+ <xsl:with-param name="table" select="$simple-table"/>
3199
3706
  </xsl:call-template>
3200
3707
 
3201
3708
  </xsl:if>
@@ -3370,12 +3877,31 @@
3370
3877
 
3371
3878
 
3372
3879
 
3880
+
3881
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3882
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3883
+ </xsl:if>
3884
+
3373
3885
  <fo:block>
3374
3886
 
3375
3887
 
3376
3888
 
3377
3889
 
3890
+ <xsl:apply-templates select="*[local-name() = 'name']">
3891
+ <xsl:with-param name="process">true</xsl:with-param>
3892
+ </xsl:apply-templates>
3893
+
3894
+ <xsl:if test="$isGenerateTableIF = 'true'">
3895
+ <!-- to determine start of table -->
3896
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3897
+ </xsl:if>
3898
+
3378
3899
  <fo:table width="95%" table-layout="fixed">
3900
+
3901
+ <xsl:if test="$isGenerateTableIF = 'true'">
3902
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3903
+ </xsl:if>
3904
+
3379
3905
 
3380
3906
  <xsl:choose>
3381
3907
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3384,69 +3910,173 @@
3384
3910
 
3385
3911
  </xsl:when>
3386
3912
  </xsl:choose>
3387
- <!-- create virtual html table for dl/[dt and dd] -->
3388
- <xsl:variable name="html-table">
3389
- <xsl:variable name="doc_ns">
3913
+
3914
+
3915
+
3916
+ <xsl:choose>
3917
+ <xsl:when test="$isGenerateTableIF = 'true'">
3918
+ <!-- generate IF for table widths -->
3919
+ <!-- example:
3920
+ <tr>
3921
+ <td valign="top" align="left" id="tab-symdu_1_1">
3922
+ <p>Symbol</p>
3923
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3924
+ </td>
3925
+ <td valign="top" align="left" id="tab-symdu_1_2">
3926
+ <p>Description</p>
3927
+ <word id="tab-symdu_1_2_word_1">Description</word>
3928
+ </td>
3929
+ </tr>
3930
+ -->
3390
3931
 
3391
- </xsl:variable>
3392
- <xsl:variable name="ns">
3393
- <xsl:choose>
3394
- <xsl:when test="normalize-space($doc_ns) != ''">
3395
- <xsl:value-of select="normalize-space($doc_ns)"/>
3396
- </xsl:when>
3397
- <xsl:otherwise>
3398
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3399
- </xsl:otherwise>
3400
- </xsl:choose>
3401
- </xsl:variable>
3402
- <tbody>
3403
- <xsl:apply-templates mode="dl"/>
3404
- </tbody>
3405
- </xsl:variable>
3406
- <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3407
- <xsl:variable name="colwidths">
3408
- <xsl:call-template name="calculate-column-widths">
3409
- <xsl:with-param name="cols-count" select="2"/>
3410
- <xsl:with-param name="table" select="$html-table"/>
3411
- </xsl:call-template>
3412
- </xsl:variable>
3413
- <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3414
- <xsl:variable name="maxlength_dt">
3415
- <xsl:call-template name="getMaxLength_dt"/>
3416
- </xsl:variable>
3417
- <xsl:variable name="isContainsKeepTogetherTag_">
3418
- false
3419
- </xsl:variable>
3420
- <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3421
- <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3422
- <xsl:call-template name="setColumnWidth_dl">
3423
- <xsl:with-param name="colwidths" select="$colwidths"/>
3424
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3425
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3426
- </xsl:call-template>
3932
+ <!-- create virtual html table for dl/[dt and dd] -->
3933
+ <xsl:variable name="simple-table">
3934
+
3935
+ <xsl:variable name="dl_table">
3936
+ <tbody>
3937
+ <xsl:apply-templates mode="dl_if">
3938
+ <xsl:with-param name="id" select="@id"/>
3939
+ </xsl:apply-templates>
3940
+ </tbody>
3941
+ </xsl:variable>
3942
+
3943
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3944
+
3945
+ <!-- Step: replace <br/> to <p>...</p> -->
3946
+ <xsl:variable name="table_without_br">
3947
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3948
+ </xsl:variable>
3949
+
3950
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3951
+
3952
+ <!-- Step: add id to each cell -->
3953
+ <!-- add <word>...</word> for each word, image, math -->
3954
+ <xsl:variable name="simple-table-id">
3955
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3956
+ <xsl:with-param name="id" select="@id"/>
3957
+ </xsl:apply-templates>
3958
+ </xsl:variable>
3959
+
3960
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3961
+
3962
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3963
+
3964
+ </xsl:variable>
3965
+
3966
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3967
+
3968
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3969
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3970
+ </xsl:apply-templates>
3971
+
3972
+ </xsl:when>
3973
+ <xsl:otherwise>
3427
3974
 
3428
- <fo:table-body>
3429
- <xsl:apply-templates>
3430
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3431
- </xsl:apply-templates>
3432
- </fo:table-body>
3975
+ <xsl:variable name="simple-table">
3976
+
3977
+ <xsl:variable name="dl_table">
3978
+ <tbody>
3979
+ <xsl:apply-templates mode="dl">
3980
+ <xsl:with-param name="id" select="@id"/>
3981
+ </xsl:apply-templates>
3982
+ </tbody>
3983
+ </xsl:variable>
3984
+
3985
+ <xsl:copy-of select="$dl_table"/>
3986
+ </xsl:variable>
3987
+
3988
+ <xsl:variable name="colwidths">
3989
+ <xsl:call-template name="calculate-column-widths">
3990
+ <xsl:with-param name="cols-count" select="2"/>
3991
+ <xsl:with-param name="table" select="$simple-table"/>
3992
+ </xsl:call-template>
3993
+ </xsl:variable>
3994
+
3995
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3996
+ DEBUG
3997
+ colwidths=<xsl:copy-of select="$colwidths"/>
3998
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3999
+
4000
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4001
+
4002
+ <xsl:variable name="maxlength_dt">
4003
+ <xsl:call-template name="getMaxLength_dt"/>
4004
+ </xsl:variable>
4005
+
4006
+ <xsl:variable name="isContainsKeepTogetherTag_">
4007
+ false
4008
+ </xsl:variable>
4009
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4010
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4011
+
4012
+
4013
+ <xsl:call-template name="setColumnWidth_dl">
4014
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4015
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4016
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4017
+ </xsl:call-template>
4018
+
4019
+ <fo:table-body>
4020
+
4021
+ <!-- DEBUG -->
4022
+ <xsl:if test="$table_if_debug = 'true'">
4023
+ <fo:table-row>
4024
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
4025
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
4026
+ </fo:table-cell>
4027
+ </fo:table-row>
4028
+ </xsl:if>
4029
+
4030
+ <xsl:apply-templates>
4031
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
4032
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
4033
+ </xsl:apply-templates>
4034
+
4035
+ </fo:table-body>
4036
+ </xsl:otherwise>
4037
+ </xsl:choose>
3433
4038
  </fo:table>
3434
4039
  </fo:block>
3435
4040
  </fo:block>
3436
4041
  </xsl:if> <!-- END: a few components -->
3437
4042
  </fo:block-container>
3438
4043
  </fo:block-container>
4044
+
4045
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
4046
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
4047
+ </xsl:if>
4048
+
4049
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4050
+ <xsl:param name="process">false</xsl:param>
4051
+ <xsl:if test="$process = 'true'">
4052
+ <fo:block xsl:use-attribute-sets="dl-name-style">
4053
+ <xsl:apply-templates/>
4054
+ </fo:block>
4055
+ </xsl:if>
3439
4056
  </xsl:template><xsl:template name="setColumnWidth_dl">
3440
4057
  <xsl:param name="colwidths"/>
3441
4058
  <xsl:param name="maxlength_dt"/>
3442
4059
  <xsl:param name="isContainsKeepTogetherTag"/>
4060
+
4061
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
4062
+
3443
4063
  <xsl:choose>
4064
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4065
+ <xsl:call-template name="insertTableColumnWidth">
4066
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4067
+ </xsl:call-template>
4068
+ </xsl:when>
3444
4069
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3445
4070
  <fo:table-column column-width="50%"/>
3446
4071
  <fo:table-column column-width="50%"/>
3447
4072
  </xsl:when>
3448
4073
  <xsl:otherwise>
3449
4074
  <xsl:choose>
4075
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4076
+ <xsl:call-template name="insertTableColumnWidth">
4077
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4078
+ </xsl:call-template>
4079
+ </xsl:when>
3450
4080
  <xsl:when test="$isContainsKeepTogetherTag">
3451
4081
  <xsl:call-template name="insertTableColumnWidth">
3452
4082
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3491,13 +4121,19 @@
3491
4121
  </xsl:choose>
3492
4122
  </xsl:template><xsl:template name="insertTableColumnWidth">
3493
4123
  <xsl:param name="colwidths"/>
4124
+
3494
4125
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3495
4126
  <xsl:choose>
3496
4127
  <xsl:when test=". = 1 or . = 0">
3497
4128
  <fo:table-column column-width="proportional-column-width(2)"/>
3498
4129
  </xsl:when>
3499
4130
  <xsl:otherwise>
3500
- <fo:table-column column-width="proportional-column-width({.})"/>
4131
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
4132
+ <xsl:variable name="divider">
4133
+ <xsl:value-of select="@divider"/>
4134
+ <xsl:if test="not(@divider)">1</xsl:if>
4135
+ </xsl:variable>
4136
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3501
4137
  </xsl:otherwise>
3502
4138
  </xsl:choose>
3503
4139
  </xsl:for-each>
@@ -3559,65 +4195,157 @@
3559
4195
  </fo:table-cell>
3560
4196
  </fo:table-row>
3561
4197
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
4198
+ <xsl:param name="id"/>
4199
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3562
4200
  <tr>
3563
4201
  <td>
4202
+ <xsl:attribute name="id">
4203
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4204
+ </xsl:attribute>
3564
4205
  <xsl:apply-templates/>
3565
4206
  </td>
3566
4207
  <td>
4208
+ <xsl:attribute name="id">
4209
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4210
+ </xsl:attribute>
4211
+
4212
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
4213
+ <xsl:with-param name="process">true</xsl:with-param>
4214
+ </xsl:apply-templates>
4215
+
4216
+ </td>
4217
+ </tr>
4218
+
4219
+ </xsl:template><xsl:template match="*[local-name()='dt']">
4220
+ <xsl:param name="key_iso"/>
4221
+ <xsl:param name="split_keep-within-line"/>
4222
+
4223
+ <fo:table-row xsl:use-attribute-sets="dt-row-style">
4224
+ <xsl:call-template name="insert_dt_cell">
4225
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4226
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4227
+ </xsl:call-template>
4228
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4229
+ <xsl:call-template name="insert_dd_cell">
4230
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4231
+ </xsl:call-template>
4232
+ </xsl:for-each>
4233
+ </fo:table-row>
4234
+ </xsl:template><xsl:template name="insert_dt_cell">
4235
+ <xsl:param name="key_iso"/>
4236
+ <xsl:param name="split_keep-within-line"/>
4237
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4238
+
4239
+ <xsl:if test="$isGenerateTableIF = 'true'">
4240
+ <!-- border is mandatory, to calculate real width -->
4241
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4242
+ <xsl:attribute name="text-align">left</xsl:attribute>
4243
+ </xsl:if>
4244
+
4245
+
4246
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4247
+ <xsl:copy-of select="@id"/>
4248
+
4249
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4250
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4251
+ </xsl:if>
4252
+
4253
+
4254
+
4255
+ <xsl:apply-templates>
4256
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4257
+ </xsl:apply-templates>
3567
4258
 
3568
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3569
- <xsl:with-param name="process">true</xsl:with-param>
3570
- </xsl:apply-templates>
3571
-
3572
- </td>
3573
- </tr>
4259
+ <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"/> -->
4260
+
4261
+ </fo:block>
4262
+ </fo:table-cell>
4263
+ </xsl:template><xsl:template name="insert_dd_cell">
4264
+ <xsl:param name="split_keep-within-line"/>
4265
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
3574
4266
 
3575
- </xsl:template><xsl:template match="*[local-name()='dt']">
3576
- <xsl:param name="key_iso"/>
4267
+ <xsl:if test="$isGenerateTableIF = 'true'">
4268
+ <!-- border is mandatory, to calculate real width -->
4269
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4270
+ </xsl:if>
3577
4271
 
3578
- <fo:table-row xsl:use-attribute-sets="dt-row-style">
3579
- <fo:table-cell>
4272
+ <fo:block>
4273
+
4274
+ <xsl:if test="$isGenerateTableIF = 'true'">
4275
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4276
+ </xsl:if>
4277
+
3580
4278
 
3581
- <fo:block xsl:use-attribute-sets="dt-style">
3582
- <xsl:copy-of select="@id"/>
3583
-
3584
- <xsl:if test="normalize-space($key_iso) = 'true'">
3585
- <xsl:attribute name="margin-top">0</xsl:attribute>
3586
- </xsl:if>
3587
-
3588
-
3589
-
3590
- <xsl:apply-templates/>
3591
- </fo:block>
3592
- </fo:table-cell>
3593
- <fo:table-cell>
3594
- <fo:block>
3595
-
3596
4279
 
3597
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3598
- <xsl:with-param name="process">true</xsl:with-param>
3599
- </xsl:apply-templates>
3600
- </fo:block>
3601
- </fo:table-cell>
3602
- </fo:table-row>
4280
+ <xsl:choose>
4281
+ <xsl:when test="$isGenerateTableIF = 'true'">
4282
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4283
+ <xsl:with-param name="process">true</xsl:with-param>
4284
+ </xsl:apply-templates>
4285
+ </xsl:when>
4286
+ <xsl:otherwise>
4287
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4288
+ <xsl:with-param name="process">true</xsl:with-param>
4289
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4290
+ </xsl:apply-templates>
4291
+ </xsl:otherwise>
4292
+
4293
+ </xsl:choose>
4294
+
4295
+ <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"/> -->
4296
+
4297
+ </fo:block>
4298
+ </fo:table-cell>
3603
4299
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3604
4300
  <xsl:apply-templates/>
3605
4301
  </xsl:template><xsl:template match="*[local-name()='dd']">
3606
4302
  <xsl:param name="process">false</xsl:param>
4303
+ <xsl:param name="split_keep-within-line"/>
3607
4304
  <xsl:if test="$process = 'true'">
3608
4305
  <xsl:apply-templates select="@language"/>
3609
- <xsl:apply-templates/>
4306
+ <xsl:apply-templates>
4307
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4308
+ </xsl:apply-templates>
3610
4309
  </xsl:if>
3611
4310
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3612
4311
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3613
- </xsl:template><xsl:template match="*[local-name()='em']">
4312
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4313
+ <xsl:param name="id"/>
4314
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4315
+ <tr>
4316
+ <td>
4317
+ <xsl:copy-of select="node()"/>
4318
+ </td>
4319
+ <td>
4320
+
4321
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4322
+
4323
+ <!-- get paragraphs from nested 'dl' -->
4324
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4325
+
4326
+
4327
+ </td>
4328
+ </tr>
4329
+
4330
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4331
+ <xsl:for-each select="*[local-name() = 'dt']">
4332
+ <p>
4333
+ <xsl:copy-of select="node()"/>
4334
+ <xsl:text> </xsl:text>
4335
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4336
+ </p>
4337
+ </xsl:for-each>
4338
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
3614
4339
  <fo:inline font-style="italic">
3615
4340
  <xsl:apply-templates/>
3616
4341
  </fo:inline>
3617
4342
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4343
+ <xsl:param name="split_keep-within-line"/>
3618
4344
  <fo:inline font-weight="bold">
3619
4345
 
3620
- <xsl:apply-templates/>
4346
+ <xsl:apply-templates>
4347
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4348
+ </xsl:apply-templates>
3621
4349
  </fo:inline>
3622
4350
  </xsl:template><xsl:template match="*[local-name()='padding']">
3623
4351
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3638,7 +4366,7 @@
3638
4366
 
3639
4367
 
3640
4368
 
3641
-
4369
+ <!-- 10 -->
3642
4370
 
3643
4371
 
3644
4372
 
@@ -3818,6 +4546,10 @@
3818
4546
  <xsl:param name="text"/>
3819
4547
  <xsl:param name="separator" select="' '"/>
3820
4548
  <xsl:choose>
4549
+
4550
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4551
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4552
+ </xsl:when>
3821
4553
  <xsl:when test="not(contains($text, $separator))">
3822
4554
  <word>
3823
4555
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
@@ -3862,13 +4594,66 @@
3862
4594
  </xsl:when>
3863
4595
  <xsl:otherwise>
3864
4596
  <word>
3865
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4597
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4598
+ <xsl:choose>
4599
+ <xsl:when test="$isGenerateTableIF = 'true'">
4600
+ <xsl:value-of select="$word"/>
4601
+ </xsl:when>
4602
+ <xsl:otherwise>
4603
+ <xsl:value-of select="string-length($word)"/>
4604
+ </xsl:otherwise>
4605
+ </xsl:choose>
3866
4606
  </word>
3867
4607
  <xsl:call-template name="tokenize">
3868
4608
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3869
4609
  </xsl:call-template>
3870
4610
  </xsl:otherwise>
3871
4611
  </xsl:choose>
4612
+ </xsl:template><xsl:template name="tokenize_with_tags">
4613
+ <xsl:param name="tags"/>
4614
+ <xsl:param name="text"/>
4615
+ <xsl:param name="separator" select="' '"/>
4616
+ <xsl:choose>
4617
+
4618
+ <xsl:when test="not(contains($text, $separator))">
4619
+ <word>
4620
+ <xsl:call-template name="enclose_text_in_tags">
4621
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4622
+ <xsl:with-param name="tags" select="$tags"/>
4623
+ </xsl:call-template>
4624
+ </word>
4625
+ </xsl:when>
4626
+ <xsl:otherwise>
4627
+ <word>
4628
+ <xsl:call-template name="enclose_text_in_tags">
4629
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4630
+ <xsl:with-param name="tags" select="$tags"/>
4631
+ </xsl:call-template>
4632
+ </word>
4633
+ <xsl:call-template name="tokenize_with_tags">
4634
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4635
+ </xsl:call-template>
4636
+ </xsl:otherwise>
4637
+ </xsl:choose>
4638
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4639
+ <xsl:param name="text"/>
4640
+ <xsl:param name="tags"/>
4641
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4642
+
4643
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4644
+
4645
+ <xsl:choose>
4646
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4647
+ <xsl:otherwise>
4648
+ <xsl:element name="{$tag_name}">
4649
+ <xsl:call-template name="enclose_text_in_tags">
4650
+ <xsl:with-param name="text" select="$text"/>
4651
+ <xsl:with-param name="tags" select="$tags"/>
4652
+ <xsl:with-param name="num" select="$num + 1"/>
4653
+ </xsl:call-template>
4654
+ </xsl:element>
4655
+ </xsl:otherwise>
4656
+ </xsl:choose>
3872
4657
  </xsl:template><xsl:template name="max_length">
3873
4658
  <xsl:param name="words"/>
3874
4659
  <xsl:for-each select="$words//word">
@@ -3969,12 +4754,19 @@
3969
4754
  </xsl:otherwise>
3970
4755
  </xsl:choose>
3971
4756
  </xsl:template><xsl:template name="getSimpleTable">
4757
+ <xsl:param name="id"/>
4758
+
3972
4759
  <xsl:variable name="simple-table">
3973
4760
 
4761
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4762
+ <xsl:variable name="table_without_br">
4763
+ <xsl:apply-templates mode="table-without-br"/>
4764
+ </xsl:variable>
4765
+
3974
4766
  <!-- Step 1. colspan processing -->
3975
4767
  <xsl:variable name="simple-table-colspan">
3976
4768
  <tbody>
3977
- <xsl:apply-templates mode="simple-table-colspan"/>
4769
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3978
4770
  </tbody>
3979
4771
  </xsl:variable>
3980
4772
 
@@ -3983,10 +4775,67 @@
3983
4775
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3984
4776
  </xsl:variable>
3985
4777
 
3986
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3987
-
4778
+ <!-- Step 3: add id to each cell -->
4779
+ <!-- add <word>...</word> for each word, image, math -->
4780
+ <xsl:variable name="simple-table-id">
4781
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4782
+ <xsl:with-param name="id" select="$id"/>
4783
+ </xsl:apply-templates>
4784
+ </xsl:variable>
4785
+
4786
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4787
+
3988
4788
  </xsl:variable>
3989
4789
  <xsl:copy-of select="$simple-table"/>
4790
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4791
+ <xsl:copy>
4792
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4793
+ </xsl:copy>
4794
+ </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">
4795
+ <xsl:copy>
4796
+ <xsl:copy-of select="@*"/>
4797
+ <p>
4798
+ <xsl:copy-of select="node()"/>
4799
+ </p>
4800
+ </xsl:copy>
4801
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4802
+ <xsl:copy>
4803
+ <xsl:copy-of select="@*"/>
4804
+ <xsl:for-each select="*[local-name()='br']">
4805
+ <xsl:variable name="current_id" select="generate-id()"/>
4806
+ <p>
4807
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4808
+ <xsl:copy-of select="."/>
4809
+ </xsl:for-each>
4810
+ </p>
4811
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4812
+ <p>
4813
+ <xsl:for-each select="following-sibling::node()">
4814
+ <xsl:copy-of select="."/>
4815
+ </xsl:for-each>
4816
+ </p>
4817
+ </xsl:if>
4818
+ </xsl:for-each>
4819
+ </xsl:copy>
4820
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4821
+ <xsl:for-each select="*[local-name()='br']">
4822
+ <xsl:variable name="current_id" select="generate-id()"/>
4823
+ <p>
4824
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4825
+ <xsl:copy-of select="."/>
4826
+ </xsl:for-each>
4827
+ </p>
4828
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4829
+ <p>
4830
+ <xsl:for-each select="following-sibling::node()">
4831
+ <xsl:copy-of select="."/>
4832
+ </xsl:for-each>
4833
+ </p>
4834
+ </xsl:if>
4835
+ </xsl:for-each>
4836
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4837
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4838
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3990
4839
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3991
4840
  <xsl:apply-templates mode="simple-table-colspan"/>
3992
4841
  </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
@@ -4076,6 +4925,126 @@
4076
4925
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4077
4926
  <xsl:with-param name="previousRow" select="$newRow"/>
4078
4927
  </xsl:apply-templates>
4928
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4929
+ <xsl:param name="id"/>
4930
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4931
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4932
+ <xsl:with-param name="id" select="$id_prefixed"/>
4933
+ </xsl:apply-templates>
4934
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4935
+ <xsl:param name="id"/>
4936
+ <xsl:copy>
4937
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4938
+ <xsl:with-param name="id" select="$id"/>
4939
+ </xsl:apply-templates>
4940
+ </xsl:copy>
4941
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4942
+ <xsl:param name="id"/>
4943
+ <xsl:copy>
4944
+ <xsl:copy-of select="@*"/>
4945
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4946
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4947
+ <xsl:with-param name="id" select="$id"/>
4948
+ </xsl:apply-templates>
4949
+ </xsl:copy>
4950
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4951
+ <xsl:param name="id"/>
4952
+ <xsl:copy>
4953
+ <xsl:copy-of select="@*"/>
4954
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4955
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4956
+ <xsl:attribute name="id">
4957
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4958
+ </xsl:attribute>
4959
+
4960
+ <xsl:for-each select="*[local-name() = 'p']">
4961
+ <xsl:copy>
4962
+ <xsl:copy-of select="@*"/>
4963
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4964
+ <xsl:attribute name="id">
4965
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4966
+ </xsl:attribute>
4967
+
4968
+ <xsl:copy-of select="node()"/>
4969
+ </xsl:copy>
4970
+ </xsl:for-each>
4971
+
4972
+
4973
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4974
+
4975
+ <xsl:variable name="td_text">
4976
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4977
+ </xsl:variable>
4978
+
4979
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4980
+
4981
+ <xsl:variable name="words">
4982
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4983
+ <word>
4984
+ <xsl:copy-of select="."/>
4985
+ </word>
4986
+ </xsl:for-each>
4987
+
4988
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4989
+ <xsl:copy-of select="."/>
4990
+ </xsl:for-each>
4991
+
4992
+ </xsl:variable>
4993
+
4994
+ <xsl:for-each select="xalan:nodeset($words)/word">
4995
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4996
+ <xsl:copy>
4997
+ <xsl:attribute name="id">
4998
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4999
+ </xsl:attribute>
5000
+ <xsl:copy-of select="node()"/>
5001
+ </xsl:copy>
5002
+ </xsl:for-each>
5003
+ </xsl:if>
5004
+ </xsl:copy>
5005
+
5006
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
5007
+ <xsl:copy>
5008
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5009
+ </xsl:copy>
5010
+ </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">
5011
+ <xsl:variable name="formatting_tags">
5012
+ <xsl:call-template name="getFormattingTags"/>
5013
+ </xsl:variable>
5014
+ <word>
5015
+ <xsl:call-template name="enclose_text_in_tags">
5016
+ <xsl:with-param name="text" select="normalize-space(.)"/>
5017
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5018
+ </xsl:call-template>
5019
+ </word>
5020
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
5021
+
5022
+ <xsl:variable name="td_text" select="."/>
5023
+
5024
+ <xsl:variable name="string_with_added_zerospaces">
5025
+ <xsl:call-template name="add-zero-spaces-java">
5026
+ <xsl:with-param name="text" select="$td_text"/>
5027
+ </xsl:call-template>
5028
+ </xsl:variable>
5029
+
5030
+ <xsl:variable name="formatting_tags">
5031
+ <xsl:call-template name="getFormattingTags"/>
5032
+ </xsl:variable>
5033
+
5034
+ <!-- <word>text</word> -->
5035
+ <xsl:call-template name="tokenize_with_tags">
5036
+ <xsl:with-param name="tags" select="$formatting_tags"/>
5037
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
5038
+ </xsl:call-template>
5039
+ </xsl:template><xsl:template name="getFormattingTags">
5040
+ <tags>
5041
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
5042
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
5043
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
5044
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
5045
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
5046
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
5047
+ </tags>
4079
5048
  </xsl:template><xsl:template name="getLang">
4080
5049
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4081
5050
  <xsl:variable name="language">
@@ -4269,6 +5238,11 @@
4269
5238
  </xsl:variable>
4270
5239
  <fo:inline xsl:use-attribute-sets="link-style">
4271
5240
 
5241
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5242
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5243
+ </xsl:if>
5244
+
5245
+
4272
5246
 
4273
5247
 
4274
5248
 
@@ -4547,7 +5521,19 @@
4547
5521
  <xsl:value-of select="$suffix"/>
4548
5522
  </xsl:if>
4549
5523
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
4550
- <fo:inline><xsl:apply-templates/></fo:inline>
5524
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5525
+ <xsl:choose>
5526
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
5527
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
5528
+ <xsl:apply-templates/>
5529
+ </fo:inline>
5530
+ </xsl:when>
5531
+ <xsl:otherwise>
5532
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
5533
+ <xsl:apply-templates/>
5534
+ </fo:block>
5535
+ </xsl:otherwise>
5536
+ </xsl:choose>
4551
5537
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
4552
5538
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
4553
5539
  <fo:block id="{@id}">
@@ -5364,7 +6350,7 @@
5364
6350
  </xsl:choose>
5365
6351
  </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">
5366
6352
  <xsl:value-of select="."/>
5367
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6353
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5368
6354
  <xsl:text> </xsl:text>
5369
6355
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5370
6356
  <xsl:copy>
@@ -5435,7 +6421,7 @@
5435
6421
 
5436
6422
 
5437
6423
 
5438
-
6424
+ <!-- 9 -->
5439
6425
 
5440
6426
 
5441
6427
 
@@ -5519,7 +6505,7 @@
5519
6505
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5520
6506
  <xsl:choose>
5521
6507
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5522
- <xsl:call-template name="interspers">
6508
+ <xsl:call-template name="interspers-java">
5523
6509
  <xsl:with-param name="str" select="."/>
5524
6510
  </xsl:call-template>
5525
6511
  </xsl:when>
@@ -5569,6 +6555,10 @@
5569
6555
  <xsl:with-param name="char" select="$char"/>
5570
6556
  </xsl:call-template>
5571
6557
  </xsl:if>
6558
+ </xsl:template><xsl:template name="interspers-java">
6559
+ <xsl:param name="str"/>
6560
+ <xsl:param name="char" select="$zero_width_space"/>
6561
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
5572
6562
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5573
6563
  <xsl:apply-templates mode="syntax_highlight"/>
5574
6564
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5781,7 +6771,9 @@
5781
6771
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5782
6772
  </xsl:if>
5783
6773
  <xsl:variable name="simple-table">
5784
- <xsl:call-template name="getSimpleTable"/>
6774
+ <xsl:call-template name="getSimpleTable">
6775
+ <xsl:with-param name="id" select="@id"/>
6776
+ </xsl:call-template>
5785
6777
  </xsl:variable>
5786
6778
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5787
6779
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -6211,6 +7203,7 @@
6211
7203
 
6212
7204
 
6213
7205
 
7206
+
6214
7207
  <xsl:choose>
6215
7208
  <xsl:when test="ancestor::un:sections and $depth = 1">12</xsl:when>
6216
7209
  <xsl:when test="ancestor::un:sections">8</xsl:when>
@@ -6526,6 +7519,11 @@
6526
7519
  </xsl:otherwise>
6527
7520
  </xsl:choose>
6528
7521
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7522
+
7523
+ <xsl:apply-templates select="*[local-name() = 'name']">
7524
+ <xsl:with-param name="process">true</xsl:with-param>
7525
+ </xsl:apply-templates>
7526
+
6529
7527
  <fo:list-block xsl:use-attribute-sets="list-style">
6530
7528
 
6531
7529
 
@@ -6536,12 +7534,23 @@
6536
7534
 
6537
7535
 
6538
7536
 
7537
+ <xsl:if test="*[local-name() = 'name']">
7538
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7539
+ </xsl:if>
7540
+
6539
7541
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6540
7542
  </fo:list-block>
6541
7543
  <!-- <xsl:for-each select="./iho:note">
6542
7544
  <xsl:call-template name="note"/>
6543
7545
  </xsl:for-each> -->
6544
7546
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
7547
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
7548
+ <xsl:param name="process">false</xsl:param>
7549
+ <xsl:if test="$process = 'true'">
7550
+ <fo:block xsl:use-attribute-sets="list-name-style">
7551
+ <xsl:apply-templates/>
7552
+ </fo:block>
7553
+ </xsl:if>
6545
7554
  </xsl:template><xsl:template match="*[local-name()='li']">
6546
7555
  <fo:list-item xsl:use-attribute-sets="list-item-style">
6547
7556
  <xsl:copy-of select="@id"/>
@@ -6741,7 +7750,7 @@
6741
7750
  <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
6742
7751
  <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
6743
7752
  <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
6744
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
7753
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6745
7754
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6746
7755
  <!-- <row>
6747
7756
  <date>05-07-2013</date>
@@ -6819,22 +7828,11 @@
6819
7828
  </xsl:template><xsl:template name="processBibitem">
6820
7829
 
6821
7830
 
7831
+ <!-- start UNECE bibitem processing -->
6822
7832
  <fo:inline padding-right="5mm">[<xsl:value-of select="un:docidentifier"/>]</fo:inline><xsl:value-of select="un:docidentifier"/>
6823
- <xsl:if test="un:title">
6824
- <fo:inline font-style="italic">
6825
- <xsl:text>, </xsl:text>
6826
- <xsl:choose>
6827
- <xsl:when test="un:title[@type = 'main' and @language = 'en']">
6828
- <xsl:apply-templates select="un:title[@type = 'main' and @language = 'en']"/>
6829
- </xsl:when>
6830
- <xsl:otherwise>
6831
- <xsl:apply-templates select="un:title"/>
6832
- </xsl:otherwise>
6833
- </xsl:choose>
6834
- </fo:inline>
6835
- </xsl:if>
7833
+ <xsl:text> </xsl:text>
6836
7834
  <xsl:apply-templates select="un:formattedref"/>
6837
-
7835
+ <!-- END UNECE bibitem processing -->
6838
7836
 
6839
7837
  </xsl:template><xsl:template name="processBibitemDocId">
6840
7838
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
@@ -7142,12 +8140,16 @@
7142
8140
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
7143
8141
 
7144
8142
 
8143
+
8144
+
7145
8145
 
7146
8146
 
7147
8147
 
7148
8148
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
7149
8149
 
7150
8150
 
8151
+
8152
+
7151
8153
  <fo:block-container margin-left="0mm" margin-right="0mm">
7152
8154
  <fo:block>
7153
8155
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -7159,25 +8161,32 @@
7159
8161
  </fo:block-container>
7160
8162
 
7161
8163
  </xsl:template><xsl:template name="displayAdmonitionName">
7162
-
8164
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
8165
+ <!-- <xsl:choose>
8166
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
8167
+ <xsl:choose>
8168
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
8169
+ <xsl:otherwise>
8170
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8171
+ </xsl:otherwise>
8172
+ </xsl:choose>
8173
+ </xsl:when>
8174
+ <xsl:otherwise>
7163
8175
  <xsl:apply-templates select="*[local-name() = 'name']"/>
7164
8176
  <xsl:if test="not(*[local-name() = 'name'])">
7165
8177
  <xsl:apply-templates select="@type"/>
7166
8178
  </xsl:if>
7167
-
7168
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7169
- <xsl:apply-templates/>
7170
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
7171
- <xsl:variable name="admonition_type_">
7172
- <xsl:call-template name="getLocalizedString">
7173
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
7174
- </xsl:call-template>
8179
+ </xsl:otherwise>
8180
+ </xsl:choose> -->
8181
+ <xsl:variable name="name">
8182
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7175
8183
  </xsl:variable>
7176
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
7177
- <xsl:value-of select="$admonition_type"/>
7178
- <xsl:if test="$admonition_type = ''">
7179
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
8184
+ <xsl:copy-of select="$name"/>
8185
+ <xsl:if test="normalize-space($name) != ''">
8186
+ <xsl:value-of select="$sep"/>
7180
8187
  </xsl:if>
8188
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8189
+ <xsl:apply-templates/>
7181
8190
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
7182
8191
 
7183
8192
  <fo:block xsl:use-attribute-sets="admonition-p-style">
@@ -7348,6 +8357,8 @@
7348
8357
  </xsl:when>
7349
8358
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
7350
8359
  </xsl:choose>
8360
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
8361
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
7351
8362
  </xsl:template><xsl:template name="printEdition">
7352
8363
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
7353
8364
  <xsl:text> </xsl:text>
@@ -7454,6 +8465,27 @@
7454
8465
  </xsl:when>
7455
8466
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
7456
8467
  </xsl:choose>
8468
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
8469
+ <xsl:param name="num"/>
8470
+ <xsl:variable name="monthStr">
8471
+ <xsl:choose>
8472
+ <xsl:when test="$num = '01'">january</xsl:when>
8473
+ <xsl:when test="$num = '02'">february</xsl:when>
8474
+ <xsl:when test="$num = '03'">march</xsl:when>
8475
+ <xsl:when test="$num = '04'">april</xsl:when>
8476
+ <xsl:when test="$num = '05'">may</xsl:when>
8477
+ <xsl:when test="$num = '06'">june</xsl:when>
8478
+ <xsl:when test="$num = '07'">july</xsl:when>
8479
+ <xsl:when test="$num = '08'">august</xsl:when>
8480
+ <xsl:when test="$num = '09'">september</xsl:when>
8481
+ <xsl:when test="$num = '10'">october</xsl:when>
8482
+ <xsl:when test="$num = '11'">november</xsl:when>
8483
+ <xsl:when test="$num = '12'">december</xsl:when>
8484
+ </xsl:choose>
8485
+ </xsl:variable>
8486
+ <xsl:call-template name="getLocalizedString">
8487
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
8488
+ </xsl:call-template>
7457
8489
  </xsl:template><xsl:template name="insertKeywords">
7458
8490
  <xsl:param name="sorting" select="'true'"/>
7459
8491
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -7647,6 +8679,7 @@
7647
8679
 
7648
8680
 
7649
8681
 
8682
+
7650
8683
  <xsl:value-of select="document('')//*/namespace::un"/>
7651
8684
 
7652
8685
 
@@ -8060,4 +9093,40 @@
8060
9093
  <xsl:value-of select="$value"/>
8061
9094
  </xsl:otherwise>
8062
9095
  </xsl:choose>
9096
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
9097
+ <xsl:param name="level">0</xsl:param>
9098
+
9099
+ <fo:block margin-left="{2*$level}mm">
9100
+ <xsl:text>
9101
+ &lt;</xsl:text>
9102
+ <xsl:value-of select="local-name()"/>
9103
+ <xsl:for-each select="@*">
9104
+ <xsl:text> </xsl:text>
9105
+ <xsl:value-of select="local-name()"/>
9106
+ <xsl:text>="</xsl:text>
9107
+ <xsl:value-of select="."/>
9108
+ <xsl:text>"</xsl:text>
9109
+ </xsl:for-each>
9110
+ <xsl:text>&gt;</xsl:text>
9111
+
9112
+ <xsl:if test="not(*)">
9113
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
9114
+ <xsl:text>&lt;/</xsl:text>
9115
+ <xsl:value-of select="local-name()"/>
9116
+ <xsl:text>&gt;</xsl:text>
9117
+ </xsl:if>
9118
+ </fo:block>
9119
+
9120
+ <xsl:if test="*">
9121
+ <fo:block>
9122
+ <xsl:apply-templates mode="print_as_xml">
9123
+ <xsl:with-param name="level" select="$level + 1"/>
9124
+ </xsl:apply-templates>
9125
+ </fo:block>
9126
+ <fo:block margin-left="{2*$level}mm">
9127
+ <xsl:text>&lt;/</xsl:text>
9128
+ <xsl:value-of select="local-name()"/>
9129
+ <xsl:text>&gt;</xsl:text>
9130
+ </fo:block>
9131
+ </xsl:if>
8063
9132
  </xsl:template></xsl:stylesheet>