metanorma-iho 0.5.8 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -135,7 +135,7 @@
135
135
  <fo:block>
136
136
  <xsl:value-of select="$docidentifier"/>
137
137
  <xsl:text> </xsl:text>
138
- <xsl:apply-templates select="/iho:iho-standard/iho:bibdata/iho:edition"/>
138
+ <xsl:apply-templates select="/iho:iho-standard/iho:bibdata/iho:edition[normalize-space(@language) = '']"/>
139
139
  </fo:block>
140
140
  </fo:block-container>
141
141
  </fo:table-cell>
@@ -463,12 +463,14 @@
463
463
 
464
464
 
465
465
  <xsl:template match="/iho:iho-standard/iho:bibdata/iho:edition">
466
- <xsl:variable name="title-edition">
467
- <xsl:call-template name="getTitle">
468
- <xsl:with-param name="name" select="'title-edition'"/>
469
- </xsl:call-template>
470
- </xsl:variable>
471
- <xsl:value-of select="$title-edition"/>
466
+ <xsl:call-template name="capitalize">
467
+ <xsl:with-param name="str">
468
+ <xsl:call-template name="getLocalizedString">
469
+ <xsl:with-param name="key">edition</xsl:with-param>
470
+ </xsl:call-template>
471
+ </xsl:with-param>
472
+ </xsl:call-template>
473
+ <xsl:text> </xsl:text>
472
474
  <xsl:apply-templates/>
473
475
  </xsl:template>
474
476
 
@@ -558,6 +560,7 @@
558
560
 
559
561
  <xsl:template match="iho:p" name="paragraph">
560
562
  <xsl:param name="inline" select="'false'"/>
563
+ <xsl:param name="split_keep-within-line"/>
561
564
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
562
565
  <xsl:variable name="element-name">
563
566
  <xsl:choose>
@@ -592,7 +595,9 @@
592
595
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
593
596
  </xsl:if>
594
597
 
595
- <xsl:apply-templates/>
598
+ <xsl:apply-templates>
599
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
600
+ </xsl:apply-templates>
596
601
  </xsl:element>
597
602
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
598
603
  <fo:block margin-bottom="12pt">
@@ -775,12 +780,41 @@
775
780
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAN8AAADfCAIAAAD5m5F7AAAAAXNSR0IArs4c6QAAAAlwSFlzAAAh1QAAIdUBBJy0nQAAPjlJREFUeAHtXQdAFEcX5qhH772IgIAgxYLYFRV7773EEjWWaKImplmS2BKT2BVjr9hFxN4bghRBpYn03nvn//aWW5cDkagcd//NxXB7uzNv3rz3zZs37S2noryoqqJQSoojRT5EAiImAdmqiqKyklSCThHTC2GHkoAsTwwwnMR2EkCInASkRY4jwhCRAF8CBJ18SZBv0ZMAQafo6YRwxJcAQSdfEuRb9CRA0Cl6OiEc8SVA0MmXBPkWPQkQdIqeTghHfAkQdPIlQb5FTwIEnaKnE8IRXwIEnXxJkG/RkwBBp+jphHDElwBBJ18S5Fv0JEDQKXo6IRzxJUDQyZcE+RY9CRB0ip5OCEd8CRB08iVBvkVPAgSdoqcTwhFfAgSdfEmQb9GTAEGn6OmEcMSXAEEnXxLkW/QkQNApejohHPElQNDJlwT5Fj0JEHSKnk4IR3wJEHTyJUG+RU8CBJ2ipxPCEV8CBJ18SZBv0ZMAQafo6YRwxJcAQSdfEuRb9CRA0Cl6OiEc8SVA0MmXBPkWPQkQdIqeTghHfAkQdPIlQb5FTwIEnaKnE8IRXwIEnXxJkG/RkwBBp+jphHDElwBBJ18S5Fv0JEDQKXo6IRzxJUDQyZcE+RY9CRB0ip5OCEd8CRB08iVBvkVPAgSdoqcTwhFfAgSdfEmQb9GTAEGn6OmEcMSXAEEnXxLkW/QkQNApejohHPElQNDJlwT5Fj0JEHSKnk4IR3wJEHTyJUG+RU8CBJ2ipxPCEV8CBJ18SZBv0ZMAQafo6YRwxJcAQSdfEuRb9CRA0Cl6OiEc8SVA0MmXBPkWPQkQdIqeTghHfAkQdPIlQb5FTwIEnaKnE8IRXwIEnXxJkG/RkwBBp+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suw0QrtuNtv5WWoI2/MyInX0vN1vE9MnDOvUvX0rOItYEsSLWkKeR0yb1mfXmvE8y1Q/1D4LD4RI00lAvNEJuQCOUbEZm/feuHr/VXpOHrpj+F6WpnrTRnVeMLkr4Fu382o6aRLKn1cCYo9OiANwxAe+PDbV4o0qulpKmmrKGDrAcxDo1j+v7Ai1ppbA/wM6aRlR7jxGJdIYB1BbeQkumxo6QqDfbKOiz143yp3HULz2/PdnL4UQFKYERGLSVZgVJmWJkQQIOsVIWRLHKkGnxKlcjCpM0ClGypI4Vgk6JU7lYlRhgk4xUpbEsUrQKXEqF6MKE3SKkbIkjlWCTolTuRhVmKBTjJQlcawSdEqcysWowgSdYqQsiWOVoFPiVC5GFSboFCNlSRyrBJ0Sp3IxqjBBpxgpS+JYJeiUOJWLUYUJOsVIWRLHKkGnxKlcjCpM0ClGypI4Vgk6JU7lYlRhgk4xUpbEsUrQKXEqF6MKE3SKkbIkjlWCTolTuRhVmKBTjJQlcawSdEqcysWowgSdYqQsiWOVoFPiVC5GFSboFCNlSRyrBJ0Sp3IxqjBBpxgpS+JYJeiUOJWLUYUJOsVIWRLHKkGnxKlcjCpM0ClGypI4Vgk6JU7lYlRhgk4xUpbEsUrQKXEqF6MKE3SKkbIkjlWCTolTuRhVmKBTjJQlcawSdEqcysWowgSdYqQsiWOVoFPiVC5GFSboFCNlSRyrBJ0Sp3IxqjBBpxgpS+JYJeiUOJWLUYUJOsVIWRLHKkGnxKlcjCpM0ClGypI4Vgk6JU7lYlRhgk4xUpbEsUrQKXEqF6MKE3SKkbIkjlWCTolTuRhVmKBTjJQlcawSdEqcysWowgSdYqQsiWP1f5V8zYCHJlYcAAAAAElFTkSuQmCC</xsl:text>
776
781
  </xsl:variable>
777
782
 
778
- <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:variable name="lang">
783
+ <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_">
784
+ <xsl:for-each select="$table_widths_from_if//table">
785
+ <xsl:copy>
786
+ <xsl:copy-of select="@*"/>
787
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
788
+ </xsl:copy>
789
+ </xsl:for-each>
790
+ </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_">
791
+ false
792
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
779
793
  <xsl:call-template name="getLang"/>
780
- </xsl:variable><xsl:variable name="pageWidth_">
781
- 210
794
+ </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_">
795
+ <xsl:choose>
796
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
797
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
798
+ </xsl:choose>
799
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
800
+ <xsl:choose>
801
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
802
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
803
+ </xsl:choose>
804
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
805
+ <xsl:choose>
806
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
807
+ <xsl:otherwise>
808
+ 210
809
+ </xsl:otherwise>
810
+ </xsl:choose>
782
811
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
783
- 297
812
+ <xsl:choose>
813
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
814
+ <xsl:otherwise>
815
+ 297
816
+ </xsl:otherwise>
817
+ </xsl:choose>
784
818
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
785
819
  25.4
786
820
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -790,20 +824,7 @@
790
824
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
791
825
  25.4
792
826
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
793
-
794
- <title-edition lang="en">
795
-
796
- <xsl:text>Edition </xsl:text>
797
-
798
- </title-edition>
799
-
800
- <title-edition lang="fr">
801
- <xsl:text>Édition </xsl:text>
802
- </title-edition>
803
827
 
804
- <title-edition lang="ru">
805
- <xsl:text>Издание </xsl:text>
806
- </title-edition>
807
828
 
808
829
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
809
830
  <title-toc lang="en">
@@ -884,7 +905,7 @@
884
905
  </xsl:variable><xsl:variable name="bibdata">
885
906
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
886
907
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
887
- </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
908
+ </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="hair_space"> </xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
888
909
  <xsl:param name="name"/>
889
910
  <xsl:param name="lang"/>
890
911
  <xsl:variable name="lang_">
@@ -932,7 +953,7 @@
932
953
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
933
954
 
934
955
  <xsl:variable name="additional_fonts_">
935
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
956
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
936
957
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
937
958
  </xsl:for-each>
938
959
  </xsl:variable>
@@ -1007,7 +1028,6 @@
1007
1028
 
1008
1029
 
1009
1030
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
1010
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1011
1031
 
1012
1032
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1013
1033
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -1097,6 +1117,7 @@
1097
1117
 
1098
1118
 
1099
1119
 
1120
+
1100
1121
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1101
1122
 
1102
1123
 
@@ -1250,6 +1271,7 @@
1250
1271
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1251
1272
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1252
1273
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1274
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1253
1275
  <xsl:attribute name="display-align">center</xsl:attribute>
1254
1276
 
1255
1277
 
@@ -1268,6 +1290,7 @@
1268
1290
  <xsl:attribute name="display-align">center</xsl:attribute>
1269
1291
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1270
1292
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1293
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1271
1294
 
1272
1295
 
1273
1296
 
@@ -1356,7 +1379,8 @@
1356
1379
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1357
1380
 
1358
1381
 
1359
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1382
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1383
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1360
1384
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1361
1385
 
1362
1386
 
@@ -1371,6 +1395,27 @@
1371
1395
 
1372
1396
 
1373
1397
 
1398
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1399
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1400
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+
1416
+
1417
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1418
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1374
1419
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1375
1420
 
1376
1421
 
@@ -1688,6 +1733,24 @@
1688
1733
 
1689
1734
 
1690
1735
 
1736
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
1737
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1738
+
1739
+
1740
+
1741
+
1742
+
1743
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1744
+
1745
+
1746
+
1747
+
1748
+
1749
+
1750
+
1751
+
1752
+
1753
+
1691
1754
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1692
1755
 
1693
1756
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2094,13 +2157,13 @@
2094
2157
 
2095
2158
  </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">
2096
2159
  <xsl:variable name="nodes_preface_">
2097
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2160
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2098
2161
  <node id="{@id}"/>
2099
2162
  </xsl:for-each>
2100
2163
  </xsl:variable>
2101
2164
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2102
2165
 
2103
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2166
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2104
2167
  <xsl:sort select="@displayorder" data-type="number"/>
2105
2168
 
2106
2169
  <!-- process Section's title -->
@@ -2166,7 +2229,7 @@
2166
2229
  </xsl:for-each>
2167
2230
  </figures>
2168
2231
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2169
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2232
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2170
2233
  <xsl:sort select="@displayorder" data-type="number"/>
2171
2234
  <xsl:apply-templates select="."/>
2172
2235
  </xsl:for-each>
@@ -2186,22 +2249,32 @@
2186
2249
  <xsl:sort select="@displayorder" data-type="number"/>
2187
2250
  <xsl:apply-templates select="."/>
2188
2251
  </xsl:for-each>
2189
- </xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
2190
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2191
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2192
- <xsl:call-template name="replace_fo_inline">
2193
- <xsl:with-param name="text" select="$text"/>
2194
- </xsl:call-template>
2195
- </xsl:template><xsl:template name="replace_fo_inline">
2252
+ </xsl:template><xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable><xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable><xsl:template match="text()" name="text">
2253
+
2254
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2255
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
2256
+ <xsl:call-template name="replace_fo_inline_tags">
2257
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2258
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2259
+ <xsl:with-param name="text" select="$text"/>
2260
+ </xsl:call-template>
2261
+
2262
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2263
+ <xsl:param name="tag_open"/>
2264
+ <xsl:param name="tag_close"/>
2196
2265
  <xsl:param name="text"/>
2197
2266
  <xsl:choose>
2198
2267
  <xsl:when test="contains($text, $tag_open)">
2199
2268
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2200
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2269
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2201
2270
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2202
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2203
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2204
- <xsl:call-template name="replace_fo_inline">
2271
+ <fo:inline keep-together.within-line="always">
2272
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2273
+ </fo:inline>
2274
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2275
+ <xsl:call-template name="replace_fo_inline_tags">
2276
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2277
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2205
2278
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2206
2279
  </xsl:call-template>
2207
2280
  </xsl:when>
@@ -2209,6 +2282,39 @@
2209
2282
  </xsl:choose>
2210
2283
  </xsl:template><xsl:template match="*[local-name()='br']">
2211
2284
  <xsl:value-of select="$linebreak"/>
2285
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2286
+ <xsl:param name="split_keep-within-line"/>
2287
+
2288
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2289
+ <xsl:choose>
2290
+
2291
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2292
+ <xsl:variable name="sep">_</xsl:variable>
2293
+ <xsl:variable name="items">
2294
+ <xsl:call-template name="split">
2295
+ <xsl:with-param name="pText" select="."/>
2296
+ <xsl:with-param name="sep" select="$sep"/>
2297
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2298
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2299
+ </xsl:call-template>
2300
+ </xsl:variable>
2301
+ <xsl:for-each select="xalan:nodeset($items)/item">
2302
+ <xsl:choose>
2303
+ <xsl:when test=". = $sep">
2304
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2305
+ </xsl:when>
2306
+ <xsl:otherwise>
2307
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2308
+ </xsl:otherwise>
2309
+ </xsl:choose>
2310
+ </xsl:for-each>
2311
+ </xsl:when>
2312
+
2313
+ <xsl:otherwise>
2314
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2315
+ </xsl:otherwise>
2316
+
2317
+ </xsl:choose>
2212
2318
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2213
2319
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2214
2320
  <xsl:apply-templates/>
@@ -2274,8 +2380,23 @@
2274
2380
  </xsl:call-template>
2275
2381
 
2276
2382
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2277
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2278
- <xsl:call-template name="add-zero-spaces-java"/>
2383
+ <xsl:choose>
2384
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2385
+ <xsl:value-of select="."/>
2386
+ </xsl:when>
2387
+ <xsl:otherwise>
2388
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2389
+ </xsl:otherwise>
2390
+ </xsl:choose>
2391
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2392
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2393
+ <!-- <xsl:copy-of select="$text"/> -->
2394
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2395
+ <xsl:choose>
2396
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2397
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2398
+ </xsl:choose>
2399
+ </xsl:for-each>
2279
2400
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2280
2401
 
2281
2402
  <xsl:variable name="table-preamble">
@@ -2285,9 +2406,14 @@
2285
2406
 
2286
2407
  <xsl:variable name="table">
2287
2408
 
2288
- <xsl:variable name="simple-table">
2289
- <xsl:call-template name="getSimpleTable"/>
2409
+ <xsl:variable name="simple-table">
2410
+ <xsl:call-template name="getSimpleTable">
2411
+ <xsl:with-param name="id" select="@id"/>
2412
+ </xsl:call-template>
2290
2413
  </xsl:variable>
2414
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2415
+
2416
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2291
2417
 
2292
2418
 
2293
2419
  <!-- Display table's name before table as standalone block -->
@@ -2310,7 +2436,23 @@
2310
2436
  </xsl:call-template>
2311
2437
  </xsl:if>
2312
2438
  </xsl:variable>
2313
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2439
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2440
+
2441
+ <!-- DEBUG -->
2442
+ <xsl:if test="$table_if_debug = 'true'">
2443
+ <fo:block font-size="60%">
2444
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2445
+ </fo:block>
2446
+ </xsl:if>
2447
+
2448
+
2449
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2450
+
2451
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2452
+ DEBUG
2453
+ colwidths=<xsl:copy-of select="$colwidths"/>
2454
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2455
+
2314
2456
 
2315
2457
 
2316
2458
  <xsl:variable name="margin-side">
@@ -2371,9 +2513,17 @@
2371
2513
  </xsl:element>
2372
2514
  </xsl:variable>
2373
2515
 
2516
+ <xsl:if test="$isGenerateTableIF = 'true'">
2517
+ <!-- to determine start of table -->
2518
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2519
+ </xsl:if>
2374
2520
 
2375
2521
  <fo:table id="{@id}">
2376
2522
 
2523
+ <xsl:if test="$isGenerateTableIF = 'true'">
2524
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2525
+ </xsl:if>
2526
+
2377
2527
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2378
2528
  <xsl:attribute name="{local-name()}">
2379
2529
  <xsl:value-of select="."/>
@@ -2387,31 +2537,47 @@
2387
2537
 
2388
2538
 
2389
2539
  <xsl:choose>
2390
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2391
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2392
- <fo:table-column column-width="{@width}"/>
2393
- </xsl:for-each>
2540
+ <xsl:when test="$isGenerateTableIF = 'true'">
2541
+ <!-- generate IF for table widths -->
2542
+ <!-- example:
2543
+ <tr>
2544
+ <td valign="top" align="left" id="tab-symdu_1_1">
2545
+ <p>Symbol</p>
2546
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2547
+ </td>
2548
+ <td valign="top" align="left" id="tab-symdu_1_2">
2549
+ <p>Description</p>
2550
+ <word id="tab-symdu_1_2_word_1">Description</word>
2551
+ </td>
2552
+ </tr>
2553
+ -->
2554
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2555
+
2394
2556
  </xsl:when>
2395
2557
  <xsl:otherwise>
2396
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2397
- <xsl:choose>
2398
- <xsl:when test=". = 1 or . = 0">
2399
- <fo:table-column column-width="proportional-column-width(2)"/>
2400
- </xsl:when>
2401
- <xsl:otherwise>
2402
- <fo:table-column column-width="proportional-column-width({.})"/>
2403
- </xsl:otherwise>
2404
- </xsl:choose>
2405
- </xsl:for-each>
2406
- </xsl:otherwise>
2407
- </xsl:choose>
2408
2558
 
2409
- <xsl:choose>
2410
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2411
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2412
- </xsl:when>
2413
- <xsl:otherwise>
2414
- <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 -->
2559
+ <xsl:choose>
2560
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2561
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2562
+ <fo:table-column column-width="{@width}"/>
2563
+ </xsl:for-each>
2564
+ </xsl:when>
2565
+ <xsl:otherwise>
2566
+ <xsl:call-template name="insertTableColumnWidth">
2567
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2568
+ </xsl:call-template>
2569
+ </xsl:otherwise>
2570
+ </xsl:choose>
2571
+
2572
+ <xsl:choose>
2573
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2574
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2575
+ </xsl:when>
2576
+ <xsl:otherwise>
2577
+ <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 -->
2578
+ </xsl:otherwise>
2579
+ </xsl:choose>
2580
+
2415
2581
  </xsl:otherwise>
2416
2582
  </xsl:choose>
2417
2583
 
@@ -2514,11 +2680,22 @@
2514
2680
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2515
2681
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2516
2682
  </xsl:template><xsl:template name="calculate-column-widths">
2683
+ <xsl:param name="table"/>
2684
+ <xsl:param name="cols-count"/>
2685
+
2686
+ <xsl:call-template name="calculate-column-widths-proportional">
2687
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2688
+ <xsl:with-param name="table" select="$table"/>
2689
+ </xsl:call-template>
2690
+
2691
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2517
2692
  <xsl:param name="table"/>
2518
2693
  <xsl:param name="cols-count"/>
2519
2694
  <xsl:param name="curr-col" select="1"/>
2520
2695
  <xsl:param name="width" select="0"/>
2521
2696
 
2697
+ <!-- table=<xsl:copy-of select="$table"/> -->
2698
+
2522
2699
  <xsl:if test="$curr-col &lt;= $cols-count">
2523
2700
  <xsl:variable name="widths">
2524
2701
  <xsl:choose>
@@ -2556,16 +2733,22 @@
2556
2733
  </xsl:for-each>
2557
2734
  </xsl:when>
2558
2735
  <xsl:otherwise>
2559
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2736
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2737
+
2738
+ <!-- <table><xsl:copy-of select="$table"/></table>
2739
+ -->
2740
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2560
2741
  <xsl:variable name="td_text">
2561
2742
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2562
2743
  </xsl:variable>
2744
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2563
2745
  <xsl:variable name="words">
2564
2746
  <xsl:variable name="string_with_added_zerospaces">
2565
2747
  <xsl:call-template name="add-zero-spaces-java">
2566
2748
  <xsl:with-param name="text" select="$td_text"/>
2567
2749
  </xsl:call-template>
2568
2750
  </xsl:variable>
2751
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2569
2752
  <xsl:call-template name="tokenize">
2570
2753
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2571
2754
  <!-- 2009 thinspace -->
@@ -2573,11 +2756,13 @@
2573
2756
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2574
2757
  </xsl:call-template>
2575
2758
  </xsl:variable>
2759
+ <!-- words=<xsl:copy-of select="$words"/> -->
2576
2760
  <xsl:variable name="max_length">
2577
2761
  <xsl:call-template name="max_length">
2578
2762
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2579
2763
  </xsl:call-template>
2580
2764
  </xsl:variable>
2765
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2581
2766
  <width>
2582
2767
  <xsl:variable name="divider">
2583
2768
  <xsl:choose>
@@ -2596,6 +2781,8 @@
2596
2781
  </xsl:choose>
2597
2782
  </xsl:variable>
2598
2783
 
2784
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2785
+
2599
2786
  <column>
2600
2787
  <xsl:for-each select="xalan:nodeset($widths)//width">
2601
2788
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2604,29 +2791,271 @@
2604
2791
  </xsl:if>
2605
2792
  </xsl:for-each>
2606
2793
  </column>
2607
- <xsl:call-template name="calculate-column-widths">
2794
+ <xsl:call-template name="calculate-column-widths-proportional">
2608
2795
  <xsl:with-param name="cols-count" select="$cols-count"/>
2609
2796
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2610
2797
  <xsl:with-param name="table" select="$table"/>
2611
2798
  </xsl:call-template>
2612
2799
  </xsl:if>
2800
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2801
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2802
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2803
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2804
+
2805
+ <!-- if all capitals english letters or digits -->
2806
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2807
+ <xsl:call-template name="repeat">
2808
+ <xsl:with-param name="char" select="'X'"/>
2809
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2810
+ </xsl:call-template>
2811
+ </xsl:if>
2613
2812
  </xsl:template><xsl:template match="text()" mode="td_text">
2614
2813
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2615
2814
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2616
2815
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2617
2816
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2618
2817
  <xsl:value-of select="@target"/>
2619
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2620
- <xsl:variable name="mathml">
2621
- <xsl:for-each select="*">
2622
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2623
- <xsl:copy-of select="."/>
2624
- </xsl:if>
2818
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2819
+ <xsl:if test="$isGenerateTableIF = 'false'">
2820
+ <xsl:variable name="mathml_">
2821
+ <xsl:for-each select="*">
2822
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2823
+ <xsl:copy-of select="."/>
2824
+ </xsl:if>
2825
+ </xsl:for-each>
2826
+ </xsl:variable>
2827
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2828
+
2829
+ <xsl:variable name="math_text">
2830
+ <xsl:value-of select="normalize-space($mathml)"/>
2831
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2832
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2833
+ </xsl:variable>
2834
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2835
+ </xsl:if>
2836
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2837
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2838
+
2839
+ <!-- via intermediate format -->
2840
+
2841
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2842
+
2843
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2844
+
2845
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2846
+
2847
+ <!-- get current table id -->
2848
+ <xsl:variable name="table_id" select="@id"/>
2849
+ <!-- find table by id in the file 'table_widths' -->
2850
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2851
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2852
+
2853
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2854
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2855
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2856
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2857
+
2858
+ <xsl:variable name="table_with_cell_widths_">
2859
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2860
+ </xsl:variable>
2861
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2862
+
2863
+ <!-- <xsl:if test="$table_if_debug = 'true'">
2864
+ <xsl:copy-of select="$table_with_cell_widths"/>
2865
+ </xsl:if> -->
2866
+
2867
+
2868
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2869
+
2870
+ <xsl:variable name="column_widths_">
2871
+ <!-- iteration of columns -->
2872
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2873
+ <xsl:variable name="pos" select="position()"/>
2874
+ <column>
2875
+ <xsl:attribute name="width_max">
2876
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2877
+ <xsl:sort select="." data-type="number" order="descending"/>
2878
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2879
+ </xsl:for-each>
2880
+ </xsl:attribute>
2881
+ <xsl:attribute name="width_min">
2882
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2883
+ <xsl:sort select="." data-type="number" order="descending"/>
2884
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2885
+ </xsl:for-each>
2886
+ </xsl:attribute>
2887
+ </column>
2625
2888
  </xsl:for-each>
2626
2889
  </xsl:variable>
2890
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2891
+
2892
+ <!-- <column_widths>
2893
+ <xsl:copy-of select="$column_widths"/>
2894
+ </column_widths> -->
2895
+
2896
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2897
+ <xsl:variable name="table_widths_">
2898
+ <table>
2899
+ <xsl:attribute name="width_max">
2900
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2901
+ </xsl:attribute>
2902
+ <xsl:attribute name="width_min">
2903
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2904
+ </xsl:attribute>
2905
+ </table>
2906
+ </xsl:variable>
2907
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2908
+
2909
+ <xsl:variable name="page_width">
2910
+ <xsl:choose>
2911
+ <xsl:when test="$parent_table_page-width != ''">
2912
+ <xsl:value-of select="$parent_table_page-width"/>
2913
+ </xsl:when>
2914
+ <xsl:otherwise>
2915
+ <xsl:value-of select="@page-width"/>
2916
+ </xsl:otherwise>
2917
+ </xsl:choose>
2918
+ </xsl:variable>
2919
+
2920
+ <xsl:if test="$table_if_debug = 'true'">
2921
+ <table_width>
2922
+ <xsl:copy-of select="$table_widths"/>
2923
+ </table_width>
2924
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2925
+ </xsl:if>
2926
+
2927
+
2928
+ <!-- There are three cases: -->
2929
+ <xsl:choose>
2930
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2931
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2932
+ <!-- call old algorithm -->
2933
+ <case1/>
2934
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2935
+ <xsl:call-template name="calculate-column-widths-proportional">
2936
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2937
+ <xsl:with-param name="table" select="$table"/>
2938
+ </xsl:call-template> -->
2939
+ </xsl:when>
2940
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2941
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2942
+ <case2/>
2943
+ <autolayout/>
2944
+ <xsl:for-each select="$column_widths/column/@width_max">
2945
+ <column divider="100"><xsl:value-of select="."/></column>
2946
+ </xsl:for-each>
2947
+ </xsl:when>
2948
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2949
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2950
+ Lets also call D the difference between maximum and minimum width of the table.
2951
+ For each column, let d be the difference between maximum and minimum width of that column.
2952
+ Now set the column's width to the minimum width plus d times W over D.
2953
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2954
+ <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)">
2955
+ <!-- difference between the available space and the minimum table width -->
2956
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2957
+ <W><xsl:value-of select="$W"/></W>
2958
+ <!-- difference between maximum and minimum width of the table -->
2959
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2960
+ <D><xsl:value-of select="$D"/></D>
2961
+ <case3/>
2962
+ <autolayout/>
2963
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2964
+ <split_keep-within-line>true</split_keep-within-line>
2965
+ </xsl:if>
2966
+ <xsl:for-each select="$column_widths/column">
2967
+ <!-- difference between maximum and minimum width of that column. -->
2968
+ <xsl:variable name="d" select="@width_max - @width_min"/>
2969
+ <d><xsl:value-of select="$d"/></d>
2970
+ <width_min><xsl:value-of select="@width_min"/></width_min>
2971
+ <e><xsl:value-of select="$d * $W div $D"/></e>
2972
+ <!-- set the column's width to the minimum width plus d times W over D. -->
2973
+ <column divider="100">
2974
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
2975
+ </column>
2976
+ </xsl:for-each>
2977
+
2978
+ </xsl:when>
2979
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
2980
+ </xsl:choose>
2981
+
2982
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
2983
+
2984
+ <!-- if nested 'dl' or 'table' -->
2985
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
2986
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
2987
+
2988
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2989
+
2990
+ <xsl:variable name="parent_table_page-width_">
2991
+ <xsl:if test="$parent_table_id != ''">
2992
+ <!-- determine column number in the parent table -->
2993
+ <xsl:variable name="parent_table_column_number">
2994
+ <xsl:choose>
2995
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2996
+ <xsl:otherwise> <!-- parent is table -->
2997
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2998
+ </xsl:otherwise>
2999
+ </xsl:choose>
3000
+ </xsl:variable>
3001
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
3002
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3003
+ </xsl:if>
3004
+ </xsl:variable>
3005
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
3006
+
3007
+ <!-- get current table id -->
3008
+ <xsl:variable name="table_id" select="@id"/>
3009
+
3010
+ <xsl:choose>
3011
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
3012
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
3013
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
3014
+ </xsl:when>
3015
+ <xsl:otherwise>
3016
+ <!-- recalculate columns width based on parent table width -->
3017
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
3018
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
3019
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
3020
+ </xsl:call-template>
3021
+ </xsl:for-each>
3022
+ </xsl:otherwise>
3023
+ </xsl:choose>
2627
3024
 
2628
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2629
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3025
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3026
+ <xsl:copy>
3027
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3028
+ </xsl:copy>
3029
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
3030
+ <xsl:copy>
3031
+ <xsl:copy-of select="@*"/>
3032
+
3033
+ <!-- The maximum width is given by the widest line. -->
3034
+ <xsl:attribute name="width_max">
3035
+ <xsl:for-each select="p_len">
3036
+ <xsl:sort select="." data-type="number" order="descending"/>
3037
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3038
+ </xsl:for-each>
3039
+ </xsl:attribute>
3040
+
3041
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3042
+ <xsl:variable name="width_min">
3043
+ <xsl:for-each select="word_len">
3044
+ <xsl:sort select="." data-type="number" order="descending"/>
3045
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3046
+ </xsl:for-each>
3047
+ </xsl:variable>
3048
+ <xsl:attribute name="width_min">
3049
+ <xsl:value-of select="$width_min"/>
3050
+ </xsl:attribute>
3051
+
3052
+ <xsl:if test="$width_min = 0">
3053
+ <xsl:attribute name="width_min">1</xsl:attribute>
3054
+ </xsl:if>
3055
+
3056
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3057
+
3058
+ </xsl:copy>
2630
3059
  </xsl:template><xsl:template match="*[local-name()='thead']">
2631
3060
  <xsl:param name="cols-count"/>
2632
3061
  <fo:table-header>
@@ -2711,16 +3140,10 @@
2711
3140
  </xsl:for-each>
2712
3141
  </xsl:when>
2713
3142
  <xsl:otherwise>
2714
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2715
- <xsl:choose>
2716
- <xsl:when test=". = 1 or . = 0">
2717
- <fo:table-column column-width="proportional-column-width(2)"/>
2718
- </xsl:when>
2719
- <xsl:otherwise>
2720
- <fo:table-column column-width="proportional-column-width({.})"/>
2721
- </xsl:otherwise>
2722
- </xsl:choose>
2723
- </xsl:for-each>
3143
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
3144
+ <xsl:call-template name="insertTableColumnWidth">
3145
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3146
+ </xsl:call-template>
2724
3147
  </xsl:otherwise>
2725
3148
  </xsl:choose>
2726
3149
 
@@ -2797,18 +3220,64 @@
2797
3220
 
2798
3221
  </fo:table-body>
2799
3222
 
2800
- </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2801
- <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3223
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3224
+ <xsl:param name="table_or_dl">table</xsl:param>
3225
+ <xsl:apply-templates mode="process_table-if">
3226
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3227
+ </xsl:apply-templates>
3228
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3229
+ <xsl:param name="table_or_dl">table</xsl:param>
2802
3230
 
2803
-
2804
-
2805
-
3231
+ <fo:table-body>
3232
+ <xsl:for-each select="*[local-name() = 'tr']">
3233
+ <xsl:variable name="col_count" select="count(*)"/>
2806
3234
 
2807
-
2808
-
2809
- <xsl:call-template name="setTableRowAttributes"/>
2810
-
2811
- <xsl:apply-templates/>
3235
+ <!-- iteration for each tr/td -->
3236
+
3237
+ <xsl:choose>
3238
+ <xsl:when test="$table_or_dl = 'table'">
3239
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3240
+ <fo:table-row number-columns-spanned="{$col_count}">
3241
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3242
+ <xsl:call-template name="td"/>
3243
+ </fo:table-row>
3244
+ </xsl:for-each>
3245
+ </xsl:when>
3246
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3247
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3248
+ <xsl:variable name="is_dt" select="position() = 1"/>
3249
+
3250
+ <xsl:for-each select="*">
3251
+ <!-- <test><xsl:copy-of select="."/></test> -->
3252
+ <fo:table-row number-columns-spanned="{$col_count}">
3253
+ <xsl:choose>
3254
+ <xsl:when test="$is_dt">
3255
+ <xsl:call-template name="insert_dt_cell"/>
3256
+ </xsl:when>
3257
+ <xsl:otherwise>
3258
+ <xsl:call-template name="insert_dd_cell"/>
3259
+ </xsl:otherwise>
3260
+ </xsl:choose>
3261
+ </fo:table-row>
3262
+ </xsl:for-each>
3263
+ </xsl:for-each>
3264
+ </xsl:otherwise>
3265
+ </xsl:choose>
3266
+
3267
+ </xsl:for-each>
3268
+ </fo:table-body>
3269
+ </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3270
+ <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3271
+
3272
+
3273
+
3274
+
3275
+
3276
+
3277
+
3278
+ <xsl:call-template name="setTableRowAttributes"/>
3279
+
3280
+ <xsl:apply-templates/>
2812
3281
  </fo:table-row>
2813
3282
  </xsl:template><xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
2814
3283
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -2883,7 +3352,7 @@
2883
3352
  </xsl:choose>
2884
3353
  </xsl:attribute>
2885
3354
  </xsl:if>
2886
- </xsl:template><xsl:template match="*[local-name()='td']">
3355
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2887
3356
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2888
3357
  <xsl:call-template name="setTextAlignment">
2889
3358
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2917,11 +3386,24 @@
2917
3386
 
2918
3387
  <xsl:call-template name="setTableCellAttributes"/>
2919
3388
 
3389
+ <xsl:if test="$isGenerateTableIF = 'true'">
3390
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3391
+ <xsl:attribute name="text-align">left</xsl:attribute>
3392
+ </xsl:if>
3393
+
2920
3394
  <fo:block>
2921
3395
 
3396
+ <xsl:if test="$isGenerateTableIF = 'true'">
3397
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3398
+ </xsl:if>
3399
+
3400
+
2922
3401
 
2923
3402
 
2924
3403
  <xsl:apply-templates/>
3404
+
3405
+ <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"/> -->
3406
+
2925
3407
  </fo:block>
2926
3408
  </fo:table-cell>
2927
3409
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -3118,9 +3600,9 @@
3118
3600
  <!-- current hierarchy is 'figure' element -->
3119
3601
  <xsl:variable name="following_dl_colwidths">
3120
3602
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3121
- <xsl:variable name="html-table">
3122
- <xsl:variable name="doc_ns">
3123
-
3603
+ <xsl:variable name="simple-table">
3604
+ <!-- <xsl:variable name="doc_ns">
3605
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3124
3606
  </xsl:variable>
3125
3607
  <xsl:variable name="ns">
3126
3608
  <xsl:choose>
@@ -3131,7 +3613,7 @@
3131
3613
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3132
3614
  </xsl:otherwise>
3133
3615
  </xsl:choose>
3134
- </xsl:variable>
3616
+ </xsl:variable> -->
3135
3617
 
3136
3618
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3137
3619
  <tbody>
@@ -3142,7 +3624,7 @@
3142
3624
 
3143
3625
  <xsl:call-template name="calculate-column-widths">
3144
3626
  <xsl:with-param name="cols-count" select="2"/>
3145
- <xsl:with-param name="table" select="$html-table"/>
3627
+ <xsl:with-param name="table" select="$simple-table"/>
3146
3628
  </xsl:call-template>
3147
3629
 
3148
3630
  </xsl:if>
@@ -3261,8 +3743,10 @@
3261
3743
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3262
3744
  </xsl:variable>
3263
3745
 
3746
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3747
+
3264
3748
  <xsl:choose>
3265
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3749
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3266
3750
 
3267
3751
  <fo:block margin-bottom="12pt" text-align="left">
3268
3752
 
@@ -3277,7 +3761,7 @@
3277
3761
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3278
3762
  </fo:block>
3279
3763
 
3280
- </xsl:when>
3764
+ </xsl:when> <!-- END: only one component -->
3281
3765
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3282
3766
  <fo:block margin-bottom="12pt" text-align="left">
3283
3767
 
@@ -3291,8 +3775,8 @@
3291
3775
  </xsl:variable>
3292
3776
  <xsl:value-of select="$title-where"/>
3293
3777
  </fo:block>
3294
- </xsl:when>
3295
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3778
+ </xsl:when> <!-- END: a few components -->
3779
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3296
3780
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3297
3781
 
3298
3782
 
@@ -3305,11 +3789,11 @@
3305
3789
  </xsl:variable>
3306
3790
  <xsl:value-of select="$title-key"/>
3307
3791
  </fo:block>
3308
- </xsl:when>
3792
+ </xsl:when> <!-- END: definition list in a figure -->
3309
3793
  </xsl:choose>
3310
3794
 
3311
3795
  <!-- a few components -->
3312
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3796
+ <xsl:if test="$onlyOneComponent = 'false'">
3313
3797
  <fo:block>
3314
3798
 
3315
3799
 
@@ -3317,6 +3801,11 @@
3317
3801
 
3318
3802
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
3319
3803
 
3804
+
3805
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3806
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3807
+ </xsl:if>
3808
+
3320
3809
  <fo:block>
3321
3810
 
3322
3811
 
@@ -3324,7 +3813,21 @@
3324
3813
  <xsl:attribute name="margin-left">-3.5mm</xsl:attribute>
3325
3814
 
3326
3815
 
3816
+ <xsl:apply-templates select="*[local-name() = 'name']">
3817
+ <xsl:with-param name="process">true</xsl:with-param>
3818
+ </xsl:apply-templates>
3819
+
3820
+ <xsl:if test="$isGenerateTableIF = 'true'">
3821
+ <!-- to determine start of table -->
3822
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3823
+ </xsl:if>
3824
+
3327
3825
  <fo:table width="95%" table-layout="fixed">
3826
+
3827
+ <xsl:if test="$isGenerateTableIF = 'true'">
3828
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3829
+ </xsl:if>
3830
+
3328
3831
 
3329
3832
  <xsl:choose>
3330
3833
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3333,61 +3836,178 @@
3333
3836
 
3334
3837
  </xsl:when>
3335
3838
  </xsl:choose>
3336
- <!-- create virtual html table for dl/[dt and dd] -->
3337
- <xsl:variable name="html-table">
3338
- <xsl:variable name="doc_ns">
3839
+
3840
+
3841
+
3842
+ <xsl:choose>
3843
+ <xsl:when test="$isGenerateTableIF = 'true'">
3844
+ <!-- generate IF for table widths -->
3845
+ <!-- example:
3846
+ <tr>
3847
+ <td valign="top" align="left" id="tab-symdu_1_1">
3848
+ <p>Symbol</p>
3849
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3850
+ </td>
3851
+ <td valign="top" align="left" id="tab-symdu_1_2">
3852
+ <p>Description</p>
3853
+ <word id="tab-symdu_1_2_word_1">Description</word>
3854
+ </td>
3855
+ </tr>
3856
+ -->
3339
3857
 
3340
- </xsl:variable>
3341
- <xsl:variable name="ns">
3342
- <xsl:choose>
3343
- <xsl:when test="normalize-space($doc_ns) != ''">
3344
- <xsl:value-of select="normalize-space($doc_ns)"/>
3345
- </xsl:when>
3346
- <xsl:otherwise>
3347
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3348
- </xsl:otherwise>
3349
- </xsl:choose>
3350
- </xsl:variable>
3351
- <tbody>
3352
- <xsl:apply-templates mode="dl"/>
3353
- </tbody>
3354
- </xsl:variable>
3355
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3356
- <xsl:variable name="colwidths">
3357
- <xsl:call-template name="calculate-column-widths">
3358
- <xsl:with-param name="cols-count" select="2"/>
3359
- <xsl:with-param name="table" select="$html-table"/>
3360
- </xsl:call-template>
3361
- </xsl:variable>
3362
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3363
- <xsl:variable name="maxlength_dt">
3364
- <xsl:call-template name="getMaxLength_dt"/>
3365
- </xsl:variable>
3366
- <xsl:call-template name="setColumnWidth_dl">
3367
- <xsl:with-param name="colwidths" select="$colwidths"/>
3368
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3369
- </xsl:call-template>
3370
- <fo:table-body>
3371
- <xsl:apply-templates>
3372
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3373
- </xsl:apply-templates>
3374
- </fo:table-body>
3858
+ <!-- create virtual html table for dl/[dt and dd] -->
3859
+ <xsl:variable name="simple-table">
3860
+
3861
+ <xsl:variable name="dl_table">
3862
+ <tbody>
3863
+ <xsl:apply-templates mode="dl_if">
3864
+ <xsl:with-param name="id" select="@id"/>
3865
+ </xsl:apply-templates>
3866
+ </tbody>
3867
+ </xsl:variable>
3868
+
3869
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3870
+
3871
+ <!-- Step: replace <br/> to <p>...</p> -->
3872
+ <xsl:variable name="table_without_br">
3873
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3874
+ </xsl:variable>
3875
+
3876
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3877
+
3878
+ <!-- Step: add id to each cell -->
3879
+ <!-- add <word>...</word> for each word, image, math -->
3880
+ <xsl:variable name="simple-table-id">
3881
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3882
+ <xsl:with-param name="id" select="@id"/>
3883
+ </xsl:apply-templates>
3884
+ </xsl:variable>
3885
+
3886
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3887
+
3888
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3889
+
3890
+ </xsl:variable>
3891
+
3892
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3893
+
3894
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3895
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3896
+ </xsl:apply-templates>
3897
+
3898
+ </xsl:when>
3899
+ <xsl:otherwise>
3900
+
3901
+ <xsl:variable name="simple-table">
3902
+
3903
+ <xsl:variable name="dl_table">
3904
+ <tbody>
3905
+ <xsl:apply-templates mode="dl">
3906
+ <xsl:with-param name="id" select="@id"/>
3907
+ </xsl:apply-templates>
3908
+ </tbody>
3909
+ </xsl:variable>
3910
+
3911
+ <xsl:copy-of select="$dl_table"/>
3912
+ </xsl:variable>
3913
+
3914
+ <xsl:variable name="colwidths">
3915
+ <xsl:call-template name="calculate-column-widths">
3916
+ <xsl:with-param name="cols-count" select="2"/>
3917
+ <xsl:with-param name="table" select="$simple-table"/>
3918
+ </xsl:call-template>
3919
+ </xsl:variable>
3920
+
3921
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3922
+ DEBUG
3923
+ colwidths=<xsl:copy-of select="$colwidths"/>
3924
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3925
+
3926
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3927
+
3928
+ <xsl:variable name="maxlength_dt">
3929
+ <xsl:call-template name="getMaxLength_dt"/>
3930
+ </xsl:variable>
3931
+
3932
+ <xsl:variable name="isContainsKeepTogetherTag_">
3933
+ false
3934
+ </xsl:variable>
3935
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3936
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3937
+
3938
+
3939
+ <xsl:call-template name="setColumnWidth_dl">
3940
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3941
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3942
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3943
+ </xsl:call-template>
3944
+
3945
+ <fo:table-body>
3946
+
3947
+ <!-- DEBUG -->
3948
+ <xsl:if test="$table_if_debug = 'true'">
3949
+ <fo:table-row>
3950
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
3951
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3952
+ </fo:table-cell>
3953
+ </fo:table-row>
3954
+ </xsl:if>
3955
+
3956
+ <xsl:apply-templates>
3957
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3958
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
3959
+ </xsl:apply-templates>
3960
+
3961
+ </fo:table-body>
3962
+ </xsl:otherwise>
3963
+ </xsl:choose>
3375
3964
  </fo:table>
3376
3965
  </fo:block>
3377
3966
  </fo:block>
3378
- </xsl:if>
3967
+ </xsl:if> <!-- END: a few components -->
3379
3968
  </fo:block-container>
3380
3969
  </fo:block-container>
3970
+
3971
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
3972
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
3973
+ </xsl:if>
3974
+
3975
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3976
+ <xsl:param name="process">false</xsl:param>
3977
+ <xsl:if test="$process = 'true'">
3978
+ <fo:block xsl:use-attribute-sets="dl-name-style">
3979
+ <xsl:apply-templates/>
3980
+ </fo:block>
3981
+ </xsl:if>
3381
3982
  </xsl:template><xsl:template name="setColumnWidth_dl">
3382
3983
  <xsl:param name="colwidths"/>
3383
3984
  <xsl:param name="maxlength_dt"/>
3985
+ <xsl:param name="isContainsKeepTogetherTag"/>
3986
+
3987
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
3988
+
3384
3989
  <xsl:choose>
3990
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3991
+ <xsl:call-template name="insertTableColumnWidth">
3992
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3993
+ </xsl:call-template>
3994
+ </xsl:when>
3385
3995
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3386
3996
  <fo:table-column column-width="50%"/>
3387
3997
  <fo:table-column column-width="50%"/>
3388
3998
  </xsl:when>
3389
3999
  <xsl:otherwise>
3390
4000
  <xsl:choose>
4001
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4002
+ <xsl:call-template name="insertTableColumnWidth">
4003
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4004
+ </xsl:call-template>
4005
+ </xsl:when>
4006
+ <xsl:when test="$isContainsKeepTogetherTag">
4007
+ <xsl:call-template name="insertTableColumnWidth">
4008
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4009
+ </xsl:call-template>
4010
+ </xsl:when>
3391
4011
  <!-- to set width check most wide chars like `W` -->
3392
4012
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3393
4013
  <fo:table-column column-width="7%"/>
@@ -3418,20 +4038,31 @@
3418
4038
  <fo:table-column column-width="60%"/>
3419
4039
  </xsl:when>
3420
4040
  <xsl:otherwise>
3421
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3422
- <xsl:choose>
3423
- <xsl:when test=". = 1 or . = 0">
3424
- <fo:table-column column-width="proportional-column-width(2)"/>
3425
- </xsl:when>
3426
- <xsl:otherwise>
3427
- <fo:table-column column-width="proportional-column-width({.})"/>
3428
- </xsl:otherwise>
3429
- </xsl:choose>
3430
- </xsl:for-each>
4041
+ <xsl:call-template name="insertTableColumnWidth">
4042
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4043
+ </xsl:call-template>
3431
4044
  </xsl:otherwise>
3432
4045
  </xsl:choose>
3433
4046
  </xsl:otherwise>
3434
4047
  </xsl:choose>
4048
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4049
+ <xsl:param name="colwidths"/>
4050
+
4051
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4052
+ <xsl:choose>
4053
+ <xsl:when test=". = 1 or . = 0">
4054
+ <fo:table-column column-width="proportional-column-width(2)"/>
4055
+ </xsl:when>
4056
+ <xsl:otherwise>
4057
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
4058
+ <xsl:variable name="divider">
4059
+ <xsl:value-of select="@divider"/>
4060
+ <xsl:if test="not(@divider)">1</xsl:if>
4061
+ </xsl:variable>
4062
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
4063
+ </xsl:otherwise>
4064
+ </xsl:choose>
4065
+ </xsl:for-each>
3435
4066
  </xsl:template><xsl:template name="getMaxLength_dt">
3436
4067
  <xsl:variable name="lengths">
3437
4068
  <xsl:for-each select="*[local-name()='dt']">
@@ -3455,7 +4086,6 @@
3455
4086
  <xsl:value-of select="$maxLength"/>
3456
4087
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3457
4088
  <xsl:param name="key_iso"/>
3458
-
3459
4089
  <!-- <tr>
3460
4090
  <td>NOTE</td>
3461
4091
  <td>
@@ -3463,27 +4093,47 @@
3463
4093
  </td>
3464
4094
  </tr>
3465
4095
  -->
3466
- <fo:table-row>
4096
+ <!-- OLD Variant -->
4097
+ <!-- <fo:table-row>
3467
4098
  <fo:table-cell>
3468
4099
  <fo:block margin-top="6pt">
3469
4100
  <xsl:if test="normalize-space($key_iso) = 'true'">
3470
4101
  <xsl:attribute name="margin-top">0</xsl:attribute>
3471
4102
  </xsl:if>
3472
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4103
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3473
4104
  </fo:block>
3474
4105
  </fo:table-cell>
3475
4106
  <fo:table-cell>
3476
4107
  <fo:block>
3477
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4108
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
4109
+ </fo:block>
4110
+ </fo:table-cell>
4111
+ </fo:table-row> -->
4112
+ <!-- <tr>
4113
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
4114
+ </tr>
4115
+ -->
4116
+ <fo:table-row>
4117
+ <fo:table-cell number-columns-spanned="2">
4118
+ <fo:block>
4119
+ <xsl:call-template name="note"/>
3478
4120
  </fo:block>
3479
4121
  </fo:table-cell>
3480
4122
  </fo:table-row>
3481
4123
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
4124
+ <xsl:param name="id"/>
4125
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3482
4126
  <tr>
3483
4127
  <td>
4128
+ <xsl:attribute name="id">
4129
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4130
+ </xsl:attribute>
3484
4131
  <xsl:apply-templates/>
3485
4132
  </td>
3486
4133
  <td>
4134
+ <xsl:attribute name="id">
4135
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4136
+ </xsl:attribute>
3487
4137
 
3488
4138
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3489
4139
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3494,50 +4144,134 @@
3494
4144
 
3495
4145
  </xsl:template><xsl:template match="*[local-name()='dt']">
3496
4146
  <xsl:param name="key_iso"/>
4147
+ <xsl:param name="split_keep-within-line"/>
3497
4148
 
3498
4149
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3499
- <fo:table-cell>
4150
+ <xsl:call-template name="insert_dt_cell">
4151
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4152
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4153
+ </xsl:call-template>
4154
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4155
+ <xsl:call-template name="insert_dd_cell">
4156
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4157
+ </xsl:call-template>
4158
+ </xsl:for-each>
4159
+ </fo:table-row>
4160
+ </xsl:template><xsl:template name="insert_dt_cell">
4161
+ <xsl:param name="key_iso"/>
4162
+ <xsl:param name="split_keep-within-line"/>
4163
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4164
+
4165
+ <xsl:if test="$isGenerateTableIF = 'true'">
4166
+ <!-- border is mandatory, to calculate real width -->
4167
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4168
+ <xsl:attribute name="text-align">left</xsl:attribute>
4169
+ </xsl:if>
4170
+
4171
+
4172
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4173
+ <xsl:copy-of select="@id"/>
4174
+
4175
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4176
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4177
+ </xsl:if>
4178
+
4179
+
4180
+
4181
+ <xsl:apply-templates>
4182
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4183
+ </xsl:apply-templates>
4184
+
4185
+ <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"/> -->
4186
+
4187
+ </fo:block>
4188
+ </fo:table-cell>
4189
+ </xsl:template><xsl:template name="insert_dd_cell">
4190
+ <xsl:param name="split_keep-within-line"/>
4191
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4192
+
4193
+ <xsl:if test="$isGenerateTableIF = 'true'">
4194
+ <!-- border is mandatory, to calculate real width -->
4195
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4196
+ </xsl:if>
4197
+
4198
+ <fo:block>
4199
+
4200
+ <xsl:if test="$isGenerateTableIF = 'true'">
4201
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4202
+ </xsl:if>
4203
+
3500
4204
 
3501
- <fo:block xsl:use-attribute-sets="dt-style">
3502
- <xsl:copy-of select="@id"/>
3503
-
3504
- <xsl:if test="normalize-space($key_iso) = 'true'">
3505
- <xsl:attribute name="margin-top">0</xsl:attribute>
3506
- </xsl:if>
3507
-
3508
-
3509
-
3510
- <xsl:apply-templates/>
3511
- </fo:block>
3512
- </fo:table-cell>
3513
- <fo:table-cell>
3514
- <fo:block>
3515
-
3516
4205
 
3517
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3518
- <xsl:with-param name="process">true</xsl:with-param>
3519
- </xsl:apply-templates>
3520
- </fo:block>
3521
- </fo:table-cell>
3522
- </fo:table-row>
4206
+ <xsl:choose>
4207
+ <xsl:when test="$isGenerateTableIF = 'true'">
4208
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4209
+ <xsl:with-param name="process">true</xsl:with-param>
4210
+ </xsl:apply-templates>
4211
+ </xsl:when>
4212
+ <xsl:otherwise>
4213
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4214
+ <xsl:with-param name="process">true</xsl:with-param>
4215
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4216
+ </xsl:apply-templates>
4217
+ </xsl:otherwise>
4218
+
4219
+ </xsl:choose>
4220
+
4221
+ <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"/> -->
4222
+
4223
+ </fo:block>
4224
+ </fo:table-cell>
3523
4225
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3524
4226
  <xsl:apply-templates/>
3525
4227
  </xsl:template><xsl:template match="*[local-name()='dd']">
3526
4228
  <xsl:param name="process">false</xsl:param>
4229
+ <xsl:param name="split_keep-within-line"/>
3527
4230
  <xsl:if test="$process = 'true'">
3528
4231
  <xsl:apply-templates select="@language"/>
3529
- <xsl:apply-templates/>
4232
+ <xsl:apply-templates>
4233
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4234
+ </xsl:apply-templates>
3530
4235
  </xsl:if>
3531
4236
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3532
4237
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3533
- </xsl:template><xsl:template match="*[local-name()='em']">
4238
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4239
+ <xsl:param name="id"/>
4240
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4241
+ <tr>
4242
+ <td>
4243
+ <xsl:copy-of select="node()"/>
4244
+ </td>
4245
+ <td>
4246
+
4247
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4248
+
4249
+ <!-- get paragraphs from nested 'dl' -->
4250
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4251
+
4252
+
4253
+ </td>
4254
+ </tr>
4255
+
4256
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4257
+ <xsl:for-each select="*[local-name() = 'dt']">
4258
+ <p>
4259
+ <xsl:copy-of select="node()"/>
4260
+ <xsl:text> </xsl:text>
4261
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4262
+ </p>
4263
+ </xsl:for-each>
4264
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
3534
4265
  <fo:inline font-style="italic">
3535
4266
  <xsl:apply-templates/>
3536
4267
  </fo:inline>
3537
4268
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4269
+ <xsl:param name="split_keep-within-line"/>
3538
4270
  <fo:inline font-weight="bold">
3539
4271
 
3540
- <xsl:apply-templates/>
4272
+ <xsl:apply-templates>
4273
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4274
+ </xsl:apply-templates>
3541
4275
  </fo:inline>
3542
4276
  </xsl:template><xsl:template match="*[local-name()='padding']">
3543
4277
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3558,7 +4292,7 @@
3558
4292
 
3559
4293
 
3560
4294
  10
3561
-
4295
+ <!-- 10 -->
3562
4296
 
3563
4297
 
3564
4298
 
@@ -3576,13 +4310,15 @@
3576
4310
  <xsl:choose>
3577
4311
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3578
4312
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3579
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4313
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3580
4314
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3581
4315
  </xsl:choose>
3582
4316
  </xsl:attribute>
3583
4317
  </xsl:if>
3584
4318
  <xsl:apply-templates/>
3585
4319
  </fo:inline>
4320
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4321
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3586
4322
  </xsl:template><xsl:template match="*[local-name()='underline']">
3587
4323
  <fo:inline text-decoration="underline">
3588
4324
  <xsl:apply-templates/>
@@ -3730,54 +4466,120 @@
3730
4466
  <fo:block break-after="page"/>
3731
4467
  <fo:block> </fo:block>
3732
4468
  <fo:block break-after="page"/>
4469
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
4470
+ <xsl:apply-templates/>
3733
4471
  </xsl:template><xsl:template name="tokenize">
3734
4472
  <xsl:param name="text"/>
3735
4473
  <xsl:param name="separator" select="' '"/>
3736
4474
  <xsl:choose>
4475
+
4476
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4477
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4478
+ </xsl:when>
3737
4479
  <xsl:when test="not(contains($text, $separator))">
3738
4480
  <word>
3739
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3740
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3741
4481
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3742
- <xsl:variable name="len_str">
3743
- <xsl:choose>
3744
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3745
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3746
- </xsl:when>
3747
- <xsl:otherwise>
3748
- <xsl:value-of select="$len_str_tmp"/>
3749
- </xsl:otherwise>
3750
- </xsl:choose>
3751
- </xsl:variable>
3752
-
3753
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3754
- <xsl:message>
3755
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3756
- len_str=<xsl:value-of select="$len_str"/>
3757
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3758
- </xsl:message>
3759
- </xsl:if> -->
3760
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3761
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3762
4482
  <xsl:choose>
3763
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3764
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4483
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
4484
+ <xsl:value-of select="$len_str_tmp"/>
3765
4485
  </xsl:when>
3766
4486
  <xsl:otherwise>
3767
- <xsl:value-of select="$len_str"/>
4487
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4488
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4489
+ <xsl:variable name="len_str">
4490
+ <xsl:choose>
4491
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4492
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
4493
+ </xsl:when>
4494
+ <xsl:otherwise>
4495
+ <xsl:value-of select="$len_str_tmp"/>
4496
+ </xsl:otherwise>
4497
+ </xsl:choose>
4498
+ </xsl:variable>
4499
+
4500
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4501
+ <xsl:message>
4502
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4503
+ len_str=<xsl:value-of select="$len_str"/>
4504
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4505
+ </xsl:message>
4506
+ </xsl:if> -->
4507
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4508
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
4509
+ <xsl:choose>
4510
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4511
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4512
+ </xsl:when>
4513
+ <xsl:otherwise>
4514
+ <xsl:value-of select="$len_str"/>
4515
+ </xsl:otherwise>
4516
+ </xsl:choose>
3768
4517
  </xsl:otherwise>
3769
4518
  </xsl:choose>
3770
4519
  </word>
3771
4520
  </xsl:when>
3772
4521
  <xsl:otherwise>
3773
4522
  <word>
3774
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4523
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4524
+ <xsl:choose>
4525
+ <xsl:when test="$isGenerateTableIF = 'true'">
4526
+ <xsl:value-of select="$word"/>
4527
+ </xsl:when>
4528
+ <xsl:otherwise>
4529
+ <xsl:value-of select="string-length($word)"/>
4530
+ </xsl:otherwise>
4531
+ </xsl:choose>
3775
4532
  </word>
3776
4533
  <xsl:call-template name="tokenize">
3777
4534
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3778
4535
  </xsl:call-template>
3779
4536
  </xsl:otherwise>
3780
4537
  </xsl:choose>
4538
+ </xsl:template><xsl:template name="tokenize_with_tags">
4539
+ <xsl:param name="tags"/>
4540
+ <xsl:param name="text"/>
4541
+ <xsl:param name="separator" select="' '"/>
4542
+ <xsl:choose>
4543
+
4544
+ <xsl:when test="not(contains($text, $separator))">
4545
+ <word>
4546
+ <xsl:call-template name="enclose_text_in_tags">
4547
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4548
+ <xsl:with-param name="tags" select="$tags"/>
4549
+ </xsl:call-template>
4550
+ </word>
4551
+ </xsl:when>
4552
+ <xsl:otherwise>
4553
+ <word>
4554
+ <xsl:call-template name="enclose_text_in_tags">
4555
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4556
+ <xsl:with-param name="tags" select="$tags"/>
4557
+ </xsl:call-template>
4558
+ </word>
4559
+ <xsl:call-template name="tokenize_with_tags">
4560
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4561
+ </xsl:call-template>
4562
+ </xsl:otherwise>
4563
+ </xsl:choose>
4564
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4565
+ <xsl:param name="text"/>
4566
+ <xsl:param name="tags"/>
4567
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4568
+
4569
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4570
+
4571
+ <xsl:choose>
4572
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4573
+ <xsl:otherwise>
4574
+ <xsl:element name="{$tag_name}">
4575
+ <xsl:call-template name="enclose_text_in_tags">
4576
+ <xsl:with-param name="text" select="$text"/>
4577
+ <xsl:with-param name="tags" select="$tags"/>
4578
+ <xsl:with-param name="num" select="$num + 1"/>
4579
+ </xsl:call-template>
4580
+ </xsl:element>
4581
+ </xsl:otherwise>
4582
+ </xsl:choose>
3781
4583
  </xsl:template><xsl:template name="max_length">
3782
4584
  <xsl:param name="words"/>
3783
4585
  <xsl:for-each select="$words//word">
@@ -3878,12 +4680,19 @@
3878
4680
  </xsl:otherwise>
3879
4681
  </xsl:choose>
3880
4682
  </xsl:template><xsl:template name="getSimpleTable">
4683
+ <xsl:param name="id"/>
4684
+
3881
4685
  <xsl:variable name="simple-table">
3882
4686
 
4687
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4688
+ <xsl:variable name="table_without_br">
4689
+ <xsl:apply-templates mode="table-without-br"/>
4690
+ </xsl:variable>
4691
+
3883
4692
  <!-- Step 1. colspan processing -->
3884
4693
  <xsl:variable name="simple-table-colspan">
3885
4694
  <tbody>
3886
- <xsl:apply-templates mode="simple-table-colspan"/>
4695
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3887
4696
  </tbody>
3888
4697
  </xsl:variable>
3889
4698
 
@@ -3892,10 +4701,67 @@
3892
4701
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3893
4702
  </xsl:variable>
3894
4703
 
3895
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3896
-
4704
+ <!-- Step 3: add id to each cell -->
4705
+ <!-- add <word>...</word> for each word, image, math -->
4706
+ <xsl:variable name="simple-table-id">
4707
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4708
+ <xsl:with-param name="id" select="$id"/>
4709
+ </xsl:apply-templates>
4710
+ </xsl:variable>
4711
+
4712
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4713
+
3897
4714
  </xsl:variable>
3898
4715
  <xsl:copy-of select="$simple-table"/>
4716
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4717
+ <xsl:copy>
4718
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4719
+ </xsl:copy>
4720
+ </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">
4721
+ <xsl:copy>
4722
+ <xsl:copy-of select="@*"/>
4723
+ <p>
4724
+ <xsl:copy-of select="node()"/>
4725
+ </p>
4726
+ </xsl:copy>
4727
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4728
+ <xsl:copy>
4729
+ <xsl:copy-of select="@*"/>
4730
+ <xsl:for-each select="*[local-name()='br']">
4731
+ <xsl:variable name="current_id" select="generate-id()"/>
4732
+ <p>
4733
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4734
+ <xsl:copy-of select="."/>
4735
+ </xsl:for-each>
4736
+ </p>
4737
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4738
+ <p>
4739
+ <xsl:for-each select="following-sibling::node()">
4740
+ <xsl:copy-of select="."/>
4741
+ </xsl:for-each>
4742
+ </p>
4743
+ </xsl:if>
4744
+ </xsl:for-each>
4745
+ </xsl:copy>
4746
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4747
+ <xsl:for-each select="*[local-name()='br']">
4748
+ <xsl:variable name="current_id" select="generate-id()"/>
4749
+ <p>
4750
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4751
+ <xsl:copy-of select="."/>
4752
+ </xsl:for-each>
4753
+ </p>
4754
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4755
+ <p>
4756
+ <xsl:for-each select="following-sibling::node()">
4757
+ <xsl:copy-of select="."/>
4758
+ </xsl:for-each>
4759
+ </p>
4760
+ </xsl:if>
4761
+ </xsl:for-each>
4762
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4763
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4764
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3899
4765
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3900
4766
  <xsl:apply-templates mode="simple-table-colspan"/>
3901
4767
  </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">
@@ -3985,6 +4851,126 @@
3985
4851
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3986
4852
  <xsl:with-param name="previousRow" select="$newRow"/>
3987
4853
  </xsl:apply-templates>
4854
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4855
+ <xsl:param name="id"/>
4856
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4857
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4858
+ <xsl:with-param name="id" select="$id_prefixed"/>
4859
+ </xsl:apply-templates>
4860
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4861
+ <xsl:param name="id"/>
4862
+ <xsl:copy>
4863
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4864
+ <xsl:with-param name="id" select="$id"/>
4865
+ </xsl:apply-templates>
4866
+ </xsl:copy>
4867
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4868
+ <xsl:param name="id"/>
4869
+ <xsl:copy>
4870
+ <xsl:copy-of select="@*"/>
4871
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4872
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4873
+ <xsl:with-param name="id" select="$id"/>
4874
+ </xsl:apply-templates>
4875
+ </xsl:copy>
4876
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4877
+ <xsl:param name="id"/>
4878
+ <xsl:copy>
4879
+ <xsl:copy-of select="@*"/>
4880
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4881
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4882
+ <xsl:attribute name="id">
4883
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4884
+ </xsl:attribute>
4885
+
4886
+ <xsl:for-each select="*[local-name() = 'p']">
4887
+ <xsl:copy>
4888
+ <xsl:copy-of select="@*"/>
4889
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4890
+ <xsl:attribute name="id">
4891
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4892
+ </xsl:attribute>
4893
+
4894
+ <xsl:copy-of select="node()"/>
4895
+ </xsl:copy>
4896
+ </xsl:for-each>
4897
+
4898
+
4899
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4900
+
4901
+ <xsl:variable name="td_text">
4902
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4903
+ </xsl:variable>
4904
+
4905
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4906
+
4907
+ <xsl:variable name="words">
4908
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4909
+ <word>
4910
+ <xsl:copy-of select="."/>
4911
+ </word>
4912
+ </xsl:for-each>
4913
+
4914
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4915
+ <xsl:copy-of select="."/>
4916
+ </xsl:for-each>
4917
+
4918
+ </xsl:variable>
4919
+
4920
+ <xsl:for-each select="xalan:nodeset($words)/word">
4921
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4922
+ <xsl:copy>
4923
+ <xsl:attribute name="id">
4924
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4925
+ </xsl:attribute>
4926
+ <xsl:copy-of select="node()"/>
4927
+ </xsl:copy>
4928
+ </xsl:for-each>
4929
+ </xsl:if>
4930
+ </xsl:copy>
4931
+
4932
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
4933
+ <xsl:copy>
4934
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
4935
+ </xsl:copy>
4936
+ </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">
4937
+ <xsl:variable name="formatting_tags">
4938
+ <xsl:call-template name="getFormattingTags"/>
4939
+ </xsl:variable>
4940
+ <word>
4941
+ <xsl:call-template name="enclose_text_in_tags">
4942
+ <xsl:with-param name="text" select="normalize-space(.)"/>
4943
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4944
+ </xsl:call-template>
4945
+ </word>
4946
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
4947
+
4948
+ <xsl:variable name="td_text" select="."/>
4949
+
4950
+ <xsl:variable name="string_with_added_zerospaces">
4951
+ <xsl:call-template name="add-zero-spaces-java">
4952
+ <xsl:with-param name="text" select="$td_text"/>
4953
+ </xsl:call-template>
4954
+ </xsl:variable>
4955
+
4956
+ <xsl:variable name="formatting_tags">
4957
+ <xsl:call-template name="getFormattingTags"/>
4958
+ </xsl:variable>
4959
+
4960
+ <!-- <word>text</word> -->
4961
+ <xsl:call-template name="tokenize_with_tags">
4962
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4963
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4964
+ </xsl:call-template>
4965
+ </xsl:template><xsl:template name="getFormattingTags">
4966
+ <tags>
4967
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
4968
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
4969
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
4970
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
4971
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
4972
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
4973
+ </tags>
3988
4974
  </xsl:template><xsl:template name="getLang">
3989
4975
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3990
4976
  <xsl:variable name="language">
@@ -4039,6 +5025,9 @@
4039
5025
  <xsl:variable name="isDeleted" select="@deleted"/>
4040
5026
 
4041
5027
  <fo:inline xsl:use-attribute-sets="mathml-style">
5028
+
5029
+
5030
+
4042
5031
 
4043
5032
 
4044
5033
  <xsl:call-template name="setTrackChangesStyles">
@@ -4046,48 +5035,80 @@
4046
5035
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4047
5036
  </xsl:call-template>
4048
5037
 
5038
+ <xsl:if test="$add_math_as_text = 'true'">
5039
+ <!-- insert helper tag -->
5040
+ <!-- set unique font-size (fiction) -->
5041
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
5042
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
5043
+ </xsl:if>
4049
5044
 
4050
-
4051
- <xsl:variable name="mathml">
4052
- <xsl:apply-templates select="." mode="mathml"/>
5045
+ <xsl:variable name="mathml_content">
5046
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4053
5047
  </xsl:variable>
4054
- <fo:instream-foreign-object fox:alt-text="Math">
4055
5048
 
5049
+
5050
+ <xsl:call-template name="mathml_instream_object">
5051
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
5052
+ </xsl:call-template>
4056
5053
 
4057
-
4058
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4059
- <xsl:variable name="comment_text_">
4060
- <xsl:choose>
4061
- <xsl:when test="normalize-space($comment_text_following) != ''">
4062
- <xsl:value-of select="$comment_text_following"/>
4063
- </xsl:when>
4064
- <xsl:otherwise>
4065
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4066
- </xsl:otherwise>
4067
- </xsl:choose>
4068
- </xsl:variable>
4069
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4070
-
4071
- <xsl:if test="normalize-space($comment_text) != ''">
4072
- <!-- put Mathin Alternate Text -->
4073
- <xsl:attribute name="fox:alt-text">
4074
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4075
- </xsl:attribute>
4076
- </xsl:if>
4077
-
4078
- <xsl:variable name="mathml_content">
4079
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4080
- </xsl:variable>
4081
- <!-- put MathML in Actual Text -->
4082
- <xsl:attribute name="fox:actual-text">
4083
- <xsl:value-of select="$mathml_content"/>
4084
- </xsl:attribute>
4085
-
4086
-
4087
-
4088
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4089
- </fo:instream-foreign-object>
5054
+
4090
5055
  </fo:inline>
5056
+ </xsl:template><xsl:template name="getMathml_comment_text">
5057
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5058
+ <xsl:variable name="comment_text_">
5059
+ <xsl:choose>
5060
+ <xsl:when test="normalize-space($comment_text_following) != ''">
5061
+ <xsl:value-of select="$comment_text_following"/>
5062
+ </xsl:when>
5063
+ <xsl:otherwise>
5064
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5065
+ </xsl:otherwise>
5066
+ </xsl:choose>
5067
+ </xsl:variable>
5068
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5069
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
5070
+ <xsl:value-of select="$comment_text"/>
5071
+ </xsl:template><xsl:template name="mathml_instream_object">
5072
+ <xsl:param name="comment_text"/>
5073
+ <xsl:param name="mathml_content"/>
5074
+
5075
+ <xsl:variable name="comment_text_">
5076
+ <xsl:choose>
5077
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5078
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5079
+ </xsl:choose>
5080
+ </xsl:variable>
5081
+
5082
+ <xsl:variable name="mathml">
5083
+ <xsl:apply-templates select="." mode="mathml"/>
5084
+ </xsl:variable>
5085
+
5086
+ <fo:instream-foreign-object fox:alt-text="Math">
5087
+
5088
+
5089
+
5090
+
5091
+
5092
+
5093
+
5094
+ <!-- put MathML in Actual Text -->
5095
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5096
+ <xsl:attribute name="fox:actual-text">
5097
+ <xsl:value-of select="$mathml_content"/>
5098
+ </xsl:attribute>
5099
+
5100
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5101
+ <xsl:if test="normalize-space($comment_text_) != ''">
5102
+ <!-- put Mathin Alternate Text -->
5103
+ <xsl:attribute name="fox:alt-text">
5104
+ <xsl:value-of select="$comment_text_"/>
5105
+ </xsl:attribute>
5106
+ </xsl:if>
5107
+ <!-- </xsl:if> -->
5108
+
5109
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
5110
+
5111
+ </fo:instream-foreign-object>
4091
5112
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4092
5113
  <!-- <xsl:text>a+b</xsl:text> -->
4093
5114
  <xsl:text>&lt;</xsl:text>
@@ -4118,7 +5139,9 @@
4118
5139
  <!-- replace start and end spaces to non-break space -->
4119
5140
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4120
5141
  </xsl:copy>
4121
- </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
5142
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="mathml:mtd/mathml:mo/text()[. = '/']" mode="mathml">
5143
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5144
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4122
5145
  <xsl:variable name="target">
4123
5146
  <xsl:choose>
4124
5147
  <xsl:when test="@updatetype = 'true'">
@@ -4713,18 +5736,33 @@
4713
5736
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4714
5737
  <xsl:copy>
4715
5738
  <xsl:apply-templates select="@*" mode="svg_update"/>
4716
- <xsl:variable name="viewbox">
5739
+ <xsl:variable name="viewbox_">
4717
5740
  <xsl:call-template name="split">
4718
5741
  <xsl:with-param name="pText" select="@viewBox"/>
4719
5742
  <xsl:with-param name="sep" select="' '"/>
4720
5743
  </xsl:call-template>
4721
5744
  </xsl:variable>
5745
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5746
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5747
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5748
+
4722
5749
  <xsl:attribute name="width">
4723
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5750
+ <xsl:choose>
5751
+ <xsl:when test="$width != ''">
5752
+ <xsl:value-of select="round($width)"/>
5753
+ </xsl:when>
5754
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5755
+ </xsl:choose>
4724
5756
  </xsl:attribute>
4725
5757
  <xsl:attribute name="height">
4726
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5758
+ <xsl:choose>
5759
+ <xsl:when test="$height != ''">
5760
+ <xsl:value-of select="round($height)"/>
5761
+ </xsl:when>
5762
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5763
+ </xsl:choose>
4727
5764
  </xsl:attribute>
5765
+
4728
5766
  <xsl:apply-templates mode="svg_update"/>
4729
5767
  </xsl:copy>
4730
5768
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4919,7 +5957,11 @@
4919
5957
  <xsl:apply-templates mode="bookmarks"/>
4920
5958
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4921
5959
  <xsl:apply-templates select="."/>
4922
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5960
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'span']" mode="contents">
5961
+ <xsl:apply-templates mode="contents"/>
5962
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5963
+ <xsl:apply-templates mode="bookmarks"/>
5964
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
4923
5965
  <xsl:apply-templates mode="bookmarks"/>
4924
5966
  </xsl:template><xsl:template name="addBookmarks">
4925
5967
  <xsl:param name="contents"/>
@@ -5201,7 +6243,9 @@
5201
6243
  <xsl:apply-templates/>
5202
6244
  </xsl:otherwise>
5203
6245
  </xsl:choose>
5204
- </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() = 'tab']" mode="contents_item">
6246
+ </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">
6247
+ <xsl:value-of select="."/>
6248
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5205
6249
  <xsl:text> </xsl:text>
5206
6250
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5207
6251
  <xsl:copy>
@@ -5232,9 +6276,22 @@
5232
6276
  </xsl:when>
5233
6277
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5234
6278
  </xsl:choose>
6279
+ </xsl:template><xsl:template match="text()" mode="contents_item">
6280
+ <xsl:call-template name="keep_together_standard_number"/>
6281
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
6282
+ <xsl:apply-templates mode="contents_item"/>
5235
6283
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5236
6284
 
5237
6285
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6286
+
6287
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6288
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6289
+ </xsl:if>
6290
+
6291
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6292
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6293
+ </xsl:if>
6294
+
5238
6295
  <xsl:copy-of select="@id"/>
5239
6296
 
5240
6297
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5259,7 +6316,7 @@
5259
6316
 
5260
6317
 
5261
6318
  10
5262
-
6319
+ <!-- 9 -->
5263
6320
 
5264
6321
 
5265
6322
 
@@ -5343,7 +6400,7 @@
5343
6400
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5344
6401
  <xsl:choose>
5345
6402
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5346
- <xsl:call-template name="interspers">
6403
+ <xsl:call-template name="interspers-java">
5347
6404
  <xsl:with-param name="str" select="."/>
5348
6405
  </xsl:call-template>
5349
6406
  </xsl:when>
@@ -5393,6 +6450,10 @@
5393
6450
  <xsl:with-param name="char" select="$char"/>
5394
6451
  </xsl:call-template>
5395
6452
  </xsl:if>
6453
+ </xsl:template><xsl:template name="interspers-java">
6454
+ <xsl:param name="str"/>
6455
+ <xsl:param name="char" select="$zero_width_space"/>
6456
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
5396
6457
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5397
6458
  <xsl:apply-templates mode="syntax_highlight"/>
5398
6459
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5605,7 +6666,9 @@
5605
6666
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5606
6667
  </xsl:if>
5607
6668
  <xsl:variable name="simple-table">
5608
- <xsl:call-template name="getSimpleTable"/>
6669
+ <xsl:call-template name="getSimpleTable">
6670
+ <xsl:with-param name="id" select="@id"/>
6671
+ </xsl:call-template>
5609
6672
  </xsl:variable>
5610
6673
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5611
6674
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -5712,39 +6775,67 @@
5712
6775
  </xsl:otherwise>
5713
6776
  </xsl:choose>
5714
6777
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5715
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5716
-
6778
+
6779
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
6780
+
5717
6781
 
6782
+
5718
6783
  <xsl:variable name="fo_element">
5719
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6784
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5720
6785
  block
5721
6786
  </xsl:variable>
5722
6787
 
5723
- <!-- display 'EXAMPLE' -->
5724
- <xsl:apply-templates select="*[local-name()='name']">
5725
- <xsl:with-param name="fo_element" select="$fo_element"/>
5726
- </xsl:apply-templates>
6788
+ <fo:block-container margin-left="0mm">
5727
6789
 
5728
- <xsl:choose>
5729
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5730
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5731
- <fo:block-container margin-left="0mm" margin-right="0mm">
5732
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6790
+ <xsl:choose>
6791
+
6792
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6793
+
6794
+ <!-- display name 'EXAMPLE' in a separate block -->
6795
+ <fo:block>
6796
+ <xsl:apply-templates select="*[local-name()='name']">
5733
6797
  <xsl:with-param name="fo_element" select="$fo_element"/>
5734
6798
  </xsl:apply-templates>
6799
+ </fo:block>
6800
+
6801
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6802
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6803
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6804
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6805
+ </xsl:apply-templates>
6806
+ </fo:block-container>
5735
6807
  </fo:block-container>
5736
- </fo:block-container>
5737
- </xsl:when>
5738
- <xsl:otherwise>
5739
- <fo:inline>
5740
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5741
- <xsl:with-param name="fo_element" select="$fo_element"/>
5742
- </xsl:apply-templates>
5743
- </fo:inline>
5744
- </xsl:otherwise>
5745
- </xsl:choose>
5746
-
5747
- </fo:block>
6808
+ </xsl:when> <!-- end block -->
6809
+
6810
+ <xsl:otherwise> <!-- inline -->
6811
+
6812
+ <!-- display 'EXAMPLE' and first element in the same line -->
6813
+ <fo:block>
6814
+ <xsl:apply-templates select="*[local-name()='name']">
6815
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6816
+ </xsl:apply-templates>
6817
+ <fo:inline>
6818
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
6819
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6820
+ </xsl:apply-templates>
6821
+ </fo:inline>
6822
+ </fo:block>
6823
+
6824
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
6825
+ <!-- display further elements in blocks -->
6826
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6827
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6828
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
6829
+ <xsl:with-param name="fo_element" select="'block'"/>
6830
+ </xsl:apply-templates>
6831
+ </fo:block-container>
6832
+ </fo:block-container>
6833
+ </xsl:if>
6834
+ </xsl:otherwise> <!-- end inline -->
6835
+
6836
+ </xsl:choose>
6837
+ </fo:block-container>
6838
+ </fo:block-container>
5748
6839
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5749
6840
  <xsl:param name="fo_element">block</xsl:param>
5750
6841
 
@@ -5776,10 +6867,16 @@
5776
6867
  </xsl:variable>
5777
6868
  <xsl:choose>
5778
6869
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5779
- <fo:block xsl:use-attribute-sets="example-p-style">
5780
-
5781
- <xsl:apply-templates/>
5782
- </fo:block>
6870
+ <fo:block-container>
6871
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
6872
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6873
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6874
+ </xsl:if>
6875
+ <fo:block xsl:use-attribute-sets="example-p-style">
6876
+
6877
+ <xsl:apply-templates/>
6878
+ </fo:block>
6879
+ </fo:block-container>
5783
6880
  </xsl:when>
5784
6881
  <xsl:otherwise>
5785
6882
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -5961,7 +7058,16 @@
5961
7058
  </fo:inline>
5962
7059
  </xsl:when>
5963
7060
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5964
- <fo:inline><xsl:apply-templates/></fo:inline>
7061
+
7062
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
7063
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
7064
+ <xsl:choose>
7065
+ <xsl:when test="$uri_src != ''">
7066
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
7067
+ </xsl:when>
7068
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
7069
+ </xsl:choose>
7070
+
5965
7071
  </xsl:otherwise>
5966
7072
  </xsl:choose>
5967
7073
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -6133,10 +7239,24 @@
6133
7239
 
6134
7240
  </fo:block>
6135
7241
  <xsl:apply-templates/>
6136
- </xsl:template><xsl:template match="*[local-name() = 'review']">
7242
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
6137
7243
  <!-- comment 2019-11-29 -->
6138
7244
  <!-- <fo:block font-weight="bold">Review:</fo:block>
6139
7245
  <xsl:apply-templates /> -->
7246
+
7247
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
7248
+
7249
+ <xsl:choose>
7250
+ <!-- if there isn't the attribute '@from', then -->
7251
+ <xsl:when test="$id_from = ''">
7252
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7253
+ </xsl:when>
7254
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
7255
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
7256
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7257
+ </xsl:when>
7258
+ </xsl:choose>
7259
+
6140
7260
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6141
7261
  <!-- 0xA0 to space replacement -->
6142
7262
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6281,6 +7401,11 @@
6281
7401
  </xsl:otherwise>
6282
7402
  </xsl:choose>
6283
7403
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7404
+
7405
+ <xsl:apply-templates select="*[local-name() = 'name']">
7406
+ <xsl:with-param name="process">true</xsl:with-param>
7407
+ </xsl:apply-templates>
7408
+
6284
7409
  <fo:list-block xsl:use-attribute-sets="list-style">
6285
7410
 
6286
7411
 
@@ -6291,12 +7416,23 @@
6291
7416
 
6292
7417
 
6293
7418
 
7419
+ <xsl:if test="*[local-name() = 'name']">
7420
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7421
+ </xsl:if>
7422
+
6294
7423
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6295
7424
  </fo:list-block>
6296
7425
  <!-- <xsl:for-each select="./iho:note">
6297
7426
  <xsl:call-template name="note"/>
6298
7427
  </xsl:for-each> -->
6299
7428
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
7429
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
7430
+ <xsl:param name="process">false</xsl:param>
7431
+ <xsl:if test="$process = 'true'">
7432
+ <fo:block xsl:use-attribute-sets="list-name-style">
7433
+ <xsl:apply-templates/>
7434
+ </fo:block>
7435
+ </xsl:if>
6300
7436
  </xsl:template><xsl:template match="*[local-name()='li']">
6301
7437
  <fo:list-item xsl:use-attribute-sets="list-item-style">
6302
7438
  <xsl:copy-of select="@id"/>
@@ -6493,7 +7629,10 @@
6493
7629
  <!-- to split by '_' and other chars -->
6494
7630
  <xsl:call-template name="add-zero-spaces-java"/>
6495
7631
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6496
- <fo:inline id="{@id}" font-size="1pt"/>
7632
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7633
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7634
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7635
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6497
7636
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6498
7637
  <!-- <row>
6499
7638
  <date>05-07-2013</date>
@@ -6562,9 +7701,9 @@
6562
7701
  <fo:inline>
6563
7702
 
6564
7703
  <xsl:value-of select="*[local-name() = 'docidentifier'][@type = 'metanorma-ordinal']"/>
6565
- <xsl:if test="not(*[local-name() = 'docidentifier'][@type = 'metanorma-ordinal'])">
6566
- <xsl:number format="[1]"/>
6567
- </xsl:if>
7704
+ <xsl:if test="not(*[local-name() = 'docidentifier'][@type = 'metanorma-ordinal'])">
7705
+ <xsl:number format="[1]"/>
7706
+ </xsl:if>
6568
7707
 
6569
7708
  </fo:inline>
6570
7709
  </fo:block>
@@ -6588,107 +7727,7 @@
6588
7727
 
6589
7728
 
6590
7729
  <!-- start IHO bibitem processing -->
6591
- <!-- IHO documents:
6592
- "[1] S57 edition 3.1: IHO Transfer Standard for Digital Hydrographic Data, International Hydrographic Organization (www.iho.int)”
6593
- [{number}] {docID} edition {edition}: {title}, {author/organization}
6594
- Non-IHO documents:
6595
- Provide title and publisher -->
6596
- <xsl:choose>
6597
- <xsl:when test="iho:formattedref">
6598
- <xsl:apply-templates select="iho:formattedref"/>
6599
- </xsl:when>
6600
- <xsl:otherwise>
6601
- <xsl:choose>
6602
- <!-- IHO documents -->
6603
- <!-- {docID} edition {edition}: {title}, {author/organization} -->
6604
- <xsl:when test="iho:docidentifier[1]/@type='IHO'">
6605
- <xsl:value-of select="iho:docidentifier[1]"/>
6606
- <xsl:apply-templates select="iho:edition"/>
6607
- <xsl:if test="iho:title or iho:contributor or iho:url">
6608
- <xsl:text>: </xsl:text>
6609
- </xsl:if>
6610
- </xsl:when>
6611
-
6612
- <!-- Non-IHO documents -->
6613
- <!-- title and publisher -->
6614
- <xsl:otherwise>
6615
- <xsl:variable name="docID">
6616
- <xsl:call-template name="processBibitemDocId"/>
6617
- </xsl:variable>
6618
- <xsl:value-of select="normalize-space($docID)"/>
6619
- <xsl:if test="normalize-space($docID) != ''"><xsl:text>: </xsl:text></xsl:if>
6620
- </xsl:otherwise>
6621
- </xsl:choose>
6622
-
6623
- <xsl:choose>
6624
- <xsl:when test="iho:title[@type = 'main' and @language = 'en']">
6625
- <xsl:apply-templates select="iho:title[@type = 'main' and @language = 'en']"/>
6626
- </xsl:when>
6627
- <xsl:otherwise>
6628
- <xsl:apply-templates select="iho:title"/>
6629
- </xsl:otherwise>
6630
- </xsl:choose>
6631
-
6632
- <xsl:if test="iho:title and iho:contributor">
6633
- <xsl:text>, </xsl:text>
6634
- </xsl:if>
6635
-
6636
- <xsl:variable name="authors">
6637
- <xsl:choose>
6638
- <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6639
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6640
- <xsl:copy-of select="."/>
6641
- </xsl:for-each>
6642
- </xsl:when>
6643
- <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
6644
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
6645
- <xsl:copy-of select="."/>
6646
- </xsl:for-each>
6647
- </xsl:when>
6648
- <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
6649
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
6650
- <xsl:copy>
6651
- <xsl:choose>
6652
- <xsl:when test="position() != 1 and position() != last()">, </xsl:when>
6653
- <xsl:when test="position() != 1 and position() = last()"> and </xsl:when>
6654
- </xsl:choose>
6655
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6656
- </xsl:copy>
6657
- </xsl:for-each>
6658
- </xsl:when>
6659
- </xsl:choose>
6660
- </xsl:variable>
6661
-
6662
- <xsl:for-each select="xalan:nodeset($authors)/*">
6663
- <xsl:choose>
6664
- <xsl:when test="not(*[local-name() = 'role'])"><!-- publisher organisation -->
6665
- <xsl:value-of select="."/>
6666
- </xsl:when>
6667
- <xsl:otherwise> <!-- author, editor -->
6668
- <xsl:choose>
6669
- <xsl:when test="*[local-name() = 'organization']/*[local-name() = 'name']">
6670
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6671
- </xsl:when>
6672
- <xsl:otherwise>
6673
- <xsl:for-each select="*[local-name() = 'person']">
6674
- <xsl:variable name="author">
6675
- <xsl:call-template name="processPersonalAuthor"/>
6676
- </xsl:variable>
6677
- <xsl:value-of select="xalan:nodeset($author)/author"/>
6678
- </xsl:for-each>
6679
- </xsl:otherwise>
6680
- </xsl:choose>
6681
- </xsl:otherwise>
6682
- </xsl:choose>
6683
- <xsl:if test="*[local-name() = 'organization']/*[local-name() = 'name'] and position() != last()">
6684
- <xsl:text>, </xsl:text>
6685
- </xsl:if>
6686
- </xsl:for-each>
6687
-
6688
- <xsl:apply-templates select="*[local-name() = 'uri'][1]"/>
6689
-
6690
- </xsl:otherwise>
6691
- </xsl:choose>
7730
+ <xsl:apply-templates select="iho:formattedref"/>
6692
7731
  <!-- end IHO bibitem processing -->
6693
7732
 
6694
7733
  </xsl:template><xsl:template name="processBibitemDocId">
@@ -7011,25 +8050,32 @@
7011
8050
  </fo:block-container>
7012
8051
 
7013
8052
  </xsl:template><xsl:template name="displayAdmonitionName">
7014
-
8053
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
8054
+ <!-- <xsl:choose>
8055
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
8056
+ <xsl:choose>
8057
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
8058
+ <xsl:otherwise>
8059
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8060
+ </xsl:otherwise>
8061
+ </xsl:choose>
8062
+ </xsl:when>
8063
+ <xsl:otherwise>
7015
8064
  <xsl:apply-templates select="*[local-name() = 'name']"/>
7016
8065
  <xsl:if test="not(*[local-name() = 'name'])">
7017
8066
  <xsl:apply-templates select="@type"/>
7018
8067
  </xsl:if>
7019
-
7020
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7021
- <xsl:apply-templates/>
7022
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
7023
- <xsl:variable name="admonition_type_">
7024
- <xsl:call-template name="getLocalizedString">
7025
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
7026
- </xsl:call-template>
8068
+ </xsl:otherwise>
8069
+ </xsl:choose> -->
8070
+ <xsl:variable name="name">
8071
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7027
8072
  </xsl:variable>
7028
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
7029
- <xsl:value-of select="$admonition_type"/>
7030
- <xsl:if test="$admonition_type = ''">
7031
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
8073
+ <xsl:copy-of select="$name"/>
8074
+ <xsl:if test="normalize-space($name) != ''">
8075
+ <xsl:value-of select="$sep"/>
7032
8076
  </xsl:if>
8077
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
8078
+ <xsl:apply-templates/>
7033
8079
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
7034
8080
  <!-- processing for admonition/p found in the template for 'p' -->
7035
8081
  <xsl:call-template name="paragraph"/>
@@ -7106,6 +8152,120 @@
7106
8152
  <xsl:apply-templates select="." mode="update_xml_step1"/>
7107
8153
  </xsl:for-each>
7108
8154
  </xsl:copy>
8155
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
8156
+ <xsl:apply-templates mode="update_xml_step1"/>
8157
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
8158
+ <xsl:copy>
8159
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
8160
+ </xsl:copy>
8161
+ </xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable><xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8162
+
8163
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
8164
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
8165
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8166
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8167
+ <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
8168
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
8169
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8170
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8171
+ <xsl:with-param name="text" select="$text_"/>
8172
+ </xsl:call-template></text></xsl:variable>
8173
+
8174
+ <xsl:variable name="parent" select="local-name(..)"/>
8175
+
8176
+ <xsl:variable name="text2">
8177
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
8178
+ <xsl:copy-of select="."/>
8179
+ </xsl:for-each></text>
8180
+ </xsl:variable>
8181
+
8182
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
8183
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
8184
+ <xsl:variable name="text3">
8185
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
8186
+ <xsl:choose>
8187
+ <xsl:when test="self::text()">
8188
+ <xsl:variable name="text_units_" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
8189
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
8190
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8191
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8192
+ <xsl:with-param name="text" select="$text_units_"/>
8193
+ </xsl:call-template></text></xsl:variable>
8194
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
8195
+ </xsl:when>
8196
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8197
+ </xsl:choose>
8198
+ </xsl:for-each></text>
8199
+ </xsl:variable>
8200
+
8201
+ <xsl:choose>
8202
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
8203
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
8204
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
8205
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
8206
+ <xsl:choose>
8207
+ <xsl:when test="self::text()">
8208
+ <xsl:variable name="text_dots_" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
8209
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
8210
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8211
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8212
+ <xsl:with-param name="text" select="$text_dots_"/>
8213
+ </xsl:call-template></text></xsl:variable>
8214
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
8215
+ </xsl:when>
8216
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8217
+ </xsl:choose>
8218
+ </xsl:for-each>
8219
+ </xsl:when>
8220
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
8221
+ </xsl:choose>
8222
+
8223
+ </xsl:template><xsl:template name="replace_text_tags">
8224
+ <xsl:param name="tag_open"/>
8225
+ <xsl:param name="tag_close"/>
8226
+ <xsl:param name="text"/>
8227
+ <xsl:choose>
8228
+ <xsl:when test="contains($text, $tag_open)">
8229
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
8230
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
8231
+
8232
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
8233
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
8234
+ </xsl:element>
8235
+
8236
+ <xsl:call-template name="replace_text_tags">
8237
+ <xsl:with-param name="tag_open" select="$tag_open"/>
8238
+ <xsl:with-param name="tag_close" select="$tag_close"/>
8239
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
8240
+ </xsl:call-template>
8241
+ </xsl:when>
8242
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8243
+ </xsl:choose>
8244
+ </xsl:template><xsl:template name="printEdition">
8245
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8246
+ <xsl:text> </xsl:text>
8247
+ <xsl:choose>
8248
+ <xsl:when test="$edition_i18n != ''">
8249
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
8250
+ <xsl:call-template name="capitalize">
8251
+ <xsl:with-param name="str" select="$edition_i18n"/>
8252
+ </xsl:call-template>
8253
+ </xsl:when>
8254
+ <xsl:otherwise>
8255
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
8256
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
8257
+ <xsl:call-template name="capitalize">
8258
+ <xsl:with-param name="str">
8259
+ <xsl:call-template name="getLocalizedString">
8260
+ <xsl:with-param name="key">edition</xsl:with-param>
8261
+ </xsl:call-template>
8262
+ </xsl:with-param>
8263
+ </xsl:call-template>
8264
+ <xsl:text> </xsl:text>
8265
+ <xsl:value-of select="$edition"/>
8266
+ </xsl:if>
8267
+ </xsl:otherwise>
8268
+ </xsl:choose>
7109
8269
  </xsl:template><xsl:template name="convertDate">
7110
8270
  <xsl:param name="date"/>
7111
8271
  <xsl:param name="format" select="'short'"/>
@@ -7793,4 +8953,40 @@
7793
8953
  <xsl:value-of select="$value"/>
7794
8954
  </xsl:otherwise>
7795
8955
  </xsl:choose>
8956
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
8957
+ <xsl:param name="level">0</xsl:param>
8958
+
8959
+ <fo:block margin-left="{2*$level}mm">
8960
+ <xsl:text>
8961
+ &lt;</xsl:text>
8962
+ <xsl:value-of select="local-name()"/>
8963
+ <xsl:for-each select="@*">
8964
+ <xsl:text> </xsl:text>
8965
+ <xsl:value-of select="local-name()"/>
8966
+ <xsl:text>="</xsl:text>
8967
+ <xsl:value-of select="."/>
8968
+ <xsl:text>"</xsl:text>
8969
+ </xsl:for-each>
8970
+ <xsl:text>&gt;</xsl:text>
8971
+
8972
+ <xsl:if test="not(*)">
8973
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
8974
+ <xsl:text>&lt;/</xsl:text>
8975
+ <xsl:value-of select="local-name()"/>
8976
+ <xsl:text>&gt;</xsl:text>
8977
+ </xsl:if>
8978
+ </fo:block>
8979
+
8980
+ <xsl:if test="*">
8981
+ <fo:block>
8982
+ <xsl:apply-templates mode="print_as_xml">
8983
+ <xsl:with-param name="level" select="$level + 1"/>
8984
+ </xsl:apply-templates>
8985
+ </fo:block>
8986
+ <fo:block margin-left="{2*$level}mm">
8987
+ <xsl:text>&lt;/</xsl:text>
8988
+ <xsl:value-of select="local-name()"/>
8989
+ <xsl:text>&gt;</xsl:text>
8990
+ </fo:block>
8991
+ </xsl:if>
7796
8992
  </xsl:template></xsl:stylesheet>